summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-07-24 20:51:47 +0100
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-07-24 20:52:54 +0100
commit49cc929d0748fa62b42cef7b4dcfd372cafe891e (patch)
tree799ae959c4cd6fac8676c4e8a46685538d407a61
parenta4a7f84b08324245b9777c439beae3f7a8810568 (diff)
parent38d9178d358b860ac99bcefb1c65a6a2b6ec098d (diff)
downloadandroid_development-49cc929d0748fa62b42cef7b4dcfd372cafe891e.tar.gz
android_development-49cc929d0748fa62b42cef7b4dcfd372cafe891e.tar.bz2
android_development-49cc929d0748fa62b42cef7b4dcfd372cafe891e.zip
Merge tag 'android-4.3_r2.1' into cm-10.2
Android 4.3 release 2.1 Conflicts: ide/eclipse/.classpath sdk/plat_tools_source.properties Change-Id: I02498afb48cf3f128e55c50d197f6da92dbf342b
-rw-r--r--apps/Development/res/layout/connectivity.xml43
-rw-r--r--apps/Development/res/values/strings.xml3
-rw-r--r--apps/Development/src/com/android/development/BadBehaviorActivity.java4
-rw-r--r--apps/Development/src/com/android/development/Connectivity.java112
-rw-r--r--apps/Development/src/com/android/development/EnterURL.java310
-rw-r--r--apps/Development/src/com/android/development/InstrumentationList.java3
-rw-r--r--apps/FontLab/Android.mk10
-rw-r--r--apps/FontLab/AndroidManifest.xml13
-rw-r--r--apps/FontLab/MODULE_LICENSE_APACHE20
-rw-r--r--apps/FontLab/NOTICE190
-rw-r--r--apps/FontLab/src/com/android/fontlab/BackgroundPicker.java77
-rw-r--r--apps/FontLab/src/com/android/fontlab/FontLab.java372
-rw-r--r--apps/FontLab/src/com/android/fontlab/FontPicker.java74
-rw-r--r--build/Android.mk7
-rw-r--r--build/product_sdk.mk6
-rw-r--r--build/sdk-windows-x86.atree34
-rw-r--r--build/sdk.atree77
-rwxr-xr-xbuild/tools/mk_sdk_repo_xml.sh4
-rwxr-xr-xbuild/tools/patch_windows_sdk.sh1
-rw-r--r--build/tools/sdk_repo.mk67
-rw-r--r--build/tools/windows_sdk.mk4
-rw-r--r--build/windows_sdk_whitelist.mk (renamed from build/sdk_only_whitelist.mk)4
-rw-r--r--cmds/monkey/src/com/android/commands/monkey/Monkey.java55
-rw-r--r--cmds/monkey/src/com/android/commands/monkey/MonkeyActivityEvent.java2
-rw-r--r--cmds/monkey/src/com/android/commands/monkey/MonkeyInstrumentationEvent.java3
-rw-r--r--cmds/monkey/src/com/android/commands/monkey/MonkeySourceNetwork.java1
-rw-r--r--cmds/monkey/src/com/android/commands/monkey/MonkeySourceNetworkViews.java116
-rw-r--r--cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java116
-rw-r--r--ide/eclipse/.classpath11
-rw-r--r--ide/eclipse/android-include-paths.xml30
-rw-r--r--ide/eclipse/android-symbols.xml69
-rw-r--r--ndk/platforms/README.CRT.TXT2
-rw-r--r--ndk/platforms/android-14/arch-arm/symbols/libOpenSLES.so.functions.txt3
-rw-r--r--ndk/platforms/android-14/arch-x86/symbols/libOpenSLES.so.functions.txt3
-rw-r--r--ndk/platforms/android-18/arch-arm/symbols/libGLESv3.so.functions.txt263
-rw-r--r--ndk/platforms/android-18/arch-arm/symbols/libGLESv3.so.variables.txt1
-rw-r--r--ndk/platforms/android-18/arch-mips/symbols/libGLESv3.so.functions.txt263
-rw-r--r--ndk/platforms/android-18/arch-mips/symbols/libGLESv3.so.variables.txt1
-rw-r--r--ndk/platforms/android-18/arch-x86/symbols/libGLESv3.so.functions.txt263
-rw-r--r--ndk/platforms/android-18/arch-x86/symbols/libGLESv3.so.variables.txt1
-rw-r--r--ndk/platforms/android-18/include/GLES3/gl3.h1061
-rw-r--r--ndk/platforms/android-18/include/GLES3/gl3ext.h24
-rw-r--r--ndk/platforms/android-18/include/GLES3/gl3platform.h30
-rw-r--r--ndk/platforms/android-18/samples/gles3jni/AndroidManifest-11.xml (renamed from samples/BrowserPlugin/AndroidManifest.xml)33
-rw-r--r--ndk/platforms/android-18/samples/gles3jni/AndroidManifest-18.xml33
-rw-r--r--ndk/platforms/android-18/samples/gles3jni/README33
-rw-r--r--ndk/platforms/android-18/samples/gles3jni/jni/Android-11.mk (renamed from tools/emulator/system/sensors/Android.mk)23
-rw-r--r--ndk/platforms/android-18/samples/gles3jni/jni/Android-18.mk (renamed from tools/emulator/system/qemu-props/Android.mk)24
-rw-r--r--ndk/platforms/android-18/samples/gles3jni/jni/RendererES2.cpp142
-rw-r--r--ndk/platforms/android-18/samples/gles3jni/jni/RendererES3.cpp165
-rw-r--r--ndk/platforms/android-18/samples/gles3jni/jni/gl3stub.c342
-rw-r--r--ndk/platforms/android-18/samples/gles3jni/jni/gl3stub.h491
-rw-r--r--ndk/platforms/android-18/samples/gles3jni/jni/gles3jni.cpp284
-rw-r--r--ndk/platforms/android-18/samples/gles3jni/jni/gles3jni.h108
-rw-r--r--ndk/platforms/android-18/samples/gles3jni/res/values/strings.xml24
-rw-r--r--ndk/platforms/android-18/samples/gles3jni/src/com/android/gles3jni/GLES3JNIActivity.java45
-rw-r--r--ndk/platforms/android-18/samples/gles3jni/src/com/android/gles3jni/GLES3JNILib.java (renamed from samples/BrowserPlugin/res/values/strings.xml)25
-rw-r--r--ndk/platforms/android-18/samples/gles3jni/src/com/android/gles3jni/GLES3JNIView.java59
-rw-r--r--ndk/platforms/android-3/arch-arm/include/asm/socket.h40
-rw-r--r--ndk/platforms/android-3/arch-arm/include/asm/unistd.h189
-rw-r--r--ndk/platforms/android-3/arch-arm/include/fenv.h260
-rw-r--r--ndk/platforms/android-3/arch-arm/include/machine/_types.h17
-rw-r--r--ndk/platforms/android-3/arch-arm/include/machine/endian.h89
-rw-r--r--ndk/platforms/android-3/arch-arm/lib-bootstrap/crtbegin_dynamic.obin0 -> 1796 bytes
-rw-r--r--ndk/platforms/android-3/arch-arm/lib-bootstrap/crtend_android.obin0 -> 760 bytes
-rwxr-xr-xndk/platforms/android-3/arch-arm/lib-bootstrap/libc.sobin0 -> 74816 bytes
-rwxr-xr-xndk/platforms/android-3/arch-arm/lib-bootstrap/libdl.sobin0 -> 5188 bytes
-rw-r--r--ndk/platforms/android-3/arch-arm/symbols/libc.so.functions.txt1
-rw-r--r--ndk/platforms/android-3/include/asm-generic/mman-common.h60
-rw-r--r--ndk/platforms/android-3/include/asm-generic/mman.h58
-rw-r--r--ndk/platforms/android-3/include/asm-generic/pgtable-nopmd.h48
-rw-r--r--ndk/platforms/android-3/include/asm-generic/socket.h81
-rw-r--r--ndk/platforms/android-3/include/asm-generic/swab.h (renamed from ndk/platforms/android-9/arch-mips/include/asm/asmmacro.h)12
-rw-r--r--ndk/platforms/android-3/include/byteswap.h3
-rw-r--r--ndk/platforms/android-3/include/dirent.h35
-rw-r--r--ndk/platforms/android-3/include/elf.h15
-rw-r--r--ndk/platforms/android-3/include/errno.h14
-rw-r--r--ndk/platforms/android-3/include/limits.h17
-rw-r--r--ndk/platforms/android-3/include/linux/icmp.h2
-rw-r--r--ndk/platforms/android-3/include/linux/stddef.h19
-rw-r--r--ndk/platforms/android-3/include/linux/sysctl.h2
-rw-r--r--ndk/platforms/android-3/include/pthread.h5
-rw-r--r--ndk/platforms/android-3/include/resolv.h1
-rw-r--r--ndk/platforms/android-3/include/stdint.h6
-rw-r--r--ndk/platforms/android-3/include/stdio.h25
-rw-r--r--ndk/platforms/android-3/include/sys/endian.h1
-rw-r--r--ndk/platforms/android-3/include/sys/limits.h3
-rw-r--r--ndk/platforms/android-3/include/sys/sysconf.h3
-rw-r--r--ndk/platforms/android-3/include/sys/types.h6
-rw-r--r--ndk/platforms/android-3/include/wchar.h2
-rw-r--r--ndk/platforms/android-4/samples/san-angeles/jni/app-android.c51
-rw-r--r--ndk/platforms/android-4/samples/san-angeles/src/com/example/SanAngeles/DemoActivity.java17
-rw-r--r--ndk/platforms/android-5/arch-arm/symbols/libc.so.functions.txt1
-rw-r--r--ndk/platforms/android-5/include/GLES2/gl2.h4
-rw-r--r--ndk/platforms/android-5/include/pthread.h5
-rw-r--r--ndk/platforms/android-8/arch-arm/symbols/libc.so.functions.txt1
-rw-r--r--ndk/platforms/android-8/include/android/bitmap.h5
-rw-r--r--ndk/platforms/android-8/include/pthread.h5
-rw-r--r--ndk/platforms/android-8/include/stdio.h25
-rw-r--r--ndk/platforms/android-8/include/wchar.h2
-rw-r--r--ndk/platforms/android-8/samples/bitmap-plasma/jni/plasma.c1
-rw-r--r--ndk/platforms/android-9/arch-arm/symbols/libc.so.functions.txt1
-rw-r--r--ndk/platforms/android-9/arch-mips/include/asm/cpu-features.h27
-rw-r--r--ndk/platforms/android-9/arch-mips/include/asm/elf.h14
-rw-r--r--ndk/platforms/android-9/arch-mips/include/asm/fcntl.h14
-rw-r--r--ndk/platforms/android-9/arch-mips/include/asm/mach-generic/spaces.h13
-rw-r--r--ndk/platforms/android-9/arch-mips/include/asm/mman.h19
-rw-r--r--ndk/platforms/android-9/arch-mips/include/asm/module.h12
-rw-r--r--ndk/platforms/android-9/arch-mips/include/asm/msgbuf.h9
-rw-r--r--ndk/platforms/android-9/arch-mips/include/asm/pgalloc.h4
-rw-r--r--ndk/platforms/android-9/arch-mips/include/asm/pgtable-32.h79
-rw-r--r--ndk/platforms/android-9/arch-mips/include/asm/pgtable.h25
-rw-r--r--ndk/platforms/android-9/arch-mips/include/asm/processor.h28
-rw-r--r--ndk/platforms/android-9/arch-mips/include/asm/ptrace.h12
-rw-r--r--ndk/platforms/android-9/arch-mips/include/asm/reg.h23
-rw-r--r--ndk/platforms/android-9/arch-mips/include/asm/resource.h3
-rw-r--r--ndk/platforms/android-9/arch-mips/include/asm/siginfo.h30
-rw-r--r--ndk/platforms/android-9/arch-mips/include/asm/socket.h19
-rw-r--r--ndk/platforms/android-9/arch-mips/include/asm/string.h10
-rw-r--r--ndk/platforms/android-9/arch-mips/include/asm/uaccess.h22
-rw-r--r--ndk/platforms/android-9/arch-mips/include/asm/unistd.h373
-rw-r--r--ndk/platforms/android-9/arch-mips/include/fenv.h303
-rw-r--r--ndk/platforms/android-9/arch-mips/include/machine/_types.h8
-rw-r--r--ndk/platforms/android-9/arch-mips/include/machine/endian.h70
-rw-r--r--ndk/platforms/android-9/arch-mips/lib-bootstrap/crtbegin_dynamic.obin0 -> 2792 bytes
-rw-r--r--ndk/platforms/android-9/arch-mips/lib-bootstrap/crtend_android.obin0 -> 1205 bytes
-rwxr-xr-xndk/platforms/android-9/arch-mips/lib-bootstrap/libc.sobin0 -> 128569 bytes
-rwxr-xr-xndk/platforms/android-9/arch-mips/lib-bootstrap/libdl.sobin0 -> 71212 bytes
-rw-r--r--ndk/platforms/android-9/arch-mips/symbols/libc.so.functions.txt1
-rw-r--r--ndk/platforms/android-9/arch-x86/include/asm/socket.h52
-rw-r--r--ndk/platforms/android-9/arch-x86/include/asm/unistd_32.h34
-rw-r--r--ndk/platforms/android-9/arch-x86/include/fenv.h3
-rw-r--r--ndk/platforms/android-9/arch-x86/include/machine/_types.h23
-rw-r--r--ndk/platforms/android-9/arch-x86/include/machine/endian.h (renamed from ndk/platforms/android-9/arch-x86/include/endian.h)1
-rw-r--r--ndk/platforms/android-9/arch-x86/lib-bootstrap/crtbegin_dynamic.obin0 -> 2344 bytes
-rw-r--r--ndk/platforms/android-9/arch-x86/lib-bootstrap/crtend_android.obin0 -> 704 bytes
-rwxr-xr-xndk/platforms/android-9/arch-x86/lib-bootstrap/libc.sobin0 -> 105700 bytes
-rwxr-xr-xndk/platforms/android-9/arch-x86/lib-bootstrap/libdl.sobin0 -> 5188 bytes
-rw-r--r--ndk/platforms/android-9/arch-x86/lib/libc.abin3257844 -> 3259518 bytes
-rw-r--r--ndk/platforms/android-9/arch-x86/symbols/libc.so.functions.txt3
-rw-r--r--ndk/platforms/android-9/include/SLES/OpenSLES_AndroidConfiguration.h2
-rw-r--r--ndk/platforms/android-9/include/android/bitmap.h5
-rw-r--r--ndk/platforms/android-9/include/pthread.h15
-rw-r--r--ndk/platforms/android-9/include/sys/cdefs.h7
-rw-r--r--ndk/platforms/android-9/include/wchar.h2
-rw-r--r--ndk/platforms/android-9/samples/native-audio/jni/native-audio-jni.c56
-rw-r--r--ndk/platforms/android-9/samples/native-plasma/jni/plasma.c3
-rw-r--r--ndk/samples/module-exports/jni/bar/bar.c1
-rw-r--r--ndk/sources/android/libportable/Android.mk57
-rw-r--r--ndk/sources/android/libportable/arch-arm/errno.c21
-rw-r--r--ndk/sources/android/libportable/arch-arm/fenv.c104
-rw-r--r--ndk/sources/android/libportable/arch-arm/sockopt.c30
-rw-r--r--ndk/sources/android/libportable/arch-arm/unwind.c80
-rw-r--r--ndk/sources/android/libportable/arch-mips/_setjmp.S193
-rw-r--r--ndk/sources/android/libportable/arch-mips/clone.c140
-rw-r--r--ndk/sources/android/libportable/arch-mips/epoll.c9
-rw-r--r--ndk/sources/android/libportable/arch-mips/errno.c254
-rw-r--r--ndk/sources/android/libportable/arch-mips/eventfd.c96
-rw-r--r--ndk/sources/android/libportable/arch-mips/fcntl.c422
-rw-r--r--ndk/sources/android/libportable/arch-mips/fenv.c208
-rw-r--r--ndk/sources/android/libportable/arch-mips/filefd.c502
-rw-r--r--ndk/sources/android/libportable/arch-mips/flags.c58
-rw-r--r--ndk/sources/android/libportable/arch-mips/inotify.c85
-rw-r--r--ndk/sources/android/libportable/arch-mips/ioctl.c3
-rw-r--r--ndk/sources/android/libportable/arch-mips/jboffsets.h46
-rw-r--r--ndk/sources/android/libportable/arch-mips/mmap.c136
-rw-r--r--ndk/sources/android/libportable/arch-mips/open.c102
-rw-r--r--ndk/sources/android/libportable/arch-mips/pipe.c87
-rw-r--r--ndk/sources/android/libportable/arch-mips/poll.c63
-rw-r--r--ndk/sources/android/libportable/arch-mips/pthread.c314
-rw-r--r--ndk/sources/android/libportable/arch-mips/resource.c13
-rw-r--r--ndk/sources/android/libportable/arch-mips/setjmp.S218
-rw-r--r--ndk/sources/android/libportable/arch-mips/signal.c1772
-rw-r--r--ndk/sources/android/libportable/arch-mips/sigsetjmp.S78
-rw-r--r--ndk/sources/android/libportable/arch-mips/socket.c245
-rw-r--r--ndk/sources/android/libportable/arch-mips/sockopt.c80
-rw-r--r--ndk/sources/android/libportable/arch-mips/stat.c43
-rw-r--r--ndk/sources/android/libportable/arch-mips/statfs.c25
-rw-r--r--ndk/sources/android/libportable/arch-mips/syscall.c640
-rw-r--r--ndk/sources/android/libportable/arch-mips/timer.c (renamed from ndk/sources/android/libportable/arch-arm/stat.c)32
-rw-r--r--ndk/sources/android/libportable/arch-mips/timerfd.c82
-rw-r--r--ndk/sources/android/libportable/arch-mips/waitpid.c45
-rw-r--r--ndk/sources/android/libportable/arch-x86/epoll.c9
-rw-r--r--ndk/sources/android/libportable/arch-x86/errno.c21
-rw-r--r--ndk/sources/android/libportable/arch-x86/fcntl.c3
-rw-r--r--ndk/sources/android/libportable/arch-x86/fenv.c166
-rw-r--r--ndk/sources/android/libportable/arch-x86/ioctl.c3
-rw-r--r--ndk/sources/android/libportable/arch-x86/open.c3
-rw-r--r--ndk/sources/android/libportable/arch-x86/socket.c23
-rw-r--r--ndk/sources/android/libportable/arch-x86/sockopt.c30
-rw-r--r--ndk/sources/android/libportable/arch-x86/stat.c17
-rw-r--r--ndk/sources/android/libportable/common/include/asm-generic/portability.h (renamed from ndk/sources/android/libportable/arch-arm/epoll.c)23
-rw-r--r--ndk/sources/android/libportable/common/include/asm-generic/siginfo_portable.h221
-rw-r--r--ndk/sources/android/libportable/common/include/asm-generic/signal_portable.h21
-rw-r--r--ndk/sources/android/libportable/common/include/asm/sigcontext_portable.h40
-rw-r--r--ndk/sources/android/libportable/common/include/asm/siginfo_portable.h17
-rw-r--r--ndk/sources/android/libportable/common/include/asm/signal_portable.h185
-rw-r--r--ndk/sources/android/libportable/common/include/asm/unistd-portable.h401
-rw-r--r--ndk/sources/android/libportable/common/include/errno_portable.h14
-rw-r--r--ndk/sources/android/libportable/common/include/eventfd_portable.h63
-rw-r--r--ndk/sources/android/libportable/common/include/fcntl_portable.h59
-rw-r--r--ndk/sources/android/libportable/common/include/fenv_portable.h37
-rw-r--r--ndk/sources/android/libportable/common/include/filefd_portable.h44
-rw-r--r--ndk/sources/android/libportable/common/include/inotify_portable.h51
-rw-r--r--ndk/sources/android/libportable/common/include/ioctls_portable.h111
-rw-r--r--ndk/sources/android/libportable/common/include/log_portable.h101
-rw-r--r--ndk/sources/android/libportable/common/include/netdb_portable.h281
-rw-r--r--ndk/sources/android/libportable/common/include/portability.h49
-rw-r--r--ndk/sources/android/libportable/common/include/signal_portable.h198
-rw-r--r--ndk/sources/android/libportable/common/include/signalfd_portable.h60
-rw-r--r--ndk/sources/android/libportable/common/include/timerfd_portable.h51
-rw-r--r--ndk/sources/android/native_app_glue/android_native_app_glue.c6
-rw-r--r--samples/ApiDemos/AndroidManifest.xml107
-rw-r--r--samples/ApiDemos/res/drawable/box.xml2
-rw-r--r--samples/ApiDemos/res/drawable/box_white.xml21
-rw-r--r--samples/ApiDemos/res/drawable/filled_box.xml2
-rw-r--r--samples/ApiDemos/res/drawable/hover_background_active.xml2
-rw-r--r--samples/ApiDemos/res/drawable/hover_background_inactive.xml2
-rw-r--r--samples/ApiDemos/res/layout/action_bar_display_options.xml75
-rw-r--r--samples/ApiDemos/res/layout/custom_layout.xml94
-rw-r--r--samples/ApiDemos/res/layout/keystore_usage.xml192
-rw-r--r--samples/ApiDemos/res/layout/overscan.xml202
-rw-r--r--samples/ApiDemos/res/layout/overscan_activity.xml67
-rw-r--r--samples/ApiDemos/res/layout/rotation_animation.xml74
-rw-r--r--samples/ApiDemos/res/layout/system_ui_modes.xml153
-rw-r--r--samples/ApiDemos/res/layout/textclock.xml16
-rw-r--r--samples/ApiDemos/res/layout/trigger_sensors.xml31
-rw-r--r--samples/ApiDemos/res/layout/videoview.xml10
-rw-r--r--samples/ApiDemos/res/layout/window_focus_observer.xml33
-rw-r--r--samples/ApiDemos/res/raw/videoviewdemo.mp4bin0 -> 1393457 bytes
-rw-r--r--samples/ApiDemos/res/values-v18/bools.xml20
-rw-r--r--samples/ApiDemos/res/values/arrays.xml4
-rw-r--r--samples/ApiDemos/res/values/attrs.xml13
-rw-r--r--samples/ApiDemos/res/values/bools.xml7
-rw-r--r--samples/ApiDemos/res/values/strings.xml51
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/ActionBarDisplayOptions.java18
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/OverscanActivity.java39
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/RotationAnimation.java91
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/ScreenOrientation.java4
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/content/ChangedContacts.java348
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/content/FileProvider.java41
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/media/VideoViewDemo.java27
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/os/TriggerSensors.java113
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/security/KeyStoreUsage.java526
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/view/CustomLayout.java245
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/view/CustomLayoutActivity.java33
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/view/ExpandableList1.java4
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/view/GameControllerInput.java10
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/view/GameView.java4
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/view/SystemUIModes.java (renamed from samples/ApiDemos/src/com/example/android/apis/view/OverscanActivity.java)34
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/view/SystemUIModesOverlay.java31
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/view/VideoPlayerActivity.java2
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/view/WindowFocusObserver.java106
-rw-r--r--samples/AppLimits/Android.mk17
-rw-r--r--samples/AppLimits/AndroidManifest.xml42
-rw-r--r--samples/AppLimits/res/values/strings.xml48
-rw-r--r--samples/AppLimits/res/xml/custom_prefs.xml33
-rw-r--r--samples/AppLimits/src/com/example/android/applimits/CustomRestrictionsActivity.java159
-rw-r--r--samples/AppLimits/src/com/example/android/applimits/GetRestrictionsReceiver.java139
-rw-r--r--samples/BluetoothLeGatt/Android.mk16
-rw-r--r--samples/BluetoothLeGatt/AndroidManifest.xml45
-rwxr-xr-xsamples/BluetoothLeGatt/res/drawable-hdpi/ic_launcher.pngbin0 -> 5170 bytes
-rwxr-xr-xsamples/BluetoothLeGatt/res/drawable-mdpi/ic_launcher.pngbin0 -> 3025 bytes
-rwxr-xr-xsamples/BluetoothLeGatt/res/drawable-xhdpi/ic_launcher.pngbin0 -> 7227 bytes
-rwxr-xr-xsamples/BluetoothLeGatt/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 12800 bytes
-rw-r--r--samples/BluetoothLeGatt/res/layout/actionbar_indeterminate_progress.xml23
-rw-r--r--samples/BluetoothLeGatt/res/layout/gatt_services_characteristics.xml71
-rw-r--r--samples/BluetoothLeGatt/res/layout/listitem_device.xml28
-rw-r--r--samples/BluetoothLeGatt/res/menu/gatt_services.xml29
-rw-r--r--samples/BluetoothLeGatt/res/menu/main.xml29
-rw-r--r--samples/BluetoothLeGatt/res/values/strings.xml37
-rw-r--r--samples/BluetoothLeGatt/src/com/example/bluetooth/le/BluetoothLeService.java319
-rw-r--r--samples/BluetoothLeGatt/src/com/example/bluetooth/le/DeviceControlActivity.java309
-rw-r--r--samples/BluetoothLeGatt/src/com/example/bluetooth/le/DeviceScanActivity.java269
-rw-r--r--samples/BluetoothLeGatt/src/com/example/bluetooth/le/SampleGattAttributes.java42
-rw-r--r--samples/BrowserPlugin/Android.mk41
-rw-r--r--samples/BrowserPlugin/MODULE_LICENSE_APACHE20
-rw-r--r--samples/BrowserPlugin/NOTICE190
-rw-r--r--samples/BrowserPlugin/README177
-rw-r--r--samples/BrowserPlugin/jni/Android.mk79
-rw-r--r--samples/BrowserPlugin/jni/PluginObject.cpp215
-rw-r--r--samples/BrowserPlugin/jni/PluginObject.h99
-rw-r--r--samples/BrowserPlugin/jni/RenderingThread.cpp212
-rw-r--r--samples/BrowserPlugin/jni/RenderingThread.h77
-rw-r--r--samples/BrowserPlugin/jni/animation/AnimationPlugin.cpp168
-rw-r--r--samples/BrowserPlugin/jni/animation/AnimationPlugin.h48
-rw-r--r--samples/BrowserPlugin/jni/animation/AnimationThread.cpp155
-rw-r--r--samples/BrowserPlugin/jni/animation/AnimationThread.h66
-rw-r--r--samples/BrowserPlugin/jni/audio/AudioPlugin.cpp382
-rw-r--r--samples/BrowserPlugin/jni/audio/AudioPlugin.h74
-rw-r--r--samples/BrowserPlugin/jni/background/BackgroundPlugin.cpp499
-rw-r--r--samples/BrowserPlugin/jni/background/BackgroundPlugin.h66
-rw-r--r--samples/BrowserPlugin/jni/form/FormPlugin.cpp381
-rw-r--r--samples/BrowserPlugin/jni/form/FormPlugin.h72
-rw-r--r--samples/BrowserPlugin/jni/jni-bridge.cpp82
-rw-r--r--samples/BrowserPlugin/jni/main.cpp468
-rw-r--r--samples/BrowserPlugin/jni/main.h35
-rw-r--r--samples/BrowserPlugin/jni/navigation/NavigationPlugin.cpp242
-rw-r--r--samples/BrowserPlugin/jni/navigation/NavigationPlugin.h57
-rw-r--r--samples/BrowserPlugin/jni/paint/PaintPlugin.cpp462
-rw-r--r--samples/BrowserPlugin/jni/paint/PaintPlugin.h73
-rw-r--r--samples/BrowserPlugin/jni/video/VideoPlugin.cpp135
-rw-r--r--samples/BrowserPlugin/jni/video/VideoPlugin.h44
-rwxr-xr-xsamples/BrowserPlugin/res/drawable-hdpi/sample_browser_plugin.pngbin5916 -> 0 bytes
-rwxr-xr-xsamples/BrowserPlugin/res/drawable-mdpi/sample_browser_plugin.pngbin3610 -> 0 bytes
-rw-r--r--samples/BrowserPlugin/src/com/android/sampleplugin/AnimationSurface.java22
-rw-r--r--samples/BrowserPlugin/src/com/android/sampleplugin/BackgroundSurface.java19
-rw-r--r--samples/BrowserPlugin/src/com/android/sampleplugin/BackgroundTest.java11
-rw-r--r--samples/BrowserPlugin/src/com/android/sampleplugin/PaintSurface.java95
-rw-r--r--samples/BrowserPlugin/src/com/android/sampleplugin/SamplePlugin.java38
-rw-r--r--samples/BrowserPlugin/src/com/android/sampleplugin/VideoSurface.java67
-rw-r--r--samples/BrowserPlugin/src/com/android/sampleplugin/graphics/Cube.java100
-rw-r--r--samples/BrowserPlugin/src/com/android/sampleplugin/graphics/CubeRenderer.java109
-rw-r--r--samples/LunarLander/res/layout/lunar_layout.xml16
-rw-r--r--samples/LunarLander/src/com/example/android/lunarlander/LunarLander.java2
-rw-r--r--samples/LunarLander/src/com/example/android/lunarlander/LunarView.java16
-rw-r--r--samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/HelloCompute.java4
-rw-r--r--samples/SimpleJNI/jni/Android.mk2
-rw-r--r--samples/Support4Demos/AndroidManifest.xml68
-rw-r--r--samples/Support4Demos/res/drawable-hdpi/drawer_shadow.9.pngbin0 -> 171 bytes
-rw-r--r--samples/Support4Demos/res/drawable-hdpi/ic_drawer.pngbin0 -> 2842 bytes
-rw-r--r--samples/Support4Demos/res/drawable-mdpi/drawer_shadow.9.pngbin0 -> 158 bytes
-rw-r--r--samples/Support4Demos/res/drawable-mdpi/ic_drawer.pngbin0 -> 2837 bytes
-rw-r--r--samples/Support4Demos/res/drawable-xhdpi/drawer_shadow.9.pngbin0 -> 182 bytes
-rw-r--r--samples/Support4Demos/res/drawable-xhdpi/ic_drawer.pngbin0 -> 1056 bytes
-rw-r--r--samples/Support4Demos/res/layout/bidiformater_support.xml58
-rw-r--r--samples/Support4Demos/res/layout/drawer_layout.xml51
-rw-r--r--samples/Support4Demos/res/layout/file_provider_example.xml (renamed from apps/FontLab/res/layout/font_lab.xml)25
-rw-r--r--samples/Support4Demos/res/layout/media_controller.xml76
-rw-r--r--samples/Support4Demos/res/layout/sliding_pane_layout.xml56
-rw-r--r--samples/Support4Demos/res/layout/videoview.xml41
-rw-r--r--samples/Support4Demos/res/layout/wakeful_alarm_controller.xml35
-rw-r--r--samples/Support4Demos/res/raw/videoviewdemo.mp4bin0 -> 1393457 bytes
-rw-r--r--samples/Support4Demos/res/values/strings.xml36
-rw-r--r--samples/Support4Demos/res/xml/my_paths.xml14
-rw-r--r--samples/Support4Demos/src/com/example/android/supportv4/content/FileProviderExample.java81
-rw-r--r--samples/Support4Demos/src/com/example/android/supportv4/content/SimpleWakefulController.java75
-rw-r--r--samples/Support4Demos/src/com/example/android/supportv4/content/SimpleWakefulReceiver.java37
-rw-r--r--samples/Support4Demos/src/com/example/android/supportv4/content/SimpleWakefulService.java56
-rw-r--r--samples/Support4Demos/src/com/example/android/supportv4/media/MediaController.java370
-rw-r--r--samples/Support4Demos/src/com/example/android/supportv4/media/TransportControllerActivity.java307
-rw-r--r--samples/Support4Demos/src/com/example/android/supportv4/text/BidiFormatterSupport.java50
-rw-r--r--samples/Support4Demos/src/com/example/android/supportv4/widget/DrawerLayoutActivity.java244
-rw-r--r--samples/Support4Demos/src/com/example/android/supportv4/widget/SlidingPaneLayoutActivity.java222
-rw-r--r--samples/Support7Demos/Android.mk38
-rw-r--r--samples/Support7Demos/AndroidManifest.xml166
-rw-r--r--samples/Support7Demos/_index.html30
-rw-r--r--samples/Support7Demos/res/drawable-hdpi/apidemo_androidlogo.pngbin0 -> 2642 bytes
-rwxr-xr-xsamples/Support7Demos/res/drawable-hdpi/app_sample_code.pngbin0 -> 3608 bytes
-rw-r--r--samples/Support7Demos/res/drawable-hdpi/ic_launcher_settings.pngbin0 -> 7230 bytes
-rw-r--r--samples/Support7Demos/res/drawable-mdpi/apidemo_androidlogo.pngbin0 -> 1983 bytes
-rw-r--r--samples/Support7Demos/res/drawable-mdpi/app_sample_code.pngbin0 -> 5198 bytes
-rw-r--r--samples/Support7Demos/res/drawable-mdpi/ic_launcher_settings.pngbin0 -> 4122 bytes
-rw-r--r--samples/Support7Demos/res/layout-land/grid_layout_2.xml64
-rw-r--r--samples/Support7Demos/res/layout/action_bar_display_options.xml55
-rw-r--r--samples/Support7Demos/res/layout/action_bar_display_options_custom.xml17
-rw-r--r--samples/Support7Demos/res/layout/action_bar_fragment_menu.xml63
-rw-r--r--samples/Support7Demos/res/layout/action_bar_settings_action_provider.xml34
-rw-r--r--samples/Support7Demos/res/layout/action_bar_tab_content.xml19
-rw-r--r--samples/Support7Demos/res/layout/action_bar_tabs.xml49
-rw-r--r--samples/Support7Demos/res/layout/grid_layout_1.xml47
-rw-r--r--samples/Support7Demos/res/layout/grid_layout_2.xml64
-rw-r--r--samples/Support7Demos/res/layout/sample_media_router.xml64
-rw-r--r--samples/Support7Demos/res/menu/action_bar_settings_action_provider.xml27
-rw-r--r--samples/Support7Demos/res/menu/actions.xml49
-rw-r--r--samples/Support7Demos/res/menu/display_options_actions.xml21
-rw-r--r--samples/Support7Demos/res/menu/sample_media_router_menu.xml23
-rw-r--r--samples/Support7Demos/res/values/arrays.xml33
-rw-r--r--samples/Support7Demos/res/values/colors.xml (renamed from samples/MailSync/res/values/ids.xml)8
-rw-r--r--samples/Support7Demos/res/values/strings.xml91
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/Support7Demos.java151
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/_package.html24
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarDisplayOptions.java144
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarFragmentMenu.java237
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarMechanics.java73
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarSettingsActionProviderActivity.java93
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarTabs.java134
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarUsage.java99
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/app/_index.html33
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProvider.java262
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProviderService.java33
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouterActivity.java385
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/media/_index.html23
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/view/GridLayout1.java34
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/view/GridLayout2.java (renamed from tools/emulator/system/libqemu/test_util.h)30
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/view/GridLayout3.java129
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/view/_index.html22
-rw-r--r--samples/devbytes/animation/ActivityAnimations/AndroidManifest.xml45
-rw-r--r--samples/devbytes/animation/ActivityAnimations/res/drawable-hdpi/ic_launcher.pngbin0 -> 9397 bytes
-rw-r--r--samples/devbytes/animation/ActivityAnimations/res/drawable-mdpi/ic_launcher.pngbin0 -> 5237 bytes
-rw-r--r--samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p1.jpgbin0 -> 187272 bytes
-rw-r--r--samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p2.jpgbin0 -> 107850 bytes
-rw-r--r--samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p3.jpgbin0 -> 98727 bytes
-rw-r--r--samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p4.jpgbin0 -> 227086 bytes
-rw-r--r--samples/devbytes/animation/ActivityAnimations/res/drawable-xhdpi/ic_launcher.pngbin0 -> 14383 bytes
-rw-r--r--samples/devbytes/animation/ActivityAnimations/res/layout/activity_animations.xml21
-rw-r--r--samples/devbytes/animation/ActivityAnimations/res/layout/picture_info.xml41
-rw-r--r--samples/devbytes/animation/ActivityAnimations/res/menu/activity_better_window_animations.xml24
-rw-r--r--samples/devbytes/animation/ActivityAnimations/res/values/strings.xml21
-rw-r--r--samples/devbytes/animation/ActivityAnimations/res/values/styles.xml39
-rw-r--r--samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/ActivityAnimations.java133
-rw-r--r--samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/BitmapUtils.java107
-rw-r--r--samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/PictureData.java (renamed from ndk/sources/android/libportable/arch-arm/socket.c)22
-rw-r--r--samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/PictureDetailsActivity.java280
-rw-r--r--samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/ShadowLayout.java116
-rw-r--r--samples/devbytes/animation/Anticipation/AndroidManifest.xml41
-rw-r--r--samples/devbytes/animation/Anticipation/res/drawable-hdpi/ic_launcher.pngbin0 -> 9397 bytes
-rw-r--r--samples/devbytes/animation/Anticipation/res/drawable-mdpi/ic_launcher.pngbin0 -> 5237 bytes
-rw-r--r--samples/devbytes/animation/Anticipation/res/drawable-xhdpi/ic_launcher.pngbin0 -> 14383 bytes
-rw-r--r--samples/devbytes/animation/Anticipation/res/layout/main.xml28
-rw-r--r--samples/devbytes/animation/Anticipation/res/values-v14/styles.xml26
-rw-r--r--samples/devbytes/animation/Anticipation/res/values/strings.xml22
-rw-r--r--samples/devbytes/animation/Anticipation/res/values/styles.xml34
-rw-r--r--samples/devbytes/animation/Anticipation/src/com/example/android/anticipation/AnticiButton.java230
-rw-r--r--samples/devbytes/animation/Anticipation/src/com/example/android/anticipation/Anticipation.java40
-rw-r--r--samples/devbytes/animation/CurvedMotion/AndroidManifest.xml41
-rw-r--r--samples/devbytes/animation/CurvedMotion/res/drawable-hdpi/ic_launcher.pngbin0 -> 9397 bytes
-rw-r--r--samples/devbytes/animation/CurvedMotion/res/drawable-mdpi/ic_launcher.pngbin0 -> 5237 bytes
-rw-r--r--samples/devbytes/animation/CurvedMotion/res/drawable-xhdpi/ic_launcher.pngbin0 -> 14383 bytes
-rw-r--r--samples/devbytes/animation/CurvedMotion/res/layout/activity_curved_motion.xml33
-rw-r--r--samples/devbytes/animation/CurvedMotion/res/values-v11/styles.xml25
-rw-r--r--samples/devbytes/animation/CurvedMotion/res/values-v14/styles.xml26
-rw-r--r--samples/devbytes/animation/CurvedMotion/res/values/dimens.xml21
-rw-r--r--samples/devbytes/animation/CurvedMotion/res/values/strings.xml22
-rw-r--r--samples/devbytes/animation/CurvedMotion/res/values/styles.xml34
-rw-r--r--samples/devbytes/animation/CurvedMotion/src/com/example/android/curvedmotion/AnimatorPath.java67
-rw-r--r--samples/devbytes/animation/CurvedMotion/src/com/example/android/curvedmotion/CurvedMotion.java124
-rw-r--r--samples/devbytes/animation/CurvedMotion/src/com/example/android/curvedmotion/PathEvaluator.java49
-rw-r--r--samples/devbytes/animation/CurvedMotion/src/com/example/android/curvedmotion/PathPoint.java101
-rw-r--r--samples/devbytes/animation/ListViewItemAnimations/AndroidManifest.xml42
-rw-r--r--samples/devbytes/animation/ListViewItemAnimations/res/drawable-hdpi/ic_launcher.pngbin0 -> 9397 bytes
-rw-r--r--samples/devbytes/animation/ListViewItemAnimations/res/drawable-mdpi/ic_launcher.pngbin0 -> 5237 bytes
-rw-r--r--samples/devbytes/animation/ListViewItemAnimations/res/drawable-xhdpi/ic_launcher.pngbin0 -> 14383 bytes
-rw-r--r--samples/devbytes/animation/ListViewItemAnimations/res/drawable-xhdpi/shadowed_background.9.pngbin0 -> 1941 bytes
-rw-r--r--samples/devbytes/animation/ListViewItemAnimations/res/drawable-xhdpi/tv_background_with_divider.9.pngbin0 -> 1817 bytes
-rw-r--r--samples/devbytes/animation/ListViewItemAnimations/res/layout-v9/activity_list_view_item_animations.xml37
-rw-r--r--samples/devbytes/animation/ListViewItemAnimations/res/layout-v9/opaque_text_view.xml25
-rw-r--r--samples/devbytes/animation/ListViewItemAnimations/res/layout/activity_list_view_item_animations.xml37
-rw-r--r--samples/devbytes/animation/ListViewItemAnimations/res/layout/opaque_text_view.xml24
-rw-r--r--samples/devbytes/animation/ListViewItemAnimations/res/values-v11/styles.xml25
-rw-r--r--samples/devbytes/animation/ListViewItemAnimations/res/values-v14/styles.xml26
-rw-r--r--samples/devbytes/animation/ListViewItemAnimations/res/values/dimens.xml21
-rw-r--r--samples/devbytes/animation/ListViewItemAnimations/res/values/strings.xml22
-rw-r--r--samples/devbytes/animation/ListViewItemAnimations/res/values/styles.xml38
-rw-r--r--samples/devbytes/animation/ListViewItemAnimations/src/com/example/android/listviewitemanimations/BackgroundContainer.java77
-rw-r--r--samples/devbytes/animation/ListViewItemAnimations/src/com/example/android/listviewitemanimations/Cheeses.java154
-rw-r--r--samples/devbytes/animation/ListViewItemAnimations/src/com/example/android/listviewitemanimations/ListViewItemAnimations.java402
-rw-r--r--samples/devbytes/animation/ListViewItemAnimations/src/com/example/android/listviewitemanimations/StableArrayAdapter.java62
-rw-r--r--samples/devbytes/animation/ListViewRemovalAnimation/AndroidManifest.xml42
-rw-r--r--samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-hdpi/ic_launcher.pngbin0 -> 9397 bytes
-rw-r--r--samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-mdpi/ic_launcher.pngbin0 -> 5237 bytes
-rw-r--r--samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-xhdpi/ic_launcher.pngbin0 -> 14383 bytes
-rw-r--r--samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-xhdpi/shadowed_background.9.pngbin0 -> 197 bytes
-rw-r--r--samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-xhdpi/tv_background_with_divider.9.pngbin0 -> 1817 bytes
-rw-r--r--samples/devbytes/animation/ListViewRemovalAnimation/res/layout/activity_list_view_deletion.xml37
-rw-r--r--samples/devbytes/animation/ListViewRemovalAnimation/res/layout/opaque_text_view.xml24
-rw-r--r--samples/devbytes/animation/ListViewRemovalAnimation/res/values-v11/styles.xml25
-rw-r--r--samples/devbytes/animation/ListViewRemovalAnimation/res/values-v14/styles.xml26
-rw-r--r--samples/devbytes/animation/ListViewRemovalAnimation/res/values/strings.xml21
-rw-r--r--samples/devbytes/animation/ListViewRemovalAnimation/res/values/styles.xml37
-rw-r--r--samples/devbytes/animation/ListViewRemovalAnimation/src/com/example/android/listviewremovalanimation/BackgroundContainer.java78
-rw-r--r--samples/devbytes/animation/ListViewRemovalAnimation/src/com/example/android/listviewremovalanimation/Cheeses.java154
-rw-r--r--samples/devbytes/animation/ListViewRemovalAnimation/src/com/example/android/listviewremovalanimation/ListViewRemovalAnimation.java248
-rw-r--r--samples/devbytes/animation/ListViewRemovalAnimation/src/com/example/android/listviewremovalanimation/StableArrayAdapter.java62
-rw-r--r--samples/devbytes/animation/LiveButton/AndroidManifest.xml41
-rw-r--r--samples/devbytes/animation/LiveButton/res/drawable-hdpi/ic_launcher.pngbin0 -> 9397 bytes
-rw-r--r--samples/devbytes/animation/LiveButton/res/drawable-mdpi/ic_launcher.pngbin0 -> 5237 bytes
-rw-r--r--samples/devbytes/animation/LiveButton/res/drawable-xhdpi/ic_launcher.pngbin0 -> 14383 bytes
-rw-r--r--samples/devbytes/animation/LiveButton/res/layout/activity_overshoot.xml29
-rw-r--r--samples/devbytes/animation/LiveButton/res/values-v14/styles.xml26
-rw-r--r--samples/devbytes/animation/LiveButton/res/values/strings.xml22
-rw-r--r--samples/devbytes/animation/LiveButton/res/values/styles.xml34
-rw-r--r--samples/devbytes/animation/LiveButton/src/com/example/android/livebutton/LiveButton.java65
-rw-r--r--samples/devbytes/animation/MultiPropertyAnimations/AndroidManifest.xml41
-rw-r--r--samples/devbytes/animation/MultiPropertyAnimations/res/drawable-hdpi/ic_launcher.pngbin0 -> 9397 bytes
-rw-r--r--samples/devbytes/animation/MultiPropertyAnimations/res/drawable-mdpi/ic_launcher.pngbin0 -> 5237 bytes
-rw-r--r--samples/devbytes/animation/MultiPropertyAnimations/res/drawable-xhdpi/ic_launcher.pngbin0 -> 14383 bytes
-rw-r--r--samples/devbytes/animation/MultiPropertyAnimations/res/layout/activity_multi_property_animations.xml46
-rw-r--r--samples/devbytes/animation/MultiPropertyAnimations/res/values-v14/styles.xml26
-rw-r--r--samples/devbytes/animation/MultiPropertyAnimations/res/values/dimens.xml21
-rw-r--r--samples/devbytes/animation/MultiPropertyAnimations/res/values/strings.xml22
-rw-r--r--samples/devbytes/animation/MultiPropertyAnimations/res/values/styles.xml34
-rw-r--r--samples/devbytes/animation/MultiPropertyAnimations/src/com/example/android/multipropertyanimations/MultiPropertyAnimations.java92
-rw-r--r--samples/devbytes/animation/SquashAndStretch/AndroidManifest.xml41
-rw-r--r--samples/devbytes/animation/SquashAndStretch/res/drawable-hdpi/ic_launcher.pngbin0 -> 9397 bytes
-rw-r--r--samples/devbytes/animation/SquashAndStretch/res/drawable-mdpi/ic_launcher.pngbin0 -> 5237 bytes
-rw-r--r--samples/devbytes/animation/SquashAndStretch/res/drawable-xhdpi/ic_launcher.pngbin0 -> 14383 bytes
-rw-r--r--samples/devbytes/animation/SquashAndStretch/res/layout/main.xml31
-rw-r--r--samples/devbytes/animation/SquashAndStretch/res/menu/main.xml24
-rw-r--r--samples/devbytes/animation/SquashAndStretch/res/values-v14/styles.xml26
-rw-r--r--samples/devbytes/animation/SquashAndStretch/res/values/strings.xml22
-rw-r--r--samples/devbytes/animation/SquashAndStretch/res/values/styles.xml34
-rw-r--r--samples/devbytes/animation/SquashAndStretch/src/com/example/squashandstretch/SquashAndStretch.java114
-rw-r--r--samples/devbytes/animation/ToonGame/AndroidManifest.xml49
-rw-r--r--samples/devbytes/animation/ToonGame/res/drawable-hdpi/ic_launcher.pngbin0 -> 9397 bytes
-rw-r--r--samples/devbytes/animation/ToonGame/res/drawable-mdpi/blue_oval.xml21
-rw-r--r--samples/devbytes/animation/ToonGame/res/drawable-mdpi/cyan_oval.xml21
-rw-r--r--samples/devbytes/animation/ToonGame/res/drawable-mdpi/green_button.xml19
-rw-r--r--samples/devbytes/animation/ToonGame/res/drawable-mdpi/green_down.9.pngbin0 -> 3125 bytes
-rw-r--r--samples/devbytes/animation/ToonGame/res/drawable-mdpi/green_oval.xml21
-rw-r--r--samples/devbytes/animation/ToonGame/res/drawable-mdpi/green_up.9.pngbin0 -> 3290 bytes
-rw-r--r--samples/devbytes/animation/ToonGame/res/drawable-mdpi/ic_launcher.pngbin0 -> 5237 bytes
-rw-r--r--samples/devbytes/animation/ToonGame/res/drawable-mdpi/magenta_oval.xml21
-rw-r--r--samples/devbytes/animation/ToonGame/res/drawable-mdpi/red_oval.xml21
-rw-r--r--samples/devbytes/animation/ToonGame/res/drawable-mdpi/yellow_oval.xml21
-rw-r--r--samples/devbytes/animation/ToonGame/res/drawable-xhdpi/ic_launcher.pngbin0 -> 14383 bytes
-rw-r--r--samples/devbytes/animation/ToonGame/res/layout/activity_toon_game.xml47
-rw-r--r--samples/devbytes/animation/ToonGame/res/layout/player_setup_layout.xml187
-rw-r--r--samples/devbytes/animation/ToonGame/res/values/dimens.xml22
-rw-r--r--samples/devbytes/animation/ToonGame/res/values/strings.xml23
-rw-r--r--samples/devbytes/animation/ToonGame/res/values/styles.xml34
-rw-r--r--samples/devbytes/animation/ToonGame/src/com/example/android/toongame/PlayerSetupActivity.java360
-rw-r--r--samples/devbytes/animation/ToonGame/src/com/example/android/toongame/SkewableTextView.java84
-rw-r--r--samples/devbytes/animation/ToonGame/src/com/example/android/toongame/ToonGame.java219
-rw-r--r--samples/training/ContactsList/AndroidManifest.xml72
-rw-r--r--samples/training/ContactsList/libs/android-support-v4.jarbin0 -> 393154 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-hdpi-v11/ic_action_add.pngbin0 -> 308 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-hdpi-v11/ic_action_edit.pngbin0 -> 945 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-hdpi-v11/ic_action_search.pngbin0 -> 819 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-hdpi/ic_action_add.pngbin0 -> 1259 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-hdpi/ic_action_edit.pngbin0 -> 2997 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-hdpi/ic_action_map.pngbin0 -> 1393 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-hdpi/ic_action_search.pngbin0 -> 2969 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-hdpi/ic_contact_picture_180_holo_light.pngbin0 -> 2887 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-hdpi/ic_contact_picture_holo_light.pngbin0 -> 944 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-hdpi/ic_launcher.pngbin0 -> 4899 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-hdpi/quickcontact_badge_small_pressed.9.pngbin0 -> 633 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-hdpi/quickcontact_badge_small_unpressed.9.pngbin0 -> 627 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-mdpi-v11/ic_action_add.pngbin0 -> 183 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-mdpi-v11/ic_action_edit.pngbin0 -> 603 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-mdpi-v11/ic_action_search.pngbin0 -> 515 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-mdpi/ic_action_add.pngbin0 -> 693 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-mdpi/ic_action_edit.pngbin0 -> 1595 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-mdpi/ic_action_map.pngbin0 -> 902 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-mdpi/ic_action_search.pngbin0 -> 1600 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-mdpi/ic_contact_picture_180_holo_light.pngbin0 -> 1926 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-mdpi/ic_contact_picture_holo_light.pngbin0 -> 686 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-mdpi/ic_launcher.pngbin0 -> 2863 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-mdpi/quickcontact_badge_small_pressed.9.pngbin0 -> 605 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-mdpi/quickcontact_badge_small_unpressed.9.pngbin0 -> 609 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-xhdpi-v11/ic_action_add.pngbin0 -> 349 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-xhdpi-v11/ic_action_edit.pngbin0 -> 1252 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-xhdpi-v11/ic_action_search.pngbin0 -> 1073 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-xhdpi/ic_action_add.pngbin0 -> 1397 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-xhdpi/ic_action_edit.pngbin0 -> 3765 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-xhdpi/ic_action_map.pngbin0 -> 1919 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-xhdpi/ic_action_search.pngbin0 -> 3716 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-xhdpi/ic_contact_picture_180_holo_light.pngbin0 -> 3674 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-xhdpi/ic_contact_picture_holo_light.pngbin0 -> 1299 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-xhdpi/ic_launcher.pngbin0 -> 6857 bytes
-rw-r--r--samples/training/ContactsList/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 12234 bytes
-rw-r--r--samples/training/ContactsList/res/drawable/quickcontact_badge_small.xml29
-rw-r--r--samples/training/ContactsList/res/layout-land/contact_detail_fragment.xml81
-rw-r--r--samples/training/ContactsList/res/layout/activity_main.xml26
-rw-r--r--samples/training/ContactsList/res/layout/activity_main_twopanes.xml43
-rw-r--r--samples/training/ContactsList/res/layout/contact_detail_fragment.xml86
-rw-r--r--samples/training/ContactsList/res/layout/contact_detail_item.xml65
-rw-r--r--samples/training/ContactsList/res/layout/contact_list_fragment.xml38
-rw-r--r--samples/training/ContactsList/res/layout/contact_list_item.xml70
-rw-r--r--samples/training/ContactsList/res/menu/contact_detail_menu.xml25
-rw-r--r--samples/training/ContactsList/res/menu/contact_list_menu.xml35
-rw-r--r--samples/training/ContactsList/res/values-sw360dp/styles.xml26
-rw-r--r--samples/training/ContactsList/res/values-sw600dp-port/integers.xml24
-rw-r--r--samples/training/ContactsList/res/values-sw600dp/bools.xml22
-rw-r--r--samples/training/ContactsList/res/values-sw600dp/integers.xml24
-rw-r--r--samples/training/ContactsList/res/values-sw600dp/layout.xml23
-rw-r--r--samples/training/ContactsList/res/values-sw600dp/styles.xml25
-rw-r--r--samples/training/ContactsList/res/values-sw720dp/dimens.xml24
-rw-r--r--samples/training/ContactsList/res/values-v11/styles.xml40
-rw-r--r--samples/training/ContactsList/res/values/bools.xml22
-rw-r--r--samples/training/ContactsList/res/values/colors.xml24
-rw-r--r--samples/training/ContactsList/res/values/dimens.xml26
-rw-r--r--samples/training/ContactsList/res/values/integers.xml24
-rw-r--r--samples/training/ContactsList/res/values/strings.xml48
-rw-r--r--samples/training/ContactsList/res/values/styles.xml61
-rw-r--r--samples/training/ContactsList/res/xml/searchable_contacts.xml24
-rw-r--r--samples/training/ContactsList/src/com/example/android/contactslist/ui/ContactDetailActivity.java91
-rw-r--r--samples/training/ContactsList/src/com/example/android/contactslist/ui/ContactDetailFragment.java687
-rw-r--r--samples/training/ContactsList/src/com/example/android/contactslist/ui/ContactsListActivity.java130
-rw-r--r--samples/training/ContactsList/src/com/example/android/contactslist/ui/ContactsListFragment.java935
-rw-r--r--samples/training/ContactsList/src/com/example/android/contactslist/util/ImageCache.java227
-rw-r--r--samples/training/ContactsList/src/com/example/android/contactslist/util/ImageLoader.java422
-rw-r--r--samples/training/ContactsList/src/com/example/android/contactslist/util/Utils.java103
-rw-r--r--samples/training/EffectiveNavigation/libs/android-support-v4.jarbin0 -> 393153 bytes
-rwxr-xr-xsamples/training/InteractiveChart/AndroidManifest.xml42
-rw-r--r--samples/training/InteractiveChart/libs/android-support-v4.jarbin0 -> 385685 bytes
-rwxr-xr-xsamples/training/InteractiveChart/project.properties27
-rw-r--r--samples/training/InteractiveChart/res/drawable-hdpi/ic_launcher.pngbin0 -> 6478 bytes
-rw-r--r--samples/training/InteractiveChart/res/drawable-mdpi/ic_launcher.pngbin0 -> 3726 bytes
-rw-r--r--samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_pan_down.pngbin0 -> 1677 bytes
-rw-r--r--samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_pan_left.pngbin0 -> 1734 bytes
-rw-r--r--samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_pan_right.pngbin0 -> 1737 bytes
-rw-r--r--samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_pan_up.pngbin0 -> 1635 bytes
-rw-r--r--samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_zoom_in.pngbin0 -> 1221 bytes
-rw-r--r--samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_zoom_out.pngbin0 -> 331 bytes
-rw-r--r--samples/training/InteractiveChart/res/drawable-xhdpi/ic_launcher.pngbin0 -> 9521 bytes
-rw-r--r--samples/training/InteractiveChart/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 16950 bytes
-rwxr-xr-xsamples/training/InteractiveChart/res/layout/activity_main.xml32
-rw-r--r--samples/training/InteractiveChart/res/menu/main.xml43
-rw-r--r--samples/training/InteractiveChart/res/values-sw600dp/dimens.xml19
-rw-r--r--samples/training/InteractiveChart/res/values-v11/styles.xml19
-rw-r--r--samples/training/InteractiveChart/res/values-v14/styles.xml19
-rw-r--r--samples/training/InteractiveChart/res/values/attrs.xml29
-rw-r--r--samples/training/InteractiveChart/res/values/dimens.xml20
-rwxr-xr-xsamples/training/InteractiveChart/res/values/strings.xml26
-rw-r--r--samples/training/InteractiveChart/res/values/styles.xml19
-rw-r--r--samples/training/InteractiveChart/src/com/example/android/interactivechart/InteractiveLineGraphView.java1185
-rwxr-xr-xsamples/training/InteractiveChart/src/com/example/android/interactivechart/MainActivity.java70
-rw-r--r--samples/training/InteractiveChart/src/com/example/android/interactivechart/OverScrollerCompat.java44
-rw-r--r--samples/training/InteractiveChart/src/com/example/android/interactivechart/ScaleGestureDetectorCompat.java57
-rw-r--r--samples/training/InteractiveChart/src/com/example/android/interactivechart/Zoomer.java130
-rwxr-xr-xsamples/training/NavigationDrawer/AndroidManifest.xml40
-rw-r--r--samples/training/NavigationDrawer/libs/android-support-v4.jarbin0 -> 535319 bytes
-rwxr-xr-xsamples/training/NavigationDrawer/res/drawable-hdpi/action_search.pngbin0 -> 1764 bytes
-rw-r--r--samples/training/NavigationDrawer/res/drawable-hdpi/drawer_shadow.9.pngbin0 -> 171 bytes
-rw-r--r--samples/training/NavigationDrawer/res/drawable-hdpi/ic_drawer.pngbin0 -> 2842 bytes
-rwxr-xr-xsamples/training/NavigationDrawer/res/drawable-hdpi/ic_launcher.pngbin0 -> 3860 bytes
-rwxr-xr-xsamples/training/NavigationDrawer/res/drawable-mdpi/action_search.pngbin0 -> 1394 bytes
-rw-r--r--samples/training/NavigationDrawer/res/drawable-mdpi/drawer_shadow.9.pngbin0 -> 158 bytes
-rw-r--r--samples/training/NavigationDrawer/res/drawable-mdpi/ic_drawer.pngbin0 -> 2837 bytes
-rwxr-xr-xsamples/training/NavigationDrawer/res/drawable-mdpi/ic_launcher.pngbin0 -> 2378 bytes
-rwxr-xr-xsamples/training/NavigationDrawer/res/drawable-xhdpi/action_search.pngbin0 -> 2127 bytes
-rw-r--r--samples/training/NavigationDrawer/res/drawable-xhdpi/drawer_shadow.9.pngbin0 -> 182 bytes
-rw-r--r--samples/training/NavigationDrawer/res/drawable-xhdpi/ic_drawer.pngbin0 -> 1056 bytes
-rwxr-xr-xsamples/training/NavigationDrawer/res/drawable-xhdpi/ic_launcher.pngbin0 -> 5525 bytes
-rwxr-xr-xsamples/training/NavigationDrawer/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 10368 bytes
-rw-r--r--samples/training/NavigationDrawer/res/drawable/earth.jpgbin0 -> 98592 bytes
-rw-r--r--samples/training/NavigationDrawer/res/drawable/jupiter.jpgbin0 -> 32610 bytes
-rw-r--r--samples/training/NavigationDrawer/res/drawable/mars.jpgbin0 -> 144054 bytes
-rw-r--r--samples/training/NavigationDrawer/res/drawable/mercury.jpgbin0 -> 81442 bytes
-rw-r--r--samples/training/NavigationDrawer/res/drawable/neptune.jpgbin0 -> 32548 bytes
-rw-r--r--samples/training/NavigationDrawer/res/drawable/saturn.jpgbin0 -> 21019 bytes
-rw-r--r--samples/training/NavigationDrawer/res/drawable/uranus.jpgbin0 -> 13956 bytes
-rw-r--r--samples/training/NavigationDrawer/res/drawable/venus.jpgbin0 -> 12409 bytes
-rwxr-xr-xsamples/training/NavigationDrawer/res/layout/activity_main.xml47
-rw-r--r--samples/training/NavigationDrawer/res/layout/drawer_list_item.xml27
-rw-r--r--samples/training/NavigationDrawer/res/layout/fragment_planet.xml23
-rw-r--r--samples/training/NavigationDrawer/res/menu/main.xml22
-rwxr-xr-xsamples/training/NavigationDrawer/res/values/strings.xml33
-rwxr-xr-xsamples/training/NavigationDrawer/src/com/example/android/navigationdrawerexample/MainActivity.java240
-rw-r--r--samples/training/bitmapfun/src/com/example/android/bitmapfun/provider/Images.java286
-rw-r--r--samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageCache.java138
-rw-r--r--samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageFetcher.java3
-rw-r--r--samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageResizer.java49
-rw-r--r--samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageWorker.java47
-rw-r--r--scripts/app_engine_server/memcache_zipserve.py2
-rw-r--r--scripts/app_engine_server/redirects.yaml96
-rwxr-xr-xscripts/symbol.py3
-rw-r--r--sdk/api-versions.xml1629
-rw-r--r--sdk/build_tools_source.properties3
-rw-r--r--sdk/plat_tools_source.properties3
-rw-r--r--sdk/support_source.properties2
-rwxr-xr-xtestrunner/adb_interface.py2
-rw-r--r--testrunner/coverage_targets.xml2
-rw-r--r--testrunner/test_defs.xml33
-rw-r--r--testrunner/test_defs/instrumentation_test.py46
-rw-r--r--tools/emulator/opengl/Android.mk66
-rw-r--r--tools/emulator/opengl/README3
-rw-r--r--tools/emulator/opengl/common.mk240
-rw-r--r--tools/emulator/opengl/host/include/libOpenglRender/IOStream.h102
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/Android.mk23
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/ErrorLog.h37
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/FixedBuffer.h53
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp417
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h441
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/GLDecoderContextData.h69
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/GLErrorLog.h34
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp469
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/GLSharedGroup.h143
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/Makefile13
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/SmartPtr.h167
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.cpp168
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.h50
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/TcpStream.cpp91
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/TcpStream.h32
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/TimeUtils.cpp69
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/TimeUtils.h22
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/UnixStream.cpp137
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/UnixStream.h31
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/Win32PipeStream.cpp239
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/Win32PipeStream.h41
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/codec_defs.h23
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.cpp471
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.h95
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/gl_base_types.h62
-rw-r--r--tools/emulator/opengl/shared/OpenglOsUtils/Android.mk20
-rw-r--r--tools/emulator/opengl/shared/OpenglOsUtils/osDynLibrary.cpp79
-rw-r--r--tools/emulator/opengl/shared/OpenglOsUtils/osDynLibrary.h71
-rw-r--r--tools/emulator/opengl/shared/OpenglOsUtils/osProcess.h62
-rw-r--r--tools/emulator/opengl/shared/OpenglOsUtils/osProcessUnix.cpp210
-rw-r--r--tools/emulator/opengl/shared/OpenglOsUtils/osProcessWin.cpp171
-rw-r--r--tools/emulator/opengl/shared/OpenglOsUtils/osThread.h60
-rw-r--r--tools/emulator/opengl/shared/OpenglOsUtils/osThreadUnix.cpp94
-rw-r--r--tools/emulator/opengl/shared/OpenglOsUtils/osThreadWin.cpp101
-rw-r--r--tools/emulator/opengl/system/GLESv1/Android.mk12
-rw-r--r--tools/emulator/opengl/system/GLESv1/gl.cpp146
-rw-r--r--tools/emulator/opengl/system/GLESv1_enc/Android.mk19
-rw-r--r--tools/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp989
-rw-r--r--tools/emulator/opengl/system/GLESv1_enc/GLEncoder.h149
-rw-r--r--tools/emulator/opengl/system/GLESv1_enc/GLEncoderUtils.cpp24
-rw-r--r--tools/emulator/opengl/system/GLESv1_enc/GLEncoderUtils.h22
-rw-r--r--tools/emulator/opengl/system/GLESv1_enc/gl_client_context.cpp308
-rw-r--r--tools/emulator/opengl/system/GLESv1_enc/gl_client_context.h603
-rw-r--r--tools/emulator/opengl/system/GLESv1_enc/gl_client_proc.h305
-rw-r--r--tools/emulator/opengl/system/GLESv1_enc/gl_enc.cpp5184
-rw-r--r--tools/emulator/opengl/system/GLESv1_enc/gl_enc.h316
-rw-r--r--tools/emulator/opengl/system/GLESv1_enc/gl_entry.cpp2066
-rw-r--r--tools/emulator/opengl/system/GLESv1_enc/gl_ftable.h288
-rw-r--r--tools/emulator/opengl/system/GLESv1_enc/gl_opcodes.h300
-rw-r--r--tools/emulator/opengl/system/GLESv1_enc/gl_types.h20
-rw-r--r--tools/emulator/opengl/system/GLESv2/Android.mk12
-rw-r--r--tools/emulator/opengl/system/GLESv2/gl2.cpp143
-rw-r--r--tools/emulator/opengl/system/GLESv2_enc/Android.mk20
-rw-r--r--tools/emulator/opengl/system/GLESv2_enc/GL2Encoder.cpp1197
-rw-r--r--tools/emulator/opengl/system/GLESv2_enc/GL2Encoder.h216
-rw-r--r--tools/emulator/opengl/system/GLESv2_enc/GL2EncoderUtils.cpp39
-rw-r--r--tools/emulator/opengl/system/GLESv2_enc/GL2EncoderUtils.h24
-rw-r--r--tools/emulator/opengl/system/GLESv2_enc/gl2_client_context.cpp225
-rw-r--r--tools/emulator/opengl/system/GLESv2_enc/gl2_client_context.h437
-rw-r--r--tools/emulator/opengl/system/GLESv2_enc/gl2_client_proc.h222
-rw-r--r--tools/emulator/opengl/system/GLESv2_enc/gl2_enc.cpp3130
-rw-r--r--tools/emulator/opengl/system/GLESv2_enc/gl2_enc.h234
-rw-r--r--tools/emulator/opengl/system/GLESv2_enc/gl2_entry.cpp1483
-rw-r--r--tools/emulator/opengl/system/GLESv2_enc/gl2_ftable.h216
-rw-r--r--tools/emulator/opengl/system/GLESv2_enc/gl2_opcodes.h217
-rw-r--r--tools/emulator/opengl/system/GLESv2_enc/gl2_types.h21
-rw-r--r--tools/emulator/opengl/system/OpenglSystemCommon/Android.mk13
-rw-r--r--tools/emulator/opengl/system/OpenglSystemCommon/EGLClientIface.h41
-rw-r--r--tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp153
-rw-r--r--tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.h55
-rw-r--r--tools/emulator/opengl/system/OpenglSystemCommon/QemuPipeStream.cpp190
-rw-r--r--tools/emulator/opengl/system/OpenglSystemCommon/QemuPipeStream.h51
-rw-r--r--tools/emulator/opengl/system/OpenglSystemCommon/ThreadInfo.cpp39
-rw-r--r--tools/emulator/opengl/system/OpenglSystemCommon/ThreadInfo.h59
-rw-r--r--tools/emulator/opengl/system/OpenglSystemCommon/gralloc_cb.h108
-rw-r--r--tools/emulator/opengl/system/egl/Android.mk41
-rw-r--r--tools/emulator/opengl/system/egl/ClientAPIExts.cpp157
-rw-r--r--tools/emulator/opengl/system/egl/ClientAPIExts.h29
-rw-r--r--tools/emulator/opengl/system/egl/ClientAPIExts.in201
-rw-r--r--tools/emulator/opengl/system/egl/egl.cfg1
-rw-r--r--tools/emulator/opengl/system/egl/egl.cpp1254
-rw-r--r--tools/emulator/opengl/system/egl/eglContext.h51
-rw-r--r--tools/emulator/opengl/system/egl/eglDisplay.cpp497
-rw-r--r--tools/emulator/opengl/system/egl/eglDisplay.h89
-rw-r--r--tools/emulator/opengl/system/egl/egl_ftable.h64
-rw-r--r--tools/emulator/opengl/system/gralloc/Android.mk19
-rw-r--r--tools/emulator/opengl/system/gralloc/gralloc.cpp929
-rw-r--r--tools/emulator/opengl/system/renderControl_enc/Android.mk12
-rw-r--r--tools/emulator/opengl/system/renderControl_enc/README136
-rw-r--r--tools/emulator/opengl/system/renderControl_enc/renderControl.attrib41
-rw-r--r--tools/emulator/opengl/system/renderControl_enc/renderControl.in25
-rw-r--r--tools/emulator/opengl/system/renderControl_enc/renderControl.types11
-rw-r--r--tools/emulator/opengl/system/renderControl_enc/renderControl_client_context.cpp42
-rw-r--r--tools/emulator/opengl/system/renderControl_enc/renderControl_client_context.h71
-rw-r--r--tools/emulator/opengl/system/renderControl_enc/renderControl_client_proc.h39
-rw-r--r--tools/emulator/opengl/system/renderControl_enc/renderControl_enc.cpp536
-rw-r--r--tools/emulator/opengl/system/renderControl_enc/renderControl_enc.h51
-rw-r--r--tools/emulator/opengl/system/renderControl_enc/renderControl_entry.cpp192
-rw-r--r--tools/emulator/opengl/system/renderControl_enc/renderControl_ftable.h40
-rw-r--r--tools/emulator/opengl/system/renderControl_enc/renderControl_opcodes.h34
-rw-r--r--tools/emulator/opengl/system/renderControl_enc/renderControl_types.h28
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/Android.mk74
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/ApiInitializer.h42
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/CleanSpec.mk50
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/ServerConnection.cpp125
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/ServerConnection.h55
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/ThreadInfo.cpp39
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/ThreadInfo.h49
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/egl.cfg1
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/egl.cpp663
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/egl_dispatch.cpp71
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/egl_dispatch.h115
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/egl_ftable.h66
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/egl_proc.h68
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/gles.cpp1410
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/gles_dispatch.cpp298
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/gles_dispatch.h570
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/gles_emul.cfg7
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/gles_ftable.h292
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/gles_proc.h296
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/glesv1_emul_ifc.cpp39
-rw-r--r--tools/emulator/opengl/tests/gles_android_wrapper/glesv2_emul_ifc.cpp40
-rw-r--r--tools/emulator/opengl/tests/ut_rendercontrol_enc/Android.mk8
-rw-r--r--tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.attrib4
-rw-r--r--tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.in11
-rw-r--r--tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.types2
-rw-r--r--tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol_types.h17
-rwxr-xr-xtools/emulator/system/camera/Android.mk72
-rwxr-xr-xtools/emulator/system/camera/CallbackNotifier.cpp294
-rwxr-xr-xtools/emulator/system/camera/CallbackNotifier.h233
-rwxr-xr-xtools/emulator/system/camera/Converters.cpp173
-rwxr-xr-xtools/emulator/system/camera/Converters.h314
-rw-r--r--tools/emulator/system/camera/EmulatedBaseCamera.cpp73
-rw-r--r--tools/emulator/system/camera/EmulatedBaseCamera.h101
-rwxr-xr-xtools/emulator/system/camera/EmulatedCamera.cpp1041
-rwxr-xr-xtools/emulator/system/camera/EmulatedCamera.h401
-rw-r--r--tools/emulator/system/camera/EmulatedCamera2.cpp408
-rw-r--r--tools/emulator/system/camera/EmulatedCamera2.h272
-rwxr-xr-xtools/emulator/system/camera/EmulatedCameraCommon.h60
-rwxr-xr-xtools/emulator/system/camera/EmulatedCameraDevice.cpp397
-rwxr-xr-xtools/emulator/system/camera/EmulatedCameraDevice.h544
-rwxr-xr-xtools/emulator/system/camera/EmulatedCameraFactory.cpp449
-rwxr-xr-xtools/emulator/system/camera/EmulatedCameraFactory.h176
-rwxr-xr-xtools/emulator/system/camera/EmulatedCameraHal.cpp45
-rwxr-xr-xtools/emulator/system/camera/EmulatedFakeCamera.cpp90
-rwxr-xr-xtools/emulator/system/camera/EmulatedFakeCamera.h74
-rw-r--r--tools/emulator/system/camera/EmulatedFakeCamera2.cpp2705
-rw-r--r--tools/emulator/system/camera/EmulatedFakeCamera2.h424
-rwxr-xr-xtools/emulator/system/camera/EmulatedFakeCameraDevice.cpp430
-rwxr-xr-xtools/emulator/system/camera/EmulatedFakeCameraDevice.h197
-rwxr-xr-xtools/emulator/system/camera/EmulatedQemuCamera.cpp119
-rwxr-xr-xtools/emulator/system/camera/EmulatedQemuCamera.h73
-rw-r--r--tools/emulator/system/camera/EmulatedQemuCamera2.cpp55
-rw-r--r--tools/emulator/system/camera/EmulatedQemuCamera2.h66
-rwxr-xr-xtools/emulator/system/camera/EmulatedQemuCameraDevice.cpp265
-rwxr-xr-xtools/emulator/system/camera/EmulatedQemuCameraDevice.h121
-rw-r--r--tools/emulator/system/camera/JpegCompressor.cpp64
-rw-r--r--tools/emulator/system/camera/JpegCompressor.h98
-rwxr-xr-xtools/emulator/system/camera/PreviewWindow.cpp216
-rwxr-xr-xtools/emulator/system/camera/PreviewWindow.h165
-rwxr-xr-xtools/emulator/system/camera/QemuClient.cpp559
-rwxr-xr-xtools/emulator/system/camera/QemuClient.h437
-rw-r--r--tools/emulator/system/camera/fake-pipeline2/Base.h64
-rw-r--r--tools/emulator/system/camera/fake-pipeline2/JpegCompressor.cpp270
-rw-r--r--tools/emulator/system/camera/fake-pipeline2/JpegCompressor.h109
-rw-r--r--tools/emulator/system/camera/fake-pipeline2/Scene.cpp459
-rw-r--r--tools/emulator/system/camera/fake-pipeline2/Scene.h180
-rw-r--r--tools/emulator/system/camera/fake-pipeline2/Sensor.cpp500
-rw-r--r--tools/emulator/system/camera/fake-pipeline2/Sensor.h221
-rw-r--r--tools/emulator/system/camera/media_codecs.xml103
-rw-r--r--tools/emulator/system/camera/media_profiles.xml414
-rw-r--r--tools/emulator/system/gps/Android.mk36
-rw-r--r--tools/emulator/system/gps/gps_qemu.c955
-rw-r--r--tools/emulator/system/libqemu/test_guest_1.c105
-rw-r--r--tools/emulator/system/libqemu/test_guest_2.c240
-rw-r--r--tools/emulator/system/libqemu/test_host_1.c244
-rw-r--r--tools/emulator/system/libqemu/test_host_2.c129
-rw-r--r--tools/emulator/system/libqemu/test_util.c137
-rw-r--r--tools/emulator/system/libqemu/tests.mk30
-rw-r--r--tools/emulator/system/lights/Android.mk26
-rw-r--r--tools/emulator/system/lights/lights_qemu.c213
-rw-r--r--tools/emulator/system/qemu-props/qemu-props.c116
-rw-r--r--tools/emulator/system/qemud/Android.mk20
-rw-r--r--tools/emulator/system/qemud/qemud.c1719
-rw-r--r--tools/emulator/system/sensors/sensors_qemu.c637
-rw-r--r--tools/idegen/Android.mk3
-rwxr-xr-xtools/idegen/index-gen.sh50
-rwxr-xr-xtools/idegen/intellij-gen.sh60
-rw-r--r--tools/idegen/src/com/android/idegen/AggregatedModule.java132
-rw-r--r--tools/idegen/src/com/android/idegen/Constants.java46
-rw-r--r--tools/idegen/src/com/android/idegen/DirectorySearch.java141
-rw-r--r--tools/idegen/src/com/android/idegen/FrameworkModule.java46
-rw-r--r--tools/idegen/src/com/android/idegen/IntellijProject.java195
-rw-r--r--tools/idegen/src/com/android/idegen/MakeFileParser.java233
-rw-r--r--tools/idegen/src/com/android/idegen/Module.java198
-rw-r--r--tools/idegen/src/com/android/idegen/ModuleCache.java107
-rw-r--r--tools/idegen/src/com/android/idegen/ModuleIndexes.java122
-rw-r--r--tools/idegen/src/com/android/idegen/StandardModule.java215
-rw-r--r--tools/idegen/templates/idea/compiler.xml23
-rw-r--r--tools/idegen/templates/idea/copyright/Apache_2.xml9
-rw-r--r--tools/idegen/templates/idea/copyright/profiles_settings.xml7
-rw-r--r--tools/idegen/templates/idea/misc.xml46
-rw-r--r--tools/idegen/templates/idea/modules.xml9
-rw-r--r--tools/idegen/templates/idea/vcs.xml7
-rw-r--r--tools/idegen/templates/module-template.iml12
865 files changed, 38079 insertions, 59364 deletions
diff --git a/apps/Development/res/layout/connectivity.xml b/apps/Development/res/layout/connectivity.xml
index ff0c6ea6b..2df645ccf 100644
--- a/apps/Development/res/layout/connectivity.xml
+++ b/apps/Development/res/layout/connectivity.xml
@@ -18,6 +18,10 @@
*/
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/connectivity_layout"
+ android:descendantFocusability="beforeDescendants"
+ android:focusableInTouchMode="true"
+ android:focusable="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -173,6 +177,45 @@
android:paddingTop="4dip"
android:layout_width="match_parent"
android:layout_height="wrap_content">
+ <Button android:id="@+id/startScan"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/start_scan" />
+ <CheckBox android:id="@+id/scanDisconnect"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/disconnect" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:inputType="number"
+ android:text="@string/scan_cycles" />
+ <EditText android:id="@+id/sc_scan_cycles"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:minEms="5" />
+ <TextView android:id="@+id/sc_scan_results"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="14.5sp" />
+ </LinearLayout>
+
+ <!-- divider line -->
+ <View android:background="#FFFFFFFF"
+ android:layout_width="match_parent"
+ android:layout_height="3dip" />
+
+ <LinearLayout
+ android:orientation="horizontal"
+ android:paddingTop="4dip"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
<Button android:id="@+id/start_mms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/apps/Development/res/values/strings.xml b/apps/Development/res/values/strings.xml
index 10879316f..b7ed5e12e 100644
--- a/apps/Development/res/values/strings.xml
+++ b/apps/Development/res/values/strings.xml
@@ -30,6 +30,9 @@
<string name="stop_toggling">Stop Wifi Toggle</string>
<string name="start_screen_toggling">Start Screen Toggle</string>
<string name="stop_screen_toggling">Stop Screen Toggle</string>
+ <string name="start_scan">Start Scan</string>
+ <string name="scan_cycles">Scan Cycles: </string>
+ <string name="disconnect">Disconnect</string>
<string name="start_mms">Start MMS</string>
<string name="stop_mms">Stop MMS</string>
diff --git a/apps/Development/src/com/android/development/BadBehaviorActivity.java b/apps/Development/src/com/android/development/BadBehaviorActivity.java
index 78632206e..d34c3132e 100644
--- a/apps/Development/src/com/android/development/BadBehaviorActivity.java
+++ b/apps/Development/src/com/android/development/BadBehaviorActivity.java
@@ -107,6 +107,10 @@ public class BadBehaviorActivity extends Activity {
public int appNotResponding(String proc, int pid, String st) {
return 0;
}
+
+ public int systemNotResponding(String message) {
+ return 0;
+ }
}
@Override
diff --git a/apps/Development/src/com/android/development/Connectivity.java b/apps/Development/src/com/android/development/Connectivity.java
index c62d9b59b..95487dc1d 100644
--- a/apps/Development/src/com/android/development/Connectivity.java
+++ b/apps/Development/src/com/android/development/Connectivity.java
@@ -30,6 +30,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.net.ConnectivityManager;
import android.net.NetworkUtils;
import android.net.RouteInfo;
+import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.os.RemoteException;
import android.os.Handler;
@@ -65,7 +66,9 @@ import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.Socket;
+import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.List;
import java.util.Map;
import org.apache.http.client.HttpClient;
@@ -78,6 +81,11 @@ import org.apache.http.impl.client.DefaultHttpClient;
public class Connectivity extends Activity {
private static final String TAG = "DevTools - Connectivity";
+ private static final String GET_SCAN_RES = "Get Results";
+ private static final String START_SCAN = "Start Scan";
+ private static final String PROGRESS_SCAN = "In Progress";
+
+ private static final long SCAN_CYCLES = 15;
private static final int EVENT_TOGGLE_WIFI = 1;
private static final int EVENT_TOGGLE_SCREEN = 2;
@@ -98,11 +106,25 @@ public class Connectivity extends Activity {
private boolean mDelayedCycleStarted = false;
+ private Button mScanButton;
+ private TextView mScanResults;
+ private EditText mScanCyclesEdit;
+ private CheckBox mScanDisconnect;
+ private long mScanCycles = SCAN_CYCLES;
+ private long mScanCur = -1;
+ private long mStartTime = -1;
+ private long mStopTime;
+ private long mTotalScanTime = 0;
+ private long mTotalScanCount = 0;
+
private WifiManager mWm;
private PowerManager mPm;
private ConnectivityManager mCm;
private INetworkManagementService mNetd;
+ private WifiScanReceiver mScanRecv;
+ IntentFilter mIntentFilter;
+
private WakeLock mWakeLock = null;
private WakeLock mScreenonWakeLock = null;
@@ -185,6 +207,42 @@ public class Connectivity extends Activity {
}
};
+ /**
+ * Wifi Scan Listener
+ */
+ private class WifiScanReceiver extends BroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+
+ if (action.equals(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)) {
+ mStopTime = SystemClock.elapsedRealtime();
+ if (mStartTime != -1) {
+ mTotalScanTime += (mStopTime - mStartTime);
+ mStartTime = -1;
+ }
+ Log.d(TAG, "Scan: READY " + mScanCur);
+
+ List<ScanResult> wifiScanResults = mWm.getScanResults();
+ if (wifiScanResults != null) {
+ mTotalScanCount += wifiScanResults.size();
+ Log.d(TAG, "Scan: Results = " + wifiScanResults.size());
+ }
+
+ mScanCur--;
+ mScanCyclesEdit.setText(Long.toString(mScanCur));
+ if (mScanCur == 0) {
+ unregisterReceiver(mScanRecv);
+ mScanButton.setText(GET_SCAN_RES);
+ } else {
+ mStartTime = SystemClock.elapsedRealtime();
+ mWm.startScan();
+ }
+ }
+ }
+ }
+
+
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -218,6 +276,19 @@ public class Connectivity extends Activity {
mSCCycleCountView = (TextView)findViewById(R.id.sc_wifi_cycles_done);
mSCCycleCountView.setText(Integer.toString(mSCCycleCount));
+ mScanButton = (Button)findViewById(R.id.startScan);
+ mScanButton.setOnClickListener(mClickListener);
+ mScanCyclesEdit = (EditText)findViewById(R.id.sc_scan_cycles);
+ mScanCyclesEdit.setText(Long.toString(mScanCycles));
+ mScanDisconnect = (CheckBox)findViewById(R.id.scanDisconnect);
+ mScanDisconnect.setChecked(true);
+ mScanResults = (TextView)findViewById(R.id.sc_scan_results);
+ mScanResults.setVisibility(View.INVISIBLE);
+
+ mScanRecv = new WifiScanReceiver();
+ mIntentFilter = new IntentFilter();
+ mIntentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
+
findViewById(R.id.start_mms).setOnClickListener(mClickListener);
findViewById(R.id.stop_mms).setOnClickListener(mClickListener);
findViewById(R.id.start_hipri).setOnClickListener(mClickListener);
@@ -237,10 +308,10 @@ public class Connectivity extends Activity {
}
-
@Override
public void onResume() {
super.onResume();
+ findViewById(R.id.connectivity_layout).requestFocus();
}
private View.OnClickListener mClickListener = new View.OnClickListener() {
@@ -264,6 +335,9 @@ public class Connectivity extends Activity {
case R.id.stopScreenCycle:
onStopScreenCycle();
break;
+ case R.id.startScan:
+ onStartScanCycle();
+ break;
case R.id.start_mms:
mCm.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE,
Phone.FEATURE_ENABLE_MMS);
@@ -375,6 +449,42 @@ public class Connectivity extends Activity {
Phone.FEATURE_ENABLE_MMS);
}
+ private void onStartScanCycle() {
+ if (mScanCur == -1) {
+ try {
+ mScanCur = Long.parseLong(mScanCyclesEdit.getText().toString());
+ mScanCycles = mScanCur;
+ } catch (Exception e) { };
+ if (mScanCur <= 0) {
+ mScanCur = -1;
+ mScanCycles = SCAN_CYCLES;
+ return;
+ }
+ }
+ if (mScanCur > 0) {
+ registerReceiver(mScanRecv, mIntentFilter);
+ mScanButton.setText(PROGRESS_SCAN);
+ mScanResults.setVisibility(View.INVISIBLE);
+ if (mScanDisconnect.isChecked())
+ mWm.disconnect();
+ mTotalScanTime = 0;
+ mTotalScanCount = 0;
+ mStartTime = SystemClock.elapsedRealtime();
+ mWm.startScan();
+ } else {
+ // Show results
+ mScanResults.setText("Average Scan Time = " +
+ Long.toString(mTotalScanTime / mScanCycles) + " ms ; Average Scan Amount = " +
+ Long.toString(mTotalScanCount / mScanCycles));
+ mScanResults.setVisibility(View.VISIBLE);
+ mScanButton.setText(START_SCAN);
+ mScanCur = -1;
+ mScanCyclesEdit.setText(Long.toString(mScanCycles));
+ if (mScanDisconnect.isChecked())
+ mWm.reassociate();
+ }
+ }
+
private void onAddDefaultRoute() {
try {
mNetd.addRoute("eth0", new RouteInfo(null,
diff --git a/apps/Development/src/com/android/development/EnterURL.java b/apps/Development/src/com/android/development/EnterURL.java
deleted file mode 100644
index 76b8a34c5..000000000
--- a/apps/Development/src/com/android/development/EnterURL.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/* //device/apps/Notes/NotesList.java
-**
-** Copyright 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.development;
-
-import android.app.ListActivity;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.Intent;
-import android.database.Cursor;
-import android.database.sqlite.SQLiteDatabase;
-import android.net.Uri;
-import android.os.Bundle;
-import android.text.Editable;
-import android.text.Selection;
-import android.text.format.DateUtils;
-import android.util.AttributeSet;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.EditText;
-import android.widget.ListView;
-import android.widget.SimpleAdapter;
-import android.graphics.Rect;
-
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-
-public class EnterURL extends ListActivity
-{
- private static final int DATABASE_VERSION = 1;
- public static class UrlEditText extends EditText
- {
- public UrlEditText(Context context, AttributeSet attrs)
- {
- super(context, attrs);
- }
-
- @Override
- protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect)
- {
- super.onFocusChanged(focused, direction, previouslyFocusedRect);
- if (focused) {
- Editable text = getText();
- String str = text.toString();
- int highlightStart = 0;
- if (str.startsWith("content://")) {
- highlightStart = "content://".length();
- }
- Selection.setSelection(text, highlightStart, text.length());
- }
- }
- }
-
- public static class DisplayEditText extends EditText
- {
- public DisplayEditText(Context context, AttributeSet attrs)
- {
- super(context, attrs);
- }
-
- @Override
- protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect)
- {
- super.onFocusChanged(focused, direction, previouslyFocusedRect);
- if (focused) {
- Editable text = getText();
- Selection.setSelection(text, 0, text.length());
- }
- }
- }
-
- @Override
- public View onCreateView(String name, Context context, AttributeSet attrs)
- {
- if (name.equals("com.android.development.UrlEditText")) {
- return new UrlEditText(this, attrs);
- }
- if (name.equals("com.android.development.DisplayEditText")) {
- return new DisplayEditText(this, attrs);
- }
- return null;
- }
-
- View.OnClickListener mViewItemAction = new View.OnClickListener () {
- public void onClick(View v)
- {
- String url = mUrlField.getText().toString();
- String display = mDisplayField.getText().toString();
- viewItem(url, display);
- }
- };
-
- public void onCreate(Bundle icicle)
- {
- super.onCreate(icicle);
- setContentView(R.layout.enter_url);
-
- // display
- mDisplayField = (DisplayEditText)findViewById(R.id.display_edit_text);
- mDisplayField.setOnClickListener(mViewItemAction);
- // url
- mUrlField = (UrlEditText)findViewById(R.id.url_edit_text);
- mUrlField.setOnClickListener(mViewItemAction);
- }
-
- public void onStop()
- {
- super.onStop();
-
- if (mCursor != null) {
- mCursor.deactivate();
- }
- }
-
- public void onResume()
- {
- super.onResume();
-
- // show the history
- loadPrefs();
- fillListView();
- if (mHistory.size() > 0) {
- ListView lv = this.getListView();
- lv.setSelection(0);
- lv.requestFocus();
- }
- }
-
- public boolean onCreateOptionsMenu(Menu menu)
- {
- super.onCreateOptionsMenu(menu);
- menu.add(0, 0, 0, "Clear Bookmarks").setOnMenuItemClickListener(mClearBookmarks);
- return true;
- }
-
- protected void onListItemClick(ListView l, View v, int position, long id)
- {
- HistoryEntry he = mHistory.get(position);
- viewItem(he.url, he.display);
- }
-
- private final void viewItem(String url, String display)
- {
- // -------------- save this in the history ----------------
- // look in the history
- int count = mHistory.size();
- int i;
- for (i=0; i<count; i++) {
- HistoryEntry he = mHistory.get(i);
- if (he.url.equals(url) && he.display.equals(display)) {
- he.updateAccessTime();
- mHistory.remove(i);
- mHistory.add(0, he);
- break;
- }
- }
- if (i >= count) {
- // didn't find it, add it first
- HistoryEntry he = new HistoryEntry();
- he.url = url;
- he.display = display;
- he.updateAccessTime();
- mHistory.add(0, he);
- }
-
- savePrefs();
-
- // -------------- view it ---------------------------------
- Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
- intent.setClass(this, DataList.class);
- intent.putExtra("display", display);
- startActivity(intent);
- }
-
- MenuItem.OnMenuItemClickListener mClearBookmarks = new MenuItem.OnMenuItemClickListener() {
- public boolean onMenuItemClick(MenuItem item) {
- mHistory.clear();
- savePrefs();
- fillListView();
- return true;
- }
- };
-
- private void fillListView()
- {
- loadPrefs();
- ArrayList<HashMap<String, String>> d = new ArrayList<HashMap<String, String>>();
- int count = mHistory.size();
- for (int i=0; i<count; i++) {
- HashMap<String, String> m = new HashMap<String, String>();
- HistoryEntry he = mHistory.get(i);
- m.put("title", he.url + " (" + he.display + ")");
- d.add(m);
- }
- setListAdapter(new SimpleAdapter(this, d, R.layout.url_list,
- new String[] {"title"},
- new int[] {android.R.id.text1}));
- }
-
- SQLiteDatabase openDB()
- {
- SQLiteDatabase db = null;
- db = openOrCreateDatabase("inspector.db", 0, null);
- int version = db.getVersion();
- if (version != DATABASE_VERSION) {
- db.execSQL("CREATE TABLE History ("
- + " url TEXT,"
- + " display TEXT,"
- + " lastAccessTime TEXT"
- + ");");
- db.execSQL("CREATE TABLE FieldState ("
- + " url TEXT,"
- + " display TEXT"
- + ");");
- db.setVersion(DATABASE_VERSION);
- }
- return db;
- }
-
- private void loadPrefs()
- {
- SQLiteDatabase db = openDB();
- Cursor c = db.query("History",
- new String[] { "url", "display", "lastAccessTime" },
- null, null, null, null, "lastAccessTime DESC");
- int urlCol = c.getColumnIndex("url");
- int accessCol = c.getColumnIndex("lastAccessTime");
- int displayCol = c.getColumnIndex("display");
- mHistory.clear();
- while (c.moveToNext()) {
- HistoryEntry he = new HistoryEntry();
- he.url = c.getString(urlCol);
- he.display = c.getString(displayCol);
- he.lastAccessTime = c.getString(accessCol);
- mHistory.add(he);
- }
-
- c = db.query("FieldState", null, null, null, null, null, null);
- if (c.moveToNext()) {
- urlCol = c.getColumnIndex("url");
- displayCol = c.getColumnIndex("display");
- mUrlField.setText(c.getString(urlCol));
- mDisplayField.setText(c.getString(displayCol));
- } else {
- mDisplayField.setText("_id");
- mUrlField.setText("content://");
- }
-
- db.close();
- }
-
- private void savePrefs()
- {
- ContentValues m;
- HistoryEntry he;
-
- SQLiteDatabase db = openDB();
- db.execSQL("DELETE FROM History;");
- int count = mHistory.size();
- for (int i=0; i<count; i++) {
- m = new ContentValues();
- he = mHistory.get(i);
- m.put("url", he.url);
- m.put("display", he.display);
- m.put("lastAccessTime", he.lastAccessTime);
- db.insert("History", null, m);
- }
-
- db.execSQL("DELETE FROM FieldState");
- m = new ContentValues();
- m.put("url", mUrlField.getText().toString());
- m.put("display", mDisplayField.getText().toString());
- db.insert("FieldState", null, m);
-
- db.close();
- }
-
- private class HistoryEntry
- {
- public String url;
- public String display;
- public String lastAccessTime;
- public void updateAccessTime()
- {
- this.lastAccessTime = DateUtils.writeDateTime(
- new GregorianCalendar());
- }
- }
-
- private ArrayList<HistoryEntry> mHistory = new ArrayList<HistoryEntry>();
- private UrlEditText mUrlField;
- private DisplayEditText mDisplayField;
- private Cursor mCursor;
-}
diff --git a/apps/Development/src/com/android/development/InstrumentationList.java b/apps/Development/src/com/android/development/InstrumentationList.java
index eb6c2519b..fddfe86e8 100644
--- a/apps/Development/src/com/android/development/InstrumentationList.java
+++ b/apps/Development/src/com/android/development/InstrumentationList.java
@@ -155,7 +155,8 @@ public class InstrumentationList extends ListActivity
}
try {
ActivityManagerNative.getDefault().
- startInstrumentation(className, profilingFile, 0, null, mWatcher, UserHandle.myUserId());
+ startInstrumentation(className, profilingFile, 0, null, mWatcher, null,
+ UserHandle.myUserId());
} catch (RemoteException ex) {
}
}
diff --git a/apps/FontLab/Android.mk b/apps/FontLab/Android.mk
deleted file mode 100644
index 3cad52a4c..000000000
--- a/apps/FontLab/Android.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := FontLab
-
-include $(BUILD_PACKAGE)
diff --git a/apps/FontLab/AndroidManifest.xml b/apps/FontLab/AndroidManifest.xml
deleted file mode 100644
index ea961d539..000000000
--- a/apps/FontLab/AndroidManifest.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.fontlab">
- <application android:label="Font lab">
- <activity android:name="FontLab">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.DEFAULT" />
- <category android:name="android.intent.category.TEST" />
- </intent-filter>
- </activity>
- <activity android:name="BackgroundPicker"/>
- <activity android:name="FontPicker"/>
- </application>
-</manifest>
diff --git a/apps/FontLab/MODULE_LICENSE_APACHE2 b/apps/FontLab/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb..000000000
--- a/apps/FontLab/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/apps/FontLab/NOTICE b/apps/FontLab/NOTICE
deleted file mode 100644
index c5b1efa7a..000000000
--- a/apps/FontLab/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
- Copyright (c) 2005-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.
-
- 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.
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
diff --git a/apps/FontLab/src/com/android/fontlab/BackgroundPicker.java b/apps/FontLab/src/com/android/fontlab/BackgroundPicker.java
deleted file mode 100644
index e23ac82d8..000000000
--- a/apps/FontLab/src/com/android/fontlab/BackgroundPicker.java
+++ /dev/null
@@ -1,77 +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.fontlab;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import android.app.ListActivity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.ListView;
-import android.widget.SimpleAdapter;
-
-
-public abstract class BackgroundPicker extends ListActivity
-{
-
- public void onCreate(Bundle icicle)
- {
- super.onCreate(icicle);
-
- setListAdapter(new SimpleAdapter(this,
- getData(),
- android.R.layout.simple_list_item_1,
- new String[] {"title"},
- new int[] {android.R.id.text1}));
- }
-
- protected List getData()
- {
- List myData = new ArrayList<Bundle>();
- addItem(myData, "Solid White", 0, 0xFFFFFFFF, 0xFF000000);
- addItem(myData, "Solid Light Gray", 0, 0xFFBFBFBF, 0xFF000000);
- addItem(myData, "Solid Dark Gray", 0, 0xFF404040, 0xFFFFFFFF);
- addItem(myData, "Solid Black", 0, 0xFF000000, 0xFFFFFFFF);
- addItem(myData, "Solid Blue", 0, 0xFF1a387a, 0xFFFFFFFF);
- addItem(myData, "Textured White", 0, 0, 0xFF000000);
- // addItem(myData, "Textured Blue", android.R.drawable.screen_background_blue, 0, 0xFFFFFFFF);
-
- return myData;
- }
-
- protected void addItem(List<Bundle> data, String name, int textureRes, int bgColor, int textColor)
- {
- Bundle temp = new Bundle();
- temp.putString("title", name);
- if (textureRes != 0) {
- temp.putInt("texture", textureRes);
- }
- temp.putInt("bgcolor", bgColor);
- temp.putInt("text", textColor);
- data.add(temp);
- }
-
- protected void onListItemClick(ListView l, View v, int position, long id)
- {
- Bundle map = (Bundle) l.getItemAtPosition(position);
- setResult(RESULT_OK, (new Intent()).putExtras(map));
- finish();
- }
-
-}
diff --git a/apps/FontLab/src/com/android/fontlab/FontLab.java b/apps/FontLab/src/com/android/fontlab/FontLab.java
deleted file mode 100644
index 611d34d8e..000000000
--- a/apps/FontLab/src/com/android/fontlab/FontLab.java
+++ /dev/null
@@ -1,372 +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.fontlab;
-
-import java.util.Map;
-
-import android.app.Activity;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Typeface;
-import android.graphics.drawable.PaintDrawable;
-import android.os.Bundle;
-import android.view.KeyEvent;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.TextView;
-
-public class FontLab extends Activity {
- private static final int MIN_SIZE = 1;
- private static final int MAX_SIZE = 60;
-
- private static final float SCALE_X_RANGE = 20;
- private static final int MAX_SCALE_X = 20;
- private static final int MIN_SCALE_X = -19; // -20 would make zero-scale
-
- private static final int MAX_GAMMA = 40;
- private static final int MIN_GAMMA = 1;
- private static final float GAMMA_RANGE = 20;
-
- private static final String[] sText = {
- "Applications Contacts Maps Google Browser Text messages Address book"
- + " Development Earth Quake Settings Voicemail Zoolander. Four score"
- + " and seven years ago our fathers brought forth on this continent, a"
- + " new nation, conceived in Liberty, and dedicated to the proposition"
- + " that all men are created equal. Now we are engaged in a great civil"
- + " war, testing whether that nation, or any nation so conceived and so"
- + " dedicated, can long endure. We are met on a great battle-field of"
- + " that war. We have come to dedicate a portion of that field, as a"
- + " final resting place for those who here gave their lives that that"
- + " nation might live. It is altogether fitting and proper that we"
- + " should do this. But, in a larger sense, we can not dedicate - we"
- + " can not consecrate - we can not hallow - this ground. The brave"
- + " men, living and dead, who struggled here, have consecrated it, far"
- + " above our poor power to add or detract. The world will little note,"
- + " nor long remember what we say here, but it can never forget what"
- + " they did here. It is for us the living, rather, to be dedicated"
- + " here to the unfinished work which they who fought here have thus"
- + " far so nobly advanced. It is rather for us to be here dedicated to"
- + " the great task remaining before us - that from these honored dead"
- + " we take increased devotion to that cause for which they gave the"
- + " last full measure of devotion - that we here highly resolve that"
- + " these dead shall not have died in vain - that this nation, under"
- + " God, shall have a new birth of freedom - and that government of the"
- + " people, by the people, for the people, shall not perish from the"
- + " earth."
- ,
- "A Spanish doctor on Tuesday stood by his opinion that Fidel Castro is recovering from stomach surgery despite a newspaper report stating the Cuban leader is in a serious condition after a number of failed operations."
- + " When Senator Wayne Allard, Republican of Colorado, announced Monday that he would not seek re-election, the uphill battle for his party to reclaim the Senate in 2008 became an even steeper climb."
- + " Naomi Campbell was today sentenced to five days' community service and ordered to attend an anger management course after she admitted throwing a mobile phone at her maid."
- ,
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*()-_=+[]\\{}|;':\",./<>?"
- ,
- "HaH HbH HcH HdH HeH HfH HgH HhH HiH HjH HkH HlH HmH HnH HoH HpH HqH HrH HsH HtH HuH HvH HwH HxH HyH HzH"
- + "HAH HBH HCH HDH HEH HFH HGH HHH HIH HJH HKH HLH HMH HNH HOH HPH HQH HRH HSH HTH HUH HVH HWH HXH HYH HZH"
- };
-
- private void updateText() {
- mTextIndex %= sText.length;
- String s = sText[mTextIndex];
- mColumn1.setText(s);
- mColumn2.setText(s);
- }
-
- public FontLab() {}
-
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- setContentView(R.layout.font_lab);
-
- mColumn1 = (TextView)findViewById(R.id.column1);
- mColumn2 = (TextView)findViewById(R.id.column2);
- mContentView = findViewById(R.id.content);
-
-
- mColumn1.setTextSize(mFontSize);
- mColumn2.setTextSize(mFontSize);
-
- mColumn1.setTextColor(Color.BLACK);
- mColumn1.setBackgroundDrawable(new PaintDrawable(Color.WHITE));
- mColumn2.setTextColor(Color.WHITE);
- mColumn2.setBackgroundDrawable(new PaintDrawable(Color.BLACK));
-
- refreshFont();
- updateTitle();
- updateText();
-
- setDefaultKeyMode(Activity.DEFAULT_KEYS_SHORTCUT);
-
- mColumn1.setPadding(5, 0, 5, 0);
- mColumn2.setPadding(5, 0, 5, 0);
- }
-
- private void updateTitle() {
- Typeface tf = mColumn1.getTypeface();
- String title = " PS=" + mFontSize + " X="
- + (1 + mTextScaleXDelta/SCALE_X_RANGE)
- + " G=" + (mGamma/GAMMA_RANGE)
- + " S=" + ((mColumn1.getPaintFlags() & Paint.SUBPIXEL_TEXT_FLAG) != 0 ? 1 : 0)
- + " " + sTypefaceName[mFontIndex]
- + " " + sStyleName[tf.getStyle()]
- ;
- setTitle(title);
- }
-
- /** Called when it is time to initialize the activity state. */
- protected void onRestoreInstanceState(Bundle state) {
- super.onRestoreInstanceState(state);
- }
-
- protected void onResume() {
- super.onResume();
- }
-
- private static final String sStyleName[] = {
- "Regular", "Bold", "Italic", "Bold Italic"
- };
- private static final String sTypefaceName[] = {
- "Sans",
- "Serif",
- "Mono"
- };
- private static final Typeface sTypeface[] = {
- Typeface.SANS_SERIF,
- Typeface.SERIF,
- Typeface.MONOSPACE
- };
- private static final int FONT_INDEX_SANS = 0; // index into sTypeface
- private static final int FONT_INDEX_SERIF = 1; // index into sTypeface
- private static final int FONT_INDEX_MONO = 2; // index into sTypeface
-
- private static boolean canSupportStyle(Typeface tf, int styleBits) {
- tf = Typeface.create(tf, styleBits);
- return (tf.getStyle() & styleBits) == styleBits;
- }
-
- private void refreshFont() {
- Typeface tf = Typeface.create(sTypeface[mFontIndex], mFontStyle);
- mColumn1.setTypeface(tf);
- mColumn2.setTypeface(tf);
- updateTitle();
- }
-
- private MenuItem.OnMenuItemClickListener mFontClickListener = new MenuItem.OnMenuItemClickListener() {
- public boolean onMenuItemClick(MenuItem item) {
- mFontIndex = item.getItemId();
- refreshFont();
- return true;
- }
- };
-
- private void addFontMenu(Menu menu, int index) {
- MenuItem item = menu.add(0, index, 0, sTypefaceName[index]);
- item.setCheckable(true);
- item.setOnMenuItemClickListener(mFontClickListener);
- item.setChecked(index == mFontIndex);
- }
-
- private MenuItem.OnMenuItemClickListener mStyleClickListener = new MenuItem.OnMenuItemClickListener() {
- public boolean onMenuItemClick(MenuItem item) {
- mFontStyle = mFontStyle ^ item.getItemId();
- refreshFont();
- return true;
- }
- };
-
- private void addStyleMenu(Menu menu, int style, char shortCut) {
- MenuItem item = menu.add(0, style, 0, (style == Typeface.BOLD) ? "Bold" : "Italic");
- item.setCheckable(true);
- item.setOnMenuItemClickListener(mStyleClickListener);
- item.setChecked((mFontStyle & style) != 0);
-
- item.setVisible(canSupportStyle(sTypeface[mFontIndex], style));
- if (shortCut != 0) {
- item.setAlphabeticShortcut(shortCut);
- }
- }
-
- private MenuItem.OnMenuItemClickListener mFlagClickListener = new MenuItem.OnMenuItemClickListener() {
- public boolean onMenuItemClick(MenuItem item) {
- int mask = item.getItemId();
- mColumn1.setPaintFlags(mColumn1.getPaintFlags() ^ mask);
- mColumn2.setPaintFlags(mColumn2.getPaintFlags() ^ mask);
- updateTitle();
- return true;
- }
- };
-
- private
- void addFlagMenu(Menu menu, int paintFlag, String label, char shortCut) {
- MenuItem item = menu.add(0, paintFlag, 0, label);
- item.setCheckable(true);
- item.setOnMenuItemClickListener(mFlagClickListener);
- item.setChecked((mColumn1.getPaintFlags() & paintFlag) != 0);
- if (shortCut != 0) {
- item.setAlphabeticShortcut(shortCut);
- }
- }
-
- private static void addListenerMenu(MenuItem item,
- MenuItem.OnMenuItemClickListener listener,
- char keyChar) {
- item.setOnMenuItemClickListener(listener);
- if (keyChar != '\0') {
- item.setAlphabeticShortcut(keyChar);
- }
- }
-
- public boolean onCreateOptionsMenu(Menu menu) {
- super.onCreateOptionsMenu(menu);
- return true;
- }
-
- @Override public boolean onPrepareOptionsMenu(Menu menu) {
- super.onPrepareOptionsMenu(menu);
- menu.clear();
-
- addFontMenu(menu, FONT_INDEX_SANS);
- addFontMenu(menu, FONT_INDEX_SERIF);
-// addFontMenu(menu, FONT_INDEX_MONO);
- addStyleMenu(menu, Typeface.BOLD, 'b');
- addStyleMenu(menu, Typeface.ITALIC, 'i');
- addFlagMenu(menu, Paint.SUBPIXEL_TEXT_FLAG, "SubPixel", 's');
- // addFlagMenu(menu, Paint.DEV_KERN_TEXT_FLAG, "DevKern", 'k');
- menu.add(0, 0, 0, "Text").setOnMenuItemClickListener(mTextCallback).setAlphabeticShortcut('t');
-
- return true;
- }
-
- protected void onActivityResult(int requestCode, int resultCode,
- String data, Map extras) {
- if (resultCode == RESULT_OK) {
- switch (requestCode) {
- case BACKGROUND_PICKED:
- {
- int color = ((Integer)extras.get("text")).intValue();
- mColumn1.setTextColor(color);
- mColumn2.setTextColor(color);
-
- int colorTranslucent = (color & 0x00FFFFFF) + 0x77000000;
-
- setTitleColor(color);
-
- Integer texture = (Integer)extras.get("texture");
- if (texture != null) {
- mContentView.setBackgroundResource(texture.intValue());
- } else {
- color = ((Integer)extras.get("bgcolor")).intValue();
- mContentView.setBackgroundColor(color);
- }
- }
- break;
- }
- }
- }
-
- @Override public boolean onKeyDown(int keyCode, KeyEvent event) {
- int size = mFontSize;
- int scaleX = mTextScaleXDelta;
-
- switch (keyCode) {
- case KeyEvent.KEYCODE_DPAD_DOWN:
- size -= 1;
- break;
- case KeyEvent.KEYCODE_DPAD_UP:
- size += 1;
- break;
- case KeyEvent.KEYCODE_DPAD_RIGHT:
- scaleX += 1;
- break;
- case KeyEvent.KEYCODE_DPAD_LEFT:
- scaleX -= 1;
- break;
- case KeyEvent.KEYCODE_U:
- case KeyEvent.KEYCODE_VOLUME_UP:
- changeGamma(1);
- return true;
- case KeyEvent.KEYCODE_D:
- case KeyEvent.KEYCODE_VOLUME_DOWN:
- changeGamma(-1);
- return true;
- default:
- return super.onKeyDown(keyCode, event);
- }
-
- size = Math.min(MAX_SIZE, Math.max(MIN_SIZE, size));
- if (size != mFontSize) {
- mFontSize = size;
- mColumn1.setTextSize(mFontSize);
- mColumn2.setTextSize(mFontSize);
- updateTitle();
- return true;
- }
-
- scaleX = Math.min(MAX_SCALE_X, Math.max(MIN_SCALE_X, scaleX));
- if (scaleX != mTextScaleXDelta) {
- mTextScaleXDelta = scaleX;
- mColumn1.setTextScaleX(1 + scaleX / SCALE_X_RANGE);
- mColumn2.setTextScaleX(1 + scaleX / SCALE_X_RANGE);
- updateTitle();
- return true;
- }
-
- return super.onKeyDown(keyCode, event);
- }
-
- // default to gamma of 1.0
- private int mGamma = Math.round(1.0f * GAMMA_RANGE);
-
- private void changeGamma(int delta) {
- int gamma = Math.min(MAX_GAMMA, Math.max(MIN_GAMMA, mGamma + delta));
- if (gamma != mGamma) {
- mGamma = gamma;
- updateTitle();
- float blackGamma = mGamma / GAMMA_RANGE;
- Typeface.setGammaForText(blackGamma, 1 / blackGamma);
- mContentView.invalidate();
- }
- }
-
- private void setFont(TextView t, TextView f, Map extras) {
- int style = ((Integer)extras.get("style")).intValue();
- String font = (String)extras.get("font");
- t.setTypeface(Typeface.create(font, style));
-
- f.setText((String)extras.get("title"));
- }
-
- MenuItem.OnMenuItemClickListener mTextCallback = new MenuItem.OnMenuItemClickListener() {
- public boolean onMenuItemClick(MenuItem item) {
- mTextIndex += 1;
- updateText();
- return true;
- }
- };
-
- private static final int BACKGROUND_PICKED = 1;
-
- private TextView mColumn1;
- private TextView mColumn2;
- private View mContentView;
- private int mFontIndex = FONT_INDEX_SANS;
- private int mFontStyle = Typeface.NORMAL;
- private int mFontSize = 18;
- private int mTextIndex;
- private int mTextScaleXDelta;
-}
-
diff --git a/apps/FontLab/src/com/android/fontlab/FontPicker.java b/apps/FontLab/src/com/android/fontlab/FontPicker.java
deleted file mode 100644
index 7f4fdb672..000000000
--- a/apps/FontLab/src/com/android/fontlab/FontPicker.java
+++ /dev/null
@@ -1,74 +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.fontlab;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import android.app.ListActivity;
-import android.content.Intent;
-import android.graphics.Typeface;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.ListView;
-import android.widget.SimpleAdapter;
-
-
-public abstract class FontPicker extends ListActivity
-{
-
- public void onCreate(Bundle icicle)
- {
- super.onCreate(icicle);
-
- setListAdapter(new SimpleAdapter(this,
- getData(),
- android.R.layout.simple_list_item_1,
- new String[] {"title"},
- new int[] {android.R.id.text1}));
- }
-
- protected List getData()
- {
- List myData = new ArrayList<Bundle>(7);
- addItem(myData, "Sans", "sans-serif", Typeface.NORMAL);
- addItem(myData, "Sans Bold", "sans-serif", Typeface.BOLD);
- addItem(myData, "Serif", "serif", Typeface.NORMAL);
- addItem(myData, "Serif Bold", "serif", Typeface.BOLD);
- addItem(myData, "Serif Italic", "serif", Typeface.ITALIC);
- addItem(myData, "Serif Bold Italic", "serif", Typeface.BOLD_ITALIC);
- addItem(myData, "Mono", "monospace", Typeface.NORMAL);
- return myData;
- }
-
- protected void addItem(List<Bundle> data, String name, String fontName, int style)
- {
- Bundle temp = new Bundle();
- temp.putString("title", name);
- temp.putString("font", fontName);
- temp.putInt("style", style);
- data.add(temp);
- }
-
- protected void onListItemClick(ListView l, View v, int position, long id)
- {
- Bundle map = (Bundle) l.getItemAtPosition(position);
- setResult(RESULT_OK, (new Intent()).putExtras(map));
- finish();
- }
-
-}
diff --git a/build/Android.mk b/build/Android.mk
index b66b7dd3f..6d798dec7 100644
--- a/build/Android.mk
+++ b/build/Android.mk
@@ -118,6 +118,11 @@ $(eval _psm_build_module :=)
$(eval _psm_packaging_target :=)
endef
-ANDROID_SUPPORT_LIBRARIES := android-support-v4 android-support-v7-gridlayout android-support-v13
+ANDROID_SUPPORT_LIBRARIES := \
+ android-support-v4 \
+ android-support-v7-gridlayout \
+ android-support-v7-appcompat \
+ android-support-v7-mediarouter \
+ android-support-v13
$(foreach lib, $(ANDROID_SUPPORT_LIBRARIES), $(eval $(call _package_sdk_library,$(lib))))
diff --git a/build/product_sdk.mk b/build/product_sdk.mk
index ad827788d..f7ebfd25d 100644
--- a/build/product_sdk.mk
+++ b/build/product_sdk.mk
@@ -27,7 +27,9 @@
# Host tools and java libraries that are parts of the SDK.
PRODUCT_PACKAGES += \
+ aapt \
adb \
+ aidl \
bios.bin \
commons-compress-1.0 \
dexdump \
@@ -43,11 +45,9 @@ PRODUCT_PACKAGES += \
jython \
layoutlib \
layoutlib-tests \
+ llvm-rs-cc \
org.eclipse.jface_3.6.2.M20110210-1200 \
org.eclipse.equinox.common_3.6.0.v20100503 \
org.eclipse.core.commands_3.6.0.I20100512-1500 \
osgi \
- swing-worker-1.1 \
vgabios-cirrus.bin
-
-:qa!
diff --git a/build/sdk-windows-x86.atree b/build/sdk-windows-x86.atree
index 2eee75da0..c9ec5f97a 100644
--- a/build/sdk-windows-x86.atree
+++ b/build/sdk-windows-x86.atree
@@ -26,6 +26,10 @@
# are controled by sdk/build/tools.windows.atree.
#
+##############################################################################
+# Platform Tools Component
+##############################################################################
+
rm platform-tools/adb
rm platform-tools/fastboot
bin/adb.exe strip platform-tools/adb.exe
@@ -33,20 +37,30 @@ bin/fastboot.exe strip platform-tools/fastboot.exe
bin/AdbWinUsbApi.dll platform-tools/AdbWinUsbApi.dll
bin/AdbWinApi.dll platform-tools/AdbWinApi.dll
-rm platform-tools/aapt
-bin/aapt.exe strip platform-tools/aapt.exe
-rm platform-tools/aidl
-bin/aidl.exe strip platform-tools/aidl.exe
+##############################################################################
+# Build Tools Component
+##############################################################################
+
+rm build-tools/${PLATFORM_NAME}/aapt
+bin/aapt.exe strip build-tools/${PLATFORM_NAME}/aapt.exe
+
+rm build-tools/${PLATFORM_NAME}/aidl
+bin/aidl.exe strip build-tools/${PLATFORM_NAME}/aidl.exe
+
+rm build-tools/${PLATFORM_NAME}/dx
+dalvik/dx/etc/dx.bat build-tools/${PLATFORM_NAME}/dx.bat
+rm build-tools/${PLATFORM_NAME}/dexdump
+bin/dexdump.exe strip build-tools/${PLATFORM_NAME}/dexdump.exe
+
+rm build-tools/${PLATFORM_NAME}/llvm-rs-cc
+bin/llvm-rs-cc.exe strip build-tools/${PLATFORM_NAME}/llvm-rs-cc.exe
-rm platform-tools/dx
-dalvik/dx/etc/dx.bat platform-tools/dx.bat
-rm platform-tools/dexdump
-bin/dexdump.exe strip platform-tools/dexdump.exe
-rm platform-tools/llvm-rs-cc
-bin/llvm-rs-cc.exe strip platform-tools/llvm-rs-cc.exe
+##############################################################################
+# Docs Component
+##############################################################################
external/sonivox/docs/JET_Authoring_Guidelines.html docs/JetCreator/JET_Authoring_Guidelines.html
external/sonivox/docs/JET_Authoring_Guidelines_files docs/JetCreator/JET_Authoring_Guidelines_files
diff --git a/build/sdk.atree b/build/sdk.atree
index 83ccedc8c..59681dfba 100644
--- a/build/sdk.atree
+++ b/build/sdk.atree
@@ -33,32 +33,46 @@ development/docs/SDK_RELEASE_NOTES RELEASE_NOTES.html
# doc redirect
frameworks/base/docs/docs-redirect.html documentation.html
+
##############################################################################
# Platform Tools Component
##############################################################################
+sdk/files/sdk_files_NOTICE.txt platform-tools/NOTICE.txt
development/sdk/plat_tools_source.properties platform-tools/source.properties
# host tools from out/host/$(HOST_OS)-$(HOST_ARCH)/
bin/adb strip platform-tools/adb
-bin/aapt strip platform-tools/aapt
-bin/aidl strip platform-tools/aidl
bin/fastboot strip platform-tools/fastboot
-bin/llvm-rs-cc strip platform-tools/llvm-rs-cc
-
-# dx
-bin/dx platform-tools/dx
-bin/dexdump platform-tools/dexdump
-framework/dx.jar platform-tools/lib/dx.jar
-
-# Framework include for Renderscript
-frameworks/rs/scriptc platform-tools/renderscript/include
-external/clang/lib/Headers platform-tools/renderscript/clang-include
-external/clang/LICENSE.TXT platform-tools/renderscript/clang-include/LICENSE.TXT
# API database for tools such as lint
development/sdk/api-versions.xml platform-tools/api/api-versions.xml
+
+##############################################################################
+# Build Tools Component
+##############################################################################
+# Note that the build-tools sub-folder uses the platform-name as a placeholder
+# at build-time. Packaging will later change that to the actual build-tools
+# revision as specified in the source.properties.
+
+sdk/files/sdk_files_NOTICE.txt build-tools/${PLATFORM_NAME}/NOTICE.txt
+development/sdk/build_tools_source.properties build-tools/${PLATFORM_NAME}/source.properties
+
+# build tools from out/host/$(HOST_OS)-$(HOST_ARCH)/
+bin/aapt strip build-tools/${PLATFORM_NAME}/aapt
+bin/aidl strip build-tools/${PLATFORM_NAME}/aidl
+# renderscript (cc + headers)
+bin/llvm-rs-cc strip build-tools/${PLATFORM_NAME}/llvm-rs-cc
+frameworks/rs/scriptc build-tools/${PLATFORM_NAME}/renderscript/include
+external/clang/lib/Headers build-tools/${PLATFORM_NAME}/renderscript/clang-include
+external/clang/LICENSE.TXT build-tools/${PLATFORM_NAME}/renderscript/clang-include/LICENSE.TXT
+# dx
+bin/dx build-tools/${PLATFORM_NAME}/dx
+framework/dx.jar build-tools/${PLATFORM_NAME}/lib/dx.jar
+bin/dexdump build-tools/${PLATFORM_NAME}/dexdump
+
+
##############################################################################
# Platform Component
##############################################################################
@@ -70,8 +84,8 @@ ${HOST_OUT}/development/sdk/platform_source.properties platforms/${PLATFORM_NAME
sdk/sdk-build.prop platforms/${PLATFORM_NAME}/build.prop
# the uper-jar file that apps link against. This is the public API
-${OUT_DIR}/target/common/obj/PACKAGING/android_jar_intermediates/android.jar platforms/${PLATFORM_NAME}/android.jar
-${OUT_DIR}/target/common/obj/JAVA_LIBRARIES/android_uiautomator_intermediates/javalib.jar platforms/${PLATFORM_NAME}/uiautomator.jar
+${OUT_DIR}/target/common/obj/PACKAGING/android_jar_intermediates/android.jar platforms/${PLATFORM_NAME}/android.jar
+${OUT_DIR}/target/common/obj/JAVA_LIBRARIES/android_uiautomator_intermediates/javalib.jar platforms/${PLATFORM_NAME}/uiautomator.jar
# the aidl precompiled include
obj/framework.aidl platforms/${PLATFORM_NAME}/framework.aidl
@@ -89,7 +103,7 @@ development/tools/emulator/skins/WXGA800 platforms/${PLATFORM_NAME}/skins/
development/tools/emulator/skins/WXGA800-7in platforms/${PLATFORM_NAME}/skins/WXGA800-7in
# Platform SDK properties
-development/sdk/sdk.properties platforms/${PLATFORM_NAME}/sdk.properties
+development/sdk/sdk.properties platforms/${PLATFORM_NAME}/sdk.properties
# sdk.git Ant templates for project files
development/tools/templates/AndroidManifest.template platforms/${PLATFORM_NAME}/templates/AndroidManifest.template
@@ -121,6 +135,7 @@ sdk/files/sdk_files_NOTICE.txt platforms/${PLATFORM_NAME}/templates/NOTICE.txt
sdk/files/sdk_files_NOTICE.txt platforms/${PLATFORM_NAME}/data/NOTICE.txt
sdk/files/sdk_files_NOTICE.txt platforms/${PLATFORM_NAME}/skins/NOTICE.txt
+
##############################################################################
# System image Component
##############################################################################
@@ -133,6 +148,7 @@ system/build.prop system-images/${PLATFORM_NAME}/${TARG
# Note: the kernel image is handled by sdk-android-<abi>.atree now.
+
##############################################################################
# Docs Component
##############################################################################
@@ -167,6 +183,7 @@ development/samples/BackupRestore samples/${PLATFORM_NAME}/BackupRe
development/samples/BasicGLSurfaceView samples/${PLATFORM_NAME}/BasicGLSurfaceView
development/samples/BluetoothChat samples/${PLATFORM_NAME}/BluetoothChat
development/samples/BluetoothHDP samples/${PLATFORM_NAME}/BluetoothHDP
+development/samples/BluetoothLeGatt samples/${PLATFORM_NAME}/BluetoothLeGatt
development/samples/ContactManager samples/${PLATFORM_NAME}/ContactManager
development/samples/CrossCompatibility samples/${PLATFORM_NAME}/CrossCompatibility
development/samples/CubeLiveWallpaper samples/${PLATFORM_NAME}/CubeLiveWallpaper
@@ -180,7 +197,7 @@ development/samples/MultiResolution samples/${PLATFORM_NAME}/MultiRes
development/samples/NotePad samples/${PLATFORM_NAME}/NotePad
development/samples/RandomMusicPlayer samples/${PLATFORM_NAME}/RandomMusicPlayer
development/samples/SpellChecker/SampleSpellCheckerService samples/${PLATFORM_NAME}/SpellChecker/SampleSpellCheckerService
-development/samples/SpellChecker/HelloSpellChecker samples/${PLATFORM_NAME}/SpellChecker/HelloSpellChecker
+development/samples/SpellChecker/HelloSpellChecker samples/${PLATFORM_NAME}/SpellChecker/HelloSpellChecker
development/samples/SampleSyncAdapter samples/${PLATFORM_NAME}/SampleSyncAdapter
development/samples/SearchableDictionary samples/${PLATFORM_NAME}/SearchableDictionary
development/samples/SipDemo samples/${PLATFORM_NAME}/SipDemo
@@ -210,7 +227,7 @@ development/samples/FmRadioReceiver samples/${PLATFORM_NAME}/FmRadioR
development/samples/FmRadioTransmitter samples/${PLATFORM_NAME}/FmRadioTransmitter
# NOTICE files are copied by build/core/Makefile from sdk.git
-sdk/files/sdk_files_NOTICE.txt samples/${PLATFORM_NAME}/NOTICE.txt
+sdk/files/sdk_files_NOTICE.txt samples/${PLATFORM_NAME}/NOTICE.txt
##############################################################################
# Add-on Folder
@@ -219,6 +236,7 @@ sdk/files/sdk_files_NOTICE.txt samples/${PLATFORM_NAME}/NOTICE.txt
# empty add-on folder with just a readme copied from sdk.git
sdk/files/README_add-ons.txt add-ons/README.txt
+
##############################################################################
# Extra Component: Support
##############################################################################
@@ -242,12 +260,33 @@ frameworks/support/v7/gridlayout/.classpath
frameworks/support/v7/gridlayout/AndroidManifest.xml extras/android/support/v7/gridlayout/AndroidManifest.xml
frameworks/support/v7/gridlayout/project.properties extras/android/support/v7/gridlayout/project.properties
frameworks/support/v7/gridlayout/res extras/android/support/v7/gridlayout/res
-frameworks/support/v7/gridlayout/readme extras/android/support/v7/gridlayout/src/.readme
+frameworks/support/v7/gridlayout/src/.readme extras/android/support/v7/gridlayout/src/.readme
${OUT_DIR}/target/common/obj/PACKAGING/android-support-v7-gridlayout_intermediates/android-support-v7-gridlayout.jar extras/android/support/v7/gridlayout/libs/android-support-v7-gridlayout.jar
+frameworks/support/v7/appcompat/README.txt extras/android/support/v7/appcompat/README.txt
+frameworks/support/v7/appcompat/.project extras/android/support/v7/appcompat/.project
+frameworks/support/v7/appcompat/.classpath extras/android/support/v7/appcompat/.classpath
+frameworks/support/v7/appcompat/AndroidManifest.xml extras/android/support/v7/appcompat/AndroidManifest.xml
+frameworks/support/v7/appcompat/project.properties extras/android/support/v7/appcompat/project.properties
+frameworks/support/v7/appcompat/res extras/android/support/v7/appcompat/res
+frameworks/support/v7/appcompat/src/.readme extras/android/support/v7/appcompat/src/.readme
+${OUT_DIR}/target/common/obj/PACKAGING/android-support-v7-appcompat_intermediates/android-support-v7-appcompat.jar extras/android/support/v7/appcompat/libs/android-support-v7-appcompat.jar
+
+frameworks/support/v7/mediarouter/README.txt extras/android/support/v7/mediarouter/README.txt
+frameworks/support/v7/mediarouter/.project extras/android/support/v7/mediarouter/.project
+frameworks/support/v7/mediarouter/.classpath extras/android/support/v7/mediarouter/.classpath
+frameworks/support/v7/mediarouter/AndroidManifest.xml extras/android/support/v7/mediarouter/AndroidManifest.xml
+frameworks/support/v7/mediarouter/project.properties extras/android/support/v7/mediarouter/project.properties
+frameworks/support/v7/mediarouter/res extras/android/support/v7/mediarouter/res
+frameworks/support/v7/mediarouter/src/.readme extras/android/support/v7/mediarouter/src/.readme
+${OUT_DIR}/target/common/obj/PACKAGING/android-support-v7-mediarouter_intermediates/android-support-v7-mediarouter.jar extras/android/support/v7/mediarouter/libs/android-support-v7-mediarouter.jar
+
+development/samples/Support7Demos extras/android/support/samples/Support7Demos
+
##############################################################################
# Tests Component
##############################################################################
framework/layoutlib-tests.jar tests/libtests/layoutlib-tests.jar
system/app/ConnectivityTest.apk tests/emulator-test-apps/ConnectivityTest.apk
system/app/GpsLocationTest.apk tests/emulator-test-apps/GpsLocationTest.apk
+
diff --git a/build/tools/mk_sdk_repo_xml.sh b/build/tools/mk_sdk_repo_xml.sh
index 298671d3f..c807a56e4 100755
--- a/build/tools/mk_sdk_repo_xml.sh
+++ b/build/tools/mk_sdk_repo_xml.sh
@@ -6,7 +6,7 @@ set -e
PROG_DIR=$(dirname $0)
-TYPES="tool platform-tool platform sample doc add-on system-image source support"
+TYPES="tool platform-tool build-tool platform sample doc add-on system-image source support"
OSES="linux macosx windows any linux-x86 darwin"
TMP_DIR=$(mktemp -d -t sdkrepo.tmp.XXXXXXXX)
@@ -144,6 +144,7 @@ if [[ "$ROOT" == "sdk-repository" && "$XSD_VERSION" -ge 7 ]] ||
[[ "$ROOT" == "sdk-addon" && "$XSD_VERSION" -ge 5 ]]; then
FULL_REVISIONS=(
tool revision
+ build-tool revision
platform-tool revision
@ min-tools-rev
@ min-platform-tools-rev
@@ -409,3 +410,4 @@ echo "</sdk:$ROOT>" >> "$OUT"
echo "## Validate XML against schema"
xmllint --schema $SCHEMA "$OUT"
+
diff --git a/build/tools/patch_windows_sdk.sh b/build/tools/patch_windows_sdk.sh
index 6d30577e7..7a930b0e7 100755
--- a/build/tools/patch_windows_sdk.sh
+++ b/build/tools/patch_windows_sdk.sh
@@ -74,6 +74,7 @@ fi
${TOPDIR}out/host/linux-x86/bin/atree -f ${TOPDIR}development/build/sdk-windows-x86.atree \
-I $WIN_OUT_DIR/host/windows-x86 \
-I ${TOPDIR:-.} \
+ -v "PLATFORM_NAME=android-$PLATFORM_VERSION" \
-o $TEMP_SDK_DIR
# Fix EOL chars to make window users happy - fix all files at the top level
diff --git a/build/tools/sdk_repo.mk b/build/tools/sdk_repo.mk
index deb3bdc79..24e380f4e 100644
--- a/build/tools/sdk_repo.mk
+++ b/build/tools/sdk_repo.mk
@@ -31,10 +31,10 @@ define mk-sdk-repo-pkg-1
$(call sdk-repo-pkg-zip,$(1),$(2),$(3)): $(2)
@echo "Building SDK repository package $(3) from $(notdir $(2))"
$(hide) cd $(basename $(2)) && \
- zip -9rq ../$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) $(3)/*
+ zip -9rq ../$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) $(3)/*
$(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
SDK_REPO_XML_ARGS += $(3) $(1) \
- $(call sdk-repo-pkg-zip,$(1),$(2),$(3)):$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
+ $(call sdk-repo-pkg-zip,$(1),$(2),$(3)):$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
endef
# Defines the rule to build an SDK repository package when the
@@ -52,10 +52,10 @@ define mk-sdk-repo-pkg-2
$(call sdk-repo-pkg-zip,$(1),$(2),$(3)): $(2)
@echo "Building SDK repository package $(3) from $(notdir $(2))"
$(hide) cd $(basename $(2))/$(3) && \
- zip -9rq ../../$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) *
+ zip -9rq ../../$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) *
$(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
SDK_REPO_XML_ARGS += $(3) $(1) \
- $(call sdk-repo-pkg-zip,$(1),$(2),$(3)):$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
+ $(call sdk-repo-pkg-zip,$(1),$(2),$(3)):$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
endef
# Defines the rule to build an SDK repository package when the
@@ -77,10 +77,10 @@ define mk-sdk-repo-pkg-3
$(call sdk-repo-pkg-zip,$(1),$(2),$(3)): $(2)
@echo "Building SDK repository package $(3) from $(notdir $(2))"
$(hide) cd $(basename $(2))/$(4) && \
- zip -9rq ../../../$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) *
+ zip -9rq ../../../$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) *
$(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
SDK_REPO_XML_ARGS += $(3) $(1) \
- $(call sdk-repo-pkg-zip,$(1),$(2),$(3)):$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
+ $(call sdk-repo-pkg-zip,$(1),$(2),$(3)):$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
endef
# Defines the rule to build an SDK sources package.
@@ -93,12 +93,12 @@ define mk-sdk-repo-sources
$(call sdk-repo-pkg-zip,$(1),$(2),$(3)): $(2) $(HOST_OUT)/development/sdk/source_source.properties
@echo "Building SDK sources package"
$(hide) $(TOPDIR)development/build/tools/mk_sources_zip.py --exec-zip \
- $(HOST_OUT)/development/sdk/source_source.properties \
- $(call sdk-repo-pkg-zip,$(1),$(2),$(3)) \
- $(TOPDIR).
+ $(HOST_OUT)/development/sdk/source_source.properties \
+ $(call sdk-repo-pkg-zip,$(1),$(2),$(3)) \
+ $(TOPDIR).
$(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
SDK_REPO_XML_ARGS += $(3) $(1) \
- $(call sdk-repo-pkg-zip,$(1),$(2),$(3)):$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
+ $(call sdk-repo-pkg-zip,$(1),$(2),$(3)):$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
endef
# -----------------------------------------------------------------
@@ -113,10 +113,11 @@ SDK_EXTRAS_XML_ARGS := $(SDK_REPO_XML_ARGS)
SDK_REPO_XML_ARGS :=
SDK_EXTRAS_DEPS += \
- $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),support)
+ $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),support)
$(eval $(call mk-sdk-repo-pkg-1,$(HOST_OS),$(MAIN_SDK_ZIP),tools))
+$(eval $(call mk-sdk-repo-pkg-2,$(HOST_OS),$(MAIN_SDK_ZIP),build-tools))
$(eval $(call mk-sdk-repo-pkg-1,$(HOST_OS),$(MAIN_SDK_ZIP),platform-tools))
$(eval $(call mk-sdk-repo-pkg-1,$(HOST_OS),$(MAIN_SDK_ZIP),docs))
$(eval $(call mk-sdk-repo-pkg-2,$(HOST_OS),$(MAIN_SDK_ZIP),platforms))
@@ -125,13 +126,14 @@ $(eval $(call mk-sdk-repo-pkg-3,$(HOST_OS),$(MAIN_SDK_ZIP),system-images,system-
$(eval $(call mk-sdk-repo-sources,$(HOST_OS),$(MAIN_SDK_ZIP),sources))
SDK_REPO_DEPS += \
- $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),tools) \
- $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),platform-tools) \
- $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),docs) \
- $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),platforms) \
- $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),samples) \
- $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),system-images) \
- $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),sources)
+ $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),tools) \
+ $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),build-tools) \
+ $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),platform-tools) \
+ $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),docs) \
+ $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),platforms) \
+ $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),samples) \
+ $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),system-images) \
+ $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),sources)
endif
@@ -142,11 +144,13 @@ ifneq ($(WIN_SDK_ZIP),)
# docs, platforms and samples have nothing OS-dependent right now.
$(eval $(call mk-sdk-repo-pkg-1,windows,$(WIN_SDK_ZIP),tools))
+$(eval $(call mk-sdk-repo-pkg-2,windows,$(WIN_SDK_ZIP),build-tools))
$(eval $(call mk-sdk-repo-pkg-1,windows,$(WIN_SDK_ZIP),platform-tools))
SDK_REPO_DEPS += \
- $(call sdk-repo-pkg-zip,windows,$(WIN_SDK_ZIP),tools) \
- $(call sdk-repo-pkg-zip,windows,$(WIN_SDK_ZIP),platform-tools)
+ $(call sdk-repo-pkg-zip,windows,$(WIN_SDK_ZIP),tools) \
+ $(call sdk-repo-pkg-zip,windows,$(WIN_SDK_ZIP),build-tools) \
+ $(call sdk-repo-pkg-zip,windows,$(WIN_SDK_ZIP),platform-tools)
endif
@@ -154,16 +158,17 @@ endif
# Pickup the most recent xml schema for repository and add-on
SDK_REPO_XSD := \
- $(lastword \
- $(wildcard \
- $(TOPDIR)sdk/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository-*.xsd \
- ))
+ $(lastword \
+ $(wildcard \
+ $(TOPDIR)prebuilts/devtools/repository/sdk-repository-*.xsd \
+ ))
SDK_ADDON_XSD := \
- $(lastword \
- $(wildcard \
- $(TOPDIR)sdk/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-addon-*.xsd \
- ))
+ $(lastword \
+ $(wildcard \
+ $(TOPDIR)prebuilts/devtools/repository/sdk-addon-*.xsd \
+ ))
+
# -----------------------------------------------------------------
# Rules for sdk addon
@@ -184,7 +189,7 @@ SDK_ADDON_XML := $(dir $(ADDON_SDK_ZIP))/addon.xml
$(SDK_ADDON_XML): $(ADDON_SDK_ZIP)
$(hide) $(TOPDIR)development/build/tools/mk_sdk_repo_xml.sh \
- $(SDK_ADDON_XML) $(SDK_ADDON_XSD) add-on $(HOST_OS) $(RENAMED_ADDON_ZIP)
+ $(SDK_ADDON_XML) $(SDK_ADDON_XSD) add-on $(HOST_OS) $(RENAMED_ADDON_ZIP)
$(call dist-for-goals, sdk_repo, $(SDK_ADDON_XML))
@@ -200,7 +205,7 @@ ifneq ($(SDK_REPO_XML_ARGS),)
$(SDK_REPO_XML): $(SDK_REPO_DEPS)
$(hide) $(TOPDIR)development/build/tools/mk_sdk_repo_xml.sh \
- $(SDK_REPO_XML) $(SDK_REPO_XSD) $(SDK_REPO_XML_ARGS)
+ $(SDK_REPO_XML) $(SDK_REPO_XSD) $(SDK_REPO_XML_ARGS)
$(call dist-for-goals, sdk_repo, $(SDK_REPO_XML))
@@ -215,7 +220,7 @@ ifneq ($(SDK_EXTRAS_XML_ARGS),)
$(SDK_EXTRAS_XML): $(SDK_EXTRAS_DEPS)
$(hide) $(TOPDIR)development/build/tools/mk_sdk_repo_xml.sh \
- $(SDK_EXTRAS_XML) $(SDK_ADDON_XSD) $(SDK_EXTRAS_XML_ARGS)
+ $(SDK_EXTRAS_XML) $(SDK_ADDON_XSD) $(SDK_EXTRAS_XML_ARGS)
$(call dist-for-goals, sdk_repo, $(SDK_EXTRAS_XML))
diff --git a/build/tools/windows_sdk.mk b/build/tools/windows_sdk.mk
index 7210d63b6..631f8463c 100644
--- a/build/tools/windows_sdk.mk
+++ b/build/tools/windows_sdk.mk
@@ -94,9 +94,11 @@ $(WIN_SDK_ZIP): winsdk-tools sdk
$(hide) mkdir -p $(WIN_SDK_DIR)
$(hide) cp -rf $(MAIN_SDK_DIR)/$(MAIN_SDK_NAME) $(WIN_SDK_DIR)/$(WIN_SDK_NAME)
$(hide) USB_DRIVER_HOOK=$(USB_DRIVER_HOOK) \
+ PLATFORM_VERSION=$(PLATFORM_VERSION) \
$(TOPDIR)development/build/tools/patch_windows_sdk.sh $(subst @,-q,$(hide)) \
$(WIN_SDK_DIR)/$(WIN_SDK_NAME) $(OUT_DIR) $(TOPDIR)
- $(hide) $(TOPDIR)sdk/build/patch_windows_sdk.sh $(subst @,-q,$(hide)) \
+ $(hide) PLATFORM_VERSION=$(PLATFORM_VERSION) \
+ $(TOPDIR)sdk/build/patch_windows_sdk.sh $(subst @,-q,$(hide)) \
$(WIN_SDK_DIR)/$(WIN_SDK_NAME) $(OUT_DIR) $(TOPDIR)
$(hide) ( \
cd $(WIN_SDK_DIR) && \
diff --git a/build/sdk_only_whitelist.mk b/build/windows_sdk_whitelist.mk
index 191e1b4a4..523883a48 100644
--- a/build/sdk_only_whitelist.mk
+++ b/build/windows_sdk_whitelist.mk
@@ -13,11 +13,11 @@
# Note that there are 2 flavors of this file:
#
-# - The other file: sdk/build/sdk_only_whitelist.mk
+# - The other file: sdk/build/windows_sdk_whitelist.mk
# must list all projects that are that are NOT specific to a given platform.
# These binaries are the ones typically found in the SDK/tools directory.
#
-# - This file: development/build/sdk_only_whitelist.mk
+# - This file: development/build/windows_sdk_whitelist.mk
# must list all projects that are specific to a given platform. These
# projects generate files that are generally locates in SDK/platform-tools,
# or SDK/platforms/, etc.
diff --git a/cmds/monkey/src/com/android/commands/monkey/Monkey.java b/cmds/monkey/src/com/android/commands/monkey/Monkey.java
index 5e86a79c8..a2655e159 100644
--- a/cmds/monkey/src/com/android/commands/monkey/Monkey.java
+++ b/cmds/monkey/src/com/android/commands/monkey/Monkey.java
@@ -134,6 +134,18 @@ public class Monkey {
/**
* This is set by the ActivityController thread to request a
+ * bugreport after a system watchdog report
+ */
+ private boolean mRequestWatchdogBugreport = false;
+
+ /**
+ * Synchronization for the ActivityController callback to block
+ * until we are done handling the reporting of the watchdog error.
+ */
+ private boolean mWatchdogWaiting = false;
+
+ /**
+ * This is set by the ActivityController thread to request a
* bugreport after java application crash
*/
private boolean mRequestAppCrashBugreport = false;
@@ -355,6 +367,31 @@ public class Monkey {
}
return (mKillProcessAfterError) ? -1 : 1;
}
+
+ public int systemNotResponding(String message) {
+ StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskWrites();
+ System.err.println("// WATCHDOG: " + message);
+ StrictMode.setThreadPolicy(savedPolicy);
+
+ synchronized (Monkey.this) {
+ if (!mIgnoreCrashes) {
+ mAbort = true;
+ }
+ if (mRequestBugreport) {
+ mRequestWatchdogBugreport = true;
+ }
+ mWatchdogWaiting = true;
+ }
+ synchronized (Monkey.this) {
+ while (mWatchdogWaiting) {
+ try {
+ Monkey.this.wait();
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+ return (mKillProcessAfterError) ? -1 : 1;
+ }
}
/**
@@ -635,6 +672,11 @@ public class Monkey {
getBugreport("anr_" + mReportProcessName + "_");
mRequestAnrBugreport = false;
}
+ if (mRequestWatchdogBugreport) {
+ System.out.println("Print the watchdog report");
+ getBugreport("anr_watchdog_");
+ mRequestWatchdogBugreport = false;
+ }
if (mRequestAppCrashBugreport){
getBugreport("app_crash" + mReportProcessName + "_");
mRequestAppCrashBugreport = false;
@@ -647,6 +689,10 @@ public class Monkey {
getBugreport("Bugreport_");
mRequestPeriodicBugreport = false;
}
+ if (mWatchdogWaiting) {
+ mWatchdogWaiting = false;
+ notifyAll();
+ }
}
if (mGenerateHprof) {
@@ -1027,6 +1073,11 @@ public class Monkey {
getBugreport("anr_" + mReportProcessName + "_");
mRequestAnrBugreport = false;
}
+ if (mRequestWatchdogBugreport) {
+ System.out.println("Print the watchdog report");
+ getBugreport("anr_watchdog_");
+ mRequestWatchdogBugreport = false;
+ }
if (mRequestAppCrashBugreport){
getBugreport("app_crash" + mReportProcessName + "_");
mRequestAppCrashBugreport = false;
@@ -1053,6 +1104,10 @@ public class Monkey {
if (mAbort) {
shouldAbort = true;
}
+ if (mWatchdogWaiting) {
+ mWatchdogWaiting = false;
+ notifyAll();
+ }
}
// Report ANR, dumpsys after releasing lock on this.
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeyActivityEvent.java b/cmds/monkey/src/com/android/commands/monkey/MonkeyActivityEvent.java
index 032175207..a48a081a8 100644
--- a/cmds/monkey/src/com/android/commands/monkey/MonkeyActivityEvent.java
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeyActivityEvent.java
@@ -66,7 +66,7 @@ public class MonkeyActivityEvent extends MonkeyEvent {
}
try {
- iam.startActivity(null, intent, null, null, null, 0,
+ iam.startActivity(null, null, intent, null, null, null, 0,
0, null, null, null);
} catch (RemoteException e) {
System.err.println("** Failed talking with activity manager!");
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeyInstrumentationEvent.java b/cmds/monkey/src/com/android/commands/monkey/MonkeyInstrumentationEvent.java
index ec3160cb3..b2ae2471d 100644
--- a/cmds/monkey/src/com/android/commands/monkey/MonkeyInstrumentationEvent.java
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeyInstrumentationEvent.java
@@ -21,7 +21,6 @@ import android.app.IActivityManager;
import android.content.ComponentName;
import android.os.Bundle;
import android.os.RemoteException;
-import android.util.AndroidException;
import android.view.IWindowManager;
/**
@@ -46,7 +45,7 @@ public class MonkeyInstrumentationEvent extends MonkeyEvent {
Bundle args = new Bundle();
args.putString("class", mTestCaseName);
try {
- iam.startInstrumentation(cn, null, 0, args, null, 0);
+ iam.startInstrumentation(cn, null, 0, args, null, null, 0);
} catch (RemoteException e) {
System.err.println("** Failed talking with activity manager!");
return MonkeyEvent.INJECT_ERROR_REMOTE_EXCEPTION;
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceNetwork.java b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceNetwork.java
index cae641656..d192d532a 100644
--- a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceNetwork.java
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceNetwork.java
@@ -588,6 +588,7 @@ public class MonkeySourceNetwork implements MonkeyEventSource {
*/
private void stopServer() throws IOException {
clientSocket.close();
+ MonkeySourceNetworkViews.teardown();
input.close();
output.close();
started = false;
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceNetworkViews.java b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceNetworkViews.java
index ddb83da10..89679a14a 100644
--- a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceNetworkViews.java
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceNetworkViews.java
@@ -18,14 +18,16 @@ package com.android.commands.monkey;
import static com.android.commands.monkey.MonkeySourceNetwork.EARG;
-import android.accessibilityservice.UiTestAutomationBridge;
+import android.app.UiAutomation;
+import android.app.UiAutomationConnection;
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageManager;
import android.graphics.Rect;
+import android.os.HandlerThread;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
-import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityInteractionClient;
import android.view.accessibility.AccessibilityNodeInfo;
import com.android.commands.monkey.MonkeySourceNetwork.CommandQueue;
@@ -45,11 +47,15 @@ import java.util.Map;
* Script commands over the network.
*/
public class MonkeySourceNetworkViews {
- protected static UiTestAutomationBridge sUiTestAutomationBridge;
+
+ protected static android.app.UiAutomation sUiTestAutomationBridge;
+
private static IPackageManager sPm =
IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
private static Map<String, Class<?>> sClassMap = new HashMap<String, Class<?>>();
+ private static final String HANDLER_THREAD_NAME = "UiAutomationHandlerThread";
+
private static final String REMOTE_ERROR =
"Unable to retrieve application info from PackageManager";
private static final String CLASS_NOT_FOUND = "Error retrieving class information";
@@ -85,16 +91,25 @@ public class MonkeySourceNetworkViews {
COMMAND_MAP.put("getaccessibilityids", new GetAccessibilityIds());
}
+ private static final HandlerThread sHandlerThread = new HandlerThread(HANDLER_THREAD_NAME);
+
/**
* Registers the event listener for AccessibilityEvents.
* Also sets up a communication connection so we can query the
* accessibility service.
*/
public static void setup() {
- sUiTestAutomationBridge = new UiTestAutomationBridge();
+ sHandlerThread.setDaemon(true);
+ sHandlerThread.start();
+ sUiTestAutomationBridge = new UiAutomation(sHandlerThread.getLooper(),
+ new UiAutomationConnection());
sUiTestAutomationBridge.connect();
}
+ public static void teardown() {
+ sHandlerThread.quit();
+ }
+
/**
* Get the ID class for the given package.
* This will cause issues if people reload a package with different
@@ -118,60 +133,22 @@ public class MonkeySourceNetworkViews {
return klass;
}
- private static String getPositionFromNode(AccessibilityNodeInfo node) {
- Rect nodePosition = new Rect();
- node.getBoundsInScreen(nodePosition);
- StringBuilder positions = new StringBuilder();
- positions.append(nodePosition.left).append(" ").append(nodePosition.top);
- positions.append(" ").append(nodePosition.right-nodePosition.left).append(" ");
- positions.append(nodePosition.bottom-nodePosition.top);
- return positions.toString();
- }
-
-
- /**
- * Converts a resource identifier into it's generated integer ID
- *
- * @param stringId the string identifier
- * @return the generated integer identifier.
- */
- private static int getId(String stringId, AccessibilityEvent event)
- throws MonkeyViewException {
- try {
- AccessibilityNodeInfo node = event.getSource();
- String packageName = node.getPackageName().toString();
- ApplicationInfo appInfo = sPm.getApplicationInfo(packageName, 0, UserHandle.myUserId());
- Class<?> klass;
- klass = getIdClass(packageName, appInfo.sourceDir);
- return klass.getField(stringId).getInt(null);
- } catch (RemoteException e) {
- throw new MonkeyViewException(REMOTE_ERROR);
- } catch (ClassNotFoundException e){
- throw new MonkeyViewException(e.getMessage());
- } catch (NoSuchFieldException e){
- throw new MonkeyViewException("No such node with given id");
- } catch (IllegalAccessException e){
- throw new MonkeyViewException("Private identifier");
- } catch (NullPointerException e) {
- // AccessibilityServiceConnection throws a NullPointerException if you hand it
- // an ID that doesn't exist onscreen
- throw new MonkeyViewException("No node with given id exists onscreen");
- }
- }
-
private static AccessibilityNodeInfo getNodeByAccessibilityIds(
String windowString, String viewString) {
int windowId = Integer.parseInt(windowString);
int viewId = Integer.parseInt(viewString);
- return sUiTestAutomationBridge.findAccessibilityNodeInfoByAccessibilityId(windowId,
- viewId);
+ int connectionId = sUiTestAutomationBridge.getConnectionId();
+ AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance();
+ return client.findAccessibilityNodeInfoByAccessibilityId(connectionId, windowId, viewId, 0);
}
- private static AccessibilityNodeInfo getNodeByViewId(String viewId, AccessibilityEvent event)
- throws MonkeyViewException {
- int id = getId(viewId, event);
- return sUiTestAutomationBridge.findAccessibilityNodeInfoByViewId(
- UiTestAutomationBridge.ACTIVE_WINDOW_ID, UiTestAutomationBridge.ROOT_NODE_ID, id);
+ private static AccessibilityNodeInfo getNodeByViewId(String viewId) throws MonkeyViewException {
+ int connectionId = sUiTestAutomationBridge.getConnectionId();
+ AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance();
+ List<AccessibilityNodeInfo> infos = client.findAccessibilityNodeInfosByViewId(
+ connectionId, AccessibilityNodeInfo.ACTIVE_WINDOW_ID,
+ AccessibilityNodeInfo.ROOT_NODE_ID, viewId);
+ return (!infos.isEmpty()) ? infos.get(0) : null;
}
/**
@@ -182,11 +159,7 @@ public class MonkeySourceNetworkViews {
//listviews
public MonkeyCommandReturn translateCommand(List<String> command,
CommandQueue queue) {
- AccessibilityEvent lastEvent = sUiTestAutomationBridge.getLastAccessibilityEvent();
- if (lastEvent == null) {
- return new MonkeyCommandReturn(false, NO_ACCESSIBILITY_EVENT);
- }
- AccessibilityNodeInfo node = lastEvent.getSource();
+ AccessibilityNodeInfo node = sUiTestAutomationBridge.getRootInActiveWindow();
/* Occasionally the API will generate an event with no source, which is essentially the
* same as it generating no event at all */
if (node == null) {
@@ -195,7 +168,8 @@ public class MonkeySourceNetworkViews {
String packageName = node.getPackageName().toString();
try{
Class<?> klass;
- ApplicationInfo appInfo = sPm.getApplicationInfo(packageName, 0, UserHandle.myUserId());
+ ApplicationInfo appInfo = sPm.getApplicationInfo(packageName, 0,
+ UserHandle.myUserId());
klass = getIdClass(packageName, appInfo.sourceDir);
StringBuilder fieldBuilder = new StringBuilder();
Field[] fields = klass.getFields();
@@ -222,20 +196,13 @@ public class MonkeySourceNetworkViews {
public MonkeyCommandReturn translateCommand(List<String> command,
CommandQueue queue) {
if (command.size() > 2) {
- if (!sUiTestAutomationBridge.isConnected()) {
- return new MonkeyCommandReturn(false, NO_CONNECTION);
- }
- AccessibilityEvent lastEvent = sUiTestAutomationBridge.getLastAccessibilityEvent();
- if (lastEvent == null) {
- return new MonkeyCommandReturn(false, NO_ACCESSIBILITY_EVENT);
- }
String idType = command.get(1);
AccessibilityNodeInfo node;
String viewQuery;
List<String> args;
if ("viewid".equals(idType)) {
try {
- node = getNodeByViewId(command.get(2), lastEvent);
+ node = getNodeByViewId(command.get(2));
viewQuery = command.get(3);
args = command.subList(4, command.size());
} catch (MonkeyViewException e) {
@@ -273,11 +240,7 @@ public class MonkeySourceNetworkViews {
// getrootview
public MonkeyCommandReturn translateCommand(List<String> command,
CommandQueue queue) {
- AccessibilityEvent lastEvent = sUiTestAutomationBridge.getLastAccessibilityEvent();
- if (lastEvent == null) {
- return new MonkeyCommandReturn(false, NO_ACCESSIBILITY_EVENT);
- }
- AccessibilityNodeInfo node = lastEvent.getSource();
+ AccessibilityNodeInfo node = sUiTestAutomationBridge.getRootInActiveWindow();
return (new GetAccessibilityIds()).query(node, new ArrayList<String>());
}
}
@@ -292,14 +255,13 @@ public class MonkeySourceNetworkViews {
// getviewswithtext "some text here"
public MonkeyCommandReturn translateCommand(List<String> command,
CommandQueue queue) {
- if (!sUiTestAutomationBridge.isConnected()) {
- return new MonkeyCommandReturn(false, NO_CONNECTION);
- }
if (command.size() == 2) {
String text = command.get(1);
- List<AccessibilityNodeInfo> nodes = sUiTestAutomationBridge
- .findAccessibilityNodeInfosByText(UiTestAutomationBridge.ACTIVE_WINDOW_ID,
- UiTestAutomationBridge.ROOT_NODE_ID, text);
+ int connectionId = sUiTestAutomationBridge.getConnectionId();
+ List<AccessibilityNodeInfo> nodes = AccessibilityInteractionClient.getInstance()
+ .findAccessibilityNodeInfosByText(connectionId,
+ AccessibilityNodeInfo.ACTIVE_WINDOW_ID,
+ AccessibilityNodeInfo.ROOT_NODE_ID, text);
ViewIntrospectionCommand idGetter = new GetAccessibilityIds();
List<String> emptyArgs = new ArrayList<String>();
StringBuilder ids = new StringBuilder();
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java
index b2b9b4f8e..59aeb5599 100644
--- a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java
@@ -71,12 +71,18 @@ public class MonkeySourceScript implements MonkeyEventSource {
private long mLastRecordedEventTime = -1;
+ // process scripts in line-by-line mode (true) or batch processing mode (false)
+ private boolean mReadScriptLineByLine = false;
+
private static final boolean THIS_DEBUG = false;
// a parameter that compensates the difference of real elapsed time and
// time in theory
private static final long SLEEP_COMPENSATE_DIFF = 16;
+ // if this header is present, scripts are read and processed in line-by-line mode
+ private static final String HEADER_LINE_BY_LINE = "linebyline";
+
// maximum number of events that we read at one time
private static final int MAX_ONE_TIME_READS = 100;
@@ -147,6 +153,15 @@ public class MonkeySourceScript implements MonkeyEventSource {
BufferedReader mBufferedReader;
+ // X and Y coordincates of last touch event. Array Index is the pointerId
+ private float mLastX[] = new float[2];
+
+ private float mLastY[] = new float[2];
+
+ private long mScriptStartTime = -1;
+
+ private long mMonkeyStartTime = -1;
+
/**
* Creates a MonkeySourceScript instance.
*
@@ -207,6 +222,8 @@ public class MonkeySourceScript implements MonkeyEventSource {
System.err.println(e);
return false;
}
+ } else if (line.indexOf(HEADER_LINE_BY_LINE) >= 0) {
+ mReadScriptLineByLine = true;
} else if (line.indexOf(STARTING_DATA_LINE) >= 0) {
return true;
}
@@ -234,6 +251,21 @@ public class MonkeySourceScript implements MonkeyEventSource {
return MAX_ONE_TIME_READS;
}
+ /**
+ * Reads one line and processes it.
+ *
+ * @return the number of lines read
+ * @throws IOException If there was an error reading the file.
+ */
+ private int readOneLine() throws IOException {
+ String line = mBufferedReader.readLine();
+ if (line == null) {
+ return 0;
+ }
+ line.trim();
+ processLine(line);
+ return 1;
+ }
@@ -306,6 +338,84 @@ public class MonkeySourceScript implements MonkeyEventSource {
return;
}
+ // Handle trackball or multi-touch pointer events. pointer ID is the 13th parameter
+ if ((s.indexOf(EVENT_KEYWORD_POINTER) >= 0 || s.indexOf(EVENT_KEYWORD_TRACKBALL) >= 0)
+ && args.length == 13) {
+ try {
+ long downTime = Long.parseLong(args[0]);
+ long eventTime = Long.parseLong(args[1]);
+ int action = Integer.parseInt(args[2]);
+ float x = Float.parseFloat(args[3]);
+ float y = Float.parseFloat(args[4]);
+ float pressure = Float.parseFloat(args[5]);
+ float size = Float.parseFloat(args[6]);
+ int metaState = Integer.parseInt(args[7]);
+ float xPrecision = Float.parseFloat(args[8]);
+ float yPrecision = Float.parseFloat(args[9]);
+ int device = Integer.parseInt(args[10]);
+ int edgeFlags = Integer.parseInt(args[11]);
+ int pointerId = Integer.parseInt(args[12]);
+
+ MonkeyMotionEvent e;
+ if (s.indexOf("Pointer") > 0) {
+ if (action == MotionEvent.ACTION_POINTER_DOWN) {
+ e = new MonkeyTouchEvent(MotionEvent.ACTION_POINTER_DOWN
+ | (pointerId << MotionEvent.ACTION_POINTER_INDEX_SHIFT))
+ .setIntermediateNote(true);
+ } else {
+ e = new MonkeyTouchEvent(action);
+ }
+ if (mScriptStartTime < 0) {
+ mMonkeyStartTime = SystemClock.uptimeMillis();
+ mScriptStartTime = eventTime;
+ }
+ } else {
+ e = new MonkeyTrackballEvent(action);
+ }
+
+ if (pointerId == 1) {
+ e.setDownTime(downTime)
+ .setEventTime(eventTime)
+ .setMetaState(metaState)
+ .setPrecision(xPrecision, yPrecision)
+ .setDeviceId(device)
+ .setEdgeFlags(edgeFlags)
+ .addPointer(0, mLastX[0], mLastY[0], pressure, size)
+ .addPointer(1, x, y, pressure, size);
+ mLastX[1] = x;
+ mLastY[1] = y;
+ } else if (pointerId == 0) {
+ e.setDownTime(downTime)
+ .setEventTime(eventTime)
+ .setMetaState(metaState)
+ .setPrecision(xPrecision, yPrecision)
+ .setDeviceId(device)
+ .setEdgeFlags(edgeFlags)
+ .addPointer(0, x, y, pressure, size);
+ if(action == MotionEvent.ACTION_POINTER_UP) {
+ e.addPointer(1, mLastX[1], mLastY[1]);
+ }
+ mLastX[0] = x;
+ mLastY[0] = y;
+ }
+
+ // Dynamically adjust waiting time to ensure that simulated evnets follow
+ // the time tap specified in the script
+ if (mReadScriptLineByLine) {
+ long curUpTime = SystemClock.uptimeMillis();
+ long realElapsedTime = curUpTime - mMonkeyStartTime;
+ long scriptElapsedTime = eventTime - mScriptStartTime;
+ if (realElapsedTime < scriptElapsedTime) {
+ long waitDuration = scriptElapsedTime - realElapsedTime;
+ mQ.addLast(new MonkeyWaitEvent(waitDuration));
+ }
+ }
+ mQ.addLast(e);
+ } catch (NumberFormatException e) {
+ }
+ return;
+ }
+
// Handle screen rotation events
if ((s.indexOf(EVENT_KEYWORD_ROTATION) >= 0) && args.length == 2) {
try {
@@ -719,7 +829,11 @@ public class MonkeySourceScript implements MonkeyEventSource {
readHeader();
}
- linesRead = readLines();
+ if (mReadScriptLineByLine) {
+ linesRead = readOneLine();
+ } else {
+ linesRead = readLines();
+ }
if (linesRead == 0) {
closeFile();
diff --git a/ide/eclipse/.classpath b/ide/eclipse/.classpath
index 0b1f72e67..1dcb946b9 100644
--- a/ide/eclipse/.classpath
+++ b/ide/eclipse/.classpath
@@ -2,7 +2,6 @@
<classpath>
<classpathentry kind="src" path="packages/apps/Apollo/src"/>
<classpathentry kind="src" path="packages/apps/Bluetooth/src"/>
- <classpathentry kind="src" path="packages/apps/Camera/src"/>
<classpathentry kind="src" path="packages/apps/Browser/src"/>
<classpathentry kind="src" path="packages/apps/Calendar/src"/>
<classpathentry kind="src" path="packages/apps/Calendar/extensions_src"/>
@@ -14,8 +13,10 @@
<classpathentry kind="src" path="packages/apps/CMUpdater/src"/>
<classpathentry kind="src" path="packages/apps/CMWallpapers/src"/>
<classpathentry kind="src" path="packages/apps/Contacts/src"/>
+ <classpathentry kind="src" path="packages/apps/ContactsCommon/src"/>
<classpathentry kind="src" path="packages/apps/DeskClock/src"/>
<classpathentry kind="src" path="packages/apps/DSPManager/src"/>
+ <classpathentry kind="src" path="packages/apps/Dialer/src"/>
<classpathentry kind="src" path="packages/apps/Email/src"/>
<classpathentry kind="src" path="packages/apps/Email/emailcommon/src"/>
<classpathentry kind="src" path="packages/apps/Gallery2/src"/>
@@ -27,6 +28,7 @@
<classpathentry kind="src" path="packages/apps/Mms/src"/>
<classpathentry kind="src" path="packages/apps/PackageInstaller/src"/>
<classpathentry kind="src" path="packages/apps/Phone/src"/>
+ <classpathentry kind="src" path="packages/apps/PhoneCommon/src"/>
<classpathentry kind="src" path="packages/apps/QuickSearchBox/src"/>
<classpathentry kind="src" path="packages/apps/Provision/src"/>
<classpathentry kind="src" path="packages/apps/Settings/src"/>
@@ -69,7 +71,6 @@
<classpathentry kind="src" path="frameworks/base/services/java"/>
<classpathentry kind="src" path="frameworks/base/telephony/java"/>
<classpathentry kind="src" path="frameworks/base/test-runner/src"/>
- <classpathentry kind="src" path="frameworks/base/voip/java"/>
<classpathentry kind="src" path="frameworks/base/wifi/java"/>
<classpathentry kind="src" path="frameworks/ex/carousel/java"/>
<classpathentry kind="src" path="frameworks/ex/chips/src"/>
@@ -78,7 +79,9 @@
<classpathentry kind="src" path="frameworks/opt/calendar/src"/>
<classpathentry kind="src" path="frameworks/opt/telephony/src/java"/>
<classpathentry kind="src" path="frameworks/opt/mms/src/java"/>
+ <classpathentry kind="src" path="frameworks/opt/net/voip/src/java"/>
<classpathentry kind="src" path="frameworks/opt/vcard/java"/>
+ <classpathentry kind="src" path="frameworks/support/renderscript/v8/java/src"/>
<classpathentry kind="src" path="frameworks/support/v13/java"/>
<classpathentry kind="src" path="frameworks/support/v13/ics"/>
<classpathentry kind="src" path="frameworks/support/v13/ics-mr1"/>
@@ -96,6 +99,7 @@
<classpathentry kind="src" path="out/target/common/obj/APPS/Apollo_intermediates/src/src"/>
<classpathentry kind="src" path="out/target/common/obj/APPS/Phone_intermediates/src/src"/>
<classpathentry kind="src" path="out/target/common/obj/APPS/QuickSearchBox_intermediates/src/src"/>
+ <classpathentry kind="src" path="out/target/common/obj/APPS/SystemUI_intermediates/src/src"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/android-common-carousel_intermediates/src/renderscript/src"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/com.android.emailcommon_intermediates/src/src"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java"/>
@@ -104,15 +108,16 @@
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/location/java"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/media/java"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/telephony/java"/>
- <classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/voip/java"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/wifi/java"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/services_intermediates/src"/>
<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/src/src/java"/>
+ <classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/voip-common_intermediates/src/src/java"/>
<classpathentry kind="src" path="out/target/common/R"/>
<classpathentry kind="src" path="external/apache-http/src"/>
<classpathentry kind="src" path="external/bouncycastle/bcprov/src/main/java"/>
<classpathentry kind="src" path="external/koush/Superuser/Superuser/src"/>
<classpathentry kind="src" path="external/koush/Widgets/Widgets/src"/>
+ <classpathentry kind="src" path="external/guava/guava/src"/>
<classpathentry kind="src" path="external/libphonenumber/java/src"/>
<classpathentry kind="src" path="external/mp4parser/isoparser/src/main/java"/>
<classpathentry kind="src" path="external/nist-sip/java"/>
diff --git a/ide/eclipse/android-include-paths.xml b/ide/eclipse/android-include-paths.xml
index 0e60642f8..be188bd47 100644
--- a/ide/eclipse/android-include-paths.xml
+++ b/ide/eclipse/android-include-paths.xml
@@ -5,7 +5,8 @@
</language>
<language name="Assembly">
-<includepath>${ProjDirPath}/system/core/include/arch/linux-arm</includepath>
+<includepath>${ProjDirPath}/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.7/lib/gcc/arm-eabi/4.7/include</includepath>
+<includepath>${ProjDirPath}/build/core/combo/include/arch/linux-arm</includepath>
<includepath>${ProjDirPath}/system/core/include</includepath>
<includepath>${ProjDirPath}/bionic/libc/arch-arm/include</includepath>
<includepath>${ProjDirPath}/bionic/libc/include</includepath>
@@ -19,16 +20,22 @@
<includepath>${ProjDirPath}/hardware/libhardware/include</includepath>
<includepath>${ProjDirPath}/hardware/libhardware_legacy/include</includepath>
<includepath>${ProjDirPath}/hardware/ril/include</includepath>
+<includepath>${ProjDirPath}/frameworks/av/include</includepath>
<includepath>${ProjDirPath}/frameworks/base/include</includepath>
<includepath>${ProjDirPath}/frameworks/native/include</includepath>
+<includepath>${ProjDirPath}/frameworks/native/include/media/openmax</includepath>
<includepath>${ProjDirPath}/frameworks/native/opengl/include</includepath>
<includepath>${ProjDirPath}/external/skia/include</includepath>
<includepath>${ProjDirPath}/external/skia/include/core</includepath>
-<includepath>${ProjDirPath}/prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.6/lib/gcc/arm-linux-androideabi/4.6.x-google/include</includepath>
+<includepath>${ProjDirPath}/libnativehelper/include/nativehelper</includepath>
+<includepath>${ProjDirPath}/system/core/include/arch/linux-arm</includepath>
+<includepath>${ProjDirPath}/dalvik/libnativehelper/include</includepath>
+<includepath>${ProjDirPath}/dalvik/libnativehelper/include/nativehelper</includepath>
</language>
<language name="GNU C++">
-<includepath>${ProjDirPath}/system/core/include/arch/linux-arm</includepath>
+<includepath>${ProjDirPath}/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.7/lib/gcc/arm-eabi/4.7/include</includepath>
+<includepath>${ProjDirPath}/build/core/combo/include/arch/linux-arm</includepath>
<includepath>${ProjDirPath}/system/core/include</includepath>
<includepath>${ProjDirPath}/bionic/libc/arch-arm/include</includepath>
<includepath>${ProjDirPath}/bionic/libc/include</includepath>
@@ -42,16 +49,22 @@
<includepath>${ProjDirPath}/hardware/libhardware/include</includepath>
<includepath>${ProjDirPath}/hardware/libhardware_legacy/include</includepath>
<includepath>${ProjDirPath}/hardware/ril/include</includepath>
+<includepath>${ProjDirPath}/frameworks/av/include</includepath>
<includepath>${ProjDirPath}/frameworks/base/include</includepath>
<includepath>${ProjDirPath}/frameworks/native/include</includepath>
+<includepath>${ProjDirPath}/frameworks/native/include/media/openmax</includepath>
<includepath>${ProjDirPath}/frameworks/native/opengl/include</includepath>
<includepath>${ProjDirPath}/external/skia/include</includepath>
<includepath>${ProjDirPath}/external/skia/include/core</includepath>
-<includepath>${ProjDirPath}/prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.6/lib/gcc/arm-linux-androideabi/4.6.x-google/include</includepath>
+<includepath>${ProjDirPath}/libnativehelper/include/nativehelper</includepath>
+<includepath>${ProjDirPath}/system/core/include/arch/linux-arm</includepath>
+<includepath>${ProjDirPath}/dalvik/libnativehelper/include</includepath>
+<includepath>${ProjDirPath}/dalvik/libnativehelper/include/nativehelper</includepath>
</language>
<language name="GNU C">
-<includepath>${ProjDirPath}/system/core/include/arch/linux-arm</includepath>
+<includepath>${ProjDirPath}/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.7/lib/gcc/arm-eabi/4.7/include</includepath>
+<includepath>${ProjDirPath}/build/core/combo/include/arch/linux-arm</includepath>
<includepath>${ProjDirPath}/system/core/include</includepath>
<includepath>${ProjDirPath}/bionic/libc/arch-arm/include</includepath>
<includepath>${ProjDirPath}/bionic/libc/include</includepath>
@@ -65,12 +78,17 @@
<includepath>${ProjDirPath}/hardware/libhardware/include</includepath>
<includepath>${ProjDirPath}/hardware/libhardware_legacy/include</includepath>
<includepath>${ProjDirPath}/hardware/ril/include</includepath>
+<includepath>${ProjDirPath}/frameworks/av/include</includepath>
<includepath>${ProjDirPath}/frameworks/base/include</includepath>
<includepath>${ProjDirPath}/frameworks/native/include</includepath>
+<includepath>${ProjDirPath}/frameworks/native/include/media/openmax</includepath>
<includepath>${ProjDirPath}/frameworks/native/opengl/include</includepath>
<includepath>${ProjDirPath}/external/skia/include</includepath>
<includepath>${ProjDirPath}/external/skia/include/core</includepath>
-<includepath>${ProjDirPath}/prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.6/lib/gcc/arm-linux-androideabi/4.6.x-google/include</includepath>
+<includepath>${ProjDirPath}/libnativehelper/include/nativehelper</includepath>
+<includepath>${ProjDirPath}/system/core/include/arch/linux-arm</includepath>
+<includepath>${ProjDirPath}/dalvik/libnativehelper/include</includepath>
+<includepath>${ProjDirPath}/dalvik/libnativehelper/include/nativehelper</includepath>
</language>
</section>
diff --git a/ide/eclipse/android-symbols.xml b/ide/eclipse/android-symbols.xml
index 3fae03fbb..f503a6d6b 100644
--- a/ide/eclipse/android-symbols.xml
+++ b/ide/eclipse/android-symbols.xml
@@ -6,9 +6,6 @@
</language>
<language name="Assembly">
<macro>
-<name>HAVE_ANDROID_OS</name><value>1</value>
-</macro>
-<macro>
<name>NDEBUG</name><value>1</value>
</macro>
<macro>
@@ -21,24 +18,33 @@
<name>__OPTIMIZE__</name><value>1</value>
</macro>
<macro>
-<name>HAVE_FUTEX</name><value>1</value>
+<name>EGL_TRACE</name><value>1</value>
</macro>
<macro>
-<name>HAVE_PTHREADS</name><value>1</value>
+<name>LOG_TAG</name><value>"tag"</value>
</macro>
<macro>
-<name>EGL_TRACE</name><value>1</value>
+<name>__STDC_HOSTED__</name><value>1</value>
</macro>
<macro>
-<name>LOG_TAG</name><value>"tag"</value>
+<name>USE_OPENGL_RENDERER</name><value>1</value>
+</macro>
+<macro>
+<name>__STDC__</name><value>1</value>
+</macro>
+<macro>
+<name>__ANDROID__</name><value>1</value>
+</macro>
+<macro>
+<name>__SIZE_TYPE__</name><value>unsigned int</value>
+</macro>
+<macro>
+<name>__PTRDIFF_TYPE__</name><value>int</value>
</macro>
</language>
<language name="GNU C++">
<macro>
-<name>HAVE_ANDROID_OS</name><value>1</value>
-</macro>
-<macro>
<name>NDEBUG</name><value>1</value>
</macro>
<macro>
@@ -51,24 +57,33 @@
<name>__OPTIMIZE__</name><value>1</value>
</macro>
<macro>
-<name>HAVE_FUTEX</name><value>1</value>
+<name>EGL_TRACE</name><value>1</value>
</macro>
<macro>
-<name>HAVE_PTHREADS</name><value>1</value>
+<name>LOG_TAG</name><value>"tag"</value>
</macro>
<macro>
-<name>EGL_TRACE</name><value>1</value>
+<name>__STDC_HOSTED__</name><value>1</value>
</macro>
<macro>
-<name>LOG_TAG</name><value>"tag"</value>
+<name>USE_OPENGL_RENDERER</name><value>1</value>
+</macro>
+<macro>
+<name>__STDC__</name><value>1</value>
+</macro>
+<macro>
+<name>__ANDROID__</name><value>1</value>
+</macro>
+<macro>
+<name>__SIZE_TYPE__</name><value>unsigned int</value>
+</macro>
+<macro>
+<name>__PTRDIFF_TYPE__</name><value>int</value>
</macro>
</language>
<language name="GNU C">
<macro>
-<name>HAVE_ANDROID_OS</name><value>1</value>
-</macro>
-<macro>
<name>NDEBUG</name><value>1</value>
</macro>
<macro>
@@ -81,16 +96,28 @@
<name>__OPTIMIZE__</name><value>1</value>
</macro>
<macro>
-<name>HAVE_FUTEX</name><value>1</value>
+<name>EGL_TRACE</name><value>1</value>
</macro>
<macro>
-<name>HAVE_PTHREADS</name><value>1</value>
+<name>LOG_TAG</name><value>"tag"</value>
</macro>
<macro>
-<name>EGL_TRACE</name><value>1</value>
+<name>__STDC_HOSTED__</name><value>1</value>
</macro>
<macro>
-<name>LOG_TAG</name><value>"tag"</value>
+<name>USE_OPENGL_RENDERER</name><value>1</value>
+</macro>
+<macro>
+<name>__STDC__</name><value>1</value>
+</macro>
+<macro>
+<name>__ANDROID__</name><value>1</value>
+</macro>
+<macro>
+<name>__SIZE_TYPE__</name><value>unsigned int</value>
+</macro>
+<macro>
+<name>__PTRDIFF_TYPE__</name><value>int</value>
</macro>
</language>
diff --git a/ndk/platforms/README.CRT.TXT b/ndk/platforms/README.CRT.TXT
index c7b2c41d1..8cc33edd7 100644
--- a/ndk/platforms/README.CRT.TXT
+++ b/ndk/platforms/README.CRT.TXT
@@ -15,7 +15,7 @@ object files. They have the following names and usage:
crtbegin_static.[cS]
This file contains a tiny ELF startup entry point (named '_start')
that is linked into every Android _static_ executable. These binaries can
- run on any Linux ARM system, but cannot perform dynamic linking at all.
+ run on any Linux system, but cannot perform dynamic linking at all.
Note that the kernel calls the '_start' entry point directly when it
launches such an executable. The _start stub is used to call the
diff --git a/ndk/platforms/android-14/arch-arm/symbols/libOpenSLES.so.functions.txt b/ndk/platforms/android-14/arch-arm/symbols/libOpenSLES.so.functions.txt
new file mode 100644
index 000000000..f69a3e5a1
--- /dev/null
+++ b/ndk/platforms/android-14/arch-arm/symbols/libOpenSLES.so.functions.txt
@@ -0,0 +1,3 @@
+slCreateEngine
+slQueryNumSupportedEngineInterfaces
+slQuerySupportedEngineInterfaces
diff --git a/ndk/platforms/android-14/arch-x86/symbols/libOpenSLES.so.functions.txt b/ndk/platforms/android-14/arch-x86/symbols/libOpenSLES.so.functions.txt
new file mode 100644
index 000000000..f69a3e5a1
--- /dev/null
+++ b/ndk/platforms/android-14/arch-x86/symbols/libOpenSLES.so.functions.txt
@@ -0,0 +1,3 @@
+slCreateEngine
+slQueryNumSupportedEngineInterfaces
+slQuerySupportedEngineInterfaces
diff --git a/ndk/platforms/android-18/arch-arm/symbols/libGLESv3.so.functions.txt b/ndk/platforms/android-18/arch-arm/symbols/libGLESv3.so.functions.txt
new file mode 100644
index 000000000..6ee108bde
--- /dev/null
+++ b/ndk/platforms/android-18/arch-arm/symbols/libGLESv3.so.functions.txt
@@ -0,0 +1,263 @@
+glActiveTexture
+glAttachShader
+glBeginQuery
+glBeginTransformFeedback
+glBindAttribLocation
+glBindBuffer
+glBindBufferBase
+glBindBufferRange
+glBindFramebuffer
+glBindRenderbuffer
+glBindSampler
+glBindTexture
+glBindTransformFeedback
+glBindVertexArray
+glBindVertexArrayOES
+glBlendColor
+glBlendEquation
+glBlendEquationSeparate
+glBlendFunc
+glBlendFuncSeparate
+glBlitFramebuffer
+glBufferData
+glBufferSubData
+glCheckFramebufferStatus
+glClear
+glClearBufferfi
+glClearBufferfv
+glClearBufferiv
+glClearBufferuiv
+glClearColor
+glClearDepthf
+glClearStencil
+glClientWaitSync
+glColorMask
+glCompileShader
+glCompressedTexImage2D
+glCompressedTexImage3D
+glCompressedTexImage3DOES
+glCompressedTexSubImage2D
+glCompressedTexSubImage3D
+glCompressedTexSubImage3DOES
+glCopyBufferSubData
+glCopyTexImage2D
+glCopyTexSubImage2D
+glCopyTexSubImage3D
+glCopyTexSubImage3DOES
+glCreateProgram
+glCreateShader
+glCullFace
+glDeleteBuffers
+glDeleteFramebuffers
+glDeleteProgram
+glDeleteQueries
+glDeleteRenderbuffers
+glDeleteSamplers
+glDeleteShader
+glDeleteSync
+glDeleteTextures
+glDeleteTransformFeedbacks
+glDeleteVertexArrays
+glDeleteVertexArraysOES
+glDepthFunc
+glDepthMask
+glDepthRangef
+glDetachShader
+glDisable
+glDisableVertexAttribArray
+glDrawArrays
+glDrawArraysInstanced
+glDrawBuffers
+glDrawElements
+glDrawElementsInstanced
+glDrawRangeElements
+glEGLImageTargetRenderbufferStorageOES
+glEGLImageTargetTexture2DOES
+glEnable
+glEnableVertexAttribArray
+glEndQuery
+glEndTransformFeedback
+glFenceSync
+glFinish
+glFlush
+glFlushMappedBufferRange
+glFramebufferRenderbuffer
+glFramebufferTexture2D
+glFramebufferTexture3DOES
+glFramebufferTextureLayer
+glFrontFace
+glGenBuffers
+glGenFramebuffers
+glGenQueries
+glGenRenderbuffers
+glGenSamplers
+glGenTextures
+glGenTransformFeedbacks
+glGenVertexArrays
+glGenVertexArraysOES
+glGenerateMipmap
+glGetActiveAttrib
+glGetActiveUniform
+glGetActiveUniformBlockName
+glGetActiveUniformBlockiv
+glGetActiveUniformsiv
+glGetAttachedShaders
+glGetAttribLocation
+glGetBooleanv
+glGetBufferParameteri64v
+glGetBufferParameteriv
+glGetBufferPointerv
+glGetBufferPointervOES
+glGetError
+glGetFloatv
+glGetFragDataLocation
+glGetFramebufferAttachmentParameteriv
+glGetInteger64i_v
+glGetInteger64v
+glGetIntegeri_v
+glGetIntegerv
+glGetInternalformativ
+glGetProgramBinary
+glGetProgramBinaryOES
+glGetProgramInfoLog
+glGetProgramiv
+glGetQueryObjectuiv
+glGetQueryiv
+glGetRenderbufferParameteriv
+glGetSamplerParameterfv
+glGetSamplerParameteriv
+glGetShaderInfoLog
+glGetShaderPrecisionFormat
+glGetShaderSource
+glGetShaderiv
+glGetString
+glGetStringi
+glGetSynciv
+glGetTexParameterfv
+glGetTexParameteriv
+glGetTransformFeedbackVarying
+glGetUniformBlockIndex
+glGetUniformIndices
+glGetUniformLocation
+glGetUniformfv
+glGetUniformiv
+glGetUniformuiv
+glGetVertexAttribIiv
+glGetVertexAttribIuiv
+glGetVertexAttribPointerv
+glGetVertexAttribfv
+glGetVertexAttribiv
+glHint
+glInvalidateFramebuffer
+glInvalidateSubFramebuffer
+glIsBuffer
+glIsEnabled
+glIsFramebuffer
+glIsProgram
+glIsQuery
+glIsRenderbuffer
+glIsSampler
+glIsShader
+glIsSync
+glIsTexture
+glIsTransformFeedback
+glIsVertexArray
+glIsVertexArrayOES
+glLineWidth
+glLinkProgram
+glMapBufferOES
+glMapBufferRange
+glPauseTransformFeedback
+glPixelStorei
+glPolygonOffset
+glProgramBinary
+glProgramBinaryOES
+glProgramParameteri
+glReadBuffer
+glReadPixels
+glReleaseShaderCompiler
+glRenderbufferStorage
+glRenderbufferStorageMultisample
+glResumeTransformFeedback
+glSampleCoverage
+glSamplerParameterf
+glSamplerParameterfv
+glSamplerParameteri
+glSamplerParameteriv
+glScissor
+glShaderBinary
+glShaderSource
+glStencilFunc
+glStencilFuncSeparate
+glStencilMask
+glStencilMaskSeparate
+glStencilOp
+glStencilOpSeparate
+glTexImage2D
+glTexImage3D
+glTexImage3DOES
+glTexParameterf
+glTexParameterfv
+glTexParameteri
+glTexParameteriv
+glTexStorage2D
+glTexStorage3D
+glTexSubImage2D
+glTexSubImage3D
+glTexSubImage3DOES
+glTransformFeedbackVaryings
+glUniform1f
+glUniform1fv
+glUniform1i
+glUniform1iv
+glUniform1ui
+glUniform1uiv
+glUniform2f
+glUniform2fv
+glUniform2i
+glUniform2iv
+glUniform2ui
+glUniform2uiv
+glUniform3f
+glUniform3fv
+glUniform3i
+glUniform3iv
+glUniform3ui
+glUniform3uiv
+glUniform4f
+glUniform4fv
+glUniform4i
+glUniform4iv
+glUniform4ui
+glUniform4uiv
+glUniformBlockBinding
+glUniformMatrix2fv
+glUniformMatrix2x3fv
+glUniformMatrix2x4fv
+glUniformMatrix3fv
+glUniformMatrix3x2fv
+glUniformMatrix3x4fv
+glUniformMatrix4fv
+glUniformMatrix4x2fv
+glUniformMatrix4x3fv
+glUnmapBuffer
+glUnmapBufferOES
+glUseProgram
+glValidateProgram
+glVertexAttrib1f
+glVertexAttrib1fv
+glVertexAttrib2f
+glVertexAttrib2fv
+glVertexAttrib3f
+glVertexAttrib3fv
+glVertexAttrib4f
+glVertexAttrib4fv
+glVertexAttribDivisor
+glVertexAttribI4i
+glVertexAttribI4iv
+glVertexAttribI4ui
+glVertexAttribI4uiv
+glVertexAttribIPointer
+glVertexAttribPointer
+glViewport
+glWaitSync
diff --git a/ndk/platforms/android-18/arch-arm/symbols/libGLESv3.so.variables.txt b/ndk/platforms/android-18/arch-arm/symbols/libGLESv3.so.variables.txt
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/ndk/platforms/android-18/arch-arm/symbols/libGLESv3.so.variables.txt
@@ -0,0 +1 @@
+
diff --git a/ndk/platforms/android-18/arch-mips/symbols/libGLESv3.so.functions.txt b/ndk/platforms/android-18/arch-mips/symbols/libGLESv3.so.functions.txt
new file mode 100644
index 000000000..6ee108bde
--- /dev/null
+++ b/ndk/platforms/android-18/arch-mips/symbols/libGLESv3.so.functions.txt
@@ -0,0 +1,263 @@
+glActiveTexture
+glAttachShader
+glBeginQuery
+glBeginTransformFeedback
+glBindAttribLocation
+glBindBuffer
+glBindBufferBase
+glBindBufferRange
+glBindFramebuffer
+glBindRenderbuffer
+glBindSampler
+glBindTexture
+glBindTransformFeedback
+glBindVertexArray
+glBindVertexArrayOES
+glBlendColor
+glBlendEquation
+glBlendEquationSeparate
+glBlendFunc
+glBlendFuncSeparate
+glBlitFramebuffer
+glBufferData
+glBufferSubData
+glCheckFramebufferStatus
+glClear
+glClearBufferfi
+glClearBufferfv
+glClearBufferiv
+glClearBufferuiv
+glClearColor
+glClearDepthf
+glClearStencil
+glClientWaitSync
+glColorMask
+glCompileShader
+glCompressedTexImage2D
+glCompressedTexImage3D
+glCompressedTexImage3DOES
+glCompressedTexSubImage2D
+glCompressedTexSubImage3D
+glCompressedTexSubImage3DOES
+glCopyBufferSubData
+glCopyTexImage2D
+glCopyTexSubImage2D
+glCopyTexSubImage3D
+glCopyTexSubImage3DOES
+glCreateProgram
+glCreateShader
+glCullFace
+glDeleteBuffers
+glDeleteFramebuffers
+glDeleteProgram
+glDeleteQueries
+glDeleteRenderbuffers
+glDeleteSamplers
+glDeleteShader
+glDeleteSync
+glDeleteTextures
+glDeleteTransformFeedbacks
+glDeleteVertexArrays
+glDeleteVertexArraysOES
+glDepthFunc
+glDepthMask
+glDepthRangef
+glDetachShader
+glDisable
+glDisableVertexAttribArray
+glDrawArrays
+glDrawArraysInstanced
+glDrawBuffers
+glDrawElements
+glDrawElementsInstanced
+glDrawRangeElements
+glEGLImageTargetRenderbufferStorageOES
+glEGLImageTargetTexture2DOES
+glEnable
+glEnableVertexAttribArray
+glEndQuery
+glEndTransformFeedback
+glFenceSync
+glFinish
+glFlush
+glFlushMappedBufferRange
+glFramebufferRenderbuffer
+glFramebufferTexture2D
+glFramebufferTexture3DOES
+glFramebufferTextureLayer
+glFrontFace
+glGenBuffers
+glGenFramebuffers
+glGenQueries
+glGenRenderbuffers
+glGenSamplers
+glGenTextures
+glGenTransformFeedbacks
+glGenVertexArrays
+glGenVertexArraysOES
+glGenerateMipmap
+glGetActiveAttrib
+glGetActiveUniform
+glGetActiveUniformBlockName
+glGetActiveUniformBlockiv
+glGetActiveUniformsiv
+glGetAttachedShaders
+glGetAttribLocation
+glGetBooleanv
+glGetBufferParameteri64v
+glGetBufferParameteriv
+glGetBufferPointerv
+glGetBufferPointervOES
+glGetError
+glGetFloatv
+glGetFragDataLocation
+glGetFramebufferAttachmentParameteriv
+glGetInteger64i_v
+glGetInteger64v
+glGetIntegeri_v
+glGetIntegerv
+glGetInternalformativ
+glGetProgramBinary
+glGetProgramBinaryOES
+glGetProgramInfoLog
+glGetProgramiv
+glGetQueryObjectuiv
+glGetQueryiv
+glGetRenderbufferParameteriv
+glGetSamplerParameterfv
+glGetSamplerParameteriv
+glGetShaderInfoLog
+glGetShaderPrecisionFormat
+glGetShaderSource
+glGetShaderiv
+glGetString
+glGetStringi
+glGetSynciv
+glGetTexParameterfv
+glGetTexParameteriv
+glGetTransformFeedbackVarying
+glGetUniformBlockIndex
+glGetUniformIndices
+glGetUniformLocation
+glGetUniformfv
+glGetUniformiv
+glGetUniformuiv
+glGetVertexAttribIiv
+glGetVertexAttribIuiv
+glGetVertexAttribPointerv
+glGetVertexAttribfv
+glGetVertexAttribiv
+glHint
+glInvalidateFramebuffer
+glInvalidateSubFramebuffer
+glIsBuffer
+glIsEnabled
+glIsFramebuffer
+glIsProgram
+glIsQuery
+glIsRenderbuffer
+glIsSampler
+glIsShader
+glIsSync
+glIsTexture
+glIsTransformFeedback
+glIsVertexArray
+glIsVertexArrayOES
+glLineWidth
+glLinkProgram
+glMapBufferOES
+glMapBufferRange
+glPauseTransformFeedback
+glPixelStorei
+glPolygonOffset
+glProgramBinary
+glProgramBinaryOES
+glProgramParameteri
+glReadBuffer
+glReadPixels
+glReleaseShaderCompiler
+glRenderbufferStorage
+glRenderbufferStorageMultisample
+glResumeTransformFeedback
+glSampleCoverage
+glSamplerParameterf
+glSamplerParameterfv
+glSamplerParameteri
+glSamplerParameteriv
+glScissor
+glShaderBinary
+glShaderSource
+glStencilFunc
+glStencilFuncSeparate
+glStencilMask
+glStencilMaskSeparate
+glStencilOp
+glStencilOpSeparate
+glTexImage2D
+glTexImage3D
+glTexImage3DOES
+glTexParameterf
+glTexParameterfv
+glTexParameteri
+glTexParameteriv
+glTexStorage2D
+glTexStorage3D
+glTexSubImage2D
+glTexSubImage3D
+glTexSubImage3DOES
+glTransformFeedbackVaryings
+glUniform1f
+glUniform1fv
+glUniform1i
+glUniform1iv
+glUniform1ui
+glUniform1uiv
+glUniform2f
+glUniform2fv
+glUniform2i
+glUniform2iv
+glUniform2ui
+glUniform2uiv
+glUniform3f
+glUniform3fv
+glUniform3i
+glUniform3iv
+glUniform3ui
+glUniform3uiv
+glUniform4f
+glUniform4fv
+glUniform4i
+glUniform4iv
+glUniform4ui
+glUniform4uiv
+glUniformBlockBinding
+glUniformMatrix2fv
+glUniformMatrix2x3fv
+glUniformMatrix2x4fv
+glUniformMatrix3fv
+glUniformMatrix3x2fv
+glUniformMatrix3x4fv
+glUniformMatrix4fv
+glUniformMatrix4x2fv
+glUniformMatrix4x3fv
+glUnmapBuffer
+glUnmapBufferOES
+glUseProgram
+glValidateProgram
+glVertexAttrib1f
+glVertexAttrib1fv
+glVertexAttrib2f
+glVertexAttrib2fv
+glVertexAttrib3f
+glVertexAttrib3fv
+glVertexAttrib4f
+glVertexAttrib4fv
+glVertexAttribDivisor
+glVertexAttribI4i
+glVertexAttribI4iv
+glVertexAttribI4ui
+glVertexAttribI4uiv
+glVertexAttribIPointer
+glVertexAttribPointer
+glViewport
+glWaitSync
diff --git a/ndk/platforms/android-18/arch-mips/symbols/libGLESv3.so.variables.txt b/ndk/platforms/android-18/arch-mips/symbols/libGLESv3.so.variables.txt
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/ndk/platforms/android-18/arch-mips/symbols/libGLESv3.so.variables.txt
@@ -0,0 +1 @@
+
diff --git a/ndk/platforms/android-18/arch-x86/symbols/libGLESv3.so.functions.txt b/ndk/platforms/android-18/arch-x86/symbols/libGLESv3.so.functions.txt
new file mode 100644
index 000000000..6ee108bde
--- /dev/null
+++ b/ndk/platforms/android-18/arch-x86/symbols/libGLESv3.so.functions.txt
@@ -0,0 +1,263 @@
+glActiveTexture
+glAttachShader
+glBeginQuery
+glBeginTransformFeedback
+glBindAttribLocation
+glBindBuffer
+glBindBufferBase
+glBindBufferRange
+glBindFramebuffer
+glBindRenderbuffer
+glBindSampler
+glBindTexture
+glBindTransformFeedback
+glBindVertexArray
+glBindVertexArrayOES
+glBlendColor
+glBlendEquation
+glBlendEquationSeparate
+glBlendFunc
+glBlendFuncSeparate
+glBlitFramebuffer
+glBufferData
+glBufferSubData
+glCheckFramebufferStatus
+glClear
+glClearBufferfi
+glClearBufferfv
+glClearBufferiv
+glClearBufferuiv
+glClearColor
+glClearDepthf
+glClearStencil
+glClientWaitSync
+glColorMask
+glCompileShader
+glCompressedTexImage2D
+glCompressedTexImage3D
+glCompressedTexImage3DOES
+glCompressedTexSubImage2D
+glCompressedTexSubImage3D
+glCompressedTexSubImage3DOES
+glCopyBufferSubData
+glCopyTexImage2D
+glCopyTexSubImage2D
+glCopyTexSubImage3D
+glCopyTexSubImage3DOES
+glCreateProgram
+glCreateShader
+glCullFace
+glDeleteBuffers
+glDeleteFramebuffers
+glDeleteProgram
+glDeleteQueries
+glDeleteRenderbuffers
+glDeleteSamplers
+glDeleteShader
+glDeleteSync
+glDeleteTextures
+glDeleteTransformFeedbacks
+glDeleteVertexArrays
+glDeleteVertexArraysOES
+glDepthFunc
+glDepthMask
+glDepthRangef
+glDetachShader
+glDisable
+glDisableVertexAttribArray
+glDrawArrays
+glDrawArraysInstanced
+glDrawBuffers
+glDrawElements
+glDrawElementsInstanced
+glDrawRangeElements
+glEGLImageTargetRenderbufferStorageOES
+glEGLImageTargetTexture2DOES
+glEnable
+glEnableVertexAttribArray
+glEndQuery
+glEndTransformFeedback
+glFenceSync
+glFinish
+glFlush
+glFlushMappedBufferRange
+glFramebufferRenderbuffer
+glFramebufferTexture2D
+glFramebufferTexture3DOES
+glFramebufferTextureLayer
+glFrontFace
+glGenBuffers
+glGenFramebuffers
+glGenQueries
+glGenRenderbuffers
+glGenSamplers
+glGenTextures
+glGenTransformFeedbacks
+glGenVertexArrays
+glGenVertexArraysOES
+glGenerateMipmap
+glGetActiveAttrib
+glGetActiveUniform
+glGetActiveUniformBlockName
+glGetActiveUniformBlockiv
+glGetActiveUniformsiv
+glGetAttachedShaders
+glGetAttribLocation
+glGetBooleanv
+glGetBufferParameteri64v
+glGetBufferParameteriv
+glGetBufferPointerv
+glGetBufferPointervOES
+glGetError
+glGetFloatv
+glGetFragDataLocation
+glGetFramebufferAttachmentParameteriv
+glGetInteger64i_v
+glGetInteger64v
+glGetIntegeri_v
+glGetIntegerv
+glGetInternalformativ
+glGetProgramBinary
+glGetProgramBinaryOES
+glGetProgramInfoLog
+glGetProgramiv
+glGetQueryObjectuiv
+glGetQueryiv
+glGetRenderbufferParameteriv
+glGetSamplerParameterfv
+glGetSamplerParameteriv
+glGetShaderInfoLog
+glGetShaderPrecisionFormat
+glGetShaderSource
+glGetShaderiv
+glGetString
+glGetStringi
+glGetSynciv
+glGetTexParameterfv
+glGetTexParameteriv
+glGetTransformFeedbackVarying
+glGetUniformBlockIndex
+glGetUniformIndices
+glGetUniformLocation
+glGetUniformfv
+glGetUniformiv
+glGetUniformuiv
+glGetVertexAttribIiv
+glGetVertexAttribIuiv
+glGetVertexAttribPointerv
+glGetVertexAttribfv
+glGetVertexAttribiv
+glHint
+glInvalidateFramebuffer
+glInvalidateSubFramebuffer
+glIsBuffer
+glIsEnabled
+glIsFramebuffer
+glIsProgram
+glIsQuery
+glIsRenderbuffer
+glIsSampler
+glIsShader
+glIsSync
+glIsTexture
+glIsTransformFeedback
+glIsVertexArray
+glIsVertexArrayOES
+glLineWidth
+glLinkProgram
+glMapBufferOES
+glMapBufferRange
+glPauseTransformFeedback
+glPixelStorei
+glPolygonOffset
+glProgramBinary
+glProgramBinaryOES
+glProgramParameteri
+glReadBuffer
+glReadPixels
+glReleaseShaderCompiler
+glRenderbufferStorage
+glRenderbufferStorageMultisample
+glResumeTransformFeedback
+glSampleCoverage
+glSamplerParameterf
+glSamplerParameterfv
+glSamplerParameteri
+glSamplerParameteriv
+glScissor
+glShaderBinary
+glShaderSource
+glStencilFunc
+glStencilFuncSeparate
+glStencilMask
+glStencilMaskSeparate
+glStencilOp
+glStencilOpSeparate
+glTexImage2D
+glTexImage3D
+glTexImage3DOES
+glTexParameterf
+glTexParameterfv
+glTexParameteri
+glTexParameteriv
+glTexStorage2D
+glTexStorage3D
+glTexSubImage2D
+glTexSubImage3D
+glTexSubImage3DOES
+glTransformFeedbackVaryings
+glUniform1f
+glUniform1fv
+glUniform1i
+glUniform1iv
+glUniform1ui
+glUniform1uiv
+glUniform2f
+glUniform2fv
+glUniform2i
+glUniform2iv
+glUniform2ui
+glUniform2uiv
+glUniform3f
+glUniform3fv
+glUniform3i
+glUniform3iv
+glUniform3ui
+glUniform3uiv
+glUniform4f
+glUniform4fv
+glUniform4i
+glUniform4iv
+glUniform4ui
+glUniform4uiv
+glUniformBlockBinding
+glUniformMatrix2fv
+glUniformMatrix2x3fv
+glUniformMatrix2x4fv
+glUniformMatrix3fv
+glUniformMatrix3x2fv
+glUniformMatrix3x4fv
+glUniformMatrix4fv
+glUniformMatrix4x2fv
+glUniformMatrix4x3fv
+glUnmapBuffer
+glUnmapBufferOES
+glUseProgram
+glValidateProgram
+glVertexAttrib1f
+glVertexAttrib1fv
+glVertexAttrib2f
+glVertexAttrib2fv
+glVertexAttrib3f
+glVertexAttrib3fv
+glVertexAttrib4f
+glVertexAttrib4fv
+glVertexAttribDivisor
+glVertexAttribI4i
+glVertexAttribI4iv
+glVertexAttribI4ui
+glVertexAttribI4uiv
+glVertexAttribIPointer
+glVertexAttribPointer
+glViewport
+glWaitSync
diff --git a/ndk/platforms/android-18/arch-x86/symbols/libGLESv3.so.variables.txt b/ndk/platforms/android-18/arch-x86/symbols/libGLESv3.so.variables.txt
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/ndk/platforms/android-18/arch-x86/symbols/libGLESv3.so.variables.txt
@@ -0,0 +1 @@
+
diff --git a/ndk/platforms/android-18/include/GLES3/gl3.h b/ndk/platforms/android-18/include/GLES3/gl3.h
new file mode 100644
index 000000000..9c79862c0
--- /dev/null
+++ b/ndk/platforms/android-18/include/GLES3/gl3.h
@@ -0,0 +1,1061 @@
+#ifndef __gl3_h_
+#define __gl3_h_
+
+/*
+ * gl3.h last updated on $Date: 2013-02-12 14:37:24 -0800 (Tue, 12 Feb 2013) $
+ */
+
+#include <GLES3/gl3platform.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2007-2013 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/*-------------------------------------------------------------------------
+ * Data type definitions
+ *-----------------------------------------------------------------------*/
+
+/* OpenGL ES 2.0 */
+
+typedef void GLvoid;
+typedef char GLchar;
+typedef unsigned int GLenum;
+typedef unsigned char GLboolean;
+typedef unsigned int GLbitfield;
+typedef khronos_int8_t GLbyte;
+typedef short GLshort;
+typedef int GLint;
+typedef int GLsizei;
+typedef khronos_uint8_t GLubyte;
+typedef unsigned short GLushort;
+typedef unsigned int GLuint;
+typedef khronos_float_t GLfloat;
+typedef khronos_float_t GLclampf;
+typedef khronos_int32_t GLfixed;
+typedef khronos_intptr_t GLintptr;
+typedef khronos_ssize_t GLsizeiptr;
+
+/* OpenGL ES 3.0 */
+
+typedef unsigned short GLhalf;
+typedef khronos_int64_t GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef struct __GLsync *GLsync;
+
+/*-------------------------------------------------------------------------
+ * Token definitions
+ *-----------------------------------------------------------------------*/
+
+/* OpenGL ES core versions */
+#define GL_ES_VERSION_3_0 1
+#define GL_ES_VERSION_2_0 1
+
+/* OpenGL ES 2.0 */
+
+/* ClearBufferMask */
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_COLOR_BUFFER_BIT 0x00004000
+
+/* Boolean */
+#define GL_FALSE 0
+#define GL_TRUE 1
+
+/* BeginMode */
+#define GL_POINTS 0x0000
+#define GL_LINES 0x0001
+#define GL_LINE_LOOP 0x0002
+#define GL_LINE_STRIP 0x0003
+#define GL_TRIANGLES 0x0004
+#define GL_TRIANGLE_STRIP 0x0005
+#define GL_TRIANGLE_FAN 0x0006
+
+/* BlendingFactorDest */
+#define GL_ZERO 0
+#define GL_ONE 1
+#define GL_SRC_COLOR 0x0300
+#define GL_ONE_MINUS_SRC_COLOR 0x0301
+#define GL_SRC_ALPHA 0x0302
+#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+#define GL_DST_ALPHA 0x0304
+#define GL_ONE_MINUS_DST_ALPHA 0x0305
+
+/* BlendingFactorSrc */
+/* GL_ZERO */
+/* GL_ONE */
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+/* GL_SRC_ALPHA */
+/* GL_ONE_MINUS_SRC_ALPHA */
+/* GL_DST_ALPHA */
+/* GL_ONE_MINUS_DST_ALPHA */
+
+/* BlendEquationSeparate */
+#define GL_FUNC_ADD 0x8006
+#define GL_BLEND_EQUATION 0x8009
+#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */
+#define GL_BLEND_EQUATION_ALPHA 0x883D
+
+/* BlendSubtract */
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+
+/* Separate Blend Functions */
+#define GL_BLEND_DST_RGB 0x80C8
+#define GL_BLEND_SRC_RGB 0x80C9
+#define GL_BLEND_DST_ALPHA 0x80CA
+#define GL_BLEND_SRC_ALPHA 0x80CB
+#define GL_CONSTANT_COLOR 0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+#define GL_CONSTANT_ALPHA 0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+#define GL_BLEND_COLOR 0x8005
+
+/* Buffer Objects */
+#define GL_ARRAY_BUFFER 0x8892
+#define GL_ELEMENT_ARRAY_BUFFER 0x8893
+#define GL_ARRAY_BUFFER_BINDING 0x8894
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
+
+#define GL_STREAM_DRAW 0x88E0
+#define GL_STATIC_DRAW 0x88E4
+#define GL_DYNAMIC_DRAW 0x88E8
+
+#define GL_BUFFER_SIZE 0x8764
+#define GL_BUFFER_USAGE 0x8765
+
+#define GL_CURRENT_VERTEX_ATTRIB 0x8626
+
+/* CullFaceMode */
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_FRONT_AND_BACK 0x0408
+
+/* DepthFunction */
+/* GL_NEVER */
+/* GL_LESS */
+/* GL_EQUAL */
+/* GL_LEQUAL */
+/* GL_GREATER */
+/* GL_NOTEQUAL */
+/* GL_GEQUAL */
+/* GL_ALWAYS */
+
+/* EnableCap */
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_CULL_FACE 0x0B44
+#define GL_BLEND 0x0BE2
+#define GL_DITHER 0x0BD0
+#define GL_STENCIL_TEST 0x0B90
+#define GL_DEPTH_TEST 0x0B71
+#define GL_SCISSOR_TEST 0x0C11
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_COVERAGE 0x80A0
+
+/* ErrorCode */
+#define GL_NO_ERROR 0
+#define GL_INVALID_ENUM 0x0500
+#define GL_INVALID_VALUE 0x0501
+#define GL_INVALID_OPERATION 0x0502
+#define GL_OUT_OF_MEMORY 0x0505
+
+/* FrontFaceDirection */
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+
+/* GetPName */
+#define GL_LINE_WIDTH 0x0B21
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_CULL_FACE_MODE 0x0B45
+#define GL_FRONT_FACE 0x0B46
+#define GL_DEPTH_RANGE 0x0B70
+#define GL_DEPTH_WRITEMASK 0x0B72
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#define GL_DEPTH_FUNC 0x0B74
+#define GL_STENCIL_CLEAR_VALUE 0x0B91
+#define GL_STENCIL_FUNC 0x0B92
+#define GL_STENCIL_FAIL 0x0B94
+#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+#define GL_STENCIL_REF 0x0B97
+#define GL_STENCIL_VALUE_MASK 0x0B93
+#define GL_STENCIL_WRITEMASK 0x0B98
+#define GL_STENCIL_BACK_FUNC 0x8800
+#define GL_STENCIL_BACK_FAIL 0x8801
+#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
+#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
+#define GL_STENCIL_BACK_REF 0x8CA3
+#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
+#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
+#define GL_VIEWPORT 0x0BA2
+#define GL_SCISSOR_BOX 0x0C10
+/* GL_SCISSOR_TEST */
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_PACK_ALIGNMENT 0x0D05
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_SUBPIXEL_BITS 0x0D50
+#define GL_RED_BITS 0x0D52
+#define GL_GREEN_BITS 0x0D53
+#define GL_BLUE_BITS 0x0D54
+#define GL_ALPHA_BITS 0x0D55
+#define GL_DEPTH_BITS 0x0D56
+#define GL_STENCIL_BITS 0x0D57
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+/* GL_POLYGON_OFFSET_FILL */
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+
+/* GetTextureParameter */
+/* GL_TEXTURE_MAG_FILTER */
+/* GL_TEXTURE_MIN_FILTER */
+/* GL_TEXTURE_WRAP_S */
+/* GL_TEXTURE_WRAP_T */
+
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+
+/* HintMode */
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+
+/* HintTarget */
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+
+/* DataType */
+#define GL_BYTE 0x1400
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_SHORT 0x1402
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_INT 0x1404
+#define GL_UNSIGNED_INT 0x1405
+#define GL_FLOAT 0x1406
+#define GL_FIXED 0x140C
+
+/* PixelFormat */
+#define GL_DEPTH_COMPONENT 0x1902
+#define GL_ALPHA 0x1906
+#define GL_RGB 0x1907
+#define GL_RGBA 0x1908
+#define GL_LUMINANCE 0x1909
+#define GL_LUMINANCE_ALPHA 0x190A
+
+/* PixelType */
+/* GL_UNSIGNED_BYTE */
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+
+/* Shaders */
+#define GL_FRAGMENT_SHADER 0x8B30
+#define GL_VERTEX_SHADER 0x8B31
+#define GL_MAX_VERTEX_ATTRIBS 0x8869
+#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
+#define GL_MAX_VARYING_VECTORS 0x8DFC
+#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
+#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
+#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
+#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
+#define GL_SHADER_TYPE 0x8B4F
+#define GL_DELETE_STATUS 0x8B80
+#define GL_LINK_STATUS 0x8B82
+#define GL_VALIDATE_STATUS 0x8B83
+#define GL_ATTACHED_SHADERS 0x8B85
+#define GL_ACTIVE_UNIFORMS 0x8B86
+#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
+#define GL_ACTIVE_ATTRIBUTES 0x8B89
+#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
+#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
+#define GL_CURRENT_PROGRAM 0x8B8D
+
+/* StencilFunction */
+#define GL_NEVER 0x0200
+#define GL_LESS 0x0201
+#define GL_EQUAL 0x0202
+#define GL_LEQUAL 0x0203
+#define GL_GREATER 0x0204
+#define GL_NOTEQUAL 0x0205
+#define GL_GEQUAL 0x0206
+#define GL_ALWAYS 0x0207
+
+/* StencilOp */
+/* GL_ZERO */
+#define GL_KEEP 0x1E00
+#define GL_REPLACE 0x1E01
+#define GL_INCR 0x1E02
+#define GL_DECR 0x1E03
+#define GL_INVERT 0x150A
+#define GL_INCR_WRAP 0x8507
+#define GL_DECR_WRAP 0x8508
+
+/* StringName */
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+
+/* TextureMagFilter */
+#define GL_NEAREST 0x2600
+#define GL_LINEAR 0x2601
+
+/* TextureMinFilter */
+/* GL_NEAREST */
+/* GL_LINEAR */
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+
+/* TextureParameterName */
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+
+/* TextureTarget */
+/* GL_TEXTURE_2D */
+#define GL_TEXTURE 0x1702
+
+#define GL_TEXTURE_CUBE_MAP 0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+
+/* TextureUnit */
+#define GL_TEXTURE0 0x84C0
+#define GL_TEXTURE1 0x84C1
+#define GL_TEXTURE2 0x84C2
+#define GL_TEXTURE3 0x84C3
+#define GL_TEXTURE4 0x84C4
+#define GL_TEXTURE5 0x84C5
+#define GL_TEXTURE6 0x84C6
+#define GL_TEXTURE7 0x84C7
+#define GL_TEXTURE8 0x84C8
+#define GL_TEXTURE9 0x84C9
+#define GL_TEXTURE10 0x84CA
+#define GL_TEXTURE11 0x84CB
+#define GL_TEXTURE12 0x84CC
+#define GL_TEXTURE13 0x84CD
+#define GL_TEXTURE14 0x84CE
+#define GL_TEXTURE15 0x84CF
+#define GL_TEXTURE16 0x84D0
+#define GL_TEXTURE17 0x84D1
+#define GL_TEXTURE18 0x84D2
+#define GL_TEXTURE19 0x84D3
+#define GL_TEXTURE20 0x84D4
+#define GL_TEXTURE21 0x84D5
+#define GL_TEXTURE22 0x84D6
+#define GL_TEXTURE23 0x84D7
+#define GL_TEXTURE24 0x84D8
+#define GL_TEXTURE25 0x84D9
+#define GL_TEXTURE26 0x84DA
+#define GL_TEXTURE27 0x84DB
+#define GL_TEXTURE28 0x84DC
+#define GL_TEXTURE29 0x84DD
+#define GL_TEXTURE30 0x84DE
+#define GL_TEXTURE31 0x84DF
+#define GL_ACTIVE_TEXTURE 0x84E0
+
+/* TextureWrapMode */
+#define GL_REPEAT 0x2901
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_MIRRORED_REPEAT 0x8370
+
+/* Uniform Types */
+#define GL_FLOAT_VEC2 0x8B50
+#define GL_FLOAT_VEC3 0x8B51
+#define GL_FLOAT_VEC4 0x8B52
+#define GL_INT_VEC2 0x8B53
+#define GL_INT_VEC3 0x8B54
+#define GL_INT_VEC4 0x8B55
+#define GL_BOOL 0x8B56
+#define GL_BOOL_VEC2 0x8B57
+#define GL_BOOL_VEC3 0x8B58
+#define GL_BOOL_VEC4 0x8B59
+#define GL_FLOAT_MAT2 0x8B5A
+#define GL_FLOAT_MAT3 0x8B5B
+#define GL_FLOAT_MAT4 0x8B5C
+#define GL_SAMPLER_2D 0x8B5E
+#define GL_SAMPLER_CUBE 0x8B60
+
+/* Vertex Arrays */
+#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
+#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
+#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
+#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
+#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
+#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
+
+/* Read Format */
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+
+/* Shader Source */
+#define GL_COMPILE_STATUS 0x8B81
+#define GL_INFO_LOG_LENGTH 0x8B84
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#define GL_SHADER_COMPILER 0x8DFA
+
+/* Shader Binary */
+#define GL_SHADER_BINARY_FORMATS 0x8DF8
+#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+
+/* Shader Precision-Specified Types */
+#define GL_LOW_FLOAT 0x8DF0
+#define GL_MEDIUM_FLOAT 0x8DF1
+#define GL_HIGH_FLOAT 0x8DF2
+#define GL_LOW_INT 0x8DF3
+#define GL_MEDIUM_INT 0x8DF4
+#define GL_HIGH_INT 0x8DF5
+
+/* Framebuffer Object. */
+#define GL_FRAMEBUFFER 0x8D40
+#define GL_RENDERBUFFER 0x8D41
+
+#define GL_RGBA4 0x8056
+#define GL_RGB5_A1 0x8057
+#define GL_RGB565 0x8D62
+#define GL_DEPTH_COMPONENT16 0x81A5
+#define GL_STENCIL_INDEX8 0x8D48
+
+#define GL_RENDERBUFFER_WIDTH 0x8D42
+#define GL_RENDERBUFFER_HEIGHT 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
+#define GL_RENDERBUFFER_RED_SIZE 0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
+
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+
+#define GL_COLOR_ATTACHMENT0 0x8CE0
+#define GL_DEPTH_ATTACHMENT 0x8D00
+#define GL_STENCIL_ATTACHMENT 0x8D20
+
+#define GL_NONE 0
+
+#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
+#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
+
+#define GL_FRAMEBUFFER_BINDING 0x8CA6
+#define GL_RENDERBUFFER_BINDING 0x8CA7
+#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
+
+#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
+
+/* OpenGL ES 3.0 */
+
+#define GL_READ_BUFFER 0x0C02
+#define GL_UNPACK_ROW_LENGTH 0x0CF2
+#define GL_UNPACK_SKIP_ROWS 0x0CF3
+#define GL_UNPACK_SKIP_PIXELS 0x0CF4
+#define GL_PACK_ROW_LENGTH 0x0D02
+#define GL_PACK_SKIP_ROWS 0x0D03
+#define GL_PACK_SKIP_PIXELS 0x0D04
+#define GL_COLOR 0x1800
+#define GL_DEPTH 0x1801
+#define GL_STENCIL 0x1802
+#define GL_RED 0x1903
+#define GL_RGB8 0x8051
+#define GL_RGBA8 0x8058
+#define GL_RGB10_A2 0x8059
+#define GL_TEXTURE_BINDING_3D 0x806A
+#define GL_UNPACK_SKIP_IMAGES 0x806D
+#define GL_UNPACK_IMAGE_HEIGHT 0x806E
+#define GL_TEXTURE_3D 0x806F
+#define GL_TEXTURE_WRAP_R 0x8072
+#define GL_MAX_3D_TEXTURE_SIZE 0x8073
+#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
+#define GL_MAX_ELEMENTS_VERTICES 0x80E8
+#define GL_MAX_ELEMENTS_INDICES 0x80E9
+#define GL_TEXTURE_MIN_LOD 0x813A
+#define GL_TEXTURE_MAX_LOD 0x813B
+#define GL_TEXTURE_BASE_LEVEL 0x813C
+#define GL_TEXTURE_MAX_LEVEL 0x813D
+#define GL_MIN 0x8007
+#define GL_MAX 0x8008
+#define GL_DEPTH_COMPONENT24 0x81A6
+#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
+#define GL_TEXTURE_COMPARE_MODE 0x884C
+#define GL_TEXTURE_COMPARE_FUNC 0x884D
+#define GL_CURRENT_QUERY 0x8865
+#define GL_QUERY_RESULT 0x8866
+#define GL_QUERY_RESULT_AVAILABLE 0x8867
+#define GL_BUFFER_MAPPED 0x88BC
+#define GL_BUFFER_MAP_POINTER 0x88BD
+#define GL_STREAM_READ 0x88E1
+#define GL_STREAM_COPY 0x88E2
+#define GL_STATIC_READ 0x88E5
+#define GL_STATIC_COPY 0x88E6
+#define GL_DYNAMIC_READ 0x88E9
+#define GL_DYNAMIC_COPY 0x88EA
+#define GL_MAX_DRAW_BUFFERS 0x8824
+#define GL_DRAW_BUFFER0 0x8825
+#define GL_DRAW_BUFFER1 0x8826
+#define GL_DRAW_BUFFER2 0x8827
+#define GL_DRAW_BUFFER3 0x8828
+#define GL_DRAW_BUFFER4 0x8829
+#define GL_DRAW_BUFFER5 0x882A
+#define GL_DRAW_BUFFER6 0x882B
+#define GL_DRAW_BUFFER7 0x882C
+#define GL_DRAW_BUFFER8 0x882D
+#define GL_DRAW_BUFFER9 0x882E
+#define GL_DRAW_BUFFER10 0x882F
+#define GL_DRAW_BUFFER11 0x8830
+#define GL_DRAW_BUFFER12 0x8831
+#define GL_DRAW_BUFFER13 0x8832
+#define GL_DRAW_BUFFER14 0x8833
+#define GL_DRAW_BUFFER15 0x8834
+#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
+#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
+#define GL_SAMPLER_3D 0x8B5F
+#define GL_SAMPLER_2D_SHADOW 0x8B62
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
+#define GL_PIXEL_PACK_BUFFER 0x88EB
+#define GL_PIXEL_UNPACK_BUFFER 0x88EC
+#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
+#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF
+#define GL_FLOAT_MAT2x3 0x8B65
+#define GL_FLOAT_MAT2x4 0x8B66
+#define GL_FLOAT_MAT3x2 0x8B67
+#define GL_FLOAT_MAT3x4 0x8B68
+#define GL_FLOAT_MAT4x2 0x8B69
+#define GL_FLOAT_MAT4x3 0x8B6A
+#define GL_SRGB 0x8C40
+#define GL_SRGB8 0x8C41
+#define GL_SRGB8_ALPHA8 0x8C43
+#define GL_COMPARE_REF_TO_TEXTURE 0x884E
+#define GL_MAJOR_VERSION 0x821B
+#define GL_MINOR_VERSION 0x821C
+#define GL_NUM_EXTENSIONS 0x821D
+#define GL_RGBA32F 0x8814
+#define GL_RGB32F 0x8815
+#define GL_RGBA16F 0x881A
+#define GL_RGB16F 0x881B
+#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD
+#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
+#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904
+#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905
+#define GL_MAX_VARYING_COMPONENTS 0x8B4B
+#define GL_TEXTURE_2D_ARRAY 0x8C1A
+#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D
+#define GL_R11F_G11F_B10F 0x8C3A
+#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B
+#define GL_RGB9_E5 0x8C3D
+#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E
+#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
+#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
+#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83
+#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
+#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
+#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
+#define GL_RASTERIZER_DISCARD 0x8C89
+#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
+#define GL_INTERLEAVED_ATTRIBS 0x8C8C
+#define GL_SEPARATE_ATTRIBS 0x8C8D
+#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E
+#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
+#define GL_RGBA32UI 0x8D70
+#define GL_RGB32UI 0x8D71
+#define GL_RGBA16UI 0x8D76
+#define GL_RGB16UI 0x8D77
+#define GL_RGBA8UI 0x8D7C
+#define GL_RGB8UI 0x8D7D
+#define GL_RGBA32I 0x8D82
+#define GL_RGB32I 0x8D83
+#define GL_RGBA16I 0x8D88
+#define GL_RGB16I 0x8D89
+#define GL_RGBA8I 0x8D8E
+#define GL_RGB8I 0x8D8F
+#define GL_RED_INTEGER 0x8D94
+#define GL_RGB_INTEGER 0x8D98
+#define GL_RGBA_INTEGER 0x8D99
+#define GL_SAMPLER_2D_ARRAY 0x8DC1
+#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4
+#define GL_SAMPLER_CUBE_SHADOW 0x8DC5
+#define GL_UNSIGNED_INT_VEC2 0x8DC6
+#define GL_UNSIGNED_INT_VEC3 0x8DC7
+#define GL_UNSIGNED_INT_VEC4 0x8DC8
+#define GL_INT_SAMPLER_2D 0x8DCA
+#define GL_INT_SAMPLER_3D 0x8DCB
+#define GL_INT_SAMPLER_CUBE 0x8DCC
+#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF
+#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2
+#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3
+#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4
+#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7
+#define GL_BUFFER_ACCESS_FLAGS 0x911F
+#define GL_BUFFER_MAP_LENGTH 0x9120
+#define GL_BUFFER_MAP_OFFSET 0x9121
+#define GL_DEPTH_COMPONENT32F 0x8CAC
+#define GL_DEPTH32F_STENCIL8 0x8CAD
+#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
+#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
+#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
+#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
+#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
+#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
+#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
+#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
+#define GL_FRAMEBUFFER_DEFAULT 0x8218
+#define GL_FRAMEBUFFER_UNDEFINED 0x8219
+#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
+#define GL_DEPTH_STENCIL 0x84F9
+#define GL_UNSIGNED_INT_24_8 0x84FA
+#define GL_DEPTH24_STENCIL8 0x88F0
+#define GL_UNSIGNED_NORMALIZED 0x8C17
+#define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING
+#define GL_READ_FRAMEBUFFER 0x8CA8
+#define GL_DRAW_FRAMEBUFFER 0x8CA9
+#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA
+#define GL_RENDERBUFFER_SAMPLES 0x8CAB
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
+#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
+#define GL_COLOR_ATTACHMENT1 0x8CE1
+#define GL_COLOR_ATTACHMENT2 0x8CE2
+#define GL_COLOR_ATTACHMENT3 0x8CE3
+#define GL_COLOR_ATTACHMENT4 0x8CE4
+#define GL_COLOR_ATTACHMENT5 0x8CE5
+#define GL_COLOR_ATTACHMENT6 0x8CE6
+#define GL_COLOR_ATTACHMENT7 0x8CE7
+#define GL_COLOR_ATTACHMENT8 0x8CE8
+#define GL_COLOR_ATTACHMENT9 0x8CE9
+#define GL_COLOR_ATTACHMENT10 0x8CEA
+#define GL_COLOR_ATTACHMENT11 0x8CEB
+#define GL_COLOR_ATTACHMENT12 0x8CEC
+#define GL_COLOR_ATTACHMENT13 0x8CED
+#define GL_COLOR_ATTACHMENT14 0x8CEE
+#define GL_COLOR_ATTACHMENT15 0x8CEF
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
+#define GL_MAX_SAMPLES 0x8D57
+#define GL_HALF_FLOAT 0x140B
+#define GL_MAP_READ_BIT 0x0001
+#define GL_MAP_WRITE_BIT 0x0002
+#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004
+#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
+#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010
+#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
+#define GL_RG 0x8227
+#define GL_RG_INTEGER 0x8228
+#define GL_R8 0x8229
+#define GL_RG8 0x822B
+#define GL_R16F 0x822D
+#define GL_R32F 0x822E
+#define GL_RG16F 0x822F
+#define GL_RG32F 0x8230
+#define GL_R8I 0x8231
+#define GL_R8UI 0x8232
+#define GL_R16I 0x8233
+#define GL_R16UI 0x8234
+#define GL_R32I 0x8235
+#define GL_R32UI 0x8236
+#define GL_RG8I 0x8237
+#define GL_RG8UI 0x8238
+#define GL_RG16I 0x8239
+#define GL_RG16UI 0x823A
+#define GL_RG32I 0x823B
+#define GL_RG32UI 0x823C
+#define GL_VERTEX_ARRAY_BINDING 0x85B5
+#define GL_R8_SNORM 0x8F94
+#define GL_RG8_SNORM 0x8F95
+#define GL_RGB8_SNORM 0x8F96
+#define GL_RGBA8_SNORM 0x8F97
+#define GL_SIGNED_NORMALIZED 0x8F9C
+#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69
+#define GL_COPY_READ_BUFFER 0x8F36
+#define GL_COPY_WRITE_BUFFER 0x8F37
+#define GL_COPY_READ_BUFFER_BINDING GL_COPY_READ_BUFFER
+#define GL_COPY_WRITE_BUFFER_BINDING GL_COPY_WRITE_BUFFER
+#define GL_UNIFORM_BUFFER 0x8A11
+#define GL_UNIFORM_BUFFER_BINDING 0x8A28
+#define GL_UNIFORM_BUFFER_START 0x8A29
+#define GL_UNIFORM_BUFFER_SIZE 0x8A2A
+#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B
+#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D
+#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E
+#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F
+#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30
+#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
+#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
+#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
+#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
+#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
+#define GL_UNIFORM_TYPE 0x8A37
+#define GL_UNIFORM_SIZE 0x8A38
+#define GL_UNIFORM_NAME_LENGTH 0x8A39
+#define GL_UNIFORM_BLOCK_INDEX 0x8A3A
+#define GL_UNIFORM_OFFSET 0x8A3B
+#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
+#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
+#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E
+#define GL_UNIFORM_BLOCK_BINDING 0x8A3F
+#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
+#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
+#define GL_INVALID_INDEX 0xFFFFFFFFu
+#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
+#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125
+#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
+#define GL_OBJECT_TYPE 0x9112
+#define GL_SYNC_CONDITION 0x9113
+#define GL_SYNC_STATUS 0x9114
+#define GL_SYNC_FLAGS 0x9115
+#define GL_SYNC_FENCE 0x9116
+#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
+#define GL_UNSIGNALED 0x9118
+#define GL_SIGNALED 0x9119
+#define GL_ALREADY_SIGNALED 0x911A
+#define GL_TIMEOUT_EXPIRED 0x911B
+#define GL_CONDITION_SATISFIED 0x911C
+#define GL_WAIT_FAILED 0x911D
+#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
+#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE
+#define GL_ANY_SAMPLES_PASSED 0x8C2F
+#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
+#define GL_SAMPLER_BINDING 0x8919
+#define GL_RGB10_A2UI 0x906F
+#define GL_TEXTURE_SWIZZLE_R 0x8E42
+#define GL_TEXTURE_SWIZZLE_G 0x8E43
+#define GL_TEXTURE_SWIZZLE_B 0x8E44
+#define GL_TEXTURE_SWIZZLE_A 0x8E45
+#define GL_GREEN 0x1904
+#define GL_BLUE 0x1905
+#define GL_INT_2_10_10_10_REV 0x8D9F
+#define GL_TRANSFORM_FEEDBACK 0x8E22
+#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23
+#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24
+#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25
+#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
+#define GL_PROGRAM_BINARY_LENGTH 0x8741
+#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE
+#define GL_PROGRAM_BINARY_FORMATS 0x87FF
+#define GL_COMPRESSED_R11_EAC 0x9270
+#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271
+#define GL_COMPRESSED_RG11_EAC 0x9272
+#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273
+#define GL_COMPRESSED_RGB8_ETC2 0x9274
+#define GL_COMPRESSED_SRGB8_ETC2 0x9275
+#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
+#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
+#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
+#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
+#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F
+#define GL_MAX_ELEMENT_INDEX 0x8D6B
+#define GL_NUM_SAMPLE_COUNTS 0x9380
+#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
+
+/*-------------------------------------------------------------------------
+ * Entrypoint definitions
+ *-----------------------------------------------------------------------*/
+
+/* OpenGL ES 2.0 */
+
+GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
+GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name);
+GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
+GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
+GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
+GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode);
+GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
+GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
+GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
+GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
+GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
+GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
+GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat depth);
+GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
+GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
+GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
+GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers);
+GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);
+GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);
+GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures);
+GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
+GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
+GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f);
+GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
+GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
+GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
+GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
+GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glFinish (void);
+GL_APICALL void GL_APIENTRY glFlush (void);
+GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers);
+GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
+GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers);
+GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers);
+GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
+GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
+GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
+GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
+GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
+GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
+GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL GLenum GL_APIENTRY glGetError (void);
+GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
+GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
+GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
+GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
+GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name);
+GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
+GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
+GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);
+GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
+GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
+GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
+GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
+GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
+GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
+GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
+GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
+GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
+GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
+GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length);
+GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
+GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);
+GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params);
+GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x);
+GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x);
+GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y);
+GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z);
+GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);
+GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x);
+GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
+GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+
+/* OpenGL ES 3.0 */
+
+GL_APICALL void GL_APIENTRY glReadBuffer (GLenum mode);
+GL_APICALL void GL_APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices);
+GL_APICALL void GL_APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glGenQueries (GLsizei n, GLuint* ids);
+GL_APICALL void GL_APIENTRY glDeleteQueries (GLsizei n, const GLuint* ids);
+GL_APICALL GLboolean GL_APIENTRY glIsQuery (GLuint id);
+GL_APICALL void GL_APIENTRY glBeginQuery (GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glEndQuery (GLenum target);
+GL_APICALL void GL_APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint* params);
+GL_APICALL GLboolean GL_APIENTRY glUnmapBuffer (GLenum target);
+GL_APICALL void GL_APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, GLvoid** params);
+GL_APICALL void GL_APIENTRY glDrawBuffers (GLsizei n, const GLenum* bufs);
+GL_APICALL void GL_APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+GL_APICALL GLvoid* GL_APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GL_APICALL void GL_APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length);
+GL_APICALL void GL_APIENTRY glBindVertexArray (GLuint array);
+GL_APICALL void GL_APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint* arrays);
+GL_APICALL void GL_APIENTRY glGenVertexArrays (GLsizei n, GLuint* arrays);
+GL_APICALL GLboolean GL_APIENTRY glIsVertexArray (GLuint array);
+GL_APICALL void GL_APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint* data);
+GL_APICALL void GL_APIENTRY glBeginTransformFeedback (GLenum primitiveMode);
+GL_APICALL void GL_APIENTRY glEndTransformFeedback (void);
+GL_APICALL void GL_APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+GL_APICALL void GL_APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer);
+GL_APICALL void GL_APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode);
+GL_APICALL void GL_APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name);
+GL_APICALL void GL_APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint* params);
+GL_APICALL void GL_APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w);
+GL_APICALL void GL_APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+GL_APICALL void GL_APIENTRY glVertexAttribI4iv (GLuint index, const GLint* v);
+GL_APICALL void GL_APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint* v);
+GL_APICALL void GL_APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint* params);
+GL_APICALL GLint GL_APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glUniform1ui (GLint location, GLuint v0);
+GL_APICALL void GL_APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1);
+GL_APICALL void GL_APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2);
+GL_APICALL void GL_APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GL_APICALL void GL_APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void GL_APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void GL_APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void GL_APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void GL_APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint* value);
+GL_APICALL void GL_APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint* value);
+GL_APICALL void GL_APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+GL_APICALL const GLubyte* GL_APIENTRY glGetStringi (GLenum name, GLuint index);
+GL_APICALL void GL_APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+GL_APICALL void GL_APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices);
+GL_APICALL void GL_APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params);
+GL_APICALL GLuint GL_APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar* uniformBlockName);
+GL_APICALL void GL_APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName);
+GL_APICALL void GL_APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+GL_APICALL void GL_APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount);
+GL_APICALL GLsync GL_APIENTRY glFenceSync (GLenum condition, GLbitfield flags);
+GL_APICALL GLboolean GL_APIENTRY glIsSync (GLsync sync);
+GL_APICALL void GL_APIENTRY glDeleteSync (GLsync sync);
+GL_APICALL GLenum GL_APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glGetInteger64v (GLenum pname, GLint64* params);
+GL_APICALL void GL_APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values);
+GL_APICALL void GL_APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64* data);
+GL_APICALL void GL_APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64* params);
+GL_APICALL void GL_APIENTRY glGenSamplers (GLsizei count, GLuint* samplers);
+GL_APICALL void GL_APIENTRY glDeleteSamplers (GLsizei count, const GLuint* samplers);
+GL_APICALL GLboolean GL_APIENTRY glIsSampler (GLuint sampler);
+GL_APICALL void GL_APIENTRY glBindSampler (GLuint unit, GLuint sampler);
+GL_APICALL void GL_APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint* param);
+GL_APICALL void GL_APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param);
+GL_APICALL void GL_APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat* param);
+GL_APICALL void GL_APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor);
+GL_APICALL void GL_APIENTRY glBindTransformFeedback (GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint* ids);
+GL_APICALL void GL_APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint* ids);
+GL_APICALL GLboolean GL_APIENTRY glIsTransformFeedback (GLuint id);
+GL_APICALL void GL_APIENTRY glPauseTransformFeedback (void);
+GL_APICALL void GL_APIENTRY glResumeTransformFeedback (void);
+GL_APICALL void GL_APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary);
+GL_APICALL void GL_APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum* attachments);
+GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GL_APICALL void GL_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/ndk/platforms/android-18/include/GLES3/gl3ext.h b/ndk/platforms/android-18/include/GLES3/gl3ext.h
new file mode 100644
index 000000000..4d4ea96c4
--- /dev/null
+++ b/ndk/platforms/android-18/include/GLES3/gl3ext.h
@@ -0,0 +1,24 @@
+#ifndef __gl3ext_h_
+#define __gl3ext_h_
+
+/* $Revision: 17809 $ on $Date:: 2012-05-14 08:03:36 -0700 #$ */
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+/* OpenGL ES 3 Extensions
+ *
+ * After an OES extension's interactions with OpenGl ES 3.0 have been documented,
+ * its tokens and function definitions should be added to this file in a manner
+ * that does not conflict with gl2ext.h or gl3.h.
+ *
+ * Tokens and function definitions for extensions that have become standard
+ * features in OpenGL ES 3.0 will not be added to this file.
+ *
+ * Applications using OpenGL-ES-2-only extensions should include gl2ext.h
+ */
+
+#endif /* __gl3ext_h_ */
+
diff --git a/ndk/platforms/android-18/include/GLES3/gl3platform.h b/ndk/platforms/android-18/include/GLES3/gl3platform.h
new file mode 100644
index 000000000..1bd1a850f
--- /dev/null
+++ b/ndk/platforms/android-18/include/GLES3/gl3platform.h
@@ -0,0 +1,30 @@
+#ifndef __gl3platform_h_
+#define __gl3platform_h_
+
+/* $Revision: 18437 $ on $Date:: 2012-07-08 23:31:39 -0700 #$ */
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+/* Platform-specific types and definitions for OpenGL ES 3.X gl3.h
+ *
+ * Adopters may modify khrplatform.h and this file to suit their platform.
+ * You are encouraged to submit all modifications to the Khronos group so that
+ * they can be included in future versions of this file. Please submit changes
+ * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
+ * by filing a bug against product "OpenGL-ES" component "Registry".
+ */
+
+#include <KHR/khrplatform.h>
+
+#ifndef GL_APICALL
+#define GL_APICALL KHRONOS_APICALL
+#endif
+
+#ifndef GL_APIENTRY
+#define GL_APIENTRY KHRONOS_APIENTRY
+#endif
+
+#endif /* __gl3platform_h_ */
diff --git a/samples/BrowserPlugin/AndroidManifest.xml b/ndk/platforms/android-18/samples/gles3jni/AndroidManifest-11.xml
index d92672929..9213c5820 100644
--- a/samples/BrowserPlugin/AndroidManifest.xml
+++ b/ndk/platforms/android-18/samples/gles3jni/AndroidManifest-11.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
+<!-- Copyright 2013 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.
@@ -15,22 +15,19 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.sampleplugin"
- android:versionCode="1"
- android:versionName="1.0">
-
- <uses-permission android:name="android.webkit.permission.PLUGIN"/>
-
- <uses-sdk android:minSdkVersion="3" />
-
- <application android:icon="@drawable/sample_browser_plugin"
- android:label="@string/sample_browser_plugin">
- <service android:name=".SamplePlugin">
+ package="com.android.gles3jni">
+ <application
+ android:label="@string/gles3jni_activity">
+ <activity android:name="GLES3JNIActivity"
+ android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
+ android:launchMode="singleTask"
+ android:configChanges="orientation|keyboardHidden">
<intent-filter>
- <action android:name="android.webkit.PLUGIN" />
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
- <meta-data android:name="type" android:value="native" />
- </service>
+ </activity>
</application>
-
+ <uses-feature android:glEsVersion="0x00020000"/>
+ <uses-sdk android:minSdkVersion="11"/>
</manifest>
diff --git a/ndk/platforms/android-18/samples/gles3jni/AndroidManifest-18.xml b/ndk/platforms/android-18/samples/gles3jni/AndroidManifest-18.xml
new file mode 100644
index 000000000..7eea32fcc
--- /dev/null
+++ b/ndk/platforms/android-18/samples/gles3jni/AndroidManifest-18.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2013 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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.gles3jni">
+ <application
+ android:label="@string/gles3jni_activity">
+ <activity android:name="GLES3JNIActivity"
+ android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
+ android:launchMode="singleTask"
+ android:configChanges="orientation|keyboardHidden">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+ <uses-feature android:glEsVersion="0x00030000"/>
+ <uses-sdk android:minSdkVersion="18"/>
+</manifest>
diff --git a/ndk/platforms/android-18/samples/gles3jni/README b/ndk/platforms/android-18/samples/gles3jni/README
new file mode 100644
index 000000000..2250e218f
--- /dev/null
+++ b/ndk/platforms/android-18/samples/gles3jni/README
@@ -0,0 +1,33 @@
+This sample demonstrates how to use OpenGL ES 3.0 from JNI/native code.
+
+The sample can be built two different ways:
+ * Compatible with API level 11 and later [*1]
+ * Require API level 18 or later.
+Both versions include an OpenGL ES 2.0 fallback path for devices that don't
+support OpenGL ES 3.0.
+
+To build and install the sample:
+$ ln -s AndroidManifest-$N.xml AndroidManifest.xml
+$ ln -s Android-$N.mk jni/Android.mk
+$ $ANDROID_SDK/tools/android update project --path . --target android-$N
+$ ../../ndk-build
+$ ant debug
+$ adb install bin/GLES3JNIActivity-debug.apk
+where $N is '11' or '18' and
+ANDROID_SDK is the root of your SDK installation.
+
+The OpenGL ES 3.0 rendering path uses a few new features compared to the
+OpenGL ES 2.0 path:
+
+* Instanced rendering and vertex attribute divisor to reduce the number of
+ draw calls and uniform changes.
+* Vertex array objects to reduce the number of calls required to set up
+ vertex attribute state on each frame.
+* Explicit assignment of attribute locations, eliminating the need to query
+ assignments.
+
+
+[*1] The only dependency on API level 11 is the call to
+ setEGLContextClientVersion in GLES3JNIView. With a custom
+ EGLConfigChooser and EGLContextFactory the sample would be compatible
+ with older API levels.
diff --git a/tools/emulator/system/sensors/Android.mk b/ndk/platforms/android-18/samples/gles3jni/jni/Android-11.mk
index a1b8967e4..baf17d209 100644
--- a/tools/emulator/system/sensors/Android.mk
+++ b/ndk/platforms/android-18/samples/gles3jni/jni/Android-11.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 The Android Open Source Project
+# Copyright 2013 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.
@@ -12,19 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+LOCAL_PATH:= $(call my-dir)
-LOCAL_PATH := $(call my-dir)
-
-# HAL module implemenation stored in
-# hw/<SENSORS_HARDWARE_MODULE_ID>.<ro.hardware>.so
include $(CLEAR_VARS)
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_SRC_FILES := sensors_qemu.c
-ifeq ($(TARGET_PRODUCT),vbox_x86)
-LOCAL_MODULE := sensors.vbox_x86
-else
-LOCAL_MODULE := sensors.goldfish
-endif
+LOCAL_MODULE := libgles3jni
+LOCAL_CFLAGS := -Werror -DDYNAMIC_ES3
+LOCAL_SRC_FILES := gles3jni.cpp \
+ RendererES2.cpp \
+ RendererES3.cpp \
+ gl3stub.c
+LOCAL_LDLIBS := -llog -lGLESv2 -lEGL
+
include $(BUILD_SHARED_LIBRARY)
diff --git a/tools/emulator/system/qemu-props/Android.mk b/ndk/platforms/android-18/samples/gles3jni/jni/Android-18.mk
index 885e5b777..5111de54f 100644
--- a/tools/emulator/system/qemu-props/Android.mk
+++ b/ndk/platforms/android-18/samples/gles3jni/jni/Android-18.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 The Android Open Source Project
+# Copyright 2013 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.
@@ -12,17 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# this file is used to build emulator-specific program tools
-# that should only run in the emulator.
-#
-
-LOCAL_PATH := $(call my-dir)
+LOCAL_PATH:= $(call my-dir)
-# The 'qemu-props' program is run from /system/etc/init.goldfish.rc
-# to setup various system properties sent by the emulator program.
-#
include $(CLEAR_VARS)
-LOCAL_MODULE := qemu-props
-LOCAL_SRC_FILES := qemu-props.c
-LOCAL_SHARED_LIBRARIES := libcutils
-include $(BUILD_EXECUTABLE)
+
+LOCAL_MODULE := libgles3jni
+LOCAL_CFLAGS := -Werror
+LOCAL_SRC_FILES := gles3jni.cpp \
+ RendererES2.cpp \
+ RendererES3.cpp
+LOCAL_LDLIBS := -llog -lGLESv3 -lEGL
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/ndk/platforms/android-18/samples/gles3jni/jni/RendererES2.cpp b/ndk/platforms/android-18/samples/gles3jni/jni/RendererES2.cpp
new file mode 100644
index 000000000..d5f8d4881
--- /dev/null
+++ b/ndk/platforms/android-18/samples/gles3jni/jni/RendererES2.cpp
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2013 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.
+ */
+
+#include "gles3jni.h"
+#include <EGL/egl.h>
+
+static const char VERTEX_SHADER[] =
+ "#version 100\n"
+ "uniform mat2 scaleRot;\n"
+ "uniform vec2 offset;\n"
+ "attribute vec2 pos;\n"
+ "attribute vec4 color;\n"
+ "varying vec4 vColor;\n"
+ "void main() {\n"
+ " gl_Position = vec4(scaleRot*pos + offset, 0.0, 1.0);\n"
+ " vColor = color;\n"
+ "}\n";
+
+static const char FRAGMENT_SHADER[] =
+ "#version 100\n"
+ "precision mediump float;\n"
+ "varying vec4 vColor;\n"
+ "void main() {\n"
+ " gl_FragColor = vColor;\n"
+ "}\n";
+
+class RendererES2: public Renderer {
+public:
+ RendererES2();
+ virtual ~RendererES2();
+ bool init();
+
+private:
+ virtual float* mapOffsetBuf();
+ virtual void unmapOffsetBuf();
+ virtual float* mapTransformBuf();
+ virtual void unmapTransformBuf();
+ virtual void draw(unsigned int numInstances);
+
+ const EGLContext mEglContext;
+ GLuint mProgram;
+ GLuint mVB;
+ GLint mPosAttrib;
+ GLint mColorAttrib;
+ GLint mScaleRotUniform;
+ GLint mOffsetUniform;
+
+ float mOffsets[2*MAX_INSTANCES];
+ float mScaleRot[4*MAX_INSTANCES]; // array of 2x2 column-major matrices
+};
+
+Renderer* createES2Renderer() {
+ RendererES2* renderer = new RendererES2;
+ if (!renderer->init()) {
+ delete renderer;
+ return NULL;
+ }
+ return renderer;
+}
+
+RendererES2::RendererES2()
+: mEglContext(eglGetCurrentContext()),
+ mProgram(0),
+ mVB(0),
+ mPosAttrib(-1),
+ mColorAttrib(-1),
+ mScaleRotUniform(-1),
+ mOffsetUniform(-1)
+{}
+
+bool RendererES2::init() {
+ mProgram = createProgram(VERTEX_SHADER, FRAGMENT_SHADER);
+ if (!mProgram)
+ return false;
+ mPosAttrib = glGetAttribLocation(mProgram, "pos");
+ mColorAttrib = glGetAttribLocation(mProgram, "color");
+ mScaleRotUniform = glGetUniformLocation(mProgram, "scaleRot");
+ mOffsetUniform = glGetUniformLocation(mProgram, "offset");
+
+ glGenBuffers(1, &mVB);
+ glBindBuffer(GL_ARRAY_BUFFER, mVB);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(QUAD), &QUAD[0], GL_STATIC_DRAW);
+
+ ALOGV("Using OpenGL ES 2.0 renderer");
+ return true;
+}
+
+RendererES2::~RendererES2() {
+ /* The destructor may be called after the context has already been
+ * destroyed, in which case our objects have already been destroyed.
+ *
+ * If the context exists, it must be current. This only happens when we're
+ * cleaning up after a failed init().
+ */
+ if (eglGetCurrentContext() != mEglContext)
+ return;
+ glDeleteBuffers(1, &mVB);
+ glDeleteProgram(mProgram);
+}
+
+float* RendererES2::mapOffsetBuf() {
+ return mOffsets;
+}
+
+void RendererES2::unmapOffsetBuf() {
+}
+
+float* RendererES2::mapTransformBuf() {
+ return mScaleRot;
+}
+
+void RendererES2::unmapTransformBuf() {
+}
+
+void RendererES2::draw(unsigned int numInstances) {
+ glUseProgram(mProgram);
+
+ glBindBuffer(GL_ARRAY_BUFFER, mVB);
+ glVertexAttribPointer(mPosAttrib, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)offsetof(Vertex, pos));
+ glVertexAttribPointer(mColorAttrib, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), (const GLvoid*)offsetof(Vertex, rgba));
+ glEnableVertexAttribArray(mPosAttrib);
+ glEnableVertexAttribArray(mColorAttrib);
+
+ for (unsigned int i = 0; i < numInstances; i++) {
+ glUniformMatrix2fv(mScaleRotUniform, 1, GL_FALSE, mScaleRot + 4*i);
+ glUniform2fv(mOffsetUniform, 1, mOffsets + 2*i);
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ }
+}
diff --git a/ndk/platforms/android-18/samples/gles3jni/jni/RendererES3.cpp b/ndk/platforms/android-18/samples/gles3jni/jni/RendererES3.cpp
new file mode 100644
index 000000000..a6e617b2b
--- /dev/null
+++ b/ndk/platforms/android-18/samples/gles3jni/jni/RendererES3.cpp
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2013 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.
+ */
+
+#include "gles3jni.h"
+#include <EGL/egl.h>
+
+#define STR(s) #s
+#define STRV(s) STR(s)
+
+#define POS_ATTRIB 0
+#define COLOR_ATTRIB 1
+#define SCALEROT_ATTRIB 2
+#define OFFSET_ATTRIB 3
+
+static const char VERTEX_SHADER[] =
+ "#version 300 es\n"
+ "layout(location = " STRV(POS_ATTRIB) ") in vec2 pos;\n"
+ "layout(location=" STRV(COLOR_ATTRIB) ") in vec4 color;\n"
+ "layout(location=" STRV(SCALEROT_ATTRIB) ") in vec4 scaleRot;\n"
+ "layout(location=" STRV(OFFSET_ATTRIB) ") in vec2 offset;\n"
+ "out vec4 vColor;\n"
+ "void main() {\n"
+ " mat2 sr = mat2(scaleRot.xy, scaleRot.zw);\n"
+ " gl_Position = vec4(sr*pos + offset, 0.0, 1.0);\n"
+ " vColor = color;\n"
+ "}\n";
+
+static const char FRAGMENT_SHADER[] =
+ "#version 300 es\n"
+ "precision mediump float;\n"
+ "in vec4 vColor;\n"
+ "out vec4 outColor;\n"
+ "void main() {\n"
+ " outColor = vColor;\n"
+ "}\n";
+
+class RendererES3: public Renderer {
+public:
+ RendererES3();
+ virtual ~RendererES3();
+ bool init();
+
+private:
+ enum {VB_INSTANCE, VB_SCALEROT, VB_OFFSET, VB_COUNT};
+
+ virtual float* mapOffsetBuf();
+ virtual void unmapOffsetBuf();
+ virtual float* mapTransformBuf();
+ virtual void unmapTransformBuf();
+ virtual void draw(unsigned int numInstances);
+
+ const EGLContext mEglContext;
+ GLuint mProgram;
+ GLuint mVB[VB_COUNT];
+ GLuint mVBState;
+};
+
+Renderer* createES3Renderer() {
+ RendererES3* renderer = new RendererES3;
+ if (!renderer->init()) {
+ delete renderer;
+ return NULL;
+ }
+ return renderer;
+}
+
+RendererES3::RendererES3()
+: mEglContext(eglGetCurrentContext()),
+ mProgram(0),
+ mVBState(0)
+{
+ for (int i = 0; i < VB_COUNT; i++)
+ mVB[i] = 0;
+}
+
+bool RendererES3::init() {
+ mProgram = createProgram(VERTEX_SHADER, FRAGMENT_SHADER);
+ if (!mProgram)
+ return false;
+
+ glGenBuffers(VB_COUNT, mVB);
+ glBindBuffer(GL_ARRAY_BUFFER, mVB[VB_INSTANCE]);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(QUAD), &QUAD[0], GL_STATIC_DRAW);
+ glBindBuffer(GL_ARRAY_BUFFER, mVB[VB_SCALEROT]);
+ glBufferData(GL_ARRAY_BUFFER, MAX_INSTANCES * 4*sizeof(float), NULL, GL_DYNAMIC_DRAW);
+ glBindBuffer(GL_ARRAY_BUFFER, mVB[VB_OFFSET]);
+ glBufferData(GL_ARRAY_BUFFER, MAX_INSTANCES * 2*sizeof(float), NULL, GL_STATIC_DRAW);
+
+ glGenVertexArrays(1, &mVBState);
+ glBindVertexArray(mVBState);
+
+ glBindBuffer(GL_ARRAY_BUFFER, mVB[VB_INSTANCE]);
+ glVertexAttribPointer(POS_ATTRIB, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)offsetof(Vertex, pos));
+ glVertexAttribPointer(COLOR_ATTRIB, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), (const GLvoid*)offsetof(Vertex, rgba));
+ glEnableVertexAttribArray(POS_ATTRIB);
+ glEnableVertexAttribArray(COLOR_ATTRIB);
+
+ glBindBuffer(GL_ARRAY_BUFFER, mVB[VB_SCALEROT]);
+ glVertexAttribPointer(SCALEROT_ATTRIB, 4, GL_FLOAT, GL_FALSE, 4*sizeof(float), 0);
+ glEnableVertexAttribArray(SCALEROT_ATTRIB);
+ glVertexAttribDivisor(SCALEROT_ATTRIB, 1);
+
+ glBindBuffer(GL_ARRAY_BUFFER, mVB[VB_OFFSET]);
+ glVertexAttribPointer(OFFSET_ATTRIB, 2, GL_FLOAT, GL_FALSE, 2*sizeof(float), 0);
+ glEnableVertexAttribArray(OFFSET_ATTRIB);
+ glVertexAttribDivisor(OFFSET_ATTRIB, 1);
+
+ ALOGV("Using OpenGL ES 3.0 renderer");
+ return true;
+}
+
+RendererES3::~RendererES3() {
+ /* The destructor may be called after the context has already been
+ * destroyed, in which case our objects have already been destroyed.
+ *
+ * If the context exists, it must be current. This only happens when we're
+ * cleaning up after a failed init().
+ */
+ if (eglGetCurrentContext() != mEglContext)
+ return;
+ glDeleteVertexArrays(1, &mVBState);
+ glDeleteBuffers(VB_COUNT, mVB);
+ glDeleteProgram(mProgram);
+}
+
+float* RendererES3::mapOffsetBuf() {
+ glBindBuffer(GL_ARRAY_BUFFER, mVB[VB_OFFSET]);
+ return (float*)glMapBufferRange(GL_ARRAY_BUFFER,
+ 0, MAX_INSTANCES * 2*sizeof(float),
+ GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
+}
+
+void RendererES3::unmapOffsetBuf() {
+ glUnmapBuffer(GL_ARRAY_BUFFER);
+}
+
+float* RendererES3::mapTransformBuf() {
+ glBindBuffer(GL_ARRAY_BUFFER, mVB[VB_SCALEROT]);
+ return (float*)glMapBufferRange(GL_ARRAY_BUFFER,
+ 0, MAX_INSTANCES * 4*sizeof(float),
+ GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
+}
+
+void RendererES3::unmapTransformBuf() {
+ glUnmapBuffer(GL_ARRAY_BUFFER);
+}
+
+void RendererES3::draw(unsigned int numInstances) {
+ glUseProgram(mProgram);
+ glBindVertexArray(mVBState);
+ glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, numInstances);
+}
diff --git a/ndk/platforms/android-18/samples/gles3jni/jni/gl3stub.c b/ndk/platforms/android-18/samples/gles3jni/jni/gl3stub.c
new file mode 100644
index 000000000..19b78e7b6
--- /dev/null
+++ b/ndk/platforms/android-18/samples/gles3jni/jni/gl3stub.c
@@ -0,0 +1,342 @@
+/*
+ * Copyright 2013 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.
+ */
+
+#include "gl3stub.h"
+
+GLboolean gl3stubInit() {
+ #define FIND_PROC(s) s = (void*)eglGetProcAddress(#s)
+ FIND_PROC(glReadBuffer);
+ FIND_PROC(glDrawRangeElements);
+ FIND_PROC(glTexImage3D);
+ FIND_PROC(glTexSubImage3D);
+ FIND_PROC(glCopyTexSubImage3D);
+ FIND_PROC(glCompressedTexImage3D);
+ FIND_PROC(glCompressedTexSubImage3D);
+ FIND_PROC(glGenQueries);
+ FIND_PROC(glDeleteQueries);
+ FIND_PROC(glIsQuery);
+ FIND_PROC(glBeginQuery);
+ FIND_PROC(glEndQuery);
+ FIND_PROC(glGetQueryiv);
+ FIND_PROC(glGetQueryObjectuiv);
+ FIND_PROC(glUnmapBuffer);
+ FIND_PROC(glGetBufferPointerv);
+ FIND_PROC(glDrawBuffers);
+ FIND_PROC(glUniformMatrix2x3fv);
+ FIND_PROC(glUniformMatrix3x2fv);
+ FIND_PROC(glUniformMatrix2x4fv);
+ FIND_PROC(glUniformMatrix4x2fv);
+ FIND_PROC(glUniformMatrix3x4fv);
+ FIND_PROC(glUniformMatrix4x3fv);
+ FIND_PROC(glBlitFramebuffer);
+ FIND_PROC(glRenderbufferStorageMultisample);
+ FIND_PROC(glFramebufferTextureLayer);
+ FIND_PROC(glMapBufferRange);
+ FIND_PROC(glFlushMappedBufferRange);
+ FIND_PROC(glBindVertexArray);
+ FIND_PROC(glDeleteVertexArrays);
+ FIND_PROC(glGenVertexArrays);
+ FIND_PROC(glIsVertexArray);
+ FIND_PROC(glGetIntegeri_v);
+ FIND_PROC(glBeginTransformFeedback);
+ FIND_PROC(glEndTransformFeedback);
+ FIND_PROC(glBindBufferRange);
+ FIND_PROC(glBindBufferBase);
+ FIND_PROC(glTransformFeedbackVaryings);
+ FIND_PROC(glGetTransformFeedbackVarying);
+ FIND_PROC(glVertexAttribIPointer);
+ FIND_PROC(glGetVertexAttribIiv);
+ FIND_PROC(glGetVertexAttribIuiv);
+ FIND_PROC(glVertexAttribI4i);
+ FIND_PROC(glVertexAttribI4ui);
+ FIND_PROC(glVertexAttribI4iv);
+ FIND_PROC(glVertexAttribI4uiv);
+ FIND_PROC(glGetUniformuiv);
+ FIND_PROC(glGetFragDataLocation);
+ FIND_PROC(glUniform1ui);
+ FIND_PROC(glUniform2ui);
+ FIND_PROC(glUniform3ui);
+ FIND_PROC(glUniform4ui);
+ FIND_PROC(glUniform1uiv);
+ FIND_PROC(glUniform2uiv);
+ FIND_PROC(glUniform3uiv);
+ FIND_PROC(glUniform4uiv);
+ FIND_PROC(glClearBufferiv);
+ FIND_PROC(glClearBufferuiv);
+ FIND_PROC(glClearBufferfv);
+ FIND_PROC(glClearBufferfi);
+ FIND_PROC(glGetStringi);
+ FIND_PROC(glCopyBufferSubData);
+ FIND_PROC(glGetUniformIndices);
+ FIND_PROC(glGetActiveUniformsiv);
+ FIND_PROC(glGetUniformBlockIndex);
+ FIND_PROC(glGetActiveUniformBlockiv);
+ FIND_PROC(glGetActiveUniformBlockName);
+ FIND_PROC(glUniformBlockBinding);
+ FIND_PROC(glDrawArraysInstanced);
+ FIND_PROC(glDrawElementsInstanced);
+ FIND_PROC(glFenceSync);
+ FIND_PROC(glIsSync);
+ FIND_PROC(glDeleteSync);
+ FIND_PROC(glClientWaitSync);
+ FIND_PROC(glWaitSync);
+ FIND_PROC(glGetInteger64v);
+ FIND_PROC(glGetSynciv);
+ FIND_PROC(glGetInteger64i_v);
+ FIND_PROC(glGetBufferParameteri64v);
+ FIND_PROC(glGenSamplers);
+ FIND_PROC(glDeleteSamplers);
+ FIND_PROC(glIsSampler);
+ FIND_PROC(glBindSampler);
+ FIND_PROC(glSamplerParameteri);
+ FIND_PROC(glSamplerParameteriv);
+ FIND_PROC(glSamplerParameterf);
+ FIND_PROC(glSamplerParameterfv);
+ FIND_PROC(glGetSamplerParameteriv);
+ FIND_PROC(glGetSamplerParameterfv);
+ FIND_PROC(glVertexAttribDivisor);
+ FIND_PROC(glBindTransformFeedback);
+ FIND_PROC(glDeleteTransformFeedbacks);
+ FIND_PROC(glGenTransformFeedbacks);
+ FIND_PROC(glIsTransformFeedback);
+ FIND_PROC(glPauseTransformFeedback);
+ FIND_PROC(glResumeTransformFeedback);
+ FIND_PROC(glGetProgramBinary);
+ FIND_PROC(glProgramBinary);
+ FIND_PROC(glProgramParameteri);
+ FIND_PROC(glInvalidateFramebuffer);
+ FIND_PROC(glInvalidateSubFramebuffer);
+ FIND_PROC(glTexStorage2D);
+ FIND_PROC(glTexStorage3D);
+ FIND_PROC(glGetInternalformativ);
+ #undef FIND_PROC
+
+ if (!glReadBuffer ||
+ !glDrawRangeElements ||
+ !glTexImage3D ||
+ !glTexSubImage3D ||
+ !glCopyTexSubImage3D ||
+ !glCompressedTexImage3D ||
+ !glCompressedTexSubImage3D ||
+ !glGenQueries ||
+ !glDeleteQueries ||
+ !glIsQuery ||
+ !glBeginQuery ||
+ !glEndQuery ||
+ !glGetQueryiv ||
+ !glGetQueryObjectuiv ||
+ !glUnmapBuffer ||
+ !glGetBufferPointerv ||
+ !glDrawBuffers ||
+ !glUniformMatrix2x3fv ||
+ !glUniformMatrix3x2fv ||
+ !glUniformMatrix2x4fv ||
+ !glUniformMatrix4x2fv ||
+ !glUniformMatrix3x4fv ||
+ !glUniformMatrix4x3fv ||
+ !glBlitFramebuffer ||
+ !glRenderbufferStorageMultisample ||
+ !glFramebufferTextureLayer ||
+ !glMapBufferRange ||
+ !glFlushMappedBufferRange ||
+ !glBindVertexArray ||
+ !glDeleteVertexArrays ||
+ !glGenVertexArrays ||
+ !glIsVertexArray ||
+ !glGetIntegeri_v ||
+ !glBeginTransformFeedback ||
+ !glEndTransformFeedback ||
+ !glBindBufferRange ||
+ !glBindBufferBase ||
+ !glTransformFeedbackVaryings ||
+ !glGetTransformFeedbackVarying ||
+ !glVertexAttribIPointer ||
+ !glGetVertexAttribIiv ||
+ !glGetVertexAttribIuiv ||
+ !glVertexAttribI4i ||
+ !glVertexAttribI4ui ||
+ !glVertexAttribI4iv ||
+ !glVertexAttribI4uiv ||
+ !glGetUniformuiv ||
+ !glGetFragDataLocation ||
+ !glUniform1ui ||
+ !glUniform2ui ||
+ !glUniform3ui ||
+ !glUniform4ui ||
+ !glUniform1uiv ||
+ !glUniform2uiv ||
+ !glUniform3uiv ||
+ !glUniform4uiv ||
+ !glClearBufferiv ||
+ !glClearBufferuiv ||
+ !glClearBufferfv ||
+ !glClearBufferfi ||
+ !glGetStringi ||
+ !glCopyBufferSubData ||
+ !glGetUniformIndices ||
+ !glGetActiveUniformsiv ||
+ !glGetUniformBlockIndex ||
+ !glGetActiveUniformBlockiv ||
+ !glGetActiveUniformBlockName ||
+ !glUniformBlockBinding ||
+ !glDrawArraysInstanced ||
+ !glDrawElementsInstanced ||
+ !glFenceSync ||
+ !glIsSync ||
+ !glDeleteSync ||
+ !glClientWaitSync ||
+ !glWaitSync ||
+ !glGetInteger64v ||
+ !glGetSynciv ||
+ !glGetInteger64i_v ||
+ !glGetBufferParameteri64v ||
+ !glGenSamplers ||
+ !glDeleteSamplers ||
+ !glIsSampler ||
+ !glBindSampler ||
+ !glSamplerParameteri ||
+ !glSamplerParameteriv ||
+ !glSamplerParameterf ||
+ !glSamplerParameterfv ||
+ !glGetSamplerParameteriv ||
+ !glGetSamplerParameterfv ||
+ !glVertexAttribDivisor ||
+ !glBindTransformFeedback ||
+ !glDeleteTransformFeedbacks ||
+ !glGenTransformFeedbacks ||
+ !glIsTransformFeedback ||
+ !glPauseTransformFeedback ||
+ !glResumeTransformFeedback ||
+ !glGetProgramBinary ||
+ !glProgramBinary ||
+ !glProgramParameteri ||
+ !glInvalidateFramebuffer ||
+ !glInvalidateSubFramebuffer ||
+ !glTexStorage2D ||
+ !glTexStorage3D ||
+ !glGetInternalformativ)
+ {
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
+}
+
+/* Function pointer definitions */
+GL_APICALL void (* GL_APIENTRY glReadBuffer) (GLenum mode);
+GL_APICALL void (* GL_APIENTRY glDrawRangeElements) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices);
+GL_APICALL void (* GL_APIENTRY glTexImage3D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void (* GL_APIENTRY glTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void (* GL_APIENTRY glCopyTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void (* GL_APIENTRY glCompressedTexImage3D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void (* GL_APIENTRY glCompressedTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void (* GL_APIENTRY glGenQueries) (GLsizei n, GLuint* ids);
+GL_APICALL void (* GL_APIENTRY glDeleteQueries) (GLsizei n, const GLuint* ids);
+GL_APICALL GLboolean (* GL_APIENTRY glIsQuery) (GLuint id);
+GL_APICALL void (* GL_APIENTRY glBeginQuery) (GLenum target, GLuint id);
+GL_APICALL void (* GL_APIENTRY glEndQuery) (GLenum target);
+GL_APICALL void (* GL_APIENTRY glGetQueryiv) (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void (* GL_APIENTRY glGetQueryObjectuiv) (GLuint id, GLenum pname, GLuint* params);
+GL_APICALL GLboolean (* GL_APIENTRY glUnmapBuffer) (GLenum target);
+GL_APICALL void (* GL_APIENTRY glGetBufferPointerv) (GLenum target, GLenum pname, GLvoid** params);
+GL_APICALL void (* GL_APIENTRY glDrawBuffers) (GLsizei n, const GLenum* bufs);
+GL_APICALL void (* GL_APIENTRY glUniformMatrix2x3fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void (* GL_APIENTRY glUniformMatrix3x2fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void (* GL_APIENTRY glUniformMatrix2x4fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void (* GL_APIENTRY glUniformMatrix4x2fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void (* GL_APIENTRY glUniformMatrix3x4fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void (* GL_APIENTRY glUniformMatrix4x3fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void (* GL_APIENTRY glBlitFramebuffer) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+GL_APICALL void (* GL_APIENTRY glRenderbufferStorageMultisample) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void (* GL_APIENTRY glFramebufferTextureLayer) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+GL_APICALL GLvoid* (* GL_APIENTRY glMapBufferRange) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GL_APICALL void (* GL_APIENTRY glFlushMappedBufferRange) (GLenum target, GLintptr offset, GLsizeiptr length);
+GL_APICALL void (* GL_APIENTRY glBindVertexArray) (GLuint array);
+GL_APICALL void (* GL_APIENTRY glDeleteVertexArrays) (GLsizei n, const GLuint* arrays);
+GL_APICALL void (* GL_APIENTRY glGenVertexArrays) (GLsizei n, GLuint* arrays);
+GL_APICALL GLboolean (* GL_APIENTRY glIsVertexArray) (GLuint array);
+GL_APICALL void (* GL_APIENTRY glGetIntegeri_v) (GLenum target, GLuint index, GLint* data);
+GL_APICALL void (* GL_APIENTRY glBeginTransformFeedback) (GLenum primitiveMode);
+GL_APICALL void (* GL_APIENTRY glEndTransformFeedback) (void);
+GL_APICALL void (* GL_APIENTRY glBindBufferRange) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+GL_APICALL void (* GL_APIENTRY glBindBufferBase) (GLenum target, GLuint index, GLuint buffer);
+GL_APICALL void (* GL_APIENTRY glTransformFeedbackVaryings) (GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode);
+GL_APICALL void (* GL_APIENTRY glGetTransformFeedbackVarying) (GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name);
+GL_APICALL void (* GL_APIENTRY glVertexAttribIPointer) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
+GL_APICALL void (* GL_APIENTRY glGetVertexAttribIiv) (GLuint index, GLenum pname, GLint* params);
+GL_APICALL void (* GL_APIENTRY glGetVertexAttribIuiv) (GLuint index, GLenum pname, GLuint* params);
+GL_APICALL void (* GL_APIENTRY glVertexAttribI4i) (GLuint index, GLint x, GLint y, GLint z, GLint w);
+GL_APICALL void (* GL_APIENTRY glVertexAttribI4ui) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+GL_APICALL void (* GL_APIENTRY glVertexAttribI4iv) (GLuint index, const GLint* v);
+GL_APICALL void (* GL_APIENTRY glVertexAttribI4uiv) (GLuint index, const GLuint* v);
+GL_APICALL void (* GL_APIENTRY glGetUniformuiv) (GLuint program, GLint location, GLuint* params);
+GL_APICALL GLint (* GL_APIENTRY glGetFragDataLocation) (GLuint program, const GLchar *name);
+GL_APICALL void (* GL_APIENTRY glUniform1ui) (GLint location, GLuint v0);
+GL_APICALL void (* GL_APIENTRY glUniform2ui) (GLint location, GLuint v0, GLuint v1);
+GL_APICALL void (* GL_APIENTRY glUniform3ui) (GLint location, GLuint v0, GLuint v1, GLuint v2);
+GL_APICALL void (* GL_APIENTRY glUniform4ui) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GL_APICALL void (* GL_APIENTRY glUniform1uiv) (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void (* GL_APIENTRY glUniform2uiv) (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void (* GL_APIENTRY glUniform3uiv) (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void (* GL_APIENTRY glUniform4uiv) (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void (* GL_APIENTRY glClearBufferiv) (GLenum buffer, GLint drawbuffer, const GLint* value);
+GL_APICALL void (* GL_APIENTRY glClearBufferuiv) (GLenum buffer, GLint drawbuffer, const GLuint* value);
+GL_APICALL void (* GL_APIENTRY glClearBufferfv) (GLenum buffer, GLint drawbuffer, const GLfloat* value);
+GL_APICALL void (* GL_APIENTRY glClearBufferfi) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+GL_APICALL const GLubyte* (* GL_APIENTRY glGetStringi) (GLenum name, GLuint index);
+GL_APICALL void (* GL_APIENTRY glCopyBufferSubData) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+GL_APICALL void (* GL_APIENTRY glGetUniformIndices) (GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices);
+GL_APICALL void (* GL_APIENTRY glGetActiveUniformsiv) (GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params);
+GL_APICALL GLuint (* GL_APIENTRY glGetUniformBlockIndex) (GLuint program, const GLchar* uniformBlockName);
+GL_APICALL void (* GL_APIENTRY glGetActiveUniformBlockiv) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params);
+GL_APICALL void (* GL_APIENTRY glGetActiveUniformBlockName) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName);
+GL_APICALL void (* GL_APIENTRY glUniformBlockBinding) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+GL_APICALL void (* GL_APIENTRY glDrawArraysInstanced) (GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
+GL_APICALL void (* GL_APIENTRY glDrawElementsInstanced) (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount);
+GL_APICALL GLsync (* GL_APIENTRY glFenceSync) (GLenum condition, GLbitfield flags);
+GL_APICALL GLboolean (* GL_APIENTRY glIsSync) (GLsync sync);
+GL_APICALL void (* GL_APIENTRY glDeleteSync) (GLsync sync);
+GL_APICALL GLenum (* GL_APIENTRY glClientWaitSync) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void (* GL_APIENTRY glWaitSync) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void (* GL_APIENTRY glGetInteger64v) (GLenum pname, GLint64* params);
+GL_APICALL void (* GL_APIENTRY glGetSynciv) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values);
+GL_APICALL void (* GL_APIENTRY glGetInteger64i_v) (GLenum target, GLuint index, GLint64* data);
+GL_APICALL void (* GL_APIENTRY glGetBufferParameteri64v) (GLenum target, GLenum pname, GLint64* params);
+GL_APICALL void (* GL_APIENTRY glGenSamplers) (GLsizei count, GLuint* samplers);
+GL_APICALL void (* GL_APIENTRY glDeleteSamplers) (GLsizei count, const GLuint* samplers);
+GL_APICALL GLboolean (* GL_APIENTRY glIsSampler) (GLuint sampler);
+GL_APICALL void (* GL_APIENTRY glBindSampler) (GLuint unit, GLuint sampler);
+GL_APICALL void (* GL_APIENTRY glSamplerParameteri) (GLuint sampler, GLenum pname, GLint param);
+GL_APICALL void (* GL_APIENTRY glSamplerParameteriv) (GLuint sampler, GLenum pname, const GLint* param);
+GL_APICALL void (* GL_APIENTRY glSamplerParameterf) (GLuint sampler, GLenum pname, GLfloat param);
+GL_APICALL void (* GL_APIENTRY glSamplerParameterfv) (GLuint sampler, GLenum pname, const GLfloat* param);
+GL_APICALL void (* GL_APIENTRY glGetSamplerParameteriv) (GLuint sampler, GLenum pname, GLint* params);
+GL_APICALL void (* GL_APIENTRY glGetSamplerParameterfv) (GLuint sampler, GLenum pname, GLfloat* params);
+GL_APICALL void (* GL_APIENTRY glVertexAttribDivisor) (GLuint index, GLuint divisor);
+GL_APICALL void (* GL_APIENTRY glBindTransformFeedback) (GLenum target, GLuint id);
+GL_APICALL void (* GL_APIENTRY glDeleteTransformFeedbacks) (GLsizei n, const GLuint* ids);
+GL_APICALL void (* GL_APIENTRY glGenTransformFeedbacks) (GLsizei n, GLuint* ids);
+GL_APICALL GLboolean (* GL_APIENTRY glIsTransformFeedback) (GLuint id);
+GL_APICALL void (* GL_APIENTRY glPauseTransformFeedback) (void);
+GL_APICALL void (* GL_APIENTRY glResumeTransformFeedback) (void);
+GL_APICALL void (* GL_APIENTRY glGetProgramBinary) (GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary);
+GL_APICALL void (* GL_APIENTRY glProgramBinary) (GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length);
+GL_APICALL void (* GL_APIENTRY glProgramParameteri) (GLuint program, GLenum pname, GLint value);
+GL_APICALL void (* GL_APIENTRY glInvalidateFramebuffer) (GLenum target, GLsizei numAttachments, const GLenum* attachments);
+GL_APICALL void (* GL_APIENTRY glInvalidateSubFramebuffer) (GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void (* GL_APIENTRY glTexStorage2D) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void (* GL_APIENTRY glTexStorage3D) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GL_APICALL void (* GL_APIENTRY glGetInternalformativ) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params);
diff --git a/ndk/platforms/android-18/samples/gles3jni/jni/gl3stub.h b/ndk/platforms/android-18/samples/gles3jni/jni/gl3stub.h
new file mode 100644
index 000000000..7a02bf272
--- /dev/null
+++ b/ndk/platforms/android-18/samples/gles3jni/jni/gl3stub.h
@@ -0,0 +1,491 @@
+#ifndef __gl3_h_
+#define __gl3_h_
+
+/*
+ * stub gl3.h for dynamic loading, based on:
+ * gl3.h last updated on $Date: 2013-02-12 14:37:24 -0800 (Tue, 12 Feb 2013) $
+ *
+ * Changes:
+ * - Added #include <GLES2/gl2.h>
+ * - Removed duplicate OpenGL ES 2.0 declarations
+ * - Converted OpenGL ES 3.0 function prototypes to function pointer
+ * declarations
+ * - Added gl3stubInit() declaration
+ */
+
+#include <GLES2/gl2.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2007-2013 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/* Call this function before calling any OpenGL ES 3.0 functions. It will
+ * return GL_TRUE if the OpenGL ES 3.0 was successfully initialized, GL_FALSE
+ * otherwise. */
+GLboolean gl3stubInit();
+
+/*-------------------------------------------------------------------------
+ * Data type definitions
+ *-----------------------------------------------------------------------*/
+
+/* OpenGL ES 3.0 */
+
+typedef unsigned short GLhalf;
+typedef khronos_int64_t GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef struct __GLsync *GLsync;
+
+/*-------------------------------------------------------------------------
+ * Token definitions
+ *-----------------------------------------------------------------------*/
+
+/* OpenGL ES core versions */
+#define GL_ES_VERSION_3_0 1
+
+/* OpenGL ES 3.0 */
+
+#define GL_READ_BUFFER 0x0C02
+#define GL_UNPACK_ROW_LENGTH 0x0CF2
+#define GL_UNPACK_SKIP_ROWS 0x0CF3
+#define GL_UNPACK_SKIP_PIXELS 0x0CF4
+#define GL_PACK_ROW_LENGTH 0x0D02
+#define GL_PACK_SKIP_ROWS 0x0D03
+#define GL_PACK_SKIP_PIXELS 0x0D04
+#define GL_COLOR 0x1800
+#define GL_DEPTH 0x1801
+#define GL_STENCIL 0x1802
+#define GL_RED 0x1903
+#define GL_RGB8 0x8051
+#define GL_RGBA8 0x8058
+#define GL_RGB10_A2 0x8059
+#define GL_TEXTURE_BINDING_3D 0x806A
+#define GL_UNPACK_SKIP_IMAGES 0x806D
+#define GL_UNPACK_IMAGE_HEIGHT 0x806E
+#define GL_TEXTURE_3D 0x806F
+#define GL_TEXTURE_WRAP_R 0x8072
+#define GL_MAX_3D_TEXTURE_SIZE 0x8073
+#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
+#define GL_MAX_ELEMENTS_VERTICES 0x80E8
+#define GL_MAX_ELEMENTS_INDICES 0x80E9
+#define GL_TEXTURE_MIN_LOD 0x813A
+#define GL_TEXTURE_MAX_LOD 0x813B
+#define GL_TEXTURE_BASE_LEVEL 0x813C
+#define GL_TEXTURE_MAX_LEVEL 0x813D
+#define GL_MIN 0x8007
+#define GL_MAX 0x8008
+#define GL_DEPTH_COMPONENT24 0x81A6
+#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
+#define GL_TEXTURE_COMPARE_MODE 0x884C
+#define GL_TEXTURE_COMPARE_FUNC 0x884D
+#define GL_CURRENT_QUERY 0x8865
+#define GL_QUERY_RESULT 0x8866
+#define GL_QUERY_RESULT_AVAILABLE 0x8867
+#define GL_BUFFER_MAPPED 0x88BC
+#define GL_BUFFER_MAP_POINTER 0x88BD
+#define GL_STREAM_READ 0x88E1
+#define GL_STREAM_COPY 0x88E2
+#define GL_STATIC_READ 0x88E5
+#define GL_STATIC_COPY 0x88E6
+#define GL_DYNAMIC_READ 0x88E9
+#define GL_DYNAMIC_COPY 0x88EA
+#define GL_MAX_DRAW_BUFFERS 0x8824
+#define GL_DRAW_BUFFER0 0x8825
+#define GL_DRAW_BUFFER1 0x8826
+#define GL_DRAW_BUFFER2 0x8827
+#define GL_DRAW_BUFFER3 0x8828
+#define GL_DRAW_BUFFER4 0x8829
+#define GL_DRAW_BUFFER5 0x882A
+#define GL_DRAW_BUFFER6 0x882B
+#define GL_DRAW_BUFFER7 0x882C
+#define GL_DRAW_BUFFER8 0x882D
+#define GL_DRAW_BUFFER9 0x882E
+#define GL_DRAW_BUFFER10 0x882F
+#define GL_DRAW_BUFFER11 0x8830
+#define GL_DRAW_BUFFER12 0x8831
+#define GL_DRAW_BUFFER13 0x8832
+#define GL_DRAW_BUFFER14 0x8833
+#define GL_DRAW_BUFFER15 0x8834
+#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
+#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
+#define GL_SAMPLER_3D 0x8B5F
+#define GL_SAMPLER_2D_SHADOW 0x8B62
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
+#define GL_PIXEL_PACK_BUFFER 0x88EB
+#define GL_PIXEL_UNPACK_BUFFER 0x88EC
+#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
+#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF
+#define GL_FLOAT_MAT2x3 0x8B65
+#define GL_FLOAT_MAT2x4 0x8B66
+#define GL_FLOAT_MAT3x2 0x8B67
+#define GL_FLOAT_MAT3x4 0x8B68
+#define GL_FLOAT_MAT4x2 0x8B69
+#define GL_FLOAT_MAT4x3 0x8B6A
+#define GL_SRGB 0x8C40
+#define GL_SRGB8 0x8C41
+#define GL_SRGB8_ALPHA8 0x8C43
+#define GL_COMPARE_REF_TO_TEXTURE 0x884E
+#define GL_MAJOR_VERSION 0x821B
+#define GL_MINOR_VERSION 0x821C
+#define GL_NUM_EXTENSIONS 0x821D
+#define GL_RGBA32F 0x8814
+#define GL_RGB32F 0x8815
+#define GL_RGBA16F 0x881A
+#define GL_RGB16F 0x881B
+#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD
+#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
+#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904
+#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905
+#define GL_MAX_VARYING_COMPONENTS 0x8B4B
+#define GL_TEXTURE_2D_ARRAY 0x8C1A
+#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D
+#define GL_R11F_G11F_B10F 0x8C3A
+#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B
+#define GL_RGB9_E5 0x8C3D
+#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E
+#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
+#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
+#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83
+#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
+#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
+#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
+#define GL_RASTERIZER_DISCARD 0x8C89
+#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
+#define GL_INTERLEAVED_ATTRIBS 0x8C8C
+#define GL_SEPARATE_ATTRIBS 0x8C8D
+#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E
+#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
+#define GL_RGBA32UI 0x8D70
+#define GL_RGB32UI 0x8D71
+#define GL_RGBA16UI 0x8D76
+#define GL_RGB16UI 0x8D77
+#define GL_RGBA8UI 0x8D7C
+#define GL_RGB8UI 0x8D7D
+#define GL_RGBA32I 0x8D82
+#define GL_RGB32I 0x8D83
+#define GL_RGBA16I 0x8D88
+#define GL_RGB16I 0x8D89
+#define GL_RGBA8I 0x8D8E
+#define GL_RGB8I 0x8D8F
+#define GL_RED_INTEGER 0x8D94
+#define GL_RGB_INTEGER 0x8D98
+#define GL_RGBA_INTEGER 0x8D99
+#define GL_SAMPLER_2D_ARRAY 0x8DC1
+#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4
+#define GL_SAMPLER_CUBE_SHADOW 0x8DC5
+#define GL_UNSIGNED_INT_VEC2 0x8DC6
+#define GL_UNSIGNED_INT_VEC3 0x8DC7
+#define GL_UNSIGNED_INT_VEC4 0x8DC8
+#define GL_INT_SAMPLER_2D 0x8DCA
+#define GL_INT_SAMPLER_3D 0x8DCB
+#define GL_INT_SAMPLER_CUBE 0x8DCC
+#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF
+#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2
+#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3
+#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4
+#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7
+#define GL_BUFFER_ACCESS_FLAGS 0x911F
+#define GL_BUFFER_MAP_LENGTH 0x9120
+#define GL_BUFFER_MAP_OFFSET 0x9121
+#define GL_DEPTH_COMPONENT32F 0x8CAC
+#define GL_DEPTH32F_STENCIL8 0x8CAD
+#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
+#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
+#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
+#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
+#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
+#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
+#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
+#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
+#define GL_FRAMEBUFFER_DEFAULT 0x8218
+#define GL_FRAMEBUFFER_UNDEFINED 0x8219
+#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
+#define GL_DEPTH_STENCIL 0x84F9
+#define GL_UNSIGNED_INT_24_8 0x84FA
+#define GL_DEPTH24_STENCIL8 0x88F0
+#define GL_UNSIGNED_NORMALIZED 0x8C17
+#define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING
+#define GL_READ_FRAMEBUFFER 0x8CA8
+#define GL_DRAW_FRAMEBUFFER 0x8CA9
+#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA
+#define GL_RENDERBUFFER_SAMPLES 0x8CAB
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
+#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
+#define GL_COLOR_ATTACHMENT1 0x8CE1
+#define GL_COLOR_ATTACHMENT2 0x8CE2
+#define GL_COLOR_ATTACHMENT3 0x8CE3
+#define GL_COLOR_ATTACHMENT4 0x8CE4
+#define GL_COLOR_ATTACHMENT5 0x8CE5
+#define GL_COLOR_ATTACHMENT6 0x8CE6
+#define GL_COLOR_ATTACHMENT7 0x8CE7
+#define GL_COLOR_ATTACHMENT8 0x8CE8
+#define GL_COLOR_ATTACHMENT9 0x8CE9
+#define GL_COLOR_ATTACHMENT10 0x8CEA
+#define GL_COLOR_ATTACHMENT11 0x8CEB
+#define GL_COLOR_ATTACHMENT12 0x8CEC
+#define GL_COLOR_ATTACHMENT13 0x8CED
+#define GL_COLOR_ATTACHMENT14 0x8CEE
+#define GL_COLOR_ATTACHMENT15 0x8CEF
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
+#define GL_MAX_SAMPLES 0x8D57
+#define GL_HALF_FLOAT 0x140B
+#define GL_MAP_READ_BIT 0x0001
+#define GL_MAP_WRITE_BIT 0x0002
+#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004
+#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
+#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010
+#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
+#define GL_RG 0x8227
+#define GL_RG_INTEGER 0x8228
+#define GL_R8 0x8229
+#define GL_RG8 0x822B
+#define GL_R16F 0x822D
+#define GL_R32F 0x822E
+#define GL_RG16F 0x822F
+#define GL_RG32F 0x8230
+#define GL_R8I 0x8231
+#define GL_R8UI 0x8232
+#define GL_R16I 0x8233
+#define GL_R16UI 0x8234
+#define GL_R32I 0x8235
+#define GL_R32UI 0x8236
+#define GL_RG8I 0x8237
+#define GL_RG8UI 0x8238
+#define GL_RG16I 0x8239
+#define GL_RG16UI 0x823A
+#define GL_RG32I 0x823B
+#define GL_RG32UI 0x823C
+#define GL_VERTEX_ARRAY_BINDING 0x85B5
+#define GL_R8_SNORM 0x8F94
+#define GL_RG8_SNORM 0x8F95
+#define GL_RGB8_SNORM 0x8F96
+#define GL_RGBA8_SNORM 0x8F97
+#define GL_SIGNED_NORMALIZED 0x8F9C
+#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69
+#define GL_COPY_READ_BUFFER 0x8F36
+#define GL_COPY_WRITE_BUFFER 0x8F37
+#define GL_COPY_READ_BUFFER_BINDING GL_COPY_READ_BUFFER
+#define GL_COPY_WRITE_BUFFER_BINDING GL_COPY_WRITE_BUFFER
+#define GL_UNIFORM_BUFFER 0x8A11
+#define GL_UNIFORM_BUFFER_BINDING 0x8A28
+#define GL_UNIFORM_BUFFER_START 0x8A29
+#define GL_UNIFORM_BUFFER_SIZE 0x8A2A
+#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B
+#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D
+#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E
+#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F
+#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30
+#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
+#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
+#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
+#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
+#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
+#define GL_UNIFORM_TYPE 0x8A37
+#define GL_UNIFORM_SIZE 0x8A38
+#define GL_UNIFORM_NAME_LENGTH 0x8A39
+#define GL_UNIFORM_BLOCK_INDEX 0x8A3A
+#define GL_UNIFORM_OFFSET 0x8A3B
+#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
+#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
+#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E
+#define GL_UNIFORM_BLOCK_BINDING 0x8A3F
+#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
+#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
+#define GL_INVALID_INDEX 0xFFFFFFFFu
+#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
+#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125
+#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
+#define GL_OBJECT_TYPE 0x9112
+#define GL_SYNC_CONDITION 0x9113
+#define GL_SYNC_STATUS 0x9114
+#define GL_SYNC_FLAGS 0x9115
+#define GL_SYNC_FENCE 0x9116
+#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
+#define GL_UNSIGNALED 0x9118
+#define GL_SIGNALED 0x9119
+#define GL_ALREADY_SIGNALED 0x911A
+#define GL_TIMEOUT_EXPIRED 0x911B
+#define GL_CONDITION_SATISFIED 0x911C
+#define GL_WAIT_FAILED 0x911D
+#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
+#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE
+#define GL_ANY_SAMPLES_PASSED 0x8C2F
+#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
+#define GL_SAMPLER_BINDING 0x8919
+#define GL_RGB10_A2UI 0x906F
+#define GL_TEXTURE_SWIZZLE_R 0x8E42
+#define GL_TEXTURE_SWIZZLE_G 0x8E43
+#define GL_TEXTURE_SWIZZLE_B 0x8E44
+#define GL_TEXTURE_SWIZZLE_A 0x8E45
+#define GL_GREEN 0x1904
+#define GL_BLUE 0x1905
+#define GL_INT_2_10_10_10_REV 0x8D9F
+#define GL_TRANSFORM_FEEDBACK 0x8E22
+#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23
+#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24
+#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25
+#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
+#define GL_PROGRAM_BINARY_LENGTH 0x8741
+#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE
+#define GL_PROGRAM_BINARY_FORMATS 0x87FF
+#define GL_COMPRESSED_R11_EAC 0x9270
+#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271
+#define GL_COMPRESSED_RG11_EAC 0x9272
+#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273
+#define GL_COMPRESSED_RGB8_ETC2 0x9274
+#define GL_COMPRESSED_SRGB8_ETC2 0x9275
+#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
+#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
+#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
+#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
+#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F
+#define GL_MAX_ELEMENT_INDEX 0x8D6B
+#define GL_NUM_SAMPLE_COUNTS 0x9380
+#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
+
+/*-------------------------------------------------------------------------
+ * Entrypoint definitions
+ *-----------------------------------------------------------------------*/
+
+/* OpenGL ES 3.0 */
+
+extern GL_APICALL void (* GL_APIENTRY glReadBuffer) (GLenum mode);
+extern GL_APICALL void (* GL_APIENTRY glDrawRangeElements) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices);
+extern GL_APICALL void (* GL_APIENTRY glTexImage3D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+extern GL_APICALL void (* GL_APIENTRY glTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
+extern GL_APICALL void (* GL_APIENTRY glCopyTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+extern GL_APICALL void (* GL_APIENTRY glCompressedTexImage3D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
+extern GL_APICALL void (* GL_APIENTRY glCompressedTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
+extern GL_APICALL void (* GL_APIENTRY glGenQueries) (GLsizei n, GLuint* ids);
+extern GL_APICALL void (* GL_APIENTRY glDeleteQueries) (GLsizei n, const GLuint* ids);
+extern GL_APICALL GLboolean (* GL_APIENTRY glIsQuery) (GLuint id);
+extern GL_APICALL void (* GL_APIENTRY glBeginQuery) (GLenum target, GLuint id);
+extern GL_APICALL void (* GL_APIENTRY glEndQuery) (GLenum target);
+extern GL_APICALL void (* GL_APIENTRY glGetQueryiv) (GLenum target, GLenum pname, GLint* params);
+extern GL_APICALL void (* GL_APIENTRY glGetQueryObjectuiv) (GLuint id, GLenum pname, GLuint* params);
+extern GL_APICALL GLboolean (* GL_APIENTRY glUnmapBuffer) (GLenum target);
+extern GL_APICALL void (* GL_APIENTRY glGetBufferPointerv) (GLenum target, GLenum pname, GLvoid** params);
+extern GL_APICALL void (* GL_APIENTRY glDrawBuffers) (GLsizei n, const GLenum* bufs);
+extern GL_APICALL void (* GL_APIENTRY glUniformMatrix2x3fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+extern GL_APICALL void (* GL_APIENTRY glUniformMatrix3x2fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+extern GL_APICALL void (* GL_APIENTRY glUniformMatrix2x4fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+extern GL_APICALL void (* GL_APIENTRY glUniformMatrix4x2fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+extern GL_APICALL void (* GL_APIENTRY glUniformMatrix3x4fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+extern GL_APICALL void (* GL_APIENTRY glUniformMatrix4x3fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+extern GL_APICALL void (* GL_APIENTRY glBlitFramebuffer) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+extern GL_APICALL void (* GL_APIENTRY glRenderbufferStorageMultisample) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+extern GL_APICALL void (* GL_APIENTRY glFramebufferTextureLayer) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+extern GL_APICALL GLvoid* (* GL_APIENTRY glMapBufferRange) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+extern GL_APICALL void (* GL_APIENTRY glFlushMappedBufferRange) (GLenum target, GLintptr offset, GLsizeiptr length);
+extern GL_APICALL void (* GL_APIENTRY glBindVertexArray) (GLuint array);
+extern GL_APICALL void (* GL_APIENTRY glDeleteVertexArrays) (GLsizei n, const GLuint* arrays);
+extern GL_APICALL void (* GL_APIENTRY glGenVertexArrays) (GLsizei n, GLuint* arrays);
+extern GL_APICALL GLboolean (* GL_APIENTRY glIsVertexArray) (GLuint array);
+extern GL_APICALL void (* GL_APIENTRY glGetIntegeri_v) (GLenum target, GLuint index, GLint* data);
+extern GL_APICALL void (* GL_APIENTRY glBeginTransformFeedback) (GLenum primitiveMode);
+extern GL_APICALL void (* GL_APIENTRY glEndTransformFeedback) (void);
+extern GL_APICALL void (* GL_APIENTRY glBindBufferRange) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+extern GL_APICALL void (* GL_APIENTRY glBindBufferBase) (GLenum target, GLuint index, GLuint buffer);
+extern GL_APICALL void (* GL_APIENTRY glTransformFeedbackVaryings) (GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode);
+extern GL_APICALL void (* GL_APIENTRY glGetTransformFeedbackVarying) (GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name);
+extern GL_APICALL void (* GL_APIENTRY glVertexAttribIPointer) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
+extern GL_APICALL void (* GL_APIENTRY glGetVertexAttribIiv) (GLuint index, GLenum pname, GLint* params);
+extern GL_APICALL void (* GL_APIENTRY glGetVertexAttribIuiv) (GLuint index, GLenum pname, GLuint* params);
+extern GL_APICALL void (* GL_APIENTRY glVertexAttribI4i) (GLuint index, GLint x, GLint y, GLint z, GLint w);
+extern GL_APICALL void (* GL_APIENTRY glVertexAttribI4ui) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+extern GL_APICALL void (* GL_APIENTRY glVertexAttribI4iv) (GLuint index, const GLint* v);
+extern GL_APICALL void (* GL_APIENTRY glVertexAttribI4uiv) (GLuint index, const GLuint* v);
+extern GL_APICALL void (* GL_APIENTRY glGetUniformuiv) (GLuint program, GLint location, GLuint* params);
+extern GL_APICALL GLint (* GL_APIENTRY glGetFragDataLocation) (GLuint program, const GLchar *name);
+extern GL_APICALL void (* GL_APIENTRY glUniform1ui) (GLint location, GLuint v0);
+extern GL_APICALL void (* GL_APIENTRY glUniform2ui) (GLint location, GLuint v0, GLuint v1);
+extern GL_APICALL void (* GL_APIENTRY glUniform3ui) (GLint location, GLuint v0, GLuint v1, GLuint v2);
+extern GL_APICALL void (* GL_APIENTRY glUniform4ui) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+extern GL_APICALL void (* GL_APIENTRY glUniform1uiv) (GLint location, GLsizei count, const GLuint* value);
+extern GL_APICALL void (* GL_APIENTRY glUniform2uiv) (GLint location, GLsizei count, const GLuint* value);
+extern GL_APICALL void (* GL_APIENTRY glUniform3uiv) (GLint location, GLsizei count, const GLuint* value);
+extern GL_APICALL void (* GL_APIENTRY glUniform4uiv) (GLint location, GLsizei count, const GLuint* value);
+extern GL_APICALL void (* GL_APIENTRY glClearBufferiv) (GLenum buffer, GLint drawbuffer, const GLint* value);
+extern GL_APICALL void (* GL_APIENTRY glClearBufferuiv) (GLenum buffer, GLint drawbuffer, const GLuint* value);
+extern GL_APICALL void (* GL_APIENTRY glClearBufferfv) (GLenum buffer, GLint drawbuffer, const GLfloat* value);
+extern GL_APICALL void (* GL_APIENTRY glClearBufferfi) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+extern GL_APICALL const GLubyte* (* GL_APIENTRY glGetStringi) (GLenum name, GLuint index);
+extern GL_APICALL void (* GL_APIENTRY glCopyBufferSubData) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+extern GL_APICALL void (* GL_APIENTRY glGetUniformIndices) (GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices);
+extern GL_APICALL void (* GL_APIENTRY glGetActiveUniformsiv) (GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params);
+extern GL_APICALL GLuint (* GL_APIENTRY glGetUniformBlockIndex) (GLuint program, const GLchar* uniformBlockName);
+extern GL_APICALL void (* GL_APIENTRY glGetActiveUniformBlockiv) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params);
+extern GL_APICALL void (* GL_APIENTRY glGetActiveUniformBlockName) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName);
+extern GL_APICALL void (* GL_APIENTRY glUniformBlockBinding) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+extern GL_APICALL void (* GL_APIENTRY glDrawArraysInstanced) (GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
+extern GL_APICALL void (* GL_APIENTRY glDrawElementsInstanced) (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount);
+extern GL_APICALL GLsync (* GL_APIENTRY glFenceSync) (GLenum condition, GLbitfield flags);
+extern GL_APICALL GLboolean (* GL_APIENTRY glIsSync) (GLsync sync);
+extern GL_APICALL void (* GL_APIENTRY glDeleteSync) (GLsync sync);
+extern GL_APICALL GLenum (* GL_APIENTRY glClientWaitSync) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+extern GL_APICALL void (* GL_APIENTRY glWaitSync) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+extern GL_APICALL void (* GL_APIENTRY glGetInteger64v) (GLenum pname, GLint64* params);
+extern GL_APICALL void (* GL_APIENTRY glGetSynciv) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values);
+extern GL_APICALL void (* GL_APIENTRY glGetInteger64i_v) (GLenum target, GLuint index, GLint64* data);
+extern GL_APICALL void (* GL_APIENTRY glGetBufferParameteri64v) (GLenum target, GLenum pname, GLint64* params);
+extern GL_APICALL void (* GL_APIENTRY glGenSamplers) (GLsizei count, GLuint* samplers);
+extern GL_APICALL void (* GL_APIENTRY glDeleteSamplers) (GLsizei count, const GLuint* samplers);
+extern GL_APICALL GLboolean (* GL_APIENTRY glIsSampler) (GLuint sampler);
+extern GL_APICALL void (* GL_APIENTRY glBindSampler) (GLuint unit, GLuint sampler);
+extern GL_APICALL void (* GL_APIENTRY glSamplerParameteri) (GLuint sampler, GLenum pname, GLint param);
+extern GL_APICALL void (* GL_APIENTRY glSamplerParameteriv) (GLuint sampler, GLenum pname, const GLint* param);
+extern GL_APICALL void (* GL_APIENTRY glSamplerParameterf) (GLuint sampler, GLenum pname, GLfloat param);
+extern GL_APICALL void (* GL_APIENTRY glSamplerParameterfv) (GLuint sampler, GLenum pname, const GLfloat* param);
+extern GL_APICALL void (* GL_APIENTRY glGetSamplerParameteriv) (GLuint sampler, GLenum pname, GLint* params);
+extern GL_APICALL void (* GL_APIENTRY glGetSamplerParameterfv) (GLuint sampler, GLenum pname, GLfloat* params);
+extern GL_APICALL void (* GL_APIENTRY glVertexAttribDivisor) (GLuint index, GLuint divisor);
+extern GL_APICALL void (* GL_APIENTRY glBindTransformFeedback) (GLenum target, GLuint id);
+extern GL_APICALL void (* GL_APIENTRY glDeleteTransformFeedbacks) (GLsizei n, const GLuint* ids);
+extern GL_APICALL void (* GL_APIENTRY glGenTransformFeedbacks) (GLsizei n, GLuint* ids);
+extern GL_APICALL GLboolean (* GL_APIENTRY glIsTransformFeedback) (GLuint id);
+extern GL_APICALL void (* GL_APIENTRY glPauseTransformFeedback) (void);
+extern GL_APICALL void (* GL_APIENTRY glResumeTransformFeedback) (void);
+extern GL_APICALL void (* GL_APIENTRY glGetProgramBinary) (GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary);
+extern GL_APICALL void (* GL_APIENTRY glProgramBinary) (GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length);
+extern GL_APICALL void (* GL_APIENTRY glProgramParameteri) (GLuint program, GLenum pname, GLint value);
+extern GL_APICALL void (* GL_APIENTRY glInvalidateFramebuffer) (GLenum target, GLsizei numAttachments, const GLenum* attachments);
+extern GL_APICALL void (* GL_APIENTRY glInvalidateSubFramebuffer) (GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height);
+extern GL_APICALL void (* GL_APIENTRY glTexStorage2D) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+extern GL_APICALL void (* GL_APIENTRY glTexStorage3D) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+extern GL_APICALL void (* GL_APIENTRY glGetInternalformativ) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/ndk/platforms/android-18/samples/gles3jni/jni/gles3jni.cpp b/ndk/platforms/android-18/samples/gles3jni/jni/gles3jni.cpp
new file mode 100644
index 000000000..23f2b05a1
--- /dev/null
+++ b/ndk/platforms/android-18/samples/gles3jni/jni/gles3jni.cpp
@@ -0,0 +1,284 @@
+/*
+ * Copyright 2013 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.
+ */
+
+#include <jni.h>
+#include <stdlib.h>
+#include <time.h>
+
+#include "gles3jni.h"
+
+const Vertex QUAD[4] = {
+ // Square with diagonal < 2 so that it fits in a [-1 .. 1]^2 square
+ // regardless of rotation.
+ {{-0.7f, -0.7f}, {0x00, 0xFF, 0x00}},
+ {{ 0.7f, -0.7f}, {0x00, 0x00, 0xFF}},
+ {{-0.7f, 0.7f}, {0xFF, 0x00, 0x00}},
+ {{ 0.7f, 0.7f}, {0xFF, 0xFF, 0xFF}},
+};
+
+bool checkGlError(const char* funcName) {
+ GLint err = glGetError();
+ if (err != GL_NO_ERROR) {
+ ALOGE("GL error after %s(): 0x%08x\n", funcName, err);
+ return true;
+ }
+ return false;
+}
+
+GLuint createShader(GLenum shaderType, const char* src) {
+ GLuint shader = glCreateShader(shaderType);
+ if (!shader) {
+ checkGlError("glCreateShader");
+ return 0;
+ }
+ glShaderSource(shader, 1, &src, NULL);
+
+ GLint compiled = GL_FALSE;
+ glCompileShader(shader);
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
+ if (!compiled) {
+ GLint infoLogLen = 0;
+ glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLen);
+ if (infoLogLen > 0) {
+ GLchar* infoLog = (GLchar*)malloc(infoLogLen);
+ if (infoLog) {
+ glGetShaderInfoLog(shader, infoLogLen, NULL, infoLog);
+ ALOGE("Could not compile %s shader:\n%s\n",
+ shaderType == GL_VERTEX_SHADER ? "vertex" : "fragment",
+ infoLog);
+ free(infoLog);
+ }
+ }
+ glDeleteShader(shader);
+ return 0;
+ }
+
+ return shader;
+}
+
+GLuint createProgram(const char* vtxSrc, const char* fragSrc) {
+ GLuint vtxShader = 0;
+ GLuint fragShader = 0;
+ GLuint program = 0;
+ GLint linked = GL_FALSE;
+
+ vtxShader = createShader(GL_VERTEX_SHADER, vtxSrc);
+ if (!vtxShader)
+ goto exit;
+
+ fragShader = createShader(GL_FRAGMENT_SHADER, fragSrc);
+ if (!fragShader)
+ goto exit;
+
+ program = glCreateProgram();
+ if (!program) {
+ checkGlError("glCreateProgram");
+ goto exit;
+ }
+ glAttachShader(program, vtxShader);
+ glAttachShader(program, fragShader);
+
+ glLinkProgram(program);
+ glGetProgramiv(program, GL_LINK_STATUS, &linked);
+ if (!linked) {
+ ALOGE("Could not link program");
+ GLint infoLogLen = 0;
+ glGetProgramiv(program, GL_INFO_LOG_LENGTH, &infoLogLen);
+ if (infoLogLen) {
+ GLchar* infoLog = (GLchar*)malloc(infoLogLen);
+ if (infoLog) {
+ glGetProgramInfoLog(program, infoLogLen, NULL, infoLog);
+ ALOGE("Could not link program:\n%s\n", infoLog);
+ free(infoLog);
+ }
+ }
+ glDeleteProgram(program);
+ program = 0;
+ }
+
+exit:
+ glDeleteShader(vtxShader);
+ glDeleteShader(fragShader);
+ return program;
+}
+
+static void printGlString(const char* name, GLenum s) {
+ const char* v = (const char*)glGetString(s);
+ ALOGV("GL %s: %s\n", name, v);
+}
+
+// ----------------------------------------------------------------------------
+
+Renderer::Renderer()
+: mNumInstances(0),
+ mLastFrameNs(0)
+{
+ memset(mScale, 0, sizeof(mScale));
+ memset(mAngularVelocity, 0, sizeof(mAngularVelocity));
+ memset(mAngles, 0, sizeof(mAngles));
+}
+
+Renderer::~Renderer() {
+}
+
+void Renderer::resize(int w, int h) {
+ float* offsets = mapOffsetBuf();
+ calcSceneParams(w, h, offsets);
+ unmapOffsetBuf();
+
+ for (unsigned int i = 0; i < mNumInstances; i++) {
+ mAngles[i] = drand48() * TWO_PI;
+ mAngularVelocity[i] = MAX_ROT_SPEED * (2.0*drand48() - 1.0);
+ }
+
+ mLastFrameNs = 0;
+
+ glViewport(0, 0, w, h);
+}
+
+void Renderer::calcSceneParams(unsigned int w, unsigned int h,
+ float* offsets) {
+ // number of cells along the larger screen dimension
+ const float NCELLS_MAJOR = MAX_INSTANCES_PER_SIDE;
+ // cell size in scene space
+ const float CELL_SIZE = 2.0f / NCELLS_MAJOR;
+
+ // Calculations are done in "landscape", i.e. assuming dim[0] >= dim[1].
+ // Only at the end are values put in the opposite order if h > w.
+ const float dim[2] = {fmaxf(w,h), fminf(w,h)};
+ const float aspect[2] = {dim[0] / dim[1], dim[1] / dim[0]};
+ const float scene2clip[2] = {1.0f, aspect[0]};
+ const int ncells[2] = {
+ NCELLS_MAJOR,
+ (int)floorf(NCELLS_MAJOR * aspect[1])
+ };
+
+ float centers[2][MAX_INSTANCES_PER_SIDE];
+ for (int d = 0; d < 2; d++) {
+ float offset = -ncells[d] / NCELLS_MAJOR; // -1.0 for d=0
+ for (int i = 0; i < ncells[d]; i++) {
+ centers[d][i] = scene2clip[d] * (CELL_SIZE*(i + 0.5f) + offset);
+ }
+ }
+
+ int major = w >= h ? 0 : 1;
+ int minor = w >= h ? 1 : 0;
+ // outer product of centers[0] and centers[1]
+ for (int i = 0; i < ncells[0]; i++) {
+ for (int j = 0; j < ncells[1]; j++) {
+ int idx = i*ncells[1] + j;
+ offsets[2*idx + major] = centers[0][i];
+ offsets[2*idx + minor] = centers[1][j];
+ }
+ }
+
+ mNumInstances = ncells[0] * ncells[1];
+ mScale[major] = 0.5f * CELL_SIZE * scene2clip[0];
+ mScale[minor] = 0.5f * CELL_SIZE * scene2clip[1];
+}
+
+void Renderer::step() {
+ timespec now;
+ clock_gettime(CLOCK_MONOTONIC, &now);
+ uint64_t nowNs = now.tv_sec*1000000000ull + now.tv_nsec;
+
+ if (mLastFrameNs > 0) {
+ float dt = float(nowNs - mLastFrameNs) * 0.000000001f;
+
+ for (unsigned int i = 0; i < mNumInstances; i++) {
+ mAngles[i] += mAngularVelocity[i] * dt;
+ if (mAngles[i] >= TWO_PI) {
+ mAngles[i] -= TWO_PI;
+ } else if (mAngles[i] <= -TWO_PI) {
+ mAngles[i] += TWO_PI;
+ }
+ }
+
+ float* transforms = mapTransformBuf();
+ for (unsigned int i = 0; i < mNumInstances; i++) {
+ float s = sinf(mAngles[i]);
+ float c = cosf(mAngles[i]);
+ transforms[4*i + 0] = c * mScale[0];
+ transforms[4*i + 1] = s * mScale[1];
+ transforms[4*i + 2] = -s * mScale[0];
+ transforms[4*i + 3] = c * mScale[1];
+ }
+ unmapTransformBuf();
+ }
+
+ mLastFrameNs = nowNs;
+}
+
+void Renderer::render() {
+ step();
+
+ glClearColor(0.2f, 0.2f, 0.3f, 1.0f);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ draw(mNumInstances);
+ checkGlError("Renderer::render");
+}
+
+// ----------------------------------------------------------------------------
+
+static Renderer* g_renderer = NULL;
+
+extern "C" {
+ JNIEXPORT void JNICALL Java_com_android_gles3jni_GLES3JNILib_init(JNIEnv* env, jobject obj);
+ JNIEXPORT void JNICALL Java_com_android_gles3jni_GLES3JNILib_resize(JNIEnv* env, jobject obj, jint width, jint height);
+ JNIEXPORT void JNICALL Java_com_android_gles3jni_GLES3JNILib_step(JNIEnv* env, jobject obj);
+};
+
+#if !defined(DYNAMIC_ES3)
+static GLboolean gl3stubInit() {
+ return GL_TRUE;
+}
+#endif
+
+JNIEXPORT void JNICALL
+Java_com_android_gles3jni_GLES3JNILib_init(JNIEnv* env, jobject obj) {
+ if (g_renderer) {
+ delete g_renderer;
+ g_renderer = NULL;
+ }
+
+ printGlString("Version", GL_VERSION);
+ printGlString("Vendor", GL_VENDOR);
+ printGlString("Renderer", GL_RENDERER);
+ printGlString("Extensions", GL_EXTENSIONS);
+
+ const char* versionStr = (const char*)glGetString(GL_VERSION);
+ if (strstr(versionStr, "OpenGL ES 3.") && gl3stubInit()) {
+ g_renderer = createES3Renderer();
+ } else if (strstr(versionStr, "OpenGL ES 2.")) {
+ g_renderer = createES2Renderer();
+ } else {
+ ALOGE("Unsupported OpenGL ES version");
+ }
+}
+
+JNIEXPORT void JNICALL
+Java_com_android_gles3jni_GLES3JNILib_resize(JNIEnv* env, jobject obj, jint width, jint height) {
+ if (g_renderer) {
+ g_renderer->resize(width, height);
+ }
+}
+
+JNIEXPORT void JNICALL
+Java_com_android_gles3jni_GLES3JNILib_step(JNIEnv* env, jobject obj) {
+ if (g_renderer) {
+ g_renderer->render();
+ }
+}
diff --git a/ndk/platforms/android-18/samples/gles3jni/jni/gles3jni.h b/ndk/platforms/android-18/samples/gles3jni/jni/gles3jni.h
new file mode 100644
index 000000000..dde779ce4
--- /dev/null
+++ b/ndk/platforms/android-18/samples/gles3jni/jni/gles3jni.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2013 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.
+ */
+
+#ifndef GLES3JNI_H
+#define GLES3JNI_H 1
+
+#include <android/log.h>
+#include <math.h>
+
+#if DYNAMIC_ES3
+#include "gl3stub.h"
+#else
+#include <GLES3/gl3.h>
+#endif
+
+#define DEBUG 1
+
+#define LOG_TAG "GLES3JNI"
+#define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
+#if DEBUG
+#define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)
+#else
+#define ALOGV(...)
+#endif
+
+// ----------------------------------------------------------------------------
+// Types, functions, and data used by both ES2 and ES3 renderers.
+// Defined in gles3jni.cpp.
+
+#define MAX_INSTANCES_PER_SIDE 16
+#define MAX_INSTANCES (MAX_INSTANCES_PER_SIDE * MAX_INSTANCES_PER_SIDE)
+#define TWO_PI (2.0 * M_PI)
+#define MAX_ROT_SPEED (0.3 * TWO_PI)
+
+// This demo uses three coordinate spaces:
+// - The model (a quad) is in a [-1 .. 1]^2 space
+// - Scene space is either
+// landscape: [-1 .. 1] x [-1/(2*w/h) .. 1/(2*w/h)]
+// portrait: [-1/(2*h/w) .. 1/(2*h/w)] x [-1 .. 1]
+// - Clip space in OpenGL is [-1 .. 1]^2
+//
+// Conceptually, the quads are rotated in model space, then scaled (uniformly)
+// and translated to place them in scene space. Scene space is then
+// non-uniformly scaled to clip space. In practice the transforms are combined
+// so vertices go directly from model to clip space.
+
+struct Vertex {
+ GLfloat pos[2];
+ GLubyte rgba[4];
+};
+extern const Vertex QUAD[4];
+
+// returns true if a GL error occurred
+extern bool checkGlError(const char* funcName);
+extern GLuint createShader(GLenum shaderType, const char* src);
+extern GLuint createProgram(const char* vtxSrc, const char* fragSrc);
+
+// ----------------------------------------------------------------------------
+// Interface to the ES2 and ES3 renderers, used by JNI code.
+
+class Renderer {
+public:
+ virtual ~Renderer();
+ void resize(int w, int h);
+ void render();
+
+protected:
+ Renderer();
+
+ // return a pointer to a buffer of MAX_INSTANCES * sizeof(vec2).
+ // the buffer is filled with per-instance offsets, then unmapped.
+ virtual float* mapOffsetBuf() = 0;
+ virtual void unmapOffsetBuf() = 0;
+ // return a pointer to a buffer of MAX_INSTANCES * sizeof(vec4).
+ // the buffer is filled with per-instance scale and rotation transforms.
+ virtual float* mapTransformBuf() = 0;
+ virtual void unmapTransformBuf() = 0;
+
+ virtual void draw(unsigned int numInstances) = 0;
+
+private:
+ void calcSceneParams(unsigned int w, unsigned int h, float* offsets);
+ void step();
+
+ unsigned int mNumInstances;
+ float mScale[2];
+ float mAngularVelocity[MAX_INSTANCES];
+ uint64_t mLastFrameNs;
+ float mAngles[MAX_INSTANCES];
+};
+
+extern Renderer* createES2Renderer();
+extern Renderer* createES3Renderer();
+
+#endif // GLES3JNI_H
diff --git a/ndk/platforms/android-18/samples/gles3jni/res/values/strings.xml b/ndk/platforms/android-18/samples/gles3jni/res/values/strings.xml
new file mode 100644
index 000000000..375efc639
--- /dev/null
+++ b/ndk/platforms/android-18/samples/gles3jni/res/values/strings.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2013 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.
+-->
+
+<!-- This file contains resource definitions for displayed strings, allowing
+ them to be changed based on the locale and options. -->
+
+<resources>
+ <!-- Simple strings. -->
+ <string name="gles3jni_activity">GLES3JNI</string>
+
+</resources>
diff --git a/ndk/platforms/android-18/samples/gles3jni/src/com/android/gles3jni/GLES3JNIActivity.java b/ndk/platforms/android-18/samples/gles3jni/src/com/android/gles3jni/GLES3JNIActivity.java
new file mode 100644
index 000000000..542741859
--- /dev/null
+++ b/ndk/platforms/android-18/samples/gles3jni/src/com/android/gles3jni/GLES3JNIActivity.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2013 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.gles3jni;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.WindowManager;
+
+import java.io.File;
+
+public class GLES3JNIActivity extends Activity {
+
+ GLES3JNIView mView;
+
+ @Override protected void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+ mView = new GLES3JNIView(getApplication());
+ setContentView(mView);
+ }
+
+ @Override protected void onPause() {
+ super.onPause();
+ mView.onPause();
+ }
+
+ @Override protected void onResume() {
+ super.onResume();
+ mView.onResume();
+ }
+}
diff --git a/samples/BrowserPlugin/res/values/strings.xml b/ndk/platforms/android-18/samples/gles3jni/src/com/android/gles3jni/GLES3JNILib.java
index 1f8dd4946..811658ff0 100644
--- a/samples/BrowserPlugin/res/values/strings.xml
+++ b/ndk/platforms/android-18/samples/gles3jni/src/com/android/gles3jni/GLES3JNILib.java
@@ -1,6 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2009 The Android Open Source Project
+/*
+ * Copyright 2013 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.
@@ -13,7 +12,19 @@
* 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.
--->
-<resources>
- <string name="sample_browser_plugin">Sample Browser Plugin</string>
-</resources>
+ */
+
+package com.android.gles3jni;
+
+// Wrapper for native library
+
+public class GLES3JNILib {
+
+ static {
+ System.loadLibrary("gles3jni");
+ }
+
+ public static native void init();
+ public static native void resize(int width, int height);
+ public static native void step();
+}
diff --git a/ndk/platforms/android-18/samples/gles3jni/src/com/android/gles3jni/GLES3JNIView.java b/ndk/platforms/android-18/samples/gles3jni/src/com/android/gles3jni/GLES3JNIView.java
new file mode 100644
index 000000000..12624fdf1
--- /dev/null
+++ b/ndk/platforms/android-18/samples/gles3jni/src/com/android/gles3jni/GLES3JNIView.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2013 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.gles3jni;
+
+import android.content.Context;
+import android.graphics.PixelFormat;
+import android.opengl.GLSurfaceView;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+
+import javax.microedition.khronos.egl.EGL10;
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.egl.EGLContext;
+import javax.microedition.khronos.egl.EGLDisplay;
+import javax.microedition.khronos.opengles.GL10;
+
+class GLES3JNIView extends GLSurfaceView {
+ private static final String TAG = "GLES3JNI";
+ private static final boolean DEBUG = true;
+
+ public GLES3JNIView(Context context) {
+ super(context);
+ // Pick an EGLConfig with RGB8 color, 16-bit depth, no stencil,
+ // supporting OpenGL ES 2.0 or later backwards-compatible versions.
+ setEGLConfigChooser(8, 8, 8, 0, 16, 0);
+ setEGLContextClientVersion(2);
+ setRenderer(new Renderer());
+ }
+
+ private static class Renderer implements GLSurfaceView.Renderer {
+ public void onDrawFrame(GL10 gl) {
+ GLES3JNILib.step();
+ }
+
+ public void onSurfaceChanged(GL10 gl, int width, int height) {
+ GLES3JNILib.resize(width, height);
+ }
+
+ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+ GLES3JNILib.init();
+ }
+ }
+}
diff --git a/ndk/platforms/android-3/arch-arm/include/asm/socket.h b/ndk/platforms/android-3/arch-arm/include/asm/socket.h
index 1f0050ae1..0741bad58 100644
--- a/ndk/platforms/android-3/arch-arm/include/asm/socket.h
+++ b/ndk/platforms/android-3/arch-arm/include/asm/socket.h
@@ -7,55 +7,73 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
****************************************************************************
****************************************************************************/
#ifndef _ASMARM_SOCKET_H
#define _ASMARM_SOCKET_H
-
#include <asm/sockios.h>
-
#define SOL_SOCKET 1
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SO_DEBUG 1
#define SO_REUSEADDR 2
#define SO_TYPE 3
#define SO_ERROR 4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SO_DONTROUTE 5
#define SO_BROADCAST 6
#define SO_SNDBUF 7
#define SO_RCVBUF 8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SO_SNDBUFFORCE 32
#define SO_RCVBUFFORCE 33
#define SO_KEEPALIVE 9
#define SO_OOBINLINE 10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SO_NO_CHECK 11
#define SO_PRIORITY 12
#define SO_LINGER 13
#define SO_BSDCOMPAT 14
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SO_PASSCRED 16
#define SO_PEERCRED 17
#define SO_RCVLOWAT 18
#define SO_SNDLOWAT 19
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SO_RCVTIMEO 20
#define SO_SNDTIMEO 21
-
#define SO_SECURITY_AUTHENTICATION 22
#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SO_SECURITY_ENCRYPTION_NETWORK 24
-
#define SO_BINDTODEVICE 25
-
#define SO_ATTACH_FILTER 26
#define SO_DETACH_FILTER 27
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SO_PEERNAME 28
#define SO_TIMESTAMP 29
#define SCM_TIMESTAMP SO_TIMESTAMP
-
#define SO_ACCEPTCONN 30
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SO_PEERSEC 31
#define SO_PASSSEC 34
-
+#define SO_TIMESTAMPNS 35
+#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_MARK 36
+#define SO_TIMESTAMPING 37
+#define SCM_TIMESTAMPING SO_TIMESTAMPING
+#define SO_PROTOCOL 38
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_DOMAIN 39
+#define SO_RXQ_OVFL 40
+#define SO_WIFI_STATUS 41
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
diff --git a/ndk/platforms/android-3/arch-arm/include/asm/unistd.h b/ndk/platforms/android-3/arch-arm/include/asm/unistd.h
index 9a30ddcb4..454ed899b 100644
--- a/ndk/platforms/android-3/arch-arm/include/asm/unistd.h
+++ b/ndk/platforms/android-3/arch-arm/include/asm/unistd.h
@@ -7,353 +7,480 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARM_UNISTD_H
#define __ASM_ARM_UNISTD_H
-
#define __NR_OABI_SYSCALL_BASE 0x900000
-
#if defined(__thumb__) || defined(__ARM_EABI__)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_SYSCALL_BASE 0
#else
#define __NR_SYSCALL_BASE __NR_OABI_SYSCALL_BASE
#endif
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_restart_syscall (__NR_SYSCALL_BASE+ 0)
#define __NR_exit (__NR_SYSCALL_BASE+ 1)
#define __NR_fork (__NR_SYSCALL_BASE+ 2)
#define __NR_read (__NR_SYSCALL_BASE+ 3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_write (__NR_SYSCALL_BASE+ 4)
#define __NR_open (__NR_SYSCALL_BASE+ 5)
#define __NR_close (__NR_SYSCALL_BASE+ 6)
-
#define __NR_creat (__NR_SYSCALL_BASE+ 8)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_link (__NR_SYSCALL_BASE+ 9)
#define __NR_unlink (__NR_SYSCALL_BASE+ 10)
#define __NR_execve (__NR_SYSCALL_BASE+ 11)
#define __NR_chdir (__NR_SYSCALL_BASE+ 12)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_time (__NR_SYSCALL_BASE+ 13)
#define __NR_mknod (__NR_SYSCALL_BASE+ 14)
#define __NR_chmod (__NR_SYSCALL_BASE+ 15)
#define __NR_lchown (__NR_SYSCALL_BASE+ 16)
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_lseek (__NR_SYSCALL_BASE+ 19)
#define __NR_getpid (__NR_SYSCALL_BASE+ 20)
#define __NR_mount (__NR_SYSCALL_BASE+ 21)
#define __NR_umount (__NR_SYSCALL_BASE+ 22)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_setuid (__NR_SYSCALL_BASE+ 23)
#define __NR_getuid (__NR_SYSCALL_BASE+ 24)
#define __NR_stime (__NR_SYSCALL_BASE+ 25)
#define __NR_ptrace (__NR_SYSCALL_BASE+ 26)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_alarm (__NR_SYSCALL_BASE+ 27)
-
#define __NR_pause (__NR_SYSCALL_BASE+ 29)
#define __NR_utime (__NR_SYSCALL_BASE+ 30)
-
#define __NR_access (__NR_SYSCALL_BASE+ 33)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_nice (__NR_SYSCALL_BASE+ 34)
-
#define __NR_sync (__NR_SYSCALL_BASE+ 36)
#define __NR_kill (__NR_SYSCALL_BASE+ 37)
#define __NR_rename (__NR_SYSCALL_BASE+ 38)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_mkdir (__NR_SYSCALL_BASE+ 39)
#define __NR_rmdir (__NR_SYSCALL_BASE+ 40)
#define __NR_dup (__NR_SYSCALL_BASE+ 41)
#define __NR_pipe (__NR_SYSCALL_BASE+ 42)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_times (__NR_SYSCALL_BASE+ 43)
-
#define __NR_brk (__NR_SYSCALL_BASE+ 45)
#define __NR_setgid (__NR_SYSCALL_BASE+ 46)
#define __NR_getgid (__NR_SYSCALL_BASE+ 47)
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_geteuid (__NR_SYSCALL_BASE+ 49)
#define __NR_getegid (__NR_SYSCALL_BASE+ 50)
#define __NR_acct (__NR_SYSCALL_BASE+ 51)
#define __NR_umount2 (__NR_SYSCALL_BASE+ 52)
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_ioctl (__NR_SYSCALL_BASE+ 54)
#define __NR_fcntl (__NR_SYSCALL_BASE+ 55)
-
#define __NR_setpgid (__NR_SYSCALL_BASE+ 57)
-
#define __NR_umask (__NR_SYSCALL_BASE+ 60)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_chroot (__NR_SYSCALL_BASE+ 61)
#define __NR_ustat (__NR_SYSCALL_BASE+ 62)
#define __NR_dup2 (__NR_SYSCALL_BASE+ 63)
#define __NR_getppid (__NR_SYSCALL_BASE+ 64)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getpgrp (__NR_SYSCALL_BASE+ 65)
#define __NR_setsid (__NR_SYSCALL_BASE+ 66)
#define __NR_sigaction (__NR_SYSCALL_BASE+ 67)
-
#define __NR_setreuid (__NR_SYSCALL_BASE+ 70)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_setregid (__NR_SYSCALL_BASE+ 71)
#define __NR_sigsuspend (__NR_SYSCALL_BASE+ 72)
#define __NR_sigpending (__NR_SYSCALL_BASE+ 73)
#define __NR_sethostname (__NR_SYSCALL_BASE+ 74)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_setrlimit (__NR_SYSCALL_BASE+ 75)
#define __NR_getrlimit (__NR_SYSCALL_BASE+ 76)
#define __NR_getrusage (__NR_SYSCALL_BASE+ 77)
#define __NR_gettimeofday (__NR_SYSCALL_BASE+ 78)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_settimeofday (__NR_SYSCALL_BASE+ 79)
#define __NR_getgroups (__NR_SYSCALL_BASE+ 80)
#define __NR_setgroups (__NR_SYSCALL_BASE+ 81)
#define __NR_select (__NR_SYSCALL_BASE+ 82)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_symlink (__NR_SYSCALL_BASE+ 83)
-
#define __NR_readlink (__NR_SYSCALL_BASE+ 85)
#define __NR_uselib (__NR_SYSCALL_BASE+ 86)
#define __NR_swapon (__NR_SYSCALL_BASE+ 87)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_reboot (__NR_SYSCALL_BASE+ 88)
#define __NR_readdir (__NR_SYSCALL_BASE+ 89)
#define __NR_mmap (__NR_SYSCALL_BASE+ 90)
#define __NR_munmap (__NR_SYSCALL_BASE+ 91)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_truncate (__NR_SYSCALL_BASE+ 92)
#define __NR_ftruncate (__NR_SYSCALL_BASE+ 93)
#define __NR_fchmod (__NR_SYSCALL_BASE+ 94)
#define __NR_fchown (__NR_SYSCALL_BASE+ 95)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getpriority (__NR_SYSCALL_BASE+ 96)
#define __NR_setpriority (__NR_SYSCALL_BASE+ 97)
-
#define __NR_statfs (__NR_SYSCALL_BASE+ 99)
#define __NR_fstatfs (__NR_SYSCALL_BASE+100)
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_socketcall (__NR_SYSCALL_BASE+102)
#define __NR_syslog (__NR_SYSCALL_BASE+103)
#define __NR_setitimer (__NR_SYSCALL_BASE+104)
#define __NR_getitimer (__NR_SYSCALL_BASE+105)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_stat (__NR_SYSCALL_BASE+106)
#define __NR_lstat (__NR_SYSCALL_BASE+107)
#define __NR_fstat (__NR_SYSCALL_BASE+108)
-
#define __NR_vhangup (__NR_SYSCALL_BASE+111)
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_syscall (__NR_SYSCALL_BASE+113)
#define __NR_wait4 (__NR_SYSCALL_BASE+114)
#define __NR_swapoff (__NR_SYSCALL_BASE+115)
#define __NR_sysinfo (__NR_SYSCALL_BASE+116)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_ipc (__NR_SYSCALL_BASE+117)
#define __NR_fsync (__NR_SYSCALL_BASE+118)
#define __NR_sigreturn (__NR_SYSCALL_BASE+119)
#define __NR_clone (__NR_SYSCALL_BASE+120)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_setdomainname (__NR_SYSCALL_BASE+121)
#define __NR_uname (__NR_SYSCALL_BASE+122)
-
#define __NR_adjtimex (__NR_SYSCALL_BASE+124)
#define __NR_mprotect (__NR_SYSCALL_BASE+125)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_sigprocmask (__NR_SYSCALL_BASE+126)
-
#define __NR_init_module (__NR_SYSCALL_BASE+128)
#define __NR_delete_module (__NR_SYSCALL_BASE+129)
-
#define __NR_quotactl (__NR_SYSCALL_BASE+131)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getpgid (__NR_SYSCALL_BASE+132)
#define __NR_fchdir (__NR_SYSCALL_BASE+133)
#define __NR_bdflush (__NR_SYSCALL_BASE+134)
#define __NR_sysfs (__NR_SYSCALL_BASE+135)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_personality (__NR_SYSCALL_BASE+136)
-
#define __NR_setfsuid (__NR_SYSCALL_BASE+138)
#define __NR_setfsgid (__NR_SYSCALL_BASE+139)
#define __NR__llseek (__NR_SYSCALL_BASE+140)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getdents (__NR_SYSCALL_BASE+141)
#define __NR__newselect (__NR_SYSCALL_BASE+142)
#define __NR_flock (__NR_SYSCALL_BASE+143)
#define __NR_msync (__NR_SYSCALL_BASE+144)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_readv (__NR_SYSCALL_BASE+145)
#define __NR_writev (__NR_SYSCALL_BASE+146)
#define __NR_getsid (__NR_SYSCALL_BASE+147)
#define __NR_fdatasync (__NR_SYSCALL_BASE+148)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR__sysctl (__NR_SYSCALL_BASE+149)
#define __NR_mlock (__NR_SYSCALL_BASE+150)
#define __NR_munlock (__NR_SYSCALL_BASE+151)
#define __NR_mlockall (__NR_SYSCALL_BASE+152)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_munlockall (__NR_SYSCALL_BASE+153)
#define __NR_sched_setparam (__NR_SYSCALL_BASE+154)
#define __NR_sched_getparam (__NR_SYSCALL_BASE+155)
#define __NR_sched_setscheduler (__NR_SYSCALL_BASE+156)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_sched_getscheduler (__NR_SYSCALL_BASE+157)
#define __NR_sched_yield (__NR_SYSCALL_BASE+158)
#define __NR_sched_get_priority_max (__NR_SYSCALL_BASE+159)
#define __NR_sched_get_priority_min (__NR_SYSCALL_BASE+160)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_sched_rr_get_interval (__NR_SYSCALL_BASE+161)
#define __NR_nanosleep (__NR_SYSCALL_BASE+162)
#define __NR_mremap (__NR_SYSCALL_BASE+163)
#define __NR_setresuid (__NR_SYSCALL_BASE+164)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getresuid (__NR_SYSCALL_BASE+165)
-
#define __NR_poll (__NR_SYSCALL_BASE+168)
#define __NR_nfsservctl (__NR_SYSCALL_BASE+169)
#define __NR_setresgid (__NR_SYSCALL_BASE+170)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getresgid (__NR_SYSCALL_BASE+171)
#define __NR_prctl (__NR_SYSCALL_BASE+172)
#define __NR_rt_sigreturn (__NR_SYSCALL_BASE+173)
#define __NR_rt_sigaction (__NR_SYSCALL_BASE+174)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_rt_sigprocmask (__NR_SYSCALL_BASE+175)
#define __NR_rt_sigpending (__NR_SYSCALL_BASE+176)
#define __NR_rt_sigtimedwait (__NR_SYSCALL_BASE+177)
#define __NR_rt_sigqueueinfo (__NR_SYSCALL_BASE+178)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_rt_sigsuspend (__NR_SYSCALL_BASE+179)
#define __NR_pread64 (__NR_SYSCALL_BASE+180)
#define __NR_pwrite64 (__NR_SYSCALL_BASE+181)
#define __NR_chown (__NR_SYSCALL_BASE+182)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getcwd (__NR_SYSCALL_BASE+183)
#define __NR_capget (__NR_SYSCALL_BASE+184)
#define __NR_capset (__NR_SYSCALL_BASE+185)
#define __NR_sigaltstack (__NR_SYSCALL_BASE+186)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_sendfile (__NR_SYSCALL_BASE+187)
-
#define __NR_vfork (__NR_SYSCALL_BASE+190)
#define __NR_ugetrlimit (__NR_SYSCALL_BASE+191)
#define __NR_mmap2 (__NR_SYSCALL_BASE+192)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_truncate64 (__NR_SYSCALL_BASE+193)
#define __NR_ftruncate64 (__NR_SYSCALL_BASE+194)
#define __NR_stat64 (__NR_SYSCALL_BASE+195)
#define __NR_lstat64 (__NR_SYSCALL_BASE+196)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_fstat64 (__NR_SYSCALL_BASE+197)
#define __NR_lchown32 (__NR_SYSCALL_BASE+198)
#define __NR_getuid32 (__NR_SYSCALL_BASE+199)
#define __NR_getgid32 (__NR_SYSCALL_BASE+200)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_geteuid32 (__NR_SYSCALL_BASE+201)
#define __NR_getegid32 (__NR_SYSCALL_BASE+202)
#define __NR_setreuid32 (__NR_SYSCALL_BASE+203)
#define __NR_setregid32 (__NR_SYSCALL_BASE+204)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getgroups32 (__NR_SYSCALL_BASE+205)
#define __NR_setgroups32 (__NR_SYSCALL_BASE+206)
#define __NR_fchown32 (__NR_SYSCALL_BASE+207)
#define __NR_setresuid32 (__NR_SYSCALL_BASE+208)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getresuid32 (__NR_SYSCALL_BASE+209)
#define __NR_setresgid32 (__NR_SYSCALL_BASE+210)
#define __NR_getresgid32 (__NR_SYSCALL_BASE+211)
#define __NR_chown32 (__NR_SYSCALL_BASE+212)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_setuid32 (__NR_SYSCALL_BASE+213)
#define __NR_setgid32 (__NR_SYSCALL_BASE+214)
#define __NR_setfsuid32 (__NR_SYSCALL_BASE+215)
#define __NR_setfsgid32 (__NR_SYSCALL_BASE+216)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getdents64 (__NR_SYSCALL_BASE+217)
#define __NR_pivot_root (__NR_SYSCALL_BASE+218)
#define __NR_mincore (__NR_SYSCALL_BASE+219)
#define __NR_madvise (__NR_SYSCALL_BASE+220)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_fcntl64 (__NR_SYSCALL_BASE+221)
-
#define __NR_gettid (__NR_SYSCALL_BASE+224)
#define __NR_readahead (__NR_SYSCALL_BASE+225)
#define __NR_setxattr (__NR_SYSCALL_BASE+226)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_lsetxattr (__NR_SYSCALL_BASE+227)
#define __NR_fsetxattr (__NR_SYSCALL_BASE+228)
#define __NR_getxattr (__NR_SYSCALL_BASE+229)
#define __NR_lgetxattr (__NR_SYSCALL_BASE+230)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_fgetxattr (__NR_SYSCALL_BASE+231)
#define __NR_listxattr (__NR_SYSCALL_BASE+232)
#define __NR_llistxattr (__NR_SYSCALL_BASE+233)
#define __NR_flistxattr (__NR_SYSCALL_BASE+234)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_removexattr (__NR_SYSCALL_BASE+235)
#define __NR_lremovexattr (__NR_SYSCALL_BASE+236)
#define __NR_fremovexattr (__NR_SYSCALL_BASE+237)
#define __NR_tkill (__NR_SYSCALL_BASE+238)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_sendfile64 (__NR_SYSCALL_BASE+239)
#define __NR_futex (__NR_SYSCALL_BASE+240)
#define __NR_sched_setaffinity (__NR_SYSCALL_BASE+241)
#define __NR_sched_getaffinity (__NR_SYSCALL_BASE+242)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_io_setup (__NR_SYSCALL_BASE+243)
#define __NR_io_destroy (__NR_SYSCALL_BASE+244)
#define __NR_io_getevents (__NR_SYSCALL_BASE+245)
#define __NR_io_submit (__NR_SYSCALL_BASE+246)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_io_cancel (__NR_SYSCALL_BASE+247)
#define __NR_exit_group (__NR_SYSCALL_BASE+248)
#define __NR_lookup_dcookie (__NR_SYSCALL_BASE+249)
#define __NR_epoll_create (__NR_SYSCALL_BASE+250)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_epoll_ctl (__NR_SYSCALL_BASE+251)
#define __NR_epoll_wait (__NR_SYSCALL_BASE+252)
#define __NR_remap_file_pages (__NR_SYSCALL_BASE+253)
-
#define __NR_set_tid_address (__NR_SYSCALL_BASE+256)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_timer_create (__NR_SYSCALL_BASE+257)
#define __NR_timer_settime (__NR_SYSCALL_BASE+258)
#define __NR_timer_gettime (__NR_SYSCALL_BASE+259)
#define __NR_timer_getoverrun (__NR_SYSCALL_BASE+260)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_timer_delete (__NR_SYSCALL_BASE+261)
#define __NR_clock_settime (__NR_SYSCALL_BASE+262)
#define __NR_clock_gettime (__NR_SYSCALL_BASE+263)
#define __NR_clock_getres (__NR_SYSCALL_BASE+264)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_clock_nanosleep (__NR_SYSCALL_BASE+265)
#define __NR_statfs64 (__NR_SYSCALL_BASE+266)
#define __NR_fstatfs64 (__NR_SYSCALL_BASE+267)
#define __NR_tgkill (__NR_SYSCALL_BASE+268)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_utimes (__NR_SYSCALL_BASE+269)
#define __NR_arm_fadvise64_64 (__NR_SYSCALL_BASE+270)
#define __NR_pciconfig_iobase (__NR_SYSCALL_BASE+271)
#define __NR_pciconfig_read (__NR_SYSCALL_BASE+272)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_pciconfig_write (__NR_SYSCALL_BASE+273)
#define __NR_mq_open (__NR_SYSCALL_BASE+274)
#define __NR_mq_unlink (__NR_SYSCALL_BASE+275)
#define __NR_mq_timedsend (__NR_SYSCALL_BASE+276)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_mq_timedreceive (__NR_SYSCALL_BASE+277)
#define __NR_mq_notify (__NR_SYSCALL_BASE+278)
#define __NR_mq_getsetattr (__NR_SYSCALL_BASE+279)
#define __NR_waitid (__NR_SYSCALL_BASE+280)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_socket (__NR_SYSCALL_BASE+281)
#define __NR_bind (__NR_SYSCALL_BASE+282)
#define __NR_connect (__NR_SYSCALL_BASE+283)
#define __NR_listen (__NR_SYSCALL_BASE+284)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_accept (__NR_SYSCALL_BASE+285)
#define __NR_getsockname (__NR_SYSCALL_BASE+286)
#define __NR_getpeername (__NR_SYSCALL_BASE+287)
#define __NR_socketpair (__NR_SYSCALL_BASE+288)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_send (__NR_SYSCALL_BASE+289)
#define __NR_sendto (__NR_SYSCALL_BASE+290)
#define __NR_recv (__NR_SYSCALL_BASE+291)
#define __NR_recvfrom (__NR_SYSCALL_BASE+292)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_shutdown (__NR_SYSCALL_BASE+293)
#define __NR_setsockopt (__NR_SYSCALL_BASE+294)
#define __NR_getsockopt (__NR_SYSCALL_BASE+295)
#define __NR_sendmsg (__NR_SYSCALL_BASE+296)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_recvmsg (__NR_SYSCALL_BASE+297)
#define __NR_semop (__NR_SYSCALL_BASE+298)
#define __NR_semget (__NR_SYSCALL_BASE+299)
#define __NR_semctl (__NR_SYSCALL_BASE+300)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_msgsnd (__NR_SYSCALL_BASE+301)
#define __NR_msgrcv (__NR_SYSCALL_BASE+302)
#define __NR_msgget (__NR_SYSCALL_BASE+303)
#define __NR_msgctl (__NR_SYSCALL_BASE+304)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_shmat (__NR_SYSCALL_BASE+305)
#define __NR_shmdt (__NR_SYSCALL_BASE+306)
#define __NR_shmget (__NR_SYSCALL_BASE+307)
#define __NR_shmctl (__NR_SYSCALL_BASE+308)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_add_key (__NR_SYSCALL_BASE+309)
#define __NR_request_key (__NR_SYSCALL_BASE+310)
#define __NR_keyctl (__NR_SYSCALL_BASE+311)
#define __NR_semtimedop (__NR_SYSCALL_BASE+312)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_vserver (__NR_SYSCALL_BASE+313)
#define __NR_ioprio_set (__NR_SYSCALL_BASE+314)
#define __NR_ioprio_get (__NR_SYSCALL_BASE+315)
#define __NR_inotify_init (__NR_SYSCALL_BASE+316)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_inotify_add_watch (__NR_SYSCALL_BASE+317)
#define __NR_inotify_rm_watch (__NR_SYSCALL_BASE+318)
#define __NR_mbind (__NR_SYSCALL_BASE+319)
#define __NR_get_mempolicy (__NR_SYSCALL_BASE+320)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_set_mempolicy (__NR_SYSCALL_BASE+321)
-
+#define __NR_openat (__NR_SYSCALL_BASE+322)
+#define __NR_mkdirat (__NR_SYSCALL_BASE+323)
+#define __NR_mknodat (__NR_SYSCALL_BASE+324)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fchownat (__NR_SYSCALL_BASE+325)
+#define __NR_futimesat (__NR_SYSCALL_BASE+326)
+#define __NR_fstatat64 (__NR_SYSCALL_BASE+327)
+#define __NR_unlinkat (__NR_SYSCALL_BASE+328)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_renameat (__NR_SYSCALL_BASE+329)
+#define __NR_linkat (__NR_SYSCALL_BASE+330)
+#define __NR_symlinkat (__NR_SYSCALL_BASE+331)
+#define __NR_readlinkat (__NR_SYSCALL_BASE+332)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fchmodat (__NR_SYSCALL_BASE+333)
+#define __NR_faccessat (__NR_SYSCALL_BASE+334)
+#define __NR_pselect6 (__NR_SYSCALL_BASE+335)
+#define __NR_ppoll (__NR_SYSCALL_BASE+336)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_unshare (__NR_SYSCALL_BASE+337)
+#define __NR_set_robust_list (__NR_SYSCALL_BASE+338)
+#define __NR_get_robust_list (__NR_SYSCALL_BASE+339)
+#define __NR_splice (__NR_SYSCALL_BASE+340)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_arm_sync_file_range (__NR_SYSCALL_BASE+341)
+#define __NR_sync_file_range2 __NR_arm_sync_file_range
+#define __NR_tee (__NR_SYSCALL_BASE+342)
+#define __NR_vmsplice (__NR_SYSCALL_BASE+343)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_move_pages (__NR_SYSCALL_BASE+344)
+#define __NR_getcpu (__NR_SYSCALL_BASE+345)
+#define __NR_epoll_pwait (__NR_SYSCALL_BASE+346)
+#define __NR_kexec_load (__NR_SYSCALL_BASE+347)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_utimensat (__NR_SYSCALL_BASE+348)
+#define __NR_signalfd (__NR_SYSCALL_BASE+349)
+#define __NR_timerfd_create (__NR_SYSCALL_BASE+350)
+#define __NR_eventfd (__NR_SYSCALL_BASE+351)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fallocate (__NR_SYSCALL_BASE+352)
+#define __NR_timerfd_settime (__NR_SYSCALL_BASE+353)
+#define __NR_timerfd_gettime (__NR_SYSCALL_BASE+354)
+#define __NR_signalfd4 (__NR_SYSCALL_BASE+355)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_eventfd2 (__NR_SYSCALL_BASE+356)
+#define __NR_epoll_create1 (__NR_SYSCALL_BASE+357)
+#define __NR_dup3 (__NR_SYSCALL_BASE+358)
+#define __NR_pipe2 (__NR_SYSCALL_BASE+359)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_inotify_init1 (__NR_SYSCALL_BASE+360)
+#define __NR_preadv (__NR_SYSCALL_BASE+361)
+#define __NR_pwritev (__NR_SYSCALL_BASE+362)
+#define __NR_rt_tgsigqueueinfo (__NR_SYSCALL_BASE+363)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_perf_event_open (__NR_SYSCALL_BASE+364)
+#define __NR_recvmmsg (__NR_SYSCALL_BASE+365)
+#define __NR_accept4 (__NR_SYSCALL_BASE+366)
+#define __NR_fanotify_init (__NR_SYSCALL_BASE+367)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fanotify_mark (__NR_SYSCALL_BASE+368)
+#define __NR_prlimit64 (__NR_SYSCALL_BASE+369)
+#define __NR_name_to_handle_at (__NR_SYSCALL_BASE+370)
+#define __NR_open_by_handle_at (__NR_SYSCALL_BASE+371)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_clock_adjtime (__NR_SYSCALL_BASE+372)
+#define __NR_syncfs (__NR_SYSCALL_BASE+373)
+#define __NR_sendmmsg (__NR_SYSCALL_BASE+374)
+#define __NR_setns (__NR_SYSCALL_BASE+375)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_process_vm_readv (__NR_SYSCALL_BASE+376)
+#define __NR_process_vm_writev (__NR_SYSCALL_BASE+377)
#define __ARM_NR_BASE (__NR_SYSCALL_BASE+0x0f0000)
#define __ARM_NR_breakpoint (__ARM_NR_BASE+1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __ARM_NR_cacheflush (__ARM_NR_BASE+2)
#define __ARM_NR_usr26 (__ARM_NR_BASE+3)
#define __ARM_NR_usr32 (__ARM_NR_BASE+4)
#define __ARM_NR_set_tls (__ARM_NR_BASE+5)
-
-#if defined(__ARM_EABI__) && !defined(__KERNEL__)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifdef __ARM_EABI__
#undef __NR_time
#undef __NR_umount
#undef __NR_stime
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#undef __NR_alarm
#undef __NR_utime
#undef __NR_getrlimit
#undef __NR_select
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#undef __NR_readdir
#undef __NR_mmap
#undef __NR_socketcall
#undef __NR_syscall
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#undef __NR_ipc
#endif
-
#endif
diff --git a/ndk/platforms/android-3/arch-arm/include/fenv.h b/ndk/platforms/android-3/arch-arm/include/fenv.h
index 534b12cbd..a96f99ed8 100644
--- a/ndk/platforms/android-3/arch-arm/include/fenv.h
+++ b/ndk/platforms/android-3/arch-arm/include/fenv.h
@@ -26,193 +26,151 @@
* $FreeBSD: src/lib/msun/arm/fenv.h,v 1.5 2005/03/16 19:03:45 das Exp $
*/
-#ifndef _FENV_H_
-#define _FENV_H_
+/*
+ * Rewritten for Android.
+ *
+ * The ARM FPSCR is described here:
+ * http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0344b/Chdfafia.html
+ */
+
+#ifndef _FENV_H_
+#define _FENV_H_
#include <sys/types.h>
__BEGIN_DECLS
-typedef uint32_t fenv_t;
-typedef uint32_t fexcept_t;
-
-/* Exception flags */
-#define FE_INVALID 0x0001
-#define FE_DIVBYZERO 0x0002
-#define FE_OVERFLOW 0x0004
-#define FE_UNDERFLOW 0x0008
-#define FE_INEXACT 0x0010
-#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_INEXACT | \
- FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
-
-/* Rounding modes */
-#define FE_TONEAREST 0x0000
-#define FE_TOWARDZERO 0x0001
-#define FE_UPWARD 0x0002
-#define FE_DOWNWARD 0x0003
-#define _ROUND_MASK (FE_TONEAREST | FE_DOWNWARD | \
- FE_UPWARD | FE_TOWARDZERO)
-
-/* Default floating-point environment */
-extern const fenv_t __fe_dfl_env;
-#define FE_DFL_ENV (&__fe_dfl_env)
-
-/* We need to be able to map status flag positions to mask flag positions */
-#define _FPUSW_SHIFT 16
-#define _ENABLE_MASK (FE_ALL_EXCEPT << _FPUSW_SHIFT)
-
-#ifdef ARM_HARD_FLOAT
-#define __rfs(__fpsr) __asm __volatile("rfs %0" : "=r" (*(__fpsr)))
-#define __wfs(__fpsr) __asm __volatile("wfs %0" : : "r" (__fpsr))
-#else
-#define __rfs(__fpsr)
-#define __wfs(__fpsr)
-#endif
-
-static __inline int
-feclearexcept(int __excepts)
-{
- fexcept_t __fpsr;
-
- __rfs(&__fpsr);
- __fpsr &= ~__excepts;
- __wfs(__fpsr);
- return (0);
+typedef __uint32_t fenv_t;
+typedef __uint32_t fexcept_t;
+
+/* Exception flags. */
+#define FE_INVALID 0x01
+#define FE_DIVBYZERO 0x02
+#define FE_OVERFLOW 0x04
+#define FE_UNDERFLOW 0x08
+#define FE_INEXACT 0x10
+#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
+#define _FPSCR_ENABLE_SHIFT 8
+#define _FPSCR_ENABLE_MASK (FE_ALL_EXCEPT << _FPSCR_ENABLE_SHIFT)
+
+/* Rounding modes. */
+#define FE_TONEAREST 0x0
+#define FE_UPWARD 0x1
+#define FE_DOWNWARD 0x2
+#define FE_TOWARDZERO 0x3
+#define _FPSCR_RMODE_SHIFT 22
+
+/* Default floating-point environment. */
+extern const fenv_t __fe_dfl_env;
+#define FE_DFL_ENV (&__fe_dfl_env)
+
+static __inline int fegetenv(fenv_t* __envp) {
+ fenv_t _fpscr;
+ __asm__ __volatile__("vmrs %0,fpscr" : "=r" (_fpscr));
+ *__envp = _fpscr;
+ return 0;
}
-static __inline int
-fegetexceptflag(fexcept_t *__flagp, int __excepts)
-{
- fexcept_t __fpsr;
-
- __rfs(&__fpsr);
- *__flagp = __fpsr & __excepts;
- return (0);
+static __inline int fesetenv(const fenv_t* __envp) {
+ fenv_t _fpscr = *__envp;
+ __asm__ __volatile__("vmsr fpscr,%0" : :"ri" (_fpscr));
+ return 0;
}
-static __inline int
-fesetexceptflag(const fexcept_t *__flagp, int __excepts)
-{
- fexcept_t __fpsr;
-
- __rfs(&__fpsr);
- __fpsr &= ~__excepts;
- __fpsr |= *__flagp & __excepts;
- __wfs(__fpsr);
- return (0);
+static __inline int feclearexcept(int __excepts) {
+ fexcept_t __fpscr;
+ fegetenv(&__fpscr);
+ __fpscr &= ~__excepts;
+ fesetenv(&__fpscr);
+ return 0;
}
-static __inline int
-feraiseexcept(int __excepts)
-{
- fexcept_t __ex = __excepts;
-
- fesetexceptflag(&__ex, __excepts); /* XXX */
- return (0);
+static __inline int fegetexceptflag(fexcept_t* __flagp, int __excepts) {
+ fexcept_t __fpscr;
+ fegetenv(&__fpscr);
+ *__flagp = __fpscr & __excepts;
+ return 0;
}
-static __inline int
-fetestexcept(int __excepts)
-{
- fexcept_t __fpsr;
-
- __rfs(&__fpsr);
- return (__fpsr & __excepts);
+static __inline int fesetexceptflag(const fexcept_t* __flagp, int __excepts) {
+ fexcept_t __fpscr;
+ fegetenv(&__fpscr);
+ __fpscr &= ~__excepts;
+ __fpscr |= *__flagp & __excepts;
+ fesetenv(&__fpscr);
+ return 0;
}
-static __inline int
-fegetround(void)
-{
-
- /*
- * Apparently, the rounding mode is specified as part of the
- * instruction format on ARM, so the dynamic rounding mode is
- * indeterminate. Some FPUs may differ.
- */
- return (-1);
+static __inline int feraiseexcept(int __excepts) {
+ fexcept_t __ex = __excepts;
+ fesetexceptflag(&__ex, __excepts);
+ return 0;
}
-static __inline int
-fesetround(int __round)
-{
-
- return (-1);
+static __inline int fetestexcept(int __excepts) {
+ fexcept_t __fpscr;
+ fegetenv(&__fpscr);
+ return (__fpscr & __excepts);
}
-static __inline int
-fegetenv(fenv_t *__envp)
-{
-
- __rfs(__envp);
- return (0);
+static __inline int fegetround(void) {
+ fenv_t _fpscr;
+ fegetenv(&_fpscr);
+ return ((_fpscr >> _FPSCR_RMODE_SHIFT) & 0x3);
}
-static __inline int
-feholdexcept(fenv_t *__envp)
-{
- fenv_t __env;
-
- __rfs(&__env);
- *__envp = __env;
- __env &= ~(FE_ALL_EXCEPT | _ENABLE_MASK);
- __wfs(__env);
- return (0);
+static __inline int fesetround(int __round) {
+ fenv_t _fpscr;
+ fegetenv(&_fpscr);
+ _fpscr &= ~(0x3 << _FPSCR_RMODE_SHIFT);
+ _fpscr |= (__round << _FPSCR_RMODE_SHIFT);
+ fesetenv(&_fpscr);
+ return 0;
}
-static __inline int
-fesetenv(const fenv_t *__envp)
-{
-
- __wfs(*__envp);
- return (0);
+static __inline int feholdexcept(fenv_t* __envp) {
+ fenv_t __env;
+ fegetenv(&__env);
+ *__envp = __env;
+ __env &= ~(FE_ALL_EXCEPT | _FPSCR_ENABLE_MASK);
+ fesetenv(&__env);
+ return 0;
}
-static __inline int
-feupdateenv(const fenv_t *__envp)
-{
- fexcept_t __fpsr;
-
- __rfs(&__fpsr);
- __wfs(*__envp);
- feraiseexcept(__fpsr & FE_ALL_EXCEPT);
- return (0);
+static __inline int feupdateenv(const fenv_t* __envp) {
+ fexcept_t __fpscr;
+ fegetenv(&__fpscr);
+ fesetenv(__envp);
+ feraiseexcept(__fpscr & FE_ALL_EXCEPT);
+ return 0;
}
#if __BSD_VISIBLE
-static __inline int
-feenableexcept(int __mask)
-{
- fenv_t __old_fpsr, __new_fpsr;
-
- __rfs(&__old_fpsr);
- __new_fpsr = __old_fpsr | (__mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT;
- __wfs(__new_fpsr);
- return ((__old_fpsr >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
+static __inline int feenableexcept(int __mask) {
+ fenv_t __old_fpscr, __new_fpscr;
+ fegetenv(&__old_fpscr);
+ __new_fpscr = __old_fpscr | (__mask & FE_ALL_EXCEPT) << _FPSCR_ENABLE_SHIFT;
+ fesetenv(&__new_fpscr);
+ return ((__old_fpscr >> _FPSCR_ENABLE_SHIFT) & FE_ALL_EXCEPT);
}
-static __inline int
-fedisableexcept(int __mask)
-{
- fenv_t __old_fpsr, __new_fpsr;
-
- __rfs(&__old_fpsr);
- __new_fpsr = __old_fpsr & ~((__mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT);
- __wfs(__new_fpsr);
- return ((__old_fpsr >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
+static __inline int fedisableexcept(int __mask) {
+ fenv_t __old_fpscr, __new_fpscr;
+ fegetenv(&__old_fpscr);
+ __new_fpscr = __old_fpscr & ~((__mask & FE_ALL_EXCEPT) << _FPSCR_ENABLE_SHIFT);
+ fesetenv(&__new_fpscr);
+ return ((__old_fpscr >> _FPSCR_ENABLE_SHIFT) & FE_ALL_EXCEPT);
}
-static __inline int
-fegetexcept(void)
-{
- fenv_t __fpsr;
-
- __rfs(&__fpsr);
- return ((__fpsr & _ENABLE_MASK) >> _FPUSW_SHIFT);
+static __inline int fegetexcept(void) {
+ fenv_t __fpscr;
+ fegetenv(&__fpscr);
+ return ((__fpscr & _FPSCR_ENABLE_MASK) >> _FPSCR_ENABLE_SHIFT);
}
#endif /* __BSD_VISIBLE */
__END_DECLS
-#endif /* !_FENV_H_ */
+#endif /* !_FENV_H_ */
diff --git a/ndk/platforms/android-3/arch-arm/include/machine/_types.h b/ndk/platforms/android-3/arch-arm/include/machine/_types.h
index 3e779ca85..1521a4c6c 100644
--- a/ndk/platforms/android-3/arch-arm/include/machine/_types.h
+++ b/ndk/platforms/android-3/arch-arm/include/machine/_types.h
@@ -35,17 +35,6 @@
#ifndef _ARM__TYPES_H_
#define _ARM__TYPES_H_
-
-#if !defined(__ARM_EABI__)
-/* the kernel defines size_t as unsigned int, but g++ wants it to be unsigned long */
-#define _SIZE_T
-#define _SSIZE_T
-#define _PTRDIFF_T
-typedef unsigned long size_t;
-typedef long ssize_t;
-typedef long ptrdiff_t;
-#endif
-
/* 7.18.1.1 Exact-width integer types */
typedef __signed char __int8_t;
typedef unsigned char __uint8_t;
@@ -116,10 +105,4 @@ typedef int __rune_t;
typedef void * __wctrans_t;
typedef void * __wctype_t;
-#ifdef __ARMEB__
-#define _BYTE_ORDER _BIG_ENDIAN
-#else
-#define _BYTE_ORDER _LITTLE_ENDIAN
-#endif
-
#endif /* _ARM__TYPES_H_ */
diff --git a/ndk/platforms/android-3/arch-arm/include/machine/endian.h b/ndk/platforms/android-3/arch-arm/include/machine/endian.h
new file mode 100644
index 000000000..7cba3b942
--- /dev/null
+++ b/ndk/platforms/android-3/arch-arm/include/machine/endian.h
@@ -0,0 +1,89 @@
+/* $OpenBSD: endian.h,v 1.3 2005/12/13 00:35:23 millert Exp $ */
+
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _ARM_ENDIAN_H_
+#define _ARM_ENDIAN_H_
+
+#ifdef __GNUC__
+
+/*
+ * REV and REV16 weren't available on ARM5 or ARM4.
+ * We don't include <machine/cpu-features.h> because it pollutes the
+ * namespace with macros like PLD.
+ */
+#if !defined __ARM_ARCH_5__ && !defined __ARM_ARCH_5T__ && \
+ !defined __ARM_ARCH_5TE__ && !defined __ARM_ARCH_5TEJ__ && \
+ !defined __ARM_ARCH_4T__ && !defined __ARM_ARCH_4__
+
+/* According to RealView Assembler User's Guide, REV and REV16 are available
+ * in Thumb code and 16-bit instructions when used in Thumb-2 code.
+ *
+ * REV Rd, Rm
+ * Rd and Rm must both be Lo registers.
+ *
+ * REV16 Rd, Rm
+ * Rd and Rm must both be Lo registers.
+ *
+ * The +l constraint takes care of this without constraining us in ARM mode.
+ */
+#define __swap16md(x) ({ \
+ register u_int16_t _x = (x); \
+ __asm volatile ("rev16 %0, %0" : "+l" (_x)); \
+ _x; \
+})
+
+#define __swap32md(x) ({ \
+ register u_int32_t _x = (x); \
+ __asm volatile ("rev %0, %0" : "+l" (_x)); \
+ _x; \
+})
+
+#define __swap64md(x) ({ \
+ u_int64_t _swap64md_x = (x); \
+ (u_int64_t) __swap32md(_swap64md_x >> 32) | \
+ (u_int64_t) __swap32md(_swap64md_x & 0xffffffff) << 32; \
+})
+
+/* Tell sys/endian.h we have MD variants of the swap macros. */
+#define MD_SWAP
+
+#endif /* __ARM_ARCH__ */
+#endif /* __GNUC__ */
+
+#if defined(__ARMEB__)
+#define _BYTE_ORDER _BIG_ENDIAN
+#else
+#define _BYTE_ORDER _LITTLE_ENDIAN
+#endif
+#define __STRICT_ALIGNMENT
+#include <sys/types.h>
+#include <sys/endian.h>
+
+#endif /* !_ARM_ENDIAN_H_ */
diff --git a/ndk/platforms/android-3/arch-arm/lib-bootstrap/crtbegin_dynamic.o b/ndk/platforms/android-3/arch-arm/lib-bootstrap/crtbegin_dynamic.o
new file mode 100644
index 000000000..fdcd6d683
--- /dev/null
+++ b/ndk/platforms/android-3/arch-arm/lib-bootstrap/crtbegin_dynamic.o
Binary files differ
diff --git a/ndk/platforms/android-3/arch-arm/lib-bootstrap/crtend_android.o b/ndk/platforms/android-3/arch-arm/lib-bootstrap/crtend_android.o
new file mode 100644
index 000000000..50caf05a8
--- /dev/null
+++ b/ndk/platforms/android-3/arch-arm/lib-bootstrap/crtend_android.o
Binary files differ
diff --git a/ndk/platforms/android-3/arch-arm/lib-bootstrap/libc.so b/ndk/platforms/android-3/arch-arm/lib-bootstrap/libc.so
new file mode 100755
index 000000000..8f73f670a
--- /dev/null
+++ b/ndk/platforms/android-3/arch-arm/lib-bootstrap/libc.so
Binary files differ
diff --git a/ndk/platforms/android-3/arch-arm/lib-bootstrap/libdl.so b/ndk/platforms/android-3/arch-arm/lib-bootstrap/libdl.so
new file mode 100755
index 000000000..18ddd3b38
--- /dev/null
+++ b/ndk/platforms/android-3/arch-arm/lib-bootstrap/libdl.so
Binary files differ
diff --git a/ndk/platforms/android-3/arch-arm/symbols/libc.so.functions.txt b/ndk/platforms/android-3/arch-arm/symbols/libc.so.functions.txt
index 814ce1916..4e4b92914 100644
--- a/ndk/platforms/android-3/arch-arm/symbols/libc.so.functions.txt
+++ b/ndk/platforms/android-3/arch-arm/symbols/libc.so.functions.txt
@@ -241,7 +241,6 @@ __rt_sigaction
__rt_sigprocmask
__rt_sigtimedwait
__sclose
-__set_errno
__set_syscall_errno
__set_tls
__sflags
diff --git a/ndk/platforms/android-3/include/asm-generic/mman-common.h b/ndk/platforms/android-3/include/asm-generic/mman-common.h
new file mode 100644
index 000000000..157353b57
--- /dev/null
+++ b/ndk/platforms/android-3/include/asm-generic/mman-common.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_GENERIC_MMAN_COMMON_H
+#define __ASM_GENERIC_MMAN_COMMON_H
+#define PROT_READ 0x1
+#define PROT_WRITE 0x2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PROT_EXEC 0x4
+#define PROT_SEM 0x8
+#define PROT_NONE 0x0
+#define PROT_GROWSDOWN 0x01000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PROT_GROWSUP 0x02000000
+#define MAP_SHARED 0x01
+#define MAP_PRIVATE 0x02
+#define MAP_TYPE 0x0f
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAP_FIXED 0x10
+#define MAP_ANONYMOUS 0x20
+#define MAP_UNINITIALIZED 0x0
+#define MS_ASYNC 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MS_INVALIDATE 2
+#define MS_SYNC 4
+#define MADV_NORMAL 0
+#define MADV_RANDOM 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MADV_SEQUENTIAL 2
+#define MADV_WILLNEED 3
+#define MADV_DONTNEED 4
+#define MADV_REMOVE 9
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MADV_DONTFORK 10
+#define MADV_DOFORK 11
+#define MADV_HWPOISON 100
+#define MADV_SOFT_OFFLINE 101
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MADV_MERGEABLE 12
+#define MADV_UNMERGEABLE 13
+#define MADV_HUGEPAGE 14
+#define MADV_NOHUGEPAGE 15
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAP_FILE 0
+#endif
diff --git a/ndk/platforms/android-3/include/asm-generic/mman.h b/ndk/platforms/android-3/include/asm-generic/mman.h
index 98d278303..6eaf90061 100644
--- a/ndk/platforms/android-3/include/asm-generic/mman.h
+++ b/ndk/platforms/android-3/include/asm-generic/mman.h
@@ -7,40 +7,30 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
****************************************************************************
****************************************************************************/
-#ifndef _ASM_GENERIC_MMAN_H
-#define _ASM_GENERIC_MMAN_H
-
-#define PROT_READ 0x1
-#define PROT_WRITE 0x2
-#define PROT_EXEC 0x4
-#define PROT_SEM 0x8
-#define PROT_NONE 0x0
-#define PROT_GROWSDOWN 0x01000000
-#define PROT_GROWSUP 0x02000000
-
-#define MAP_SHARED 0x01
-#define MAP_PRIVATE 0x02
-#define MAP_TYPE 0x0f
-#define MAP_FIXED 0x10
-#define MAP_ANONYMOUS 0x20
-
-#define MS_ASYNC 1
-#define MS_INVALIDATE 2
-#define MS_SYNC 4
-
-#define MADV_NORMAL 0
-#define MADV_RANDOM 1
-#define MADV_SEQUENTIAL 2
-#define MADV_WILLNEED 3
-#define MADV_DONTNEED 4
-
-#define MADV_REMOVE 9
-#define MADV_DONTFORK 10
-#define MADV_DOFORK 11
-
-#define MAP_ANON MAP_ANONYMOUS
-#define MAP_FILE 0
-
+#ifndef __ASM_GENERIC_MMAN_H
+#define __ASM_GENERIC_MMAN_H
+#include <asm-generic/mman-common.h>
+#define MAP_GROWSDOWN 0x0100
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAP_DENYWRITE 0x0800
+#define MAP_EXECUTABLE 0x1000
+#define MAP_LOCKED 0x2000
+#define MAP_NORESERVE 0x4000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAP_POPULATE 0x8000
+#define MAP_NONBLOCK 0x10000
+#define MAP_STACK 0x20000
+#define MAP_HUGETLB 0x40000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MCL_CURRENT 1
+#define MCL_FUTURE 2
#endif
diff --git a/ndk/platforms/android-3/include/asm-generic/pgtable-nopmd.h b/ndk/platforms/android-3/include/asm-generic/pgtable-nopmd.h
new file mode 100644
index 000000000..ac3f40c50
--- /dev/null
+++ b/ndk/platforms/android-3/include/asm-generic/pgtable-nopmd.h
@@ -0,0 +1,48 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _PGTABLE_NOPMD_H
+#define _PGTABLE_NOPMD_H
+#ifndef __ASSEMBLY__
+#include <asm-generic/pgtable-nopud.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct mm_struct;
+#define __PAGETABLE_PMD_FOLDED
+typedef struct { pud_t pud; } pmd_t;
+#define PMD_SHIFT PUD_SHIFT
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTRS_PER_PMD 1
+#define PMD_SIZE (1UL << PMD_SHIFT)
+#define PMD_MASK (~(PMD_SIZE-1))
+#define pmd_ERROR(pmd) (pud_ERROR((pmd).pud))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define pud_populate(mm, pmd, pte) do { } while (0)
+#define set_pud(pudptr, pudval) set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval })
+#define pmd_val(x) (pud_val((x).pud))
+#define __pmd(x) ((pmd_t) { __pud(x) } )
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define pud_page(pud) (pmd_page((pmd_t){ pud }))
+#define pud_page_vaddr(pud) (pmd_page_vaddr((pmd_t){ pud }))
+#define pmd_alloc_one(mm, address) NULL
+#define __pmd_free_tlb(tlb, x, a) do { } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#undef pmd_addr_end
+#define pmd_addr_end(addr, end) (end)
+#endif
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/ndk/platforms/android-3/include/asm-generic/socket.h b/ndk/platforms/android-3/include/asm-generic/socket.h
new file mode 100644
index 000000000..fb3876e28
--- /dev/null
+++ b/ndk/platforms/android-3/include/asm-generic/socket.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_GENERIC_SOCKET_H
+#define __ASM_GENERIC_SOCKET_H
+#include <asm/sockios.h>
+#define SOL_SOCKET 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_DEBUG 1
+#define SO_REUSEADDR 2
+#define SO_TYPE 3
+#define SO_ERROR 4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_DONTROUTE 5
+#define SO_BROADCAST 6
+#define SO_SNDBUF 7
+#define SO_RCVBUF 8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_SNDBUFFORCE 32
+#define SO_RCVBUFFORCE 33
+#define SO_KEEPALIVE 9
+#define SO_OOBINLINE 10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_NO_CHECK 11
+#define SO_PRIORITY 12
+#define SO_LINGER 13
+#define SO_BSDCOMPAT 14
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef SO_PASSCRED
+#define SO_PASSCRED 16
+#define SO_PEERCRED 17
+#define SO_RCVLOWAT 18
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_SNDLOWAT 19
+#define SO_RCVTIMEO 20
+#define SO_SNDTIMEO 21
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_SECURITY_AUTHENTICATION 22
+#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
+#define SO_SECURITY_ENCRYPTION_NETWORK 24
+#define SO_BINDTODEVICE 25
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_ATTACH_FILTER 26
+#define SO_DETACH_FILTER 27
+#define SO_PEERNAME 28
+#define SO_TIMESTAMP 29
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SCM_TIMESTAMP SO_TIMESTAMP
+#define SO_ACCEPTCONN 30
+#define SO_PEERSEC 31
+#define SO_PASSSEC 34
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_TIMESTAMPNS 35
+#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
+#define SO_MARK 36
+#define SO_TIMESTAMPING 37
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SCM_TIMESTAMPING SO_TIMESTAMPING
+#define SO_PROTOCOL 38
+#define SO_DOMAIN 39
+#define SO_RXQ_OVFL 40
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_WIFI_STATUS 41
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+#endif
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/asmmacro.h b/ndk/platforms/android-3/include/asm-generic/swab.h
index e1e9804a4..8279332d3 100644
--- a/ndk/platforms/android-9/arch-mips/include/asm/asmmacro.h
+++ b/ndk/platforms/android-3/include/asm-generic/swab.h
@@ -16,8 +16,14 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _ASM_ASMMACRO_H
-#define _ASM_ASMMACRO_H
-#include <asm/hazards.h>
+#ifndef _ASM_GENERIC_SWAB_H
+#define _ASM_GENERIC_SWAB_H
+#include <asm/bitsperlong.h>
+#if __BITS_PER_LONG == 32
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#if defined(__GNUC__) && (!defined(__STRICT_ANSI__) || defined(__KERNEL__))
+#define __SWAB_64_THRU_32__
+#endif
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/ndk/platforms/android-3/include/byteswap.h b/ndk/platforms/android-3/include/byteswap.h
index 16d2ad4f9..74b0e9180 100644
--- a/ndk/platforms/android-3/include/byteswap.h
+++ b/ndk/platforms/android-3/include/byteswap.h
@@ -28,7 +28,8 @@
#ifndef _BYTESWAP_H_
#define _BYTESWAP_H_
-#include <sys/endian.h>
+/* endian.h rather than sys/endian.h so we get the machine-specific file. */
+#include <endian.h>
#define bswap_16(x) swap16(x)
#define bswap_32(x) swap32(x)
diff --git a/ndk/platforms/android-3/include/dirent.h b/ndk/platforms/android-3/include/dirent.h
index 55eef7b52..f0a1e1707 100644
--- a/ndk/platforms/android-3/include/dirent.h
+++ b/ndk/platforms/android-3/include/dirent.h
@@ -51,28 +51,29 @@ __BEGIN_DECLS
* who assume to be able to access it directly. sad...
*/
struct dirent {
- uint64_t d_ino;
- int64_t d_off;
- unsigned short d_reclen;
- unsigned char d_type;
- char d_name[256];
+ uint64_t d_ino;
+ int64_t d_off;
+ unsigned short d_reclen;
+ unsigned char d_type;
+ char d_name[256];
};
-typedef struct DIR DIR;
+typedef struct DIR DIR;
-extern int getdents(unsigned int, struct dirent*, unsigned int);
-extern DIR* opendir(const char* dirpath);
+extern DIR* opendir(const char* dirpath);
extern DIR* fdopendir(int fd);
-extern struct dirent* readdir(DIR* dirp);
-extern int readdir_r(DIR* dirp, struct dirent *entry, struct dirent **result);
-extern int closedir(DIR* dirp);
-extern void rewinddir(DIR *dirp);
+extern struct dirent* readdir(DIR* dirp);
+extern int readdir_r(DIR* dirp, struct dirent* entry, struct dirent** result);
+extern int closedir(DIR* dirp);
+extern void rewinddir(DIR* dirp);
extern int dirfd(DIR* dirp);
-extern int alphasort(const void *a, const void *b);
-extern int scandir(const char *dir, struct dirent ***namelist,
- int(*filter)(const struct dirent *),
- int(*compar)(const struct dirent **,
- const struct dirent **));
+extern int alphasort(const struct dirent** a, const struct dirent** b);
+extern int scandir(const char* dir, struct dirent*** namelist,
+ int(*filter)(const struct dirent*),
+ int(*compar)(const struct dirent**,
+ const struct dirent**));
+
+extern int getdents(unsigned int, struct dirent*, unsigned int);
__END_DECLS
diff --git a/ndk/platforms/android-3/include/elf.h b/ndk/platforms/android-3/include/elf.h
index 8a86a6390..cb8ffb77c 100644
--- a/ndk/platforms/android-3/include/elf.h
+++ b/ndk/platforms/android-3/include/elf.h
@@ -52,7 +52,22 @@ enum {
AT_SECURE = 23
};
+#include <stdint.h>
#include <sys/exec_elf.h>
+typedef struct {
+ uint32_t a_type;
+ union {
+ uint32_t a_val;
+ } a_un;
+} Elf32_auxv_t;
+
+typedef struct {
+ uint64_t a_type;
+ union {
+ uint64_t a_val;
+ } a_un;
+} Elf64_auxv_t;
+
#endif /* _ELF_H */
diff --git a/ndk/platforms/android-3/include/errno.h b/ndk/platforms/android-3/include/errno.h
index 2b2685af4..b97f6d2e3 100644
--- a/ndk/platforms/android-3/include/errno.h
+++ b/ndk/platforms/android-3/include/errno.h
@@ -36,20 +36,24 @@ __BEGIN_DECLS
/* on Linux, ENOTSUP and EOPNOTSUPP are defined as the same error code
* even if 1000.3 states that they should be different
*/
-#ifndef ENOTUP
+#ifndef ENOTSUP
#define ENOTSUP EOPNOTSUPP
#endif
-/* internal function that should *only* be called from system calls */
-/* use errno = xxxx instead in C code */
-extern int __set_errno(int error);
-
/* internal function returning the address of the thread-specific errno */
extern volatile int* __errno(void);
/* a macro expanding to the errno l-value */
#define errno (*__errno())
+/* internal function that should *only* be called from system calls */
+/* use errno = xxxx instead in C code */
+static __inline__ int __attribute__((deprecated))
+__set_errno(int n) {
+ errno = n;
+ return -1;
+}
+
__END_DECLS
#endif /* _ERRNO_H */
diff --git a/ndk/platforms/android-3/include/limits.h b/ndk/platforms/android-3/include/limits.h
index 1de8ea611..b9d435450 100644
--- a/ndk/platforms/android-3/include/limits.h
+++ b/ndk/platforms/android-3/include/limits.h
@@ -89,7 +89,24 @@
#include <sys/syslimits.h>
#endif
+/* GLibc compatibility definitions.
+ Note that these are defined by GCC's <limits.h>
+ only when __GNU_LIBRARY__ is defined, i.e. when
+ targetting GLibc. */
+#ifndef LONG_LONG_MIN
+#define LONG_LONG_MIN LLONG_MIN
+#endif
+
+#ifndef LONG_LONG_MAX
+#define LONG_LONG_MAX LLONG_MAX
+#endif
+
+#ifndef ULONG_LONG_MAX
+#define ULONG_LONG_MAX ULLONG_MAX
+#endif
+
#ifndef PAGESIZE
+#include <asm/page.h>
#define PAGESIZE PAGE_SIZE
#endif
diff --git a/ndk/platforms/android-3/include/linux/icmp.h b/ndk/platforms/android-3/include/linux/icmp.h
index c5b58bb67..d69a0e249 100644
--- a/ndk/platforms/android-3/include/linux/icmp.h
+++ b/ndk/platforms/android-3/include/linux/icmp.h
@@ -66,7 +66,7 @@ struct icmphdr {
} echo;
__u32 gateway;
struct {
- __u16 __unused_field;
+ __u16 __linux_unused;
__u16 mtu;
} frag;
} un;
diff --git a/ndk/platforms/android-3/include/linux/stddef.h b/ndk/platforms/android-3/include/linux/stddef.h
index 5412f475d..cca408ca5 100644
--- a/ndk/platforms/android-3/include/linux/stddef.h
+++ b/ndk/platforms/android-3/include/linux/stddef.h
@@ -7,25 +7,24 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
****************************************************************************
****************************************************************************/
#ifndef _LINUX_STDDEF_H
#define _LINUX_STDDEF_H
-
#include <linux/compiler.h>
-
#undef NULL
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
-
-#undef offsetof
-#ifdef __compiler_offsetof
-#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
-#else
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-
#endif
diff --git a/ndk/platforms/android-3/include/linux/sysctl.h b/ndk/platforms/android-3/include/linux/sysctl.h
index 329e561d0..730c7405a 100644
--- a/ndk/platforms/android-3/include/linux/sysctl.h
+++ b/ndk/platforms/android-3/include/linux/sysctl.h
@@ -28,7 +28,7 @@ struct __sysctl_args {
size_t __user *oldlenp;
void __user *newval;
size_t newlen;
- unsigned long __unused[4];
+ unsigned long __linux_unused[4];
};
enum
diff --git a/ndk/platforms/android-3/include/pthread.h b/ndk/platforms/android-3/include/pthread.h
index 2a6029d64..ae55782f1 100644
--- a/ndk/platforms/android-3/include/pthread.h
+++ b/ndk/platforms/android-3/include/pthread.h
@@ -235,9 +235,4 @@ extern void __pthread_cleanup_pop(__pthread_cleanup_t* c,
} /* extern "C" */
#endif
-/************ TO FIX ************/
-
-#define LONG_LONG_MAX __LONG_LONG_MAX__
-#define LONG_LONG_MIN (-__LONG_LONG_MAX__ - 1)
-
#endif /* _PTHREAD_H_ */
diff --git a/ndk/platforms/android-3/include/resolv.h b/ndk/platforms/android-3/include/resolv.h
index 4247d68b7..7c34012a1 100644
--- a/ndk/platforms/android-3/include/resolv.h
+++ b/ndk/platforms/android-3/include/resolv.h
@@ -34,6 +34,7 @@
#include <sys/socket.h>
#include <stdio.h>
#include <arpa/nameser.h>
+#include <netinet/in.h>
__BEGIN_DECLS
diff --git a/ndk/platforms/android-3/include/stdint.h b/ndk/platforms/android-3/include/stdint.h
index 49879cb5b..c3e29dde7 100644
--- a/ndk/platforms/android-3/include/stdint.h
+++ b/ndk/platforms/android-3/include/stdint.h
@@ -226,12 +226,6 @@ typedef int64_t intmax_t;
# define UINTMAX_C(c) UINT64_C(c)
#endif
-/* size_t is defined by the GCC-specific <stddef.h> */
-#ifndef _SSIZE_T_DEFINED_
-#define _SSIZE_T_DEFINED_
-typedef long int ssize_t;
-#endif
-
#define _BITSIZE 32
/* Keep the kernel from trying to define these types... */
diff --git a/ndk/platforms/android-3/include/stdio.h b/ndk/platforms/android-3/include/stdio.h
index 273f63030..a56faa2f3 100644
--- a/ndk/platforms/android-3/include/stdio.h
+++ b/ndk/platforms/android-3/include/stdio.h
@@ -39,7 +39,7 @@
#define _STDIO_H_
#include <sys/cdefs.h>
-#include <sys/_types.h>
+#include <sys/types.h>
/* va_list and size_t must be defined by stdio.h according to Posix */
#define __need___va_list
@@ -49,30 +49,9 @@
#define __need_size_t
#include <stddef.h>
+#define __need_NULL
#include <stddef.h>
-#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE
-#include <sys/types.h> /* XXX should be removed */
-#endif
-
-#ifndef _SIZE_T_DEFINED_
-#define _SIZE_T_DEFINED_
-typedef unsigned long size_t;
-#endif
-
-#ifndef _OFF_T_DEFINED_
-#define _OFF_T_DEFINED_
-typedef long off_t;
-#endif
-
-#ifndef NULL
-#ifdef __GNUG__
-#define NULL __null
-#else
-#define NULL 0L
-#endif
-#endif
-
#define _FSTDIO /* Define for new stdio with functions. */
typedef off_t fpos_t; /* stdio file position type */
diff --git a/ndk/platforms/android-3/include/sys/endian.h b/ndk/platforms/android-3/include/sys/endian.h
index 00f48391e..2a0c65870 100644
--- a/ndk/platforms/android-3/include/sys/endian.h
+++ b/ndk/platforms/android-3/include/sys/endian.h
@@ -37,6 +37,7 @@
#define _SYS_ENDIAN_H_
#include <sys/cdefs.h>
+#include <machine/endian.h>
#include <machine/_types.h>
#define _LITTLE_ENDIAN 1234
diff --git a/ndk/platforms/android-3/include/sys/limits.h b/ndk/platforms/android-3/include/sys/limits.h
index 41d02ff3c..5b127ebb2 100644
--- a/ndk/platforms/android-3/include/sys/limits.h
+++ b/ndk/platforms/android-3/include/sys/limits.h
@@ -169,7 +169,8 @@
#undef _POSIX_PROCESS_SHARED /* we don't support process-shared synchronization */
#undef _POSIX_THREAD_SAFE_FUNCTIONS /* most functions are, but not everything yet */
-#define _POSIX_CHOWN_RESTRICTED 1 /* yes, chown requires appropriate priviledges */
+#define _POSIX_CHOWN_RESTRICTED 1 /* yes, chown requires appropriate privileges */
+#define _POSIX_MONOTONIC_CLOCK 0 /* the monotonic clock may be available; ask sysconf */
#define _POSIX_NO_TRUNC 1 /* very long pathnames generate an error */
#define _POSIX_SAVED_IDS 1 /* saved user ids is a Linux feature */
#define _POSIX_JOB_CONTROL 1 /* job control is a Linux feature */
diff --git a/ndk/platforms/android-3/include/sys/sysconf.h b/ndk/platforms/android-3/include/sys/sysconf.h
index 2fc1b0888..0a46e7aab 100644
--- a/ndk/platforms/android-3/include/sys/sysconf.h
+++ b/ndk/platforms/android-3/include/sys/sysconf.h
@@ -127,8 +127,9 @@ __BEGIN_DECLS
#define _SC_NPROCESSORS_ONLN 0x0061
#define _SC_PHYS_PAGES 0x0062
#define _SC_AVPHYS_PAGES 0x0063
+#define _SC_MONOTONIC_CLOCK 0x0064
-extern int sysconf (int name);
+extern int sysconf(int name);
__END_DECLS
diff --git a/ndk/platforms/android-3/include/sys/types.h b/ndk/platforms/android-3/include/sys/types.h
index 33fe30e55..15ecb373a 100644
--- a/ndk/platforms/android-3/include/sys/types.h
+++ b/ndk/platforms/android-3/include/sys/types.h
@@ -85,12 +85,6 @@ typedef .... pthread_rwlock_attr_t;
typedef .... pthread_t;
#endif
-#ifndef _SIZE_T_DEFINED_
-#define _SIZE_T_DEFINED_
-typedef unsigned int size_t;
-#endif
-
-/* size_t is defined by the GCC-specific <stddef.h> */
#ifndef _SSIZE_T_DEFINED_
#define _SSIZE_T_DEFINED_
typedef long int ssize_t;
diff --git a/ndk/platforms/android-3/include/wchar.h b/ndk/platforms/android-3/include/wchar.h
index e2feb6002..9a6ce1de8 100644
--- a/ndk/platforms/android-3/include/wchar.h
+++ b/ndk/platforms/android-3/include/wchar.h
@@ -50,7 +50,7 @@
__BEGIN_DECLS
-typedef int wint_t;
+typedef __WINT_TYPE__ wint_t;
typedef struct { int dummy; } mbstate_t;
typedef enum {
diff --git a/ndk/platforms/android-4/samples/san-angeles/jni/app-android.c b/ndk/platforms/android-4/samples/san-angeles/jni/app-android.c
index 0e552a7d6..399d89665 100644
--- a/ndk/platforms/android-4/samples/san-angeles/jni/app-android.c
+++ b/ndk/platforms/android-4/samples/san-angeles/jni/app-android.c
@@ -22,6 +22,8 @@
#include <time.h>
#include <android/log.h>
#include <stdint.h>
+#include "importgl.h"
+#include "app.h"
int gAppAlive = 1;
@@ -47,9 +49,7 @@ Java_com_example_SanAngeles_DemoRenderer_nativeInit( JNIEnv* env )
{
importGLInit();
appInit();
- gAppAlive = 1;
- sDemoStopped = 0;
- sTimeOffsetInit = 0;
+ gAppAlive = 1;
}
void
@@ -71,19 +71,44 @@ Java_com_example_SanAngeles_DemoRenderer_nativeDone( JNIEnv* env )
/* This is called to indicate to the render loop that it should
* stop as soon as possible.
*/
+
+void _pause()
+{
+ /* we paused the animation, so store the current
+ * time in sTimeStopped for future nativeRender calls */
+ sDemoStopped = 1;
+ sTimeStopped = _getTime();
+}
+
+void _resume()
+{
+ /* we resumed the animation, so adjust the time offset
+ * to take care of the pause interval. */
+ sDemoStopped = 0;
+ sTimeOffset -= _getTime() - sTimeStopped;
+}
+
+
void
-Java_com_example_SanAngeles_DemoGLSurfaceView_nativePause( JNIEnv* env )
+Java_com_example_SanAngeles_DemoGLSurfaceView_nativeTogglePauseResume( JNIEnv* env )
{
sDemoStopped = !sDemoStopped;
- if (sDemoStopped) {
- /* we paused the animation, so store the current
- * time in sTimeStopped for future nativeRender calls */
- sTimeStopped = _getTime();
- } else {
- /* we resumed the animation, so adjust the time offset
- * to take care of the pause interval. */
- sTimeOffset -= _getTime() - sTimeStopped;
- }
+ if (sDemoStopped)
+ _pause();
+ else
+ _resume();
+}
+
+void
+Java_com_example_SanAngeles_DemoGLSurfaceView_nativePause( JNIEnv* env )
+{
+ _pause();
+}
+
+void
+Java_com_example_SanAngeles_DemoGLSurfaceView_nativeResume( JNIEnv* env )
+{
+ _resume();
}
/* Call to render the next GL frame */
diff --git a/ndk/platforms/android-4/samples/san-angeles/src/com/example/SanAngeles/DemoActivity.java b/ndk/platforms/android-4/samples/san-angeles/src/com/example/SanAngeles/DemoActivity.java
index 696be7828..076b8a7fc 100644
--- a/ndk/platforms/android-4/samples/san-angeles/src/com/example/SanAngeles/DemoActivity.java
+++ b/ndk/platforms/android-4/samples/san-angeles/src/com/example/SanAngeles/DemoActivity.java
@@ -86,14 +86,29 @@ class DemoGLSurfaceView extends GLSurfaceView {
public boolean onTouchEvent(final MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
- nativePause();
+ nativeTogglePauseResume();
}
return true;
}
+ @Override
+ public void onPause() {
+ super.onPause();
+ nativePause();
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ nativeResume();
+ }
+
+
DemoRenderer mRenderer;
private static native void nativePause();
+ private static native void nativeResume();
+ private static native void nativeTogglePauseResume();
}
class DemoRenderer implements GLSurfaceView.Renderer {
diff --git a/ndk/platforms/android-5/arch-arm/symbols/libc.so.functions.txt b/ndk/platforms/android-5/arch-arm/symbols/libc.so.functions.txt
index 960850350..22616d40a 100644
--- a/ndk/platforms/android-5/arch-arm/symbols/libc.so.functions.txt
+++ b/ndk/platforms/android-5/arch-arm/symbols/libc.so.functions.txt
@@ -273,7 +273,6 @@ __rt_sigaction
__rt_sigprocmask
__rt_sigtimedwait
__sclose
-__set_errno
__set_syscall_errno
__set_tls
__sflags
diff --git a/ndk/platforms/android-5/include/GLES2/gl2.h b/ndk/platforms/android-5/include/GLES2/gl2.h
index e1d3b87cc..c139c2517 100644
--- a/ndk/platforms/android-5/include/GLES2/gl2.h
+++ b/ndk/platforms/android-5/include/GLES2/gl2.h
@@ -528,7 +528,7 @@ GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
-GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
+GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
GL_APICALL GLenum GL_APIENTRY glGetError (void);
@@ -547,7 +547,7 @@ GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum p
GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
-GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
+GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);
diff --git a/ndk/platforms/android-5/include/pthread.h b/ndk/platforms/android-5/include/pthread.h
index a20a52de1..ba40fa1af 100644
--- a/ndk/platforms/android-5/include/pthread.h
+++ b/ndk/platforms/android-5/include/pthread.h
@@ -262,9 +262,4 @@ extern void __pthread_cleanup_pop(__pthread_cleanup_t* c,
} /* extern "C" */
#endif
-/************ TO FIX ************/
-
-#define LONG_LONG_MAX __LONG_LONG_MAX__
-#define LONG_LONG_MIN (-__LONG_LONG_MAX__ - 1)
-
#endif /* _PTHREAD_H_ */
diff --git a/ndk/platforms/android-8/arch-arm/symbols/libc.so.functions.txt b/ndk/platforms/android-8/arch-arm/symbols/libc.so.functions.txt
index 88dd1b75b..917498f1d 100644
--- a/ndk/platforms/android-8/arch-arm/symbols/libc.so.functions.txt
+++ b/ndk/platforms/android-8/arch-arm/symbols/libc.so.functions.txt
@@ -284,7 +284,6 @@ __rt_sigaction
__rt_sigprocmask
__rt_sigtimedwait
__sclose
-__set_errno
__set_syscall_errno
__set_tls
__setresuid
diff --git a/ndk/platforms/android-8/include/android/bitmap.h b/ndk/platforms/android-8/include/android/bitmap.h
index 5078277b5..6e18763bf 100644
--- a/ndk/platforms/android-8/include/android/bitmap.h
+++ b/ndk/platforms/android-8/include/android/bitmap.h
@@ -24,11 +24,14 @@
extern "C" {
#endif
-#define ANDROID_BITMAP_RESUT_SUCCESS 0
+#define ANDROID_BITMAP_RESULT_SUCCESS 0
#define ANDROID_BITMAP_RESULT_BAD_PARAMETER -1
#define ANDROID_BITMAP_RESULT_JNI_EXCEPTION -2
#define ANDROID_BITMAP_RESULT_ALLOCATION_FAILED -3
+/* Backward compatibility: this macro used to be misspelled. */
+#define ANDROID_BITMAP_RESUT_SUCCESS ANDROID_BITMAP_RESULT_SUCCESS
+
enum AndroidBitmapFormat {
ANDROID_BITMAP_FORMAT_NONE = 0,
ANDROID_BITMAP_FORMAT_RGBA_8888 = 1,
diff --git a/ndk/platforms/android-8/include/pthread.h b/ndk/platforms/android-8/include/pthread.h
index f7a596acb..7741fcf23 100644
--- a/ndk/platforms/android-8/include/pthread.h
+++ b/ndk/platforms/android-8/include/pthread.h
@@ -267,9 +267,4 @@ extern void __pthread_cleanup_pop(__pthread_cleanup_t* c,
} /* extern "C" */
#endif
-/************ TO FIX ************/
-
-#define LONG_LONG_MAX __LONG_LONG_MAX__
-#define LONG_LONG_MIN (-__LONG_LONG_MAX__ - 1)
-
#endif /* _PTHREAD_H_ */
diff --git a/ndk/platforms/android-8/include/stdio.h b/ndk/platforms/android-8/include/stdio.h
index c38ed5a51..172c8d0dc 100644
--- a/ndk/platforms/android-8/include/stdio.h
+++ b/ndk/platforms/android-8/include/stdio.h
@@ -39,7 +39,7 @@
#define _STDIO_H_
#include <sys/cdefs.h>
-#include <sys/_types.h>
+#include <sys/types.h>
/* va_list and size_t must be defined by stdio.h according to Posix */
#define __need___va_list
@@ -49,30 +49,9 @@
#define __need_size_t
#include <stddef.h>
+#define __need_NULL
#include <stddef.h>
-#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE
-#include <sys/types.h> /* XXX should be removed */
-#endif
-
-#ifndef _SIZE_T_DEFINED_
-#define _SIZE_T_DEFINED_
-typedef unsigned long size_t;
-#endif
-
-#ifndef _OFF_T_DEFINED_
-#define _OFF_T_DEFINED_
-typedef long off_t;
-#endif
-
-#ifndef NULL
-#ifdef __GNUG__
-#define NULL __null
-#else
-#define NULL 0L
-#endif
-#endif
-
#define _FSTDIO /* Define for new stdio with functions. */
typedef off_t fpos_t; /* stdio file position type */
diff --git a/ndk/platforms/android-8/include/wchar.h b/ndk/platforms/android-8/include/wchar.h
index 97e1b5c4c..b9c7b0b48 100644
--- a/ndk/platforms/android-8/include/wchar.h
+++ b/ndk/platforms/android-8/include/wchar.h
@@ -50,7 +50,7 @@
__BEGIN_DECLS
-typedef int wint_t;
+typedef __WINT_TYPE__ wint_t;
typedef struct { int dummy; } mbstate_t;
typedef enum {
diff --git a/ndk/platforms/android-8/samples/bitmap-plasma/jni/plasma.c b/ndk/platforms/android-8/samples/bitmap-plasma/jni/plasma.c
index 79cd66df3..d5f98fbbb 100644
--- a/ndk/platforms/android-8/samples/bitmap-plasma/jni/plasma.c
+++ b/ndk/platforms/android-8/samples/bitmap-plasma/jni/plasma.c
@@ -187,7 +187,6 @@ static void init_tables(void)
static void fill_plasma( AndroidBitmapInfo* info, void* pixels, double t )
{
- Fixed ft = FIXED_FROM_FLOAT(t/1000.);
Fixed yt1 = FIXED_FROM_FLOAT(t/1230.);
Fixed yt2 = yt1;
Fixed xt10 = FIXED_FROM_FLOAT(t/3000.);
diff --git a/ndk/platforms/android-9/arch-arm/symbols/libc.so.functions.txt b/ndk/platforms/android-9/arch-arm/symbols/libc.so.functions.txt
index c1c435821..99eb2d430 100644
--- a/ndk/platforms/android-9/arch-arm/symbols/libc.so.functions.txt
+++ b/ndk/platforms/android-9/arch-arm/symbols/libc.so.functions.txt
@@ -288,7 +288,6 @@ __rt_sigaction
__rt_sigprocmask
__rt_sigtimedwait
__sclose
-__set_errno
__set_syscall_errno
__set_tls
__setresuid
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/cpu-features.h b/ndk/platforms/android-9/arch-mips/include/asm/cpu-features.h
index b3642c20b..50ce572f2 100644
--- a/ndk/platforms/android-9/arch-mips/include/asm/cpu-features.h
+++ b/ndk/platforms/android-9/arch-mips/include/asm/cpu-features.h
@@ -161,26 +161,45 @@
#define cpu_has_userlocal (cpu_data[0].options & MIPS_CPU_ULRI)
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef cpu_has_nofpuex
+#define cpu_has_nofpuex (cpu_data[0].options & MIPS_CPU_NOFPUEX)
+#endif
+#ifndef cpu_has_64bits
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define cpu_has_64bits (cpu_data[0].isa_level & MIPS_CPU_ISA_64BIT)
+#endif
+#ifndef cpu_has_64bit_zero_reg
+#define cpu_has_64bit_zero_reg (cpu_data[0].isa_level & MIPS_CPU_ISA_64BIT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#ifndef cpu_has_64bit_gp_regs
+#define cpu_has_64bit_gp_regs 0
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef cpu_has_64bit_addresses
+#define cpu_has_64bit_addresses 0
+#endif
#ifndef cpu_has_vint
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define cpu_has_vint 0
#endif
#ifndef cpu_has_veic
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define cpu_has_veic 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
#ifndef cpu_has_inclusive_pcaches
#define cpu_has_inclusive_pcaches (cpu_data[0].options & MIPS_CPU_INCLUSIVE_CACHES)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#ifndef cpu_dcache_line_size
#define cpu_dcache_line_size() cpu_data[0].dcache.linesz
#endif
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#ifndef cpu_icache_line_size
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define cpu_icache_line_size() cpu_data[0].icache.linesz
#endif
#ifndef cpu_scache_line_size
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define cpu_scache_line_size() cpu_data[0].scache.linesz
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
#endif
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/elf.h b/ndk/platforms/android-9/arch-mips/include/asm/elf.h
index 6ccb622ec..6f79694cf 100644
--- a/ndk/platforms/android-9/arch-mips/include/asm/elf.h
+++ b/ndk/platforms/android-9/arch-mips/include/asm/elf.h
@@ -186,29 +186,33 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG];
typedef double elf_fpreg_t;
typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define elf_check_arch(hdr) ({ int __res = 1; struct elfhdr *__h = (hdr); if (__h->e_machine != EM_MIPS) __res = 0; if (__h->e_ident[EI_CLASS] != ELFCLASS32) __res = 0; if ((__h->e_flags & EF_MIPS_ABI2) != 0) __res = 0; if (((__h->e_flags & EF_MIPS_ABI) != 0) && ((__h->e_flags & EF_MIPS_ABI) != EF_MIPS_ABI_O32)) __res = 0; __res; })
+#define ELF_CLASS ELFCLASS32
#ifdef __MIPSEB__
#define ELF_DATA ELFDATA2MSB
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#elif __MIPSEL__
#define ELF_DATA ELFDATA2LSB
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
#define ELF_ARCH EM_MIPS
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
struct mips_abi;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SET_PERSONALITY(ex, ibcs2) do { if (ibcs2) set_personality(PER_SVR4); set_personality(PER_LINUX); current->thread.abi = &mips_abi; } while (0)
struct task_struct;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ELF_CORE_COPY_REGS(elf_regs, regs) elf_dump_regs((elf_greg_t *)&(elf_regs), regs);
#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define USE_ELF_CORE_DUMP
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ELF_EXEC_PAGESIZE PAGE_SIZE
#define ELF_HWCAP (0)
#define ELF_PLATFORM (NULL)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ELF_PLAT_INIT(_r, load_addr) do { _r->regs[1] = _r->regs[2] = _r->regs[3] = _r->regs[4] = 0; _r->regs[5] = _r->regs[6] = _r->regs[7] = _r->regs[8] = 0; _r->regs[9] = _r->regs[10] = _r->regs[11] = _r->regs[12] = 0; _r->regs[13] = _r->regs[14] = _r->regs[15] = _r->regs[16] = 0; _r->regs[17] = _r->regs[18] = _r->regs[19] = _r->regs[20] = 0; _r->regs[21] = _r->regs[22] = _r->regs[23] = _r->regs[24] = 0; _r->regs[25] = _r->regs[26] = _r->regs[27] = _r->regs[28] = 0; _r->regs[30] = _r->regs[31] = 0; } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#ifndef ELF_ET_DYN_BASE
#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2)
#endif
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/fcntl.h b/ndk/platforms/android-9/arch-mips/include/asm/fcntl.h
index 26863404f..73de4ad3a 100644
--- a/ndk/platforms/android-9/arch-mips/include/asm/fcntl.h
+++ b/ndk/platforms/android-9/arch-mips/include/asm/fcntl.h
@@ -43,6 +43,18 @@
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define F_SETLKW64 35
#endif
+struct flock {
+ short l_type;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ short l_whence;
+ off_t l_start;
+ off_t l_len;
+ long l_sysid;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __kernel_pid_t l_pid;
+ long pad[4];
+};
+#define HAVE_ARCH_STRUCT_FLOCK
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#include <asm-generic/fcntl.h>
#endif
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/mach-generic/spaces.h b/ndk/platforms/android-9/arch-mips/include/asm/mach-generic/spaces.h
index cbda237cf..0ec1f573d 100644
--- a/ndk/platforms/android-9/arch-mips/include/asm/mach-generic/spaces.h
+++ b/ndk/platforms/android-9/arch-mips/include/asm/mach-generic/spaces.h
@@ -23,8 +23,19 @@
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define PHYS_OFFSET _AC(0, UL)
#endif
+#define CAC_BASE _AC(0x80000000, UL)
+#define IO_BASE _AC(0xa0000000, UL)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UNCAC_BASE _AC(0xa0000000, UL)
+#ifndef MAP_BASE
+#define MAP_BASE _AC(0xc0000000, UL)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef HIGHMEM_START
+#define HIGHMEM_START _AC(0x20000000, UL)
+#endif
#ifndef PAGE_OFFSET
-#define PAGE_OFFSET (CAC_BASE + PHYS_OFFSET)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PAGE_OFFSET (CAC_BASE + PHYS_OFFSET)
#endif
#endif
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/mman.h b/ndk/platforms/android-9/arch-mips/include/asm/mman.h
index 9e51c67ae..cb42c6a10 100644
--- a/ndk/platforms/android-9/arch-mips/include/asm/mman.h
+++ b/ndk/platforms/android-9/arch-mips/include/asm/mman.h
@@ -47,22 +47,33 @@
#define MAP_POPULATE 0x10000
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define MAP_NONBLOCK 0x20000
+#define MAP_STACK 0x40000
+#define MAP_HUGETLB 0x80000
#define MS_ASYNC 0x0001
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define MS_INVALIDATE 0x0002
#define MS_SYNC 0x0004
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define MCL_CURRENT 1
#define MCL_FUTURE 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define MADV_NORMAL 0
#define MADV_RANDOM 1
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define MADV_SEQUENTIAL 2
#define MADV_WILLNEED 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define MADV_DONTNEED 4
#define MADV_REMOVE 9
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define MADV_DONTFORK 10
#define MADV_DOFORK 11
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MADV_MERGEABLE 12
+#define MADV_UNMERGEABLE 13
+#define MADV_HWPOISON 100
+#define MADV_HUGEPAGE 14
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MADV_NOHUGEPAGE 15
+#define MADV_DONTDUMP 16
+#define MADV_DODUMP 17
#define MAP_FILE 0
-#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/module.h b/ndk/platforms/android-9/arch-mips/include/asm/module.h
index 45808e97c..dd242903a 100644
--- a/ndk/platforms/android-9/arch-mips/include/asm/module.h
+++ b/ndk/platforms/android-9/arch-mips/include/asm/module.h
@@ -49,8 +49,20 @@ typedef struct {
Elf64_Byte r_type;
Elf64_Sxword r_addend;
} Elf64_Mips_Rela;
+#define Elf_Shdr Elf32_Shdr
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define Elf_Sym Elf32_Sym
+#define Elf_Ehdr Elf32_Ehdr
+#define Elf_Addr Elf32_Addr
+#define Elf_Mips_Rel Elf32_Rel
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define Elf_Mips_Rela Elf32_Rela
+#define ELF_MIPS_R_SYM(rel) ELF32_R_SYM(rel.r_info)
+#define ELF_MIPS_R_TYPE(rel) ELF32_R_TYPE(rel.r_info)
#error MODULE_PROC_FAMILY undefined for your processor configuration
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MODULE_KERNEL_TYPE "32BIT "
#define MODULE_KERNEL_SMTC ""
#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_KERNEL_TYPE MODULE_KERNEL_SMTC
#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/msgbuf.h b/ndk/platforms/android-9/arch-mips/include/asm/msgbuf.h
index 31a18877f..d81da7390 100644
--- a/ndk/platforms/android-9/arch-mips/include/asm/msgbuf.h
+++ b/ndk/platforms/android-9/arch-mips/include/asm/msgbuf.h
@@ -21,18 +21,21 @@
struct msqid64_ds {
struct ipc64_perm msg_perm;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long __unused1;
__kernel_time_t msg_stime;
+ unsigned long __unused2;
__kernel_time_t msg_rtime;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long __unused3;
__kernel_time_t msg_ctime;
unsigned long msg_cbytes;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long msg_qnum;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long msg_qbytes;
__kernel_pid_t msg_lspid;
__kernel_pid_t msg_lrpid;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long __unused4;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long __unused5;
};
#endif
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/pgalloc.h b/ndk/platforms/android-9/arch-mips/include/asm/pgalloc.h
index e3ef3b853..0f163460b 100644
--- a/ndk/platforms/android-9/arch-mips/include/asm/pgalloc.h
+++ b/ndk/platforms/android-9/arch-mips/include/asm/pgalloc.h
@@ -24,6 +24,8 @@
#include <linux/sched.h>
#define pmd_pgtable(pmd) pmd_page(pmd)
#define __pte_free_tlb(tlb,pte) do { pgtable_page_dtor(pte); tlb_remove_page((tlb), pte); } while (0)
-#define check_pgt_cache() do { } while (0)
+#define pmd_free(mm, x) do { } while (0)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __pmd_free_tlb(tlb, x) do { } while (0)
+#define check_pgt_cache() do { } while (0)
#endif
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/pgtable-32.h b/ndk/platforms/android-9/arch-mips/include/asm/pgtable-32.h
new file mode 100644
index 000000000..f00508364
--- /dev/null
+++ b/ndk/platforms/android-9/arch-mips/include/asm/pgtable-32.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_PGTABLE_32_H
+#define _ASM_PGTABLE_32_H
+#include <asm/addrspace.h>
+#include <asm/page.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <linux/linkage.h>
+#include <asm/cachectl.h>
+#include <asm/fixmap.h>
+#include <asm-generic/pgtable-nopmd.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PGDIR_SHIFT (2 * PAGE_SHIFT + PTE_ORDER - PTE_T_LOG2)
+#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
+#define PGDIR_MASK (~(PGDIR_SIZE-1))
+#define __PGD_ORDER (32 - 3 * PAGE_SHIFT + PGD_T_LOG2 + PTE_T_LOG2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PGD_ORDER (__PGD_ORDER >= 0 ? __PGD_ORDER : 0)
+#define PUD_ORDER aieeee_attempt_to_allocate_pud
+#define PMD_ORDER 1
+#define PTE_ORDER 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTRS_PER_PGD (USER_PTRS_PER_PGD * 2)
+#define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t))
+#define USER_PTRS_PER_PGD (0x80000000UL/PGDIR_SIZE)
+#define FIRST_USER_ADDRESS 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VMALLOC_START MAP_BASE
+#define PKMAP_BASE (0xfe000000UL)
+#define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE)
+#define pte_ERROR(e) printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define pgd_ERROR(e) printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
+#define pmd_bad(pmd) (pmd_val(pmd) & ~PAGE_MASK)
+#define pte_page(x) pfn_to_page(pte_pfn(x))
+#define pte_pfn(x) ((unsigned long)((x).pte >> _PFN_SHIFT))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define pfn_pte(pfn, prot) __pte(((unsigned long long)(pfn) << _PFN_SHIFT) | pgprot_val(prot))
+#define __pgd_offset(address) pgd_index(address)
+#define __pud_offset(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
+#define __pmd_offset(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define pgd_offset_k(address) pgd_offset(&init_mm, address)
+#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
+#define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr))
+#define __pte_offset(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define pte_offset(dir, address) ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))
+#define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))
+#define pte_offset_map(dir, address) ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
+#define pte_unmap(pte) ((void)(pte))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __swp_type(x) (((x).val >> 8) & 0x1f)
+#define __swp_offset(x) ((x).val >> 13)
+#define __swp_entry(type,offset) ((swp_entry_t) { ((type) << 8) | ((offset) << 13) })
+#define PTE_FILE_MAX_BITS 28
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define pte_to_pgoff(_pte) ((((_pte).pte >> 1) & 0x7) | (((_pte).pte >> 2) & 0x8) | (((_pte).pte >> 8) << 4))
+#define pgoff_to_pte(off) ((pte_t) { (((off) & 0x7) << 1) | (((off) & 0x8) << 2) | (((off) >> 4) << 8) | _PAGE_FILE })
+#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
+#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/pgtable.h b/ndk/platforms/android-9/arch-mips/include/asm/pgtable.h
index ceb434351..46a5ba149 100644
--- a/ndk/platforms/android-9/arch-mips/include/asm/pgtable.h
+++ b/ndk/platforms/android-9/arch-mips/include/asm/pgtable.h
@@ -18,61 +18,62 @@
****************************************************************************/
#ifndef _ASM_PGTABLE_H
#define _ASM_PGTABLE_H
+#include <asm/pgtable-32.h>
#include <asm/io.h>
-#include <asm/pgtable-bits.h>
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/pgtable-bits.h>
struct mm_struct;
struct vm_area_struct;
#define PAGE_NONE __pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_NONCOHERENT)
-#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _page_cachable_default)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _page_cachable_default)
#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_READ | _page_cachable_default)
#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_READ | _page_cachable_default)
#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | _PAGE_GLOBAL | _page_cachable_default)
-#define PAGE_USERIO __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _page_cachable_default)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PAGE_USERIO __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _page_cachable_default)
#define PAGE_KERNEL_UNCACHED __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | _PAGE_GLOBAL | _CACHE_UNCACHED)
#define __P000 __pgprot(0)
#define __P001 __pgprot(0)
-#define __P010 __pgprot(0)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __P010 __pgprot(0)
#define __P011 __pgprot(0)
#define __P100 __pgprot(0)
#define __P101 __pgprot(0)
-#define __P110 __pgprot(0)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __P110 __pgprot(0)
#define __P111 __pgprot(0)
#define __S000 __pgprot(0)
#define __S001 __pgprot(0)
-#define __S010 __pgprot(0)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __S010 __pgprot(0)
#define __S011 __pgprot(0)
#define __S100 __pgprot(0)
#define __S101 __pgprot(0)
-#define __S110 __pgprot(0)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __S110 __pgprot(0)
#define __S111 __pgprot(0)
#define ZERO_PAGE(vaddr) (virt_to_page((void *)(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))))
#define pmd_phys(pmd) virt_to_phys((void *)pmd_val(pmd))
-#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
#define pmd_page_vaddr(pmd) pmd_val(pmd)
#define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL))
#define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT)
-#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval)
#define set_pmd(pmdptr, pmdval) do { *(pmdptr) = (pmdval); } while(0)
#define PGD_T_LOG2 (__builtin_ffs(sizeof(pgd_t)) - 1)
#define PMD_T_LOG2 (__builtin_ffs(sizeof(pmd_t)) - 1)
-#define PTE_T_LOG2 (__builtin_ffs(sizeof(pte_t)) - 1)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTE_T_LOG2 (__builtin_ffs(sizeof(pte_t)) - 1)
#define pgprot_noncached pgprot_noncached
#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
#define kern_addr_valid(addr) (1)
-#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) remap_pfn_range(vma, vaddr, pfn, size, prot)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) remap_pfn_range(vma, vaddr, pfn, size, prot)
#include <asm-generic/pgtable.h>
#define HAVE_ARCH_UNMAPPED_AREA
#define pgtable_cache_init() do { } while (0)
-#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/processor.h b/ndk/platforms/android-9/arch-mips/include/asm/processor.h
index 356312181..fe9ee7612 100644
--- a/ndk/platforms/android-9/arch-mips/include/asm/processor.h
+++ b/ndk/platforms/android-9/arch-mips/include/asm/processor.h
@@ -29,61 +29,65 @@
#include <asm/prefetch.h>
#include <asm/system.h>
#define current_text_addr() ({ __label__ _l; _l: &&_l;})
-#define NUM_FPU_REGS 32
+#define TASK_SIZE 0x7fff8000UL
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define STACK_TOP TASK_SIZE
+#define TASK_UNMAPPED_BASE ((TASK_SIZE / 3) & ~(PAGE_SIZE))
+#define NUM_FPU_REGS 32
typedef __u64 fpureg_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct mips_fpu_struct {
fpureg_t fpr[NUM_FPU_REGS];
unsigned int fcr31;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define NUM_DSP_REGS 6
typedef __u32 dspreg_t;
struct mips_dsp_state {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
dspreg_t dspr[NUM_DSP_REGS];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned int dspcontrol;
};
#define INIT_CPUMASK { {0,} }
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
typedef struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long seg;
} mm_segment_t;
#define ARCH_MIN_TASKALIGN 8
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct mips_abi;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct thread_struct {
unsigned long reg16;
unsigned long reg17, reg18, reg19, reg20, reg21, reg22, reg23;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long reg29, reg30, reg31;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long cp0_status;
struct mips_fpu_struct fpu;
struct mips_dsp_state dsp;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long cp0_badvaddr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long cp0_baduaddr;
unsigned long error_code;
unsigned long trap_no;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long irix_trampoline;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long irix_oldctx;
struct mips_abi *abi;
};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FPAFF_INIT
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INIT_THREAD { .reg16 = 0, .reg17 = 0, .reg18 = 0, .reg19 = 0, .reg20 = 0, .reg21 = 0, .reg22 = 0, .reg23 = 0, .reg29 = 0, .reg30 = 0, .reg31 = 0, .cp0_status = 0, .fpu = { .fpr = {0,}, .fcr31 = 0, }, FPAFF_INIT .dsp = { .dspr = {0, }, .dspcontrol = 0, }, .cp0_badvaddr = 0, .cp0_baduaddr = 0, .error_code = 0, .trap_no = 0, .irix_trampoline = 0, .irix_oldctx = 0, }
struct task_struct;
#define release_thread(thread) do { } while(0)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define prepare_to_copy(tsk) do { } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __KSTK_TOS(tsk) ((unsigned long)task_stack_page(tsk) + THREAD_SIZE - 32)
#define task_pt_regs(tsk) ((struct pt_regs *)__KSTK_TOS(tsk) - 1)
#define KSTK_EIP(tsk) (task_pt_regs(tsk)->cp0_epc)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29])
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define KSTK_STATUS(tsk) (task_pt_regs(tsk)->cp0_status)
#define cpu_relax() barrier()
#define return_address() ({__asm__ __volatile__("":::"$31");__builtin_return_address(0);})
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/ptrace.h b/ndk/platforms/android-9/arch-mips/include/asm/ptrace.h
index 2b71e70cb..43cfcf1e7 100644
--- a/ndk/platforms/android-9/arch-mips/include/asm/ptrace.h
+++ b/ndk/platforms/android-9/arch-mips/include/asm/ptrace.h
@@ -33,29 +33,31 @@
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ACX 78
struct pt_regs {
+ unsigned long pad0[6];
unsigned long regs[32];
- unsigned long cp0_status;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long cp0_status;
unsigned long hi;
unsigned long lo;
unsigned long cp0_badvaddr;
- unsigned long cp0_cause;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long cp0_cause;
unsigned long cp0_epc;
} __attribute__ ((aligned (8)));
#define PTRACE_GETREGS 12
-#define PTRACE_SETREGS 13
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTRACE_SETREGS 13
#define PTRACE_GETFPREGS 14
#define PTRACE_SETFPREGS 15
#define PTRACE_OLDSETOPTIONS 21
-#define PTRACE_GET_THREAD_AREA 25
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTRACE_GET_THREAD_AREA 25
#define PTRACE_SET_THREAD_AREA 26
#define PTRACE_PEEKTEXT_3264 0xc0
#define PTRACE_PEEKDATA_3264 0xc1
-#define PTRACE_POKETEXT_3264 0xc2
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTRACE_POKETEXT_3264 0xc2
#define PTRACE_POKEDATA_3264 0xc3
#define PTRACE_GET_THREAD_AREA_3264 0xc4
#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/reg.h b/ndk/platforms/android-9/arch-mips/include/asm/reg.h
index 9174e276f..1b8e8ee27 100644
--- a/ndk/platforms/android-9/arch-mips/include/asm/reg.h
+++ b/ndk/platforms/android-9/arch-mips/include/asm/reg.h
@@ -18,57 +18,54 @@
****************************************************************************/
#ifndef __ASM_MIPS_REG_H
#define __ASM_MIPS_REG_H
-#ifdef WANT_COMPAT_REG_H
#define EF_R0 6
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R1 7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R2 8
#define EF_R3 9
#define EF_R4 10
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R5 11
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R6 12
#define EF_R7 13
#define EF_R8 14
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R9 15
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R10 16
#define EF_R11 17
#define EF_R12 18
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R13 19
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R14 20
#define EF_R15 21
#define EF_R16 22
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R17 23
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R18 24
#define EF_R19 25
#define EF_R20 26
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R21 27
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R22 28
#define EF_R23 29
#define EF_R24 30
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R25 31
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R26 32
#define EF_R27 33
#define EF_R28 34
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R29 35
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R30 36
#define EF_R31 37
#define EF_LO 38
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_HI 39
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_CP0_EPC 40
#define EF_CP0_BADVADDR 41
#define EF_CP0_STATUS 42
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_CP0_CAUSE 43
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_UNUSED0 44
#define EF_SIZE 180
#endif
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#endif
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/resource.h b/ndk/platforms/android-9/arch-mips/include/asm/resource.h
index e84107204..1374d7d5d 100644
--- a/ndk/platforms/android-9/arch-mips/include/asm/resource.h
+++ b/ndk/platforms/android-9/arch-mips/include/asm/resource.h
@@ -24,6 +24,7 @@
#define RLIMIT_RSS 7
#define RLIMIT_NPROC 8
#define RLIMIT_MEMLOCK 9
-#include <asm-generic/resource.h>
+#define RLIM_INFINITY 0x7fffffffUL
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm-generic/resource.h>
#endif
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/siginfo.h b/ndk/platforms/android-9/arch-mips/include/asm/siginfo.h
index f3e508a89..8fdbf77f7 100644
--- a/ndk/platforms/android-9/arch-mips/include/asm/siginfo.h
+++ b/ndk/platforms/android-9/arch-mips/include/asm/siginfo.h
@@ -24,73 +24,75 @@
#define HAVE_ARCH_SIGINFO_T
#define HAVE_ARCH_COPY_SIGINFO
struct siginfo;
-#include <asm-generic/siginfo.h>
+#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm-generic/siginfo.h>
typedef struct siginfo {
int si_signo;
int si_code;
- int si_errno;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ int si_errno;
int __pad0[SI_MAX_SIZE / sizeof(int) - SI_PAD_SIZE - 3];
union {
int _pad[SI_PAD_SIZE];
- struct {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct {
pid_t _pid;
__ARCH_SI_UID_T _uid;
} _kill;
- struct {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct {
timer_t _tid;
int _overrun;
char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
- sigval_t _sigval;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ sigval_t _sigval;
int _sys_private;
} _timer;
struct {
- pid_t _pid;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ pid_t _pid;
__ARCH_SI_UID_T _uid;
sigval_t _sigval;
} _rt;
- struct {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct {
pid_t _pid;
__ARCH_SI_UID_T _uid;
int _status;
- clock_t _utime;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ clock_t _utime;
clock_t _stime;
} _sigchld;
struct {
- pid_t _pid;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ pid_t _pid;
clock_t _utime;
int _status;
clock_t _stime;
- } _irix_sigchld;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } _irix_sigchld;
struct {
void __user *_addr;
#ifdef __ARCH_SI_TRAPNO
- int _trapno;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ int _trapno;
#endif
} _sigfault;
struct {
- __ARCH_SI_BAND_T _band;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __ARCH_SI_BAND_T _band;
int _fd;
} _sigpoll;
} _sifields;
-} siginfo_t;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+} siginfo_t;
#undef SI_ASYNCIO
#undef SI_TIMER
#undef SI_MESGQ
-#define SI_ASYNCIO -2
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SI_ASYNCIO -2
#define SI_TIMER __SI_CODE(__SI_TIMER, -3)
#define SI_MESGQ __SI_CODE(__SI_MESGQ, -4)
#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/socket.h b/ndk/platforms/android-9/arch-mips/include/asm/socket.h
index ff8a3baf7..4dbbe85c6 100644
--- a/ndk/platforms/android-9/arch-mips/include/asm/socket.h
+++ b/ndk/platforms/android-9/arch-mips/include/asm/socket.h
@@ -42,30 +42,39 @@
#define SO_RCVTIMEO 0x1006
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SO_ACCEPTCONN 0x1009
+#define SO_PROTOCOL 0x1028
+#define SO_DOMAIN 0x1029
#define SO_NO_CHECK 11
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SO_PRIORITY 12
#define SO_BSDCOMPAT 14
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SO_PASSCRED 17
#define SO_PEERCRED 18
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SO_SECURITY_AUTHENTICATION 22
#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SO_SECURITY_ENCRYPTION_NETWORK 24
#define SO_BINDTODEVICE 25
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SO_ATTACH_FILTER 26
#define SO_DETACH_FILTER 27
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SO_PEERNAME 28
#define SO_TIMESTAMP 29
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SCM_TIMESTAMP SO_TIMESTAMP
#define SO_PEERSEC 30
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SO_SNDBUFFORCE 31
#define SO_RCVBUFFORCE 33
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SO_PASSSEC 34
#define SO_TIMESTAMPNS 35
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
#define SO_MARK 36
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_TIMESTAMPING 37
+#define SCM_TIMESTAMPING SO_TIMESTAMPING
+#define SO_RXQ_OVFL 40
+#define SO_WIFI_STATUS 41
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
#endif
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/string.h b/ndk/platforms/android-9/arch-mips/include/asm/string.h
index 856f61bbc..6f375a339 100644
--- a/ndk/platforms/android-9/arch-mips/include/asm/string.h
+++ b/ndk/platforms/android-9/arch-mips/include/asm/string.h
@@ -18,8 +18,16 @@
****************************************************************************/
#ifndef _ASM_STRING_H
#define _ASM_STRING_H
+#ifndef IN_STRING_C
+#define __HAVE_ARCH_STRCPY
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __HAVE_ARCH_STRNCPY
+#define __HAVE_ARCH_STRCMP
+#endif
+#define __HAVE_ARCH_STRNCMP
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __HAVE_ARCH_MEMSET
#define __HAVE_ARCH_MEMCPY
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __HAVE_ARCH_MEMMOVE
#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/uaccess.h b/ndk/platforms/android-9/arch-mips/include/asm/uaccess.h
index 3703af3bb..96025d3b0 100644
--- a/ndk/platforms/android-9/arch-mips/include/asm/uaccess.h
+++ b/ndk/platforms/android-9/arch-mips/include/asm/uaccess.h
@@ -23,35 +23,45 @@
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#include <linux/thread_info.h>
#include <asm-generic/uaccess.h>
+#define __UA_LIMIT 0x80000000UL
+#define __UA_ADDR ".word"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __UA_LA "la"
+#define __UA_ADDU "addu"
+#define __UA_t0 "$8"
+#define __UA_t1 "$9"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define KERNEL_DS ((mm_segment_t) { 0UL })
#define USER_DS ((mm_segment_t) { __UA_LIMIT })
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define VERIFY_READ 0
#define VERIFY_WRITE 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define get_ds() (KERNEL_DS)
#define get_fs() (current_thread_info()->addr_limit)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define set_fs(x) (current_thread_info()->addr_limit = (x))
#define segment_eq(a, b) ((a).seg == (b).seg)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __ua_size(size) ((__builtin_constant_p(size) && (signed long) (size) > 0) ? 0 : (size))
#define __access_mask get_fs().seg
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __access_ok(addr, size, mask) (((signed long)((mask) & ((addr) | ((addr) + (size)) | __ua_size(size)))) == 0)
#define access_ok(type, addr, size) likely(__access_ok((unsigned long)(addr), (size), __access_mask))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define put_user(x,ptr) __put_user_check((x), (ptr), sizeof(*(ptr)))
#define get_user(x,ptr) __get_user_check((x), (ptr), sizeof(*(ptr)))
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __put_user(x,ptr) __put_user_nocheck((x), (ptr), sizeof(*(ptr)))
#define __get_user(x,ptr) __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct __large_struct { unsigned long buf[100]; };
#define __m(x) (*(struct __large_struct __user *)(x))
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __GET_USER_DW(val, ptr) __get_user_asm_ll32(val, ptr)
#define __get_user_common(val, size, ptr) do { switch (size) { case 1: __get_user_asm(val, "lb", ptr); break; case 2: __get_user_asm(val, "lh", ptr); break; case 4: __get_user_asm(val, "lw", ptr); break; case 8: __GET_USER_DW(val, ptr); break; default: __get_user_unknown(); break; } } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __get_user_nocheck(x, ptr, size) ({ long __gu_err; __get_user_common((x), size, ptr); __gu_err; })
#define __get_user_check(x, ptr, size) ({ long __gu_err = -EFAULT; const __typeof__(*(ptr)) __user * __gu_ptr = (ptr); if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) __get_user_common((x), size, __gu_ptr); __gu_err; })
#define __get_user_asm(val, insn, addr) { long __gu_tmp; __asm__ __volatile__( "1: " insn " %1, %3 \n" "2: \n" " .section .fixup,\"ax\" \n" "3: li %0, %4 \n" " j 2b \n" " .previous \n" " .section __ex_table,\"a\" \n" " "__UA_ADDR "\t1b, 3b \n" " .previous \n" : "=r" (__gu_err), "=r" (__gu_tmp) : "0" (0), "o" (__m(addr)), "i" (-EFAULT)); (val) = (__typeof__(*(addr))) __gu_tmp; }
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __get_user_asm_ll32(val, addr) { union { unsigned long long l; __typeof__(*(addr)) t; } __gu_tmp; __asm__ __volatile__( "1: lw %1, (%3) \n" "2: lw %D1, 4(%3) \n" "3: .section .fixup,\"ax\" \n" "4: li %0, %4 \n" " move %1, $0 \n" " move %D1, $0 \n" " j 3b \n" " .previous \n" " .section __ex_table,\"a\" \n" " " __UA_ADDR " 1b, 4b \n" " " __UA_ADDR " 2b, 4b \n" " .previous \n" : "=r" (__gu_err), "=&r" (__gu_tmp.l) : "0" (0), "r" (addr), "i" (-EFAULT)); (val) = __gu_tmp.t; }
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __PUT_USER_DW(ptr) __put_user_asm_ll32(ptr)
#define __put_user_nocheck(x, ptr, size) ({ __typeof__(*(ptr)) __pu_val; long __pu_err = 0; __pu_val = (x); switch (size) { case 1: __put_user_asm("sb", ptr); break; case 2: __put_user_asm("sh", ptr); break; case 4: __put_user_asm("sw", ptr); break; case 8: __PUT_USER_DW(ptr); break; default: __put_user_unknown(); break; } __pu_err; })
#define __put_user_check(x, ptr, size) ({ __typeof__(*(ptr)) __user *__pu_addr = (ptr); __typeof__(*(ptr)) __pu_val = (x); long __pu_err = -EFAULT; if (likely(access_ok(VERIFY_WRITE, __pu_addr, size))) { switch (size) { case 1: __put_user_asm("sb", __pu_addr); break; case 2: __put_user_asm("sh", __pu_addr); break; case 4: __put_user_asm("sw", __pu_addr); break; case 8: __PUT_USER_DW(__pu_addr); break; default: __put_user_unknown(); break; } } __pu_err; })
#define __put_user_asm(insn, ptr) { __asm__ __volatile__( "1: " insn " %z2, %3 # __put_user_asm\n" "2: \n" " .section .fixup,\"ax\" \n" "3: li %0, %4 \n" " j 2b \n" " .previous \n" " .section __ex_table,\"a\" \n" " " __UA_ADDR " 1b, 3b \n" " .previous \n" : "=r" (__pu_err) : "0" (0), "Jr" (__pu_val), "o" (__m(ptr)), "i" (-EFAULT)); }
diff --git a/ndk/platforms/android-9/arch-mips/include/asm/unistd.h b/ndk/platforms/android-9/arch-mips/include/asm/unistd.h
index 38e84ccba..4a8744fe7 100644
--- a/ndk/platforms/android-9/arch-mips/include/asm/unistd.h
+++ b/ndk/platforms/android-9/arch-mips/include/asm/unistd.h
@@ -433,749 +433,814 @@
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_pipe2 (__NR_Linux + 328)
#define __NR_inotify_init1 (__NR_Linux + 329)
-#define __NR_Linux_syscalls 329
-#endif
+#define __NR_preadv (__NR_Linux + 330)
+#define __NR_pwritev (__NR_Linux + 331)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_rt_tgsigqueueinfo (__NR_Linux + 332)
+#define __NR_perf_event_open (__NR_Linux + 333)
+#define __NR_accept4 (__NR_Linux + 334)
+#define __NR_recvmmsg (__NR_Linux + 335)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fanotify_init (__NR_Linux + 336)
+#define __NR_fanotify_mark (__NR_Linux + 337)
+#define __NR_prlimit64 (__NR_Linux + 338)
+#define __NR_name_to_handle_at (__NR_Linux + 339)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_open_by_handle_at (__NR_Linux + 340)
+#define __NR_clock_adjtime (__NR_Linux + 341)
+#define __NR_syncfs (__NR_Linux + 342)
+#define __NR_sendmmsg (__NR_Linux + 343)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setns (__NR_Linux + 344)
+#define __NR_process_vm_readv (__NR_Linux + 345)
+#define __NR_process_vm_writev (__NR_Linux + 346)
+#define __NR_Linux_syscalls 346
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
#define __NR_O32_Linux 4000
-#define __NR_O32_Linux_syscalls 329
+#define __NR_O32_Linux_syscalls 346
#if _MIPS_SIM == _MIPS_SIM_ABI64
-#define __NR_Linux 5000
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_Linux 5000
#define __NR_read (__NR_Linux + 0)
#define __NR_write (__NR_Linux + 1)
#define __NR_open (__NR_Linux + 2)
-#define __NR_close (__NR_Linux + 3)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_close (__NR_Linux + 3)
#define __NR_stat (__NR_Linux + 4)
#define __NR_fstat (__NR_Linux + 5)
#define __NR_lstat (__NR_Linux + 6)
-#define __NR_poll (__NR_Linux + 7)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_poll (__NR_Linux + 7)
#define __NR_lseek (__NR_Linux + 8)
#define __NR_mmap (__NR_Linux + 9)
#define __NR_mprotect (__NR_Linux + 10)
-#define __NR_munmap (__NR_Linux + 11)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_munmap (__NR_Linux + 11)
#define __NR_brk (__NR_Linux + 12)
#define __NR_rt_sigaction (__NR_Linux + 13)
#define __NR_rt_sigprocmask (__NR_Linux + 14)
-#define __NR_ioctl (__NR_Linux + 15)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_ioctl (__NR_Linux + 15)
#define __NR_pread64 (__NR_Linux + 16)
#define __NR_pwrite64 (__NR_Linux + 17)
#define __NR_readv (__NR_Linux + 18)
-#define __NR_writev (__NR_Linux + 19)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_writev (__NR_Linux + 19)
#define __NR_access (__NR_Linux + 20)
#define __NR_pipe (__NR_Linux + 21)
#define __NR__newselect (__NR_Linux + 22)
-#define __NR_sched_yield (__NR_Linux + 23)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sched_yield (__NR_Linux + 23)
#define __NR_mremap (__NR_Linux + 24)
#define __NR_msync (__NR_Linux + 25)
#define __NR_mincore (__NR_Linux + 26)
-#define __NR_madvise (__NR_Linux + 27)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_madvise (__NR_Linux + 27)
#define __NR_shmget (__NR_Linux + 28)
#define __NR_shmat (__NR_Linux + 29)
#define __NR_shmctl (__NR_Linux + 30)
-#define __NR_dup (__NR_Linux + 31)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_dup (__NR_Linux + 31)
#define __NR_dup2 (__NR_Linux + 32)
#define __NR_pause (__NR_Linux + 33)
#define __NR_nanosleep (__NR_Linux + 34)
-#define __NR_getitimer (__NR_Linux + 35)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getitimer (__NR_Linux + 35)
#define __NR_setitimer (__NR_Linux + 36)
#define __NR_alarm (__NR_Linux + 37)
#define __NR_getpid (__NR_Linux + 38)
-#define __NR_sendfile (__NR_Linux + 39)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sendfile (__NR_Linux + 39)
#define __NR_socket (__NR_Linux + 40)
#define __NR_connect (__NR_Linux + 41)
#define __NR_accept (__NR_Linux + 42)
-#define __NR_sendto (__NR_Linux + 43)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sendto (__NR_Linux + 43)
#define __NR_recvfrom (__NR_Linux + 44)
#define __NR_sendmsg (__NR_Linux + 45)
#define __NR_recvmsg (__NR_Linux + 46)
-#define __NR_shutdown (__NR_Linux + 47)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_shutdown (__NR_Linux + 47)
#define __NR_bind (__NR_Linux + 48)
#define __NR_listen (__NR_Linux + 49)
#define __NR_getsockname (__NR_Linux + 50)
-#define __NR_getpeername (__NR_Linux + 51)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getpeername (__NR_Linux + 51)
#define __NR_socketpair (__NR_Linux + 52)
#define __NR_setsockopt (__NR_Linux + 53)
#define __NR_getsockopt (__NR_Linux + 54)
-#define __NR_clone (__NR_Linux + 55)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_clone (__NR_Linux + 55)
#define __NR_fork (__NR_Linux + 56)
#define __NR_execve (__NR_Linux + 57)
#define __NR_exit (__NR_Linux + 58)
-#define __NR_wait4 (__NR_Linux + 59)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_wait4 (__NR_Linux + 59)
#define __NR_kill (__NR_Linux + 60)
#define __NR_uname (__NR_Linux + 61)
#define __NR_semget (__NR_Linux + 62)
-#define __NR_semop (__NR_Linux + 63)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_semop (__NR_Linux + 63)
#define __NR_semctl (__NR_Linux + 64)
#define __NR_shmdt (__NR_Linux + 65)
#define __NR_msgget (__NR_Linux + 66)
-#define __NR_msgsnd (__NR_Linux + 67)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_msgsnd (__NR_Linux + 67)
#define __NR_msgrcv (__NR_Linux + 68)
#define __NR_msgctl (__NR_Linux + 69)
#define __NR_fcntl (__NR_Linux + 70)
-#define __NR_flock (__NR_Linux + 71)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_flock (__NR_Linux + 71)
#define __NR_fsync (__NR_Linux + 72)
#define __NR_fdatasync (__NR_Linux + 73)
#define __NR_truncate (__NR_Linux + 74)
-#define __NR_ftruncate (__NR_Linux + 75)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_ftruncate (__NR_Linux + 75)
#define __NR_getdents (__NR_Linux + 76)
#define __NR_getcwd (__NR_Linux + 77)
#define __NR_chdir (__NR_Linux + 78)
-#define __NR_fchdir (__NR_Linux + 79)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fchdir (__NR_Linux + 79)
#define __NR_rename (__NR_Linux + 80)
#define __NR_mkdir (__NR_Linux + 81)
#define __NR_rmdir (__NR_Linux + 82)
-#define __NR_creat (__NR_Linux + 83)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_creat (__NR_Linux + 83)
#define __NR_link (__NR_Linux + 84)
#define __NR_unlink (__NR_Linux + 85)
#define __NR_symlink (__NR_Linux + 86)
-#define __NR_readlink (__NR_Linux + 87)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_readlink (__NR_Linux + 87)
#define __NR_chmod (__NR_Linux + 88)
#define __NR_fchmod (__NR_Linux + 89)
#define __NR_chown (__NR_Linux + 90)
-#define __NR_fchown (__NR_Linux + 91)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fchown (__NR_Linux + 91)
#define __NR_lchown (__NR_Linux + 92)
#define __NR_umask (__NR_Linux + 93)
#define __NR_gettimeofday (__NR_Linux + 94)
-#define __NR_getrlimit (__NR_Linux + 95)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getrlimit (__NR_Linux + 95)
#define __NR_getrusage (__NR_Linux + 96)
#define __NR_sysinfo (__NR_Linux + 97)
#define __NR_times (__NR_Linux + 98)
-#define __NR_ptrace (__NR_Linux + 99)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_ptrace (__NR_Linux + 99)
#define __NR_getuid (__NR_Linux + 100)
#define __NR_syslog (__NR_Linux + 101)
#define __NR_getgid (__NR_Linux + 102)
-#define __NR_setuid (__NR_Linux + 103)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setuid (__NR_Linux + 103)
#define __NR_setgid (__NR_Linux + 104)
#define __NR_geteuid (__NR_Linux + 105)
#define __NR_getegid (__NR_Linux + 106)
-#define __NR_setpgid (__NR_Linux + 107)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setpgid (__NR_Linux + 107)
#define __NR_getppid (__NR_Linux + 108)
#define __NR_getpgrp (__NR_Linux + 109)
#define __NR_setsid (__NR_Linux + 110)
-#define __NR_setreuid (__NR_Linux + 111)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setreuid (__NR_Linux + 111)
#define __NR_setregid (__NR_Linux + 112)
#define __NR_getgroups (__NR_Linux + 113)
#define __NR_setgroups (__NR_Linux + 114)
-#define __NR_setresuid (__NR_Linux + 115)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setresuid (__NR_Linux + 115)
#define __NR_getresuid (__NR_Linux + 116)
#define __NR_setresgid (__NR_Linux + 117)
#define __NR_getresgid (__NR_Linux + 118)
-#define __NR_getpgid (__NR_Linux + 119)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getpgid (__NR_Linux + 119)
#define __NR_setfsuid (__NR_Linux + 120)
#define __NR_setfsgid (__NR_Linux + 121)
#define __NR_getsid (__NR_Linux + 122)
-#define __NR_capget (__NR_Linux + 123)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_capget (__NR_Linux + 123)
#define __NR_capset (__NR_Linux + 124)
#define __NR_rt_sigpending (__NR_Linux + 125)
#define __NR_rt_sigtimedwait (__NR_Linux + 126)
-#define __NR_rt_sigqueueinfo (__NR_Linux + 127)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_rt_sigqueueinfo (__NR_Linux + 127)
#define __NR_rt_sigsuspend (__NR_Linux + 128)
#define __NR_sigaltstack (__NR_Linux + 129)
#define __NR_utime (__NR_Linux + 130)
-#define __NR_mknod (__NR_Linux + 131)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mknod (__NR_Linux + 131)
#define __NR_personality (__NR_Linux + 132)
#define __NR_ustat (__NR_Linux + 133)
#define __NR_statfs (__NR_Linux + 134)
-#define __NR_fstatfs (__NR_Linux + 135)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fstatfs (__NR_Linux + 135)
#define __NR_sysfs (__NR_Linux + 136)
#define __NR_getpriority (__NR_Linux + 137)
#define __NR_setpriority (__NR_Linux + 138)
-#define __NR_sched_setparam (__NR_Linux + 139)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sched_setparam (__NR_Linux + 139)
#define __NR_sched_getparam (__NR_Linux + 140)
#define __NR_sched_setscheduler (__NR_Linux + 141)
#define __NR_sched_getscheduler (__NR_Linux + 142)
-#define __NR_sched_get_priority_max (__NR_Linux + 143)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sched_get_priority_max (__NR_Linux + 143)
#define __NR_sched_get_priority_min (__NR_Linux + 144)
#define __NR_sched_rr_get_interval (__NR_Linux + 145)
#define __NR_mlock (__NR_Linux + 146)
-#define __NR_munlock (__NR_Linux + 147)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_munlock (__NR_Linux + 147)
#define __NR_mlockall (__NR_Linux + 148)
#define __NR_munlockall (__NR_Linux + 149)
#define __NR_vhangup (__NR_Linux + 150)
-#define __NR_pivot_root (__NR_Linux + 151)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_pivot_root (__NR_Linux + 151)
#define __NR__sysctl (__NR_Linux + 152)
#define __NR_prctl (__NR_Linux + 153)
#define __NR_adjtimex (__NR_Linux + 154)
-#define __NR_setrlimit (__NR_Linux + 155)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setrlimit (__NR_Linux + 155)
#define __NR_chroot (__NR_Linux + 156)
#define __NR_sync (__NR_Linux + 157)
#define __NR_acct (__NR_Linux + 158)
-#define __NR_settimeofday (__NR_Linux + 159)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_settimeofday (__NR_Linux + 159)
#define __NR_mount (__NR_Linux + 160)
#define __NR_umount2 (__NR_Linux + 161)
#define __NR_swapon (__NR_Linux + 162)
-#define __NR_swapoff (__NR_Linux + 163)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_swapoff (__NR_Linux + 163)
#define __NR_reboot (__NR_Linux + 164)
#define __NR_sethostname (__NR_Linux + 165)
#define __NR_setdomainname (__NR_Linux + 166)
-#define __NR_create_module (__NR_Linux + 167)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_create_module (__NR_Linux + 167)
#define __NR_init_module (__NR_Linux + 168)
#define __NR_delete_module (__NR_Linux + 169)
#define __NR_get_kernel_syms (__NR_Linux + 170)
-#define __NR_query_module (__NR_Linux + 171)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_query_module (__NR_Linux + 171)
#define __NR_quotactl (__NR_Linux + 172)
#define __NR_nfsservctl (__NR_Linux + 173)
#define __NR_getpmsg (__NR_Linux + 174)
-#define __NR_putpmsg (__NR_Linux + 175)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_putpmsg (__NR_Linux + 175)
#define __NR_afs_syscall (__NR_Linux + 176)
#define __NR_reserved177 (__NR_Linux + 177)
#define __NR_gettid (__NR_Linux + 178)
-#define __NR_readahead (__NR_Linux + 179)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_readahead (__NR_Linux + 179)
#define __NR_setxattr (__NR_Linux + 180)
#define __NR_lsetxattr (__NR_Linux + 181)
#define __NR_fsetxattr (__NR_Linux + 182)
-#define __NR_getxattr (__NR_Linux + 183)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getxattr (__NR_Linux + 183)
#define __NR_lgetxattr (__NR_Linux + 184)
#define __NR_fgetxattr (__NR_Linux + 185)
#define __NR_listxattr (__NR_Linux + 186)
-#define __NR_llistxattr (__NR_Linux + 187)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_llistxattr (__NR_Linux + 187)
#define __NR_flistxattr (__NR_Linux + 188)
#define __NR_removexattr (__NR_Linux + 189)
#define __NR_lremovexattr (__NR_Linux + 190)
-#define __NR_fremovexattr (__NR_Linux + 191)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fremovexattr (__NR_Linux + 191)
#define __NR_tkill (__NR_Linux + 192)
#define __NR_reserved193 (__NR_Linux + 193)
#define __NR_futex (__NR_Linux + 194)
-#define __NR_sched_setaffinity (__NR_Linux + 195)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sched_setaffinity (__NR_Linux + 195)
#define __NR_sched_getaffinity (__NR_Linux + 196)
#define __NR_cacheflush (__NR_Linux + 197)
#define __NR_cachectl (__NR_Linux + 198)
-#define __NR_sysmips (__NR_Linux + 199)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sysmips (__NR_Linux + 199)
#define __NR_io_setup (__NR_Linux + 200)
#define __NR_io_destroy (__NR_Linux + 201)
#define __NR_io_getevents (__NR_Linux + 202)
-#define __NR_io_submit (__NR_Linux + 203)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_io_submit (__NR_Linux + 203)
#define __NR_io_cancel (__NR_Linux + 204)
#define __NR_exit_group (__NR_Linux + 205)
#define __NR_lookup_dcookie (__NR_Linux + 206)
-#define __NR_epoll_create (__NR_Linux + 207)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_epoll_create (__NR_Linux + 207)
#define __NR_epoll_ctl (__NR_Linux + 208)
#define __NR_epoll_wait (__NR_Linux + 209)
#define __NR_remap_file_pages (__NR_Linux + 210)
-#define __NR_rt_sigreturn (__NR_Linux + 211)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_rt_sigreturn (__NR_Linux + 211)
#define __NR_set_tid_address (__NR_Linux + 212)
#define __NR_restart_syscall (__NR_Linux + 213)
#define __NR_semtimedop (__NR_Linux + 214)
-#define __NR_fadvise64 (__NR_Linux + 215)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fadvise64 (__NR_Linux + 215)
#define __NR_timer_create (__NR_Linux + 216)
#define __NR_timer_settime (__NR_Linux + 217)
#define __NR_timer_gettime (__NR_Linux + 218)
-#define __NR_timer_getoverrun (__NR_Linux + 219)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_timer_getoverrun (__NR_Linux + 219)
#define __NR_timer_delete (__NR_Linux + 220)
#define __NR_clock_settime (__NR_Linux + 221)
#define __NR_clock_gettime (__NR_Linux + 222)
-#define __NR_clock_getres (__NR_Linux + 223)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_clock_getres (__NR_Linux + 223)
#define __NR_clock_nanosleep (__NR_Linux + 224)
#define __NR_tgkill (__NR_Linux + 225)
#define __NR_utimes (__NR_Linux + 226)
-#define __NR_mbind (__NR_Linux + 227)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mbind (__NR_Linux + 227)
#define __NR_get_mempolicy (__NR_Linux + 228)
#define __NR_set_mempolicy (__NR_Linux + 229)
#define __NR_mq_open (__NR_Linux + 230)
-#define __NR_mq_unlink (__NR_Linux + 231)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mq_unlink (__NR_Linux + 231)
#define __NR_mq_timedsend (__NR_Linux + 232)
#define __NR_mq_timedreceive (__NR_Linux + 233)
#define __NR_mq_notify (__NR_Linux + 234)
-#define __NR_mq_getsetattr (__NR_Linux + 235)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mq_getsetattr (__NR_Linux + 235)
#define __NR_vserver (__NR_Linux + 236)
#define __NR_waitid (__NR_Linux + 237)
#define __NR_add_key (__NR_Linux + 239)
-#define __NR_request_key (__NR_Linux + 240)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_request_key (__NR_Linux + 240)
#define __NR_keyctl (__NR_Linux + 241)
#define __NR_set_thread_area (__NR_Linux + 242)
#define __NR_inotify_init (__NR_Linux + 243)
-#define __NR_inotify_add_watch (__NR_Linux + 244)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_inotify_add_watch (__NR_Linux + 244)
#define __NR_inotify_rm_watch (__NR_Linux + 245)
#define __NR_migrate_pages (__NR_Linux + 246)
#define __NR_openat (__NR_Linux + 247)
-#define __NR_mkdirat (__NR_Linux + 248)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mkdirat (__NR_Linux + 248)
#define __NR_mknodat (__NR_Linux + 249)
#define __NR_fchownat (__NR_Linux + 250)
#define __NR_futimesat (__NR_Linux + 251)
-#define __NR_newfstatat (__NR_Linux + 252)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_newfstatat (__NR_Linux + 252)
#define __NR_unlinkat (__NR_Linux + 253)
#define __NR_renameat (__NR_Linux + 254)
#define __NR_linkat (__NR_Linux + 255)
-#define __NR_symlinkat (__NR_Linux + 256)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_symlinkat (__NR_Linux + 256)
#define __NR_readlinkat (__NR_Linux + 257)
#define __NR_fchmodat (__NR_Linux + 258)
#define __NR_faccessat (__NR_Linux + 259)
-#define __NR_pselect6 (__NR_Linux + 260)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_pselect6 (__NR_Linux + 260)
#define __NR_ppoll (__NR_Linux + 261)
#define __NR_unshare (__NR_Linux + 262)
#define __NR_splice (__NR_Linux + 263)
-#define __NR_sync_file_range (__NR_Linux + 264)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sync_file_range (__NR_Linux + 264)
#define __NR_tee (__NR_Linux + 265)
#define __NR_vmsplice (__NR_Linux + 266)
#define __NR_move_pages (__NR_Linux + 267)
-#define __NR_set_robust_list (__NR_Linux + 268)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_set_robust_list (__NR_Linux + 268)
#define __NR_get_robust_list (__NR_Linux + 269)
#define __NR_kexec_load (__NR_Linux + 270)
#define __NR_getcpu (__NR_Linux + 271)
-#define __NR_epoll_pwait (__NR_Linux + 272)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_epoll_pwait (__NR_Linux + 272)
#define __NR_ioprio_set (__NR_Linux + 273)
#define __NR_ioprio_get (__NR_Linux + 274)
#define __NR_utimensat (__NR_Linux + 275)
-#define __NR_signalfd (__NR_Linux + 276)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_signalfd (__NR_Linux + 276)
#define __NR_timerfd (__NR_Linux + 277)
#define __NR_eventfd (__NR_Linux + 278)
#define __NR_fallocate (__NR_Linux + 279)
-#define __NR_timerfd_create (__NR_Linux + 280)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_timerfd_create (__NR_Linux + 280)
#define __NR_timerfd_gettime (__NR_Linux + 281)
#define __NR_timerfd_settime (__NR_Linux + 282)
#define __NR_signalfd4 (__NR_Linux + 283)
-#define __NR_eventfd2 (__NR_Linux + 284)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_eventfd2 (__NR_Linux + 284)
#define __NR_epoll_create1 (__NR_Linux + 285)
#define __NR_dup3 (__NR_Linux + 286)
#define __NR_pipe2 (__NR_Linux + 287)
-#define __NR_inotify_init1 (__NR_Linux + 288)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define __NR_Linux_syscalls 288
+#define __NR_inotify_init1 (__NR_Linux + 288)
+#define __NR_preadv (__NR_Linux + 289)
+#define __NR_pwritev (__NR_Linux + 290)
+#define __NR_rt_tgsigqueueinfo (__NR_Linux + 291)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_perf_event_open (__NR_Linux + 292)
+#define __NR_accept4 (__NR_Linux + 293)
+#define __NR_recvmmsg (__NR_Linux + 294)
+#define __NR_fanotify_init (__NR_Linux + 295)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fanotify_mark (__NR_Linux + 296)
+#define __NR_prlimit64 (__NR_Linux + 297)
+#define __NR_name_to_handle_at (__NR_Linux + 298)
+#define __NR_open_by_handle_at (__NR_Linux + 299)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_clock_adjtime (__NR_Linux + 300)
+#define __NR_syncfs (__NR_Linux + 301)
+#define __NR_sendmmsg (__NR_Linux + 302)
+#define __NR_setns (__NR_Linux + 303)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_process_vm_readv (__NR_Linux + 304)
+#define __NR_process_vm_writev (__NR_Linux + 305)
+#define __NR_Linux_syscalls 305
#endif
-#define __NR_64_Linux 5000
-#define __NR_64_Linux_syscalls 288
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_64_Linux 5000
+#define __NR_64_Linux_syscalls 305
#if _MIPS_SIM == _MIPS_SIM_NABI32
#define __NR_Linux 6000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_read (__NR_Linux + 0)
#define __NR_write (__NR_Linux + 1)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_open (__NR_Linux + 2)
#define __NR_close (__NR_Linux + 3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_stat (__NR_Linux + 4)
#define __NR_fstat (__NR_Linux + 5)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_lstat (__NR_Linux + 6)
#define __NR_poll (__NR_Linux + 7)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_lseek (__NR_Linux + 8)
#define __NR_mmap (__NR_Linux + 9)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_mprotect (__NR_Linux + 10)
#define __NR_munmap (__NR_Linux + 11)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_brk (__NR_Linux + 12)
#define __NR_rt_sigaction (__NR_Linux + 13)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_rt_sigprocmask (__NR_Linux + 14)
#define __NR_ioctl (__NR_Linux + 15)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_pread64 (__NR_Linux + 16)
#define __NR_pwrite64 (__NR_Linux + 17)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_readv (__NR_Linux + 18)
#define __NR_writev (__NR_Linux + 19)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_access (__NR_Linux + 20)
#define __NR_pipe (__NR_Linux + 21)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR__newselect (__NR_Linux + 22)
#define __NR_sched_yield (__NR_Linux + 23)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_mremap (__NR_Linux + 24)
#define __NR_msync (__NR_Linux + 25)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_mincore (__NR_Linux + 26)
#define __NR_madvise (__NR_Linux + 27)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_shmget (__NR_Linux + 28)
#define __NR_shmat (__NR_Linux + 29)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_shmctl (__NR_Linux + 30)
#define __NR_dup (__NR_Linux + 31)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_dup2 (__NR_Linux + 32)
#define __NR_pause (__NR_Linux + 33)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_nanosleep (__NR_Linux + 34)
#define __NR_getitimer (__NR_Linux + 35)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_setitimer (__NR_Linux + 36)
#define __NR_alarm (__NR_Linux + 37)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getpid (__NR_Linux + 38)
#define __NR_sendfile (__NR_Linux + 39)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_socket (__NR_Linux + 40)
#define __NR_connect (__NR_Linux + 41)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_accept (__NR_Linux + 42)
#define __NR_sendto (__NR_Linux + 43)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_recvfrom (__NR_Linux + 44)
#define __NR_sendmsg (__NR_Linux + 45)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_recvmsg (__NR_Linux + 46)
#define __NR_shutdown (__NR_Linux + 47)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_bind (__NR_Linux + 48)
#define __NR_listen (__NR_Linux + 49)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getsockname (__NR_Linux + 50)
#define __NR_getpeername (__NR_Linux + 51)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_socketpair (__NR_Linux + 52)
#define __NR_setsockopt (__NR_Linux + 53)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getsockopt (__NR_Linux + 54)
#define __NR_clone (__NR_Linux + 55)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_fork (__NR_Linux + 56)
#define __NR_execve (__NR_Linux + 57)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_exit (__NR_Linux + 58)
#define __NR_wait4 (__NR_Linux + 59)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_kill (__NR_Linux + 60)
#define __NR_uname (__NR_Linux + 61)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_semget (__NR_Linux + 62)
#define __NR_semop (__NR_Linux + 63)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_semctl (__NR_Linux + 64)
#define __NR_shmdt (__NR_Linux + 65)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_msgget (__NR_Linux + 66)
#define __NR_msgsnd (__NR_Linux + 67)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_msgrcv (__NR_Linux + 68)
#define __NR_msgctl (__NR_Linux + 69)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_fcntl (__NR_Linux + 70)
#define __NR_flock (__NR_Linux + 71)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_fsync (__NR_Linux + 72)
#define __NR_fdatasync (__NR_Linux + 73)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_truncate (__NR_Linux + 74)
#define __NR_ftruncate (__NR_Linux + 75)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getdents (__NR_Linux + 76)
#define __NR_getcwd (__NR_Linux + 77)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_chdir (__NR_Linux + 78)
#define __NR_fchdir (__NR_Linux + 79)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_rename (__NR_Linux + 80)
#define __NR_mkdir (__NR_Linux + 81)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_rmdir (__NR_Linux + 82)
#define __NR_creat (__NR_Linux + 83)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_link (__NR_Linux + 84)
#define __NR_unlink (__NR_Linux + 85)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_symlink (__NR_Linux + 86)
#define __NR_readlink (__NR_Linux + 87)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_chmod (__NR_Linux + 88)
#define __NR_fchmod (__NR_Linux + 89)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_chown (__NR_Linux + 90)
#define __NR_fchown (__NR_Linux + 91)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_lchown (__NR_Linux + 92)
#define __NR_umask (__NR_Linux + 93)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_gettimeofday (__NR_Linux + 94)
#define __NR_getrlimit (__NR_Linux + 95)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getrusage (__NR_Linux + 96)
#define __NR_sysinfo (__NR_Linux + 97)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_times (__NR_Linux + 98)
#define __NR_ptrace (__NR_Linux + 99)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getuid (__NR_Linux + 100)
#define __NR_syslog (__NR_Linux + 101)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getgid (__NR_Linux + 102)
#define __NR_setuid (__NR_Linux + 103)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_setgid (__NR_Linux + 104)
#define __NR_geteuid (__NR_Linux + 105)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getegid (__NR_Linux + 106)
#define __NR_setpgid (__NR_Linux + 107)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getppid (__NR_Linux + 108)
#define __NR_getpgrp (__NR_Linux + 109)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_setsid (__NR_Linux + 110)
#define __NR_setreuid (__NR_Linux + 111)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_setregid (__NR_Linux + 112)
#define __NR_getgroups (__NR_Linux + 113)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_setgroups (__NR_Linux + 114)
#define __NR_setresuid (__NR_Linux + 115)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getresuid (__NR_Linux + 116)
#define __NR_setresgid (__NR_Linux + 117)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getresgid (__NR_Linux + 118)
#define __NR_getpgid (__NR_Linux + 119)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_setfsuid (__NR_Linux + 120)
#define __NR_setfsgid (__NR_Linux + 121)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getsid (__NR_Linux + 122)
#define __NR_capget (__NR_Linux + 123)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_capset (__NR_Linux + 124)
#define __NR_rt_sigpending (__NR_Linux + 125)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_rt_sigtimedwait (__NR_Linux + 126)
#define __NR_rt_sigqueueinfo (__NR_Linux + 127)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_rt_sigsuspend (__NR_Linux + 128)
#define __NR_sigaltstack (__NR_Linux + 129)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_utime (__NR_Linux + 130)
#define __NR_mknod (__NR_Linux + 131)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_personality (__NR_Linux + 132)
#define __NR_ustat (__NR_Linux + 133)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_statfs (__NR_Linux + 134)
#define __NR_fstatfs (__NR_Linux + 135)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_sysfs (__NR_Linux + 136)
#define __NR_getpriority (__NR_Linux + 137)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_setpriority (__NR_Linux + 138)
#define __NR_sched_setparam (__NR_Linux + 139)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_sched_getparam (__NR_Linux + 140)
#define __NR_sched_setscheduler (__NR_Linux + 141)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_sched_getscheduler (__NR_Linux + 142)
#define __NR_sched_get_priority_max (__NR_Linux + 143)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_sched_get_priority_min (__NR_Linux + 144)
#define __NR_sched_rr_get_interval (__NR_Linux + 145)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_mlock (__NR_Linux + 146)
#define __NR_munlock (__NR_Linux + 147)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_mlockall (__NR_Linux + 148)
#define __NR_munlockall (__NR_Linux + 149)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_vhangup (__NR_Linux + 150)
#define __NR_pivot_root (__NR_Linux + 151)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR__sysctl (__NR_Linux + 152)
#define __NR_prctl (__NR_Linux + 153)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_adjtimex (__NR_Linux + 154)
#define __NR_setrlimit (__NR_Linux + 155)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_chroot (__NR_Linux + 156)
#define __NR_sync (__NR_Linux + 157)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_acct (__NR_Linux + 158)
#define __NR_settimeofday (__NR_Linux + 159)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_mount (__NR_Linux + 160)
#define __NR_umount2 (__NR_Linux + 161)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_swapon (__NR_Linux + 162)
#define __NR_swapoff (__NR_Linux + 163)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_reboot (__NR_Linux + 164)
#define __NR_sethostname (__NR_Linux + 165)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_setdomainname (__NR_Linux + 166)
#define __NR_create_module (__NR_Linux + 167)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_init_module (__NR_Linux + 168)
#define __NR_delete_module (__NR_Linux + 169)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_get_kernel_syms (__NR_Linux + 170)
#define __NR_query_module (__NR_Linux + 171)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_quotactl (__NR_Linux + 172)
#define __NR_nfsservctl (__NR_Linux + 173)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getpmsg (__NR_Linux + 174)
#define __NR_putpmsg (__NR_Linux + 175)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_afs_syscall (__NR_Linux + 176)
#define __NR_reserved177 (__NR_Linux + 177)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_gettid (__NR_Linux + 178)
#define __NR_readahead (__NR_Linux + 179)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_setxattr (__NR_Linux + 180)
#define __NR_lsetxattr (__NR_Linux + 181)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_fsetxattr (__NR_Linux + 182)
#define __NR_getxattr (__NR_Linux + 183)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_lgetxattr (__NR_Linux + 184)
#define __NR_fgetxattr (__NR_Linux + 185)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_listxattr (__NR_Linux + 186)
#define __NR_llistxattr (__NR_Linux + 187)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_flistxattr (__NR_Linux + 188)
#define __NR_removexattr (__NR_Linux + 189)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_lremovexattr (__NR_Linux + 190)
#define __NR_fremovexattr (__NR_Linux + 191)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_tkill (__NR_Linux + 192)
#define __NR_reserved193 (__NR_Linux + 193)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_futex (__NR_Linux + 194)
#define __NR_sched_setaffinity (__NR_Linux + 195)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_sched_getaffinity (__NR_Linux + 196)
#define __NR_cacheflush (__NR_Linux + 197)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_cachectl (__NR_Linux + 198)
#define __NR_sysmips (__NR_Linux + 199)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_io_setup (__NR_Linux + 200)
#define __NR_io_destroy (__NR_Linux + 201)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_io_getevents (__NR_Linux + 202)
#define __NR_io_submit (__NR_Linux + 203)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_io_cancel (__NR_Linux + 204)
#define __NR_exit_group (__NR_Linux + 205)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_lookup_dcookie (__NR_Linux + 206)
#define __NR_epoll_create (__NR_Linux + 207)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_epoll_ctl (__NR_Linux + 208)
#define __NR_epoll_wait (__NR_Linux + 209)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_remap_file_pages (__NR_Linux + 210)
#define __NR_rt_sigreturn (__NR_Linux + 211)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_fcntl64 (__NR_Linux + 212)
#define __NR_set_tid_address (__NR_Linux + 213)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_restart_syscall (__NR_Linux + 214)
#define __NR_semtimedop (__NR_Linux + 215)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_fadvise64 (__NR_Linux + 216)
#define __NR_statfs64 (__NR_Linux + 217)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_fstatfs64 (__NR_Linux + 218)
#define __NR_sendfile64 (__NR_Linux + 219)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_timer_create (__NR_Linux + 220)
#define __NR_timer_settime (__NR_Linux + 221)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_timer_gettime (__NR_Linux + 222)
#define __NR_timer_getoverrun (__NR_Linux + 223)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_timer_delete (__NR_Linux + 224)
#define __NR_clock_settime (__NR_Linux + 225)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_clock_gettime (__NR_Linux + 226)
#define __NR_clock_getres (__NR_Linux + 227)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_clock_nanosleep (__NR_Linux + 228)
#define __NR_tgkill (__NR_Linux + 229)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_utimes (__NR_Linux + 230)
#define __NR_mbind (__NR_Linux + 231)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_get_mempolicy (__NR_Linux + 232)
#define __NR_set_mempolicy (__NR_Linux + 233)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_mq_open (__NR_Linux + 234)
#define __NR_mq_unlink (__NR_Linux + 235)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_mq_timedsend (__NR_Linux + 236)
#define __NR_mq_timedreceive (__NR_Linux + 237)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_mq_notify (__NR_Linux + 238)
#define __NR_mq_getsetattr (__NR_Linux + 239)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_vserver (__NR_Linux + 240)
#define __NR_waitid (__NR_Linux + 241)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_add_key (__NR_Linux + 243)
#define __NR_request_key (__NR_Linux + 244)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_keyctl (__NR_Linux + 245)
#define __NR_set_thread_area (__NR_Linux + 246)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_inotify_init (__NR_Linux + 247)
#define __NR_inotify_add_watch (__NR_Linux + 248)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_inotify_rm_watch (__NR_Linux + 249)
#define __NR_migrate_pages (__NR_Linux + 250)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_openat (__NR_Linux + 251)
#define __NR_mkdirat (__NR_Linux + 252)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_mknodat (__NR_Linux + 253)
#define __NR_fchownat (__NR_Linux + 254)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_futimesat (__NR_Linux + 255)
#define __NR_newfstatat (__NR_Linux + 256)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_unlinkat (__NR_Linux + 257)
#define __NR_renameat (__NR_Linux + 258)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_linkat (__NR_Linux + 259)
#define __NR_symlinkat (__NR_Linux + 260)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_readlinkat (__NR_Linux + 261)
#define __NR_fchmodat (__NR_Linux + 262)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_faccessat (__NR_Linux + 263)
#define __NR_pselect6 (__NR_Linux + 264)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_ppoll (__NR_Linux + 265)
#define __NR_unshare (__NR_Linux + 266)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_splice (__NR_Linux + 267)
#define __NR_sync_file_range (__NR_Linux + 268)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_tee (__NR_Linux + 269)
#define __NR_vmsplice (__NR_Linux + 270)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_move_pages (__NR_Linux + 271)
#define __NR_set_robust_list (__NR_Linux + 272)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_get_robust_list (__NR_Linux + 273)
#define __NR_kexec_load (__NR_Linux + 274)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_getcpu (__NR_Linux + 275)
#define __NR_epoll_pwait (__NR_Linux + 276)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_ioprio_set (__NR_Linux + 277)
#define __NR_ioprio_get (__NR_Linux + 278)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_utimensat (__NR_Linux + 279)
#define __NR_signalfd (__NR_Linux + 280)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_timerfd (__NR_Linux + 281)
#define __NR_eventfd (__NR_Linux + 282)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_fallocate (__NR_Linux + 283)
#define __NR_timerfd_create (__NR_Linux + 284)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_timerfd_gettime (__NR_Linux + 285)
#define __NR_timerfd_settime (__NR_Linux + 286)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_signalfd4 (__NR_Linux + 287)
#define __NR_eventfd2 (__NR_Linux + 288)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_epoll_create1 (__NR_Linux + 289)
#define __NR_dup3 (__NR_Linux + 290)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_pipe2 (__NR_Linux + 291)
#define __NR_inotify_init1 (__NR_Linux + 292)
-#define __NR_Linux_syscalls 292
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_preadv (__NR_Linux + 293)
+#define __NR_pwritev (__NR_Linux + 294)
+#define __NR_rt_tgsigqueueinfo (__NR_Linux + 295)
+#define __NR_perf_event_open (__NR_Linux + 296)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_accept4 (__NR_Linux + 297)
+#define __NR_recvmmsg (__NR_Linux + 298)
+#define __NR_getdents64 (__NR_Linux + 299)
+#define __NR_fanotify_init (__NR_Linux + 300)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fanotify_mark (__NR_Linux + 301)
+#define __NR_prlimit64 (__NR_Linux + 302)
+#define __NR_name_to_handle_at (__NR_Linux + 303)
+#define __NR_open_by_handle_at (__NR_Linux + 304)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_clock_adjtime (__NR_Linux + 305)
+#define __NR_syncfs (__NR_Linux + 306)
+#define __NR_sendmmsg (__NR_Linux + 307)
+#define __NR_setns (__NR_Linux + 308)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_process_vm_readv (__NR_Linux + 309)
+#define __NR_process_vm_writev (__NR_Linux + 310)
+#define __NR_Linux_syscalls 310
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_N32_Linux 6000
-#define __NR_N32_Linux_syscalls 292
+#define __NR_N32_Linux_syscalls 310
#endif
diff --git a/ndk/platforms/android-9/arch-mips/include/fenv.h b/ndk/platforms/android-9/arch-mips/include/fenv.h
index 583d0022f..ed69cf877 100644
--- a/ndk/platforms/android-9/arch-mips/include/fenv.h
+++ b/ndk/platforms/android-9/arch-mips/include/fenv.h
@@ -23,198 +23,203 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/msun/mips/fenv.h,v 1.1 2008/04/26 12:20:29 imp Exp $
+ * $FreeBSD: src/lib/msun/arm/fenv.h,v 1.5 2005/03/16 19:03:45 das Exp $
*/
-#ifndef _FENV_H_
-#define _FENV_H_
+/*
+ Rewritten for Android.
+*/
-#include <sys/cdefs.h>
-#include <sys/_types.h>
+/* MIPS FPU floating point control register bits.
+ *
+ * 31-25 -> floating point conditions code bits set by FP compare
+ * instructions
+ * 24 -> flush denormalized results to zero instead of
+ * causing unimplemented operation exception.
+ * 23 -> Condition bit
+ * 22 -> In conjunction with FS detects denormalized
+ * operands and replaces them internally with 0.
+ * 21 -> In conjunction with FS forces denormalized operands
+ * to the closest normalized value.
+ * 20-18 -> reserved (read as 0, write with 0)
+ * 17 -> cause bit for unimplemented operation
+ * 16 -> cause bit for invalid exception
+ * 15 -> cause bit for division by zero exception
+ * 14 -> cause bit for overflow exception
+ * 13 -> cause bit for underflow exception
+ * 12 -> cause bit for inexact exception
+ * 11 -> enable exception for invalid exception
+ * 10 -> enable exception for division by zero exception
+ * 9 -> enable exception for overflow exception
+ * 8 -> enable exception for underflow exception
+ * 7 -> enable exception for inexact exception
+ * 6 -> flag invalid exception
+ * 5 -> flag division by zero exception
+ * 4 -> flag overflow exception
+ * 3 -> flag underflow exception
+ * 2 -> flag inexact exception
+ * 1-0 -> rounding control
+ *
+ *
+ * Rounding Control:
+ * 00 - rounding to nearest (RN)
+ * 01 - rounding toward zero (RZ)
+ * 10 - rounding (up) toward plus infinity (RP)
+ * 11 - rounding (down)toward minus infinity (RM)
+ */
+
+#ifndef _FENV_H_
+#define _FENV_H_
+
+#include <sys/types.h>
__BEGIN_DECLS
-typedef __uint32_t fenv_t;
-typedef __uint32_t fexcept_t;
+typedef __uint32_t fenv_t;
+typedef __uint32_t fexcept_t;
/* Exception flags */
-#define FE_INVALID 0x0001
-#define FE_DIVBYZERO 0x0002
-#define FE_OVERFLOW 0x0004
-#define FE_UNDERFLOW 0x0008
-#define FE_INEXACT 0x0010
-#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_INEXACT | \
- FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
+#define FE_INVALID 0x40
+#define FE_DIVBYZERO 0x20
+#define FE_OVERFLOW 0x10
+#define FE_UNDERFLOW 0x08
+#define FE_INEXACT 0x04
+#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_INEXACT | \
+ FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
+#define _FCSR_CAUSE_SHIFT 10
+#define _ENABLE_SHIFT 5
+#define _FCSR_ENABLE_MASK (FE_ALL_EXCEPT << _ENABLE_SHIFT)
/* Rounding modes */
-#define FE_TONEAREST 0x0000
-#define FE_TOWARDZERO 0x0001
-#define FE_UPWARD 0x0002
-#define FE_DOWNWARD 0x0003
-#define _ROUND_MASK (FE_TONEAREST | FE_DOWNWARD | \
- FE_UPWARD | FE_TOWARDZERO)
-
+#define FE_TONEAREST 0x0000
+#define FE_TOWARDZERO 0x0001
+#define FE_UPWARD 0x0002
+#define FE_DOWNWARD 0x0003
+#define _FCSR_RMODE_SHIFT 0
+#define _FCSR_RMASK 0x3
/* Default floating-point environment */
-extern const fenv_t __fe_dfl_env;
-#define FE_DFL_ENV (&__fe_dfl_env)
-
-/* We need to be able to map status flag positions to mask flag positions */
-#define _FPUSW_SHIFT 16
-#define _ENABLE_MASK (FE_ALL_EXCEPT << _FPUSW_SHIFT)
-
-#ifdef ARM_HARD_FLOAT
-#define __rfs(__fpsr) __asm __volatile("rfs %0" : "=r" (*(__fpsr)))
-#define __wfs(__fpsr) __asm __volatile("wfs %0" : : "r" (__fpsr))
-#else
-#define __rfs(__fpsr)
-#define __wfs(__fpsr)
-#endif
-
-static __inline int
-feclearexcept(int __excepts)
-{
- fexcept_t __fpsr;
+extern const fenv_t __fe_dfl_env;
+#define FE_DFL_ENV (&__fe_dfl_env)
- __rfs(&__fpsr);
- __fpsr &= ~__excepts;
- __wfs(__fpsr);
- return (0);
+static __inline int fegetenv(fenv_t* __envp) {
+ fenv_t _fcsr = 0;
+#ifdef __mips_hard_float
+ __asm__ __volatile__("cfc1 %0,$31" : "=r" (_fcsr));
+#endif
+ *__envp = _fcsr;
+ return 0;
}
-static __inline int
-fegetexceptflag(fexcept_t *__flagp, int __excepts)
-{
- fexcept_t __fpsr;
-
- __rfs(&__fpsr);
- *__flagp = __fpsr & __excepts;
- return (0);
+static __inline int fesetenv(const fenv_t* __envp) {
+ fenv_t _fcsr = *__envp;
+#ifdef __mips_hard_float
+ __asm__ __volatile__("ctc1 %0,$31" : : "r" (_fcsr));
+#endif
+ return 0;
}
-static __inline int
-fesetexceptflag(const fexcept_t *__flagp, int __excepts)
-{
- fexcept_t __fpsr;
-
- __rfs(&__fpsr);
- __fpsr &= ~__excepts;
- __fpsr |= *__flagp & __excepts;
- __wfs(__fpsr);
- return (0);
+static __inline int feclearexcept(int __excepts) {
+ fexcept_t __fcsr;
+ fegetenv(&__fcsr);
+ __excepts &= FE_ALL_EXCEPT;
+ __fcsr &= ~(__excepts | (__excepts << _FCSR_CAUSE_SHIFT));
+ fesetenv(&__fcsr);
+ return 0;
}
-static __inline int
-feraiseexcept(int __excepts)
-{
- fexcept_t __ex = __excepts;
-
- fesetexceptflag(&__ex, __excepts); /* XXX */
- return (0);
+static __inline int fegetexceptflag(fexcept_t* __flagp, int __excepts) {
+ fexcept_t __fcsr;
+ fegetenv(&__fcsr);
+ *__flagp = __fcsr & __excepts & FE_ALL_EXCEPT;
+ return 0;
}
-static __inline int
-fetestexcept(int __excepts)
-{
- fexcept_t __fpsr;
-
- __rfs(&__fpsr);
- return (__fpsr & __excepts);
+static __inline int fesetexceptflag(const fexcept_t* __flagp, int __excepts) {
+ fexcept_t __fcsr;
+ fegetenv(&__fcsr);
+ /* Ensure that flags are all legal */
+ __excepts &= FE_ALL_EXCEPT;
+ __fcsr &= ~__excepts;
+ __fcsr |= *__flagp & __excepts;
+ fesetenv(&__fcsr);
+ return 0;
}
-static __inline int
-fegetround(void)
-{
-
- /*
- * Apparently, the rounding mode is specified as part of the
- * instruction format on ARM, so the dynamic rounding mode is
- * indeterminate. Some FPUs may differ.
- */
- return (-1);
+static __inline int feraiseexcept(int __excepts) {
+ fexcept_t __fcsr;
+ fegetenv(&__fcsr);
+ /* Ensure that flags are all legal */
+ __excepts &= FE_ALL_EXCEPT;
+ /* Cause bit needs to be set as well for generating the exception*/
+ __fcsr |= __excepts | (__excepts << _FCSR_CAUSE_SHIFT);
+ fesetenv(&__fcsr);
+ return 0;
}
-static __inline int
-fesetround(int __round)
-{
-
- return (-1);
+static __inline int fetestexcept(int __excepts) {
+ fexcept_t __FCSR;
+ fegetenv(&__FCSR);
+ return (__FCSR & __excepts & FE_ALL_EXCEPT);
}
-static __inline int
-fegetenv(fenv_t *__envp)
-{
-
- __rfs(__envp);
- return (0);
+static __inline int fegetround(void) {
+ fenv_t _fcsr;
+ fegetenv(&_fcsr);
+ return (_fcsr & _FCSR_RMASK);
}
-static __inline int
-feholdexcept(fenv_t *__envp)
-{
- fenv_t __env;
-
- __rfs(&__env);
- *__envp = __env;
- __env &= ~(FE_ALL_EXCEPT | _ENABLE_MASK);
- __wfs(__env);
- return (0);
+static __inline int fesetround(int __round) {
+ fenv_t _fcsr;
+ fegetenv(&_fcsr);
+ _fcsr &= ~_FCSR_RMASK;
+ _fcsr |= (__round & _FCSR_RMASK ) ;
+ fesetenv(&_fcsr);
+ return 0;
}
-static __inline int
-fesetenv(const fenv_t *__envp)
-{
-
- __wfs(*__envp);
- return (0);
+static __inline int feholdexcept(fenv_t* __envp) {
+ fenv_t __env;
+ fegetenv(&__env);
+ *__envp = __env;
+ __env &= ~(FE_ALL_EXCEPT | _FCSR_ENABLE_MASK);
+ fesetenv(&__env);
+ return 0;
}
-static __inline int
-feupdateenv(const fenv_t *__envp)
-{
- fexcept_t __fpsr;
-
- __rfs(&__fpsr);
- __wfs(*__envp);
- feraiseexcept(__fpsr & FE_ALL_EXCEPT);
- return (0);
+static __inline int feupdateenv(const fenv_t* __envp) {
+ fexcept_t __fcsr;
+ fegetenv(&__fcsr);
+ fesetenv(__envp);
+ feraiseexcept(__fcsr & FE_ALL_EXCEPT);
+ return 0;
}
#if __BSD_VISIBLE
-static __inline int
-feenableexcept(int __mask)
-{
- fenv_t __old_fpsr, __new_fpsr;
-
- __rfs(&__old_fpsr);
- __new_fpsr = __old_fpsr | (__mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT;
- __wfs(__new_fpsr);
- return ((__old_fpsr >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
+static __inline int feenableexcept(int __mask) {
+ fenv_t __old_fcsr, __new_fcsr;
+ fegetenv(&__old_fcsr);
+ __new_fcsr = __old_fcsr | (__mask & FE_ALL_EXCEPT) << _ENABLE_SHIFT;
+ fesetenv(&__new_fcsr);
+ return ((__old_fcsr >> _ENABLE_SHIFT) & FE_ALL_EXCEPT);
}
-static __inline int
-fedisableexcept(int __mask)
-{
- fenv_t __old_fpsr, __new_fpsr;
-
- __rfs(&__old_fpsr);
- __new_fpsr = __old_fpsr & ~((__mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT);
- __wfs(__new_fpsr);
- return ((__old_fpsr >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
+static __inline int fedisableexcept(int __mask) {
+ fenv_t __old_fcsr, __new_fcsr;
+ fegetenv(&__old_fcsr);
+ __new_fcsr = __old_fcsr & ~((__mask & FE_ALL_EXCEPT) << _ENABLE_SHIFT);
+ fesetenv(&__new_fcsr);
+ return ((__old_fcsr >> _ENABLE_SHIFT) & FE_ALL_EXCEPT);
}
-static __inline int
-fegetexcept(void)
-{
- fenv_t __fpsr;
-
- __rfs(&__fpsr);
- return ((__fpsr & _ENABLE_MASK) >> _FPUSW_SHIFT);
+static __inline int fegetexcept(void) {
+ fenv_t __fcsr;
+ fegetenv(&__fcsr);
+ return ((__fcsr & _FCSR_ENABLE_MASK) >> _ENABLE_SHIFT);
}
#endif /* __BSD_VISIBLE */
__END_DECLS
-#endif /* !_FENV_H_ */
-
+#endif /* !_FENV_H_ */
diff --git a/ndk/platforms/android-9/arch-mips/include/machine/_types.h b/ndk/platforms/android-9/arch-mips/include/machine/_types.h
index 1cc6c21a1..05f79ef67 100644
--- a/ndk/platforms/android-9/arch-mips/include/machine/_types.h
+++ b/ndk/platforms/android-9/arch-mips/include/machine/_types.h
@@ -105,8 +105,6 @@ typedef double __double_t;
typedef float __float_t;
typedef long long __off_t;
typedef long __ptrdiff_t;
-/*typedef unsigned long __size_t;*/
-typedef long __ssize_t;
typedef int __time_t;
typedef int __timer_t;
#if defined(__GNUC__) && __GNUC__ >= 3
@@ -124,12 +122,6 @@ typedef int __rune_t;
typedef void * __wctrans_t;
typedef void * __wctype_t;
-#ifdef __MIPSEB__
-#define _BYTE_ORDER _BIG_ENDIAN
-#else
-#define _BYTE_ORDER _LITTLE_ENDIAN
-#endif
-
#if defined(_KERNEL)
typedef struct label_t {
__register_t val[14];
diff --git a/ndk/platforms/android-9/arch-mips/include/machine/endian.h b/ndk/platforms/android-9/arch-mips/include/machine/endian.h
new file mode 100644
index 000000000..41a9004f4
--- /dev/null
+++ b/ndk/platforms/android-9/arch-mips/include/machine/endian.h
@@ -0,0 +1,70 @@
+/* $OpenBSD: endian.h,v 1.5 2006/02/27 23:35:59 miod Exp $ */
+
+/*
+ * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#ifndef _MIPS64_ENDIAN_H_
+#define _MIPS64_ENDIAN_H_
+
+#ifdef __GNUC__
+
+#if defined(__mips_isa_rev) && (__mips_isa_rev >= 2)
+#define __swap16md(x) ({ \
+ register uint16_t _x = (x); \
+ register uint16_t _r; \
+ __asm volatile ("wsbh %0, %1" : "=r" (_r) : "r" (_x)); \
+ _r; \
+})
+
+#define __swap32md(x) ({ \
+ register uint32_t _x = (x); \
+ register uint32_t _r; \
+ __asm volatile ("wsbh %0, %1; rotr %0, %0, 16" : "=r" (_r) : "r" (_x)); \
+ _r; \
+})
+
+#define __swap64md(x) ({ \
+ uint64_t _swap64md_x = (x); \
+ (uint64_t) __swap32md(_swap64md_x >> 32) | \
+ (uint64_t) __swap32md(_swap64md_x & 0xffffffff) << 32; \
+})
+
+/* Tell sys/endian.h we have MD variants of the swap macros. */
+#define MD_SWAP
+
+#endif /* __mips32r2__ */
+#endif /* __GNUC__ */
+
+#if defined(__MIPSEB__)
+#define _BYTE_ORDER _BIG_ENDIAN
+#else
+#define _BYTE_ORDER _LITTLE_ENDIAN
+#endif
+#define __STRICT_ALIGNMENT
+#include <sys/types.h>
+#include <sys/endian.h>
+
+#endif /* _MIPS64_ENDIAN_H_ */
diff --git a/ndk/platforms/android-9/arch-mips/lib-bootstrap/crtbegin_dynamic.o b/ndk/platforms/android-9/arch-mips/lib-bootstrap/crtbegin_dynamic.o
new file mode 100644
index 000000000..d3c366bf0
--- /dev/null
+++ b/ndk/platforms/android-9/arch-mips/lib-bootstrap/crtbegin_dynamic.o
Binary files differ
diff --git a/ndk/platforms/android-9/arch-mips/lib-bootstrap/crtend_android.o b/ndk/platforms/android-9/arch-mips/lib-bootstrap/crtend_android.o
new file mode 100644
index 000000000..6936f73e1
--- /dev/null
+++ b/ndk/platforms/android-9/arch-mips/lib-bootstrap/crtend_android.o
Binary files differ
diff --git a/ndk/platforms/android-9/arch-mips/lib-bootstrap/libc.so b/ndk/platforms/android-9/arch-mips/lib-bootstrap/libc.so
new file mode 100755
index 000000000..846248209
--- /dev/null
+++ b/ndk/platforms/android-9/arch-mips/lib-bootstrap/libc.so
Binary files differ
diff --git a/ndk/platforms/android-9/arch-mips/lib-bootstrap/libdl.so b/ndk/platforms/android-9/arch-mips/lib-bootstrap/libdl.so
new file mode 100755
index 000000000..62d382ef1
--- /dev/null
+++ b/ndk/platforms/android-9/arch-mips/lib-bootstrap/libdl.so
Binary files differ
diff --git a/ndk/platforms/android-9/arch-mips/symbols/libc.so.functions.txt b/ndk/platforms/android-9/arch-mips/symbols/libc.so.functions.txt
index 1c72ae906..b8a95546a 100644
--- a/ndk/platforms/android-9/arch-mips/symbols/libc.so.functions.txt
+++ b/ndk/platforms/android-9/arch-mips/symbols/libc.so.functions.txt
@@ -159,7 +159,6 @@ __rt_sigaction
__rt_sigprocmask
__rt_sigtimedwait
__sclose
-__set_errno
__set_syscall_errno
__set_thread_area
__set_tls
diff --git a/ndk/platforms/android-9/arch-x86/include/asm/socket.h b/ndk/platforms/android-9/arch-x86/include/asm/socket.h
index b5201690c..50a9874cc 100644
--- a/ndk/platforms/android-9/arch-x86/include/asm/socket.h
+++ b/ndk/platforms/android-9/arch-x86/include/asm/socket.h
@@ -16,54 +16,4 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _ASM_SOCKET_H
-#define _ASM_SOCKET_H
-#include <asm/sockios.h>
-#define SOL_SOCKET 1
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SO_DEBUG 1
-#define SO_REUSEADDR 2
-#define SO_TYPE 3
-#define SO_ERROR 4
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SO_DONTROUTE 5
-#define SO_BROADCAST 6
-#define SO_SNDBUF 7
-#define SO_RCVBUF 8
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SO_SNDBUFFORCE 32
-#define SO_RCVBUFFORCE 33
-#define SO_KEEPALIVE 9
-#define SO_OOBINLINE 10
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SO_NO_CHECK 11
-#define SO_PRIORITY 12
-#define SO_LINGER 13
-#define SO_BSDCOMPAT 14
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SO_PASSCRED 16
-#define SO_PEERCRED 17
-#define SO_RCVLOWAT 18
-#define SO_SNDLOWAT 19
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SO_RCVTIMEO 20
-#define SO_SNDTIMEO 21
-#define SO_SECURITY_AUTHENTICATION 22
-#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SO_SECURITY_ENCRYPTION_NETWORK 24
-#define SO_BINDTODEVICE 25
-#define SO_ATTACH_FILTER 26
-#define SO_DETACH_FILTER 27
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SO_PEERNAME 28
-#define SO_TIMESTAMP 29
-#define SCM_TIMESTAMP SO_TIMESTAMP
-#define SO_ACCEPTCONN 30
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SO_PEERSEC 31
-#define SO_PASSSEC 34
-#define SO_TIMESTAMPNS 35
-#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#endif
+#include <asm-generic/socket.h>
diff --git a/ndk/platforms/android-9/arch-x86/include/asm/unistd_32.h b/ndk/platforms/android-9/arch-x86/include/asm/unistd_32.h
index 4536585b7..b2193a281 100644
--- a/ndk/platforms/android-9/arch-x86/include/asm/unistd_32.h
+++ b/ndk/platforms/android-9/arch-x86/include/asm/unistd_32.h
@@ -16,8 +16,8 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _ASM_I386_UNISTD_H_
-#define _ASM_I386_UNISTD_H_
+#ifndef _ASM_X86_UNISTD_32_H
+#define _ASM_X86_UNISTD_32_H
#define __NR_restart_syscall 0
#define __NR_exit 1
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
@@ -417,9 +417,35 @@
#define __NR_utimensat 320
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __NR_signalfd 321
-#define __NR_timerfd 322
+#define __NR_timerfd_create 322
#define __NR_eventfd 323
#define __NR_fallocate 324
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define __NR_perf_event_open 364
+#define __NR_timerfd_settime 325
+#define __NR_timerfd_gettime 326
+#define __NR_signalfd4 327
+#define __NR_eventfd2 328
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_epoll_create1 329
+#define __NR_dup3 330
+#define __NR_pipe2 331
+#define __NR_inotify_init1 332
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_preadv 333
+#define __NR_pwritev 334
+#define __NR_rt_tgsigqueueinfo 335
+#define __NR_perf_event_open 336
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_recvmmsg 337
+#define __NR_fanotify_init 338
+#define __NR_fanotify_mark 339
+#define __NR_prlimit64 340
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_name_to_handle_at 341
+#define __NR_open_by_handle_at 342
+#define __NR_clock_adjtime 343
+#define __NR_syncfs 344
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sendmmsg 345
+#define __NR_setns 346
#endif
diff --git a/ndk/platforms/android-9/arch-x86/include/fenv.h b/ndk/platforms/android-9/arch-x86/include/fenv.h
index 4e322b76d..c0421c026 100644
--- a/ndk/platforms/android-9/arch-x86/include/fenv.h
+++ b/ndk/platforms/android-9/arch-x86/include/fenv.h
@@ -29,8 +29,7 @@
#ifndef _FENV_H_
#define _FENV_H_
-#include <sys/cdefs.h>
-#include <sys/_types.h>
+#include <sys/types.h>
__BEGIN_DECLS
diff --git a/ndk/platforms/android-9/arch-x86/include/machine/_types.h b/ndk/platforms/android-9/arch-x86/include/machine/_types.h
index d3d9eeb6a..d21782284 100644
--- a/ndk/platforms/android-9/arch-x86/include/machine/_types.h
+++ b/ndk/platforms/android-9/arch-x86/include/machine/_types.h
@@ -35,29 +35,6 @@
#ifndef _I386__TYPES_H_
#define _I386__TYPES_H_
-/* the kernel defines size_t as unsigned int, but g++ wants it to be unsigned long */
-#ifndef _SIZE_T_DEFINED_
-# define _SIZE_T_DEFINED_
-# ifdef __ANDROID__
- typedef unsigned int size_t;
-# else
- typedef unsigned long size_t;
-# endif
-#endif
-#if !defined(_SSIZE_T) && !defined(_SSIZE_T_DEFINED_)
-#define _SSIZE_T
-#define _SSIZE_T_DEFINED_
-typedef long int ssize_t;
-#endif
-#ifndef _PTRDIFF_T
-#define _PTRDIFF_T
-# ifdef __ANDROID__
- typedef int ptrdiff_t;
-# else
- typedef long ptrdiff_t;
-# endif
-#endif
-
/* 7.18.1.1 Exact-width integer types */
typedef __signed char __int8_t;
typedef unsigned char __uint8_t;
diff --git a/ndk/platforms/android-9/arch-x86/include/endian.h b/ndk/platforms/android-9/arch-x86/include/machine/endian.h
index 4a705364e..e7ad25784 100644
--- a/ndk/platforms/android-9/arch-x86/include/endian.h
+++ b/ndk/platforms/android-9/arch-x86/include/machine/endian.h
@@ -65,6 +65,7 @@
#endif /* __GNUC__ */
#define _BYTE_ORDER _LITTLE_ENDIAN
+#include <sys/types.h>
#include <sys/endian.h>
#endif /* _I386_ENDIAN_H_ */
diff --git a/ndk/platforms/android-9/arch-x86/lib-bootstrap/crtbegin_dynamic.o b/ndk/platforms/android-9/arch-x86/lib-bootstrap/crtbegin_dynamic.o
new file mode 100644
index 000000000..19ebcb992
--- /dev/null
+++ b/ndk/platforms/android-9/arch-x86/lib-bootstrap/crtbegin_dynamic.o
Binary files differ
diff --git a/ndk/platforms/android-9/arch-x86/lib-bootstrap/crtend_android.o b/ndk/platforms/android-9/arch-x86/lib-bootstrap/crtend_android.o
new file mode 100644
index 000000000..173dad34f
--- /dev/null
+++ b/ndk/platforms/android-9/arch-x86/lib-bootstrap/crtend_android.o
Binary files differ
diff --git a/ndk/platforms/android-9/arch-x86/lib-bootstrap/libc.so b/ndk/platforms/android-9/arch-x86/lib-bootstrap/libc.so
new file mode 100755
index 000000000..2b729fc3a
--- /dev/null
+++ b/ndk/platforms/android-9/arch-x86/lib-bootstrap/libc.so
Binary files differ
diff --git a/ndk/platforms/android-9/arch-x86/lib-bootstrap/libdl.so b/ndk/platforms/android-9/arch-x86/lib-bootstrap/libdl.so
new file mode 100755
index 000000000..e328e302e
--- /dev/null
+++ b/ndk/platforms/android-9/arch-x86/lib-bootstrap/libdl.so
Binary files differ
diff --git a/ndk/platforms/android-9/arch-x86/lib/libc.a b/ndk/platforms/android-9/arch-x86/lib/libc.a
index 90220b052..29b1726ed 100644
--- a/ndk/platforms/android-9/arch-x86/lib/libc.a
+++ b/ndk/platforms/android-9/arch-x86/lib/libc.a
Binary files differ
diff --git a/ndk/platforms/android-9/arch-x86/symbols/libc.so.functions.txt b/ndk/platforms/android-9/arch-x86/symbols/libc.so.functions.txt
index 121dc51ea..2c7a608a2 100644
--- a/ndk/platforms/android-9/arch-x86/symbols/libc.so.functions.txt
+++ b/ndk/platforms/android-9/arch-x86/symbols/libc.so.functions.txt
@@ -155,7 +155,6 @@ __rt_sigaction
__rt_sigprocmask
__rt_sigtimedwait
__sclose
-__set_errno
__set_syscall_errno
__set_thread_area
__set_tls
@@ -761,8 +760,10 @@ sigaction
sigaltstack
sigblock
siginterrupt
+siglongjmp
sigpending
sigprocmask
+sigsetjmp
sigsetmask
sigsuspend
sigwait
diff --git a/ndk/platforms/android-9/include/SLES/OpenSLES_AndroidConfiguration.h b/ndk/platforms/android-9/include/SLES/OpenSLES_AndroidConfiguration.h
index bff6410fd..ad9cad6da 100644
--- a/ndk/platforms/android-9/include/SLES/OpenSLES_AndroidConfiguration.h
+++ b/ndk/platforms/android-9/include/SLES/OpenSLES_AndroidConfiguration.h
@@ -19,6 +19,7 @@
#ifdef __cplusplus
extern "C" {
+#endif
/*---------------------------------------------------------------------------*/
/* Android AudioRecorder configuration */
@@ -63,6 +64,7 @@ extern "C" {
+#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/ndk/platforms/android-9/include/android/bitmap.h b/ndk/platforms/android-9/include/android/bitmap.h
index 160e34ad9..fabb7f430 100644
--- a/ndk/platforms/android-9/include/android/bitmap.h
+++ b/ndk/platforms/android-9/include/android/bitmap.h
@@ -23,11 +23,14 @@
__BEGIN_DECLS
-#define ANDROID_BITMAP_RESUT_SUCCESS 0
+#define ANDROID_BITMAP_RESULT_SUCCESS 0
#define ANDROID_BITMAP_RESULT_BAD_PARAMETER -1
#define ANDROID_BITMAP_RESULT_JNI_EXCEPTION -2
#define ANDROID_BITMAP_RESULT_ALLOCATION_FAILED -3
+/* Backward compatibility: this macro used to be misspelled. */
+#define ANDROID_BITMAP_RESUT_SUCCESS ANDROID_BITMAP_RESULT_SUCCESS
+
enum AndroidBitmapFormat {
ANDROID_BITMAP_FORMAT_NONE = 0,
ANDROID_BITMAP_FORMAT_RGBA_8888 = 1,
diff --git a/ndk/platforms/android-9/include/pthread.h b/ndk/platforms/android-9/include/pthread.h
index 4baf82f75..c3f055e98 100644
--- a/ndk/platforms/android-9/include/pthread.h
+++ b/ndk/platforms/android-9/include/pthread.h
@@ -42,9 +42,13 @@ typedef struct
int volatile value;
} pthread_mutex_t;
-#define PTHREAD_MUTEX_INITIALIZER {0}
-#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER {0x4000}
-#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER {0x8000}
+#define __PTHREAD_MUTEX_INIT_VALUE 0
+#define __PTHREAD_RECURSIVE_MUTEX_INIT_VALUE 0x4000
+#define __PTHREAD_ERRORCHECK_MUTEX_INIT_VALUE 0x8000
+
+#define PTHREAD_MUTEX_INITIALIZER {__PTHREAD_MUTEX_INIT_VALUE}
+#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER {__PTHREAD_RECURSIVE_MUTEX_INIT_VALUE}
+#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER {__PTHREAD_ERRORCHECK_MUTEX_INIT_VALUE}
enum {
PTHREAD_MUTEX_NORMAL = 0,
@@ -306,9 +310,4 @@ extern void __pthread_cleanup_pop(__pthread_cleanup_t* c,
} /* extern "C" */
#endif
-/************ TO FIX ************/
-
-#define LONG_LONG_MAX __LONG_LONG_MAX__
-#define LONG_LONG_MIN (-__LONG_LONG_MAX__ - 1)
-
#endif /* _PTHREAD_H_ */
diff --git a/ndk/platforms/android-9/include/sys/cdefs.h b/ndk/platforms/android-9/include/sys/cdefs.h
index 849e2b8c6..92035d428 100644
--- a/ndk/platforms/android-9/include/sys/cdefs.h
+++ b/ndk/platforms/android-9/include/sys/cdefs.h
@@ -79,7 +79,7 @@
#define ___STRING(x) __STRING(x)
#define ___CONCAT(x,y) __CONCAT(x,y)
-#if __STDC__ || defined(__cplusplus)
+#if defined(__STDC__) || defined(__cplusplus)
#define __P(protos) protos /* full-blown ANSI C */
#define __CONCAT(x,y) x ## y
#define __STRING(x) #x
@@ -213,7 +213,7 @@
* C99 defines the restrict type qualifier keyword, which was made available
* in GCC 2.92.
*/
-#if __STDC_VERSION__ >= 199901L
+#if defined(__STDC__VERSION__) && __STDC_VERSION__ >= 199901L
#define __restrict restrict
#else
#if !__GNUC_PREREQ__(2, 92)
@@ -225,7 +225,7 @@
* C99 defines __func__ predefined identifier, which was made available
* in GCC 2.95.
*/
-#if !(__STDC_VERSION__ >= 199901L)
+#if !defined(__STDC_VERSION__) || !(__STDC_VERSION__ >= 199901L)
#if __GNUC_PREREQ__(2, 6)
#define __func__ __PRETTY_FUNCTION__
#elif __GNUC_PREREQ__(2, 4)
@@ -497,5 +497,6 @@
#endif
#define __BIONIC__ 1
+#include <android/api-level.h>
#endif /* !_SYS_CDEFS_H_ */
diff --git a/ndk/platforms/android-9/include/wchar.h b/ndk/platforms/android-9/include/wchar.h
index 86d6d7339..fea648c09 100644
--- a/ndk/platforms/android-9/include/wchar.h
+++ b/ndk/platforms/android-9/include/wchar.h
@@ -51,7 +51,7 @@
__BEGIN_DECLS
-typedef int wint_t;
+typedef __WINT_TYPE__ wint_t;
typedef struct { int dummy; } mbstate_t;
typedef enum {
diff --git a/ndk/platforms/android-9/samples/native-audio/jni/native-audio-jni.c b/ndk/platforms/android-9/samples/native-audio/jni/native-audio-jni.c
index 105c64a4b..5e7946b10 100644
--- a/ndk/platforms/android-9/samples/native-audio/jni/native-audio-jni.c
+++ b/ndk/platforms/android-9/samples/native-audio/jni/native-audio-jni.c
@@ -125,6 +125,7 @@ void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context)
// the most likely other result is SL_RESULT_BUFFER_INSUFFICIENT,
// which for this code example would indicate a programming error
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
}
}
@@ -153,24 +154,29 @@ void Java_com_example_nativeaudio_NativeAudio_createEngine(JNIEnv* env, jclass c
// create engine
result = slCreateEngine(&engineObject, 0, NULL, 0, NULL, NULL);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// realize the engine
result = (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// get the engine interface, which is needed in order to create other objects
result = (*engineObject)->GetInterface(engineObject, SL_IID_ENGINE, &engineEngine);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// create output mix, with environmental reverb specified as a non-required interface
const SLInterfaceID ids[1] = {SL_IID_ENVIRONMENTALREVERB};
const SLboolean req[1] = {SL_BOOLEAN_FALSE};
result = (*engineEngine)->CreateOutputMix(engineEngine, &outputMixObject, 1, ids, req);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// realize the output mix
result = (*outputMixObject)->Realize(outputMixObject, SL_BOOLEAN_FALSE);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// get the environmental reverb interface
// this could fail if the environmental reverb effect is not available,
@@ -181,6 +187,7 @@ void Java_com_example_nativeaudio_NativeAudio_createEngine(JNIEnv* env, jclass c
if (SL_RESULT_SUCCESS == result) {
result = (*outputMixEnvironmentalReverb)->SetEnvironmentalReverbProperties(
outputMixEnvironmentalReverb, &reverbSettings);
+ (void)result;
}
// ignore unsuccessful result codes for environmental reverb, as it is optional for this example
@@ -212,43 +219,51 @@ void Java_com_example_nativeaudio_NativeAudio_createBufferQueueAudioPlayer(JNIEn
result = (*engineEngine)->CreateAudioPlayer(engineEngine, &bqPlayerObject, &audioSrc, &audioSnk,
3, ids, req);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// realize the player
result = (*bqPlayerObject)->Realize(bqPlayerObject, SL_BOOLEAN_FALSE);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// get the play interface
result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_PLAY, &bqPlayerPlay);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// get the buffer queue interface
result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_BUFFERQUEUE,
&bqPlayerBufferQueue);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// register callback on the buffer queue
result = (*bqPlayerBufferQueue)->RegisterCallback(bqPlayerBufferQueue, bqPlayerCallback, NULL);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// get the effect send interface
result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_EFFECTSEND,
&bqPlayerEffectSend);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
#if 0 // mute/solo is not supported for sources that are known to be mono, as this is
// get the mute/solo interface
result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_MUTESOLO, &bqPlayerMuteSolo);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
#endif
// get the volume interface
result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_VOLUME, &bqPlayerVolume);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// set the player's state to playing
result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING);
assert(SL_RESULT_SUCCESS == result);
-
+ (void)result;
}
@@ -259,7 +274,7 @@ jboolean Java_com_example_nativeaudio_NativeAudio_createUriAudioPlayer(JNIEnv* e
SLresult result;
// convert Java string to UTF-8
- const jbyte *utf8 = (*env)->GetStringUTFChars(env, uri, NULL);
+ const char *utf8 = (*env)->GetStringUTFChars(env, uri, NULL);
assert(NULL != utf8);
// configure audio source
@@ -280,6 +295,7 @@ jboolean Java_com_example_nativeaudio_NativeAudio_createUriAudioPlayer(JNIEnv* e
// note that an invalid URI is not detected here, but during prepare/prefetch on Android,
// or possibly during Realize on other platforms
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// release the Java string and UTF-8
(*env)->ReleaseStringUTFChars(env, uri, utf8);
@@ -296,18 +312,22 @@ jboolean Java_com_example_nativeaudio_NativeAudio_createUriAudioPlayer(JNIEnv* e
// get the play interface
result = (*uriPlayerObject)->GetInterface(uriPlayerObject, SL_IID_PLAY, &uriPlayerPlay);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// get the seek interface
result = (*uriPlayerObject)->GetInterface(uriPlayerObject, SL_IID_SEEK, &uriPlayerSeek);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// get the mute/solo interface
result = (*uriPlayerObject)->GetInterface(uriPlayerObject, SL_IID_MUTESOLO, &uriPlayerMuteSolo);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// get the volume interface
result = (*uriPlayerObject)->GetInterface(uriPlayerObject, SL_IID_VOLUME, &uriPlayerVolume);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
return JNI_TRUE;
}
@@ -327,7 +347,7 @@ void Java_com_example_nativeaudio_NativeAudio_setPlayingUriAudioPlayer(JNIEnv* e
result = (*uriPlayerPlay)->SetPlayState(uriPlayerPlay, isPlaying ?
SL_PLAYSTATE_PLAYING : SL_PLAYSTATE_PAUSED);
assert(SL_RESULT_SUCCESS == result);
-
+ (void)result;
}
}
@@ -346,7 +366,7 @@ void Java_com_example_nativeaudio_NativeAudio_setLoopingUriAudioPlayer(JNIEnv* e
result = (*uriPlayerSeek)->SetLoop(uriPlayerSeek, (SLboolean) isLooping, 0,
SL_TIME_UNKNOWN);
assert(SL_RESULT_SUCCESS == result);
-
+ (void)result;
}
}
@@ -372,6 +392,7 @@ void Java_com_example_nativeaudio_NativeAudio_setChannelMuteUriAudioPlayer(JNIEn
if (NULL != muteSoloItf) {
result = (*muteSoloItf)->SetChannelMute(muteSoloItf, chan, mute);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
}
}
@@ -383,6 +404,7 @@ void Java_com_example_nativeaudio_NativeAudio_setChannelSoloUriAudioPlayer(JNIEn
if (NULL != muteSoloItf) {
result = (*muteSoloItf)->SetChannelSolo(muteSoloItf, chan, solo);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
}
}
@@ -425,6 +447,7 @@ void Java_com_example_nativeaudio_NativeAudio_setVolumeUriAudioPlayer(JNIEnv* en
if (NULL != volumeItf) {
result = (*volumeItf)->SetVolumeLevel(volumeItf, millibel);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
}
}
@@ -436,6 +459,7 @@ void Java_com_example_nativeaudio_NativeAudio_setMuteUriAudioPlayer(JNIEnv* env,
if (NULL != volumeItf) {
result = (*volumeItf)->SetMute(volumeItf, mute);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
}
}
@@ -447,6 +471,7 @@ void Java_com_example_nativeaudio_NativeAudio_enableStereoPositionUriAudioPlayer
if (NULL != volumeItf) {
result = (*volumeItf)->EnableStereoPosition(volumeItf, enable);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
}
}
@@ -458,6 +483,7 @@ void Java_com_example_nativeaudio_NativeAudio_setStereoPositionUriAudioPlayer(JN
if (NULL != volumeItf) {
result = (*volumeItf)->SetStereoPosition(volumeItf, permille);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
}
}
@@ -487,7 +513,6 @@ jboolean Java_com_example_nativeaudio_NativeAudio_enableReverb(JNIEnv* env, jcla
jboolean Java_com_example_nativeaudio_NativeAudio_selectClip(JNIEnv* env, jclass clazz, jint which,
jint count)
{
- short *oldBuffer = nextBuffer;
switch (which) {
case 0: // CLIP_NONE
nextBuffer = (short *) NULL;
@@ -545,13 +570,13 @@ jboolean Java_com_example_nativeaudio_NativeAudio_createAssetAudioPlayer(JNIEnv*
SLresult result;
// convert Java string to UTF-8
- const jbyte *utf8 = (*env)->GetStringUTFChars(env, filename, NULL);
+ const char *utf8 = (*env)->GetStringUTFChars(env, filename, NULL);
assert(NULL != utf8);
// use asset manager to open asset by filename
AAssetManager* mgr = AAssetManager_fromJava(env, assetManager);
assert(NULL != mgr);
- AAsset* asset = AAssetManager_open(mgr, (const char *) utf8, AASSET_MODE_UNKNOWN);
+ AAsset* asset = AAssetManager_open(mgr, utf8, AASSET_MODE_UNKNOWN);
// release the Java string and UTF-8
(*env)->ReleaseStringUTFChars(env, filename, utf8);
@@ -582,30 +607,37 @@ jboolean Java_com_example_nativeaudio_NativeAudio_createAssetAudioPlayer(JNIEnv*
result = (*engineEngine)->CreateAudioPlayer(engineEngine, &fdPlayerObject, &audioSrc, &audioSnk,
3, ids, req);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// realize the player
result = (*fdPlayerObject)->Realize(fdPlayerObject, SL_BOOLEAN_FALSE);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// get the play interface
result = (*fdPlayerObject)->GetInterface(fdPlayerObject, SL_IID_PLAY, &fdPlayerPlay);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// get the seek interface
result = (*fdPlayerObject)->GetInterface(fdPlayerObject, SL_IID_SEEK, &fdPlayerSeek);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// get the mute/solo interface
result = (*fdPlayerObject)->GetInterface(fdPlayerObject, SL_IID_MUTESOLO, &fdPlayerMuteSolo);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// get the volume interface
result = (*fdPlayerObject)->GetInterface(fdPlayerObject, SL_IID_VOLUME, &fdPlayerVolume);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// enable whole file looping
result = (*fdPlayerSeek)->SetLoop(fdPlayerSeek, SL_BOOLEAN_TRUE, 0, SL_TIME_UNKNOWN);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
return JNI_TRUE;
}
@@ -624,7 +656,7 @@ void Java_com_example_nativeaudio_NativeAudio_setPlayingAssetAudioPlayer(JNIEnv*
result = (*fdPlayerPlay)->SetPlayState(fdPlayerPlay, isPlaying ?
SL_PLAYSTATE_PLAYING : SL_PLAYSTATE_PAUSED);
assert(SL_RESULT_SUCCESS == result);
-
+ (void)result;
}
}
@@ -666,16 +698,19 @@ jboolean Java_com_example_nativeaudio_NativeAudio_createAudioRecorder(JNIEnv* en
// get the record interface
result = (*recorderObject)->GetInterface(recorderObject, SL_IID_RECORD, &recorderRecord);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// get the buffer queue interface
result = (*recorderObject)->GetInterface(recorderObject, SL_IID_ANDROIDSIMPLEBUFFERQUEUE,
&recorderBufferQueue);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// register callback on the buffer queue
result = (*recorderBufferQueue)->RegisterCallback(recorderBufferQueue, bqRecorderCallback,
NULL);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
return JNI_TRUE;
}
@@ -689,8 +724,10 @@ void Java_com_example_nativeaudio_NativeAudio_startRecording(JNIEnv* env, jclass
// in case already recording, stop recording and clear buffer queue
result = (*recorderRecord)->SetRecordState(recorderRecord, SL_RECORDSTATE_STOPPED);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
result = (*recorderBufferQueue)->Clear(recorderBufferQueue);
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// the buffer is not valid for playback yet
recorderSize = 0;
@@ -702,11 +739,12 @@ void Java_com_example_nativeaudio_NativeAudio_startRecording(JNIEnv* env, jclass
// the most likely other result is SL_RESULT_BUFFER_INSUFFICIENT,
// which for this code example would indicate a programming error
assert(SL_RESULT_SUCCESS == result);
+ (void)result;
// start recording
result = (*recorderRecord)->SetRecordState(recorderRecord, SL_RECORDSTATE_RECORDING);
assert(SL_RESULT_SUCCESS == result);
-
+ (void)result;
}
diff --git a/ndk/platforms/android-9/samples/native-plasma/jni/plasma.c b/ndk/platforms/android-9/samples/native-plasma/jni/plasma.c
index 01ec644a8..617503378 100644
--- a/ndk/platforms/android-9/samples/native-plasma/jni/plasma.c
+++ b/ndk/platforms/android-9/samples/native-plasma/jni/plasma.c
@@ -192,7 +192,6 @@ static void init_tables(void)
static void fill_plasma(ANativeWindow_Buffer* buffer, double t)
{
- Fixed ft = FIXED_FROM_FLOAT(t/1000.);
Fixed yt1 = FIXED_FROM_FLOAT(t/1230.);
Fixed yt2 = yt1;
Fixed xt10 = FIXED_FROM_FLOAT(t/3000.);
@@ -407,7 +406,7 @@ static void engine_draw_frame(struct engine* engine) {
stats_endFrame(&engine->stats);
}
-static int engine_term_display(struct engine* engine) {
+static void engine_term_display(struct engine* engine) {
engine->animating = 0;
}
diff --git a/ndk/samples/module-exports/jni/bar/bar.c b/ndk/samples/module-exports/jni/bar/bar.c
index 71b21d21d..155241dcc 100644
--- a/ndk/samples/module-exports/jni/bar/bar.c
+++ b/ndk/samples/module-exports/jni/bar/bar.c
@@ -1,4 +1,5 @@
#include "bar.h"
+#include "foo.h"
int bar(int x)
{
diff --git a/ndk/sources/android/libportable/Android.mk b/ndk/sources/android/libportable/Android.mk
index 86b097c29..63428e5cb 100644
--- a/ndk/sources/android/libportable/Android.mk
+++ b/ndk/sources/android/libportable/Android.mk
@@ -26,47 +26,68 @@ LOCAL_MODULE := libportable
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-LOCAL_CFLAGS := -I $(LOCAL_PATH)/common/include
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/common/include
+
+# Uncomment the next line to easily enable Lib-Portable logging during development.
+# LOCAL_CFLAGS += -DLOG_NDEBUG=0
ifeq ($(TARGET_ARCH),mips)
libportable_arch_src_files += \
+ arch-mips/clone.c \
+ arch-mips/epoll.c \
+ arch-mips/errno.c \
+ arch-mips/eventfd.c \
+ arch-mips/fcntl.c \
+ arch-mips/filefd.c \
+ arch-mips/flags.c \
+ arch-mips/inotify.c \
arch-mips/ioctl.c \
arch-mips/mmap.c \
- arch-mips/resource.c \
- arch-mips/stat.c \
- arch-mips/statfs.c \
arch-mips/open.c \
arch-mips/poll.c \
+ arch-mips/pipe.c \
+ arch-mips/pthread.c \
+ arch-mips/resource.c \
+ arch-mips/signal.c \
arch-mips/socket.c \
arch-mips/sockopt.c \
- arch-mips/fcntl.c \
- arch-mips/epoll.c \
- arch-mips/errno.c
+ arch-mips/stat.c \
+ arch-mips/statfs.c \
+ arch-mips/syscall.c \
+ arch-mips/timer.c \
+ arch-mips/timerfd.c \
+ arch-mips/waitpid.c \
+ arch-mips/fenv.c
+
+libportable_arch_src_files += \
+ arch-mips/_setjmp.S \
+ arch-mips/setjmp.S \
+ arch-mips/sigsetjmp.S
+
endif
ifeq ($(TARGET_ARCH),arm)
libportable_arch_src_files += \
- arch-arm/stat.c \
- arch-arm/socket.c \
- arch-arm/sockopt.c \
- arch-arm/epoll.c \
- arch-arm/errno.c
+ arch-arm/unwind.c \
+ arch-arm/fenv.c
endif
ifeq ($(TARGET_ARCH),x86)
libportable_arch_src_files += \
+ arch-x86/epoll.c \
+ arch-x86/fcntl.c \
arch-x86/ioctl.c \
- arch-x86/stat.c \
arch-x86/open.c \
- arch-x86/socket.c \
- arch-x86/sockopt.c \
- arch-x86/fcntl.c \
- arch-x86/epoll.c \
- arch-x86/errno.c
+ arch-x86/stat.c \
+ arch-x86/fenv.c
endif
LOCAL_SRC_FILES := \
$(libportable_common_src_files) \
$(libportable_arch_src_files)
+LOCAL_WHOLE_STATIC_LIBRARIES += cpufeatures
+
+LOCAL_SHARED_LIBRARIES += liblog
+
include $(BUILD_SHARED_LIBRARY)
diff --git a/ndk/sources/android/libportable/arch-arm/errno.c b/ndk/sources/android/libportable/arch-arm/errno.c
deleted file mode 100644
index ffa599892..000000000
--- a/ndk/sources/android/libportable/arch-arm/errno.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 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.
- */
-
-extern volatile int* __errno(void);
-volatile int* __errno_portable()
-{
- return __errno();
-}
diff --git a/ndk/sources/android/libportable/arch-arm/fenv.c b/ndk/sources/android/libportable/arch-arm/fenv.c
new file mode 100644
index 000000000..71f370d9f
--- /dev/null
+++ b/ndk/sources/android/libportable/arch-arm/fenv.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2013, 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.
+ */
+
+#ifdef __ARM_ARCH_7A__
+
+#include <portability.h>
+#include <fenv.h>
+#include <fenv_portable.h>
+
+int WRAP(fegetenv)(fenv_t* __envp) {
+ fenv_t _fpscr;
+ __asm__ __volatile__("vmrs %0,fpscr" : "=r" (_fpscr));
+ *__envp = _fpscr;
+ return 0;
+}
+
+int WRAP(fesetenv)(const fenv_t* __envp) {
+ fenv_t _fpscr = *__envp;
+ __asm__ __volatile__("vmsr fpscr,%0" : :"ri" (_fpscr));
+ return 0;
+}
+
+int WRAP(feclearexcept)(int __excepts) {
+ fexcept_t __fpscr;
+ WRAP(fegetenv)(&__fpscr);
+ __fpscr &= ~__excepts;
+ WRAP(fesetenv)(&__fpscr);
+ return 0;
+}
+
+int WRAP(fegetexceptflag)(fexcept_t* __flagp, int __excepts) {
+ fexcept_t __fpscr;
+ WRAP(fegetenv)(&__fpscr);
+ *__flagp = __fpscr & __excepts;
+ return 0;
+}
+
+int WRAP(fesetexceptflag)(const fexcept_t* __flagp, int __excepts) {
+ fexcept_t __fpscr;
+ WRAP(fegetenv)(&__fpscr);
+ __fpscr &= ~__excepts;
+ __fpscr |= *__flagp & __excepts;
+ WRAP(fesetenv)(&__fpscr);
+ return 0;
+}
+
+int WRAP(feraiseexcept)(int __excepts) {
+ fexcept_t __ex = __excepts;
+ WRAP(fesetexceptflag)(&__ex, __excepts);
+ return 0;
+}
+
+int WRAP(fetestexcept)(int __excepts) {
+ fexcept_t __fpscr;
+ WRAP(fegetenv)(&__fpscr);
+ return (__fpscr & __excepts);
+}
+
+int WRAP(fegetround)(void) {
+ fenv_t _fpscr;
+ WRAP(fegetenv)(&_fpscr);
+ return ((_fpscr >> _FPSCR_RMODE_SHIFT) & 0x3);
+}
+
+int WRAP(fesetround)(int __round) {
+ fenv_t _fpscr;
+ WRAP(fegetenv)(&_fpscr);
+ _fpscr &= ~(0x3 << _FPSCR_RMODE_SHIFT);
+ _fpscr |= (__round << _FPSCR_RMODE_SHIFT);
+ WRAP(fesetenv)(&_fpscr);
+ return 0;
+}
+
+int WRAP(feholdexcept)(fenv_t* __envp) {
+ fenv_t __env;
+ WRAP(fegetenv)(&__env);
+ *__envp = __env;
+ __env &= ~(FE_ALL_EXCEPT | _FPSCR_ENABLE_MASK);
+ WRAP(fesetenv)(&__env);
+ return 0;
+}
+
+int WRAP(feupdateenv)(const fenv_t* __envp) {
+ fexcept_t __fpscr;
+ WRAP(fegetenv)(&__fpscr);
+ WRAP(fesetenv)(__envp);
+ WRAP(feraiseexcept)(__fpscr & FE_ALL_EXCEPT);
+ return 0;
+}
+
+#endif /* __ARM_ARCH_7A__ */
diff --git a/ndk/sources/android/libportable/arch-arm/sockopt.c b/ndk/sources/android/libportable/arch-arm/sockopt.c
deleted file mode 100644
index c86ded328..000000000
--- a/ndk/sources/android/libportable/arch-arm/sockopt.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 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.
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-extern int setsockopt(int, int, int, const void *, socklen_t);
-int setsockopt_portable(int s, int level, int optname, const void *optval, socklen_t optlen)
-{
- return setsockopt(s, level, optname, optval, optlen);
-}
-
-extern int getsockopt (int, int, int, void *, socklen_t *);
-int getsockopt_portable(int s, int level, int optname, void *optval, socklen_t *optlen)
-{
- return getsockopt(s, level, optname, optval, optlen);
-}
diff --git a/ndk/sources/android/libportable/arch-arm/unwind.c b/ndk/sources/android/libportable/arch-arm/unwind.c
new file mode 100644
index 000000000..99f2dacc4
--- /dev/null
+++ b/ndk/sources/android/libportable/arch-arm/unwind.c
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2013, 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.
+ */
+
+#include <portability.h>
+#include <stdint.h>
+
+struct _Unwind_Context;
+
+typedef enum {
+ _UVRSC_CORE = 0, // integer register
+ _UVRSC_VFP = 1, // vfp
+ _UVRSC_WMMXD = 3, // Intel WMMX data register
+ _UVRSC_WMMXC = 4 // Intel WMMX control register
+} _Unwind_VRS_RegClass;
+
+typedef enum {
+ _UVRSD_UINT32 = 0,
+ _UVRSD_VFPX = 1,
+ _UVRSD_UINT64 = 3,
+ _UVRSD_FLOAT = 4,
+ _UVRSD_DOUBLE = 5
+} _Unwind_VRS_DataRepresentation;
+
+typedef enum {
+ _UVRSR_OK = 0,
+ _UVRSR_NOT_IMPLEMENTED = 1,
+ _UVRSR_FAILED = 2
+} _Unwind_VRS_Result;
+
+_Unwind_VRS_Result _Unwind_VRS_Get(struct _Unwind_Context *context,
+ _Unwind_VRS_RegClass regclass,
+ uint32_t regno,
+ _Unwind_VRS_DataRepresentation representation,
+ void* valuep);
+
+_Unwind_VRS_Result _Unwind_VRS_Set(struct _Unwind_Context *context,
+ _Unwind_VRS_RegClass regclass,
+ uint32_t regno,
+ _Unwind_VRS_DataRepresentation representation,
+ void* valuep);
+
+#define UNWIND_POINTER_REG 12
+#define UNWIND_STACK_REG 13
+#define UNWIND_IP_REG 15
+
+uint64_t WRAP(_Unwind_GetGR)(struct _Unwind_Context* ctx, int index) {
+ uint32_t val;
+ _Unwind_VRS_Get(ctx, _UVRSC_CORE, index, _UVRSD_UINT32, &val);
+ return (uint64_t)val;
+}
+
+void WRAP(_Unwind_SetGR)(struct _Unwind_Context* ctx, int index, uint64_t new_value) {
+ uint32_t val = (uint32_t)new_value;
+ _Unwind_VRS_Set(ctx, _UVRSC_CORE, index, _UVRSD_UINT32, &val);
+}
+
+uint64_t WRAP(_Unwind_GetIP)(struct _Unwind_Context* ctx) {
+ return WRAP(_Unwind_GetGR)(ctx, UNWIND_IP_REG) & ~1; // thumb bit
+}
+
+void WRAP(_Unwind_SetIP)(struct _Unwind_Context* ctx, uintptr_t new_value) {
+ uint32_t val = (uint32_t)new_value;
+ // Propagate thumb bit to instruction pointer
+ uint32_t thumbState = WRAP(_Unwind_GetGR)(ctx, UNWIND_IP_REG) & 1;
+ uint64_t new_val = (uint64_t)(val | thumbState);
+ WRAP(_Unwind_SetGR)(ctx, UNWIND_IP_REG, new_val);
+}
diff --git a/ndk/sources/android/libportable/arch-mips/_setjmp.S b/ndk/sources/android/libportable/arch-mips/_setjmp.S
new file mode 100644
index 000000000..bceeff7b8
--- /dev/null
+++ b/ndk/sources/android/libportable/arch-mips/_setjmp.S
@@ -0,0 +1,193 @@
+/* Derived from: $OpenBSD: _setjmp.S,v 1.4 2005/08/07 16:40:15 espie Exp $ */
+
+/*
+ * Copyright (c) 2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Opsycon AB nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include <machine/asm.h>
+#include <machine/regnum.h>
+
+#include "jboffsets.h"
+
+/*
+ * _setjmp, _longjmp (not restoring signal state)
+ *
+ * XXX FPSET should probably be taken from SR setting. hmmm...
+ * GPOFF and FRAMESIZE must be the same for both _setjmp and _longjmp!
+ *
+ */
+
+FRAMESZ= MKFSIZ(0,4)
+GPOFF= FRAMESZ-2*REGSZ
+
+#define FPREG64_S(FPR, OFF, BASE) \
+ swc1 FPR, OFF(BASE) ; \
+ mfhc1 t0, FPR ; \
+ sw t0, OFF+4(BASE) ;
+
+#define FPREG64_L(FPR, OFF, BASE) \
+ lw t0, OFF+4(BASE) ; \
+ lw t1, OFF(BASE) ; \
+ mtc1 t1, FPR ; \
+ mthc1 t0, FPR ; \
+
+LEAF(_setjmp_portable, FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, _setjmp)
+ SAVE_GP(GPOFF)
+ .set noreorder
+#if defined(__mips64)
+ dli v0, MAGIC__SETJMP
+#else
+ li v0, MAGIC__SETJMP
+#endif
+ REG_S v0, JB_MAGIC(a0)
+ REG_S s0, JB_S0(a0)
+ REG_S s1, JB_S1(a0)
+ REG_S s2, JB_S2(a0)
+ REG_S s3, JB_S3(a0)
+ REG_S s4, JB_S4(a0)
+ REG_S s5, JB_S5(a0)
+ REG_S s6, JB_S6(a0)
+ REG_S s7, JB_S7(a0)
+ REG_S s8, JB_S8(a0)
+ REG_L v0, GPOFF(sp)
+ REG_S v0, JB_GP(a0)
+ PTR_ADDU v0, sp, FRAMESZ
+ REG_S v0, JB_SP(a0)
+ REG_S ra, JB_PC(a0)
+
+#if !defined(SOFTFLOAT)
+ /*
+ * Would be nice if we could tell if the FP registers are currently being used;
+ * Assume they are, and use pointer to jmp_buf in a0 to save FP registers and the
+ * jmp_buf.fpused flag.
+ */
+ li v0, 1 # v0 = 1
+ REG_S v0, JB_FPUSED(a0) # a0->jb_fpused = v0:1
+ cfc1 v0, $31
+#if _MIPS_FPSET == 32
+ FPREG64_S($f20, JB_F20, a0)
+ FPREG64_S($f21, JB_F21, a0)
+ FPREG64_S($f22, JB_F22, a0)
+ FPREG64_S($f23, JB_F23, a0)
+ FPREG64_S($f24, JB_F24, a0)
+ FPREG64_S($f25, JB_F25, a0)
+ FPREG64_S($f26, JB_F26, a0)
+ FPREG64_S($f27, JB_F27, a0)
+ FPREG64_S($f28, JB_F28, a0)
+ FPREG64_S($f29, JB_F29, a0)
+ FPREG64_S($f30, JB_F30, a0)
+ FPREG64_S($f31, JB_F31, a0)
+#else
+ swc1 $f20, JB_F20(a0)
+ swc1 $f21, JB_F21(a0)
+ swc1 $f22, JB_F22(a0)
+ swc1 $f23, JB_F23(a0)
+ swc1 $f24, JB_F24(a0)
+ swc1 $f25, JB_F25(a0)
+ swc1 $f26, JB_F26(a0)
+ swc1 $f27, JB_F27(a0)
+ swc1 $f28, JB_F28(a0)
+ swc1 $f29, JB_F29(a0)
+ swc1 $f30, JB_F30(a0)
+ swc1 $f31, JB_F31(a0)
+#endif
+ REG_S v0, JB_FSR(a0)
+#endif /* !SOFTFLOAT */
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
+ j ra
+ move v0, zero
+END(_setjmp_portable)
+
+LEAF(_longjmp_portable, FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, _longjmp)
+ SAVE_GP(GPOFF)
+ .set noreorder
+ REG_L v0, JB_MAGIC(a0)
+ bne v0, MAGIC__SETJMP, botch # jump if error
+ REG_L ra, JB_PC(a0)
+ REG_L v0, JB_FSR(a0)
+ REG_L s0, JB_S0(a0)
+ REG_L s1, JB_S1(a0)
+ REG_L s2, JB_S2(a0)
+ REG_L s3, JB_S3(a0)
+ REG_L s4, JB_S4(a0)
+ REG_L s5, JB_S5(a0)
+ REG_L s6, JB_S6(a0)
+ REG_L s7, JB_S7(a0)
+ REG_L s8, JB_S8(a0)
+ REG_L gp, JB_GP(a0)
+ REG_L sp, JB_SP(a0)
+#if !defined(SOFTFLOAT)
+ ctc1 v0, $31
+#if _MIPS_FPSET == 32
+ FPREG64_L($f20, JB_F20, a0)
+ FPREG64_L($f21, JB_F21, a0)
+ FPREG64_L($f22, JB_F22, a0)
+ FPREG64_L($f23, JB_F23, a0)
+ FPREG64_L($f24, JB_F24, a0)
+ FPREG64_L($f25, JB_F25, a0)
+ FPREG64_L($f26, JB_F26, a0)
+ FPREG64_L($f27, JB_F27, a0)
+ FPREG64_L($f28, JB_F28, a0)
+ FPREG64_L($f29, JB_F29, a0)
+ FPREG64_L($f30, JB_F30, a0)
+ FPREG64_L($f31, JB_F31, a0)
+#else
+ lwc1 $f20, JB_F20(a0)
+ lwc1 $f21, JB_F21(a0)
+ lwc1 $f22, JB_F22(a0)
+ lwc1 $f23, JB_F23(a0)
+ lwc1 $f24, JB_F24(a0)
+ lwc1 $f25, JB_F25(a0)
+ lwc1 $f26, JB_F26(a0)
+ lwc1 $f27, JB_F27(a0)
+ lwc1 $f28, JB_F28(a0)
+ lwc1 $f29, JB_F29(a0)
+ lwc1 $f30, JB_F30(a0)
+ lwc1 $f31, JB_F31(a0)
+#endif
+#endif /* !SOFTFLOAT */
+ bne a1, zero, 1f
+ nop
+ li a1, 1 # never return 0!
+1:
+ j ra
+ move v0, a1
+
+botch:
+ jal longjmperror
+ nop
+ jal abort
+ nop
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
+END(_longjmp_portable)
diff --git a/ndk/sources/android/libportable/arch-mips/clone.c b/ndk/sources/android/libportable/arch-mips/clone.c
new file mode 100644
index 000000000..7498ef635
--- /dev/null
+++ b/ndk/sources/android/libportable/arch-mips/clone.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright 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.
+ */
+
+#define _GNU_SOURCE
+#include <portability.h>
+#include <sched.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <signal_portable.h>
+#include <portability.h>
+#include <stdio.h>
+#include <errno.h>
+#include <filefd_portable.h>
+
+#define PORTABLE_TAG "clone_portable"
+#include <log_portable.h>
+
+
+/*
+ * This function maps the clone function call defined in:
+ * $TOP/bionic/libc/bionic/bionic_clone.c
+ *
+ * which calls the __bionic_clone() system call which is defined in:
+ * $TOP/bionic/libc/unistd/arch-mips/bionic/clone.S
+ *
+ * We have to map the low byte of the 'flags' parameter which
+ * contains the number of the termination signal sent to the
+ * parent when the child dies.
+ *
+ * Note that if this signal is specified as anything other than
+ * SIGCHLD, then the parent process must specify the __WALL or
+ * __WCLONE options when waiting for the child with wait(2).
+ *
+ * If no signal is specified, then the parent process is not
+ * signaled when the child terminates.
+ */
+int WRAP(clone)(int (*fn)(void *), void *child_stack, int port_flags, void *arg, ...)
+{
+ va_list args;
+ int ret;
+ int mips_flags;
+ void *new_tls = NULL;
+ int *child_tidptr = NULL;
+ int *parent_tidptr = NULL;
+ int mips_term_signum;
+ char *mips_term_signame;
+ int portable_term_signum;
+ char *portable_term_signame;
+ int cloning_vm = ((port_flags & CLONE_VM) == CLONE_VM);
+ int cloning_files = ((port_flags & CLONE_FILES) == CLONE_FILES);
+ int cloning_sighand = ((port_flags & CLONE_SIGHAND) == CLONE_SIGHAND);
+
+ ALOGV(" ");
+ ALOGV("%s(fn:%p, child_stack:%p, port_flags:0x%x, arg:%p, ...) {", __func__,
+ fn, child_stack, port_flags, arg);
+
+ /* Shared file descriptor table requires shared memory. */
+ if (cloning_files != cloning_vm) {
+ ALOGE("%s: cloning_files:%d != cloning_vm:%d) ...", __func__,
+ cloning_files, cloning_vm);
+
+ ALOGE("%s: ... port_flags:0x%x Not Supported by Lib-Portable!", __func__,
+ port_flags);
+ }
+
+ /* Shared signal handler table requires shared memory. */
+ if (cloning_sighand != cloning_vm) {
+ ALOGE("%s: cloning_sighand:%d != cloning_vm:%d) ...", __func__,
+ cloning_sighand, cloning_vm);
+
+ ALOGE("%s: ... port_flags:0x%x Not Supported by Lib-Portable!", __func__,
+ port_flags);
+ }
+
+ /* Extract optional parameters - they are cumulative. */
+ va_start(args, arg);
+ if (port_flags & (CLONE_PARENT_SETTID|CLONE_SETTLS|CLONE_CHILD_SETTID)) {
+ parent_tidptr = va_arg(args, int*);
+ }
+ if (port_flags & (CLONE_SETTLS|CLONE_CHILD_SETTID)) {
+ new_tls = va_arg(args, void*);
+ }
+ if (port_flags & CLONE_CHILD_SETTID) {
+ child_tidptr = va_arg(args, int*);
+ }
+ va_end(args);
+
+ /*
+ * Map the LSB of the flags as explained above.
+ */
+ portable_term_signum = port_flags & 0xFF;
+ if (portable_term_signum == 0) {
+ mips_flags = port_flags;
+ } else {
+ portable_term_signame = map_portable_signum_to_name(portable_term_signum);
+ ALOGV("%s: portable_term_signum:0x%x:'%s'", __func__,
+ portable_term_signum, portable_term_signame);
+ mips_term_signum = signum_pton(portable_term_signum);
+ mips_term_signame = map_mips_signum_to_name(mips_term_signum);
+ ALOGV("%s: mips_term_signum:0x%x:'%s'", __func__,
+ mips_term_signum, mips_term_signame);
+ mips_flags = (port_flags & ~0xFF) | (mips_term_signum & 0xFF);
+ }
+ ALOGV("%s: clone(%p, %p, 0x%x, %p, %p, %p, %p);", __func__,
+ fn, child_stack, mips_flags, arg, parent_tidptr, new_tls, child_tidptr);
+
+ ret = REAL(clone)(fn, child_stack, mips_flags, arg, parent_tidptr,
+ new_tls, child_tidptr);
+
+ if (ret > 0) {
+ /*
+ * Disable mapping in the parent if the child could interfere
+ * and make things even worse than skipping the signal and
+ * file read mapping.
+ */
+ if (cloning_files != cloning_vm) {
+ filefd_disable_mapping();
+ }
+ if (cloning_sighand != cloning_vm) {
+ signal_disable_mapping();
+ }
+ }
+
+ ALOGV("%s: return(ret:%d); }", __func__, ret);
+ return ret;
+}
diff --git a/ndk/sources/android/libportable/arch-mips/epoll.c b/ndk/sources/android/libportable/arch-mips/epoll.c
index f703ba1d9..ef75695df 100644
--- a/ndk/sources/android/libportable/arch-mips/epoll.c
+++ b/ndk/sources/android/libportable/arch-mips/epoll.c
@@ -14,15 +14,16 @@
* limitations under the License.
*/
+#include <portability.h>
#include <sys/epoll.h>
-int epoll_ctl_portable(int epfd, int op, int fd, struct epoll_event *event)
+int WRAP(epoll_ctl)(int epfd, int op, int fd, struct epoll_event *event)
{
- return epoll_ctl(epfd, op, fd, event);
+ return REAL(epoll_ctl)(epfd, op, fd, event);
}
-int epoll_wait_portable(int epfd, struct epoll_event *events, int max, int timeout)
+int WRAP(epoll_wait)(int epfd, struct epoll_event *events, int max, int timeout)
{
- return epoll_wait(epfd, events, max, timeout);
+ return REAL(epoll_wait)(epfd, events, max, timeout);
}
diff --git a/ndk/sources/android/libportable/arch-mips/errno.c b/ndk/sources/android/libportable/arch-mips/errno.c
index 7372c6789..14e292528 100644
--- a/ndk/sources/android/libportable/arch-mips/errno.c
+++ b/ndk/sources/android/libportable/arch-mips/errno.c
@@ -14,16 +14,22 @@
* limitations under the License.
*/
+#include <portability.h>
+#include <pthread.h>
+#include <string.h>
#include <errno.h>
#include <errno_portable.h>
+#define PORTABLE_TAG "errno_portable"
+#include <log_portable.h>
+
#if ENAMETOOLONG==ENAMETOOLONG_PORTABLE
#error Bad build environment
#endif
-static inline int mips_change_errno(int mips_errno)
+__hidden int errno_ntop(int native_errno)
{
- switch (mips_errno) {
+ switch (native_errno) {
case ENAMETOOLONG: return ENAMETOOLONG_PORTABLE;
case ENOLCK: return ENOLCK_PORTABLE;
case ENOSYS: return ENOSYS_PORTABLE;
@@ -121,14 +127,244 @@ static inline int mips_change_errno(int mips_errno)
case EOWNERDEAD: return EOWNERDEAD_PORTABLE;
case ENOTRECOVERABLE: return ENOTRECOVERABLE_PORTABLE;
}
- return mips_errno;
+ return native_errno;
+}
+
+__hidden int errno_pton(int portable_errno)
+{
+ switch (portable_errno) {
+ case ENAMETOOLONG_PORTABLE: return ENAMETOOLONG;
+ case ENOLCK_PORTABLE: return ENOLCK;
+ case ENOSYS_PORTABLE: return ENOSYS;
+ case ENOTEMPTY_PORTABLE: return ENOTEMPTY;
+ case ELOOP_PORTABLE: return ELOOP;
+ case EWOULDBLOCK_PORTABLE: return EWOULDBLOCK;
+ case ENOMSG_PORTABLE: return ENOMSG;
+ case EIDRM_PORTABLE: return EIDRM;
+ case ECHRNG_PORTABLE: return ECHRNG;
+ case EL2NSYNC_PORTABLE: return EL2NSYNC;
+ case EL3HLT_PORTABLE: return EL3HLT;
+ case EL3RST_PORTABLE: return EL3RST;
+ case ELNRNG_PORTABLE: return ELNRNG;
+ case EUNATCH_PORTABLE: return EUNATCH;
+ case ENOCSI_PORTABLE: return ENOCSI;
+ case EL2HLT_PORTABLE: return EL2HLT;
+ case EBADE_PORTABLE: return EBADE;
+ case EBADR_PORTABLE: return EBADR;
+ case EXFULL_PORTABLE: return EXFULL;
+ case ENOANO_PORTABLE: return ENOANO;
+ case EBADRQC_PORTABLE: return EBADRQC;
+ case EBADSLT_PORTABLE: return EBADSLT;
+ case EDEADLOCK_PORTABLE: return EDEADLOCK;
+ case EBFONT_PORTABLE: return EBFONT;
+ case ENOSTR_PORTABLE: return ENOSTR;
+ case ENODATA_PORTABLE: return ENODATA;
+ case ETIME_PORTABLE: return ETIME;
+ case ENOSR_PORTABLE: return ENOSR;
+ case ENONET_PORTABLE: return ENONET;
+ case ENOPKG_PORTABLE: return ENOPKG;
+ case EREMOTE_PORTABLE: return EREMOTE;
+ case ENOLINK_PORTABLE: return ENOLINK;
+ case EADV_PORTABLE: return EADV;
+ case ESRMNT_PORTABLE: return ESRMNT;
+ case ECOMM_PORTABLE: return ECOMM;
+ case EPROTO_PORTABLE: return EPROTO;
+ case EMULTIHOP_PORTABLE: return EMULTIHOP;
+ case EDOTDOT_PORTABLE: return EDOTDOT;
+ case EBADMSG_PORTABLE: return EBADMSG;
+ case EOVERFLOW_PORTABLE: return EOVERFLOW;
+ case ENOTUNIQ_PORTABLE: return ENOTUNIQ;
+ case EBADFD_PORTABLE: return EBADFD;
+ case EREMCHG_PORTABLE: return EREMCHG;
+ case ELIBACC_PORTABLE: return ELIBACC;
+ case ELIBBAD_PORTABLE: return ELIBBAD;
+ case ELIBSCN_PORTABLE: return ELIBSCN;
+ case ELIBMAX_PORTABLE: return ELIBMAX;
+ case ELIBEXEC_PORTABLE: return ELIBEXEC;
+ case EILSEQ_PORTABLE: return EILSEQ;
+ case ERESTART_PORTABLE: return ERESTART;
+ case ESTRPIPE_PORTABLE: return ESTRPIPE;
+ case EUSERS_PORTABLE: return EUSERS;
+ case ENOTSOCK_PORTABLE: return ENOTSOCK;
+ case EDESTADDRREQ_PORTABLE: return EDESTADDRREQ;
+ case EMSGSIZE_PORTABLE: return EMSGSIZE;
+ case EPROTOTYPE_PORTABLE: return EPROTOTYPE;
+ case ENOPROTOOPT_PORTABLE: return ENOPROTOOPT;
+ case EPROTONOSUPPORT_PORTABLE: return EPROTONOSUPPORT;
+ case ESOCKTNOSUPPORT_PORTABLE: return ESOCKTNOSUPPORT;
+ case EOPNOTSUPP_PORTABLE: return EOPNOTSUPP;
+ case EPFNOSUPPORT_PORTABLE: return EPFNOSUPPORT;
+ case EAFNOSUPPORT_PORTABLE: return EAFNOSUPPORT;
+ case EADDRINUSE_PORTABLE: return EADDRINUSE;
+ case EADDRNOTAVAIL_PORTABLE: return EADDRNOTAVAIL;
+ case ENETDOWN_PORTABLE: return ENETDOWN;
+ case ENETUNREACH_PORTABLE: return ENETUNREACH;
+ case ENETRESET_PORTABLE: return ENETRESET;
+ case ECONNABORTED_PORTABLE: return ECONNABORTED;
+ case ECONNRESET_PORTABLE: return ECONNRESET;
+ case ENOBUFS_PORTABLE: return ENOBUFS;
+ case EISCONN_PORTABLE: return EISCONN;
+ case ENOTCONN_PORTABLE: return ENOTCONN;
+ case ESHUTDOWN_PORTABLE: return ESHUTDOWN;
+ case ETOOMANYREFS_PORTABLE: return ETOOMANYREFS;
+ case ETIMEDOUT_PORTABLE: return ETIMEDOUT;
+ case ECONNREFUSED_PORTABLE: return ECONNREFUSED;
+ case EHOSTDOWN_PORTABLE: return EHOSTDOWN;
+ case EHOSTUNREACH_PORTABLE: return EHOSTUNREACH;
+ case EALREADY_PORTABLE: return EALREADY;
+ case EINPROGRESS_PORTABLE: return EINPROGRESS;
+ case ESTALE_PORTABLE: return ESTALE;
+ case EUCLEAN_PORTABLE: return EUCLEAN;
+ case ENOTNAM_PORTABLE: return ENOTNAM;
+ case ENAVAIL_PORTABLE: return ENAVAIL;
+ case EISNAM_PORTABLE: return EISNAM;
+ case EREMOTEIO_PORTABLE: return EREMOTEIO;
+ case EDQUOT_PORTABLE: return EDQUOT;
+ case ENOMEDIUM_PORTABLE: return ENOMEDIUM;
+ case EMEDIUMTYPE_PORTABLE: return EMEDIUMTYPE;
+ case ECANCELED_PORTABLE: return ECANCELED;
+ case ENOKEY_PORTABLE: return ENOKEY;
+ case EKEYEXPIRED_PORTABLE: return EKEYEXPIRED;
+ case EKEYREVOKED_PORTABLE: return EKEYREVOKED;
+ case EKEYREJECTED_PORTABLE: return EKEYREJECTED;
+ case EOWNERDEAD_PORTABLE: return EOWNERDEAD;
+ case ENOTRECOVERABLE_PORTABLE: return ENOTRECOVERABLE;
+ }
+ return portable_errno;
+}
+
+/* Key for the thread-specific portable errno */
+static pthread_key_t errno_key;
+
+/* Once-only initialisation of the key */
+static pthread_once_t errno_key_once = PTHREAD_ONCE_INIT;
+
+/* Free the thread-specific portable errno */
+static void errno_key_destroy(void *buf)
+{
+ if (buf)
+ free(buf);
+}
+
+/* Allocate the key */
+static void errno_key_create(void)
+{
+ pthread_key_create(&errno_key, errno_key_destroy);
+}
+
+struct errno_state {
+ int pshadow; /* copy of last portable errno */
+ int perrno; /* portable errno that may be modified by app */
+};
+
+/* Return the thread-specific portable errno */
+static struct errno_state *errno_key_data(void)
+{
+ struct errno_state *data;
+ static struct errno_state errno_state;
+
+ pthread_once(&errno_key_once, errno_key_create);
+ data = (struct errno_state *)pthread_getspecific(errno_key);
+ if (data == NULL) {
+ data = malloc(sizeof(struct errno_state));
+ pthread_setspecific(errno_key, data);
+ }
+ if (data == NULL)
+ data = &errno_state;
+ return data;
+}
+
+/*
+ * Attempt to return a thread specific location containnig the portable errno.
+ * This can be assigned to without affecting the native errno. If the key
+ * allocation fails fall back to using the native errno location.
+ */
+volatile int* WRAP(__errno)()
+{
+ struct errno_state *p;
+ int save_errno;
+
+ /* pthread_* calls may modify errno so use a copy */
+ save_errno = *REAL(__errno)();
+
+ p = errno_key_data();
+
+ ALOGV(" ");
+ ALOGV("%s(): { save_errno = errno:%d, (p:%p)->{pshadow:%d, perrno:%d}", __func__,
+ save_errno, p, p->pshadow, p->perrno);
+
+ if (save_errno == 0 && p->pshadow != p->perrno) {
+ /*
+ * portable errno has changed but native hasn't
+ * - copy portable error back to native
+ */
+ p->pshadow = p->perrno;
+ save_errno = errno_pton(p->perrno);
+ }
+ else if (save_errno != 0 && p->pshadow == p->perrno) {
+ /*
+ * Native errno has changed but portable hasn't
+ * - copy native error to portable.
+ */
+ p->pshadow = p->perrno = errno_ntop(save_errno);
+ save_errno = 0;
+ }
+ else if (save_errno != 0 && p->pshadow != p->perrno) {
+ /*
+ * Both native and portable errno values have changed
+ * so give priority to native errno
+ * - copy native error to portable
+ */
+ p->pshadow = p->perrno = errno_ntop(save_errno);
+ save_errno = 0;
+ }
+
+ ALOGV("%s: new save_errno:%d p:%p->{pshadow:%d, perrno:%d}", __func__,
+ save_errno, p, p->pshadow, p->perrno);
+
+ *REAL(__errno)() = save_errno;
+
+ ALOGV("%s: return (&p->perrno):%p; }", __func__, &p->perrno);
+
+ /* return pointer to the modifiable portable errno value */
+ return &p->perrno;
+}
+
+
+/* set portable errno */
+void WRAP(__set_errno)(int portable_errno)
+{
+ struct errno_state *p;
+ int save_errno;
+
+ /* pthread_* calls may modify errno so use a copy */
+ save_errno = *REAL(__errno)();
+
+ p = errno_key_data();
+
+ ALOGV("%s(): { save_errno = errno:%d, p:%p->{pshadow:%d, perrno:%d}", __func__,
+ save_errno, p, p->pshadow, p->perrno);
+
+ p->pshadow = p->perrno = portable_errno;
+
+ save_errno = errno_pton(portable_errno);
+
+ ALOGV("%s: new save_errno:%d, p:%p->{pshadow:%d, perrno:%d}", __func__,
+ save_errno, p, p->pshadow, p->perrno);
+
+ *REAL(__errno)() = save_errno;
+
+ ALOGV("%s: return; }", __func__);
+}
+
+extern char* REAL(strerror)(int);
+char *WRAP(strerror)(int errnum)
+{
+ return REAL(strerror)(errno_pton(errnum));
}
-extern volatile int* __errno(void);
-volatile int* __errno_portable()
+/* BSD style strerror_r */
+int WRAP(strerror_r)(int errnum, char *buf, size_t buflen)
{
- /* Note that writing to static_errno will not affect the underlying system. */
- static int static_errno;
- static_errno = mips_change_errno(*__errno());
- return &static_errno;
+ return REAL(strerror_r)(errno_pton(errnum), buf, buflen);
}
diff --git a/ndk/sources/android/libportable/arch-mips/eventfd.c b/ndk/sources/android/libportable/arch-mips/eventfd.c
new file mode 100644
index 000000000..35285d96f
--- /dev/null
+++ b/ndk/sources/android/libportable/arch-mips/eventfd.c
@@ -0,0 +1,96 @@
+/*
+ * Copyright 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.
+ */
+
+#include <portability.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <asm/unistd-portable.h>
+#include <asm/unistd.h>
+
+#include <fcntl_portable.h>
+#include <sys/eventfd.h>
+#include <eventfd_portable.h>
+#include <filefd_portable.h>
+
+#define PORTABLE_TAG "eventfd_portable"
+#include <log_portable.h>
+
+
+/* NOTE: LTP defaults to using O_NONBLOCK even if EFD_NONBLOCK is defined */
+
+
+/*
+ * Portable to Native event flags mapper.
+ */
+static inline int efd_flags_pton(int portable_flags)
+{
+ int native_flags = 0;
+
+ ALOGV("%s(portable_flags:0x%x) {", __func__, portable_flags);
+
+ if (portable_flags & EFD_NONBLOCK_PORTABLE) {
+ native_flags |= EFD_NONBLOCK;
+ portable_flags &= ~EFD_NONBLOCK_PORTABLE;
+ }
+
+ if (portable_flags & EFD_CLOEXEC_PORTABLE) {
+ native_flags |= EFD_CLOEXEC;
+ portable_flags &= EFD_CLOEXEC_PORTABLE;
+ }
+
+ if (portable_flags & EFD_SEMAPHORE_PORTABLE) {
+ native_flags |= EFD_SEMAPHORE;
+ portable_flags &= EFD_SEMAPHORE_PORTABLE;
+ }
+
+ if (portable_flags != 0) {
+ ALOGW("%s: portable_flags:0x%x != 0; Unsupported Flags being used!",
+ __func__, portable_flags);
+ }
+ ALOGV("%s: return(native_flags:%d); }", __func__, native_flags);
+ return native_flags;
+}
+
+
+/*
+ * In the original eventfd() the portable_flags were unused up to
+ * linux 2.6.26 and had to be zero. Android simply uses the
+ * new eventfd2 system call number, so it likely best to just use
+ * the Android eventfd() for both eventfd and eventfd2 system calls.
+ */
+int WRAP(eventfd)(unsigned int initval, int portable_flags) {
+ int rv;
+ int native_flags;
+
+ ALOGV(" ");
+ ALOGV("%s(initval:%u, portable_flags:%d) {", __func__,
+ initval, portable_flags);
+
+ native_flags = efd_flags_pton(portable_flags);
+
+ rv = REAL(eventfd)(initval, native_flags);
+ if (rv >= 0) {
+ if (native_flags & EFD_CLOEXEC) {
+ filefd_CLOEXEC_enabled(rv);
+ }
+ filefd_opened(rv, EVENT_FD_TYPE);
+ }
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
diff --git a/ndk/sources/android/libportable/arch-mips/fcntl.c b/ndk/sources/android/libportable/arch-mips/fcntl.c
index 31874b5ce..174b02719 100644
--- a/ndk/sources/android/libportable/arch-mips/fcntl.c
+++ b/ndk/sources/android/libportable/arch-mips/fcntl.c
@@ -14,48 +14,426 @@
* limitations under the License.
*/
+#include <portability.h>
#include <fcntl.h>
+#include <errno.h>
#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <errno_portable.h>
+#include <portability.h>
#include <fcntl_portable.h>
+#include <filefd_portable.h>
+
+#include <portability.h>
#if F_GETLK_PORTABLE==F_GETLK
#error Bad build environment
#endif
-static inline int mips_change_cmd(int cmd)
+#define PORTABLE_TAG "fcntl_portable"
+#include <log_portable.h>
+
+static char *map_portable_cmd_to_name(int cmd)
{
+ char *name;
+
switch(cmd) {
- case F_GETLK_PORTABLE:
- return F_GETLK;
- case F_SETLK_PORTABLE:
- return F_SETLK;
- case F_SETLKW_PORTABLE:
- return F_SETLKW;
- case F_SETOWN_PORTABLE:
- return F_SETOWN;
- case F_GETOWN_PORTABLE:
- return F_GETOWN;
- case F_GETLK64_PORTABLE:
- return F_GETLK64;
- case F_SETLK64_PORTABLE:
- return F_SETLK64;
- case F_SETLKW64_PORTABLE:
- return F_SETLKW64;
+ case F_DUPFD_PORTABLE: name = "F_DUPFD_PORTABLE"; break; /* 0 */
+ case F_GETFD_PORTABLE: name = "F_GETFD_PORTABLE"; break; /* 1 */
+ case F_SETFD_PORTABLE: name = "F_SETFD_PORTABLE"; break; /* 2 */
+ case F_GETFL_PORTABLE: name = "F_GETFL_PORTABLE"; break; /* 3 */
+ case F_SETFL_PORTABLE: name = "F_SETFL_PORTABLE"; break; /* 4 */
+ case F_GETLK_PORTABLE: name = "F_GETLK_PORTABLE"; break; /* 5 */
+ case F_SETLK_PORTABLE: name = "F_SETLK_PORTABLE"; break; /* 6 */
+ case F_SETLKW_PORTABLE: name = "F_SETLKW_PORTABLE"; break; /* 7 */
+ case F_SETOWN_PORTABLE: name = "F_SETOWN_PORTABLE"; break; /* 8 */
+ case F_GETOWN_PORTABLE: name = "F_GETOWN_PORTABLE"; break; /* 9 */
+ case F_SETSIG_PORTABLE: name = "F_SETSIG_PORTABLE"; break; /* 10 */
+ case F_GETSIG_PORTABLE: name = "F_GETSIG_PORTABLE"; break; /* 11 */
+ case F_GETLK64_PORTABLE: name = "F_GETLK64_PORTABLE"; break; /* 12 */
+ case F_SETLK64_PORTABLE: name = "F_SETLK64_PORTABLE"; break; /* 13 */
+ case F_SETLKW64_PORTABLE: name = "F_SETLKW64_PORTABLE"; break; /* 14 */
+ case F_SETLEASE_PORTABLE: name = "F_SETLEASE_PORTABLE"; break; /* 1024 */
+ case F_GETLEASE_PORTABLE: name = "F_GETLEASE_PORTABLE"; break; /* 1025 */
+ case F_NOTIFY_PORTABLE: name = "F_NOTIFY_PORTABLE"; break; /* 1026 */
+ case F_CANCELLK_PORTABLE: name = "F_CANCELLK_PORTABLE"; break; /* 1029 */
+ case F_DUPFD_CLOEXEC_PORTABLE: name = "F_DUPFD_CLOEXEC_PORTABLE"; break; /* 1030 */
+ default: name = "<UNKNOWN>"; break;
+ }
+ return name;
+}
+
+
+/*
+ * Maps a fcntl portable cmd to a native command.
+ */
+static int fcntl_cmd_pton(int portable_cmd)
+{
+ int native_cmd;
+ char *error_msg = NULL;
+
+ switch(portable_cmd) {
+ case F_DUPFD_PORTABLE: /* 0 --> 0 */
+ native_cmd = F_DUPFD;
+ break;
+
+ case F_GETFD_PORTABLE: /* 1 --> 1 */
+ native_cmd = F_GETFD;
+ break;
+
+ case F_SETFD_PORTABLE: /* 2 --> 2 */
+ native_cmd = F_SETFD;
+ break;
+
+ case F_GETFL_PORTABLE: /* 3 --> 3 */
+ native_cmd = F_GETFL;
+ break;
+
+ case F_SETFL_PORTABLE: /* 4 --> 4 */
+ native_cmd = F_SETFL;
+ break;
+
+ case F_GETLK_PORTABLE: /* 5 --> 14 */
+ native_cmd = F_GETLK;
+ break;
+
+ case F_SETLK_PORTABLE: /* 6 --> 6 */
+ native_cmd = F_SETLK;
+ break;
+
+ case F_SETLKW_PORTABLE: /* 7 --> 7 */
+ native_cmd = F_SETLKW;
+ break;
+
+ case F_SETOWN_PORTABLE: /* 8 --> 24 */
+ native_cmd = F_SETOWN;
+ break;
+
+ case F_GETOWN_PORTABLE: /* 9 --> 23 */
+ native_cmd = F_GETOWN;
+ break;
+
+ case F_SETSIG_PORTABLE: /* 10 --> 10 */
+ native_cmd = F_SETSIG;
+ break;
+
+ case F_GETSIG_PORTABLE: /* 11 --> 11 */
+ native_cmd = F_GETSIG;
+ break;
+
+ case F_GETLK64_PORTABLE: /* 12 --> 33 */
+ native_cmd = F_GETLK64;
+ break;
+
+ case F_SETLK64_PORTABLE: /* 13 --> 34 */
+ native_cmd = F_SETLK64;
+ break;
+
+ case F_SETLKW64_PORTABLE: /* 14 --> 35 */
+ native_cmd = F_SETLKW64;
+ break;
+
+ case F_SETLEASE_PORTABLE: /* 1024 --> 1024 */
+ native_cmd = F_SETLEASE;
+ break;
+
+ case F_GETLEASE_PORTABLE: /* 1025 --> 1025 */
+ native_cmd = F_GETLEASE;
+ break;
+
+ case F_NOTIFY_PORTABLE: /* 1026 --> 1026 */
+ native_cmd = F_NOTIFY;
+ break;
+
+ case F_CANCELLK_PORTABLE: /* 1029 --> void */
+ error_msg = "Case F_CANCELLK_PORTABLE: Not supported by MIPS. ";
+ native_cmd = portable_cmd;
+ break;
+
+ case F_DUPFD_CLOEXEC_PORTABLE: /* 1030 --> VOID; Not currently used by Bionic */
+ error_msg = "Case F_DUPFD_CLOEXEC_PORTABLE: Not supported by MIPS. ";
+ native_cmd = portable_cmd;
+ break;
+
+ default:
+ error_msg = "Case Default: Command Not Supported. ";
+ native_cmd = portable_cmd;
+ break;
}
- return cmd;
+
+done:
+ if (error_msg != NULL) {
+ ALOGE("%s(portable_cmd:%d:0x%x): %sreturn(native_cmd:%d:0x%x);", __func__,
+ portable_cmd, portable_cmd, error_msg, native_cmd, native_cmd);
+ } else {
+ ALOGV("%s(portable_cmd:%d:0x%x): return(native_cmd:%d:0x%x);", __func__,
+ portable_cmd, portable_cmd, native_cmd, native_cmd);
+ }
+ return native_cmd;
+}
+
+
+static int fcntl_flags_pton(int flags)
+{
+ int mipsflags = flags & O_ACCMODE_PORTABLE;
+
+ if (flags & O_CREAT_PORTABLE)
+ mipsflags |= O_CREAT;
+ if (flags & O_EXCL_PORTABLE)
+ mipsflags |= O_EXCL;
+ if (flags & O_NOCTTY_PORTABLE)
+ mipsflags |= O_NOCTTY;
+ if (flags & O_TRUNC_PORTABLE)
+ mipsflags |= O_TRUNC;
+ if (flags & O_APPEND_PORTABLE)
+ mipsflags |= O_APPEND;
+ if (flags & O_NONBLOCK_PORTABLE)
+ mipsflags |= O_NONBLOCK;
+ if (flags & O_SYNC_PORTABLE)
+ mipsflags |= O_SYNC;
+ if (flags & FASYNC_PORTABLE)
+ mipsflags |= FASYNC;
+ if (flags & O_DIRECT_PORTABLE)
+ mipsflags |= O_DIRECT;
+ if (flags & O_LARGEFILE_PORTABLE)
+ mipsflags |= O_LARGEFILE;
+ if (flags & O_DIRECTORY_PORTABLE)
+ mipsflags |= O_DIRECTORY;
+ if (flags & O_NOFOLLOW_PORTABLE)
+ mipsflags |= O_NOFOLLOW;
+ if (flags & O_NOATIME_PORTABLE)
+ mipsflags |= O_NOATIME;
+ if (flags & O_NDELAY_PORTABLE)
+ mipsflags |= O_NDELAY;
+
+ ALOGV("%s(flags:0x%x): return(mipsflags:0x%x);", __func__,
+ flags, mipsflags);
+
+ return mipsflags;
+}
+
+static int fcntl_flags_ntop(int flags)
+{
+ int portableflags = flags & O_ACCMODE_PORTABLE;
+
+ if (flags & O_CREAT)
+ portableflags |= O_CREAT_PORTABLE;
+ if (flags & O_EXCL)
+ portableflags |= O_EXCL_PORTABLE;
+ if (flags & O_NOCTTY)
+ portableflags |= O_NOCTTY_PORTABLE;
+ if (flags & O_TRUNC)
+ portableflags |= O_TRUNC_PORTABLE;
+ if (flags & O_APPEND)
+ portableflags |= O_APPEND_PORTABLE;
+ if (flags & O_NONBLOCK)
+ portableflags |= O_NONBLOCK_PORTABLE;
+ if (flags & O_SYNC)
+ portableflags |= O_SYNC_PORTABLE;
+ if (flags & FASYNC)
+ portableflags |= FASYNC_PORTABLE;
+ if (flags & O_DIRECT)
+ portableflags |= O_DIRECT_PORTABLE;
+ if (flags & O_LARGEFILE)
+ portableflags |= O_LARGEFILE_PORTABLE;
+ if (flags & O_DIRECTORY)
+ portableflags |= O_DIRECTORY_PORTABLE;
+ if (flags & O_NOFOLLOW)
+ portableflags |= O_NOFOLLOW_PORTABLE;
+ if (flags & O_NOATIME)
+ portableflags |= O_NOATIME_PORTABLE;
+ if (flags & O_NDELAY)
+ portableflags |= O_NDELAY_PORTABLE;
+
+ ALOGV("%s(flags:0x%x): return(portableflags:0x%x);", __func__,
+ flags, portableflags);
+
+ return portableflags;
}
extern int __fcntl64(int, int, void *);
-int fcntl_portable(int fd, int cmd, ...)
+/*
+ * For 32 bit flocks we are converting a portable/ARM struct flock to a MIPS struct flock:
+ *
+ * MIPS: ARM:
+ * struct flock { struct flock_portable {
+ * short l_type; short l_type;
+ *
+ * short l_whence; short l_whence;
+ * off_t l_start; loff_t l_start;
+ * off_t l_len; loff_t l_len;
+ * long l_sysid;
+ *
+ * __kernel_pid_t l_pid; pid_t l_pid;
+ * long pad[4];
+ * }; }
+ *
+ * which have identically sized structure members:
+ *
+ * For a 64 bit flocks we only have to deal with
+ * a four byte padding in the ARM/Portable structure:
+ *
+ * MIPS: ARM:
+ * struct flock64 { struct flock64_portable {
+ * short l_type; short l_type;
+ * short l_whence; short l_whence;
+ * unsigned char __padding[4]; <---- NOTE
+ * loff_t l_start; loff_t l_start;
+ * loff_t l_len; loff_t l_len;
+ * pid_t l_pid; pid_t l_pid;
+ * } }
+ */
+int WRAP(fcntl)(int fd, int portable_cmd, ...)
{
+ int flags;
va_list ap;
- void * arg;
+ void *arg;
+ int mips_cmd;
+ int result = 0;
+ struct flock flock; /* Native MIPS structure */
+ struct flock64 flock64; /* Native MIPS structure */
+ char *portable_cmd_name = map_portable_cmd_to_name(portable_cmd);
+ struct flock_portable *flock_portable = NULL;
+ struct flock64_portable *flock64_portable = NULL;
+
+ ALOGV(" ");
+ ALOGV("%s(fd:%d, portable_cmd:%d:'%s', ...) {", __func__,
+ fd, portable_cmd,
+ portable_cmd_name);
- va_start(ap, cmd);
+
+ va_start(ap, portable_cmd);
arg = va_arg(ap, void *);
va_end(ap);
- return __fcntl64(fd, mips_change_cmd(cmd), arg);
+ mips_cmd = fcntl_cmd_pton(portable_cmd);
+ switch(mips_cmd) {
+ case F_GETLK:
+ case F_SETLK:
+ case F_SETLKW:
+ flock_portable = (struct flock_portable *) arg;
+
+ if (invalid_pointer(flock_portable)) {
+ ALOGE("%s: flock_portable:%p == {NULL||-1}", __func__, flock_portable);
+ *REAL(__errno)() = EFAULT;
+ result = -1;
+ goto done;
+ }
+
+ /*
+ * Lock type and Whence are the same for all ARCHs
+ * (F_RDLCK:0, F_WRLCK:1, F_UNLCK:2)
+ * (SEEK_SET:0, SEEK_CUR:1, SEEK_END:2)
+ */
+ flock.l_type = flock_portable->l_type;
+ flock.l_whence = flock_portable->l_whence;
+ flock.l_start = (off_t) flock_portable->l_start;
+ flock.l_len = (off_t) flock_portable->l_len;
+ flock.l_sysid = 0L;
+ flock.l_pid = flock_portable->l_pid; /* Perhaps 0 would be better */
+
+ result = __fcntl64(fd, mips_cmd, (void *) &flock);
+
+ flock_portable->l_type = flock.l_type;
+ flock_portable->l_whence = flock.l_whence;
+ flock_portable->l_start = flock.l_start;
+ flock_portable->l_len = flock.l_len;
+ flock_portable->l_pid = flock.l_pid;
+ break;
+
+ case F_GETLK64:
+ case F_SETLK64:
+ case F_SETLKW64:
+ flock64_portable = (struct flock64_portable *) arg;
+
+ if (invalid_pointer(flock_portable)) {
+ ALOGE("%s: flock_portable:%p == {NULL||-1}", __func__, flock_portable);
+ *REAL(__errno)() = EFAULT;
+ result = -1;
+ goto done;
+ }
+
+ /*
+ * Lock type and Whence are the same for all ARCHs
+ * (F_RDLCK:0, F_WRLCK:1, F_UNLCK:2)
+ * (SEEK_SET:0, SEEK_CUR:1, SEEK_END:2)
+ */
+ flock64.l_type = flock64_portable->l_type;
+ flock64.l_whence = flock64_portable->l_whence;
+ flock64.l_start = (off_t) flock64_portable->l_start;
+ flock64.l_len = (off_t) flock64_portable->l_len;
+ flock64.l_pid = flock64_portable->l_pid; /* Perhaps 0 would be better */
+
+ result = __fcntl64(fd, mips_cmd, (void *) &flock);
+
+ flock64_portable->l_type = flock64.l_type;
+ flock64_portable->l_whence = flock64.l_whence;
+ flock64_portable->l_start = flock64.l_start;
+ flock64_portable->l_len = flock64.l_len;
+ flock64_portable->l_pid = flock64.l_pid;
+ break;
+
+ case F_SETFL:
+ flags = fcntl_flags_pton((int)arg);
+ result = __fcntl64(fd, mips_cmd, (void *)flags);
+ break;
+
+ case F_GETFL:
+ result = __fcntl64(fd, mips_cmd, arg);
+ if (result != -1)
+ result = fcntl_flags_ntop(result);
+ break;
+
+ case F_DUPFD:
+ case F_GETFD:
+ case F_SETFD:
+ case F_SETOWN:
+ case F_GETOWN:
+ case F_SETSIG:
+ case F_GETSIG:
+ case F_SETLEASE:
+ case F_GETLEASE:
+ case F_NOTIFY:
+ ALOGV("%s: Calling __fcntl64(fd:%d, mips_cmd:0x%x, arg:%p);", __func__,
+ fd, mips_cmd, arg);
+
+ result = __fcntl64(fd, mips_cmd, arg);
+
+ if (result < 0) {
+ ALOGV("%s: result = %d = __fcntl64(fd:%d, mips_cmd:0x%x, arg:%p);", __func__,
+ result, fd, mips_cmd, arg);
+ } else {
+ if (mips_cmd == F_SETFD) {
+ /*
+ * File descriptor flag bits got set or cleared.
+ */
+ flags = (int)arg;
+ if (flags & FD_CLOEXEC) {
+ filefd_CLOEXEC_enabled(fd);
+ } else {
+ filefd_CLOEXEC_disabled(fd);
+ }
+ }
+ }
+ break;
+
+ default:
+ /*
+ * This is likely a rare situation, abort() would hang fcntl13 LTP test.
+ */
+ ALOGE("%s: mips_cmd:%d doesn't appear to be supported;", __func__,
+ mips_cmd);
+
+ ALOGV("%s: Assume it doesn't need to be mapped!", __func__);
+
+ result = __fcntl64(fd, mips_cmd, arg);
+ }
+
+done:
+ ALOGV("%s: return(result:%d); }", __func__, result);
+ return result;
}
diff --git a/ndk/sources/android/libportable/arch-mips/fenv.c b/ndk/sources/android/libportable/arch-mips/fenv.c
new file mode 100644
index 000000000..d7b600f9a
--- /dev/null
+++ b/ndk/sources/android/libportable/arch-mips/fenv.c
@@ -0,0 +1,208 @@
+/*
+ * Copyright 2013, 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.
+ */
+
+#include <portability.h>
+#include <sys/types.h>
+#include <fenv.h>
+#include <fenv_portable.h>
+
+static inline int mips_change_except(int flags)
+{
+ int mipsflags = 0;
+ int exception = flags & FE_ALL_EXCEPT_PORTABLE;
+
+ // exception flags
+ if (exception & FE_INVALID_PORTABLE)
+ mipsflags |= FE_INVALID;
+ if (exception & FE_DIVBYZERO_PORTABLE)
+ mipsflags |= FE_DIVBYZERO;
+ if (exception & FE_OVERFLOW_PORTABLE)
+ mipsflags |= FE_OVERFLOW;
+ if (exception & FE_UNDERFLOW_PORTABLE)
+ mipsflags |= FE_UNDERFLOW;
+ if (exception & FE_INEXACT_PORTABLE)
+ mipsflags |= FE_INEXACT;
+
+ return mipsflags;
+}
+
+static inline int mips_change_rounding(int flags)
+{
+ int mipsflags = 0;
+ int rounding = flags & 0x03;
+
+ // rounding flags
+ switch(rounding)
+ {
+ case FE_TONEAREST_PORTABLE:
+ mipsflags = FE_TONEAREST;
+ break;
+ case FE_DOWNWARD_PORTABLE:
+ mipsflags = FE_DOWNWARD;
+ break;
+ case FE_UPWARD_PORTABLE:
+ mipsflags = FE_UPWARD;
+ break;
+ case FE_TOWARDZERO_PORTABLE:
+ mipsflags = FE_TOWARDZERO;
+ break;
+ }
+ return mipsflags;
+}
+
+static inline int mips_get_except(int mipsflags)
+{
+ int flags = 0;
+ int exception = mipsflags & FE_ALL_EXCEPT;
+
+ // exception flags
+ if (exception & FE_INVALID)
+ flags |= FE_INVALID_PORTABLE;
+ if (exception & FE_DIVBYZERO)
+ flags |= FE_DIVBYZERO_PORTABLE;
+ if (exception & FE_OVERFLOW)
+ flags |= FE_OVERFLOW_PORTABLE;
+ if (exception & FE_UNDERFLOW)
+ flags |= FE_UNDERFLOW_PORTABLE;
+ if (exception & FE_INEXACT)
+ flags |= FE_INEXACT_PORTABLE;
+ return flags;
+}
+
+static inline int mips_get_rounding(int mipsflags)
+{
+ int flags = 0;
+ int rounding = mipsflags & _FCSR_RMASK;
+
+ // rounding flags
+ switch(rounding)
+ {
+ case FE_TONEAREST:
+ flags = FE_TONEAREST_PORTABLE;
+ break;
+ case FE_DOWNWARD:
+ flags = FE_DOWNWARD_PORTABLE;
+ break;
+ case FE_UPWARD:
+ flags = FE_UPWARD_PORTABLE;
+ break;
+ case FE_TOWARDZERO:
+ flags = FE_TOWARDZERO_PORTABLE;
+ break;
+ }
+ return flags;
+}
+
+int WRAP(fegetenv)(fenv_t* __envp) {
+ fenv_t _fcsr = 0;
+#ifdef __mips_hard_float
+ __asm__ __volatile__("cfc1 %0,$31" : "=r" (_fcsr));
+#endif
+ *__envp = _fcsr;
+ return 0;
+}
+
+int WRAP(fesetenv)(const fenv_t* __envp) {
+ fenv_t _fcsr = *__envp;
+#ifdef __mips_hard_float
+ __asm__ __volatile__("ctc1 %0,$31" : : "r" (_fcsr));
+#endif
+ return 0;
+}
+
+int WRAP(feclearexcept)(int __excepts) {
+ __excepts = mips_change_except(__excepts);
+ fexcept_t __fcsr;
+ WRAP(fegetenv)(&__fcsr);
+ __excepts &= FE_ALL_EXCEPT;
+ __fcsr &= ~(__excepts | (__excepts << _FCSR_CAUSE_SHIFT));
+ WRAP(fesetenv)(&__fcsr);
+ return 0;
+}
+
+int WRAP(fegetexceptflag)(fexcept_t* __flagp, int __excepts) {
+ __excepts = mips_change_except(__excepts);
+ fexcept_t __fcsr;
+ WRAP(fegetenv)(&__fcsr);
+ *__flagp = mips_get_except(__fcsr & __excepts & FE_ALL_EXCEPT);
+ return 0;
+}
+
+int WRAP(fesetexceptflag)(const fexcept_t* __flagp, int __excepts) {
+ int __flagp_ = mips_change_except(*__flagp);
+ __excepts = mips_change_except(__excepts);
+ fexcept_t __fcsr;
+ WRAP(fegetenv)(&__fcsr);
+ /* Ensure that flags are all legal */
+ __excepts &= FE_ALL_EXCEPT;
+ __fcsr &= ~__excepts;
+ __fcsr |= __flagp_ & __excepts;
+ WRAP(fesetenv)(&__fcsr);
+ return 0;
+}
+
+int WRAP(feraiseexcept)(int __excepts) {
+ __excepts = mips_change_except(__excepts);
+ fexcept_t __fcsr;
+ WRAP(fegetenv)(&__fcsr);
+ /* Ensure that flags are all legal */
+ __excepts &= FE_ALL_EXCEPT;
+ /* Cause bit needs to be set as well for generating the exception*/
+ __fcsr |= __excepts | (__excepts << _FCSR_CAUSE_SHIFT);
+ WRAP(fesetenv)(&__fcsr);
+ return 0;
+}
+
+int WRAP(fetestexcept)(int __excepts) {
+ __excepts = mips_change_except(__excepts);
+ fexcept_t __FCSR;
+ WRAP(fegetenv)(&__FCSR);
+ return mips_get_except(__FCSR & __excepts & FE_ALL_EXCEPT);
+}
+
+int WRAP(fegetround)(void) {
+ fenv_t _fcsr;
+ WRAP(fegetenv)(&_fcsr);
+ return mips_get_rounding(_fcsr & _FCSR_RMASK);
+}
+
+int WRAP(fesetround)(int __round) {
+ __round = mips_change_rounding(__round);
+ fenv_t _fcsr;
+ WRAP(fegetenv)(&_fcsr);
+ _fcsr &= ~_FCSR_RMASK;
+ _fcsr |= (__round & _FCSR_RMASK );
+ WRAP(fesetenv)(&_fcsr);
+ return 0;
+}
+
+int WRAP(feholdexcept)(fenv_t* __envp) {
+ fenv_t __env;
+ WRAP(fegetenv)(&__env);
+ *__envp = __env;
+ __env &= ~(FE_ALL_EXCEPT | _FCSR_ENABLE_MASK);
+ WRAP(fesetenv)(&__env);
+ return 0;
+}
+
+int WRAP(feupdateenv)(const fenv_t* __envp) {
+ fexcept_t __fcsr;
+ WRAP(fegetenv)(&__fcsr);
+ WRAP(fesetenv)(__envp);
+ WRAP(feraiseexcept)(__fcsr & FE_ALL_EXCEPT);
+ return 0;
+}
+
diff --git a/ndk/sources/android/libportable/arch-mips/filefd.c b/ndk/sources/android/libportable/arch-mips/filefd.c
new file mode 100644
index 000000000..d80eb3dd2
--- /dev/null
+++ b/ndk/sources/android/libportable/arch-mips/filefd.c
@@ -0,0 +1,502 @@
+/*
+ * Copyright 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.
+ */
+
+#include <portability.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <errno_portable.h>
+#include <filefd_portable.h>
+#include <signal_portable.h>
+#include <sys/atomics.h>
+
+#define PORTABLE_TAG "filefd_portable"
+#include <log_portable.h>
+
+/*
+ * Maintaining a list of special file descriptors in lib-portable:
+ * ---------------------------------------------------------------
+ *
+ * These are file descriptors which were opened with system calls
+ * which make it possible to read kernel data structures via the
+ * read system call. See man pages for:
+ * signalfd(2)
+ * eventfd(2)
+ * timerfd_create(2)
+ *
+ * The files conditioned with signalfd(2) need to have their reads
+ * intercepted to correct signal numbers. This is done using this table
+ * of mapped files.
+ *
+ * The signalfd(2) semantics are maintained across execve(2) by exporting
+ * and importing environment variables for file descriptors that are not
+ * marked as close-on-execute. For example testing import code with:
+ * Eg:
+ * export ANDROID_PORTABLE_MAPPED_FILE_DESCRIPTORS=10,17
+ * export ANDROID_PORTABLE_MAPPED_FILE_TYPES=2,1
+ *
+ * Where
+ * filefd_mapped_file[10] = SIGNAL_FD_TYPE:2
+ * filefd_FD_CLOEXEC_file[10] = 0;
+ * and
+ * filefd_mapped_file[17] = EVENT_FD_TYPE:1
+ * filefd_FD_CLOEXEC_file[17] = 0;
+ *
+ * A table of CLOEXEC_files is maintained via call-backs
+ * in open_portable() and fcntl_portable() which indicates
+ * the files with close-on-execute semantics.
+ *
+ * The signalfd(2) fork(2) and thread semantics are not
+ * affected by the mapping of signalfd() file descriptor reads.
+ *
+ * This algorithm requires that threads have the same sharing
+ * attributes for file descriptors and memory and will be disabled
+ * by a call from clone() if the environment is unsuitable for it's use.
+ */
+
+static char *fd_env_name = "ANDROID_PORTABLE_MAPPED_FILE_DESCRIPTORS";
+static char *type_env_name = "ANDROID_PORTABLE_MAPPED_FILE_TYPES";
+static enum filefd_type filefd_mapped_file[__FD_SETSIZE];
+static int filefd_FD_CLOEXEC_file[__FD_SETSIZE];
+
+static volatile int filefd_mapped_files = 0;
+static volatile int filefd_enabled = 1;
+
+/*
+ * Assuming sizeof(int)==4, and __FD_SETSIZE < 10000 each token will
+ * occupy a maximum of 5 characters (4 digits + delimiter:','). The tokens
+ * are the numbers above, a file descriptor (0..9999), and the filefd_type's
+ * which are a single digit.
+ *
+ * The arrays used to manipulate the environment variables are allocated using
+ * malloc to avoid overrunning the stack.
+ */
+#if __FD_SETSIZE >= 10000
+#error MAX_ENV_SIZE must be increased
+#endif
+
+#define MAX_ENV_SIZE (__FD_SETSIZE * 5)
+
+static int export_fd_env()
+{
+ const int max_env_size = MAX_ENV_SIZE;
+ int type_env_bytes_remaining = max_env_size;
+ char *type_env_allocated = NULL, *type_env;
+ int fd_env_bytes_remaining = max_env_size;
+ char *fd_env_allocated = NULL, *fd_env;
+ int exported_file_descriptors = 0;
+ enum filefd_type fd_type;
+ int overwrite = 1;
+ int fd_count = 0;
+ int saved_errno;
+ int fd_cloexec;
+ int len;
+ int rv1;
+ int rv2;
+ int rv;
+ int fd;
+
+ ALOGV("%s:() {", __func__);
+
+ saved_errno = *REAL(__errno)();
+
+ type_env_allocated = malloc(max_env_size);
+ fd_env_allocated = malloc(max_env_size);
+ if (type_env_allocated == NULL || fd_env_allocated == NULL) {
+ ALOGE("%s: type_env_allocated:%p, fd_env_allocated:%p; FIXME!", __func__,
+ type_env_allocated, fd_env_allocated);
+
+ rv = -1;
+ goto done;
+ } else {
+ ALOGV("%s: type_env_allocated:%p, fd_env_allocated:%p;", __func__,
+ type_env_allocated, fd_env_allocated);
+ }
+
+ type_env = type_env_allocated;
+ fd_env = fd_env_allocated;
+
+ for (fd = 0; fd < __FD_SETSIZE; fd++) {
+ fd_type = filefd_mapped_file[fd];
+ if (fd_type != UNUSED_FD_TYPE) {
+ ++fd_count;
+ ALOGV("%s: fd_type = %d = filefd_mapped_file[fd:%d]; ++fdcount:%d;", __func__,
+ fd_type, fd, fd_count);
+
+ fd_cloexec = filefd_FD_CLOEXEC_file[fd];
+ ALOGV("%s: fd_cloexec = %d = filefd_FD_CLOEXEC_file[fd:%d];", __func__,
+ fd_cloexec, fd);
+
+ if (fd_cloexec == 0) {
+ rv = snprintf(fd_env, fd_env_bytes_remaining, "%d,", fd);
+ ASSERT(rv > 0);
+ fd_env += rv;
+ fd_env_bytes_remaining -= rv;
+ rv = snprintf(type_env, type_env_bytes_remaining, "%d,", filefd_mapped_file[fd]);
+ ASSERT(rv > 0);
+ type_env += rv;
+ type_env_bytes_remaining -= rv;
+ exported_file_descriptors++;
+ }
+
+ /*
+ * There is a chance of inconsistent results here if
+ * another thread is updating the array while it was
+ * being copied, but this code is only run during exec
+ * so the state of the file descriptors that the child
+ * sees will be inconsistent anyway.
+ */
+ if (fd_count == filefd_mapped_files)
+ break;
+ }
+ }
+ if (fd_count != filefd_mapped_files) {
+ ALOGE("%s: fd_count:%d != filefd_mapped_files:%d; [Likely Race; add futex?]", __func__,
+ fd_count, filefd_mapped_files);
+
+ }
+ if (exported_file_descriptors == 0) {
+ rv1 = unsetenv(fd_env_name);
+ rv2 = unsetenv(type_env_name);
+ if (rv1 != 0 || rv2 != 0) {
+ ALOGV("%s: Note: unsetenv() failed!", __func__);
+ }
+ rv = 0;
+ } else {
+ if (fd_env > fd_env_allocated) {
+ fd_env--; /* backup fd_env to last ',' */
+ }
+ *fd_env = '\0';
+
+ if (type_env > type_env_allocated) {
+ type_env--; /* backup type_env to last ',' */
+ }
+ *type_env = '\0';
+
+ rv = setenv(fd_env_name, fd_env_allocated, overwrite);
+ if (rv != 0) {
+ ALOGE("%s: rv:%d = setenv(fd_env_name:'%s', fd_env_allocated:'%s' ...);", __func__,
+ rv, fd_env_name, fd_env_allocated);
+ } else {
+ ALOGV("%s: rv:%d = setenv(fd_env_name:'%s', fd_env_allocated:'%s' ...);", __func__,
+ rv, fd_env_name, fd_env_allocated);
+ }
+ if (rv != 0) goto done;
+
+ rv = setenv(type_env_name, type_env_allocated, overwrite);
+
+ if (rv != 0) {
+ ALOGE("%s: rv:%d = setenv(type_env_name:'%s', type_env_allocated:'%s' ...);",
+ __func__, rv, type_env_name, type_env_allocated);
+ } else {
+ ALOGV("%s: rv:%d = setenv(type_env_name:'%s', type_env_allocated:'%s' ...);",
+ __func__, rv, type_env_name, type_env_allocated);
+ }
+ }
+
+done:
+ if (type_env_allocated)
+ free(type_env_allocated);
+
+ if (fd_env_allocated)
+ free(fd_env_allocated);
+
+ *REAL(__errno)() = saved_errno;
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+static int import_fd_env(int verify)
+{
+ char *type_env_allocated = NULL;
+ char *fd_env_allocated = NULL;
+ char *type_token_saved_ptr;
+ char *fd_token_saved_ptr;
+ enum filefd_type fd_type;
+ char *type_env, *fd_env;
+ int saved_errno;
+ char *type_token;
+ char *fd_token;
+ int rv = 0;
+ int fd;
+
+ ALOGV("%s:(verify:%d) {", __func__, verify);
+
+ saved_errno = *REAL(__errno)();
+
+ /*
+ * get file descriptor environment pointer and make a
+ * a copy of the string.
+ */
+ fd_env = getenv(fd_env_name);
+ if (fd_env == NULL) {
+ ALOGV("%s: fd_env = NULL = getenv('%s');", __func__,
+ fd_env_name);
+ goto done;
+ } else {
+ ALOGV("%s: fd_env = '%s' = getenv('%s');", __func__,
+ fd_env, fd_env_name);
+
+ fd_env_allocated = malloc(strlen(fd_env)+1);
+ if (fd_env_allocated == NULL) {
+ ALOGE("%s: fd_env_allocated = NULL; malloc failed", __func__);
+ goto done;
+ }
+ strcpy(fd_env_allocated, fd_env);
+ }
+
+ /*
+ * get file descriptor environment pointer and make a copy of
+ * the string to our stack.
+ */
+ type_env = getenv(type_env_name);
+ if (type_env == NULL) {
+ ALOGV("%s: type_env = NULL = getenv(type_env_name:'%s');", __func__,
+ type_env_name);
+ goto done;
+ } else {
+ ALOGV("%s: type_env = '%s' = getenv(type_env_name:'%s');", __func__,
+ type_env, type_env_name);
+
+ type_env_allocated = malloc(strlen(type_env)+1);
+ if (type_env_allocated == NULL) {
+ ALOGE("%s: type_env_allocated = NULL; malloc failed", __func__);
+ goto done;
+ }
+ strcpy(type_env_allocated, type_env);
+ }
+
+ /*
+ * Setup strtok_r(), use it to parse the env tokens, and
+ * initialise the filefd_mapped_file array.
+ */
+ fd_token = strtok_r(fd_env_allocated, ",", &fd_token_saved_ptr);
+ type_token = strtok_r(type_env_allocated, ",", &type_token_saved_ptr);
+ while (fd_token && type_token) {
+ fd = atoi(fd_token);
+ ASSERT(fd >= 0 );
+ ASSERT(fd < __FD_SETSIZE);
+
+ fd_type = (enum filefd_type) atoi(type_token);
+ ASSERT(fd_type > UNUSED_FD_TYPE);
+ ASSERT(fd_type < MAX_FD_TYPE);
+
+ if (fd >= 0 && fd < __FD_SETSIZE) {
+ if (fd_type > UNUSED_FD_TYPE && fd_type < MAX_FD_TYPE) {
+ if (verify) {
+ ASSERT(filefd_mapped_file[fd] == fd_type);
+ ALOGV("%s: filefd_mapped_file[fd:%d] == fd_type:%d;", __func__,
+ fd, fd_type);
+ } else {
+ ASSERT(filefd_mapped_file[fd] == UNUSED_FD_TYPE);
+
+ __atomic_inc(&filefd_mapped_files);
+ ALOGV("%s: ++filefd_mapped_files:%d;", __func__,
+ filefd_mapped_files);
+
+ filefd_mapped_file[fd] = fd_type;
+ ALOGV("%s: filefd_mapped_file[fd:%d] = fd_type:%d;", __func__,
+ fd, fd_type);
+ }
+ }
+ }
+
+ fd_token = strtok_r(NULL, ",", &fd_token_saved_ptr);
+ type_token = strtok_r(NULL, ",", &type_token_saved_ptr);
+ }
+
+done:
+ if (type_env_allocated)
+ free(type_env_allocated);
+ if (fd_env_allocated)
+ free(fd_env_allocated);
+
+ *REAL(__errno)() = saved_errno;
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+/*
+ * This function will get run by the linker when the library is loaded.
+ */
+static void __attribute__ ((constructor)) linker_import_fd_env(void)
+{
+ int rv;
+ int verify_consistancy = 0;
+
+ ALOGV(" ");
+ ALOGV("%s() {", __func__);
+
+ rv = import_fd_env(verify_consistancy); /* File type table not verified. */
+
+ ALOGV("%s: }", __func__);
+}
+
+
+__hidden void filefd_opened(int fd, enum filefd_type fd_type)
+{
+ ALOGV("%s(fd:%d) {", __func__, fd);
+
+ if (fd >= 0 && fd < __FD_SETSIZE) {
+ if (filefd_mapped_file[fd] == UNUSED_FD_TYPE) {
+ __atomic_inc(&filefd_mapped_files);
+ filefd_mapped_file[fd] = fd_type;
+ }
+ ASSERT(filefd_mapped_file[fd] == fd_type);
+ }
+
+ ALOGV("%s: }", __func__);
+}
+
+__hidden void filefd_closed(int fd)
+{
+ ALOGV("%s(fd:%d) {", __func__, fd);
+
+ if (fd >= 0 && fd < __FD_SETSIZE) {
+ if (filefd_mapped_file[fd] != UNUSED_FD_TYPE) {
+ filefd_mapped_file[fd] = UNUSED_FD_TYPE;
+ filefd_FD_CLOEXEC_file[fd] = 0;
+ __atomic_dec(&filefd_mapped_files);
+ }
+ }
+ ALOGV("%s: }", __func__);
+}
+
+
+__hidden void filefd_CLOEXEC_enabled(int fd)
+{
+ ALOGV("%s:(fd:%d) {", __func__, fd);
+
+ if (fd >= 0 && fd < __FD_SETSIZE) {
+ filefd_FD_CLOEXEC_file[fd] = 1;
+ }
+
+ ALOGV("%s: }", __func__);
+}
+
+__hidden void filefd_CLOEXEC_disabled(int fd)
+{
+ ALOGV("%s:(fd:%d) {", __func__, fd);
+
+ if (fd >= 0 && fd < __FD_SETSIZE) {
+ filefd_FD_CLOEXEC_file[fd] = 0;
+ }
+
+ ALOGV("%s: }", __func__);
+}
+
+
+__hidden void filefd_disable_mapping()
+{
+ ALOGV("%s:() {", __func__);
+
+ filefd_enabled = 0;
+
+ ALOGV("%s: }", __func__);
+}
+
+
+int WRAP(close)(int fd)
+{
+ int rv;
+
+ ALOGV(" ");
+ ALOGV("%s(fd:%d) {", __func__, fd);
+
+ rv = REAL(close)(fd);
+ filefd_closed(fd);
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+int WRAP(read)(int fd, void *buf, size_t count)
+{
+ int rv;
+ enum filefd_type fd_type;
+
+ ALOGV(" ");
+ ALOGV("%s(fd:%d, buf:0x%p, count:%d) {", __func__,
+ fd, buf, count);
+
+ fd_type = filefd_mapped_file[fd];
+ ALOGV("%s:fd_type:%d", __func__,
+ fd_type);
+
+ switch (fd_type) {
+ /* Reads on these descriptors are portable; no need to be mapped. */
+ case UNUSED_FD_TYPE:
+ case EVENT_FD_TYPE:
+ case INOTIFY_FD_TYPE:
+ case TIMER_FD_TYPE:
+ rv = REAL(read)(fd, buf, count);
+ break;
+
+ /* The read() of a signalfd() file descriptor needs to be mapped. */
+ case SIGNAL_FD_TYPE:
+ if (filefd_enabled) {
+ rv = read_signalfd_mapper(fd, buf, count);
+ } else {
+ rv = REAL(read)(fd, buf, count);
+ }
+ break;
+
+ default:
+ ALOGE("Unknown fd_type:%d!", fd_type);
+ rv = REAL(read)(fd, buf, count);
+ break;
+ }
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+/*
+ * Export PORTABLE environment variables before execve().
+ * Tries a second time if it detects an extremely unlikely
+ * race condition.
+ */
+int WRAP(execve)(const char *filename, char *const argv[], char *const envp[])
+{
+ int rv;
+ int mapped_files = filefd_mapped_files;
+ int verify_consistancy = 1;
+
+ ALOGV(" ");
+ ALOGV("%s(filename:%p, argv:%p, envp:%p) {", __func__,
+ filename, argv, envp);
+
+ export_fd_env();
+
+ if (mapped_files != filefd_mapped_files) {
+ export_fd_env();
+ }
+ import_fd_env(verify_consistancy); /* File type table consistancy verified. */
+
+ rv = REAL(execve)(filename, argv, envp);
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
diff --git a/ndk/sources/android/libportable/arch-mips/flags.c b/ndk/sources/android/libportable/arch-mips/flags.c
new file mode 100644
index 000000000..f18b8d952
--- /dev/null
+++ b/ndk/sources/android/libportable/arch-mips/flags.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright 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.
+ */
+
+#include <portability.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <fcntl_portable.h>
+
+#define PORTABLE_TAG "flags_portable"
+#include <log_portable.h>
+
+
+/* __sflags is an internal bionic routine but the symbol is exported and there are callers... */
+extern int __sflags(const char *, int *);
+
+int
+WRAP(__sflags)(const char *mode, int *optr)
+{
+ int rv;
+ int nflags, pflags;
+
+ ALOGV(" ");
+ ALOGV("%s(mode:%p, optr:%p) {", __func__, mode, optr);
+
+ rv = __sflags(mode, &nflags);
+
+ /* error - no change to *optr */
+ if (rv == 0)
+ goto done;
+
+ pflags = nflags & O_ACCMODE;
+ if (nflags & O_CREAT)
+ pflags |= O_CREAT_PORTABLE;
+ if (nflags & O_TRUNC)
+ pflags |= O_TRUNC_PORTABLE;
+ if (nflags & O_APPEND)
+ pflags |= O_APPEND_PORTABLE;
+
+ /* Set *optr to portable flags */
+ *optr = pflags;
+
+done:
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
diff --git a/ndk/sources/android/libportable/arch-mips/inotify.c b/ndk/sources/android/libportable/arch-mips/inotify.c
new file mode 100644
index 000000000..76b1cac4d
--- /dev/null
+++ b/ndk/sources/android/libportable/arch-mips/inotify.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright 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.
+ */
+
+#include <portability.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <asm/unistd.h>
+#include <asm/unistd-portable.h>
+
+#include <fcntl_portable.h>
+#include <inotify_portable.h>
+
+#include <filefd_portable.h>
+
+
+#define PORTABLE_TAG "inotify_portable"
+#include <log_portable.h>
+
+extern int syscall(int, ...);
+
+
+/*
+ * NOTE: LTP defaults to using O_CLOEXEC for IN_CLOEXEC,
+ * and 02000000 if O_CLOEXEC isn't defined.
+ */
+
+
+/*
+ * Portable to Native event flags mapper.
+ */
+static inline int in_flags_pton(int portable_flags)
+{
+ int native_flags = 0;
+
+ ALOGV("%s(portable_flags:0x%x) {", __func__, portable_flags);
+
+ if (portable_flags & IN_NONBLOCK_PORTABLE) {
+ native_flags |= IN_NONBLOCK;
+ }
+
+ if (portable_flags & IN_CLOEXEC_PORTABLE) {
+ native_flags |= IN_CLOEXEC;
+ }
+
+ ALOGV("%s: return(native_flags:%d); }", __func__, native_flags);
+ return native_flags;
+}
+
+
+int WRAP(inotify_init1)(int portable_flags) {
+ int rv;
+ int native_flags;
+
+ ALOGV(" ");
+ ALOGV("%s(portable_flags:%d) {", __func__,
+ portable_flags);
+
+ native_flags = in_flags_pton(portable_flags);
+
+ rv = syscall(__NR_inotify_init1, native_flags);
+ if (rv >= 0) {
+ if (native_flags & IN_CLOEXEC) {
+ filefd_CLOEXEC_enabled(rv);
+ }
+ filefd_opened(rv, INOTIFY_FD_TYPE);
+ }
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
diff --git a/ndk/sources/android/libportable/arch-mips/ioctl.c b/ndk/sources/android/libportable/arch-mips/ioctl.c
index cbd517f7a..7e82a6a52 100644
--- a/ndk/sources/android/libportable/arch-mips/ioctl.c
+++ b/ndk/sources/android/libportable/arch-mips/ioctl.c
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <portability.h>
#include <stdarg.h>
#include <sys/ioctl.h>
#include <ioctls_portable.h>
@@ -213,7 +214,7 @@ static inline int mips_change_request(int request)
}
extern int __ioctl(int, int, void *);
-int ioctl_portable(int fd, int request, ...)
+int WRAP(ioctl)(int fd, int request, ...)
{
va_list ap;
void * arg;
diff --git a/ndk/sources/android/libportable/arch-mips/jboffsets.h b/ndk/sources/android/libportable/arch-mips/jboffsets.h
new file mode 100644
index 000000000..b43d77ac3
--- /dev/null
+++ b/ndk/sources/android/libportable/arch-mips/jboffsets.h
@@ -0,0 +1,46 @@
+#ifndef _JBOFFSETS_H_
+#define _JBOFFSETS_H_
+
+/*
+ * Normally the same layout is used for saving the registers in jmp_buf
+ * as that used in struct sigcontext. For portability all of the registers need
+ * to be stored in the space available in a portable jmp_buf so this code
+ * packs the register together.
+ */
+
+#define JB_MASK (0*REGSZ)
+#define JB_PC (1*REGSZ)
+#define JB_MAGIC (2*REGSZ)
+#define JB_S0 (3*REGSZ)
+#define JB_S1 (4*REGSZ)
+#define JB_S2 (5*REGSZ)
+#define JB_S3 (6*REGSZ)
+#define JB_S4 (7*REGSZ)
+#define JB_S5 (8*REGSZ)
+#define JB_S6 (9*REGSZ)
+#define JB_S7 (10*REGSZ)
+#define JB_S8 (11*REGSZ)
+#define JB_GP (12*REGSZ)
+#define JB_SP (13*REGSZ)
+#define JB_SAVEMASK (14*REGSZ)
+#define JB_FPUSED (15*REGSZ)
+#define JB_FSR (16*REGSZ)
+#define JB_FPBASE (18*REGSZ)
+#define JB_F20 (JB_FPBASE+0*REGSZ_FP)
+#define JB_F21 (JB_FPBASE+1*REGSZ_FP)
+#define JB_F22 (JB_FPBASE+2*REGSZ_FP)
+#define JB_F23 (JB_FPBASE+3*REGSZ_FP)
+#define JB_F24 (JB_FPBASE+4*REGSZ_FP)
+#define JB_F25 (JB_FPBASE+5*REGSZ_FP)
+#define JB_F26 (JB_FPBASE+6*REGSZ_FP)
+#define JB_F27 (JB_FPBASE+7*REGSZ_FP)
+#define JB_F28 (JB_FPBASE+8*REGSZ_FP)
+#define JB_F29 (JB_FPBASE+9*REGSZ_FP)
+#define JB_F30 (JB_FPBASE+10*REGSZ_FP)
+#define JB_F31 (JB_FPBASE+11*REGSZ_FP)
+
+/* Use different magic numbers to avoid misuse of native vs portable contexts */
+#define MAGIC_SETJMP 0xACEDBEAD
+#define MAGIC__SETJMP 0xBEAD1CAB
+
+#endif /* _JBOFFSETS_H_ */
diff --git a/ndk/sources/android/libportable/arch-mips/mmap.c b/ndk/sources/android/libportable/arch-mips/mmap.c
index d165e2b3e..f2c3a1a8f 100644
--- a/ndk/sources/android/libportable/arch-mips/mmap.c
+++ b/ndk/sources/android/libportable/arch-mips/mmap.c
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <portability.h>
#include <unistd.h>
#include <errno.h>
#include <sys/mman.h>
@@ -23,71 +24,106 @@
#error Bad build environment
#endif
-static inline int mips_change_prot(int prot)
+#define PORTABLE_TAG "mmap_portable"
+#include <log_portable.h>
+
+static inline int mmap_prot_pton(int portable_prot)
{
+ int native_prot = portable_prot;
+
+ ALOGV("%s(portable_prot:0x%x) {", __func__, portable_prot);
+
/* Only PROT_SEM is different */
- if (prot & PROT_SEM_PORTABLE) {
- prot &= ~PROT_SEM_PORTABLE;
- prot |= PROT_SEM;
+ if (portable_prot & PROT_SEM_PORTABLE) {
+ native_prot &= ~PROT_SEM_PORTABLE;
+ native_prot |= PROT_SEM;
}
- return prot;
+ ALOGV("%s: return(native_prot:0x%x); }", __func__, native_prot);
+ return native_prot;
}
-static inline int mips_change_flags(int flags)
+
+static inline int mmap_flags_pton(int portable_flags)
{
- int mipsflags = 0;
- if (flags & MAP_SHARED_PORTABLE)
- mipsflags |= MAP_SHARED;
- if (flags & MAP_PRIVATE_PORTABLE)
- mipsflags |= MAP_PRIVATE;
- if (flags & MAP_FIXED_PORTABLE)
- mipsflags |= MAP_FIXED;
- if (flags & MAP_ANONYMOUS_PORTABLE)
- mipsflags |= MAP_ANONYMOUS;
- if (flags & MAP_GROWSDOWN_PORTABLE)
- mipsflags |= MAP_GROWSDOWN;
- if (flags & MAP_DENYWRITE_PORTABLE)
- mipsflags |= MAP_DENYWRITE;
- if (flags & MAP_EXECUTABLE_PORTABLE)
- mipsflags |= MAP_EXECUTABLE;
- if (flags & MAP_LOCKED_PORTABLE)
- mipsflags |= MAP_LOCKED;
- if (flags & MAP_NORESERVE_PORTABLE)
- mipsflags |= MAP_NORESERVE;
- if (flags & MAP_POPULATE_PORTABLE)
- mipsflags |= MAP_POPULATE;
- if (flags & MAP_NONBLOCK_PORTABLE)
- mipsflags |= MAP_NONBLOCK;
-
- return mipsflags;
+ int native_flags = 0;
+
+ ALOGV("%s(portable_flags:0x%x) {", __func__, portable_flags);
+
+ if (portable_flags & MAP_SHARED_PORTABLE) {
+ native_flags |= MAP_SHARED;
+ }
+ if (portable_flags & MAP_PRIVATE_PORTABLE) {
+ native_flags |= MAP_PRIVATE;
+ }
+ if (portable_flags & MAP_FIXED_PORTABLE) {
+ native_flags |= MAP_FIXED;
+ }
+ if (portable_flags & MAP_ANONYMOUS_PORTABLE) {
+ native_flags |= MAP_ANONYMOUS;
+ }
+ if (portable_flags & MAP_GROWSDOWN_PORTABLE) {
+ native_flags |= MAP_GROWSDOWN;
+ }
+ if (portable_flags & MAP_DENYWRITE_PORTABLE) {
+ native_flags |= MAP_DENYWRITE;
+ }
+ if (portable_flags & MAP_EXECUTABLE_PORTABLE) {
+ native_flags |= MAP_EXECUTABLE;
+ }
+ if (portable_flags & MAP_LOCKED_PORTABLE) {
+ native_flags |= MAP_LOCKED;
+ }
+ if (portable_flags & MAP_NORESERVE_PORTABLE) {
+ native_flags |= MAP_NORESERVE;
+ }
+ if (portable_flags & MAP_POPULATE_PORTABLE) {
+ native_flags |= MAP_POPULATE;
+ }
+ if (portable_flags & MAP_NONBLOCK_PORTABLE) {
+ native_flags |= MAP_NONBLOCK;
+ }
+
+ ALOGV("%s: return(native_flags:0x%x); }", __func__, native_flags);
+ return native_flags;
}
-#define MMAP2_SHIFT 12
-extern void *__mmap2(void *, size_t, int, int, int, size_t);
-void *mmap_portable(void *addr, size_t size, int prot, int flags, int fd, long offset)
+extern void* REAL(mmap)(void *, size_t, int, int, int, off_t);
+void *WRAP(mmap)(void *addr, size_t size, int prot, int flags, int fd, long byte_offset)
{
- void *ret;
- int mips_prot, mips_flags;
+ int native_prot, native_flags;
+ int saved_errno;
+ void *ret_addr;
- if (offset & ((1UL << MMAP2_SHIFT)-1)) {
- errno = EINVAL;
- return MAP_FAILED;
- }
+ ALOGV(" ");
+ ALOGV("%s(addr:%p, size:%d, prot:0x%x, flags:0x%x, fd:%d, byte_offset:0x%lx) {", __func__,
+ addr, size, prot, flags, fd, byte_offset);
- mips_prot = mips_change_prot(prot);
- mips_flags = mips_change_flags(flags);
- ret = __mmap2(addr, size, mips_prot, mips_flags, fd,
- (size_t)offset >> MMAP2_SHIFT);
+ native_prot = mmap_prot_pton(prot);
+ native_flags = mmap_flags_pton(flags);
- if (ret && (mips_flags & (MAP_PRIVATE | MAP_ANONYMOUS)))
- madvise(ret, size, MADV_MERGEABLE);
+ ret_addr = REAL(mmap)(addr, size, native_prot, native_flags, fd, byte_offset);
- return ret;
+ ALOGV("%s: return(ret_addr:%p); }", __func__, ret_addr);
+ return ret_addr;
}
-extern int mprotect(const void *, size_t, int);
-int mprotect_portable(const void *addr, size_t size, int prot)
+
+extern int mprotect(const void *, size_t, int);
+
+int WRAP(mprotect)(const void *addr, size_t size, int portable_prot)
{
- return mprotect(addr, size, mips_change_prot(prot));
+ int rv;
+ int native_prot;
+
+ ALOGV(" ");
+ ALOGV("%s(addr:%p, size:%d, portable_prot:0x%x); {", __func__,
+ addr, size, portable_prot);
+
+ native_prot = mmap_prot_pton(portable_prot);
+
+ rv = REAL(mprotect)(addr, size, native_prot);
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
}
diff --git a/ndk/sources/android/libportable/arch-mips/open.c b/ndk/sources/android/libportable/arch-mips/open.c
index 2f4dcd7de..99ed7f9a4 100644
--- a/ndk/sources/android/libportable/arch-mips/open.c
+++ b/ndk/sources/android/libportable/arch-mips/open.c
@@ -14,59 +14,78 @@
* limitations under the License.
*/
+#include <portability.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdarg.h>
+#include <portability.h>
#include <fcntl_portable.h>
+#include <filefd_portable.h>
+
+#define PORTABLE_TAG "open_portable"
+#include <log_portable.h>
#if O_CREAT_PORTABLE==O_CREAT
#error Bad build environment
#endif
-static inline int mips_change_flags(int flags)
+
+static inline int open_flags_pton(int flags)
{
int mipsflags = flags & O_ACCMODE_PORTABLE;
+
+ ALOGV("%s(flags:0x%x) {", __func__, flags);
+
if (flags & O_CREAT_PORTABLE)
- mipsflags |= O_CREAT;
+ mipsflags |= O_CREAT;
if (flags & O_EXCL_PORTABLE)
- mipsflags |= O_EXCL;
+ mipsflags |= O_EXCL;
if (flags & O_NOCTTY_PORTABLE)
- mipsflags |= O_NOCTTY;
+ mipsflags |= O_NOCTTY;
if (flags & O_TRUNC_PORTABLE)
- mipsflags |= O_TRUNC;
+ mipsflags |= O_TRUNC;
if (flags & O_APPEND_PORTABLE)
- mipsflags |= O_APPEND;
+ mipsflags |= O_APPEND;
if (flags & O_NONBLOCK_PORTABLE)
- mipsflags |= O_NONBLOCK;
+ mipsflags |= O_NONBLOCK;
if (flags & O_SYNC_PORTABLE)
- mipsflags |= O_SYNC;
+ mipsflags |= O_SYNC;
if (flags & FASYNC_PORTABLE)
- mipsflags |= FASYNC;
+ mipsflags |= FASYNC;
if (flags & O_DIRECT_PORTABLE)
- mipsflags |= O_DIRECT;
+ mipsflags |= O_DIRECT;
if (flags & O_LARGEFILE_PORTABLE)
- mipsflags |= O_LARGEFILE;
+ mipsflags |= O_LARGEFILE;
if (flags & O_DIRECTORY_PORTABLE)
- mipsflags |= O_DIRECTORY;
+ mipsflags |= O_DIRECTORY;
if (flags & O_NOFOLLOW_PORTABLE)
- mipsflags |= O_NOFOLLOW;
+ mipsflags |= O_NOFOLLOW;
if (flags & O_NOATIME_PORTABLE)
- mipsflags |= O_NOATIME;
+ mipsflags |= O_NOATIME;
if (flags & O_NDELAY_PORTABLE)
- mipsflags |= O_NDELAY;
+ mipsflags |= O_NDELAY;
+ ALOGV("%s: return(mipsflags:0x%x); }", __func__, mipsflags);
return mipsflags;
}
+
extern int __open(const char*, int, int);
-int open_portable(const char *pathname, int flags, ...)
+
+int WRAP(open)(const char *pathname, int flags, ...)
{
mode_t mode = 0;
+ int native_flags;
+ int fd;
+
+ ALOGV(" ");
+ ALOGV("%s(pathname:%p, flags:0x%x, ...) {", __func__,
+ pathname, flags);
+
flags |= O_LARGEFILE_PORTABLE;
- if (flags & O_CREAT_PORTABLE)
- {
+ if (flags & O_CREAT_PORTABLE) {
va_list args;
va_start(args, flags);
@@ -74,18 +93,40 @@ int open_portable(const char *pathname, int flags, ...)
va_end(args);
}
- return __open(pathname, mips_change_flags(flags), mode);
+ native_flags = open_flags_pton(flags);
+
+ fd = __open(pathname, native_flags, mode);
+ if (fd == -1) {
+ /* Can't print pathname as a string, might be bogus */
+ ALOGV("%s: fd = %d = __open(pathname:%p, native_flags:0x%x, mode:0x%x);", __func__,
+ fd, pathname, native_flags, mode);
+ } else {
+ if (flags & O_CLOEXEC) {
+ filefd_CLOEXEC_enabled(fd);
+ } else {
+ filefd_CLOEXEC_disabled(fd);
+ }
+ }
+ ALOGV("%s: return(fd:%d); }", __func__, fd);
+ return fd;
}
+
extern int __openat(int, const char*, int, int);
-int openat_portable(int fd, const char *pathname, int flags, ...)
+
+int WRAP(openat)(int dirfd, const char *pathname, int flags, ...)
{
mode_t mode = 0;
+ int native_flags;
+ int fd;
+
+ ALOGV(" ");
+ ALOGV("%s(dirfd:%d, pathname:0x%p, flags:0x%x, ...) {", __func__,
+ dirfd, pathname, flags);
flags |= O_LARGEFILE_PORTABLE;
- if (flags & O_CREAT_PORTABLE)
- {
+ if (flags & O_CREAT_PORTABLE) {
va_list args;
va_start(args, flags);
@@ -93,5 +134,20 @@ int openat_portable(int fd, const char *pathname, int flags, ...)
va_end(args);
}
- return __openat(fd, pathname, mips_change_flags(flags), mode);
+ native_flags = open_flags_pton(flags);
+
+ fd = __openat(dirfd, pathname, native_flags, mode);
+
+ if (fd == -1) {
+ ALOGV("%s: fd = %d = __open(pathname:0x%p, native_flags:0x%x, mode:0x%d);", __func__,
+ fd, pathname, native_flags, mode);
+ } else {
+ if (flags & O_CLOEXEC) {
+ filefd_CLOEXEC_enabled(fd);
+ } else {
+ filefd_CLOEXEC_disabled(fd);
+ }
+ }
+ ALOGV("%s: return(fd:%d); }", __func__, fd);
+ return fd;
}
diff --git a/ndk/sources/android/libportable/arch-mips/pipe.c b/ndk/sources/android/libportable/arch-mips/pipe.c
new file mode 100644
index 000000000..fa8026676
--- /dev/null
+++ b/ndk/sources/android/libportable/arch-mips/pipe.c
@@ -0,0 +1,87 @@
+/*
+ * Copyright 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.
+ */
+
+#define _GNU_SOURCE /* GLibc compatibility to declare pipe2(2) */
+#include <portability.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <portability.h>
+#include <asm/unistd.h>
+#include <asm/unistd-portable.h>
+
+#include <fcntl_portable.h>
+#include <asm/unistd-portable.h>
+#include <asm/unistd.h>
+#include <filefd_portable.h>
+
+
+#define PORTABLE_TAG "pipe_portable"
+#include <log_portable.h>
+
+extern int syscall(int, ...);
+
+
+/* NOTE: LTP defaults to using O_NONBLOCK even if O_NONBLOCK is defined */
+
+
+/*
+ * Portable to Native event flags mapper.
+ */
+static inline int tdf_flags_pton(int portable_flags)
+{
+ int native_flags = 0;
+
+ ALOGV("%s(portable_flags:0x%x) {", __func__, portable_flags);
+
+ if (portable_flags & O_NONBLOCK_PORTABLE) {
+ native_flags |= O_NONBLOCK;
+ }
+
+ if (portable_flags & O_CLOEXEC_PORTABLE) {
+ native_flags |= O_CLOEXEC;
+ }
+
+ ALOGV("%s: return(native_flags:%d); }", __func__, native_flags);
+ return native_flags;
+}
+
+
+int WRAP(pipe2)(int pipefd[2], int portable_flags) {
+ int native_flags;
+ int rv;
+
+ ALOGV(" ");
+ ALOGV("%s(pipefd[2]:%p, portable_flags:0x%x) {", __func__,
+ pipefd, portable_flags);
+
+ native_flags = tdf_flags_pton(portable_flags);
+
+ rv = REAL(pipe2)(pipefd, native_flags);
+ if (rv >= 0) {
+ ALOGV("%s: pipe2() returned pipefd[0]:%d, pipefd[1]:%d", __func__,
+ pipefd[0], pipefd[1]);
+
+ if (native_flags & O_CLOEXEC) {
+ filefd_CLOEXEC_enabled(pipefd[0]);
+ filefd_CLOEXEC_enabled(pipefd[1]);
+ }
+ }
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
diff --git a/ndk/sources/android/libportable/arch-mips/poll.c b/ndk/sources/android/libportable/arch-mips/poll.c
index 955c094ad..3f971760e 100644
--- a/ndk/sources/android/libportable/arch-mips/poll.c
+++ b/ndk/sources/android/libportable/arch-mips/poll.c
@@ -14,9 +14,63 @@
* limitations under the License.
*/
+#include <portability.h>
#include <poll.h>
#include <poll_portable.h>
+/*
+ *_XOPEN_SOURCE added the ability to not only poll for data coming in or out
+ * but now also the ability to poll for high priority input and output. Though
+ * the normal priority is equivalent to the original I/O it was assigned new bits:
+ * POLLIN Equivalent to POLLRDNORM
+ * POLLOUT Equivalent to POLLWRNORM
+ *
+ * The Linux kernel sets both POLLIN and POLLRDNORM when data is available and sets
+ * both POLLOUT and POLLWRNORM when data can be written; so the new priority BAND bits
+ * just supplement the meaning of the prior POLLIN and POLLOUT bits as well as the
+ * new POLLRDNORM and POLLWRNORM bits.
+ *
+ * The DECNet Protocol can set the poll in priority flag, POLLRDBAND.
+ * ATM as well as a whole bunch of other protocols can set the poll out priority flag,
+ * POLLWRBAND.
+ *
+ * MIPS and SPARC likely assigned the new XOPEN poll out event flags in UNIX well before
+ * UNIX was ported to X86. It appears that Intel chose different bits and that was
+ * established by Linus as the the generic case and later also chosen by ARM.
+ *
+ * POLLWRNORM:0x100 - MIPS used POLLOUT:0x0004, which is equivalent in meaning.
+ *
+ * POLLWRBAND:0x200 - MIPS used 0x0100. which is POLLWRNORM:0x100.
+ *
+ * Summary:
+ * ========
+ * Both Normal and Priority flags can be mapped to MIPS flags (left to right below).
+ * Only the Priority poll out flag can be mapped back to portable because MIPS
+ * is using the same number as POLLOUT for POLLWRNORM (right to left below).
+ *
+ * ARM/GENERIC/PORTABLE MIPS
+ * ==================== ======
+ * POLLIN 0x0001 0x0001
+ * POLLPRI 0x0002 0x0002
+ * POLLOUT 0x0004 <-----+ 0x0004
+ * POLLERR 0x0008 \ 0x0008
+ * POLLHUP 0x0010 \ 0x0010
+ * POLLNVAL 0x0020 \ 0x0020
+ * POLLRDNORM 0x0040 \ 0x0040
+ * POLLRDBAND 0x0080 \ 0x0080
+ * POLLWRNORM 0x0100 -----------+<----> 0x0004
+ * POLLWRBAND 0x0200 <-----------------> 0x0100
+ * POLLMSG 0x0400 0x0400
+ * POLLREMOVE 0x1000 0x1000
+ * POLLRDHUP 0x2000 0x2000
+ *
+ * The loss of the high priority notice for the polling
+ * of output data is likely minor as it was only being used
+ * in DECNet. Also, the poll system call and device poll
+ * implementations processes POLLOUT and POLLWRNORM event
+ * flags the same.
+ */
+
#if POLLWRNORM_PORTABLE==POLLWRNORM
#error Bad build environment
#endif
@@ -38,7 +92,10 @@ static inline short mips_change_portable_events(short portable_events)
static inline short change_mips_events(short mips_events)
{
- /* MIPS POLLWRNORM equals POLLOUT that is the same as POLLOUT_PORTABLE, so we just update POLLWRBNAD_PORTABLE. */
+ /*
+ * MIPS POLLWRNORM equals MIPS POLLOUT, which is the same as POLLOUT_PORTABLE;
+ * so we just map POLLWRBAND to POLLWRBAND_PORTABLE.
+ */
if (mips_events & POLLWRBAND) {
mips_events &= ~POLLWRBAND;
mips_events |= POLLWRBAND_PORTABLE;
@@ -49,7 +106,7 @@ static inline short change_mips_events(short mips_events)
extern int poll(struct pollfd *, nfds_t, long);
-int poll_portable(struct pollfd *fds, nfds_t nfds, long timeout)
+int WRAP(poll)(struct pollfd *fds, nfds_t nfds, long timeout)
{
nfds_t i;
int ret;
@@ -57,7 +114,7 @@ int poll_portable(struct pollfd *fds, nfds_t nfds, long timeout)
for (i = 0; i < nfds; i++)
fds->events = mips_change_portable_events(fds->events);
- ret = poll(fds, nfds, timeout);
+ ret = REAL(poll)(fds, nfds, timeout);
for (i = 0; i < nfds; i++) {
fds->events = change_mips_events(fds->events);
diff --git a/ndk/sources/android/libportable/arch-mips/pthread.c b/ndk/sources/android/libportable/arch-mips/pthread.c
new file mode 100644
index 000000000..41d94786e
--- /dev/null
+++ b/ndk/sources/android/libportable/arch-mips/pthread.c
@@ -0,0 +1,314 @@
+/*
+ * Copyright 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.
+ */
+
+#include <portability.h>
+#include <pthread.h>
+#include <time.h>
+#include <signal.h>
+#include <signal_portable.h>
+#include <errno.h>
+#include <errno_portable.h>
+
+#define PORTABLE_TAG "pthread_portable"
+#include <log_portable.h>
+
+/*
+ * Macros for STRIP_PARENS() which is used below in PTHREAD_WRAPPER(); cpp magic from:
+ * http://boost.2283326.n4.nabble.com/preprocessor-removing-parentheses-td2591973.html
+ */
+#define CAT(x, y) CAT_I(x, y)
+#define CAT_I(x, y) x ## y
+
+#define APPLY(macro, args) APPLY_I(macro, args)
+#define APPLY_I(macro, args) macro args
+
+#define STRIP_PARENS(x) EVAL((STRIP_PARENS_I x), x)
+#define STRIP_PARENS_I(...) 1,1
+
+#define EVAL(test, x) EVAL_I(test, x)
+#define EVAL_I(test, x) MAYBE_STRIP_PARENS(TEST_ARITY test, x)
+
+#define TEST_ARITY(...) APPLY(TEST_ARITY_I, (__VA_ARGS__, 2, 1))
+#define TEST_ARITY_I(a,b,c,...) c
+
+#define MAYBE_STRIP_PARENS(cond, x) MAYBE_STRIP_PARENS_I(cond, x)
+#define MAYBE_STRIP_PARENS_I(cond, x) CAT(MAYBE_STRIP_PARENS_, cond)(x)
+
+#define MAYBE_STRIP_PARENS_1(x) x
+#define MAYBE_STRIP_PARENS_2(x) APPLY(MAYBE_STRIP_PARENS_2_I, x)
+#define MAYBE_STRIP_PARENS_2_I(...) __VA_ARGS__
+
+/*
+ * Call pthread function and convert return value (a native errno) to portable error number.
+ */
+#define PTHREAD_WRAPPER(fn, DECLARGS, CALLARGS, fmt) \
+ int WRAP(fn) DECLARGS \
+ { \
+ int rv, portable_rv; \
+ \
+ ALOGV(" "); \
+ ALOGV("%s" fmt, __func__, STRIP_PARENS(CALLARGS)); \
+ rv = REAL(fn) CALLARGS; \
+ portable_rv = errno_ntop(rv); \
+ ALOGV("%s: return(portable_rv:%d); rv:%d;", __func__, \
+ portable_rv, rv); \
+ return portable_rv; \
+ }
+
+PTHREAD_WRAPPER(pthread_attr_init, (pthread_attr_t *attr), (attr), "(attr:%p)");
+
+PTHREAD_WRAPPER(pthread_attr_destroy, (pthread_attr_t *attr), (attr), "(attr:%p)");
+
+PTHREAD_WRAPPER(pthread_attr_setdetachstate, (pthread_attr_t *attr, int state), (attr, state),
+ "(attr:%p, state:%d)");
+
+PTHREAD_WRAPPER(pthread_attr_getdetachstate, (pthread_attr_t const *attr, int *state),
+ (attr, state), "(attr:%p, state:%p)");
+
+PTHREAD_WRAPPER(pthread_attr_setschedpolicy, (pthread_attr_t *attr, int policy), (attr, policy),
+ "(attr:%p, policy:%d)");
+
+PTHREAD_WRAPPER(pthread_attr_getschedpolicy, (pthread_attr_t const *attr, int *policy),
+ (attr, policy), "(attr:%p, policy:%p)");
+
+PTHREAD_WRAPPER(pthread_attr_setschedparam,
+ (pthread_attr_t *attr, struct sched_param const *param), (attr, param),
+ "(attr:%p, param:%p)");
+
+PTHREAD_WRAPPER(pthread_attr_getschedparam,
+ (pthread_attr_t const *attr, struct sched_param *param), (attr, param),
+ "(attr:%p, param:%p)");
+
+PTHREAD_WRAPPER(pthread_attr_setstacksize, (pthread_attr_t *attr, size_t stack_size),
+ (attr, stack_size), "(attr:%p, stack_size:%d)");
+
+PTHREAD_WRAPPER(pthread_attr_getstacksize, (pthread_attr_t const *attr, size_t *stack_size),
+ (attr, stack_size), "(attr:%p, stack_size:%p)");
+
+PTHREAD_WRAPPER(pthread_attr_setstack, (pthread_attr_t *attr, void *stackaddr, size_t stack_size),
+ (attr, stackaddr, stack_size), "(attr:%p, stackaddr:%p, stack_size:%d)");
+
+PTHREAD_WRAPPER(pthread_attr_getstack, (pthread_attr_t const *attr, void **stackaddr,
+ size_t *stack_size), (attr, stackaddr, stack_size),
+ "(attr:%p, stackaddr:%p stack_size:%p)");
+
+PTHREAD_WRAPPER(pthread_attr_setguardsize, (pthread_attr_t *attr, size_t guard_size),
+ (attr, guard_size), "(attr:%p, guard_size:%d)");
+
+PTHREAD_WRAPPER(pthread_attr_getguardsize, (pthread_attr_t const *attr, size_t *guard_size),
+ (attr, guard_size), "(attr:%p, guard_size:%p)");
+
+PTHREAD_WRAPPER(pthread_attr_setscope, (pthread_attr_t *attr, int scope), (attr, scope),
+ "(attr:%p, scope:%d)");
+
+PTHREAD_WRAPPER(pthread_attr_getscope, (pthread_attr_t const *attr), (attr), "(attr:%p)");
+
+PTHREAD_WRAPPER(pthread_getattr_np, (pthread_t thid, pthread_attr_t *attr), (thid, attr),
+ "(thid:%lx, attr:%p)");
+
+PTHREAD_WRAPPER(pthread_create, (pthread_t *thread, const pthread_attr_t *attr,
+ void *(*start_routine) (void *), void *arg),
+ (thread, attr, start_routine, arg),
+ "(thread:%p attr:%p, start_routine:%p, arg:%p)");
+
+// void pthread_exit(void * retval);
+PTHREAD_WRAPPER(pthread_join, (pthread_t thid, void **ret_val), (thid, ret_val),
+ "(thid:%lx, ret_val:%p)");
+
+PTHREAD_WRAPPER(pthread_detach, (pthread_t thid), (thid), "(thid:%lx)");
+
+// pthread_t pthread_self(void);
+// int pthread_equal(pthread_t one, pthread_t two);
+
+PTHREAD_WRAPPER(pthread_getschedparam, (pthread_t thid, int *policy, struct sched_param *param),
+ (thid, policy, param), "(thid:%lx, policy:%p, param:%p)");
+
+PTHREAD_WRAPPER(pthread_setschedparam, (pthread_t thid, int policy,
+ struct sched_param const *param), (thid, policy, param),
+ "(thid:%lx, policy:%d, param:%p)");
+
+PTHREAD_WRAPPER(pthread_mutexattr_init, (pthread_mutexattr_t *attr), (attr), "(attr:%p)");
+
+PTHREAD_WRAPPER(pthread_mutexattr_destroy, (pthread_mutexattr_t *attr), (attr), "(attr:%p)");
+
+PTHREAD_WRAPPER(pthread_mutexattr_gettype, (const pthread_mutexattr_t *attr, int *type),
+ (attr, type), "(attr:%p, type:%p)");
+
+PTHREAD_WRAPPER(pthread_mutexattr_settype, (pthread_mutexattr_t *attr, int type), (attr, type),
+ "(attr:%p, type:%d)");
+
+PTHREAD_WRAPPER(pthread_mutexattr_setpshared, (pthread_mutexattr_t *attr, int pshared),
+ (attr, pshared), "(attr:%p, pshared:%d)");
+
+PTHREAD_WRAPPER(pthread_mutexattr_getpshared, (pthread_mutexattr_t *attr, int *pshared),
+ (attr, pshared), "(attr:%p, pshared:%p)");
+
+PTHREAD_WRAPPER(pthread_mutex_init, (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr),
+ (mutex, attr), "(mutex:%p, attr:%p)");
+
+PTHREAD_WRAPPER(pthread_mutex_destroy, (pthread_mutex_t *mutex), (mutex), "(mutex:%p)");
+
+PTHREAD_WRAPPER(pthread_mutex_lock, (pthread_mutex_t *mutex), (mutex), "(mutex:%p)");
+
+PTHREAD_WRAPPER(pthread_mutex_unlock, (pthread_mutex_t *mutex), (mutex), "(mutex:%p)");
+
+PTHREAD_WRAPPER(pthread_mutex_trylock, (pthread_mutex_t *mutex), (mutex), "(mutex:%p)");
+
+#if 0 /* MISSING FROM BIONIC */
+PTHREAD_WRAPPER(pthread_mutex_timedlock, (pthread_mutex_t *mutex, struct timespec *ts),
+ (mutex, ts), "(mutex:%p, ts:%p)");
+#endif /* MISSING */
+
+PTHREAD_WRAPPER(pthread_condattr_init, (pthread_condattr_t *attr), (attr), "(attr:%p)");
+
+PTHREAD_WRAPPER(pthread_condattr_getpshared, (pthread_condattr_t *attr, int *pshared),
+ (attr, pshared), "(attr:%p, pshared:%p)");
+
+PTHREAD_WRAPPER(pthread_condattr_setpshared, (pthread_condattr_t* attr, int pshared),
+ (attr, pshared), "(attr:%p, pshared:%d)");
+
+PTHREAD_WRAPPER(pthread_condattr_destroy, (pthread_condattr_t *attr), (attr), "(attr:%p)");
+
+PTHREAD_WRAPPER(pthread_cond_init, (pthread_cond_t *cond, const pthread_condattr_t *attr),
+ (cond, attr), "(cond:%p, attr:%p)");
+
+PTHREAD_WRAPPER(pthread_cond_destroy, (pthread_cond_t *cond), (cond), "(cond:%p)");
+
+PTHREAD_WRAPPER(pthread_cond_broadcast, (pthread_cond_t *cond), (cond), "(cond:%p)");
+
+PTHREAD_WRAPPER(pthread_cond_signal, (pthread_cond_t *cond), (cond), "(cond:%p)");
+
+PTHREAD_WRAPPER(pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t *mutex),
+ (cond, mutex), "(cond:%p, mutex:%p)");
+
+PTHREAD_WRAPPER(pthread_cond_timedwait, (pthread_cond_t *cond, pthread_mutex_t *mutex,
+ const struct timespec *abstime), (cond, mutex, abstime),
+ "(cond:%p, mutex:%p, abstime:%p)");
+
+PTHREAD_WRAPPER(pthread_cond_timedwait_monotonic_np, (pthread_cond_t *cond,
+ pthread_mutex_t *mutex, const struct timespec *abstime),
+ (cond, mutex, abstime), "(cond:%p, mutex:%p, abstime:%p)");
+
+PTHREAD_WRAPPER(pthread_cond_timedwait_monotonic, (pthread_cond_t *cond, pthread_mutex_t
+ *mutex, const struct timespec *abstime),
+ (cond, mutex, abstime), "(cond:%p, mutex:%p, abstime:%p)");
+
+PTHREAD_WRAPPER(pthread_cond_timedwait_relative_np, (pthread_cond_t *cond, pthread_mutex_t *mutex,
+ const struct timespec *reltime), (cond, mutex, reltime),
+ "(cond:%p, mutex:%p, reltime:%p)");
+
+PTHREAD_WRAPPER(pthread_cond_timeout_np, (pthread_cond_t *cond, pthread_mutex_t *mutex,
+ unsigned msecs), (cond, mutex, msecs), "(cond:%p, mutex:%p, msecs:%u)");
+
+PTHREAD_WRAPPER(pthread_mutex_lock_timeout_np, (pthread_mutex_t *mutex, unsigned msecs),
+ (mutex, msecs), "(mutex:%p, msecs:%u)");
+
+PTHREAD_WRAPPER(pthread_rwlockattr_init, (pthread_rwlockattr_t *attr), (attr), "(attr:%p)");
+
+PTHREAD_WRAPPER(pthread_rwlockattr_destroy, (pthread_rwlockattr_t *attr), (attr), "(attr:%p)");
+
+PTHREAD_WRAPPER(pthread_rwlockattr_setpshared, (pthread_rwlockattr_t *attr, int pshared),
+ (attr, pshared), "(attr:%p, pshared:%d)");
+
+PTHREAD_WRAPPER(pthread_rwlockattr_getpshared, (pthread_rwlockattr_t *attr, int *pshared),
+ (attr, pshared), "(attr:%p, pshared:%p)");
+
+PTHREAD_WRAPPER(pthread_rwlock_init, (pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr),
+ (rwlock, attr), "(rwlock:%p, attr:%p)");
+
+PTHREAD_WRAPPER(pthread_rwlock_destroy, (pthread_rwlock_t *rwlock), (rwlock), "(rwlock:%p)");
+
+PTHREAD_WRAPPER(pthread_rwlock_rdlock, (pthread_rwlock_t *rwlock), (rwlock), "(rwlock:%p)");
+
+PTHREAD_WRAPPER(pthread_rwlock_tryrdlock, (pthread_rwlock_t *rwlock), (rwlock), "(rwlock:%p)");
+
+PTHREAD_WRAPPER(pthread_rwlock_timedrdlock, (pthread_rwlock_t *rwlock,
+ const struct timespec *abs_timeout),
+ (rwlock, abs_timeout), "(rwlock:%p, abs_timeout:%p)");
+
+PTHREAD_WRAPPER(pthread_rwlock_wrlock, (pthread_rwlock_t *rwlock), (rwlock), "(rwlock:%p)");
+
+PTHREAD_WRAPPER(pthread_rwlock_trywrlock, (pthread_rwlock_t *rwlock), (rwlock), "(rwlock:%p)");
+
+PTHREAD_WRAPPER(pthread_rwlock_timedwrlock, (pthread_rwlock_t *rwlock,
+ const struct timespec *abs_timeout), (rwlock, abs_timeout),
+ "(rwlock:%p, abs_timeout:%p)");
+
+PTHREAD_WRAPPER(pthread_rwlock_unlock, (pthread_rwlock_t *rwlock), (rwlock), "(rwlock:%p)");
+
+PTHREAD_WRAPPER(pthread_key_create, (pthread_key_t *key, void (*destructor_function)(void *)),
+ (key, destructor_function), "(key:%p, destructor_function:%p)");
+
+PTHREAD_WRAPPER(pthread_key_delete , (pthread_key_t key), (key), "(key:%x)");
+
+PTHREAD_WRAPPER(pthread_setspecific, (pthread_key_t key, const void *value), (key, value),
+ "(key:%x, value:%p)");
+
+// void *pthread_getspecific(pthread_key_t key);
+
+int WRAP(pthread_kill)(pthread_t thread, int portable_signum)
+{
+ char *portable_signame = map_portable_signum_to_name(portable_signum);
+ int mips_signum;
+ int portable_ret, ret;
+
+ ALOGV("%s(thread:%lx, portable_signum:%d)", __func__, thread, portable_signum);
+
+ mips_signum = signum_pton(portable_signum);
+
+ if ((portable_signum != 0) && (mips_signum == 0)) {
+ /* A signal MIPS doesn't support; all we can do is ignore it. */
+ ret = 0;
+ } else {
+ ALOGV("%s: calling pthread_kill(thread:%lx, mips_signum:%d);", __func__,
+ thread, mips_signum);
+ ret = REAL(pthread_kill)(thread, mips_signum);
+ }
+ portable_ret = errno_ntop(ret);
+
+ ALOGV("%s: return portable_ret:%d; ret:%d;", __func__,
+ portable_ret, ret);
+
+ return portable_ret;
+}
+
+int WRAP(pthread_sigmask)(int portable_how, const sigset_portable_t *portable_sigset,
+ sigset_portable_t *portable_oldset)
+{
+ int portable_ret, ret;
+
+ ALOGV(" ");
+ ALOGV("%s(portable_how:%d portable_sigset:%p, portable_oldset:%p)", __func__,
+ portable_how, portable_sigset, portable_oldset);
+
+ ret = do_sigmask(portable_how, portable_sigset, portable_oldset, pthread_sigmask, NULL);
+
+ portable_ret = errno_ntop(ret);
+
+ ALOGV("%s: return portable_ret:%d; ret:%d;", __func__,
+ portable_ret, ret);
+
+ return portable_ret;
+}
+
+PTHREAD_WRAPPER(pthread_getcpuclockid, (pthread_t tid, clockid_t *clockid), (tid, clockid),
+ "(tid:%lx, clockid:%p)");
+
+PTHREAD_WRAPPER(pthread_once, (pthread_once_t *once_control, void (*init_routine)(void)),
+ (once_control, init_routine), "(once_control:%p, init_routine:%p)");
+
+PTHREAD_WRAPPER(pthread_setname_np, (pthread_t thid, const char *thname), (thid, thname),
+ "(thid:%lx, thname:\"%s\")");
diff --git a/ndk/sources/android/libportable/arch-mips/resource.c b/ndk/sources/android/libportable/arch-mips/resource.c
index 4119e79df..91b473d3f 100644
--- a/ndk/sources/android/libportable/arch-mips/resource.c
+++ b/ndk/sources/android/libportable/arch-mips/resource.c
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <portability.h>
#include <sys/resource.h>
#include <resource_portable.h>
@@ -38,14 +39,14 @@ static inline int mips_change_resource(int resource)
return resource;
}
-extern int getrlimit(int resource, struct rlimit *rlp);
-int getrlimit_portable(int resource, struct rlimit *rlp)
+extern int REAL(getrlimit)(int resource, struct rlimit *rlp);
+int WRAP(getrlimit)(int resource, struct rlimit *rlp)
{
- return getrlimit(mips_change_resource(resource), rlp);
+ return REAL(getrlimit)(mips_change_resource(resource), rlp);
}
-extern int setrlimit(int resource, const struct rlimit *rlp);
-int setrlimit_portable(int resource, const struct rlimit *rlp)
+extern int REAL(setrlimit)(int resource, const struct rlimit *rlp);
+int WRAP(setrlimit)(int resource, const struct rlimit *rlp)
{
- return setrlimit(mips_change_resource(resource), rlp);
+ return REAL(setrlimit)(mips_change_resource(resource), rlp);
}
diff --git a/ndk/sources/android/libportable/arch-mips/setjmp.S b/ndk/sources/android/libportable/arch-mips/setjmp.S
new file mode 100644
index 000000000..15329725e
--- /dev/null
+++ b/ndk/sources/android/libportable/arch-mips/setjmp.S
@@ -0,0 +1,218 @@
+/* Derived from: $OpenBSD: setjmp.S,v 1.5 2005/08/07 16:40:15 espie Exp $ */
+
+/*
+ * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Opsycon AB nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include <asm-generic/portability.h>
+#include <machine/asm.h>
+#include <machine/regnum.h>
+
+#include "jboffsets.h"
+
+/*
+ * setjmp, longjmp implementation for libc.
+ */
+
+FRAMESZ= MKFSIZ(2,6)
+A1OFF= FRAMESZ-4*REGSZ
+A0OFF= FRAMESZ-3*REGSZ
+GPOFF= FRAMESZ-2*REGSZ
+RAOFF= FRAMESZ-1*REGSZ
+
+#define FPREG64_S(FPR, OFF, BASE) \
+ swc1 FPR, OFF(BASE) ; \
+ mfhc1 t0, FPR ; \
+ sw t0, OFF+4(BASE) ;
+
+#define FPREG64_L(FPR, OFF, BASE) \
+ lw t0, OFF+4(BASE) ; \
+ lw t1, OFF(BASE) ; \
+ mtc1 t1, FPR ; \
+ mthc1 t0, FPR ; \
+
+
+
+NON_LEAF(WRAP(setjmp), FRAMESZ, ra)
+ .mask 0x80000000, RAOFF
+ PTR_SUBU sp, FRAMESZ # allocate stack frame
+ SETUP_GP64(GPOFF, WRAP(setjmp))
+ SAVE_GP(GPOFF)
+ .set reorder
+ REG_S ra, RAOFF(sp) # save state
+ REG_S a0, A0OFF(sp)
+
+ move a0, zero # get current signal mask
+ jal sigblock
+
+ REG_L v1, A0OFF(sp) # v1 = jmpbuf
+ REG_S v0, JB_MASK(v1) # save sc_mask = sigblock(0)
+
+ REG_L a0, A0OFF(sp) # restore jmpbuf
+ REG_L ra, RAOFF(sp)
+ REG_S ra, JB_PC(a0) # sc_pc = return address
+#if defined(__mips64)
+ dli v0, MAGIC_SETJMP
+#else
+ li v0, MAGIC_SETJMP
+#endif
+ REG_S v0, JB_MAGIC(a0)
+ REG_S s0, JB_S0(a0)
+ REG_S s1, JB_S1(a0)
+ REG_S s2, JB_S2(a0)
+ REG_S s3, JB_S3(a0)
+ REG_S s4, JB_S4(a0)
+ REG_S s5, JB_S5(a0)
+ REG_S s6, JB_S6(a0)
+ REG_S s7, JB_S7(a0)
+ REG_S s8, JB_S8(a0)
+ REG_L v0, GPOFF(sp)
+ REG_S v0, JB_GP(a0)
+ PTR_ADDU v0, sp, FRAMESZ
+ REG_S v0, JB_SP(a0)
+
+#if !defined(SOFTFLOAT)
+ /*
+ * Would be nice if we could tell if the FP registers are currently being used.
+ * Assume they are, and use pointer to jmp_buf in a0 to save FP registers and the
+ * jmp_buf.fpused flag.
+ */
+ li v0, 1 # v0 = 1
+ REG_S v0, JB_FPUSED(a0) # a0->jb_fpused = v0:1
+ cfc1 v0, $31
+#if _MIPS_FPSET == 32
+ FPREG64_S($f20, JB_F20, a0)
+ FPREG64_S($f21, JB_F21, a0)
+ FPREG64_S($f22, JB_F22, a0)
+ FPREG64_S($f23, JB_F23, a0)
+ FPREG64_S($f24, JB_F24, a0)
+ FPREG64_S($f25, JB_F25, a0)
+ FPREG64_S($f26, JB_F26, a0)
+ FPREG64_S($f27, JB_F27, a0)
+ FPREG64_S($f28, JB_F28, a0)
+ FPREG64_S($f29, JB_F29, a0)
+ FPREG64_S($f30, JB_F30, a0)
+ FPREG64_S($f31, JB_F31, a0)
+#else
+ swc1 $f20, JB_F20(a0)
+ swc1 $f21, JB_F21(a0)
+ swc1 $f22, JB_F22(a0)
+ swc1 $f23, JB_F23(a0)
+ swc1 $f24, JB_F24(a0)
+ swc1 $f25, JB_F25(a0)
+ swc1 $f26, JB_F26(a0)
+ swc1 $f27, JB_F27(a0)
+ swc1 $f28, JB_F28(a0)
+ swc1 $f29, JB_F29(a0)
+ swc1 $f30, JB_F30(a0)
+ swc1 $f31, JB_F31(a0)
+#endif
+ REG_S v0, JB_FSR(a0)
+#endif /* !SOFTFLOAT */
+ move v0, zero
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
+ j ra
+
+botch:
+ jal longjmperror
+ jal abort
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
+END(WRAP(setjmp))
+
+
+LEAF(WRAP(longjmp), FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, WRAP(longjmp))
+ SAVE_GP(GPOFF)
+ .set reorder
+ sw a1, A1OFF(sp)
+ sw a0, A0OFF(sp)
+
+ lw a0, JB_MASK(a0)
+ jal sigsetmask
+
+ lw a0, A0OFF(sp)
+ lw a1, A1OFF(sp)
+
+ .set noreorder
+ REG_L v0, JB_MAGIC(a0)
+ bne v0, MAGIC_SETJMP, botch # jump if error
+ REG_L ra, JB_PC(a0)
+ REG_L s0, JB_S0(a0)
+ REG_L s1, JB_S1(a0)
+ REG_L s2, JB_S2(a0)
+ REG_L s3, JB_S3(a0)
+ REG_L s4, JB_S4(a0)
+ REG_L s5, JB_S5(a0)
+ REG_L s6, JB_S6(a0)
+ REG_L s7, JB_S7(a0)
+ REG_L s8, JB_S8(a0)
+ REG_L gp, JB_GP(a0)
+ REG_L sp, JB_SP(a0)
+
+#if !defined(SOFTFLOAT)
+ REG_L v0, JB_FSR(a0)
+ ctc1 v0, $31
+#if _MIPS_FPSET == 32
+ FPREG64_L($f20, JB_F20, a0)
+ FPREG64_L($f21, JB_F21, a0)
+ FPREG64_L($f22, JB_F22, a0)
+ FPREG64_L($f23, JB_F23, a0)
+ FPREG64_L($f24, JB_F24, a0)
+ FPREG64_L($f25, JB_F25, a0)
+ FPREG64_L($f26, JB_F26, a0)
+ FPREG64_L($f27, JB_F27, a0)
+ FPREG64_L($f28, JB_F28, a0)
+ FPREG64_L($f29, JB_F29, a0)
+ FPREG64_L($f30, JB_F30, a0)
+ FPREG64_L($f31, JB_F31, a0)
+#else
+ lwc1 $f20, JB_F20(a0)
+ lwc1 $f21, JB_F21(a0)
+ lwc1 $f22, JB_F22(a0)
+ lwc1 $f23, JB_F23(a0)
+ lwc1 $f24, JB_F24(a0)
+ lwc1 $f25, JB_F25(a0)
+ lwc1 $f26, JB_F26(a0)
+ lwc1 $f27, JB_F27(a0)
+ lwc1 $f28, JB_F28(a0)
+ lwc1 $f29, JB_F29(a0)
+ lwc1 $f30, JB_F30(a0)
+ lwc1 $f31, JB_F31(a0)
+#endif
+#endif /* !SOFTFLOAT */
+ bne a1, zero, 1f
+ nop
+ li a1, 1 # never return 0!
+1:
+ j ra
+ move v0, a1
+
+END(WRAP(longjmp))
diff --git a/ndk/sources/android/libportable/arch-mips/signal.c b/ndk/sources/android/libportable/arch-mips/signal.c
new file mode 100644
index 000000000..4d2d2587c
--- /dev/null
+++ b/ndk/sources/android/libportable/arch-mips/signal.c
@@ -0,0 +1,1772 @@
+/*
+ * Copyright 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.
+ */
+
+#include <portability.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <signal_portable.h>
+#include <portability.h>
+#include <stdio.h>
+#include <errno.h>
+#include <errno_portable.h>
+#include <asm/unistd-portable.h>
+#include <asm/unistd.h>
+#include <signalfd_portable.h>
+#include <filefd_portable.h>
+
+#define PORTABLE_TAG "signal_portable"
+#include <log_portable.h>
+
+
+#if SIGBUS_PORTABLE == SIGBUS
+#error Bad build environment
+#endif
+
+typedef void (*sig3handler_t)(int, siginfo_t *, void *);
+
+static volatile int signal_handler_mapping_enabled = 1;
+
+extern int syscall(int, ...);
+
+
+__hidden void signal_disable_mapping()
+{
+ ALOGV("%s(): signal_handler_mapping_enabled:%d = 0;", __func__,
+ signal_handler_mapping_enabled);
+
+ signal_handler_mapping_enabled = 0;
+}
+
+
+/*
+ * The next five hidden functions are not exposed in the
+ * libportable shared object. They are used here and other
+ * functions, like waitpid(), which need to map signal numbers.
+ */
+__hidden char *map_portable_signum_to_name(int portable_signum)
+{
+ char *name;
+
+ switch(portable_signum) {
+ case SIGHUP_PORTABLE: name = "SIGHUP_PORTABLE:1"; break;
+ case SIGINT_PORTABLE: name = "SIGINT_PORTABLE:2"; break;
+ case SIGQUIT_PORTABLE: name = "SIGQUIT_PORTABLE:3"; break;
+ case SIGILL_PORTABLE: name = "SIGILL_PORTABLE:4"; break;
+ case SIGTRAP_PORTABLE: name = "SIGTRAP_PORTABLE:5"; break;
+ case SIGABRT_PORTABLE: name = "SIGABRT_PORTABLE:6"; break;
+ case SIGBUS_PORTABLE: name = "SIGBUS_PORTABLE:7"; break;
+ case SIGFPE_PORTABLE: name = "SIGFPE_PORTABLE:8"; break;
+ case SIGKILL_PORTABLE: name = "SIGKILL_PORTABLE:9"; break;
+ case SIGUSR1_PORTABLE: name = "SIGUSR1_PORTABLE:10"; break;
+ case SIGSEGV_PORTABLE: name = "SIGSEGV_PORTABLE:11"; break;
+ case SIGUSR2_PORTABLE: name = "SIGUSR2_PORTABLE:12"; break;
+ case SIGPIPE_PORTABLE: name = "SIGPIPE_PORTABLE:13"; break;
+ case SIGALRM_PORTABLE: name = "SIGALRM_PORTABLE:14"; break;
+ case SIGTERM_PORTABLE: name = "SIGTERM_PORTABLE:15"; break;
+ case SIGSTKFLT_PORTABLE: name = "SIGSTKFLT_PORTABLE:16"; break;
+ case SIGCHLD_PORTABLE: name = "SIGCHLD_PORTABLE:17"; break;
+ case SIGCONT_PORTABLE: name = "SIGCONT_PORTABLE:18"; break;
+ case SIGSTOP_PORTABLE: name = "SIGSTOP_PORTABLE:19"; break;
+ case SIGTSTP_PORTABLE: name = "SIGTSTP_PORTABLE:20"; break;
+ case SIGTTIN_PORTABLE: name = "SIGTTIN_PORTABLE:21"; break;
+ case SIGTTOU_PORTABLE: name = "SIGTTOU_PORTABLE:22"; break;
+ case SIGURG_PORTABLE: name = "SIGURG_PORTABLE:23"; break;
+ case SIGXCPU_PORTABLE: name = "SIGXCPU_PORTABLE:24"; break;
+ case SIGXFSZ_PORTABLE: name = "SIGXFSZ_PORTABLE:25"; break;
+ case SIGVTALRM_PORTABLE: name = "SIGVTALRM_PORTABLE:26"; break;
+ case SIGPROF_PORTABLE: name = "SIGPROF_PORTABLE:27"; break;
+ case SIGWINCH_PORTABLE: name = "SIGWINCH_PORTABLE:28"; break;
+ case SIGIO_PORTABLE: name = "SIGIO_PORTABLE:29"; break;
+ case SIGPWR_PORTABLE: name = "SIGPWR_PORTABLE:30"; break;
+ case SIGSYS_PORTABLE: name = "SIGSYS_PORTABLE:31"; break;
+ case SIGRTMIN_PORTABLE: name = "SIGRTMIN_PORTABLE:32"; break;
+
+ case SIGRT_1_PORTABLE: name = "SIGRT_1_PORTABLE:33"; break;
+ case SIGRT_2_PORTABLE: name = "SIGRT_2_PORTABLE:34"; break;
+ case SIGRT_3_PORTABLE: name = "SIGRT_3_PORTABLE:35"; break;
+ case SIGRT_4_PORTABLE: name = "SIGRT_4_PORTABLE:36"; break;
+ case SIGRT_5_PORTABLE: name = "SIGRT_5_PORTABLE:37"; break;
+ case SIGRT_6_PORTABLE: name = "SIGRT_6_PORTABLE:38"; break;
+ case SIGRT_7_PORTABLE: name = "SIGRT_7_PORTABLE:39"; break;
+ case SIGRT_8_PORTABLE: name = "SIGRT_8_PORTABLE:40"; break;
+ case SIGRT_9_PORTABLE: name = "SIGRT_9_PORTABLE:41"; break;
+ case SIGRT_10_PORTABLE: name = "SIGRT_10_PORTABLE:42"; break;
+ case SIGRT_11_PORTABLE: name = "SIGRT_11_PORTABLE:43"; break;
+ case SIGRT_12_PORTABLE: name = "SIGRT_12_PORTABLE:44"; break;
+ case SIGRT_13_PORTABLE: name = "SIGRT_13_PORTABLE:45"; break;
+ case SIGRT_14_PORTABLE: name = "SIGRT_14_PORTABLE:46"; break;
+ case SIGRT_15_PORTABLE: name = "SIGRT_15_PORTABLE:47"; break;
+ case SIGRT_16_PORTABLE: name = "SIGRT_16_PORTABLE:48"; break;
+ case SIGRT_17_PORTABLE: name = "SIGRT_17_PORTABLE:49"; break;
+ case SIGRT_18_PORTABLE: name = "SIGRT_18_PORTABLE:50"; break;
+ case SIGRT_19_PORTABLE: name = "SIGRT_19_PORTABLE:51"; break;
+ case SIGRT_20_PORTABLE: name = "SIGRT_20_PORTABLE:52"; break;
+ case SIGRT_21_PORTABLE: name = "SIGRT_21_PORTABLE:53"; break;
+ case SIGRT_22_PORTABLE: name = "SIGRT_22_PORTABLE:54"; break;
+ case SIGRT_23_PORTABLE: name = "SIGRT_23_PORTABLE:55"; break;
+ case SIGRT_24_PORTABLE: name = "SIGRT_24_PORTABLE:56"; break;
+ case SIGRT_25_PORTABLE: name = "SIGRT_25_PORTABLE:57"; break;
+ case SIGRT_26_PORTABLE: name = "SIGRT_26_PORTABLE:58"; break;
+ case SIGRT_27_PORTABLE: name = "SIGRT_27_PORTABLE:59"; break;
+ case SIGRT_28_PORTABLE: name = "SIGRT_28_PORTABLE:60"; break;
+ case SIGRT_29_PORTABLE: name = "SIGRT_29_PORTABLE:61"; break;
+ case SIGRT_30_PORTABLE: name = "SIGRT_30_PORTABLE:62"; break;
+ case SIGRT_31_PORTABLE: name = "SIGRT_31_PORTABLE:63"; break;
+ case SIGRTMAX_PORTABLE: name = "SIGRTMAX_PORTABLE:64"; break;
+
+ default: name = "<<UNKNOWN>>"; break;
+ }
+ return name;
+}
+
+
+__hidden char *map_mips_signum_to_name(int mips_signum)
+{
+ char *name;
+
+ switch(mips_signum) {
+ case SIGHUP: name = "SIGHUP:1"; break;
+ case SIGINT: name = "SIGINT:2"; break;
+ case SIGQUIT: name = "SIGQUIT:3"; break;
+ case SIGILL: name = "SIGILL:4"; break;
+ case SIGTRAP: name = "SIGTRAP:5"; break;
+ case SIGIOT: name = "SIGIOT:6"; break;
+ case SIGEMT: name = "SIGEMT:7"; break;
+ case SIGFPE: name = "SIGFPE:8"; break;
+ case SIGKILL: name = "SIGKILL:9"; break;
+ case SIGBUS: name = "SIGBUS:10"; break;
+ case SIGSEGV: name = "SIGSEGV:11"; break;
+ case SIGSYS: name = "SIGSYS:12"; break;
+ case SIGPIPE: name = "SIGPIPE:13"; break;
+ case SIGALRM: name = "SIGALRM:14"; break;
+ case SIGTERM: name = "SIGTERM:15"; break;
+ case SIGUSR1: name = "SIGUSR1:16"; break;
+ case SIGUSR2: name = "SIGUSR2:17"; break;
+ case SIGCHLD: name = "SIGCHLD:18"; break;
+ case SIGPWR: name = "SIGPWR:19"; break;
+ case SIGWINCH: name = "SIGWINCH:20"; break;
+ case SIGURG: name = "SIGURG:21"; break;
+ case SIGIO: name = "SIGIO:22"; break;
+ case SIGSTOP: name = "SIGSTOP:23"; break;
+ case SIGTSTP: name = "SIGTSTP:24"; break;
+ case SIGCONT: name = "SIGCONT:25"; break;
+ case SIGTTIN: name = "SIGTTIN:26"; break;
+ case SIGTTOU: name = "SIGTTOU:27"; break;
+ case SIGVTALRM: name = "SIGVTALRM:28"; break;
+ case SIGPROF: name = "SIGPROF:29"; break;
+ case SIGXCPU: name = "SIGXCPU:30"; break;
+ case SIGXFSZ: name = "SIGXFSZ:31"; break;
+
+ case SIGRTMIN: name = "SIGRTMIN:32"; break;
+ case SIGRT_1: name = "SIGRT_1:33"; break;
+ case SIGRT_2: name = "SIGRT_2:34"; break;
+ case SIGRT_3: name = "SIGRT_3:35"; break;
+ case SIGRT_4: name = "SIGRT_4:36"; break;
+ case SIGRT_5: name = "SIGRT_5:37"; break;
+ case SIGRT_6: name = "SIGRT_6:38"; break;
+ case SIGRT_7: name = "SIGRT_7:39"; break;
+ case SIGRT_8: name = "SIGRT_8:40"; break;
+ case SIGRT_9: name = "SIGRT_9:41"; break;
+ case SIGRT_10: name = "SIGRT_10:42"; break;
+ case SIGRT_11: name = "SIGRT_11:43"; break;
+ case SIGRT_12: name = "SIGRT_12:44"; break;
+ case SIGRT_13: name = "SIGRT_13:45"; break;
+ case SIGRT_14: name = "SIGRT_14:46"; break;
+ case SIGRT_15: name = "SIGRT_15:47"; break;
+ case SIGRT_16: name = "SIGRT_16:48"; break;
+ case SIGRT_17: name = "SIGRT_17:49"; break;
+ case SIGRT_18: name = "SIGRT_18:50"; break;
+ case SIGRT_19: name = "SIGRT_19:51"; break;
+ case SIGRT_20: name = "SIGRT_20:52"; break;
+ case SIGRT_21: name = "SIGRT_21:53"; break;
+ case SIGRT_22: name = "SIGRT_22:54"; break;
+ case SIGRT_23: name = "SIGRT_23:55"; break;
+ case SIGRT_24: name = "SIGRT_24:56"; break;
+ case SIGRT_25: name = "SIGRT_25:57"; break;
+ case SIGRT_26: name = "SIGRT_26:58"; break;
+ case SIGRT_27: name = "SIGRT_27:59"; break;
+ case SIGRT_28: name = "SIGRT_28:60"; break;
+ case SIGRT_29: name = "SIGRT_29:61"; break;
+ case SIGRT_30: name = "SIGRT_30:62"; break;
+ case SIGRT_31: name = "SIGRT_31:63"; break;
+ case SIGRT_32: name = "SIGRT_32:64"; break;
+
+ /* NOTE: SIGRT_33...SIGRTMAX-1 Not printed */
+
+ case SIGRTMAX: name = "SIGRTMAX:128"; break;
+ default: name = "<<UNKNOWN>>"; break;
+ }
+ return name;
+}
+
+
+/*
+ * Maps a signal number from portable to native.
+ */
+__hidden int signum_pton(int portable_signum)
+{
+ int mips_signum = -1;
+
+ switch(portable_signum) {
+ case SIGHUP_PORTABLE: /* 1 */
+ return SIGHUP;
+
+ case SIGINT_PORTABLE: /* 2 */
+ return SIGINT;
+
+ case SIGQUIT_PORTABLE: /* 3 */
+ return SIGQUIT;
+
+ case SIGILL_PORTABLE: /* 4 */
+ return SIGILL;
+
+ case SIGTRAP_PORTABLE: /* 5 */
+ return SIGTRAP;
+
+ case SIGABRT_PORTABLE: /* 6 */
+ return SIGABRT;
+
+ case SIGBUS_PORTABLE: /* 7 --> 10 */
+ return SIGBUS;
+
+ case SIGFPE_PORTABLE: /* 8 */
+ return SIGFPE;
+
+ case SIGKILL_PORTABLE: /* 9 */
+ return SIGKILL;
+
+ case SIGUSR1_PORTABLE: /* 10 --> 16 */
+ return SIGUSR1;
+
+ case SIGSEGV_PORTABLE: /* 11 */
+ return SIGSEGV;
+
+ case SIGUSR2_PORTABLE: /* 12 --> 17 */
+ return SIGUSR2;
+
+ case SIGPIPE_PORTABLE: /* 13 */
+ return SIGPIPE;
+
+ case SIGALRM_PORTABLE: /* 14 */
+ return SIGALRM;
+
+ case SIGTERM_PORTABLE: /* 15 */
+ return SIGTERM;
+
+ case SIGSTKFLT_PORTABLE: /* 16 --> 7 */
+ return SIGEMT; /* No native SIGSTKFLT exist ...
+ ... mapping it to SIGEMT. */
+
+ case SIGCHLD_PORTABLE: /* 17 --> 18 */
+ return SIGCHLD;
+
+ case SIGCONT_PORTABLE: /* 18 --> 25 */
+ return SIGCONT;
+
+ case SIGSTOP_PORTABLE: /* 19 --> 23 */
+ return SIGSTOP;
+
+ case SIGTSTP_PORTABLE: /* 20 --> 24 */
+ return SIGTSTP;
+
+ case SIGTTIN_PORTABLE: /* 21 --> 26 */
+ return SIGTTIN;
+
+ case SIGTTOU_PORTABLE: /* 22 --> 27 */
+ return SIGTTOU;
+
+ case SIGURG_PORTABLE: /* 23 --> 21 */
+ return SIGURG;
+
+ case SIGXCPU_PORTABLE: /* 24 --> 30 */
+ return SIGXCPU;
+
+ case SIGXFSZ_PORTABLE: /* 25 --> 31 */
+ return SIGXFSZ;
+
+ case SIGVTALRM_PORTABLE: /* 26 --> 28 */
+ return SIGVTALRM;
+
+ case SIGPROF_PORTABLE: /* 27 --> 29 */
+ return SIGPROF;
+
+ case SIGWINCH_PORTABLE: /* 28 --> 20 */
+ return SIGWINCH;
+
+ case SIGIO_PORTABLE: /* 29 --> 22 */
+ return SIGIO;
+
+ case SIGPWR_PORTABLE: /* 30 --> 19 */
+ return SIGPWR;
+
+ case SIGSYS_PORTABLE: /* 31 --> 12 */
+ return SIGSYS;
+ /*
+ * Mapping lower 32 Real Time signals to identical Native signal numbers.
+ * NOTE: SIGRTMAX_PORTABLE == 64 but SIGRTMAX == 128.
+ */
+ case SIGRTMIN_PORTABLE...SIGRTMAX_PORTABLE: /* 32 ... 64 */
+ ASSERT(SIGRTMIN_PORTABLE == SIGRTMIN);
+ ASSERT(SIGRTMAX_PORTABLE <= SIGRTMAX);
+ return portable_signum;
+
+ default:
+ ALOGE("%s: switch default: NOTE portable_signum:%d Not supported. Just a Test?",
+ __func__, portable_signum);
+ /*
+ * User could be LTP testing with bogus signal numbers,
+ * if so we mimic the test.
+ *
+ * If the signal is just outside the PORTABLE range
+ * we use a signal just outside the Native/MIPS range.
+ */
+ if (portable_signum < 0) {
+ mips_signum = portable_signum;
+ } else if (portable_signum > NSIG_PORTABLE) {
+ mips_signum = (portable_signum - NSIG_PORTABLE) + NSIG;
+ } else {
+ ALOGE("%s: 0 <= portable_signum:%d <= NSIG_PORTABLE:%d; Not supported, return(0);",
+ __func__, portable_signum, NSIG_PORTABLE);
+
+ mips_signum = 0;
+ }
+ break;
+ }
+ ALOGV("%s(portable_signum:%d): return(mips_signum:%d);", __func__,
+ portable_signum, mips_signum);
+
+ return mips_signum;
+}
+
+
+/*
+ * Maps a signal number from native to portable.
+ */
+__hidden int signum_ntop(int mips_signum)
+{
+ int portable_ssignum = -1;
+
+ switch(mips_signum) {
+ case SIGHUP: /* 1 */
+ return SIGHUP_PORTABLE;
+
+ case SIGINT: /* 2 */
+ return SIGINT_PORTABLE;
+
+ case SIGQUIT: /* 3 */
+ return SIGQUIT_PORTABLE;
+
+ case SIGILL: /* 4 */
+ return SIGILL_PORTABLE;
+
+ case SIGTRAP: /* 5 */
+ return SIGTRAP_PORTABLE;
+
+ case SIGABRT: /* 6 */
+ return SIGABRT_PORTABLE;
+
+ case SIGBUS: /* 7 <-- 10 */
+ return SIGBUS_PORTABLE;
+
+ case SIGFPE: /* 8 */
+ return SIGFPE_PORTABLE;
+
+ case SIGKILL: /* 9 */
+ return SIGKILL_PORTABLE;
+
+ case SIGUSR1: /* 10 <-- 16 */
+ return SIGUSR1_PORTABLE;
+
+ case SIGSEGV: /* 11 */
+ return SIGSEGV_PORTABLE;
+
+ case SIGUSR2: /* 12 <-- 17 */
+ return SIGUSR2_PORTABLE;
+
+ case SIGPIPE: /* 13 */
+ return SIGPIPE_PORTABLE;
+
+ case SIGALRM: /* 14 */
+ return SIGALRM_PORTABLE;
+
+ case SIGTERM: /* 15 */
+ return SIGTERM_PORTABLE;
+
+ case SIGEMT: /* 16 <--- 7 */
+ return SIGSTKFLT_PORTABLE; /* No native SIGSTKFLT exist ...
+ ... reverse mapping SIGEMT ...
+ ... back to SIGSTKFLT. */
+
+ case SIGCHLD: /* 17 <-- 18 */
+ return SIGCHLD_PORTABLE;
+
+ case SIGCONT: /* 18 <-- 15 */
+ return SIGCONT_PORTABLE;
+
+ case SIGSTOP: /* 19 <-- 23 */
+ return SIGSTOP_PORTABLE;
+
+ case SIGTSTP: /* 20 <-- 24 */
+ return SIGTSTP_PORTABLE;
+
+ case SIGTTIN: /* 21 <-- 26 */
+ return SIGTTIN_PORTABLE;
+
+ case SIGTTOU: /* 22 <-- 27 */
+ return SIGTTOU_PORTABLE;
+
+ case SIGURG: /* 23 <-- 21 */
+ return SIGURG_PORTABLE;
+
+ case SIGXCPU: /* 24 <-- 30 */
+ return SIGXCPU_PORTABLE;
+
+ case SIGXFSZ: /* 25 <-- 31 */
+ return SIGXFSZ_PORTABLE;
+
+ case SIGVTALRM: /* 26 <-- 28 */
+ return SIGVTALRM_PORTABLE;
+
+ case SIGPROF: /* 27 <-- 29 */
+ return SIGPROF_PORTABLE;
+
+ case SIGWINCH: /* 28 <-- 20 */
+ return SIGWINCH_PORTABLE;
+
+ case SIGIO: /* 29 <-- 22 */
+ return SIGIO_PORTABLE;
+
+ case SIGPWR: /* 30 <-- 19 */
+ return SIGPWR_PORTABLE;
+
+ case SIGSYS: /* 31 <-- 12 */
+ return SIGSYS_PORTABLE;
+
+ /*
+ * Mapping lower 32 Real Time signals to identical Portable signal numbers.
+ * NOTE: SIGRTMAX_PORTABLE == 64 but SIGRTMAX == 128.
+ */
+ case SIGRTMIN...SIGRTMAX_PORTABLE: /* 32 ... 64 */
+ ASSERT(SIGRTMIN == SIGRTMIN_PORTABLE);
+ ASSERT(SIGRTMAX >= SIGRTMAX_PORTABLE);
+ return mips_signum;
+
+ /*
+ * Mapping upper 63 Native Real Time signals to the last Portable signal number.
+ * Shouldn't even be possible to be using these signals.
+ */
+ case (SIGRTMAX_PORTABLE+1)...SIGRTMAX: /* 65 ... 128 */
+ ASSERT(SIGRTMIN == SIGRTMIN_PORTABLE);
+ ASSERT(SIGRTMAX >= SIGRTMAX_PORTABLE);
+
+ ALOGE("%s: mips_signum:%d Can't be mapped to a unique portable signal;", __func__,
+ mips_signum);
+
+ ALOGE("%s: Mapping highest 63 Real Time Signals to the largest RT Portable SigNo.",
+ __func__);
+
+ return SIGRTMAX_PORTABLE;
+
+
+ default:
+ ALOGE("%s: switch default: mips_signum:%d Not supported! return(0);", __func__,
+ mips_signum);
+#if 0
+ LOG_FATAL("%s: mips_signum:%d is not portable;", __func__, mips_signum);
+#endif
+ return 0;
+ }
+ return portable_ssignum;
+}
+
+
+/*
+ * Deal with siginfo structure being a bit different.
+ * Need to swap errno and code fields.
+ */
+static void siginfo_pton(siginfo_portable_t *portable_sip, siginfo_t *native_sip)
+{
+
+ ALOGV("%s(portable_sip:%p, native_sip:%p) {", __func__,
+ portable_sip, native_sip);
+
+ ASSERT(sizeof(siginfo_portable_t) == sizeof(siginfo_t));
+
+ /*
+ * Default to the same structure members,
+ * code and errno are swapped between ARM and MIPS,
+ * and errno needs to be translated.
+ *
+ * The signal number isn't translated, as the kernel
+ * will fill it it when it delivers the signal.
+ */
+
+ *native_sip = *((siginfo_t *)portable_sip);
+ native_sip->si_signo = 0;
+ native_sip->si_code = portable_sip->si_code;
+ native_sip->si_errno = errno_pton(portable_sip->si_errno);
+
+ ALOGV("%s: return; }", __func__);
+}
+
+
+static void siginfo_ntop(siginfo_t *native_sip, siginfo_portable_t *portable_sip)
+{
+
+ ALOGV("%s(native_sip,:%p, portable_sip:%p) {", __func__,
+ native_sip, portable_sip);
+
+ ASSERT(sizeof(siginfo_portable_t) == sizeof(siginfo_t));
+
+ /*
+ * Structure assignment to default to the same structure members,
+ * as only the code and errno are swapped in position between
+ * ARM and MIPS; errno and signal number also need to be translated.
+ */
+ *portable_sip = *((siginfo_portable_t *)native_sip);
+
+ portable_sip->si_signo = signum_ntop(native_sip->si_signo);
+ portable_sip->si_code = native_sip->si_code;
+ portable_sip->si_errno = errno_ntop(native_sip->si_errno);
+
+ ALOGV("%s: return; }", __func__);
+}
+
+
+/*
+ * Array of signal handlers as the portable users expects they
+ * they have been registered in the kernel. Problem is we need
+ * to have our own handler to map the MIPS signal number to a
+ * portable signal number.
+ */
+static sig3handler_portable_t mips_portable_sighandler[NSIG_PORTABLE + 1] = { NULL };
+
+static void mips_sigaction_handler(int mips_signum, siginfo_t *sip, void *ucp)
+{
+ int portable_signum;
+ char *portable_signame;
+ char *mips_signame = map_mips_signum_to_name(mips_signum);
+ sig3handler_portable_t portable_sighandler;
+ siginfo_portable_t portable_si;
+ siginfo_portable_t *portable_sip;
+
+ ALOGV(" ");
+ ALOGV("%s(mips_signum:%d:'%s', sip:%p, ucp:%p) {", __func__,
+ mips_signum,
+ mips_signame, sip, ucp);
+
+ portable_signum = signum_ntop(mips_signum);
+ portable_signame = map_portable_signum_to_name(portable_signum);
+ portable_sighandler = mips_portable_sighandler[portable_signum];
+
+ if (invalid_pointer(portable_sighandler)) {
+ /*
+ * If a portable/ARM application tries to set signals in the signal mask > 32
+ * it results in a signal_handler being set to -1:SIG_ERR. Calling a function
+ * at location -1 doesn't produce very informative Android backtraces on MIPS.
+ */
+ ALOGE("%s: invalid_pointer(portable_sighandler:%p); Likely about to Trap or Bus Error!",
+ __func__, portable_sighandler);
+
+ ALOGE("%s: HINT: Likely best to use gdbserver and look at sigaction arguments.", __func__);
+ }
+ ASSERT(portable_sighandler != NULL);
+ ASSERT(portable_sighandler != (sig3handler_portable_t) SIG_DFL);
+ ASSERT(portable_sighandler != (sig3handler_portable_t) SIG_IGN);
+
+ if (sip == NULL) {
+ portable_sip = NULL;
+ } else {
+ /* Map signinfo from native to portable format */
+ portable_sip = &portable_si;
+ siginfo_ntop(sip, portable_sip);
+ }
+
+
+ ALOGV("%s: Calling portable_sighandler:%p(portable_signum:%d, portable_sip:%p, ucp:%p);",
+ __func__, portable_sighandler, portable_signum, portable_sip, ucp);
+
+ portable_sighandler(portable_signum, portable_sip, ucp);
+
+ ALOGV("%s: return; }", __func__);
+}
+
+
+static void mips_sighandler(int mips_signum)
+{
+ int portable_signum;
+ char *portable_signame;
+ char *mips_signame = map_mips_signum_to_name(mips_signum);
+ sig3handler_portable_t portable_sighandler;
+
+ ALOGV(" ");
+ ALOGV("%s(mips_signum:%d:'%s') {", __func__, mips_signum, mips_signame);
+
+ mips_sigaction_handler(mips_signum, NULL, NULL);
+
+ ALOGV("%s: return; }", __func__);
+}
+
+
+static sighandler_t sighandler_pton(sighandler_portable_t portable_handler, int sigaction)
+{
+ sighandler_t mips_handler;
+
+ ALOGV("%s(portable_handler:%p, sigaction:%d) {", __func__,
+ portable_handler, sigaction);
+
+ switch((int) portable_handler) {
+ case (int) SIG_DFL:
+ case (int) SIG_IGN:
+ mips_handler = portable_handler;
+ break;
+
+ default: /* NOTE: Includes SIG_ERR:-1 */
+ if (invalid_pointer(portable_handler)) {
+ /*
+ * Calling sigaction() with a bogus signal handler doesn't fail,
+ * so we let the portable cases fail later as the native case would.
+ */
+ ALOGE("%s: invalid_pointer(portable_handler:%p)!", __func__, portable_handler);
+ ALOGE("%s: HINT: Likely to cause a BUS Error ....", __func__);
+ ALOGE("%s: HINT: ... when the signal handler is called!", __func__);
+ }
+
+ /*
+ * Signal Mapping can be disabled in the rare case of the clone
+ * flags not being compatble for VM and file descriptors.
+ */
+ if (signal_handler_mapping_enabled) {
+ if (sigaction)
+ mips_handler = (sighandler_t) mips_sigaction_handler;
+ else
+ mips_handler = (sighandler_t) mips_sighandler;
+ } else {
+ mips_handler = portable_handler; /* Don't MAP */
+ }
+ break;
+ }
+
+ ALOGV("%s: return(mips_handler:%p); }", __func__, mips_handler);
+ return mips_handler;
+}
+
+
+/*
+ * This function maps the signal number and calls one of the low level mips signal()
+ * functions implemented in libc/unistd/signal.c:
+ * sysv_signal()
+ * bsd_signal()
+ *
+ * The last 2 parameters to this static function, mips_signal_fn*, specify which of
+ * these functions to call. We intercept the above to functions, as well as signal(),
+ * and call the associated *_portable() functions below.
+ *
+ * In addition, we intercept the signal_handler with our own handlers that map the
+ * signal number from the MIPS convention to the PORTABLE/ARM convention.
+ */
+static sighandler_portable_t
+do_signal_portable(int portable_signum, sighandler_portable_t portable_handler,
+ __sighandler_t (mips_signal_fn)(int, __sighandler_t))
+{
+ char *portable_signame = map_portable_signum_to_name(portable_signum);
+ int mips_signum;
+ sighandler_t mips_handler;
+ sighandler_portable_t rv;
+ sighandler_portable_t prev_portable_handler;
+
+ ALOGV("%s(portable_signum:%d:%s, portable_handler:%p, mips_signal_fn:%p) {", __func__,
+ portable_signum,
+ portable_signame, portable_handler, mips_signal_fn);
+
+ mips_signum = signum_pton(portable_signum);
+
+ if ((portable_signum != 0) && ((mips_signum <= 0) || (mips_signum > NSIG))) {
+ /*
+ * Invalid request; Let the kernel generate the proper return value and set errno.
+ */
+ mips_handler = sighandler_pton(portable_handler, 0);
+ rv = mips_signal_fn(mips_signum, mips_handler);
+ } else {
+ /*
+ * We have a usable signal number, redirect it to our signal handler
+ * if a portable handler was provided so we can convert the signal number.
+ * Save our current mapped signal handler for likely return.
+ */
+ prev_portable_handler = (sighandler_portable_t) mips_portable_sighandler[portable_signum];
+
+ mips_handler = sighandler_pton(portable_handler, 0);
+ if (mips_handler != portable_handler) {
+ mips_portable_sighandler[portable_signum] = (sig3handler_portable_t) portable_handler;
+ }
+ rv = mips_signal_fn(mips_signum, mips_handler);
+
+ if ((rv == (sighandler_portable_t) mips_sighandler) ||
+ (rv == (sighandler_portable_t) mips_sigaction_handler)) {
+
+ rv = (sighandler_t) prev_portable_handler;
+ }
+ }
+
+ ALOGV("%s: return(rv:%p); }", __func__, rv);
+ return rv;
+}
+
+
+/*
+ * signal() can't be called directly, due to an in-line function in signal.h which
+ * redirects the call to bsd_signal(). _signal() is a static function; not to be called
+ * directly. This function isn't actually needed.
+ */
+sighandler_portable_t WRAP(signal)(int portable_signum, sighandler_portable_t handler)
+{
+ sighandler_portable_t rv;
+
+ ALOGV(" ");
+ ALOGV("%s(portable_signum:%d, handler:%p) {", __func__,
+ portable_signum, handler);
+
+ /* bsd does a SA_RESTART */
+ rv = do_signal_portable(portable_signum, handler, bsd_signal);
+
+ ALOGV("%s: return(ret:%p); }", __func__, rv);
+ return rv;
+}
+
+
+sighandler_portable_t WRAP(sysv_signal)(int portable_signum, sighandler_portable_t handler)
+{
+ sighandler_portable_t rv;
+
+ ALOGV(" ");
+ ALOGV("%s(portable_signum:%d, handler:%p) {", __func__,
+ portable_signum, handler);
+
+ /* sysv does a SA_RESETHAND */
+ rv = do_signal_portable(portable_signum, handler, sysv_signal);
+
+ ALOGV("%s: return(ret:%p); }", __func__, rv);
+ return rv;
+}
+
+
+/*
+ * NOTE:
+ * handler is either the Bionic
+ * bsd_signal() signal handler
+ * or
+ * the sysv_signal() signal handler.
+ */
+
+sighandler_portable_t WRAP(bsd_signal)(int portable_signum, sighandler_portable_t handler)
+{
+ sighandler_portable_t rv;
+
+ ALOGV(" ");
+ ALOGV("%s(portable_signum:%d, handler:%p) {", __func__,
+ portable_signum, handler);
+
+ /* bsd does a SA_RESTART */
+ rv = do_signal_portable(portable_signum, handler, bsd_signal);
+
+ ALOGV("%s: return(ret:%p); }", __func__, rv);
+ return rv;
+}
+
+
+static int do_kill(int id, int portable_signum, int (*fn)(int, int))
+{
+ char *portable_signame = map_portable_signum_to_name(portable_signum);
+ int mips_signum;
+ int rv;
+
+ ALOGV("%s(id:%d, portable_signum:%d:'%s', fn:%p) {", __func__,
+ id, portable_signum,
+ portable_signame, fn);
+
+ mips_signum = signum_pton(portable_signum);
+
+ if ((portable_signum != 0) && (mips_signum == 0)) {
+ rv = 0;
+ } else {
+ ALOGV("%s: Calling fn:%p(id:%d, mips_signum:%d);", __func__,
+ fn, id, mips_signum);
+
+ rv = fn(id, mips_signum);
+ }
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+int WRAP(killpg)(int pgrp, int portable_signum)
+{
+ extern int REAL(killpg)(int pgrp, int sig);
+ int rv;
+
+ ALOGV(" ");
+ ALOGV("%s(pgrp:%d, portable_signum:%d) {", __func__,
+ pgrp, portable_signum);
+
+ rv = do_kill(pgrp, portable_signum, REAL(killpg));
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+int WRAP(kill)(pid_t pid, int portable_signum)
+{
+ extern int REAL(kill)(pid_t, int);
+ int rv;
+
+ ALOGV(" ");
+ ALOGV("%s(pid:%d, portable_signum:%d) {", __func__,
+ pid, portable_signum);
+
+ rv = do_kill(pid, portable_signum, REAL(kill));
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+int WRAP(tkill)(int tid, int portable_signum)
+{
+ extern int REAL(tkill)(int, int);
+ int rv;
+
+ ALOGV(" ");
+ ALOGV("%s(tid:%d, portable_signum:%d) {", __func__,
+ tid, portable_signum);
+
+ rv = do_kill(tid, portable_signum, REAL(tkill));
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+/* tgkill is not exported from android-14 libc.so */
+#if 0
+int WRAP(tgkill)(int tgid, int tid, int portable_signum)
+{
+ extern int tgkill(int, int, int);
+ char *portable_signame = map_portable_signum_to_name(portable_signum);
+ int mips_signum;
+ int rv;
+
+ ALOGV("%s(tgid:%d, tid:%d, portable_signum:%d:'%s') {", __func__,
+ tgid, tid, portable_signum, portable_signame);
+
+ mips_signum = signum_pton(portable_signum);
+
+ if ((portable_signum != 0) && (mips_signum == 0))
+ rv = 0;
+ else
+ rv = REAL(tgkill)(tgid, tid, mips_signum);
+
+ ALOGV("%s: return rv:%d; }", __func__, rv);
+ return rv;
+}
+#endif
+
+
+int WRAP(raise)(int portable_signum)
+{
+ char *portable_signame = map_portable_signum_to_name(portable_signum);
+ int mips_signum = signum_pton(portable_signum);
+ int rv;
+
+ ALOGV("%s(portable_signum:%d:'%s') {", __func__, portable_signum, portable_signame);
+
+ if ((portable_signum != 0) && (mips_signum == 0))
+ rv = 0;
+ else
+ rv = REAL(raise)(mips_signum);
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+void sigset_pton(sigset_portable_t *portable_sigset, sigset_t *mips_sigset)
+{
+ int portable_signum;
+
+ ASSERT(mips_sigset != NULL);
+
+ ALOGV("%s(portable_sigset:%p, mips_sigset:%p) {", __func__,
+ portable_sigset, mips_sigset);
+
+ sigemptyset(mips_sigset);
+ if (invalid_pointer((void *)portable_sigset)) {
+ ALOGE("%s: portable_sigset:%p is not valid; returning empty set.", __func__,
+ portable_sigset);
+ goto done;
+ }
+
+ for(portable_signum = 1; portable_signum <= NSIG_PORTABLE; portable_signum++) {
+
+ if (WRAP(sigismember)(portable_sigset, portable_signum)) {
+ char *portable_signame = map_portable_signum_to_name(portable_signum);
+ int mips_signum = signum_pton(portable_signum);
+ char *mips_signame;
+
+ if (mips_signum != 0) {
+ int err;
+
+ mips_signame = map_mips_signum_to_name(mips_signum);
+ ALOGV("%s: sigaddset(mips_sigset:%p, mips_signum:%d:'%s');", __func__,
+ mips_sigset, mips_signum,
+ mips_signame);
+
+ err = sigaddset(mips_sigset, mips_signum);
+ if (err == -1) {
+ PERROR("sigaddset");
+ }
+ }
+ }
+ }
+
+done:
+ ALOGV("%s: return; }", __func__);
+ return;
+}
+
+
+void
+sigset_ntop(const sigset_t *const_mips_sigset, sigset_portable_t *portable_sigset)
+{
+ int mips_signum;
+ sigset_t *mips_sigset = (sigset_t *) const_mips_sigset;
+
+ ALOGV("%s(const_mips_sigset:%p, portable_sigset:%p) {", __func__,
+ const_mips_sigset, portable_sigset);
+
+ ASSERT(mips_sigset != NULL);
+
+ if (invalid_pointer((void *)portable_sigset)) {
+ ALOGE("%s: portable_sigset:%p is not Valid; can't return sigset", __func__,
+ portable_sigset);
+ goto done;
+ }
+ WRAP(sigemptyset)(portable_sigset);
+
+ for(mips_signum = 1; mips_signum <= NSIG; mips_signum++) {
+ if (sigismember(mips_sigset, mips_signum)) {
+ int portable_signum = signum_ntop(mips_signum);
+
+ if (portable_signum != 0)
+ WRAP(sigaddset)(portable_sigset, portable_signum);
+ }
+ }
+
+done:
+ ALOGV("%s: return; }", __func__);
+ return;
+}
+
+
+static int sigaction_flags_pton(int portable_flags)
+{
+ int mips_flags = 0;
+
+ if (portable_flags & SA_NOCLDSTOP_PORTABLE) {
+ mips_flags |= SA_NOCLDSTOP;
+ }
+ if (portable_flags & SA_NOCLDWAIT_PORTABLE) {
+ mips_flags |= SA_NOCLDWAIT;
+ }
+ if (portable_flags & SA_SIGINFO_PORTABLE) {
+ mips_flags |= SA_SIGINFO;
+ }
+ if (portable_flags & SA_THIRTYTWO_PORTABLE) {
+ ALOGV("%s: SA_THIRTYTWO_PORTABLE isn't SUPPORTED.", __func__);
+ }
+ if (portable_flags & SA_RESTORER_PORTABLE) {
+ mips_flags |= SA_RESTORER;
+ }
+ if (portable_flags & SA_ONSTACK_PORTABLE) {
+ mips_flags |= SA_ONSTACK;
+ }
+ if (portable_flags & SA_RESTART_PORTABLE) {
+ mips_flags |= SA_RESTART;
+ }
+ if (portable_flags & SA_NODEFER_PORTABLE) {
+ mips_flags |= SA_NODEFER;
+ }
+ if (portable_flags & SA_RESETHAND_PORTABLE) {
+ mips_flags |= SA_RESETHAND;
+ }
+
+ ALOGV("%s(portable_flags:0x%x) return(mips_flags:0x%x);", __func__,
+ portable_flags, mips_flags);
+
+ return mips_flags;
+}
+
+
+int sigaction_flags_ntop(int mips_flags)
+{
+ int portable_flags = 0;
+
+ if (mips_flags & SA_NOCLDSTOP) portable_flags |= SA_NOCLDSTOP_PORTABLE;
+ if (mips_flags & SA_NOCLDWAIT) portable_flags |= SA_NOCLDWAIT_PORTABLE;
+ if (mips_flags & SA_SIGINFO) portable_flags |= SA_SIGINFO_PORTABLE;
+#ifdef SA_THIRTYTWO
+ if (mips_flags & SA_THIRTYTWO) portable_flags |= SA_THIRTYTWO_PORTABLE;
+#endif
+ if (mips_flags & SA_RESTORER) portable_flags |= SA_RESTORER_PORTABLE;
+ if (mips_flags & SA_ONSTACK) portable_flags |= SA_ONSTACK_PORTABLE;
+ if (mips_flags & SA_RESTART) portable_flags |= SA_RESTART_PORTABLE;
+ if (mips_flags & SA_NODEFER) portable_flags |= SA_NODEFER_PORTABLE;
+ if (mips_flags & SA_RESETHAND) portable_flags |= SA_RESETHAND_PORTABLE;
+
+ ALOGV("%s(mips_flags:0x%x) return(portable_flags:0x%x);", __func__,
+ mips_flags, portable_flags);
+
+ return portable_flags;
+}
+
+
+/*
+ * Called by portable/ARM code, which we map and do MIPS system calls.
+ *
+ * The incoming system call used a Portable/ARM sigaction structure:
+ * ------------------------------------------------------------------
+ * struct sigaction_portable {
+ * union {
+ * __sighandler_portable_t _sa_handler;
+ * __sigaction_handler_portable_t _sa_sigaction;
+ * } _u;
+ * sigset_portable_t sa_mask;
+ * unsigned long sa_flags;
+ * void (*sa_restorer)(void);
+ * };
+ *
+ * A similar, but different, structure is used in the MIPS/Native system call:
+ * ---------------------------------------------------------------------------
+ * struct sigaction {
+ * unsigned int sa_flags;
+ * union {
+ * __sighandler_t sa_handler;
+ * __sigaction_handler_portable_t _sa_sigaction;
+ * } __u;
+ * sigset_t sa_mask;
+ * };
+ *
+ * This sigaction structure needs to be mapped before the MIPS systems call as well as after for
+ * returning the old/previous sigaction. Also, like signal_portable() above, we need to maintain
+ * a table of signal handlers that our intercepting handler can call after it converts the signal
+ * numbers.
+ */
+static int do_sigaction_portable(int portable_signum, const struct sigaction_portable *act,
+ struct sigaction_portable *oldact, sigaction_fn fn,
+ rt_sigaction_fn rt_fn)
+{
+ int mips_signum;
+ char *mips_signame;
+ struct sigaction mips_act;
+ struct sigaction *mips_act_ptr;
+ struct sigaction mips_oldact;
+ sighandler_t mips_handler;
+ sighandler_portable_t portable_handler;
+ sig3handler_portable_t prev_portable_handler;
+ char *portable_signame = map_portable_signum_to_name(portable_signum);
+ int rv;
+
+ ALOGV("%s(portable_signum:%d:'%s', act:%p, oldact:%p, fn:%p, rt_fn:%p) {", __func__,
+ portable_signum,
+ portable_signame, act, oldact, fn, rt_fn);
+
+ mips_signum = signum_pton(portable_signum);
+ mips_signame = map_mips_signum_to_name(mips_signum);
+
+ if ((portable_signum != 0) && (mips_signum == 0)) {
+ /* We got a portable signum that we can't map; Ignore the request */
+ rv = 0;
+ goto done;
+ }
+ if (portable_signum > 0 && portable_signum <= NSIG_PORTABLE)
+ prev_portable_handler = mips_portable_sighandler[portable_signum];
+ else
+ prev_portable_handler = NULL;
+
+ memset(&mips_act, 0, sizeof(mips_act));
+
+ if (invalid_pointer((void *)act)) {
+ mips_act_ptr = (struct sigaction *)act;
+ } else {
+ /*
+ * Make the MIPS version of sigaction, which has no sa_restorer function pointer.
+ * Also the handler will be called with a pointer to a to a sigcontext structure
+ * which is totally non-portable.
+ */
+ sigset_pton(((sigset_portable_t *)&act->sa_mask),
+ ((sigset_t *) &mips_act.sa_mask));
+
+ mips_act.sa_flags = sigaction_flags_pton(act->sa_flags);
+
+ if (mips_act.sa_flags & SA_SIGINFO) {
+ /*
+ * Providing the three argument version of a signal handler.
+ */
+ portable_handler = (sighandler_portable_t) act->sa_sigaction_portable;
+ if ((portable_signum <= 0) || (portable_signum > NSIG_PORTABLE)) {
+ /*
+ * Let the kernel generate the proper return value and set errno.
+ */
+ mips_act.sa_sigaction = (sig3handler_t) portable_handler;
+ } else {
+ mips_handler = sighandler_pton(portable_handler, 1);
+ if (mips_handler != portable_handler) {
+ mips_portable_sighandler[portable_signum] =
+ (sig3handler_portable_t) portable_handler;
+ }
+ mips_act.sa_sigaction = (sig3handler_t) mips_handler;
+ }
+ } else {
+ /*
+ * Providing the classic single argument version of a signal handler.
+ */
+ portable_handler = act->sa_handler_portable;
+ if ((portable_signum <= 0) || (portable_signum > NSIG_PORTABLE)) {
+ /*
+ * Let the kernel generate the proper return value and set errno.
+ */
+ mips_act.sa_handler = (sighandler_t) portable_handler;
+ } else {
+ mips_handler = sighandler_pton(portable_handler, 1);
+ if (mips_handler != portable_handler) {
+ mips_portable_sighandler[portable_signum] =
+ (sig3handler_portable_t) portable_handler;
+ }
+ mips_act.sa_handler = mips_handler;
+ }
+ }
+ mips_act_ptr = &mips_act;
+ }
+
+ if (fn != NULL) {
+ ASSERT(rt_fn == NULL);
+ rv = fn(mips_signum, mips_act_ptr, &mips_oldact);
+ } else {
+ ASSERT(rt_fn != NULL);
+ rv = rt_fn(mips_signum, mips_act_ptr, &mips_oldact, sizeof(sigset_t));
+ }
+
+ if (rv == 0 && oldact) {
+ if (mips_oldact.sa_sigaction == (__sigaction_handler_portable_t) mips_sigaction_handler ||
+ mips_oldact.sa_sigaction == (__sigaction_handler_portable_t) mips_sighandler) {
+
+ oldact->sa_sigaction_portable =
+ (__sigaction_handler_portable_t) prev_portable_handler;
+ } else {
+ oldact->sa_sigaction_portable =
+ (__sigaction_handler_portable_t) mips_oldact.sa_sigaction;
+ }
+ sigset_ntop((sigset_t *) &(mips_oldact.sa_mask),
+ (sigset_portable_t *) &(oldact->sa_mask));
+
+ oldact->sa_flags = sigaction_flags_ntop(mips_oldact.sa_flags);
+ oldact->sa_restorer = NULL;
+ }
+
+done:
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+int WRAP(sigaction)(int portable_signum, const struct sigaction_portable *act,
+ struct sigaction_portable *oldact)
+{
+ extern int REAL(sigaction)(int, const struct sigaction *, struct sigaction *);
+ int rv;
+
+ ALOGV(" ");
+ ALOGV("%s(portable_signum:%d, act:%p, oldact:%p) {", __func__,
+ portable_signum, act, oldact);
+
+ rv = do_sigaction_portable(portable_signum, act, oldact, REAL(sigaction), NULL);
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+/*
+ * Currently signalfd() isn't supported by bionic with
+ * only the portable syscall.c code using this code by
+ * intercepting the syscall(__NR_signalfd4, ...) in bionic.
+ */
+__hidden int do_signalfd4_portable(int fd, const sigset_portable_t *portable_sigmask,
+ int portable_sigsetsize, int portable_flags)
+{
+ sigset_t native_sigmask;
+ int native_sigsetsize = sizeof(native_sigmask);
+ int native_flags = 0;
+ int rv;
+
+ ALOGV("%s(fd:%d, portable_sigmask:%p, portable_sigsetsize:%d, portable_flags:0x%x) {",
+ __func__, fd, portable_sigmask, portable_sigsetsize, portable_flags);
+
+ sigset_pton((sigset_portable_t *)portable_sigmask, &native_sigmask);
+
+ if (portable_flags & SFD_NONBLOCK_PORTABLE) {
+ native_flags |= SFD_NONBLOCK;
+ }
+ if (portable_flags & SFD_CLOEXEC_PORTABLE) {
+ native_flags |= SFD_CLOEXEC;
+ }
+ rv = syscall(__NR_signalfd4, fd, &native_sigmask, native_sigsetsize, native_flags);
+
+ if (rv >= 0) {
+ if (native_flags & SFD_CLOEXEC) {
+ filefd_CLOEXEC_enabled(rv);
+ }
+
+ /*
+ * Reads on this file descriptor must be mapped to be portable.
+ * The mapping should survive a fork and most clones naturally.
+ * For the system call to be completely portable it has to propagate
+ * these mapped files after an execve(). Environment variables have
+ * been added to do that. See filefd.c for details.
+ */
+ filefd_opened(rv, SIGNAL_FD_TYPE);
+ }
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+#if 0
+/*
+ * signalfd() isn't available in Bionic yet. When it is, it will be implemented like
+ * the glibc version where the sigsetsize is computed in the bionic code and passed
+ * down to the kernel with __NR_signalfd4.
+ *
+ * This function can't be called from bionic, so there isn't an entry in the experimental
+ * linker.cpp table for testing and this function.
+ */
+int WRAP(signalfd)(int fd, const sigset_portable_t *portable_sigmask, int portable_flags)
+{
+ int portable_sigsetsize = sizeof(sigset_portable_t);
+ int rv;
+
+ ALOGV("%s(fd:%d, portable_sigmask:%p, portable_flags:0x%x) {", __func__,
+ fd, portable_sigmask, portable_flags);
+
+ rv = do_signalfd4_portable(fd, portable_sigsetsize, portable_sigmask, portable_flags);
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+#endif
+
+
+/*
+ * Called by read_portable() to do signalfd read() mapping.
+ */
+__hidden int read_signalfd_mapper(int fd, void *buf, size_t count)
+{
+ int rv;
+
+ ALOGV("%s(fd:%d, buf:0x%p, count:%d) {", __func__,
+ fd, buf, count);
+
+ rv = read(fd, buf, count);
+ if (rv > 0) {
+ int siginfos = rv/sizeof(struct signalfd_siginfo);
+ struct signalfd_siginfo *si = (struct signalfd_siginfo *) buf;
+ int i;
+
+ /* Read signalfd_siginfo structure(s) if read is large enough */
+ for (i = 0; i < siginfos; i++, si++) {
+ int ssi_signo;
+
+ ssi_signo = si->ssi_signo;
+ si->ssi_signo = signum_ntop(si->ssi_signo);
+ ALOGV("%s: si->ssi_signo:%d = signum_ntop(si->ssi_signo:%d); i:%d", __func__,
+ si->ssi_signo, ssi_signo, i);
+
+ si->ssi_errno = errno_ntop(si->ssi_errno);
+
+ /*
+ * The ssi_codes appear to be generic; defined in
+ * the kernel in include/asm-generic/siginfo.h
+ */
+ if (si->ssi_status > 0 && si->ssi_status <= NSIG) {
+ si->ssi_status = signum_ntop(si->ssi_status);
+ }
+
+ /*
+ * The rest of the struct members, like
+ * ssi_trapno, ssi_int, ssi_ptr
+ * are not likely worth dealing with.
+ */
+ }
+ }
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+int WRAP(sigsuspend)(const sigset_portable_t *portable_sigmask)
+{
+ int rv;
+ sigset_t mips_sigmask;
+
+ ALOGV("%s(portable_sigmask:%p) {", __func__, portable_sigmask);
+
+ if (invalid_pointer((void *)portable_sigmask)) {
+ *REAL(__errno)() = EFAULT;
+ rv = -1;
+ } else {
+ sigset_pton((sigset_portable_t *)portable_sigmask, &mips_sigmask);
+ rv = REAL(sigsuspend)(&mips_sigmask);
+ }
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+int WRAP(sigpending)(sigset_portable_t *portable_sigset)
+{
+ int rv;
+ sigset_t mips_sigset;
+
+ ALOGV("%s(portable_sigset:%p) {", __func__,
+ portable_sigset);
+
+ if (invalid_pointer((void *)portable_sigset)) {
+ *REAL(__errno)() = EFAULT;
+ rv = -1;
+ } else {
+ rv = REAL(sigpending)(&mips_sigset);
+ sigset_ntop(&mips_sigset, portable_sigset);
+ }
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+int WRAP(sigwait)(const sigset_portable_t *portable_sigset, int *ptr_to_portable_sig)
+{
+ int rv;
+ sigset_t mips_sigset;
+ int mips_sig;
+ int portable_sig;
+
+ ALOGV("%s(portable_sigset:%p, ptr_to_portable_sig:%p) {", __func__,
+ portable_sigset, ptr_to_portable_sig);
+
+ if (invalid_pointer((void *)portable_sigset)) {
+ *REAL(__errno)() = EFAULT;
+ rv = -1;
+ } else {
+ sigset_pton((sigset_portable_t *)portable_sigset, &mips_sigset);
+
+ rv = REAL(sigwait)(&mips_sigset, &mips_sig);
+
+ portable_sig = signum_ntop(mips_sig);
+ *ptr_to_portable_sig = portable_sig;
+ }
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+int WRAP(siginterrupt)(int portable_signum, int flag)
+
+{
+ int rv;
+ int mips_signum;
+
+ ALOGV("%s(portable_signum:%d, flag:0x%x) {", __func__,
+ portable_signum, flag);
+
+ mips_signum = signum_pton(portable_signum);
+
+ if ((portable_signum != 0) && (mips_signum == 0)) {
+ ALOGE("%s: Unsupported portable_signum:%d; Ignoring.", __func__,
+ portable_signum);
+ rv = 0;
+ } else {
+ rv = REAL(siginterrupt)(mips_signum, flag);
+ }
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+__hidden int do_sigmask(int portable_how, const sigset_portable_t *portable_sigset,
+ sigset_portable_t *portable_oldset, sigmask_fn fn,
+ rt_sigmask_fn rt_fn)
+{
+ int rv;
+ int how;
+ char *how_name;
+ sigset_t mips_sigset, *mips_sigset_p;
+ sigset_t mips_oldset, *mips_oldset_p;
+
+ ALOGV("%s(portable_how:%d, portable_sigset:%p, portable_oldset:%p, fn:%p, rt_fn:%p) {",
+ __func__, portable_how, portable_sigset, portable_oldset, fn, rt_fn);
+
+ switch(portable_how) {
+ case SIG_BLOCK_PORTABLE: how = SIG_BLOCK; how_name = "SIG_BLOCK"; break;
+ case SIG_UNBLOCK_PORTABLE: how = SIG_UNBLOCK; how_name = "SIG_UNBLOCK"; break;
+ case SIG_SETMASK_PORTABLE: how = SIG_SETMASK; how_name = "SIG_SETMASK"; break;
+
+ default:
+ ALOGE("%s: portable_how:%d NOT SUPPORTED!", __func__, portable_how);
+ how = -1;
+ break;
+ }
+
+ if (invalid_pointer((void *)portable_sigset)) {
+ mips_sigset_p = (sigset_t *) portable_sigset;
+ } else {
+ mips_sigset_p = &mips_sigset;
+ memset(mips_sigset_p, 0, sizeof(mips_sigset));
+ sigemptyset(mips_sigset_p);
+ sigset_pton((sigset_portable_t *)portable_sigset, &mips_sigset);
+ }
+
+ if (invalid_pointer((void *)portable_oldset)) {
+ mips_oldset_p = (sigset_t *) portable_oldset;
+ } else {
+ mips_oldset_p = &mips_oldset;
+ memset(mips_oldset_p, 0, sizeof(mips_oldset));
+ sigemptyset(mips_oldset_p);
+ }
+
+ if (fn != NULL) {
+ ASSERT(rt_fn == NULL);
+ rv = fn(how, mips_sigset_p, mips_oldset_p);
+ } else {
+ ASSERT(rt_fn != NULL);
+ rv = rt_fn(how, mips_sigset_p, mips_oldset_p, sizeof(sigset_t));
+ }
+
+ if (rv == 0 && !invalid_pointer(portable_oldset)) {
+ /* Map returned mips_oldset to portable_oldset for return to caller */
+ sigset_ntop(mips_oldset_p, portable_oldset);
+ }
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+int WRAP(sigprocmask)(int portable_how, const sigset_portable_t *portable_sigset,
+ sigset_portable_t *portable_oldset)
+{
+ extern int REAL(sigprocmask)(int, const sigset_t *, sigset_t *);
+ int rv;
+
+ ALOGV(" ");
+ ALOGV("%s(portable_how:%d, portable_sigset:%p, portable_oldset:%p) {", __func__,
+ portable_how, portable_sigset, portable_oldset);
+
+ rv = do_sigmask(portable_how, portable_sigset, portable_oldset, REAL(sigprocmask), NULL);
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+int WRAP(__rt_sigaction)(int portable_signum, const struct sigaction_portable *act,
+ struct sigaction_portable *oldact, size_t sigsetsize)
+{
+ extern int REAL(__rt_sigaction)(int , const struct sigaction *, struct sigaction *, size_t);
+ int rv;
+
+ ALOGV(" ");
+ ALOGV("%s(portable_signum:%d, act:%p, oldset:%p, sigsetsize:%d) {", __func__,
+ portable_signum, act, oldact, sigsetsize);
+
+ /* NOTE: ARM kernel is expecting sizeof(sigset_t) to be 8 bytes */
+ if (sigsetsize != (2* sizeof(long))) {
+ *REAL(__errno)() = EINVAL;
+ rv = -1;
+ goto done;
+ }
+ rv = do_sigaction_portable(portable_signum, act, oldact, NULL, REAL(__rt_sigaction));
+
+done:
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+int WRAP(__rt_sigprocmask)(int portable_how,
+ const sigset_portable_t *portable_sigset,
+ sigset_portable_t *portable_oldset,
+ size_t sigsetsize)
+{
+ extern int REAL(__rt_sigprocmask)(int, const sigset_t *, sigset_t *, size_t);
+ int rv;
+
+ ALOGV(" ");
+ ALOGV("%s(portable_how:%d, portable_sigset:%p, portable_oldset:%p, sigsetsize:%d) {",
+ __func__, portable_how, portable_sigset, portable_oldset, sigsetsize);
+
+ /* NOTE: ARM kernel is expecting sizeof(sigset_t) to be 8 bytes */
+ if (sigsetsize != (2* sizeof(long))) {
+ *REAL(__errno)() = EINVAL;
+ rv = -1;
+ goto done;
+ }
+ rv = do_sigmask(portable_how, portable_sigset, portable_oldset, NULL, REAL(__rt_sigprocmask));
+
+ done:
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+
+ return rv;
+}
+
+
+int WRAP(__rt_sigtimedwait)(const sigset_portable_t *portable_sigset,
+ siginfo_portable_t *portable_siginfo,
+ const struct timespec *timeout,
+ size_t portable_sigsetsize)
+{
+ extern int REAL(__rt_sigtimedwait)(const sigset_t *, siginfo_t *, const struct timespec *, size_t);
+
+ sigset_t native_sigset_struct;
+ sigset_t *native_sigset = &native_sigset_struct;
+ siginfo_t native_siginfo_struct;
+ siginfo_t *native_siginfo;
+ int rv;
+
+ ALOGV(" ");
+ ALOGV("%s(portable_sigset:%p, portable_siginfo:%p, timeout:%p, portable_sigsetsize:%d) {",
+ __func__, portable_sigset, portable_siginfo, timeout, portable_sigsetsize);
+
+ /* NOTE: ARM kernel is expecting sizeof(sigset_t) to be 8 bytes */
+ if (portable_sigsetsize != (2* sizeof(long))) {
+ *REAL(__errno)() = EINVAL;
+ rv = -1;
+ goto done;
+ }
+ if (portable_sigset == NULL) {
+ native_sigset = NULL;
+ } else {
+ sigset_pton((sigset_portable_t *)portable_sigset, native_sigset);
+ }
+ if (portable_siginfo == NULL) {
+ native_siginfo = NULL;
+ } else {
+ native_siginfo = &native_siginfo_struct;
+ }
+ rv = REAL(__rt_sigtimedwait)(native_sigset, native_siginfo, timeout, sizeof(sigset_t));
+ if (rv == 0 && native_siginfo != NULL) {
+ /* Map siginfo struct from native to portable format. */
+ siginfo_ntop(native_siginfo, portable_siginfo);
+ }
+
+done:
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+#ifdef __NR_rt_sigqueueinfo
+
+#if 0
+/*
+ * sigqueue():
+ * This function became available in UNIX GLIBC after 1993.
+ * It's not available in any versions of Android yet, and
+ * it can't be called via syscall(). It's been useful for
+ * testing with the LTP by the posix testsuite, and tests
+ * show that it works fine.
+ *
+ * NOTE:
+ * Android has in incorrect limit on the number of queueable signals
+ * defined in libc/unistd/sysconf.c:
+ *
+ * #define SYSTEM_SIGQUEUE_MAX 32
+ *
+ * sigqueue() must return EAGAIN if exceeded and we don't on Android.
+ */
+int WRAP(sigqueue)(pid_t pid, int portable_sig, const union sigval value)
+{
+ siginfo_t native_siginfo;
+ siginfo_t *native_sip;
+ siginfo_portable_t portable_siginfo;
+ siginfo_portable_t *portable_sip;
+ int native_sig;
+ int rv;
+
+ ALOGV(" ");
+ ALOGV("%s(pid:%d, portable_sig:%d, value:%p) {", __func__,
+ pid, portable_sig, value.sival_ptr);
+
+ native_sig = signum_pton(portable_sig);
+ native_sip = &native_siginfo;
+
+ portable_sip = &portable_siginfo;
+ portable_sip->si_signo = 0; /* Filled in by the kernel */
+ portable_sip->si_code = SI_QUEUE;
+ portable_sip->si_pid = getpid(); /* Process ID of sender */
+ portable_sip->si_uid = getuid(); /* Real UID of sender */
+ portable_sip->si_value = value; /* Last arg supplied */
+
+ siginfo_pton(portable_sip, native_sip);
+
+ /*
+ * man page says sigqueue() is implemented via rt_sigqueueinfo().
+ */
+ ALOGV("%s: calling syscall(__NR_rt_sigqueueinfo:%d, pid:%d, native_sig:%d, native_sip:%p);",
+ __func__, __NR_rt_sigqueueinfo, pid, native_sig, native_sip);
+
+ rv = syscall(__NR_rt_sigqueueinfo, pid, native_sig, native_sip);
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+#endif
+
+
+/*
+ * Real Time version of sigqueueinfo().
+ */
+int WRAP(rt_sigqueueinfo)(pid_t pid, int portable_sig, siginfo_portable_t *portable_sip)
+{
+ int native_sig;
+ siginfo_t native_siginfo, *native_sip;
+ int rv;
+
+ ALOGV(" ");
+ ALOGV("%s(pid:%d, portable_sig:%d, portable_sip:%p) {", __func__,
+ pid, portable_sig, portable_sip);
+
+ native_sig = signum_pton(portable_sig);
+
+ if (portable_sip != NULL) {
+ native_sip = &native_siginfo;
+ siginfo_pton(portable_sip, native_sip);
+ } else {
+ native_sip = NULL;
+ }
+ rv = syscall(__NR_rt_sigqueueinfo, pid, native_sig, native_sip);
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+#endif /* __NR_rt_sigqueueinfo */
+
+
+#ifdef __NR_rt_tgsigqueueinfo
+/*
+ * Thread Group flavor of the real time version of sigqueueinfo().
+ */
+int WRAP(rt_tgsigqueueinfo)(pid_t tgid, pid_t pid, int portable_sig,
+ siginfo_portable_t *portable_sip)
+{
+ siginfo_t native_siginfo, *native_sip;
+ int native_sig;
+ int rv;
+
+ ALOGV(" ");
+ ALOGV("%s(tgid:%d, pid:%d, portable_sig:%d, portable_sip:%p) {", __func__,
+ tgid, pid, portable_sig, portable_sip);
+
+ native_sig = signum_pton(portable_sig);
+
+ if (portable_sip != NULL) {
+ native_sip = &native_siginfo;
+ siginfo_pton(portable_sip, native_sip);
+ } else {
+ native_sip = NULL;
+ }
+ rv = syscall(__NR_rt_tgsigqueueinfo, pid, native_sig, native_sip);
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+#endif /* __NR_rt_tgsigqueueinfo */
+
+
+/*
+ * ss_flags and ss_size are located in different locations in stack_t structure:
+ *
+ * Incomming ARM/Portable stack_t: Outgoing MIPS stack_t:
+ * ------------------------------- ----------------------------
+ * typedef struct sigaltstack { typedef struct sigaltstack {
+ * void __user *ss_sp; void *ss_sp;
+ * int ss_flags; size_t ss_size;
+ * size_t ss_size; int ss_flags;
+ * } stack_t;
+ *
+ */
+int WRAP(sigaltstack)(const portable_stack_t *ss, portable_stack_t *oss)
+{
+ int rv;
+ stack_t new_stack, *mips_ss;
+ stack_t old_stack, *mips_oss;
+
+ ALOGV(" ");
+ ALOGV("%s(ss:%p, oss:%p) {", __func__, ss, oss);
+
+ if (ss == NULL) {
+ mips_ss = NULL;
+ } else {
+ if (invalid_pointer((void *)ss)) {
+ ALOGE("%s: invalid_pointer(ss:%p): Let kernel set proper errno and set return value.",
+ __func__, ss);
+
+ mips_ss = (stack_t *) ss;
+ } else {
+ memset(&new_stack, 0, sizeof(stack_t));
+ new_stack.ss_sp = ss->ss_sp;
+ new_stack.ss_flags = ss->ss_flags;
+ new_stack.ss_size = ss->ss_size;
+ mips_ss = &new_stack;
+ }
+ }
+ if (oss == NULL) {
+ mips_oss = NULL;
+ } else {
+ if (invalid_pointer((void *)oss)) {
+ ALOGE("%s: invalid_pointer(oss:%p): Let kernel set proper errno and return value.",
+ __func__, oss);
+
+ mips_oss = (stack_t *)oss;
+ } else {
+ memset(&old_stack, 0, sizeof(stack_t));
+ mips_oss = &old_stack;
+ }
+ }
+
+ rv = REAL(sigaltstack)(mips_ss, mips_oss);
+
+ if (!invalid_pointer(oss)) {
+ oss->ss_sp = old_stack.ss_sp;
+ oss->ss_flags = old_stack.ss_flags;
+ oss->ss_size = old_stack.ss_size;
+ }
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+
+ return rv;
+}
diff --git a/ndk/sources/android/libportable/arch-mips/sigsetjmp.S b/ndk/sources/android/libportable/arch-mips/sigsetjmp.S
new file mode 100644
index 000000000..237d46b50
--- /dev/null
+++ b/ndk/sources/android/libportable/arch-mips/sigsetjmp.S
@@ -0,0 +1,78 @@
+/* Derived from: $OpenBSD: sigsetjmp.S,v 1.5 2005/08/07 16:40:15 espie Exp $ */
+/*-
+ * Copyright (c) 1991, 1993, 1995,
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Havard Eidnes.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <asm-generic/portability.h>
+#include <machine/asm.h>
+#include <machine/regnum.h>
+
+#include "jboffsets.h"
+
+/*
+ * trampolines for sigsetjmp and siglongjmp save and restore mask.
+ */
+FRAMESZ= MKFSIZ(1,1)
+GPOFF= FRAMESZ-2*REGSZ
+
+LEAF(WRAP(sigsetjmp), FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, sigsetjmp)
+ .set reorder
+ REG_S a1, JB_SAVEMASK(a0) # save "savemask"
+ bne a1, 0x0, 1f # do saving of signal mask?
+ LA t9, _setjmp_portable
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
+ jr t9
+
+1: LA t9, WRAP(setjmp)
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
+ jr t9
+END(WRAP(sigsetjmp))
+
+LEAF(WRAP(siglongjmp), FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, WRAP(siglongjmp))
+ .set reorder
+ REG_L t0, JB_SAVEMASK(a0) # get "savemask"
+ bne t0, 0x0, 1f # restore signal mask?
+ LA t9, _longjmp_portable
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
+ jr t9
+1:
+ LA t9, WRAP(longjmp)
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
+ jr t9
+END(WRAP(siglongjmp))
diff --git a/ndk/sources/android/libportable/arch-mips/socket.c b/ndk/sources/android/libportable/arch-mips/socket.c
index 51b8db028..be2c7e6ed 100644
--- a/ndk/sources/android/libportable/arch-mips/socket.c
+++ b/ndk/sources/android/libportable/arch-mips/socket.c
@@ -14,31 +14,248 @@
* limitations under the License.
*/
+#include <portability.h>
#include <unistd.h>
#include <sys/socket.h>
-#include <sys/linux-syscalls.h>
+#include <fcntl.h>
+#include <netdb.h>
+
#include <socket_portable.h>
+#include <fcntl_portable.h>
+#include <netdb_portable.h>
+#include <portability.h>
+
+#define PORTABLE_TAG "socket_portable"
+#include <log_portable.h>
#if SOCK_STREAM==SOCK_STREAM_PORTABLE
#error Bad build environment
#endif
-static inline int mips_change_type(int type)
+/* LTP defaults to using O_NONBLOCK if SOCK_NONBLOCK is not defined. */
+#ifndef SOCK_NONBLOCK_PORTABLE
+# define SOCK_NONBLOCK_PORTABLE O_NONBLOCK_PORTABLE
+#endif
+#ifndef SOCK_NONBLOCK
+# define SOCK_NONBLOCK O_NONBLOCK
+#endif
+
+/* Current NDK headers do not define SOCK_CLOEXEC or O_CLOEXEC */
+#if !defined(SOCK_CLOEXEC_PORTABLE) && defined(O_CLOEXEC_PORTABLE)
+# define SOCK_CLOEXEC_PORTABLE O_CLOEXEC_PORTABLE
+#endif
+#if !defined(SOCK_CLOEXEC) && defined(O_CLOEXEC)
+# define SOCK_CLOEXEC O_CLOEXEC
+#endif
+
+
+/*
+ * Portable to Native socktype mapper.
+ */
+static inline int socktype_pton(int portable_type)
{
- switch (type) {
- case SOCK_STREAM_PORTABLE: return SOCK_STREAM;
- case SOCK_DGRAM_PORTABLE: return SOCK_DGRAM;
- case SOCK_RAW_PORTABLE: return SOCK_RAW;
- case SOCK_RDM_PORTABLE: return SOCK_RDM;
- case SOCK_SEQPACKET_PORTABLE: return SOCK_SEQPACKET;
- case SOCK_PACKET_PORTABLE: return SOCK_PACKET;
- }
- return type;
+ int native_type = 0;
+
+ ALOGV("%s(portable_type:0x%x) {", __func__, portable_type);
+
+ if (portable_type & SOCK_NONBLOCK_PORTABLE) {
+ native_type |= SOCK_NONBLOCK;
+ portable_type &= ~SOCK_NONBLOCK_PORTABLE;
+ }
+
+#if defined(SOCK_CLOEXEC_PORTABLE) && defined(SOCK_CLOEXEC)
+ if (portable_type & SOCK_CLOEXEC_PORTABLE) {
+ native_type |= SOCK_CLOEXEC;
+ portable_type &= ~SOCK_CLOEXEC_PORTABLE;
+ }
+#endif
+
+ switch (portable_type) {
+ case SOCK_STREAM_PORTABLE: native_type |= SOCK_STREAM; break;
+ case SOCK_DGRAM_PORTABLE: native_type |= SOCK_DGRAM; break;
+ case SOCK_RAW_PORTABLE: native_type |= SOCK_RAW; break;
+ case SOCK_RDM_PORTABLE: native_type |= SOCK_RDM; break;
+ case SOCK_SEQPACKET_PORTABLE: native_type |= SOCK_SEQPACKET; break;
+ case SOCK_PACKET_PORTABLE: native_type |= SOCK_PACKET; break;
+ default:
+ ALOGE("%s: case default: native_type:0x%x |= portable_type:0x%x:[UNKNOWN!];", __func__,
+ native_type, portable_type);
+
+ native_type |= portable_type;
+ break;
+ }
+ ALOGV("%s: return(native_type:%d); }", __func__, native_type);
+ return native_type;
+}
+
+
+/*
+ * Native to Portable socktype mapper.
+ */
+static inline int socktype_ntop(int native_type)
+{
+ int portable_type = 0;
+
+ ALOGV("%s(native_type:0x%x) {", __func__, native_type);
+
+ if (native_type & SOCK_NONBLOCK) {
+ portable_type |= SOCK_NONBLOCK_PORTABLE;
+ native_type &= ~SOCK_NONBLOCK;
+ }
+
+#if defined(SOCK_CLOEXEC_PORTABLE) && defined(SOCK_CLOEXEC)
+ if (native_type & SOCK_CLOEXEC) {
+ portable_type |= SOCK_CLOEXEC_PORTABLE;
+ native_type &= ~SOCK_CLOEXEC;
+ }
+#endif
+
+ switch (native_type) {
+ case SOCK_STREAM: portable_type |= SOCK_STREAM_PORTABLE; break;
+ case SOCK_DGRAM: portable_type |= SOCK_DGRAM_PORTABLE; break;
+ case SOCK_RAW: portable_type |= SOCK_RAW_PORTABLE; break;
+ case SOCK_RDM: portable_type |= SOCK_RDM_PORTABLE; break;
+ case SOCK_SEQPACKET: portable_type |= SOCK_SEQPACKET_PORTABLE; break;
+ case SOCK_PACKET: portable_type |= SOCK_PACKET_PORTABLE; break;
+ default:
+ portable_type |= native_type;
+ ALOGE("%s: case default: portable_type:0x%x |= native_type:0x%x:[UNKNOWN!];", __func__,
+ portable_type, native_type);
+ }
+ ALOGV("%s: return(portable_type:%d); }", __func__, portable_type);
+ return portable_type;
}
-extern int socket(int, int, int);
-int socket_portable(int domain, int type, int protocol) {
- return socket(domain, mips_change_type(type), protocol);
+extern int REAL(socket)(int, int, int);
+
+int WRAP(socket)(int domain, int type, int protocol) {
+ int rv;
+
+ ALOGV(" ");
+ ALOGV("%s(domain:%d, type:%d, protocol:%d) {", __func__,
+ domain, type, protocol);
+
+ rv = REAL(socket)(domain, socktype_pton(type), protocol);
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+int WRAP(socketpair)(int domain, int type, int protocol, int sv[2]) {
+ int rv;
+
+ ALOGV(" ");
+ ALOGV("%s(domain:%d, type:%d, protocol:%d, sv[2]:%p) {", __func__,
+ domain, type, protocol, sv);
+
+ rv = REAL(socketpair)(domain, socktype_pton(type), protocol, sv);
+
+ if ((rv != 0) || invalid_pointer(sv)) {
+ ALOGV("%s: return(rv:%d); }", __func__,
+ rv);
+ } else {
+ ALOGV("%s: return(rv:%d); sv[0]:%d; sv[1]:%d;}", __func__,
+ rv, sv[0], sv[1]);
+ }
+ return rv;
+}
+
+#define PRINT_ADDRINFO(p) { \
+ ALOGV("%s: p:%p->{ai_flags:%d, ai_family:%d, ai_socktype:%d, ai_protocol:%d, ...", __func__, \
+ p, p->ai_flags, p->ai_family, p->ai_socktype, p->ai_protocol); \
+ \
+ ALOGV("%s: p:%p->{... ai_addrlen:%d, ai_addr:%p, ai_canonname:%p, p->ai_next:%p);", __func__,\
+ p, p->ai_addrlen, p->ai_addr, p->ai_canonname, p->ai_next); \
+}
+
+/*
+ * Returns a list of portable addrinfo structures that are
+ * later made free with a call to the portable version of
+ * freeaddrinfo(); which is written below this function.
+ */
+int WRAP(getaddrinfo)(const char *node, const char *service,
+ struct addrinfo_portable *portable_hints,
+ struct addrinfo_portable **portable_results)
+{
+ int rv;
+ struct addrinfo *native_hints;
+ struct addrinfo **native_results, *rp;
+ int saved_portable_socktype;
+
+ ALOGV(" ");
+ ALOGV("%s(node:%p, service:%p, portable_hints:%p, portable_results:%p) {", __func__,
+ node, service, portable_hints, portable_results);
+
+ PRINT_ADDRINFO(portable_hints);
+
+ /*
+ * The only part of the addrinfo structure that needs to be modified
+ * between ARM and MIPS is the socktype;
+ */
+ ASSERT(sizeof(struct addrinfo_portable) == sizeof(struct addrinfo));
+ native_hints = ((struct addrinfo *) portable_hints);
+ if (native_hints != NULL) {
+ saved_portable_socktype = portable_hints->ai_socktype;
+ native_hints->ai_socktype = socktype_pton(saved_portable_socktype);
+ }
+ ASSERT(portable_results != NULL);
+ native_results = (struct addrinfo **) portable_results;
+
+ rv = REAL(getaddrinfo)(node, service, native_hints, native_results);
+
+ if (native_hints != NULL) {
+ portable_hints->ai_socktype = saved_portable_socktype;
+ }
+
+
+ /*
+ * Map socktypes in the return list of addrinfo structures from native to portable.
+ * Assuming getaddrinfo() has left structure writeable and the list is generated
+ * on each call. This seems to be true when looking at the man page and the code
+ * at:
+ * ./bionic/libc/netbsd/net/getaddrinfo.c
+ */
+ for (rp = *native_results; rp != NULL; rp = rp->ai_next) {
+ PRINT_ADDRINFO(rp);
+ rp->ai_socktype = socktype_ntop(rp->ai_socktype);
+ }
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
+
+/*
+ * Free the results list returned from a previous call
+ * to the portable version of getaddrinfo().
+ */
+void WRAP(freeaddrinfo)(struct addrinfo_portable *portable_results)
+{
+ struct addrinfo *native_results, *rp;
+
+ ALOGV(" ");
+ ALOGV("%s(portable_results:%p) {", __func__, portable_results);
+
+ PRINT_ADDRINFO(portable_results);
+
+ /*
+ * The only part of each addrinfo structure that needs to be modified
+ * between ARM and MIPS is the socktype;
+ *
+ * Map socktypes in the return list of iportable addrinfo structures back to native.
+ * Again, assuming getaddrinfo() has left structure writeable and the list is generated
+ * on each call. This seems to be true when looking at the man page and the code.
+ */
+ ASSERT(sizeof(struct addrinfo_portable) == sizeof(struct addrinfo));
+ native_results = ((struct addrinfo *) portable_results);
+ for (rp = native_results; rp != NULL; rp = rp->ai_next) {
+ PRINT_ADDRINFO(rp);
+ rp->ai_socktype = socktype_pton(rp->ai_socktype); /* Likely not really necessary */
+ }
+ REAL(freeaddrinfo)(native_results);
+
+ ALOGV("%s: return; }", __func__);
+ return;
}
diff --git a/ndk/sources/android/libportable/arch-mips/sockopt.c b/ndk/sources/android/libportable/arch-mips/sockopt.c
index fda404956..6c7ec51a8 100644
--- a/ndk/sources/android/libportable/arch-mips/sockopt.c
+++ b/ndk/sources/android/libportable/arch-mips/sockopt.c
@@ -14,11 +14,11 @@
* limitations under the License.
*/
+#include <portability.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <socket_portable.h>
-
#if SOL_SOCKET_PORTABLE==SOL_SOCKET
#error Build environment
#endif
@@ -27,8 +27,8 @@ static inline int mips_change_level(int level)
{
switch (level) {
case SOL_SOCKET_PORTABLE:
- level = SOL_SOCKET;
- break;
+ level = SOL_SOCKET;
+ break;
}
return level;
}
@@ -38,83 +38,83 @@ static inline int mips_change_optname(int optname)
{
switch (optname) {
case SO_DEBUG_PORTABLE:
- return SO_DEBUG;
+ return SO_DEBUG;
case SO_REUSEADDR_PORTABLE:
- return SO_REUSEADDR;
+ return SO_REUSEADDR;
case SO_TYPE_PORTABLE:
- return SO_TYPE;
+ return SO_TYPE;
case SO_ERROR_PORTABLE:
- return SO_ERROR;
+ return SO_ERROR;
case SO_DONTROUTE_PORTABLE:
- return SO_DONTROUTE;
+ return SO_DONTROUTE;
case SO_BROADCAST_PORTABLE:
- return SO_BROADCAST;
+ return SO_BROADCAST;
case SO_SNDBUF_PORTABLE:
- return SO_SNDBUF;
+ return SO_SNDBUF;
case SO_RCVBUF_PORTABLE:
- return SO_RCVBUF;
+ return SO_RCVBUF;
case SO_SNDBUFFORCE_PORTABLE:
- return SO_SNDBUFFORCE;
+ return SO_SNDBUFFORCE;
case SO_RCVBUFFORCE_PORTABLE:
- return SO_RCVBUFFORCE;
+ return SO_RCVBUFFORCE;
case SO_KEEPALIVE_PORTABLE:
- return SO_KEEPALIVE;
+ return SO_KEEPALIVE;
case SO_OOBINLINE_PORTABLE:
- return SO_OOBINLINE;
+ return SO_OOBINLINE;
case SO_NO_CHECK_PORTABLE:
- return SO_NO_CHECK;
+ return SO_NO_CHECK;
case SO_PRIORITY_PORTABLE:
- return SO_PRIORITY;
+ return SO_PRIORITY;
case SO_LINGER_PORTABLE:
- return SO_LINGER;
+ return SO_LINGER;
case SO_BSDCOMPAT_PORTABLE:
- return SO_BSDCOMPAT;
+ return SO_BSDCOMPAT;
case SO_PASSCRED_PORTABLE:
- return SO_PASSCRED;
+ return SO_PASSCRED;
case SO_PEERCRED_PORTABLE:
- return SO_PEERCRED;
+ return SO_PEERCRED;
case SO_RCVLOWAT_PORTABLE:
- return SO_RCVLOWAT;
+ return SO_RCVLOWAT;
case SO_SNDLOWAT_PORTABLE:
- return SO_SNDLOWAT;
+ return SO_SNDLOWAT;
case SO_RCVTIMEO_PORTABLE:
- return SO_RCVTIMEO;
+ return SO_RCVTIMEO;
case SO_SNDTIMEO_PORTABLE:
- return SO_SNDTIMEO;
+ return SO_SNDTIMEO;
case SO_SECURITY_AUTHENTICATION_PORTABLE:
- return SO_SECURITY_AUTHENTICATION;
+ return SO_SECURITY_AUTHENTICATION;
case SO_SECURITY_ENCRYPTION_TRANSPORT_PORTABLE:
- return SO_SECURITY_ENCRYPTION_TRANSPORT;
+ return SO_SECURITY_ENCRYPTION_TRANSPORT;
case SO_SECURITY_ENCRYPTION_NETWORK_PORTABLE:
- return SO_SECURITY_ENCRYPTION_NETWORK;
+ return SO_SECURITY_ENCRYPTION_NETWORK;
case SO_BINDTODEVICE_PORTABLE:
- return SO_BINDTODEVICE;
+ return SO_BINDTODEVICE;
case SO_ATTACH_FILTER_PORTABLE:
- return SO_ATTACH_FILTER;
+ return SO_ATTACH_FILTER;
case SO_DETACH_FILTER_PORTABLE:
- return SO_DETACH_FILTER;
+ return SO_DETACH_FILTER;
case SO_PEERNAME_PORTABLE:
- return SO_PEERNAME;
+ return SO_PEERNAME;
case SO_TIMESTAMP_PORTABLE:
- return SO_TIMESTAMP;
+ return SO_TIMESTAMP;
case SO_ACCEPTCONN_PORTABLE:
- return SO_ACCEPTCONN;
+ return SO_ACCEPTCONN;
case SO_PEERSEC_PORTABLE:
- return SO_PEERSEC;
+ return SO_PEERSEC;
case SO_PASSSEC_PORTABLE:
- return SO_PASSSEC;
+ return SO_PASSSEC;
}
return optname;
}
extern int setsockopt(int, int, int, const void *, socklen_t);
-int setsockopt_portable(int s, int level, int optname, const void *optval, socklen_t optlen)
+int WRAP(setsockopt)(int s, int level, int optname, const void *optval, socklen_t optlen)
{
- return setsockopt(s, mips_change_level(level), mips_change_optname(optname), optval, optlen);
+ return REAL(setsockopt)(s, mips_change_level(level), mips_change_optname(optname), optval, optlen);
}
extern int getsockopt (int, int, int, void *, socklen_t *);
-int getsockopt_portable(int s, int level, int optname, void *optval, socklen_t *optlen)
+int WRAP(getsockopt)(int s, int level, int optname, void *optval, socklen_t *optlen)
{
- return getsockopt(s, mips_change_level(level), mips_change_optname(optname), optval, optlen);
+ return REAL(getsockopt)(s, mips_change_level(level), mips_change_optname(optname), optval, optlen);
}
diff --git a/ndk/sources/android/libportable/arch-mips/stat.c b/ndk/sources/android/libportable/arch-mips/stat.c
index 6af5eeeb9..8706f86e5 100644
--- a/ndk/sources/android/libportable/arch-mips/stat.c
+++ b/ndk/sources/android/libportable/arch-mips/stat.c
@@ -14,37 +14,64 @@
* limitations under the License.
*/
+#include <portability.h>
+#include <errno.h>
+#include <errno_portable.h>
#include <stat_portable.h>
/* Note: The Portable Header will define stat to stat_portable */
-int stat_portable(const char *path, struct stat_portable *s)
+int WRAP(stat)(const char *path, struct stat_portable *s)
{
struct stat mips_stat;
- int ret = stat(path, &mips_stat);
+ int ret;
+
+ if (invalid_pointer(s)) {
+ *REAL(__errno)() = EFAULT;
+ return -1;
+ }
+ ret = REAL(stat)(path, &mips_stat);
stat_ntop(&mips_stat, s);
return ret;
}
-int fstat_portable(int fd, struct stat_portable *s)
+int WRAP(fstat)(int fd, struct stat_portable *s)
{
struct stat mips_stat;
- int ret = fstat(fd, &mips_stat);
+ int ret;
+
+ if (invalid_pointer(s)) {
+ *REAL(__errno)() = EFAULT;
+ return -1;
+ }
+ ret = REAL(fstat)(fd, &mips_stat);
stat_ntop(&mips_stat, s);
return ret;
}
-int lstat_portable(const char *path, struct stat_portable *s)
+int WRAP(lstat)(const char *path, struct stat_portable *s)
{
struct stat mips_stat;
- int ret = lstat(path, &mips_stat);
+ int ret;
+
+ if (invalid_pointer(s)) {
+ *REAL(__errno)() = EFAULT;
+ return -1;
+ }
+ ret = REAL(lstat)(path, &mips_stat);
stat_ntop(&mips_stat, s);
return ret;
}
-int fstatat_portable(int dirfd, const char *path, struct stat_portable *s, int flags)
+int WRAP(fstatat)(int dirfd, const char *path, struct stat_portable *s, int flags)
{
struct stat mips_stat;
- int ret = fstatat(dirfd, path, &mips_stat, flags);
+ int ret;
+
+ if (invalid_pointer(s)) {
+ *REAL(__errno)() = EFAULT;
+ return -1;
+ }
+ ret = REAL(fstatat)(dirfd, path, &mips_stat, flags);
stat_ntop(&mips_stat, s);
return ret;
}
diff --git a/ndk/sources/android/libportable/arch-mips/statfs.c b/ndk/sources/android/libportable/arch-mips/statfs.c
index cd8b5afac..45dfd093a 100644
--- a/ndk/sources/android/libportable/arch-mips/statfs.c
+++ b/ndk/sources/android/libportable/arch-mips/statfs.c
@@ -14,8 +14,11 @@
* limitations under the License.
*/
-#include <statfs_portable.h>
+#include <portability.h>
#include <string.h>
+#include <errno.h>
+#include <errno_portable.h>
+#include <statfs_portable.h>
static inline void statfs_ntop(struct statfs *n_statfs, struct statfs_portable *p_statfs)
{
@@ -32,18 +35,30 @@ static inline void statfs_ntop(struct statfs *n_statfs, struct statfs_portable *
p_statfs->f_frsize = n_statfs->f_frsize;
}
-int statfs_portable(const char* path, struct statfs_portable* stat)
+int WRAP(statfs)(const char* path, struct statfs_portable* stat)
{
struct statfs mips_stat;
- int ret = statfs(path, &mips_stat);
+ int ret;
+
+ if (invalid_pointer(stat)) {
+ *REAL(__errno)() = EFAULT;
+ return -1;
+ }
+ ret = REAL(statfs)(path, &mips_stat);
statfs_ntop(&mips_stat, stat);
return ret;
}
-int fstatfs_portable(int fd, struct statfs_portable* stat)
+int WRAP(fstatfs)(int fd, struct statfs_portable* stat)
{
struct statfs mips_stat;
- int ret = fstatfs(fd, &mips_stat);
+ int ret;
+
+ if (invalid_pointer(stat)) {
+ *REAL(__errno)() = EFAULT;
+ return -1;
+ }
+ ret = REAL(fstatfs)(fd, &mips_stat);
statfs_ntop(&mips_stat, stat);
return ret;
}
diff --git a/ndk/sources/android/libportable/arch-mips/syscall.c b/ndk/sources/android/libportable/arch-mips/syscall.c
new file mode 100644
index 000000000..5e31b80e1
--- /dev/null
+++ b/ndk/sources/android/libportable/arch-mips/syscall.c
@@ -0,0 +1,640 @@
+/*
+ * Copyright 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.
+ */
+
+#include <portability.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <signal.h>
+#include <signal_portable.h>
+#include <time.h>
+#include <errno.h>
+#include <errno_portable.h>
+#include <eventfd_portable.h>
+#include <filefd_portable.h>
+#include <inotify_portable.h>
+#include <timerfd_portable.h>
+#include <asm/unistd-portable.h>
+#include <asm/unistd.h>
+
+#define PORTABLE_TAG "syscall_portable"
+#include <log_portable.h>
+
+#if __NR_gettimeofday_portable == __NR_gettimeofday
+#error "Bad build environment"
+#endif
+
+/*
+ * Minimal syscall support for LTP testing.
+ * These are the system calls that LTP references explicitly.
+ * Not all of them are exported via bionic header so use #ifdef.
+ *
+ * TODO:
+ * Add existing portable system calls currently redirected from
+ * experimental Bionic linker code so that calls to them via
+ * syscall() are also processed. For example, LTP only calls open()
+ * directly and never does a syscall(__NR_open, ...).
+ */
+
+
+extern int REAL(syscall)(int, ...);
+
+#define MAXARGS 8
+
+int WRAP(syscall)(int portable_number, ...)
+{
+ va_list ap;
+ int native_number, ret;
+ int i, nargs, args[MAXARGS];
+
+ ALOGV(" ");
+ ALOGV("%s(portable_number:%d, ...) {", __func__, portable_number);
+
+ switch (portable_number) {
+#ifdef __NR_add_key_portable
+ case __NR_add_key_portable: native_number = __NR_add_key; break;
+#endif
+
+#ifdef __NR_cacheflush_portable
+ case __NR_cacheflush_portable: {
+ long start, end, flags;
+
+ va_start(ap, portable_number);
+ start = va_arg(ap, long);
+ end = va_arg(ap, long);
+ flags = va_arg(ap, long);
+ va_end(ap);
+
+ ret = cacheflush(start, end, flags);
+ goto done;
+ }
+#endif
+
+#ifdef __NR_capget_portable
+ case __NR_capget_portable: native_number = __NR_capget; break;
+#endif
+
+#ifdef __NR_capset_portable
+ case __NR_capset_portable: native_number = __NR_capset; break;
+#endif
+
+#ifdef __NR_clock_getres_portable
+ case __NR_clock_getres_portable: native_number = __NR_clock_getres; break;
+#endif
+
+#ifdef __NR_clock_nanosleep
+ case __NR_clock_nanosleep_portable: native_number = __NR_clock_nanosleep; break;
+#endif
+
+#ifdef __NR_dup3_portable
+ case __NR_dup3_portable: native_number = __NR_dup3; break;
+#endif
+
+#ifdef __NR_epoll_create_portable
+ case __NR_epoll_create_portable: native_number = __NR_epoll_create; break;
+#endif
+
+#ifdef __NR_epoll_create1_portable
+ case __NR_epoll_create1_portable: native_number = __NR_epoll_create1; break;
+#endif
+
+#ifdef __NR_eventfd_portable
+ /*
+ * Prior to 2.6.27 we only had this system call,
+ * which didn't have a flags argument. The kernel
+ * just provides a zero for flags when this system
+ * call number is used.
+ */
+ case __NR_eventfd_portable: {
+ unsigned int initval; /* 64-bit counter initial value */
+ int flags = 0;
+
+ va_start(ap, portable_number);
+
+ initval = va_arg(ap, int);
+
+ va_end(ap);
+
+ ret = WRAP(eventfd)(initval, flags); /* Android uses __NR_eventfd2 in eventfd() */
+ goto done;
+ }
+#endif
+
+#ifdef __NR_eventfd2_portable
+ /*
+ * Starting with Linux 2.6.27 a flags argument was added.
+ * Both Bionic and glibc implement the eventfd() now with
+ * the additional flags argument.
+ */
+ case __NR_eventfd2_portable: {
+ unsigned int initval; /* 64-bit counter initial value */
+ int flags;
+
+ va_start(ap, portable_number);
+
+ initval = va_arg(ap, int);
+ flags = va_arg(ap, int);
+
+ va_end(ap);
+
+ ret = WRAP(eventfd)(initval, flags); /* Android uses __NR_eventfd2 in eventfd() */
+ goto done;
+ }
+#endif
+
+#ifdef __NR_exit_group_portable
+ case __NR_exit_group_portable: native_number = __NR_exit_group; break;
+#endif
+
+#ifdef __NR_faccessat_portable
+ case __NR_faccessat_portable: native_number = __NR_faccessat; break;
+#endif
+
+#ifdef __NR_fallocate_portable
+ case __NR_fallocate_portable: native_number = __NR_fallocate; break;
+#endif
+
+#ifdef __NR_fchmodat_portable
+ case __NR_fchmodat_portable: native_number = __NR_fchmodat; break;
+#endif
+
+#ifdef __NR_fchownat_portable
+ case __NR_fchownat_portable: native_number = __NR_fchownat; break;
+#endif
+
+#ifdef __NR_fstatat64_portable
+ case __NR_fstatat64_portable: native_number = __NR_fstatat64; break;
+#endif
+
+#ifdef __NR_futimesat_portable
+ case __NR_futimesat_portable: native_number = __NR_futimesat; break;
+#endif
+
+#ifdef __NR_getegid_portable
+ case __NR_getegid_portable: native_number = __NR_getegid; break;
+#endif
+
+#ifdef __NR_geteuid_portable
+ case __NR_geteuid_portable: native_number = __NR_geteuid; break;
+#endif
+
+#ifdef __NR_getgid_portable
+ case __NR_getgid_portable: native_number = __NR_getgid; break;
+#endif
+
+#ifdef __NR_get_mempolicy_portable
+ case __NR_get_mempolicy_portable: native_number = __NR_get_mempolicy; break;
+#endif
+
+#ifdef __NR_get_robust_list_portable
+ case __NR_get_robust_list_portable: native_number = __NR_get_robust_list; break;
+#endif
+
+#ifdef __NR_gettid_portable
+ case __NR_gettid_portable: native_number = __NR_gettid; break;
+#endif
+
+#ifdef __NR_gettimeofday_portable
+ case __NR_gettimeofday_portable: native_number = __NR_gettimeofday; break;
+#endif
+
+#ifdef __NR_getuid_portable
+ case __NR_getuid_portable: native_number = __NR_getuid; break;
+#endif
+
+#ifdef __NR_inotify_init_portable
+ case __NR_inotify_init_portable: native_number = __NR_inotify_init; break;
+#endif
+
+#ifdef __NR_inotify_add_watch_portable
+ case __NR_inotify_add_watch_portable: native_number = __NR_inotify_add_watch; break;
+#endif
+
+#ifdef __NR_inotify_init1_portable
+ case __NR_inotify_init1_portable: {
+ int portable_flags;
+
+ va_start(ap, portable_number);
+ portable_flags = va_arg(ap, int);
+ va_end(ap);
+
+ ret = WRAP(inotify_init1)(portable_flags);
+ goto done;
+ }
+#endif
+
+#ifdef __NR_keyctl_portable
+ case __NR_keyctl_portable: native_number = __NR_keyctl; break;
+#endif
+
+#ifdef __NR_linkat
+ case __NR_linkat_portable: native_number = __NR_linkat; break;
+#endif
+
+#ifdef __NR_mbind_portable
+ case __NR_mbind_portable: native_number = __NR_mbind; break;
+#endif
+
+#ifdef __NR_mkdirat_portable
+ case __NR_mkdirat_portable: native_number = __NR_mkdirat; break;
+#endif
+
+#ifdef __NR_mknodat_portable
+ case __NR_mknodat_portable: native_number = __NR_mknodat; break;
+#endif
+
+#ifdef __NR_openat_portable
+ case __NR_openat_portable: native_number = __NR_openat; break;
+#endif
+
+#ifdef __NR_pipe2_portable
+ case __NR_pipe2_portable: {
+ int *pipefd_ptr;
+ int portable_flags;
+
+ va_start(ap, portable_number);
+ pipefd_ptr = va_arg(ap, int *);
+ portable_flags = va_arg(ap, int);
+ va_end(ap);
+
+ ret = WRAP(pipe2)(pipefd_ptr, portable_flags);
+ goto done;
+ }
+#endif
+
+#ifdef __NR_readahead_portable
+ case __NR_readahead_portable: native_number = __NR_readahead; break;
+#endif
+
+#ifdef __NR_readlinkat_portable
+ case __NR_readlinkat_portable: native_number = __NR_readlinkat; break;
+#endif
+
+#ifdef __NR_renameat_portable
+ case __NR_renameat_portable: native_number = __NR_renameat; break;
+#endif
+
+#ifdef __NR_rt_sigaction_portable
+ case __NR_rt_sigaction_portable: {
+ int sig;
+ struct sigaction_portable *act;
+ struct sigaction_portable *oact;
+ size_t sigsetsize;
+
+ va_start(ap, portable_number);
+ sig = va_arg(ap, int);
+ act = va_arg(ap, struct sigaction_portable *);
+ oact = va_arg(ap, struct sigaction_portable *);
+ sigsetsize = va_arg(ap, size_t);
+ va_end(ap);
+ return WRAP(__rt_sigaction)(sig, act, oact, sigsetsize);
+ }
+#endif
+
+#ifdef __NR_rt_sigprocmask_portable
+ case __NR_rt_sigprocmask_portable: {
+ int how;
+ const sigset_portable_t *set;
+ sigset_portable_t *oset;
+ size_t sigsetsize;
+
+ va_start(ap, portable_number);
+ how = va_arg(ap, int);
+ set = va_arg(ap, sigset_portable_t *);
+ oset = va_arg(ap, sigset_portable_t *);
+ sigsetsize = va_arg(ap, size_t);
+ va_end(ap);
+
+ ret = WRAP(__rt_sigprocmask)(how, set, oset, sigsetsize);
+ goto done;
+ }
+#endif
+
+#ifdef __NR_rt_sigtimedwait_portable
+ case __NR_rt_sigtimedwait_portable: {
+ const sigset_portable_t *set;
+ siginfo_portable_t *info;
+ const struct timespec *timeout;
+ size_t sigsetsize;
+
+ va_start(ap, portable_number);
+ set = va_arg(ap, sigset_portable_t *);
+ info = va_arg(ap, siginfo_portable_t *);
+ timeout = va_arg(ap, struct timespec *);
+ sigsetsize = va_arg(ap, size_t);
+ va_end(ap);
+
+ ret = WRAP(__rt_sigtimedwait)(set, info, timeout, sigsetsize);
+ goto done;
+ }
+#endif
+
+#ifdef __NR_rt_sigqueueinfo_portable
+ case __NR_rt_sigqueueinfo_portable: {
+ pid_t pid;
+ int sig;
+ siginfo_portable_t *uinfo;
+
+ va_start(ap, portable_number);
+ pid = va_arg(ap, pid_t);
+ sig = va_arg(ap, int);
+ uinfo = va_arg(ap, siginfo_portable_t *);
+ va_end(ap);
+
+ ret = WRAP(rt_sigqueueinfo)(pid, sig, uinfo);
+ goto done;
+ }
+#endif
+
+#ifdef __NR_setgid_portable
+ case __NR_setgid_portable: native_number = __NR_setgid; break;
+#endif
+
+#ifdef __NR_set_mempolicy_portable
+ case __NR_set_mempolicy_portable: native_number = __NR_set_mempolicy; break;
+#endif
+
+#ifdef __NR_set_robust_list_portable
+ case __NR_set_robust_list_portable: native_number = __NR_set_robust_list; break;
+#endif
+
+#ifdef __NR_set_tid_address_portable
+ case __NR_set_tid_address_portable: native_number = __NR_set_tid_address; break;
+#endif
+
+#ifdef __NR_sgetmask_portable
+ case __NR_sgetmask_portable: native_number = __NR_sgetmask; break;
+#endif
+
+#ifdef __NR_signalfd4_portable
+ case __NR_signalfd4_portable: {
+ int fd;
+ sigset_portable_t *portable_sigmask;
+ int sigsetsize;
+ int flags;
+
+ va_start(ap, portable_number);
+
+ fd = va_arg(ap, int);
+ portable_sigmask = va_arg(ap, sigset_portable_t *);
+ sigsetsize = va_arg(ap, int);
+ flags = va_arg(ap, int);
+
+ va_end(ap);
+
+ ret = do_signalfd4_portable(fd, (const sigset_portable_t *) portable_sigmask, sigsetsize,
+ flags);
+ goto done;
+ }
+#endif
+
+#ifdef __NR_socketcall_portable
+ case __NR_socketcall_portable: native_number = __NR_socketcall; break;
+#endif
+
+#ifdef __NR_splice_portable
+ case __NR_splice_portable: native_number = __NR_splice; break;
+#endif
+
+/* REMIND - DOUBLE CHECK THIS ONE */
+#ifdef __NR_ssetmask_portable
+ case __NR_ssetmask_portable: native_number = __NR_ssetmask; break;
+#endif
+
+#ifdef __NR_swapoff_portable
+ case __NR_swapoff_portable: native_number = __NR_swapoff; break;
+#endif
+
+#ifdef __NR_swapon_portable
+ case __NR_swapon_portable: native_number = __NR_swapon; break;
+#endif
+
+#ifdef __NR_symlinkat_portable
+ case __NR_symlinkat_portable: native_number = __NR_symlinkat; break;
+#endif
+
+/*
+ * ARM uses the new, version 2, form of sync_file_range() which
+ * doesn't waste 32 bits between the 32 bit arg and the 64 bit arg.
+ * It does this by moving the last 32 bit arg and placing it with
+ * the 1st 32 bit arg.
+ *
+ * Here's the trivial mapping function in the kernel ARM code:
+ *
+ * sync_file_range2(int fd, unsigned int flags, loff_t offset, loff_t nbytes) {
+ * return sys_sync_file_range(fd, offset, nbytes, flags);
+ * }
+ *
+ * For portability we have to do a similar mapping for the native/MIPS system
+ * call but have to provide the alignment padding expected by the sync_file_range()
+ * system call. We avoid alignment issues while using varargs by avoiding the use
+ * of 64 bit args.
+ */
+#if defined( __NR_arm_sync_file_range_portable)
+ case __NR_arm_sync_file_range_portable: native_number = __NR_sync_file_range; {
+ int fd;
+ int flags;
+ int offset_low, offset_high;
+ int nbytes_low, nbytes_high;
+ int align_fill = 0;
+
+
+ va_start(ap, portable_number);
+ fd = va_arg(ap, int);
+ flags = va_arg(ap, int);
+ offset_low = va_arg(ap, int);
+ offset_high = va_arg(ap, int);
+ nbytes_low = va_arg(ap, int);
+ nbytes_high = va_arg(ap, int);
+ va_end(ap);
+
+ ALOGV("%s: Calling syscall(native_number:%d:'sync_file_range', fd:%d, "
+ "align_fill:0x%x, offset_low:0x%x, offset_high:0x%x, "
+ "nbytes_low:0x%x, nbytes_high:0x%x, flags:0x%x);", __func__,
+ native_number, fd, align_fill, offset_low, offset_high,
+ nbytes_low, nbytes_high, flags);
+
+ ret = REAL(syscall)(native_number, fd, align_fill, offset_low, offset_high,
+ nbytes_low, nbytes_high, flags);
+
+ goto done;
+ }
+#endif
+
+
+#ifdef __NR__sysctl_portable
+ case __NR__sysctl_portable: native_number = __NR__sysctl; break;
+#endif
+
+#ifdef __NR_sysfs_portable
+ case __NR_sysfs_portable: native_number = __NR_sysfs; break;
+#endif
+
+#ifdef __NR_syslog_portable
+ case __NR_syslog_portable: native_number = __NR_syslog; break;
+#endif
+
+#ifdef __NR_tee_portable
+ case __NR_tee_portable: native_number = __NR_tee; break;
+#endif
+
+#ifdef __NR_timer_create_portable
+ case __NR_timer_create_portable: {
+ clockid_t clockid;
+ struct sigevent *evp;
+ timer_t *timerid;
+
+ va_start(ap, portable_number);
+ clockid = va_arg(ap, clockid_t);
+ evp = va_arg(ap, struct sigevent *);
+ timerid = va_arg(ap, timer_t *);
+ va_end(ap);
+
+ ret = WRAP(timer_create)(clockid, evp, timerid);
+ goto done;
+ }
+#endif
+
+#ifdef __NR_timerfd_create_portable
+ case __NR_timerfd_create_portable: {
+ int clockid;
+ int flags;
+
+ va_start(ap, portable_number);
+ clockid = va_arg(ap, int); /* clockid is portable */
+ flags = va_arg(ap, int); /* flags need to be mapped */
+ va_end(ap);
+
+ ret = WRAP(timerfd_create)(clockid, flags);
+ goto done;
+ }
+#endif
+
+#ifdef __NR_timerfd_gettime_portable
+ case __NR_timerfd_gettime_portable: native_number = __NR_timerfd_gettime; break;
+#endif
+
+#ifdef __NR_timerfd_settime_portable
+ case __NR_timerfd_settime_portable: native_number = __NR_timerfd_settime; break;
+#endif
+
+#ifdef __NR_timer_getoverrun_portable
+ case __NR_timer_getoverrun_portable: native_number = __NR_timer_getoverrun; break;
+#endif
+
+#ifdef __NR_timer_gettime_portable
+ case __NR_timer_gettime_portable: native_number = __NR_timer_gettime; break;
+#endif
+
+#ifdef __NR_timer_settime_portable
+ case __NR_timer_settime_portable: native_number = __NR_timer_settime; break;
+#endif
+
+#ifdef __NR_rt_tgsigqueueinfo_portable
+ case __NR_rt_tgsigqueueinfo_portable: {
+ pid_t tgid;
+ pid_t pid;
+ int sig;
+ siginfo_portable_t *uinfo;
+
+ va_start(ap, portable_number);
+ tgid = va_arg(ap, pid_t);
+ pid = va_arg(ap, pid_t);
+ sig = va_arg(ap, int);
+ uinfo = va_arg(ap, siginfo_portable_t *);
+ va_end(ap);
+
+ ret = WRAP(rt_tgsigqueueinfo)(tgid, pid, sig, uinfo);
+ goto done;
+ }
+#endif
+
+#ifdef __NR_tkill_portable
+ case __NR_tkill_portable: {
+ int tid, sig;
+
+ va_start(ap, portable_number);
+ tid = va_arg(ap, int);
+ sig = va_arg(ap, int);
+ va_end(ap);
+
+ ret = WRAP(tkill)(tid, sig);
+ goto done;
+ }
+#endif
+
+#ifdef __NR_uname_portable
+ case __NR_uname_portable: native_number = __NR_uname; break;
+#endif
+
+#ifdef __NR_vmsplice_portable
+ case __NR_vmsplice_portable: native_number = __NR_vmsplice; break;
+#endif
+
+ default:
+ ALOGV("%s(portable_number:%d, ...): case default; native_number = -1; "
+ "[ERROR: ADD MISSING SYSTEM CALL]", __func__, portable_number);
+
+ native_number = -1;
+ break;
+ }
+
+ ALOGV("%s: native_number = %d", __func__, native_number);
+
+ if (native_number <= 0) {
+ ALOGV("%s: native_number:%d <= 0; ret = -1; [ERROR: FIX SYSTEM CALL]", __func__,
+ native_number);
+
+ *REAL(__errno)() = ENOSYS;
+ ret = -1;
+ goto done;
+ }
+
+ /*
+ * Get the argument list
+ * This is pretty crappy:
+ * It assumes that the portable and native arguments are compatible
+ * It assumes that no more than MAXARGS arguments are passed
+ *
+ * Possible changes:
+ * o include the argument count for each mapped system call
+ * o map the syscall into the equivalent library call:
+ * eg syscall(__NR_gettimeofday_portable, struct timeval *tv, struct timezone *tz) =>
+ * gettimeofday(struct timeval *tv, struct timezone *tz)
+ *
+ * second option is probably best as it allows argument remapping to take place if needed
+ *
+ */
+ va_start(ap, portable_number);
+ /* For now assume all syscalls take MAXARGS arguments. */
+ nargs = MAXARGS;
+ for (i = 0; i < nargs; i++)
+ args[i] = va_arg(ap, int);
+ va_end(ap);
+
+ ALOGV("%s: Calling syscall(%d, %d, %d, %d, %d, %d, %d, %d, %d);", __func__,
+ native_number, args[0], args[1], args[2], args[3], args[4],
+ args[5], args[6], args[7]);
+
+ ret = REAL(syscall)(native_number, args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7]);
+
+done:
+ if (ret == -1) {
+ ALOGV("%s: ret == -1; errno:%d;", __func__, *REAL(__errno)());
+ }
+ ALOGV("%s: return(ret:%d); }", __func__, ret);
+ return ret;
+}
diff --git a/ndk/sources/android/libportable/arch-arm/stat.c b/ndk/sources/android/libportable/arch-mips/timer.c
index 20a34ad2a..c2844e1b3 100644
--- a/ndk/sources/android/libportable/arch-arm/stat.c
+++ b/ndk/sources/android/libportable/arch-mips/timer.c
@@ -14,25 +14,23 @@
* limitations under the License.
*/
-#include <stat_portable.h>
+#include <portability.h>
+#include <signal.h>
+#include <signal_portable.h>
+#include <time.h>
-/* Note: The Portable Header will define stat to stat_portable */
-int stat_portable(const char *path, struct stat_portable *s)
+int WRAP(timer_create)(clockid_t clockid, struct sigevent *portable_evp,
+ timer_t *timerid)
{
- return stat(path, s);
-}
-
-int fstat_portable(int fd, struct stat_portable *s)
-{
- return fstat(fd, s);
-}
+ struct sigevent native_sigevent, *evp = portable_evp;
-int lstat_portable(const char *path, struct stat_portable *s)
-{
- return lstat(path, s);
-}
+ if (!invalid_pointer(portable_evp) &&
+ (evp->sigev_notify == SIGEV_SIGNAL ||
+ evp->sigev_notify == SIGEV_THREAD_ID)) {
-int fstatat_portable(int dirfd, const char *path, struct stat_portable *s, int flags)
-{
- return fstatat(dirfd, path, s, flags);
+ native_sigevent = *portable_evp;
+ evp = &native_sigevent;
+ evp->sigev_signo = signum_pton(evp->sigev_signo);
+ }
+ return REAL(timer_create)(clockid, evp, timerid);
}
diff --git a/ndk/sources/android/libportable/arch-mips/timerfd.c b/ndk/sources/android/libportable/arch-mips/timerfd.c
new file mode 100644
index 000000000..b57c3f277
--- /dev/null
+++ b/ndk/sources/android/libportable/arch-mips/timerfd.c
@@ -0,0 +1,82 @@
+/*
+ * Copyright 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.
+ */
+
+#include <portability.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <asm/unistd.h>
+#include <asm/unistd-portable.h>
+
+#include <fcntl_portable.h>
+#include <timerfd_portable.h>
+
+#include <filefd_portable.h>
+
+
+#define PORTABLE_TAG "timerfd_portable"
+#include <log_portable.h>
+
+extern int syscall(int, ...);
+
+
+/* NOTE: LTP defaults to using O_NONBLOCK even if TFD_NONBLOCK is defined */
+
+
+/*
+ * Portable to Native event flags mapper.
+ */
+static inline int tdf_flags_pton(int portable_flags)
+{
+ int native_flags = 0;
+
+ ALOGV("%s(portable_flags:0x%x) {", __func__, portable_flags);
+
+ if (portable_flags & TFD_NONBLOCK_PORTABLE) {
+ native_flags |= TFD_NONBLOCK;
+ }
+
+ if (portable_flags & TFD_CLOEXEC_PORTABLE) {
+ native_flags |= TFD_CLOEXEC;
+ }
+
+ ALOGV("%s: return(native_flags:%d); }", __func__, native_flags);
+ return native_flags;
+}
+
+
+int WRAP(timerfd_create)(int clockid, int portable_flags) {
+ int rv;
+ int native_flags;
+
+ ALOGV(" ");
+ ALOGV("%s(clockid:%d, portable_flags:%d) {", __func__,
+ clockid, portable_flags);
+
+ native_flags = tdf_flags_pton(portable_flags);
+
+ rv = REAL(syscall)(__NR_timerfd_create, clockid, native_flags);
+ if (rv >= 0) {
+ if (native_flags & TFD_CLOEXEC) {
+ filefd_CLOEXEC_enabled(rv);
+ }
+ filefd_opened(rv, TIMER_FD_TYPE);
+ }
+
+ ALOGV("%s: return(rv:%d); }", __func__, rv);
+ return rv;
+}
+
diff --git a/ndk/sources/android/libportable/arch-mips/waitpid.c b/ndk/sources/android/libportable/arch-mips/waitpid.c
new file mode 100644
index 000000000..77e628387
--- /dev/null
+++ b/ndk/sources/android/libportable/arch-mips/waitpid.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 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.
+ */
+
+#include <portability.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <signal_portable.h>
+#include <stdio.h>
+#include <sys/wait.h>
+
+#define PORTABLE_TAG "waitpid_portable"
+#include <log_portable.h>
+
+pid_t WRAP(waitpid)(pid_t pid, int *status, int options)
+{
+ pid_t ret;
+
+ ret = REAL(waitpid)(pid, status, options);
+ if (status && ret > 0) {
+ /*
+ * Status layout is identical, so just the signal
+ * number needs to be changed.
+ */
+ if (WIFSIGNALED(*status))
+ *status = (*status & ~0x7f) | signum_ntop(WTERMSIG(*status));
+ else if (WIFSTOPPED(*status))
+ *status = (*status & ~0xff00) | (signum_ntop(WSTOPSIG(*status)) << 8);
+ }
+
+ return ret;
+}
diff --git a/ndk/sources/android/libportable/arch-x86/epoll.c b/ndk/sources/android/libportable/arch-x86/epoll.c
index e2f91f29f..c68344133 100644
--- a/ndk/sources/android/libportable/arch-x86/epoll.c
+++ b/ndk/sources/android/libportable/arch-x86/epoll.c
@@ -14,23 +14,24 @@
* limitations under the License.
*/
+#include <portability.h>
#include <sys/epoll.h>
#include <epoll_portable.h>
-int epoll_ctl_portable(int epfd, int op, int fd, struct epoll_event_portable *event)
+int WRAP(epoll_ctl)(int epfd, int op, int fd, struct epoll_event_portable *event)
{
struct epoll_event x86_epoll_event;
x86_epoll_event.events = event->events;
x86_epoll_event.data = event->data;
- return epoll_ctl(epfd, op, fd, &x86_epoll_event);
+ return REAL(epoll_ctl)(epfd, op, fd, &x86_epoll_event);
}
-int epoll_wait_portable(int epfd, struct epoll_event_portable *events, int max, int timeout)
+int WRAP(epoll_wait)(int epfd, struct epoll_event_portable *events, int max, int timeout)
{
struct epoll_event x86_epoll_event;
- int ret = epoll_wait(epfd, &x86_epoll_event, max, timeout);
+ int ret = REAL(epoll_wait)(epfd, &x86_epoll_event, max, timeout);
events->events = x86_epoll_event.events;
events->data = x86_epoll_event.data;
diff --git a/ndk/sources/android/libportable/arch-x86/errno.c b/ndk/sources/android/libportable/arch-x86/errno.c
deleted file mode 100644
index ffa599892..000000000
--- a/ndk/sources/android/libportable/arch-x86/errno.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 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.
- */
-
-extern volatile int* __errno(void);
-volatile int* __errno_portable()
-{
- return __errno();
-}
diff --git a/ndk/sources/android/libportable/arch-x86/fcntl.c b/ndk/sources/android/libportable/arch-x86/fcntl.c
index 7561f8546..74b14c12b 100644
--- a/ndk/sources/android/libportable/arch-x86/fcntl.c
+++ b/ndk/sources/android/libportable/arch-x86/fcntl.c
@@ -14,13 +14,14 @@
* limitations under the License.
*/
+#include <portability.h>
#include <fcntl.h>
#include <stdarg.h>
#include <fcntl_portable.h>
extern int __fcntl64(int, int, void *);
-int fcntl_portable(int fd, int cmd, ...)
+int WRAP(fcntl)(int fd, int cmd, ...)
{
va_list ap;
void * arg;
diff --git a/ndk/sources/android/libportable/arch-x86/fenv.c b/ndk/sources/android/libportable/arch-x86/fenv.c
new file mode 100644
index 000000000..adf6f3048
--- /dev/null
+++ b/ndk/sources/android/libportable/arch-x86/fenv.c
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2013, 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.
+ */
+
+
+#include <portability.h>
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <fenv.h>
+#include <fenv_portable.h>
+
+static inline int x86_change_except(int flags)
+{
+ int x86flags = 0;
+ int exception = flags & FE_ALL_EXCEPT_PORTABLE;
+
+ // exception flags
+ if (exception & FE_INVALID_PORTABLE)
+ x86flags |= FE_INVALID;
+ if (exception & FE_DIVBYZERO_PORTABLE)
+ x86flags |= FE_DIVBYZERO;
+ if (exception & FE_OVERFLOW_PORTABLE)
+ x86flags |= FE_OVERFLOW;
+ if (exception & FE_UNDERFLOW_PORTABLE)
+ x86flags |= FE_UNDERFLOW;
+ if (exception & FE_INEXACT_PORTABLE)
+ x86flags |= FE_INEXACT;
+
+ return x86flags;
+}
+
+static inline int x86_change_rounding(int flags)
+{
+ int x86flags = 0;
+ int rounding = flags & 0x03;
+
+ // rounding flags
+ switch(rounding)
+ {
+ case FE_TONEAREST_PORTABLE:
+ x86flags = FE_TONEAREST;
+ break;
+ case FE_DOWNWARD_PORTABLE:
+ x86flags = FE_DOWNWARD;
+ break;
+ case FE_UPWARD_PORTABLE:
+ x86flags = FE_UPWARD;
+ break;
+ case FE_TOWARDZERO_PORTABLE:
+ x86flags = FE_TOWARDZERO;
+ break;
+ }
+ return x86flags;
+}
+
+static inline int x86_get_except(int x86flags)
+{
+ int flags = 0;
+ int exception = x86flags & FE_ALL_EXCEPT;
+
+ // exception flags
+ if (exception & FE_INVALID)
+ flags |= FE_INVALID_PORTABLE;
+ if (exception & FE_DIVBYZERO)
+ flags |= FE_DIVBYZERO_PORTABLE;
+ if (exception & FE_OVERFLOW)
+ flags |= FE_OVERFLOW_PORTABLE;
+ if (exception & FE_UNDERFLOW)
+ flags |= FE_UNDERFLOW_PORTABLE;
+ if (exception & FE_INEXACT)
+ flags |= FE_INEXACT_PORTABLE;
+
+ return flags;
+}
+static inline int x86_get_rounding(int x86flags)
+{
+ int flags = 0;
+ int rounding = x86flags & _ROUND_MASK;
+
+ // rounding flags
+ switch(rounding)
+ {
+ case FE_TONEAREST:
+ flags = FE_TONEAREST_PORTABLE;
+ break;
+ case FE_DOWNWARD:
+ flags = FE_DOWNWARD_PORTABLE;
+ break;
+ case FE_UPWARD:
+ flags = FE_UPWARD_PORTABLE;
+ break;
+ case FE_TOWARDZERO:
+ flags = FE_TOWARDZERO_PORTABLE;
+ break;
+ }
+
+ return flags;
+}
+
+int
+WRAP(fesetexceptflag)(const fexcept_t *flagp, int excepts)
+{
+ const fexcept_t flagp_ = x86_change_except(*flagp);
+ int excepts_ = x86_change_except(excepts);
+ return REAL(fesetexceptflag)(&flagp_, excepts_);
+}
+
+int
+WRAP(fegetexceptflag)(fexcept_t *flagp, int excepts)
+{
+ REAL(fegetexceptflag)(flagp, x86_change_except(excepts));
+ *flagp = x86_get_except(*flagp);
+ return 0;
+}
+
+int
+WRAP(feraiseexcept)(int excepts)
+{
+ return REAL(feraiseexcept)(x86_change_except(excepts));
+}
+
+int
+WRAP(feclearexcept)(int excepts)
+{
+ return REAL(feclearexcept)(x86_change_except(excepts));
+}
+
+int
+WRAP(fetestexcept)(int excepts)
+{
+ return REAL(fetestexcept)(x86_change_except(excepts));
+}
+
+int
+WRAP(fegetround)(void)
+{
+ int round = REAL(fegetround)();
+ return x86_get_rounding(round);
+}
+
+int
+WRAP(fesetround)(int round)
+{
+ return REAL(fesetround)(x86_change_rounding(round));
+}
+
+int
+WRAP(fegetexcept)(void)
+{
+ int flags = REAL(fegetexcept)();
+ return x86_get_except(flags);
+}
+
diff --git a/ndk/sources/android/libportable/arch-x86/ioctl.c b/ndk/sources/android/libportable/arch-x86/ioctl.c
index ea88c3099..01ddbcd50 100644
--- a/ndk/sources/android/libportable/arch-x86/ioctl.c
+++ b/ndk/sources/android/libportable/arch-x86/ioctl.c
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <portability.h>
#include <stdarg.h>
#include <sys/ioctl.h>
#include <ioctls_portable.h>
@@ -31,7 +32,7 @@ static inline int x86_change_request(int request)
}
extern int __ioctl(int, int, void *);
-int ioctl_portable(int fd, int request, ...)
+int WRAP(ioctl)(int fd, int request, ...)
{
va_list ap;
void * arg;
diff --git a/ndk/sources/android/libportable/arch-x86/open.c b/ndk/sources/android/libportable/arch-x86/open.c
index a38f38c3d..dae578b3f 100644
--- a/ndk/sources/android/libportable/arch-x86/open.c
+++ b/ndk/sources/android/libportable/arch-x86/open.c
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <portability.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdarg.h>
@@ -56,7 +57,7 @@ static inline int x86_change_flags(int flags)
}
extern int __open(const char*, int, int);
-int open_portable(const char *pathname, int flags, ...)
+int WRAP(open)(const char *pathname, int flags, ...)
{
mode_t mode = 0;
flags |= O_LARGEFILE;
diff --git a/ndk/sources/android/libportable/arch-x86/socket.c b/ndk/sources/android/libportable/arch-x86/socket.c
deleted file mode 100644
index 7e7ca9b38..000000000
--- a/ndk/sources/android/libportable/arch-x86/socket.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 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.
- */
-
-#include <unistd.h>
-#include <sys/socket.h>
-#include <sys/linux-syscalls.h>
-
-int socket_portable(int domain, int type, int protocol) {
- return socket(domain, type, protocol);
-}
diff --git a/ndk/sources/android/libportable/arch-x86/sockopt.c b/ndk/sources/android/libportable/arch-x86/sockopt.c
deleted file mode 100644
index c86ded328..000000000
--- a/ndk/sources/android/libportable/arch-x86/sockopt.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 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.
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-extern int setsockopt(int, int, int, const void *, socklen_t);
-int setsockopt_portable(int s, int level, int optname, const void *optval, socklen_t optlen)
-{
- return setsockopt(s, level, optname, optval, optlen);
-}
-
-extern int getsockopt (int, int, int, void *, socklen_t *);
-int getsockopt_portable(int s, int level, int optname, void *optval, socklen_t *optlen)
-{
- return getsockopt(s, level, optname, optval, optlen);
-}
diff --git a/ndk/sources/android/libportable/arch-x86/stat.c b/ndk/sources/android/libportable/arch-x86/stat.c
index 6b368c8db..1d1737838 100644
--- a/ndk/sources/android/libportable/arch-x86/stat.c
+++ b/ndk/sources/android/libportable/arch-x86/stat.c
@@ -14,37 +14,38 @@
* limitations under the License.
*/
+#include <portability.h>
#include <stat_portable.h>
/* Note: The Portable Header will define stat to stat_portable */
-int stat_portable(const char *path, struct stat_portable *s)
+int WRAP(stat)(const char *path, struct stat_portable *s)
{
struct stat x86_stat;
- int ret = stat(path, &x86_stat);
+ int ret = REAL(stat)(path, &x86_stat);
stat_ntop(&x86_stat, s);
return ret;
}
-int fstat_portable(int fd, struct stat_portable *s)
+int WRAP(fstat)(int fd, struct stat_portable *s)
{
struct stat x86_stat;
- int ret = fstat(fd, &x86_stat);
+ int ret = REAL(fstat)(fd, &x86_stat);
stat_ntop(&x86_stat, s);
return ret;
}
-int lstat_portable(const char *path, struct stat_portable *s)
+int WRAP(lstat)(const char *path, struct stat_portable *s)
{
struct stat x86_stat;
- int ret = lstat(path, &x86_stat);
+ int ret = REAL(lstat)(path, &x86_stat);
stat_ntop(&x86_stat, s);
return ret;
}
-int fstatat_portable(int dirfd, const char *path, struct stat_portable *s, int flags)
+int WRAP(fstatat)(int dirfd, const char *path, struct stat_portable *s, int flags)
{
struct stat x86_stat;
- int ret = fstatat(dirfd, path, &x86_stat, flags);
+ int ret = REAL(fstatat)(dirfd, path, &x86_stat, flags);
stat_ntop(&x86_stat, s);
return ret;
}
diff --git a/ndk/sources/android/libportable/arch-arm/epoll.c b/ndk/sources/android/libportable/common/include/asm-generic/portability.h
index f703ba1d9..8d91854fe 100644
--- a/ndk/sources/android/libportable/arch-arm/epoll.c
+++ b/ndk/sources/android/libportable/common/include/asm-generic/portability.h
@@ -14,15 +14,18 @@
* limitations under the License.
*/
-#include <sys/epoll.h>
+#ifndef _ASM_PORTABILITY_H_
+#define _ASM_PORTABILITY_H_
-int epoll_ctl_portable(int epfd, int op, int fd, struct epoll_event *event)
-{
- return epoll_ctl(epfd, op, fd, event);
-}
-
-int epoll_wait_portable(int epfd, struct epoll_event *events, int max, int timeout)
-{
- return epoll_wait(epfd, events, max, timeout);
-}
+#if !defined(__HOST__)
+#define WRAP(f) f ## _portable
+#define REAL(f) f
+#else
+/* On host app link with libpportable.a with -Wl,--wrap=symbol, which resolve symbol symbol to __wrap_symbol,
+ * and __real_symbol refer to the original symbol
+ */
+#define WRAP(f) __wrap_ ## f
+#define REAL(f) __real_ ## f
+#endif
+#endif /* _ASM_PORTABILITY_H_ */
diff --git a/ndk/sources/android/libportable/common/include/asm-generic/siginfo_portable.h b/ndk/sources/android/libportable/common/include/asm-generic/siginfo_portable.h
new file mode 100644
index 000000000..1f13ad8ea
--- /dev/null
+++ b/ndk/sources/android/libportable/common/include/asm-generic/siginfo_portable.h
@@ -0,0 +1,221 @@
+/****************************************************************************
+ Derived from platforms/android-14/arch-arm/usr/include/asm-generic/siginfo.h
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_PORTABLE_GENERIC_SIGINFO_H
+#define _ASM_PORTABLE_GENERIC_SIGINFO_H
+
+#include <linux/compiler.h>
+#include <linux/types.h>
+
+typedef union sigval_portable {
+ int sival_int;
+ void __user *sival_ptr;
+} sigval_portable_t;
+
+#ifndef __ARCH_SI_PREAMBLE_SIZE
+#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
+#endif
+
+#define SI_MAX_SIZE 128
+#ifndef SI_PAD_SIZE
+#define SI_PAD_SIZE ((SI_MAX_SIZE - __ARCH_SI_PREAMBLE_SIZE) / sizeof(int))
+#endif
+
+#ifndef __ARCH_SI_UID_T
+#define __ARCH_SI_UID_T uid_t
+#endif
+
+#ifndef __ARCH_SI_BAND_T
+#define __ARCH_SI_BAND_T long
+#endif
+
+typedef struct siginfo_portable {
+ int si_signo;
+ int si_errno;
+ int si_code;
+
+ union {
+ int _pad[SI_PAD_SIZE];
+
+ struct {
+ pid_t _pid;
+ __ARCH_SI_UID_T _uid;
+ } _kill;
+
+ struct {
+ timer_t _tid;
+ int _overrun;
+ char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
+ sigval_portable_t _sigval;
+ int _sys_private;
+ } _timer;
+
+ struct {
+ pid_t _pid;
+ __ARCH_SI_UID_T _uid;
+ sigval_t _sigval;
+ } _rt;
+
+ struct {
+ pid_t _pid;
+ __ARCH_SI_UID_T _uid;
+ int _status;
+ clock_t _utime;
+ clock_t _stime;
+ } _sigchld;
+
+ struct {
+ void __user *_addr;
+#ifdef __ARCH_SI_TRAPNO
+ int _trapno;
+#endif
+ } _sigfault;
+
+ struct {
+ __ARCH_SI_BAND_T _band;
+ int _fd;
+ } _sigpoll;
+
+ } _sifields;
+} siginfo_portable_t;
+
+#ifndef si_pid
+#define si_pid _sifields._kill._pid
+#define si_uid _sifields._kill._uid
+#define si_tid _sifields._timer._tid
+#define si_overrun _sifields._timer._overrun
+#define si_sys_private _sifields._timer._sys_private
+#define si_status _sifields._sigchld._status
+#define si_utime _sifields._sigchld._utime
+#define si_stime _sifields._sigchld._stime
+#define si_value _sifields._rt._sigval
+#define si_int _sifields._rt._sigval.sival_int
+#define si_ptr _sifields._rt._sigval.sival_ptr
+#define si_addr _sifields._sigfault._addr
+#ifdef __ARCH_SI_TRAPNO
+#define si_trapno _sifields._sigfault._trapno
+#endif
+#define si_band _sifields._sigpoll._band
+#define si_fd _sifields._sigpoll._fd
+#endif
+
+#ifndef __SI_KILL
+#define __SI_KILL 0
+#define __SI_TIMER 0
+#define __SI_POLL 0
+#define __SI_FAULT 0
+#define __SI_CHLD 0
+#define __SI_RT 0
+#define __SI_MESGQ 0
+#define __SI_CODE(T,N) (N)
+#endif
+
+#ifndef SI_USER
+#define SI_USER 0
+#define SI_KERNEL 0x80
+#define SI_QUEUE -1
+#define SI_TIMER __SI_CODE(__SI_TIMER,-2)
+#define SI_MESGQ __SI_CODE(__SI_MESGQ,-3)
+#define SI_ASYNCIO -4
+#define SI_SIGIO -5
+#define SI_TKILL -6
+#define SI_DETHREAD -7
+
+#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
+#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
+#endif
+
+#ifndef ILL_ILLOPC
+#define ILL_ILLOPC (__SI_FAULT|1)
+#define ILL_ILLOPN (__SI_FAULT|2)
+#define ILL_ILLADR (__SI_FAULT|3)
+#define ILL_ILLTRP (__SI_FAULT|4)
+#define ILL_PRVOPC (__SI_FAULT|5)
+#define ILL_PRVREG (__SI_FAULT|6)
+#define ILL_COPROC (__SI_FAULT|7)
+#define ILL_BADSTK (__SI_FAULT|8)
+#define NSIGILL 8
+#endif
+
+#ifndef FPE_INTDIV
+#define FPE_INTDIV (__SI_FAULT|1)
+#define FPE_INTOVF (__SI_FAULT|2)
+#define FPE_FLTDIV (__SI_FAULT|3)
+#define FPE_FLTOVF (__SI_FAULT|4)
+#define FPE_FLTUND (__SI_FAULT|5)
+#define FPE_FLTRES (__SI_FAULT|6)
+#define FPE_FLTINV (__SI_FAULT|7)
+#define FPE_FLTSUB (__SI_FAULT|8)
+#define NSIGFPE 8
+
+#define SEGV_MAPERR (__SI_FAULT|1)
+#define SEGV_ACCERR (__SI_FAULT|2)
+#define NSIGSEGV 2
+
+#define BUS_ADRALN (__SI_FAULT|1)
+#define BUS_ADRERR (__SI_FAULT|2)
+#define BUS_OBJERR (__SI_FAULT|3)
+#define NSIGBUS 3
+
+#define TRAP_BRKPT (__SI_FAULT|1)
+#define TRAP_TRACE (__SI_FAULT|2)
+#define NSIGTRAP 2
+
+#define CLD_EXITED (__SI_CHLD|1)
+#define CLD_KILLED (__SI_CHLD|2)
+#define CLD_DUMPED (__SI_CHLD|3)
+#define CLD_TRAPPED (__SI_CHLD|4)
+#define CLD_STOPPED (__SI_CHLD|5)
+#define CLD_CONTINUED (__SI_CHLD|6)
+#define NSIGCHLD 6
+
+#define POLL_IN (__SI_POLL|1)
+#define POLL_OUT (__SI_POLL|2)
+#define POLL_MSG (__SI_POLL|3)
+#define POLL_ERR (__SI_POLL|4)
+#define POLL_PRI (__SI_POLL|5)
+#define POLL_HUP (__SI_POLL|6)
+#define NSIGPOLL 6
+
+#define SIGEV_SIGNAL 0
+#define SIGEV_NONE 1
+#define SIGEV_THREAD 2
+#define SIGEV_THREAD_ID 4
+#endif /* FPE_INTDIV */
+
+#ifndef __ARCH_SIGEV_PREAMBLE_SIZE
+#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_portable_t))
+#endif
+
+#define SIGEV_MAX_SIZE 64
+#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) / sizeof(int))
+
+typedef struct sigevent_portable {
+ sigval_portable_t sigev_value;
+ int sigev_signo;
+ int sigev_notify;
+ union {
+ int _pad[SIGEV_PAD_SIZE];
+ int _tid;
+
+ struct {
+ void (*_function)(sigval_portable_t);
+ void *_attribute;
+ } _sigev_thread;
+ } _sigev_un;
+} sigevent_portable_t;
+
+#define sigev_notify_function _sigev_un._sigev_thread._function
+#define sigev_notify_attributes _sigev_un._sigev_thread._attribute
+#define sigev_notify_thread_id _sigev_un._tid
+
+#endif
diff --git a/ndk/sources/android/libportable/common/include/asm-generic/signal_portable.h b/ndk/sources/android/libportable/common/include/asm-generic/signal_portable.h
new file mode 100644
index 000000000..97b1b405a
--- /dev/null
+++ b/ndk/sources/android/libportable/common/include/asm-generic/signal_portable.h
@@ -0,0 +1,21 @@
+/****************************************************************************
+ Derived from platforms/android-14/arch-arm/usr/include/asm-generic/signal.h
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_GENERIC_SIGNAL_PORTABLE_H
+#define __ASM_GENERIC_SIGNAL_PORTABLE_H
+
+#define SIG_BLOCK_PORTABLE 0
+#define SIG_UNBLOCK_PORTABLE 1
+#define SIG_SETMASK_PORTABLE 2
+
+#endif
+
diff --git a/ndk/sources/android/libportable/common/include/asm/sigcontext_portable.h b/ndk/sources/android/libportable/common/include/asm/sigcontext_portable.h
new file mode 100644
index 000000000..477b3e847
--- /dev/null
+++ b/ndk/sources/android/libportable/common/include/asm/sigcontext_portable.h
@@ -0,0 +1,40 @@
+/****************************************************************************
+ Derived from gdk/platforms/android-14/arch-arm/usr/include/asm/sigcontext.h
+ ****************************************************************************
+ ***
+ *** This header was ORIGINALLY automatically generated from a Linux kernel
+ *** header of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_SIGCONTEXT_PORTABLE_H
+#define _ASMARM_SIGCONTEXT_PORTABLE_H
+
+struct sigcontext_portable {
+ unsigned long trap_no;
+ unsigned long error_code;
+ unsigned long oldmask;
+ unsigned long arm_r0;
+ unsigned long arm_r1;
+ unsigned long arm_r2;
+ unsigned long arm_r3;
+ unsigned long arm_r4;
+ unsigned long arm_r5;
+ unsigned long arm_r6;
+ unsigned long arm_r7;
+ unsigned long arm_r8;
+ unsigned long arm_r9;
+ unsigned long arm_r10;
+ unsigned long arm_fp;
+ unsigned long arm_ip;
+ unsigned long arm_sp;
+ unsigned long arm_lr;
+ unsigned long arm_pc;
+ unsigned long arm_cpsr;
+ unsigned long fault_address;
+};
+
+#endif
diff --git a/ndk/sources/android/libportable/common/include/asm/siginfo_portable.h b/ndk/sources/android/libportable/common/include/asm/siginfo_portable.h
new file mode 100644
index 000000000..283f23ece
--- /dev/null
+++ b/ndk/sources/android/libportable/common/include/asm/siginfo_portable.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_PORTABLE_SIGINFO_H
+#define _ASM_PORTABLE_SIGINFO_H
+
+#include <asm-generic/siginfo_portable.h>
+
+#endif
diff --git a/ndk/sources/android/libportable/common/include/asm/signal_portable.h b/ndk/sources/android/libportable/common/include/asm/signal_portable.h
new file mode 100644
index 000000000..a9608cc04
--- /dev/null
+++ b/ndk/sources/android/libportable/common/include/asm/signal_portable.h
@@ -0,0 +1,185 @@
+/****************************************************************************
+ Derived from gdk/platforms/android-14/arch-arm/usr/include/asm/signal.h
+ ****************************************************************************
+ ***
+ *** This header was ORIGINALLY automatically generated from a Linux kernel
+ *** header of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_SIGNAL_PORTABLE_H
+#define _ASMARM_SIGNAL_PORTABLE_H
+
+struct siginfo; /* TODO: Change to siginfo_portable */
+
+#define NSIG_PORTABLE 64
+typedef unsigned long sigset_portable_t;
+
+#define SIGHUP_PORTABLE 1
+#define SIGINT_PORTABLE 2
+#define SIGQUIT_PORTABLE 3
+#define SIGILL_PORTABLE 4
+#define SIGTRAP_PORTABLE 5
+#define SIGABRT_PORTABLE 6
+#define SIGIOT_PORTABLE 6
+#define SIGBUS_PORTABLE 7
+#define SIGFPE_PORTABLE 8
+#define SIGKILL_PORTABLE 9
+#define SIGUSR1_PORTABLE 10
+#define SIGSEGV_PORTABLE 11
+#define SIGUSR2_PORTABLE 12
+#define SIGPIPE_PORTABLE 13
+#define SIGALRM_PORTABLE 14
+#define SIGTERM_PORTABLE 15
+#define SIGSTKFLT_PORTABLE 16
+#define SIGCHLD_PORTABLE 17
+#define SIGCONT_PORTABLE 18
+#define SIGSTOP_PORTABLE 19
+#define SIGTSTP_PORTABLE 20
+#define SIGTTIN_PORTABLE 21
+#define SIGTTOU_PORTABLE 22
+#define SIGURG_PORTABLE 23
+#define SIGXCPU_PORTABLE 24
+#define SIGXFSZ_PORTABLE 25
+#define SIGVTALRM_PORTABLE 26
+#define SIGPROF_PORTABLE 27
+#define SIGWINCH_PORTABLE 28
+#define SIGIO_PORTABLE 29
+#define SIGPOLL_PORTABLE SIGIO
+
+#define SIGPWR_PORTABLE 30
+#define SIGSYS_PORTABLE 31
+#define SIGUNUSED_PORTABLE 31
+
+#define SIGSWI_PORTABLE 32
+#define SIGRTMIN_PORTABLE 32
+
+#define SIGRT_1_PORTABLE (SIGRTMIN_PORTABLE + 1)
+#define SIGRT_2_PORTABLE (SIGRTMIN_PORTABLE + 2)
+#define SIGRT_3_PORTABLE (SIGRTMIN_PORTABLE + 3)
+#define SIGRT_4_PORTABLE (SIGRTMIN_PORTABLE + 4)
+#define SIGRT_5_PORTABLE (SIGRTMIN_PORTABLE + 5)
+#define SIGRT_5_PORTABLE (SIGRTMIN_PORTABLE + 5)
+#define SIGRT_6_PORTABLE (SIGRTMIN_PORTABLE + 6)
+#define SIGRT_7_PORTABLE (SIGRTMIN_PORTABLE + 7)
+#define SIGRT_8_PORTABLE (SIGRTMIN_PORTABLE + 8)
+#define SIGRT_9_PORTABLE (SIGRTMIN_PORTABLE + 9)
+#define SIGRT_10_PORTABLE (SIGRTMIN_PORTABLE + 10)
+#define SIGRT_11_PORTABLE (SIGRTMIN_PORTABLE + 11)
+#define SIGRT_12_PORTABLE (SIGRTMIN_PORTABLE + 12)
+#define SIGRT_13_PORTABLE (SIGRTMIN_PORTABLE + 13)
+#define SIGRT_14_PORTABLE (SIGRTMIN_PORTABLE + 14)
+#define SIGRT_15_PORTABLE (SIGRTMIN_PORTABLE + 15)
+#define SIGRT_15_PORTABLE (SIGRTMIN_PORTABLE + 15)
+#define SIGRT_16_PORTABLE (SIGRTMIN_PORTABLE + 16)
+#define SIGRT_17_PORTABLE (SIGRTMIN_PORTABLE + 17)
+#define SIGRT_18_PORTABLE (SIGRTMIN_PORTABLE + 18)
+#define SIGRT_19_PORTABLE (SIGRTMIN_PORTABLE + 19)
+#define SIGRT_20_PORTABLE (SIGRTMIN_PORTABLE + 20)
+#define SIGRT_20_PORTABLE (SIGRTMIN_PORTABLE + 20)
+#define SIGRT_21_PORTABLE (SIGRTMIN_PORTABLE + 21)
+#define SIGRT_22_PORTABLE (SIGRTMIN_PORTABLE + 22)
+#define SIGRT_23_PORTABLE (SIGRTMIN_PORTABLE + 23)
+#define SIGRT_24_PORTABLE (SIGRTMIN_PORTABLE + 24)
+#define SIGRT_25_PORTABLE (SIGRTMIN_PORTABLE + 25)
+#define SIGRT_25_PORTABLE (SIGRTMIN_PORTABLE + 25)
+#define SIGRT_26_PORTABLE (SIGRTMIN_PORTABLE + 26)
+#define SIGRT_27_PORTABLE (SIGRTMIN_PORTABLE + 27)
+#define SIGRT_28_PORTABLE (SIGRTMIN_PORTABLE + 28)
+#define SIGRT_29_PORTABLE (SIGRTMIN_PORTABLE + 29)
+#define SIGRT_30_PORTABLE (SIGRTMIN_PORTABLE + 30)
+#define SIGRT_31_PORTABLE (SIGRTMIN_PORTABLE + 31)
+#define SIGRT_32_PORTABLE (SIGRTMIN_PORTABLE + 32)
+
+#define SIGRTMAX_PORTABLE NSIG_PORTABLE
+
+/*
+ * Define MIPS/Native Real Time Signal Names for debugging.
+ * NOTE:
+ * Currently only defining the 32 RT signals that the
+ * lib-portable application can interact with. MIPS has
+ * an additional 63 signals.
+ */
+#define SIGRT_1 (SIGRTMIN + 1)
+#define SIGRT_2 (SIGRTMIN + 2)
+#define SIGRT_3 (SIGRTMIN + 3)
+#define SIGRT_4 (SIGRTMIN + 4)
+#define SIGRT_5 (SIGRTMIN + 5)
+#define SIGRT_5 (SIGRTMIN + 5)
+#define SIGRT_6 (SIGRTMIN + 6)
+#define SIGRT_7 (SIGRTMIN + 7)
+#define SIGRT_8 (SIGRTMIN + 8)
+#define SIGRT_9 (SIGRTMIN + 9)
+#define SIGRT_10 (SIGRTMIN + 10)
+#define SIGRT_11 (SIGRTMIN + 11)
+#define SIGRT_12 (SIGRTMIN + 12)
+#define SIGRT_13 (SIGRTMIN + 13)
+#define SIGRT_14 (SIGRTMIN + 14)
+#define SIGRT_15 (SIGRTMIN + 15)
+#define SIGRT_15 (SIGRTMIN + 15)
+#define SIGRT_16 (SIGRTMIN + 16)
+#define SIGRT_17 (SIGRTMIN + 17)
+#define SIGRT_18 (SIGRTMIN + 18)
+#define SIGRT_19 (SIGRTMIN + 19)
+#define SIGRT_20 (SIGRTMIN + 20)
+#define SIGRT_20 (SIGRTMIN + 20)
+#define SIGRT_21 (SIGRTMIN + 21)
+#define SIGRT_22 (SIGRTMIN + 22)
+#define SIGRT_23 (SIGRTMIN + 23)
+#define SIGRT_24 (SIGRTMIN + 24)
+#define SIGRT_25 (SIGRTMIN + 25)
+#define SIGRT_25 (SIGRTMIN + 25)
+#define SIGRT_26 (SIGRTMIN + 26)
+#define SIGRT_27 (SIGRTMIN + 27)
+#define SIGRT_28 (SIGRTMIN + 28)
+#define SIGRT_29 (SIGRTMIN + 29)
+#define SIGRT_30 (SIGRTMIN + 30)
+#define SIGRT_31 (SIGRTMIN + 31)
+#define SIGRT_32 (SIGRTMIN + 32)
+/*
+ * NOTE: Native signals SIGRT_33 ... SIGRTMAX
+ * can't be used by a lib-portable application.
+ */
+
+#define SA_NOCLDSTOP_PORTABLE 0x00000001
+#define SA_NOCLDWAIT_PORTABLE 0x00000002
+#define SA_SIGINFO_PORTABLE 0x00000004
+#define SA_THIRTYTWO_PORTABLE 0x02000000
+#define SA_RESTORER_PORTABLE 0x04000000
+#define SA_ONSTACK_PORTABLE 0x08000000
+#define SA_RESTART_PORTABLE 0x10000000
+#define SA_NODEFER_PORTABLE 0x40000000
+#define SA_RESETHAND_PORTABLE 0x80000000
+
+#define SA_NOMASK_PORTSBLE SA_NODEFER_PORTABLE
+#define SA_ONESHOT_PORTABLE SA_RESETHAND_PORABLE
+
+
+#include <asm-generic/signal_portable.h>
+
+typedef __signalfn_t __user *__sighandler_portable_t;
+typedef void (*__sigaction_handler_portable_t)(int, struct siginfo *, void *);
+
+struct sigaction_portable {
+ union {
+ __sighandler_portable_t _sa_handler;
+ __sigaction_handler_portable_t _sa_sigaction;
+ } _u;
+ sigset_portable_t sa_mask;
+ unsigned long sa_flags;
+ void (*sa_restorer)(void);
+};
+
+#define sa_handler_portable _u._sa_handler
+#define sa_sigaction_portable _u._sa_sigaction
+
+typedef struct sigaltstack_portable {
+ void __user *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+} portable_stack_t;
+
+#endif
diff --git a/ndk/sources/android/libportable/common/include/asm/unistd-portable.h b/ndk/sources/android/libportable/common/include/asm/unistd-portable.h
new file mode 100644
index 000000000..a542e9244
--- /dev/null
+++ b/ndk/sources/android/libportable/common/include/asm/unistd-portable.h
@@ -0,0 +1,401 @@
+#ifndef __ASM_UNISTD_PORTABLE_H
+#define __ASM_UNISTD_PORTABLE_H
+
+/* Derived from android-14/arch-arm/usr/include/asm/unistd.h */
+
+#define __NR_SYSCALL_BASE_portable 0
+
+#define __NR_restart_syscall_portable (__NR_SYSCALL_BASE_portable+ 0)
+#define __NR_exit_portable (__NR_SYSCALL_BASE_portable+ 1)
+#define __NR_fork_portable (__NR_SYSCALL_BASE_portable+ 2)
+#define __NR_read_portable (__NR_SYSCALL_BASE_portable+ 3)
+#define __NR_write_portable (__NR_SYSCALL_BASE_portable+ 4)
+#define __NR_open_portable (__NR_SYSCALL_BASE_portable+ 5)
+#define __NR_close_portable (__NR_SYSCALL_BASE_portable+ 6)
+
+#define __NR_creat_portable (__NR_SYSCALL_BASE_portable+ 8)
+#define __NR_link_portable (__NR_SYSCALL_BASE_portable+ 9)
+#define __NR_unlink_portable (__NR_SYSCALL_BASE_portable+ 10)
+#define __NR_execve_portable (__NR_SYSCALL_BASE_portable+ 11)
+#define __NR_chdir_portable (__NR_SYSCALL_BASE_portable+ 12)
+#define __NR_time_portable (__NR_SYSCALL_BASE_portable+ 13)
+#define __NR_mknod_portable (__NR_SYSCALL_BASE_portable+ 14)
+#define __NR_chmod_portable (__NR_SYSCALL_BASE_portable+ 15)
+#define __NR_lchown_portable (__NR_SYSCALL_BASE_portable+ 16)
+
+#define __NR_lseek_portable (__NR_SYSCALL_BASE_portable+ 19)
+#define __NR_getpid_portable (__NR_SYSCALL_BASE_portable+ 20)
+#define __NR_mount_portable (__NR_SYSCALL_BASE_portable+ 21)
+#define __NR_umount_portable (__NR_SYSCALL_BASE_portable+ 22)
+#define __NR_setuid_portable (__NR_SYSCALL_BASE_portable+ 23)
+#define __NR_getuid_portable (__NR_SYSCALL_BASE_portable+ 24)
+#define __NR_stime_portable (__NR_SYSCALL_BASE_portable+ 25)
+#define __NR_ptrace_portable (__NR_SYSCALL_BASE_portable+ 26)
+#define __NR_alarm_portable (__NR_SYSCALL_BASE_portable+ 27)
+
+#define __NR_pause_portable (__NR_SYSCALL_BASE_portable+ 29)
+#define __NR_utime_portable (__NR_SYSCALL_BASE_portable+ 30)
+
+#define __NR_access_portable (__NR_SYSCALL_BASE_portable+ 33)
+#define __NR_nice_portable (__NR_SYSCALL_BASE_portable+ 34)
+
+#define __NR_sync_portable (__NR_SYSCALL_BASE_portable+ 36)
+#define __NR_kill_portable (__NR_SYSCALL_BASE_portable+ 37)
+#define __NR_rename_portable (__NR_SYSCALL_BASE_portable+ 38)
+#define __NR_mkdir_portable (__NR_SYSCALL_BASE_portable+ 39)
+#define __NR_rmdir_portable (__NR_SYSCALL_BASE_portable+ 40)
+#define __NR_dup_portable (__NR_SYSCALL_BASE_portable+ 41)
+#define __NR_pipe_portable (__NR_SYSCALL_BASE_portable+ 42)
+#define __NR_times_portable (__NR_SYSCALL_BASE_portable+ 43)
+
+#define __NR_brk_portable (__NR_SYSCALL_BASE_portable+ 45)
+#define __NR_setgid_portable (__NR_SYSCALL_BASE_portable+ 46)
+#define __NR_getgid_portable (__NR_SYSCALL_BASE_portable+ 47)
+
+#define __NR_geteuid_portable (__NR_SYSCALL_BASE_portable+ 49)
+#define __NR_getegid_portable (__NR_SYSCALL_BASE_portable+ 50)
+#define __NR_acct_portable (__NR_SYSCALL_BASE_portable+ 51)
+#define __NR_umount2_portable (__NR_SYSCALL_BASE_portable+ 52)
+
+#define __NR_ioctl_portable (__NR_SYSCALL_BASE_portable+ 54)
+#define __NR_fcntl_portable (__NR_SYSCALL_BASE_portable+ 55)
+
+#define __NR_setpgid_portable (__NR_SYSCALL_BASE_portable+ 57)
+
+#define __NR_umask_portable (__NR_SYSCALL_BASE_portable+ 60)
+#define __NR_chroot_portable (__NR_SYSCALL_BASE_portable+ 61)
+#define __NR_ustat_portable (__NR_SYSCALL_BASE_portable+ 62)
+#define __NR_dup2_portable (__NR_SYSCALL_BASE_portable+ 63)
+#define __NR_getppid_portable (__NR_SYSCALL_BASE_portable+ 64)
+#define __NR_getpgrp_portable (__NR_SYSCALL_BASE_portable+ 65)
+#define __NR_setsid_portable (__NR_SYSCALL_BASE_portable+ 66)
+#define __NR_sigaction_portable (__NR_SYSCALL_BASE_portable+ 67)
+
+#define __NR_setreuid_portable (__NR_SYSCALL_BASE_portable+ 70)
+#define __NR_setregid_portable (__NR_SYSCALL_BASE_portable+ 71)
+#define __NR_sigsuspend_portable (__NR_SYSCALL_BASE_portable+ 72)
+#define __NR_sigpending_portable (__NR_SYSCALL_BASE_portable+ 73)
+#define __NR_sethostname_portable (__NR_SYSCALL_BASE_portable+ 74)
+#define __NR_setrlimit_portable (__NR_SYSCALL_BASE_portable+ 75)
+#define __NR_getrlimit_portable (__NR_SYSCALL_BASE_portable+ 76)
+#define __NR_getrusage_portable (__NR_SYSCALL_BASE_portable+ 77)
+#define __NR_gettimeofday_portable (__NR_SYSCALL_BASE_portable+ 78)
+#define __NR_settimeofday_portable (__NR_SYSCALL_BASE_portable+ 79)
+#define __NR_getgroups_portable (__NR_SYSCALL_BASE_portable+ 80)
+#define __NR_setgroups_portable (__NR_SYSCALL_BASE_portable+ 81)
+#define __NR_select_portable (__NR_SYSCALL_BASE_portable+ 82)
+#define __NR_symlink_portable (__NR_SYSCALL_BASE_portable+ 83)
+
+#define __NR_readlink_portable (__NR_SYSCALL_BASE_portable+ 85)
+#define __NR_uselib_portable (__NR_SYSCALL_BASE_portable+ 86)
+#define __NR_swapon_portable (__NR_SYSCALL_BASE_portable+ 87)
+#define __NR_reboot_portable (__NR_SYSCALL_BASE_portable+ 88)
+#define __NR_readdir_portable (__NR_SYSCALL_BASE_portable+ 89)
+#define __NR_mmap_portable (__NR_SYSCALL_BASE_portable+ 90)
+#define __NR_munmap_portable (__NR_SYSCALL_BASE_portable+ 91)
+#define __NR_truncate_portable (__NR_SYSCALL_BASE_portable+ 92)
+#define __NR_ftruncate_portable (__NR_SYSCALL_BASE_portable+ 93)
+#define __NR_fchmod_portable (__NR_SYSCALL_BASE_portable+ 94)
+#define __NR_fchown_portable (__NR_SYSCALL_BASE_portable+ 95)
+#define __NR_getpriority_portable (__NR_SYSCALL_BASE_portable+ 96)
+#define __NR_setpriority_portable (__NR_SYSCALL_BASE_portable+ 97)
+
+#define __NR_statfs_portable (__NR_SYSCALL_BASE_portable+ 99)
+#define __NR_fstatfs_portable (__NR_SYSCALL_BASE_portable+100)
+
+#define __NR_socketcall_portable (__NR_SYSCALL_BASE_portable+102)
+#define __NR_syslog_portable (__NR_SYSCALL_BASE_portable+103)
+#define __NR_setitimer_portable (__NR_SYSCALL_BASE_portable+104)
+#define __NR_getitimer_portable (__NR_SYSCALL_BASE_portable+105)
+#define __NR_stat_portable (__NR_SYSCALL_BASE_portable+106)
+#define __NR_lstat_portable (__NR_SYSCALL_BASE_portable+107)
+#define __NR_fstat_portable (__NR_SYSCALL_BASE_portable+108)
+
+#define __NR_vhangup_portable (__NR_SYSCALL_BASE_portable+111)
+
+#define __NR_syscall_portable (__NR_SYSCALL_BASE_portable+113)
+#define __NR_wait4_portable (__NR_SYSCALL_BASE_portable+114)
+#define __NR_swapoff_portable (__NR_SYSCALL_BASE_portable+115)
+#define __NR_sysinfo_portable (__NR_SYSCALL_BASE_portable+116)
+#define __NR_ipc_portable (__NR_SYSCALL_BASE_portable+117)
+#define __NR_fsync_portable (__NR_SYSCALL_BASE_portable+118)
+#define __NR_sigreturn_portable (__NR_SYSCALL_BASE_portable+119)
+#define __NR_clone_portable (__NR_SYSCALL_BASE_portable+120)
+#define __NR_setdomainname_portable (__NR_SYSCALL_BASE_portable+121)
+#define __NR_uname_portable (__NR_SYSCALL_BASE_portable+122)
+
+#define __NR_adjtimex_portable (__NR_SYSCALL_BASE_portable+124)
+#define __NR_mprotect_portable (__NR_SYSCALL_BASE_portable+125)
+#define __NR_sigprocmask_portable (__NR_SYSCALL_BASE_portable+126)
+
+#define __NR_init_module_portable (__NR_SYSCALL_BASE_portable+128)
+#define __NR_delete_module_portable (__NR_SYSCALL_BASE_portable+129)
+
+#define __NR_quotactl_portable (__NR_SYSCALL_BASE_portable+131)
+#define __NR_getpgid_portable (__NR_SYSCALL_BASE_portable+132)
+#define __NR_fchdir_portable (__NR_SYSCALL_BASE_portable+133)
+#define __NR_bdflush_portable (__NR_SYSCALL_BASE_portable+134)
+#define __NR_sysfs_portable (__NR_SYSCALL_BASE_portable+135)
+#define __NR_personality_portable (__NR_SYSCALL_BASE_portable+136)
+
+#define __NR_setfsuid_portable (__NR_SYSCALL_BASE_portable+138)
+#define __NR_setfsgid_portable (__NR_SYSCALL_BASE_portable+139)
+#define __NR__llseek_portable (__NR_SYSCALL_BASE_portable+140)
+#define __NR_getdents_portable (__NR_SYSCALL_BASE_portable+141)
+#define __NR__newselect_portable (__NR_SYSCALL_BASE_portable+142)
+#define __NR_flock_portable (__NR_SYSCALL_BASE_portable+143)
+#define __NR_msync_portable (__NR_SYSCALL_BASE_portable+144)
+#define __NR_readv_portable (__NR_SYSCALL_BASE_portable+145)
+#define __NR_writev_portable (__NR_SYSCALL_BASE_portable+146)
+#define __NR_getsid_portable (__NR_SYSCALL_BASE_portable+147)
+#define __NR_fdatasync_portable (__NR_SYSCALL_BASE_portable+148)
+#define __NR__sysctl_portable (__NR_SYSCALL_BASE_portable+149)
+#define __NR_mlock_portable (__NR_SYSCALL_BASE_portable+150)
+#define __NR_munlock_portable (__NR_SYSCALL_BASE_portable+151)
+#define __NR_mlockall_portable (__NR_SYSCALL_BASE_portable+152)
+#define __NR_munlockall_portable (__NR_SYSCALL_BASE_portable+153)
+#define __NR_sched_setparam_portable (__NR_SYSCALL_BASE_portable+154)
+#define __NR_sched_getparam_portable (__NR_SYSCALL_BASE_portable+155)
+#define __NR_sched_setscheduler_portable (__NR_SYSCALL_BASE_portable+156)
+#define __NR_sched_getscheduler_portable (__NR_SYSCALL_BASE_portable+157)
+#define __NR_sched_yield_portable (__NR_SYSCALL_BASE_portable+158)
+#define __NR_sched_get_priority_max_portable (__NR_SYSCALL_BASE_portable+159)
+#define __NR_sched_get_priority_min_portable (__NR_SYSCALL_BASE_portable+160)
+#define __NR_sched_rr_get_interval_portable (__NR_SYSCALL_BASE_portable+161)
+#define __NR_nanosleep_portable (__NR_SYSCALL_BASE_portable+162)
+#define __NR_mremap_portable (__NR_SYSCALL_BASE_portable+163)
+#define __NR_setresuid_portable (__NR_SYSCALL_BASE_portable+164)
+#define __NR_getresuid_portable (__NR_SYSCALL_BASE_portable+165)
+
+#define __NR_poll_portable (__NR_SYSCALL_BASE_portable+168)
+#define __NR_nfsservctl_portable (__NR_SYSCALL_BASE_portable+169)
+#define __NR_setresgid_portable (__NR_SYSCALL_BASE_portable+170)
+#define __NR_getresgid_portable (__NR_SYSCALL_BASE_portable+171)
+#define __NR_prctl_portable (__NR_SYSCALL_BASE_portable+172)
+#define __NR_rt_sigreturn_portable (__NR_SYSCALL_BASE_portable+173)
+#define __NR_rt_sigaction_portable (__NR_SYSCALL_BASE_portable+174)
+#define __NR_rt_sigprocmask_portable (__NR_SYSCALL_BASE_portable+175)
+#define __NR_rt_sigpending_portable (__NR_SYSCALL_BASE_portable+176)
+#define __NR_rt_sigtimedwait_portable (__NR_SYSCALL_BASE_portable+177)
+#define __NR_rt_sigqueueinfo_portable (__NR_SYSCALL_BASE_portable+178)
+#define __NR_rt_sigsuspend_portable (__NR_SYSCALL_BASE_portable+179)
+#define __NR_pread64_portable (__NR_SYSCALL_BASE_portable+180)
+#define __NR_pwrite64_portable (__NR_SYSCALL_BASE_portable+181)
+#define __NR_chown_portable (__NR_SYSCALL_BASE_portable+182)
+#define __NR_getcwd_portable (__NR_SYSCALL_BASE_portable+183)
+#define __NR_capget_portable (__NR_SYSCALL_BASE_portable+184)
+#define __NR_capset_portable (__NR_SYSCALL_BASE_portable+185)
+#define __NR_sigaltstack_portable (__NR_SYSCALL_BASE_portable+186)
+#define __NR_sendfile_portable (__NR_SYSCALL_BASE_portable+187)
+
+#define __NR_vfork_portable (__NR_SYSCALL_BASE_portable+190)
+#define __NR_ugetrlimit_portable (__NR_SYSCALL_BASE_portable+191)
+#define __NR_mmap2_portable (__NR_SYSCALL_BASE_portable+192)
+#define __NR_truncate64_portable (__NR_SYSCALL_BASE_portable+193)
+#define __NR_ftruncate64_portable (__NR_SYSCALL_BASE_portable+194)
+#define __NR_stat64_portable (__NR_SYSCALL_BASE_portable+195)
+#define __NR_lstat64_portable (__NR_SYSCALL_BASE_portable+196)
+#define __NR_fstat64_portable (__NR_SYSCALL_BASE_portable+197)
+#define __NR_lchown32_portable (__NR_SYSCALL_BASE_portable+198)
+#define __NR_getuid32_portable (__NR_SYSCALL_BASE_portable+199)
+#define __NR_getgid32_portable (__NR_SYSCALL_BASE_portable+200)
+#define __NR_geteuid32_portable (__NR_SYSCALL_BASE_portable+201)
+#define __NR_getegid32_portable (__NR_SYSCALL_BASE_portable+202)
+#define __NR_setreuid32_portable (__NR_SYSCALL_BASE_portable+203)
+#define __NR_setregid32_portable (__NR_SYSCALL_BASE_portable+204)
+#define __NR_getgroups32_portable (__NR_SYSCALL_BASE_portable+205)
+#define __NR_setgroups32_portable (__NR_SYSCALL_BASE_portable+206)
+#define __NR_fchown32_portable (__NR_SYSCALL_BASE_portable+207)
+#define __NR_setresuid32_portable (__NR_SYSCALL_BASE_portable+208)
+#define __NR_getresuid32_portable (__NR_SYSCALL_BASE_portable+209)
+#define __NR_setresgid32_portable (__NR_SYSCALL_BASE_portable+210)
+#define __NR_getresgid32_portable (__NR_SYSCALL_BASE_portable+211)
+#define __NR_chown32_portable (__NR_SYSCALL_BASE_portable+212)
+#define __NR_setuid32_portable (__NR_SYSCALL_BASE_portable+213)
+#define __NR_setgid32_portable (__NR_SYSCALL_BASE_portable+214)
+#define __NR_setfsuid32_portable (__NR_SYSCALL_BASE_portable+215)
+#define __NR_setfsgid32_portable (__NR_SYSCALL_BASE_portable+216)
+#define __NR_getdents64_portable (__NR_SYSCALL_BASE_portable+217)
+#define __NR_pivot_root_portable (__NR_SYSCALL_BASE_portable+218)
+#define __NR_mincore_portable (__NR_SYSCALL_BASE_portable+219)
+#define __NR_madvise_portable (__NR_SYSCALL_BASE_portable+220)
+#define __NR_fcntl64_portable (__NR_SYSCALL_BASE_portable+221)
+
+#define __NR_gettid_portable (__NR_SYSCALL_BASE_portable+224)
+#define __NR_readahead_portable (__NR_SYSCALL_BASE_portable+225)
+#define __NR_setxattr_portable (__NR_SYSCALL_BASE_portable+226)
+#define __NR_lsetxattr_portable (__NR_SYSCALL_BASE_portable+227)
+#define __NR_fsetxattr_portable (__NR_SYSCALL_BASE_portable+228)
+#define __NR_getxattr_portable (__NR_SYSCALL_BASE_portable+229)
+#define __NR_lgetxattr_portable (__NR_SYSCALL_BASE_portable+230)
+#define __NR_fgetxattr_portable (__NR_SYSCALL_BASE_portable+231)
+#define __NR_listxattr_portable (__NR_SYSCALL_BASE_portable+232)
+#define __NR_llistxattr_portable (__NR_SYSCALL_BASE_portable+233)
+#define __NR_flistxattr_portable (__NR_SYSCALL_BASE_portable+234)
+#define __NR_removexattr_portable (__NR_SYSCALL_BASE_portable+235)
+#define __NR_lremovexattr_portable (__NR_SYSCALL_BASE_portable+236)
+#define __NR_fremovexattr_portable (__NR_SYSCALL_BASE_portable+237)
+#define __NR_tkill_portable (__NR_SYSCALL_BASE_portable+238)
+#define __NR_sendfile64_portable (__NR_SYSCALL_BASE_portable+239)
+#define __NR_futex_portable (__NR_SYSCALL_BASE_portable+240)
+#define __NR_sched_setaffinity_portable (__NR_SYSCALL_BASE_portable+241)
+#define __NR_sched_getaffinity_portable (__NR_SYSCALL_BASE_portable+242)
+#define __NR_io_setup_portable (__NR_SYSCALL_BASE_portable+243)
+#define __NR_io_destroy_portable (__NR_SYSCALL_BASE_portable+244)
+#define __NR_io_getevents_portable (__NR_SYSCALL_BASE_portable+245)
+#define __NR_io_submit_portable (__NR_SYSCALL_BASE_portable+246)
+#define __NR_io_cancel_portable (__NR_SYSCALL_BASE_portable+247)
+#define __NR_exit_group_portable (__NR_SYSCALL_BASE_portable+248)
+#define __NR_lookup_dcookie_portable (__NR_SYSCALL_BASE_portable+249)
+#define __NR_epoll_create_portable (__NR_SYSCALL_BASE_portable+250)
+#define __NR_epoll_ctl_portable (__NR_SYSCALL_BASE_portable+251)
+#define __NR_epoll_wait_portable (__NR_SYSCALL_BASE_portable+252)
+#define __NR_remap_file_pages_portable (__NR_SYSCALL_BASE_portable+253)
+
+#define __NR_set_tid_address_portable (__NR_SYSCALL_BASE_portable+256)
+#define __NR_timer_create_portable (__NR_SYSCALL_BASE_portable+257)
+#define __NR_timer_settime_portable (__NR_SYSCALL_BASE_portable+258)
+#define __NR_timer_gettime_portable (__NR_SYSCALL_BASE_portable+259)
+#define __NR_timer_getoverrun_portable (__NR_SYSCALL_BASE_portable+260)
+#define __NR_timer_delete_portable (__NR_SYSCALL_BASE_portable+261)
+#define __NR_clock_settime_portable (__NR_SYSCALL_BASE_portable+262)
+#define __NR_clock_gettime_portable (__NR_SYSCALL_BASE_portable+263)
+#define __NR_clock_getres_portable (__NR_SYSCALL_BASE_portable+264)
+#define __NR_clock_nanosleep_portable (__NR_SYSCALL_BASE_portable+265)
+#define __NR_statfs64_portable (__NR_SYSCALL_BASE_portable+266)
+#define __NR_fstatfs64_portable (__NR_SYSCALL_BASE_portable+267)
+#define __NR_tgkill_portable (__NR_SYSCALL_BASE_portable+268)
+#define __NR_utimes_portable (__NR_SYSCALL_BASE_portable+269)
+#define __NR_arm_fadvise64_64_portable (__NR_SYSCALL_BASE_portable+270)
+#define __NR_pciconfig_iobase_portable (__NR_SYSCALL_BASE_portable+271)
+#define __NR_pciconfig_read_portable (__NR_SYSCALL_BASE_portable+272)
+#define __NR_pciconfig_write_portable (__NR_SYSCALL_BASE_portable+273)
+#define __NR_mq_open_portable (__NR_SYSCALL_BASE_portable+274)
+#define __NR_mq_unlink_portable (__NR_SYSCALL_BASE_portable+275)
+#define __NR_mq_timedsend_portable (__NR_SYSCALL_BASE_portable+276)
+#define __NR_mq_timedreceive_portable (__NR_SYSCALL_BASE_portable+277)
+#define __NR_mq_notify_portable (__NR_SYSCALL_BASE_portable+278)
+#define __NR_mq_getsetattr_portable (__NR_SYSCALL_BASE_portable+279)
+#define __NR_waitid_portable (__NR_SYSCALL_BASE_portable+280)
+#define __NR_socket_portable (__NR_SYSCALL_BASE_portable+281)
+#define __NR_bind_portable (__NR_SYSCALL_BASE_portable+282)
+#define __NR_connect_portable (__NR_SYSCALL_BASE_portable+283)
+#define __NR_listen_portable (__NR_SYSCALL_BASE_portable+284)
+#define __NR_accept_portable (__NR_SYSCALL_BASE_portable+285)
+#define __NR_getsockname_portable (__NR_SYSCALL_BASE_portable+286)
+#define __NR_getpeername_portable (__NR_SYSCALL_BASE_portable+287)
+#define __NR_socketpair_portable (__NR_SYSCALL_BASE_portable+288)
+#define __NR_send_portable (__NR_SYSCALL_BASE_portable+289)
+#define __NR_sendto_portable (__NR_SYSCALL_BASE_portable+290)
+#define __NR_recv_portable (__NR_SYSCALL_BASE_portable+291)
+#define __NR_recvfrom_portable (__NR_SYSCALL_BASE_portable+292)
+#define __NR_shutdown_portable (__NR_SYSCALL_BASE_portable+293)
+#define __NR_setsockopt_portable (__NR_SYSCALL_BASE_portable+294)
+#define __NR_getsockopt_portable (__NR_SYSCALL_BASE_portable+295)
+#define __NR_sendmsg_portable (__NR_SYSCALL_BASE_portable+296)
+#define __NR_recvmsg_portable (__NR_SYSCALL_BASE_portable+297)
+#define __NR_semop_portable (__NR_SYSCALL_BASE_portable+298)
+#define __NR_semget_portable (__NR_SYSCALL_BASE_portable+299)
+#define __NR_semctl_portable (__NR_SYSCALL_BASE_portable+300)
+#define __NR_msgsnd_portable (__NR_SYSCALL_BASE_portable+301)
+#define __NR_msgrcv_portable (__NR_SYSCALL_BASE_portable+302)
+#define __NR_msgget_portable (__NR_SYSCALL_BASE_portable+303)
+#define __NR_msgctl_portable (__NR_SYSCALL_BASE_portable+304)
+#define __NR_shmat_portable (__NR_SYSCALL_BASE_portable+305)
+#define __NR_shmdt_portable (__NR_SYSCALL_BASE_portable+306)
+#define __NR_shmget_portable (__NR_SYSCALL_BASE_portable+307)
+#define __NR_shmctl_portable (__NR_SYSCALL_BASE_portable+308)
+#define __NR_add_key_portable (__NR_SYSCALL_BASE_portable+309)
+#define __NR_request_key_portable (__NR_SYSCALL_BASE_portable+310)
+#define __NR_keyctl_portable (__NR_SYSCALL_BASE_portable+311)
+#define __NR_semtimedop_portable (__NR_SYSCALL_BASE_portable+312)
+#define __NR_vserver_portable (__NR_SYSCALL_BASE_portable+313)
+#define __NR_ioprio_set_portable (__NR_SYSCALL_BASE_portable+314)
+#define __NR_ioprio_get_portable (__NR_SYSCALL_BASE_portable+315)
+#define __NR_inotify_init_portable (__NR_SYSCALL_BASE_portable+316)
+#define __NR_inotify_add_watch_portable (__NR_SYSCALL_BASE_portable+317)
+#define __NR_inotify_rm_watch_portable (__NR_SYSCALL_BASE_portable+318)
+#define __NR_mbind_portable (__NR_SYSCALL_BASE_portable+319)
+#define __NR_get_mempolicy_portable (__NR_SYSCALL_BASE_portable+320)
+#define __NR_set_mempolicy_portable (__NR_SYSCALL_BASE_portable+321)
+
+#define __NR_openat_portable (__NR_SYSCALL_BASE_portable+322)
+#define __NR_mkdirat_portable (__NR_SYSCALL_BASE_portable+323)
+#define __NR_mknodat_portable (__NR_SYSCALL_BASE_portable+324)
+#define __NR_fchownat_portable (__NR_SYSCALL_BASE_portable+325)
+#define __NR_futimesat_portable (__NR_SYSCALL_BASE_portable+326)
+#define __NR_fstatat64_portable (__NR_SYSCALL_BASE_portable+327)
+#define __NR_unlinkat_portable (__NR_SYSCALL_BASE_portable+328)
+#define __NR_renameat_portable (__NR_SYSCALL_BASE_portable+329)
+#define __NR_linkat_portable (__NR_SYSCALL_BASE_portable+330)
+#define __NR_symlinkat_portable (__NR_SYSCALL_BASE_portable+331)
+#define __NR_readlinkat_portable (__NR_SYSCALL_BASE_portable+332)
+#define __NR_fchmodat_portable (__NR_SYSCALL_BASE_portable+333)
+#define __NR_faccessat_portable (__NR_SYSCALL_BASE_portable+334)
+#define __NR_pselect6_portable (__NR_SYSCALL_BASE_portable+335)
+#define __NR_ppoll_portable (__NR_SYSCALL_BASE_portable+336)
+#define __NR_unshare_portable (__NR_SYSCALL_BASE_portable+337)
+#define __NR_set_robust_list_portable (__NR_SYSCALL_BASE_portable+338)
+#define __NR_get_robust_list_portable (__NR_SYSCALL_BASE_portable+339)
+#define __NR_splice_portable (__NR_SYSCALL_BASE_portable+340)
+#define __NR_arm_sync_file_range_portable (__NR_SYSCALL_BASE_portable+341)
+#define __NR_tee_portable (__NR_SYSCALL_BASE_portable+342)
+#define __NR_vmsplice_portable (__NR_SYSCALL_BASE_portable+343)
+#define __NR_move_pages_portable (__NR_SYSCALL_BASE_portable+344)
+#define __NR_getcpu_portable (__NR_SYSCALL_BASE_portable+345)
+#define __NR_epoll_pwait_portable (__NR_SYSCALL_BASE_portable+346)
+#define __NR_kexec_load_portable (__NR_SYSCALL_BASE_portable+347)
+#define __NR_utimensat_portable (__NR_SYSCALL_BASE_portable+348)
+#define __NR_signalfd_portable (__NR_SYSCALL_BASE_portable+349)
+#define __NR_timerfd_create_portable (__NR_SYSCALL_BASE_portable+350)
+#define __NR_eventfd_portable (__NR_SYSCALL_BASE_portable+351)
+#define __NR_fallocate_portable (__NR_SYSCALL_BASE_portable+352)
+#define __NR_timerfd_settime_portable (__NR_SYSCALL_BASE_portable+353)
+#define __NR_timerfd_gettime_portable (__NR_SYSCALL_BASE_portable+354)
+#define __NR_signalfd4_portable (__NR_SYSCALL_BASE_portable+355)
+#define __NR_eventfd2_portable (__NR_SYSCALL_BASE_portable+356)
+#define __NR_epoll_create1_portable (__NR_SYSCALL_BASE_portable+357)
+#define __NR_dup3_portable (__NR_SYSCALL_BASE_portable+358)
+#define __NR_pipe2_portable (__NR_SYSCALL_BASE_portable+359)
+#define __NR_inotify_init1_portable (__NR_SYSCALL_BASE_portable+360)
+#define __NR_preadv_portable (__NR_SYSCALL_BASE_portable+361)
+#define __NR_pwritev_portable (__NR_SYSCALL_BASE_portable+362)
+#define __NR_rt_tgsigqueueinfo_portable (__NR_SYSCALL_BASE_portable+363)
+#define __NR_perf_event_open_portable (__NR_SYSCALL_BASE_portable+364)
+#define __NR_recvmmsg_portable (__NR_SYSCALL_BASE_portable+365)
+#define __NR_accept4_portable (__NR_SYSCALL_BASE_portable+366)
+#define __NR_fanotify_init_portable (__NR_SYSCALL_BASE_portable+367)
+#define __NR_fanotify_mark_portable (__NR_SYSCALL_BASE_portable+368)
+#define __NR_prlimit64_portable (__NR_SYSCALL_BASE_portable+369)
+#define __NR_name_to_handle_at_portable (__NR_SYSCALL_BASE_portable+370)
+#define __NR_open_by_handle_at_portable (__NR_SYSCALL_BASE_portable+371)
+#define __NR_clock_adjtime_portable (__NR_SYSCALL_BASE_portable+372)
+#define __NR_syncfs_portable (__NR_SYSCALL_BASE_portable+373)
+#define __NR_sendmmsg_portable (__NR_SYSCALL_BASE_portable+374)
+#define __NR_setns_portable (__NR_SYSCALL_BASE_portable+375)
+#define __NR_process_vm_readv_portable (__NR_SYSCALL_BASE_portable+376)
+#define __NR_process_vm_writev_portable (__NR_SYSCALL_BASE_portable+377)
+
+
+#define __ARM_NR_BASE_portable (__NR_SYSCALL_BASE_portable+0x0f0000)
+#define __ARM_NR_breakpoint_portable (__ARM_NR_BASE_portable+1)
+#define __ARM_NR_cacheflush_portable (__ARM_NR_BASE_portable+2)
+#define __ARM_NR_usr26_portable (__ARM_NR_BASE_portable+3)
+#define __ARM_NR_usr32_portable (__ARM_NR_BASE_portable+4)
+#define __ARM_NR_set_tls_portable (__ARM_NR_BASE_portable+5)
+
+/* Apparently these are not callable using syscall on ARM... */
+#undef __NR_time_portable
+#undef __NR_umount_portable
+#undef __NR_stime_portable
+#undef __NR_alarm_portable
+#undef __NR_utime_portable
+#undef __NR_getrlimit_portable
+#undef __NR_select_portable
+#undef __NR_readdir_portable
+#undef __NR_mmap_portable
+#undef __NR_socketcall_portable
+#undef __NR_syscall_portable
+#undef __NR_ipc_portable
+
+#endif
diff --git a/ndk/sources/android/libportable/common/include/errno_portable.h b/ndk/sources/android/libportable/common/include/errno_portable.h
index c2f6523c2..61888c614 100644
--- a/ndk/sources/android/libportable/common/include/errno_portable.h
+++ b/ndk/sources/android/libportable/common/include/errno_portable.h
@@ -17,7 +17,14 @@
#ifndef _ERRNO_PORTABLE_H_
#define _ERRNO_PORTABLE_H_
-/* Derived from development/ndk/platforms/android-3/include/asm-generic/errno.h */
+#include <portability.h>
+
+/*
+ * Derived from development/ndk/platforms/android-3/include/asm-generic/errno.h
+ * NOTE:
+ * Base errno #defines from 1...35 are ARCH independent and not defined;
+ * they are defined in ./asm-generic/errno-base.h
+ */
#define EDEADLK_PORTABLE 35
#define ENAMETOOLONG_PORTABLE 36
#define ENOLCK_PORTABLE 37
@@ -120,4 +127,9 @@
#define EOWNERDEAD_PORTABLE 130
#define ENOTRECOVERABLE_PORTABLE 131
+extern __hidden int errno_ntop(int native_errno);
+extern __hidden int errno_pton(int native_errno);
+
+extern volatile int* REAL(__errno)(void);
+
#endif /* _ERRNO_PORTABLE_H */
diff --git a/ndk/sources/android/libportable/common/include/eventfd_portable.h b/ndk/sources/android/libportable/common/include/eventfd_portable.h
new file mode 100644
index 000000000..d72ca8dd3
--- /dev/null
+++ b/ndk/sources/android/libportable/common/include/eventfd_portable.h
@@ -0,0 +1,63 @@
+/*
+ * Derived from bionic/libc/include/sys/eventfd.h
+ *
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _SYS_EVENTFD_PORTABLE_H
+#define _SYS_EVENTFD_PORTABLE_H
+
+#include <portability.h>
+#include <sys/cdefs.h>
+#include <fcntl_portable.h>
+
+__BEGIN_DECLS
+
+/*
+ * EFD_SEMAPHORE is defined in recent linux kernels;
+ * but isn't mentioned elsewhere. See linux 3.4
+ * include/linux/eventfd.h for example.
+ */
+#define EFD_SEMAPHORE (1 << 0)
+
+#define EFD_SEMAPHORE_PORTABLE EFD_SEMAPHORE
+#define EFD_CLOEXEC_PORTABLE O_CLOEXEC_PORTABLE
+#define EFD_NONBLOCK_PORTABLE O_NONBLOCK_PORTABLE
+
+/* type of event counter */
+typedef uint64_t eventfd_portable_t;
+
+extern int WRAP(eventfd)(unsigned int initval, int flags);
+
+#if 0
+/* Compatibility with GLibc; libportable versions don't appear to be necessary */
+extern int eventfd_read(int fd, eventfd_t *counter);
+extern int eventfd_write(int fd, const eventfd_t counter);
+#endif
+
+__END_DECLS
+
+#endif /* _SYS_EVENTFD_H */
diff --git a/ndk/sources/android/libportable/common/include/fcntl_portable.h b/ndk/sources/android/libportable/common/include/fcntl_portable.h
index 7240ad3ce..6e99c8b30 100644
--- a/ndk/sources/android/libportable/common/include/fcntl_portable.h
+++ b/ndk/sources/android/libportable/common/include/fcntl_portable.h
@@ -18,7 +18,7 @@
#define _FCNTL_PORTABLE_H_
/* Derived from development/ndk/platforms/android-3/arch-arm/include/asm/fcntl.h */
-/* NB x86 does not have these and only uses the generic definitions */
+/* NB x86 does not have these and only uses the generic definitions. */
#define O_DIRECTORY_PORTABLE 040000
#define O_NOFOLLOW_PORTABLE 0100000
#define O_DIRECT_PORTABLE 0200000
@@ -72,6 +72,30 @@
#define O_NDELAY_PORTABLE O_NONBLOCK_PORTABLE
#endif
+/* From Bionic libc/kernel/common/asm-generic/fcntl.h */
+#ifndef O_CLOEXEC_PORTABLE
+#define O_CLOEXEC_PORTABLE 02000000
+#endif
+
+#ifndef __ARCH_FLOCK64_PAD
+#define __ARCH_FLOCK64_PAD
+#endif
+
+/*
+ * For use with F_GETLK and F_SETLK
+ */
+struct flock_portable {
+ short l_type;
+ short l_whence;
+ off_t l_start;
+ off_t l_len;
+ pid_t l_pid;
+ __ARCH_FLOCK64_PAD
+};
+
+/*
+ * For use with F_GETLK64 and F_SETLK64
+ */
struct flock64_portable {
short l_type;
short l_whence;
@@ -82,9 +106,10 @@ struct flock64_portable {
__ARCH_FLOCK64_PAD
};
+#if 0
/*
-The X86 Version is
-
+ * The X86 Version is
+ */
struct flock64 {
short l_type;
short l_whence;
@@ -93,22 +118,48 @@ struct flock64 {
pid_t l_pid;
__ARCH_FLOCK64_PAD
};
-*/
+#endif /* 0 */
+
+
+#ifndef F_DUPFD_PORTABLE
+#define F_DUPFD_PORTABLE 0
+#define F_GETFD_PORTABLE 1
+#define F_SETFD_PORTABLE 2
+#define F_GETFL_PORTABLE 3
+#define F_SETFL_PORTABLE 4
+#endif
#ifndef F_GETLK_PORTABLE
#define F_GETLK_PORTABLE 5
#define F_SETLK_PORTABLE 6
#define F_SETLKW_PORTABLE 7
#endif
+
#ifndef F_SETOWN_PORTABLE
#define F_SETOWN_PORTABLE 8
#define F_GETOWN_PORTABLE 9
#endif
+#ifndef F_SETSIG_PORTABLE
+#define F_SETSIG_PORTABLE 10
+#define F_GETSIG_PORTABLE 11
+#endif
+
#ifndef F_GETLK64_PORTABLE
#define F_GETLK64_PORTABLE 12
#define F_SETLK64_PORTABLE 13
#define F_SETLKW64_PORTABLE 14
#endif
+/* This constant seems to be the same for all ARCH's */
+#define F_LINUX_SPECIFIC_BASE_PORTABLE 1024
+
+#define F_SETLEASE_PORTABLE (F_LINUX_SPECIFIC_BASE+0) /* 1024 */
+#define F_GETLEASE_PORTABLE (F_LINUX_SPECIFIC_BASE+1) /* 1025 */
+#define F_NOTIFY_PORTABLE (F_LINUX_SPECIFIC_BASE+2) /* 1026 */
+
+/* Currently these are only supported by X86_64 */
+#define F_CANCELLK_PORTABLE (F_LINUX_SPECIFIC_BASE+5) /* 1029 */
+#define F_DUPFD_CLOEXEC_PORTABLE (F_LINUX_SPECIFIC_BASE+6) /* 1030 */
+
#endif /* _FCNTL_PORTABLE_H */
diff --git a/ndk/sources/android/libportable/common/include/fenv_portable.h b/ndk/sources/android/libportable/common/include/fenv_portable.h
new file mode 100644
index 000000000..902c141ae
--- /dev/null
+++ b/ndk/sources/android/libportable/common/include/fenv_portable.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2013, 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.
+ */
+
+#ifndef _FENV_PORTABLE_H_
+#define _FENV_PORTABLE_H_
+
+#include <sys/types.h>
+
+/* Exception flags. */
+#define FE_INVALID_PORTABLE 0x01
+#define FE_DIVBYZERO_PORTABLE 0x02
+#define FE_OVERFLOW_PORTABLE 0x04
+#define FE_UNDERFLOW_PORTABLE 0x08
+#define FE_INEXACT_PORTABLE 0x10
+#define FE_ALL_EXCEPT_PORTABLE (FE_DIVBYZERO_PORTABLE | FE_INEXACT_PORTABLE | FE_INVALID_PORTABLE |\
+ FE_OVERFLOW_PORTABLE | FE_UNDERFLOW_PORTABLE)
+
+/* Rounding modes. */
+#define FE_TONEAREST_PORTABLE 0x0
+#define FE_UPWARD_PORTABLE 0x1
+#define FE_DOWNWARD_PORTABLE 0x2
+#define FE_TOWARDZERO_PORTABLE 0x3
+
+#endif /* _FENV_PORTABLE_H_ */
diff --git a/ndk/sources/android/libportable/common/include/filefd_portable.h b/ndk/sources/android/libportable/common/include/filefd_portable.h
new file mode 100644
index 000000000..76cd4b849
--- /dev/null
+++ b/ndk/sources/android/libportable/common/include/filefd_portable.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright 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.
+ */
+
+#ifndef _FILEFD_PORTABLE_H_
+#define _FILEFD_PORTABLE_H_
+
+/*
+ * Maintaining a list of special file descriptors in lib-portable
+ * which are maintained across a execve() via environment variables.
+ * See portable/arch-mips/filefd.c for details.
+ */
+enum filefd_type {
+ UNUSED_FD_TYPE = 0,
+ EVENT_FD_TYPE,
+ INOTIFY_FD_TYPE,
+ SIGNAL_FD_TYPE,
+ TIMER_FD_TYPE,
+ MAX_FD_TYPE
+};
+
+extern __hidden void filefd_opened(int fd, enum filefd_type fd_type);
+extern __hidden void filefd_closed(int fd);
+extern __hidden void filefd_CLOEXEC_enabled(int fd);
+extern __hidden void filefd_CLOEXEC_disabled(int fd);
+extern __hidden void filefd_disable_mapping(void);
+
+extern int WRAP(close)(int fd);
+extern int WRAP(read)(int fd, void *buf, size_t count);
+extern int WRAP(pipe2)(int pipefd[2], int portable_flags);
+
+#endif /* _FILEFD_PORTABLE_H_ */
diff --git a/ndk/sources/android/libportable/common/include/inotify_portable.h b/ndk/sources/android/libportable/common/include/inotify_portable.h
new file mode 100644
index 000000000..09d4d6400
--- /dev/null
+++ b/ndk/sources/android/libportable/common/include/inotify_portable.h
@@ -0,0 +1,51 @@
+/*
+ * Derived from bionic/libc/include/sys/eventfd.h
+ *
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _SYS_INOTIFY_PORTABLE_H
+#define _SYS_INOTIFY_PORTABLE_H
+
+#include <portability.h>
+#include <sys/cdefs.h>
+#include <fcntl.h>
+#include <fcntl_portable.h>
+
+__BEGIN_DECLS
+
+#define IN_CLOEXEC O_CLOEXEC
+#define IN_NONBLOCK O_NONBLOCK
+
+#define IN_CLOEXEC_PORTABLE O_CLOEXEC_PORTABLE
+#define IN_NONBLOCK_PORTABLE O_NONBLOCK_PORTABLE
+
+extern int WRAP(inotify_init1)(int flags);
+
+__END_DECLS
+
+#endif /* _SYS_INOTIFY_H */
diff --git a/ndk/sources/android/libportable/common/include/ioctls_portable.h b/ndk/sources/android/libportable/common/include/ioctls_portable.h
index e9e977cb9..9c03f2568 100644
--- a/ndk/sources/android/libportable/common/include/ioctls_portable.h
+++ b/ndk/sources/android/libportable/common/include/ioctls_portable.h
@@ -17,8 +17,9 @@
#ifndef _IOCTLS_PORTABLE_H_
#define _IOCTLS_PORTABLE_H_
-/* Derived from development/ndk/platforms/android-3/include/asm-generic/ioctl.h */
-
+/*
+ * Derived from development/ndk/platforms/android-3/include/asm-generic/ioctl.h
+ */
#define _IOC_NRBITS_PORTABLE 8
#define _IOC_TYPEBITS_PORTABLE 8
#define _IOC_SIZEBITS_PORTABLE 14
@@ -38,18 +39,37 @@
#define _IOC_WRITE_PORTABLE 1U
#define _IOC_READ_PORTABLE 2U
-#define _IOC_PORTABLE(dir,type,nr,size) (((dir) << _IOC_DIRSHIFT_PORTABLE) | ((type) << _IOC_TYPESHIFT_PORTABLE) | ((nr) << _IOC_NRSHIFT_PORTABLE) | ((size) << _IOC_SIZESHIFT_PORTABLE))
+#define _IOC_PORTABLE(dir, type, nr, size) ( \
+ ((dir) << _IOC_DIRSHIFT_PORTABLE) | \
+ ((type) << _IOC_TYPESHIFT_PORTABLE) | \
+ ((nr) << _IOC_NRSHIFT_PORTABLE) | \
+ ((size) << _IOC_SIZESHIFT_PORTABLE) \
+)
extern unsigned int __invalid_size_argument_for_IOC;
-#define _IOC_TYPECHECK_PORTABLE(t) ((sizeof(t) == sizeof(t[1]) && sizeof(t) < (1 << _IOC_SIZEBITS_PORTABLE)) ? sizeof(t) : __invalid_size_argument_for_IOC)
-#define _IO_PORTABLE(type,nr) _IOC_PORTABLE(_IOC_NONE_PORTABLE,(type),(nr),0)
-#define _IOR_PORTABLE(type,nr,size) _IOC_PORTABLE(_IOC_READ_PORTABLE,(type),(nr),(_IOC_TYPECHECK_PORTABLE(size)))
-#define _IOW_PORTABLE(type,nr,size) _IOC_PORTABLE(_IOC_WRITE_PORTABLE,(type),(nr),(_IOC_TYPECHECK_PORTABLE(size)))
-#define _IOWR_PORTABLE(type,nr,size) _IOC_PORTABLE(_IOC_READ_PORTABLE|_IOC_WRITE_PORTABLE,(type),(nr),(_IOC_TYPECHECK_PORTABLE(size)))
+#define _IOC_TYPECHECK_PORTABLE(t) ( \
+ (sizeof(t) == sizeof(t[1]) && sizeof(t) < (1 << _IOC_SIZEBITS_PORTABLE)) ? \
+ sizeof(t) : \
+ __invalid_size_argument_for_IOC \
+)
+
+#define _IO_PORTABLE(type, nr) _IOC_PORTABLE(_IOC_NONE_PORTABLE, (type), (nr), 0)
+
+#define _IOR_PORTABLE(type, nr, size) \
+ _IOC_PORTABLE(_IOC_READ_PORTABLE, (type), (nr), (_IOC_TYPECHECK_PORTABLE(size)))
+
+#define _IOW_PORTABLE(type, nr, size) \
+ _IOC_PORTABLE(_IOC_WRITE_PORTABLE, (type), (nr), (_IOC_TYPECHECK_PORTABLE(size)))
+
+#define _IOWR_PORTABLE(type, nr, size) \
+ IOC_PORTABLE(_IOC_READ_PORTABLE | \
+ _IOC_WRITE_PORTABLE, (type), (nr), (IOC_TYPECHECK_PORTABLE(size)) )
-/* Derived from development/ndk/platforms/android-3/arch-arm/include/asm/ioctls.h */
+/*
+ * Derived from development/ndk/platforms/android-3/arch-arm/include/asm/ioctls.h
+ */
#define TCGETS_PORTABLE 0x5401
#define TCSETS_PORTABLE 0x5402
#define TCSETSW_PORTABLE 0x5403
@@ -121,8 +141,9 @@ extern unsigned int __invalid_size_argument_for_IOC;
#define TIOCSER_TEMT_PORTABLE 0x01
-/* Derived from development/ndk/platforms/android-3/include/sys/ioctl_compat.h */
-
+/*
+ * Derived from development/ndk/platforms/android-3/include/sys/ioctl_compat.h
+ */
struct tchars_portable {
char t_intrc; /* interrupt */
char t_quitc; /* quit */
@@ -142,11 +163,11 @@ struct ltchars_portable {
};
struct sgttyb_portable {
- char sg_ispeed; /* input speed */
- char sg_ospeed; /* output speed */
- char sg_erase; /* erase character */
- char sg_kill; /* kill character */
- short sg_flags; /* mode flags */
+ char sg_ispeed; /* input speed */
+ char sg_ospeed; /* output speed */
+ char sg_erase; /* erase character */
+ char sg_kill; /* kill character */
+ short sg_flags; /* mode flags */
};
#ifdef USE_OLD_TTY
@@ -156,23 +177,49 @@ struct sgttyb_portable {
# define OTIOCGETD_PORTABLE _IOR_PORTABLE('t', 0, int) /* get line discipline */
# define OTIOCSETD_PORTABLE _IOW_PORTABLE('t', 1, int) /* set line discipline */
#endif
-#define TIOCHPCL_PORTABLE _IO_PORTABLE('t', 2) /* hang up on last close */
-#define TIOCGETP_PORTABLE _IOR_PORTABLE('t', 8,struct sgttyb_portable)/* get parameters -- gtty */
-#define TIOCSETP_PORTABLE _IOW_PORTABLE('t', 9,struct sgttyb_portable)/* set parameters -- stty */
-#define TIOCSETN_PORTABLE _IOW_PORTABLE('t',10,struct sgttyb_portable)/* as above, but no flushtty*/
-#define TIOCSETC_PORTABLE _IOW_PORTABLE('t',17,struct tchars_portable)/* set special characters */
-#define TIOCGETC_PORTABLE _IOR_PORTABLE('t',18,struct tchars_portable)/* get special characters */
-
-#define TIOCLBIS_PORTABLE _IOW_PORTABLE('t', 127, int) /* bis local mode bits */
-#define TIOCLBIC_PORTABLE _IOW_PORTABLE('t', 126, int) /* bic local mode bits */
-#define TIOCLSET_PORTABLE _IOW_PORTABLE('t', 125, int) /* set entire local mode word */
-#define TIOCLGET_PORTABLE _IOR_PORTABLE('t', 124, int) /* get local modes */
-#define TIOCSLTC_PORTABLE _IOW_PORTABLE('t',117,struct ltchars_portable)/* set local special chars*/
-#define TIOCGLTC_PORTABLE _IOR_PORTABLE('t',116,struct ltchars_portable)/* get local special chars*/
-#define OTIOCCONS_PORTABLE _IO_PORTABLE('t', 98) /* for hp300 -- sans int arg */
-
-/* Derived from development/ndk/platforms/android-3/arch-arm/include/asm/sockios.h */
+/* hang up on last close */
+#define TIOCHPCL_PORTABLE _IO_PORTABLE('t', 2)
+
+/* get parameters -- gtty */
+#define TIOCGETP_PORTABLE _IOR_PORTABLE('t', 8,struct sgttyb_portable)
+
+/* set parameters -- stty */
+#define TIOCSETP_PORTABLE _IOW_PORTABLE('t', 9,struct sgttyb_portable)
+
+/* as above, but no flushtty*/
+#define TIOCSETN_PORTABLE _IOW_PORTABLE('t',10,struct sgttyb_portable)
+
+/* set special characters */
+#define TIOCSETC_PORTABLE _IOW_PORTABLE('t',17,struct tchars_portable)
+
+/* get special characters */
+#define TIOCGETC_PORTABLE _IOR_PORTABLE('t',18,struct tchars_portable)
+
+/* bis local mode bits */
+#define TIOCLBIS_PORTABLE _IOW_PORTABLE('t', 127, int)
+
+/* bic local mode bits */
+#define TIOCLBIC_PORTABLE _IOW_PORTABLE('t', 126, int)
+
+/* set entire local mode word */
+#define TIOCLSET_PORTABLE _IOW_PORTABLE('t', 125, int)
+
+/* get local modes */
+#define TIOCLGET_PORTABLE _IOR_PORTABLE('t', 124, int)
+
+/* set local special chars*/
+#define TIOCSLTC_PORTABLE _IOW_PORTABLE('t',117,struct ltchars_portable)
+
+/* get local special chars*/
+#define TIOCGLTC_PORTABLE _IOR_PORTABLE('t',116,struct ltchars_portable)
+
+ /* for hp300 -- sans int arg */
+#define OTIOCCONS_PORTABLE _IO_PORTABLE('t', 98)
+
+/*
+ * Derived from development/ndk/platforms/android-3/arch-arm/include/asm/sockios.h
+ */
#define FIOSETOWN_PORTABLE 0x8901
#define SIOCSPGRP_PORTABLE 0x8902
#define FIOGETOWN_PORTABLE 0x8903
diff --git a/ndk/sources/android/libportable/common/include/log_portable.h b/ndk/sources/android/libportable/common/include/log_portable.h
new file mode 100644
index 000000000..1a4fd435c
--- /dev/null
+++ b/ndk/sources/android/libportable/common/include/log_portable.h
@@ -0,0 +1,101 @@
+/*
+ * ALOG Levels: F - Fatal, E - Error, W - Warning, I - Info, D - Debug, V - Verbose
+ *
+ * Using them to work within the Android logcat logging mechanism:
+ *
+ * % logcat '*:v' [To display Verbose Logging]
+ * % logcat 'fcntl_portable:v' [To display just this fcntl logging]
+ *
+ * NOTE: This assumes you only use the 'PORTABLE_TAG'; which is the default.
+ * For debugging LTP it's been helpful to include the LTP program being tested;
+ * which is enabled below with #define EXTENDED_LOGGING.
+ *
+ * Logging routines also support ALOG*_IF() and ASSERT(); For details See:
+ *
+ * ${ANDROID_TOP}/system/core/include/cutils/log.h
+ * and
+ * http://developer.android.com/tools/debugging/debugging-log.html
+ *
+ * ALOGV is turned off by release builds: Use the #define below with LOG_NDEBUG=0 to enable.
+ *
+ * Strace works fine with ALOG out if a large max string size is used via the -s option;
+ * Example:
+ *
+ * strace -s 132 ./sigaction01
+ *
+ * writev(3, [{"\2", 1},
+ * {"./sigaction01`signal_portable\0", 30},
+ * {"sigaction_portable(portable_signum:10:'SIGUSR1_PORTABLE:10', ...
+ * {"map_portable_sigset_to_mips(portable_sigset:0x7fe47a0c, ...
+ * ...
+ */
+
+ /*
+ * Enable LOG_NDEBUG to have debug code visible in logcat output by default.
+ * Also possible via the Lib-Portable Android.mk file. Example:
+ *
+ * # Have logging permanently enable during development.
+ * LOCAL_CFLAGS += -DLOG_NDEBUG=0
+ */
+// # define LOG_NDEBUG 0
+
+
+// #define EXTENDED_LOGGING /* Include the current program name in the LOG_TAG */
+#ifdef EXTENDED_LOGGING
+/*
+ * Inline function to put the current program name
+ * and this library into the logcat prefix. Example:
+ *
+ * V/./sigaction01`signal_portable(605): sigaction_portable(... ) {
+ * -----------------------------
+ *
+ * Disabled by default in AOSP, enable by removing the // above.
+ * Useful when debugging more than one program; For example LTP has thousands.
+ */
+#define MAX_TAG_LEN 128
+static char my_portable_tag[MAX_TAG_LEN + 1];
+
+static inline char *portable_tag() {
+ extern char *__progname;
+
+ if (my_portable_tag[0] == '\000') {
+ strncat(&my_portable_tag[0], __progname, MAX_TAG_LEN);
+ strncat(&my_portable_tag[0], ".", MAX_TAG_LEN - strlen(my_portable_tag));
+ strncat(&my_portable_tag[0], PORTABLE_TAG, MAX_TAG_LEN - strlen(my_portable_tag));
+ }
+ return my_portable_tag;
+}
+#define LOG_TAG portable_tag()
+#else /* !EXTENDED_LOGGING */
+#define LOG_TAG PORTABLE_TAG
+#endif
+
+/*
+ * Override LOG_PRI() defined in ${AOSP}/system/core/include/cutils/log.h
+ * to preserve the value of errno while logging.
+ */
+#define LOG_PRI(priority, tag, ...) ({ \
+ int _errno = *REAL(__errno)(); \
+ int _rv = android_printLog(priority, tag, __VA_ARGS__); \
+ *REAL(__errno)() = _errno; \
+ _rv; /* Returned to caller */ \
+})
+
+#if !defined(__HOST__)
+#include <cutils/log.h>
+
+# define PERROR(str) { \
+ ALOGE("%s: PERROR('%s'): errno:%d:'%s'", __func__, str, *REAL(__errno)(), strerror(errno)); \
+}
+
+# define ASSERT(cond) ALOG_ASSERT(cond, "assertion failed:(%s), file: %s, line: %d:%s", \
+ #cond, __FILE__, __LINE__, __func__);
+#else
+#include <assert.h>
+# define PERROR(str) fprintf(stderr, "%s: PERROR('%s'): errno:%d:'%s'", __func__, str, *REAL(__errno)(), strerror(*REAL(__errno)()))
+# define ASSERT(cond) assert(cond)
+# define ALOGV(a,...)
+# define ALOGW(a,...)
+# define ALOGE(a,...)
+
+#endif \ No newline at end of file
diff --git a/ndk/sources/android/libportable/common/include/netdb_portable.h b/ndk/sources/android/libportable/common/include/netdb_portable.h
new file mode 100644
index 000000000..b3e652868
--- /dev/null
+++ b/ndk/sources/android/libportable/common/include/netdb_portable.h
@@ -0,0 +1,281 @@
+/*
+ * Derived from android-14/arch-arm/usr/include/netdb.h
+ *-
+ * Copyright (c) 1980, 1983, 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * -
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ * -
+ * --Copyright--
+ */
+
+/*
+ * @(#)netdb.h 8.1 (Berkeley) 6/2/93
+ * From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $
+ * $FreeBSD: /repoman/r/ncvs/src/include/netdb.h,v 1.41 2006/04/15 16:20:26 ume Exp $
+ */
+
+#ifndef _NETDB_PORTABLE_H_
+#define _NETDB_PORTABLE_H_
+
+#if 0
+/*
+ * Most of the declararitions are not needed for addrinfo mapping.
+ * Diff of mips and arm code running through cpp show only the
+ * values of ai_socktype being different.
+ */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#ifndef _PATH_HEQUIV
+# define _PATH_HEQUIV "/system/etc/hosts.equiv"
+#endif
+
+#define _PATH_HOSTS "/system/etc/hosts"
+#define _PATH_NETWORKS "/system/etc/networks"
+#define _PATH_PROTOCOLS "/system/etc/protocols"
+#define _PATH_SERVICES "/system/etc/services"
+
+#define MAXHOSTNAMELEN 256
+
+
+/*
+ * Structures returned by network data base library. All addresses are
+ * supplied in host order, and returned in network order (suitable for
+ * use in system calls).
+ */
+struct hostent {
+ char *h_name; /* official name of host */
+ char **h_aliases; /* alias list */
+ int h_addrtype; /* host address type */
+ int h_length; /* length of address */
+ char **h_addr_list; /* list of addresses from name server */
+#define h_addr h_addr_list[0] /* address, for backward compatibility */
+};
+
+struct netent {
+ char *n_name; /* official name of net */
+ char **n_aliases; /* alias list */
+ int n_addrtype; /* net address type */
+ uint32_t n_net; /* network # */
+};
+
+struct servent {
+ char *s_name; /* official service name */
+ char **s_aliases; /* alias list */
+ int s_port; /* port # */
+ char *s_proto; /* protocol to use */
+};
+
+struct protoent {
+ char *p_name; /* official protocol name */
+ char **p_aliases; /* alias list */
+ int p_proto; /* protocol # */
+};
+#endif
+
+/*
+ * For mapping MIPS and ARM these structures differ only in the
+ * ai_socktype values.
+ */
+struct addrinfo_portable {
+ int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
+ int ai_family; /* PF_xxx */
+ int ai_socktype; /* SOCK_xxx */
+ int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
+ socklen_t ai_addrlen; /* length of ai_addr */
+ char *ai_canonname; /* canonical name for hostname */
+ struct sockaddr *ai_addr; /* binary address */
+ struct addrinfo *ai_next; /* next structure in linked list */
+};
+
+#if 0
+/*
+ * Error return codes from gethostbyname() and gethostbyaddr()
+ * (left in h_errno).
+ */
+
+#define NETDB_INTERNAL -1 /* see errno */
+#define NETDB_SUCCESS 0 /* no problem */
+#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
+#define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL */
+#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
+#define NO_DATA 4 /* Valid name, no data record of requested type */
+#define NO_ADDRESS NO_DATA /* no address, look for MX record */
+
+/*
+ * Error return codes from getaddrinfo()
+ */
+#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
+#define EAI_AGAIN 2 /* temporary failure in name resolution */
+#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
+#define EAI_FAIL 4 /* non-recoverable failure in name resolution */
+#define EAI_FAMILY 5 /* ai_family not supported */
+#define EAI_MEMORY 6 /* memory allocation failure */
+#define EAI_NODATA 7 /* no address associated with hostname */
+#define EAI_NONAME 8 /* hostname nor servname provided, or not known */
+#define EAI_SERVICE 9 /* servname not supported for ai_socktype */
+#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
+#define EAI_SYSTEM 11 /* system error returned in errno */
+#define EAI_BADHINTS 12 /* invalid value for hints */
+#define EAI_PROTOCOL 13 /* resolved protocol is unknown */
+#define EAI_OVERFLOW 14 /* argument buffer overflow */
+#define EAI_MAX 15
+
+/*
+ * Flag values for getaddrinfo()
+ */
+#define AI_PASSIVE 0x00000001 /* get address to use bind() */
+#define AI_CANONNAME 0x00000002 /* fill ai_canonname */
+#define AI_NUMERICHOST 0x00000004 /* prevent host name resolution */
+#define AI_NUMERICSERV 0x00000008 /* prevent service name resolution */
+/* valid flags for addrinfo (not a standard def, apps should not use it) */
+#define AI_MASK \
+ (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \
+ AI_ADDRCONFIG)
+
+#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
+#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */
+#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */
+#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */
+/* special recommended flags for getipnodebyname */
+#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
+
+/*
+ * Constants for getnameinfo()
+ */
+#define NI_MAXHOST 1025
+#define NI_MAXSERV 32
+
+/*
+ * Flag values for getnameinfo()
+ */
+#define NI_NOFQDN 0x00000001
+#define NI_NUMERICHOST 0x00000002
+#define NI_NAMEREQD 0x00000004
+#define NI_NUMERICSERV 0x00000008
+#define NI_DGRAM 0x00000010
+#if 0 /* obsolete */
+#define NI_WITHSCOPEID 0x00000020
+#endif
+
+/*
+ * Scope delimit character
+ */
+#define SCOPE_DELIMITER '%'
+
+__BEGIN_DECLS
+/* BIONIC-BEGIN */
+#define h_errno (*__get_h_errno())
+int* __get_h_errno(void);
+/* BIONIC-END */
+void endservent(void);
+struct hostent *gethostbyaddr(const char *, int, int);
+struct hostent *gethostbyname(const char *);
+int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
+struct hostent *gethostbyname2(const char *, int);
+struct hostent *gethostent(void);
+struct netent *getnetbyaddr(uint32_t, int);
+struct netent *getnetbyname(const char *);
+struct protoent *getprotobyname(const char *);
+struct protoent *getprotobynumber(int);
+struct servent *getservbyname(const char *, const char *);
+struct servent *getservbyport(int, const char *);
+struct servent *getservent(void);
+void herror(const char *);
+const char *hstrerror(int);
+#endif
+
+int WRAP(getaddrinfo)(const char *, const char *, struct addrinfo_portable *,
+ struct addrinfo_portable **);
+
+void WRAP(freeaddrinfo)(struct addrinfo_portable *);
+
+#if 0 /* Not needed for addrinfo mapping */
+int getnameinfo(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, int);
+const char *gai_strerror(int);
+void setservent(int);
+
+#if 0 /* MISSING FROM BIONIC */
+void endhostent(void);
+void endnetent(void);
+void endnetgrent(void);
+void endprotoent(void);
+void freehostent(struct hostent *);
+
+int gethostbyaddr_r(const char *, int, int, struct hostent *, char *, size_t,
+ struct hostent **, int *);
+
+int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t,
+ struct hostent **, int *);
+
+int gethostent_r(struct hostent *, char *, size_t, struct hostent **, int *);
+struct hostent *getipnodebyaddr(const void *, size_t, int, int *);
+struct hostent *getipnodebyname(const char *, int, int, int *);
+int getnetbyaddr_r(uint32_t, int, struct netent *, char *, size_t, struct netent**, int *);
+int getnetbyname_r(const char *, struct netent *, char *, size_t, struct netent **, int *);
+int getnetent_r(struct netent *, char *, size_t, struct netent **, int *);
+int getnetgrent(char **, char **, char **);
+int getprotobyname_r(const char *, struct protoent *, char *, size_t, struct protoent **);
+int getprotobynumber_r(int, struct protoent *, char *, size_t, struct protoent **);
+struct protoent *getprotoent(void);
+int getprotoent_r(struct protoent *, char *, size_t, struct protoent **);
+int innetgr(const char *, const char *, const char *, const char *);
+void sethostent(int);
+void setnetent(int);
+void setprotoent(int);
+struct netent *getnetent(void);
+void setnetgrent(const char *);
+#endif /* MISSING FROM BIONIC */
+#endif /* Not needed for addrinfo mapping */
+
+
+__END_DECLS
+
+#endif /* !_NETDB_H_ */
diff --git a/ndk/sources/android/libportable/common/include/portability.h b/ndk/sources/android/libportable/common/include/portability.h
new file mode 100644
index 000000000..54f140618
--- /dev/null
+++ b/ndk/sources/android/libportable/common/include/portability.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 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.
+ */
+
+#ifndef _PORTABILITY_H_
+#define _PORTABILITY_H_
+
+#include "asm-generic/portability.h"
+/*
+ * Common portability helper routines
+ */
+
+/*
+ * Check a portable pointer before we access it
+ * Well behaved programs should not be passing bad pointers
+ * to the kernel but this routine can be used to check a pointer
+ * if we need to use it before calling the kernel
+ *
+ * It does not catch every possible case but it is sufficient for LTP
+ */
+inline static int invalid_pointer(void *p)
+{
+ return p == 0
+ || p == (void *)-1
+#ifdef __mips__
+ || (int)p < 0
+#endif
+ ;
+}
+
+/*
+ * Hidden functions are exposed while linking the libportable shared object
+ * but are not exposed thereafter.
+ */
+#define __hidden __attribute__((visibility("hidden")))
+
+#endif /* _PORTABILITY_H_ */
diff --git a/ndk/sources/android/libportable/common/include/signal_portable.h b/ndk/sources/android/libportable/common/include/signal_portable.h
new file mode 100644
index 000000000..3ea8de1a6
--- /dev/null
+++ b/ndk/sources/android/libportable/common/include/signal_portable.h
@@ -0,0 +1,198 @@
+/*
+ * Derived from gdk/platforms/android-14/arch-arm/usr/include/signal.h
+ *
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _SIGNAL_PORTABLE_H_
+#define _SIGNAL_PORTABLE_H_
+
+#include <portability.h>
+#include <sys/cdefs.h>
+#include <limits.h> /* For LONG_BIT */
+#include <string.h> /* For memset() */
+#include <signal.h>
+#include <time.h>
+#include <sys/types.h>
+#include <asm/signal_portable.h>
+#include <asm/sigcontext_portable.h>
+
+#define __ARCH_SI_UID_T __kernel_uid32_t
+#include <asm/siginfo_portable.h>
+#undef __ARCH_SI_UID_T
+
+__BEGIN_DECLS
+
+typedef int sig_atomic_t;
+
+#if 0
+/* _NSIG is used by the SIGRTMAX definition under <asm/signal.h>, however
+ * its definition is part of a #if __KERNEL__ .. #endif block in the original
+ * kernel headers and is thus not part of our cleaned-up versions.
+ *
+ * Looking at the current kernel sources, it is defined as 64 for all
+ * architectures except for the 'mips' one which set it to 128.
+ */
+#ifndef _NSIG_PORTABLE
+# define _NSIG_PORTABLE 64
+#endif
+#endif
+
+extern const char * const sys_siglist[];
+extern const char * const sys_signame[];
+
+static __inline__ int WRAP(sigismember)(sigset_portable_t *set, int signum)
+{
+ unsigned long *local_set = (unsigned long *)set;
+ signum--;
+ return (int)((local_set[signum/LONG_BIT] >> (signum%LONG_BIT)) & 1);
+}
+
+
+static __inline__ int WRAP(sigaddset)(sigset_portable_t *set, int signum)
+{
+ unsigned long *local_set = (unsigned long *)set;
+ signum--;
+ local_set[signum/LONG_BIT] |= 1UL << (signum%LONG_BIT);
+ return 0;
+}
+
+
+static __inline__ int WRAP(sigdelset)(sigset_portable_t *set, int signum)
+{
+ unsigned long *local_set = (unsigned long *)set;
+ signum--;
+ local_set[signum/LONG_BIT] &= ~(1UL << (signum%LONG_BIT));
+ return 0;
+}
+
+
+static __inline__ int WRAP(sigemptyset)(sigset_portable_t *set)
+{
+ memset(set, 0, sizeof *set);
+ return 0;
+}
+
+static __inline__ int WRAP(sigfillset)(sigset_portable_t *set)
+{
+ memset(set, ~0, sizeof *set);
+ return 0;
+}
+
+/* compatibility types */
+typedef void (*sig_portable_t)(int);
+typedef sig_portable_t sighandler_portable_t;
+
+/* Extended compatibility types, for processing a siginfo_t argument */
+typedef void (*sig3_portable_t)(int, siginfo_portable_t *, void *);
+typedef sig3_portable_t sig3handler_portable_t;
+
+/* differentiater between sysv and bsd behaviour 8*/
+extern __sighandler_t sysv_signal(int, __sighandler_portable_t);
+extern __sighandler_t bsd_signal(int, __sighandler_portable_t);
+
+#if 0
+/* the default is bsd */
+static __inline__ __sighandler_portable_t WRAP(signal)(int s, sighandler_portable_t f)
+{
+ return bsd_signal(s,f);
+}
+#endif
+
+/* the portable mapped syscall itself */
+extern __sighandler_portable_t WRAP(__signal)(int, __sighandler_portable_t);
+
+extern int WRAP(sigprocmask)(int, const sigset_portable_t *, sigset_portable_t *);
+
+extern int WRAP(sigaction)(int, const struct sigaction_portable *,
+ struct sigaction_portable *);
+
+extern int WRAP(sigpending)(sigset_portable_t *);
+extern int WRAP(sigsuspend)(const sigset_portable_t *);
+extern int WRAP(sigwait)(const sigset_portable_t *set, int *sig);
+extern int WRAP(siginterrupt)(int sig, int flag);
+
+extern int WRAP(raise)(int);
+extern int WRAP(kill)(pid_t, int);
+extern int WRAP(killpg)(int pgrp, int sig);
+extern int WRAP(tkill)(int tid, int portable_signum);
+extern int WRAP(sigaltstack)(const portable_stack_t *ss, portable_stack_t *oss);
+extern int WRAP(timer_create)(clockid_t, struct sigevent *, timer_t *);
+
+#if 0
+extern int WRAP(signalfd)(int fd, const sigset_portable_t *portable_sigmask, int flags);
+#endif
+
+extern __hidden int do_signalfd4_portable(int fd, const sigset_portable_t *portable_sigmask,
+ int portable_sigsetsize, int flags);
+
+extern __hidden int read_signalfd_mapper(int fd, void *buf, size_t count);
+extern __hidden char *map_portable_signum_to_name(int portable_signum);
+extern __hidden char *map_mips_signum_to_name(int mips_signum);
+extern __hidden int signum_pton(int portable_signum);
+extern __hidden int signum_ntop(int mips_signum);
+
+typedef int (*sigmask_fn)(int, const sigset_t *, sigset_t *);
+typedef int (*rt_sigmask_fn)(int, const sigset_t *, sigset_t *, size_t);
+typedef int (*sigaction_fn)(int, const struct sigaction *, struct sigaction *);
+typedef int (*rt_sigaction_fn)(int, const struct sigaction *, struct sigaction *, size_t);
+
+
+extern __hidden int do_sigmask(int portable_how, const sigset_portable_t *portable_sigset,
+ sigset_portable_t *portable_oldset, sigmask_fn fn,
+ rt_sigmask_fn rt_fn);
+
+
+/* These functions are called from syscall.c and experimental Bionic linker. */
+extern int WRAP(__rt_sigaction)(int portable_signum,
+ const struct sigaction_portable *act,
+ struct sigaction_portable *oldact,
+ size_t sigsetsize);
+
+extern int WRAP(__rt_sigprocmask)(int portable_how,
+ const sigset_portable_t *portable_sigset,
+ sigset_portable_t *portable_oldset,
+ size_t sigsetsize);
+
+extern int WRAP(__rt_sigtimedwait)(const sigset_portable_t *portable_sigset,
+ siginfo_portable_t *portable_siginfo,
+ const struct timespec *timeout,
+ size_t portable_sigsetsize);
+
+
+/* These functions are only called from syscall.c; not experimental Bionic linker. */
+extern __hidden int WRAP(rt_sigqueueinfo)(pid_t pid, int sig, siginfo_portable_t *uinfo);
+
+extern __hidden int WRAP(rt_tgsigqueueinfo)(pid_t tgid, pid_t pid, int sig,
+ siginfo_portable_t *uinfo);
+
+
+/* Called by clone when memory and signal handlers aren't compatable. */
+extern __hidden void signal_disable_mapping(void);
+
+__END_DECLS
+
+#endif /* _SIGNAL_PORTABLE_H_ */
diff --git a/ndk/sources/android/libportable/common/include/signalfd_portable.h b/ndk/sources/android/libportable/common/include/signalfd_portable.h
new file mode 100644
index 000000000..54ff47061
--- /dev/null
+++ b/ndk/sources/android/libportable/common/include/signalfd_portable.h
@@ -0,0 +1,60 @@
+/*
+ * Derived from Goldfish include/linux/signalfd.h
+ *
+ * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org>
+ *
+ */
+
+#ifndef _LINUX_SIGNALFD_PORTABLE_H
+#define _LINUX_SIGNALFD_PORTABLE_H
+
+#include <linux/types.h>
+#include <fcntl.h>
+
+/* Flags for signalfd4. */
+#define SFD_CLOEXEC O_CLOEXEC
+#define SFD_NONBLOCK O_NONBLOCK
+
+/* For O_CLOEXEC_PORTABLE and O_NONBLOCK_PORTABLE */
+#include "fcntl_portable.h"
+
+#define SFD_CLOEXEC_PORTABLE O_CLOEXEC_PORTABLE
+#define SFD_NONBLOCK_PORTABLE O_NONBLOCK_PORTABLE
+
+/*
+ * This structure is the same for Native and Portable.
+ * However for MIPS ssi_signo and ssi_errno differ in their
+ * values and need to be mapped.
+ */
+struct signalfd_siginfo {
+ __u32 ssi_signo;
+ __s32 ssi_errno;
+ __s32 ssi_code;
+ __u32 ssi_pid;
+ __u32 ssi_uid;
+ __s32 ssi_fd;
+ __u32 ssi_tid;
+ __u32 ssi_band;
+ __u32 ssi_overrun;
+ __u32 ssi_trapno;
+ __s32 ssi_status;
+ __s32 ssi_int;
+ __u64 ssi_ptr;
+ __u64 ssi_utime;
+ __u64 ssi_stime;
+ __u64 ssi_addr;
+
+ /*
+ * Pad structure to 128 bytes. Remember to update the
+ * pad size when you add new members. We use a fixed
+ * size structure to avoid compatibility problems with
+ * future versions, and we leave extra space for additional
+ * members. We use fixed size members because this structure
+ * comes out of a read(2) and we really don't want to have
+ * a compat (sp?) on read(2).
+ */
+ __u8 __pad[48];
+};
+
+#endif /* _LINUX_SIGNALFD_PORTABLE_H */
+
diff --git a/ndk/sources/android/libportable/common/include/timerfd_portable.h b/ndk/sources/android/libportable/common/include/timerfd_portable.h
new file mode 100644
index 000000000..d6c294c2a
--- /dev/null
+++ b/ndk/sources/android/libportable/common/include/timerfd_portable.h
@@ -0,0 +1,51 @@
+/*
+ * Derived from bionic/libc/include/sys/eventfd.h
+ *
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _SYS_TIMERFD_PORTABLE_H
+#define _SYS_TIMERFD_PORTABLE_H
+
+#include <portability.h>
+#include <sys/cdefs.h>
+#include <fcntl.h>
+#include <fcntl_portable.h>
+
+__BEGIN_DECLS
+
+#define TFD_CLOEXEC O_CLOEXEC
+#define TFD_NONBLOCK O_NONBLOCK
+
+#define TFD_CLOEXEC_PORTABLE O_CLOEXEC_PORTABLE
+#define TFD_NONBLOCK_PORTABLE O_NONBLOCK_PORTABLE
+
+extern int WRAP(timerfd_create)(int clockid, int flags);
+
+__END_DECLS
+
+#endif /* _SYS_TIMERFD_H */
diff --git a/ndk/sources/android/native_app_glue/android_native_app_glue.c b/ndk/sources/android/native_app_glue/android_native_app_glue.c
index 82fc03017..55a52bc0e 100644
--- a/ndk/sources/android/native_app_glue/android_native_app_glue.c
+++ b/ndk/sources/android/native_app_glue/android_native_app_glue.c
@@ -186,16 +186,14 @@ static void android_app_destroy(struct android_app* android_app) {
static void process_input(struct android_app* app, struct android_poll_source* source) {
AInputEvent* event = NULL;
- if (AInputQueue_getEvent(app->inputQueue, &event) >= 0) {
+ while (AInputQueue_getEvent(app->inputQueue, &event) >= 0) {
LOGV("New input event: type=%d\n", AInputEvent_getType(event));
if (AInputQueue_preDispatchEvent(app->inputQueue, event)) {
- return;
+ continue;
}
int32_t handled = 0;
if (app->onInputEvent != NULL) handled = app->onInputEvent(app, event);
AInputQueue_finishEvent(app->inputQueue, event, handled);
- } else {
- LOGE("Failure reading next input event: %s\n", strerror(errno));
}
}
diff --git a/samples/ApiDemos/AndroidManifest.xml b/samples/ApiDemos/AndroidManifest.xml
index 0273baae0..34464a0f6 100644
--- a/samples/ApiDemos/AndroidManifest.xml
+++ b/samples/ApiDemos/AndroidManifest.xml
@@ -36,7 +36,7 @@
<!-- For android.media.audiofx.Visualizer -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
- <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="16" />
+ <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="17" />
<!-- We will request access to the camera, saying we require a camera
of some sort but not one with autofocus capability. -->
@@ -93,6 +93,16 @@
</intent-filter>
</activity>
+ <activity android:name=".app.OverscanActivity"
+ android:label="@string/activity_overscan"
+ android:theme="@android:style/Theme.Holo.NoActionBar.Overscan"
+ android:enabled="@bool/atLeastJellyBeanMR2">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
<activity android:name=".app.QuickContactsDemo"
android:label="@string/quick_contacts_demo">
<intent-filter>
@@ -234,6 +244,14 @@
</intent-filter>
</activity>
+ <activity android:name=".app.RotationAnimation"
+ android:label="@string/activity_rotation_animation">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
<activity android:name=".app.ReorderTwo" />
<activity android:name=".app.ReorderThree" />
<activity android:name=".app.ReorderFour" />
@@ -1150,6 +1168,13 @@
</intent-filter>
</activity>
+ <activity android:name=".content.ChangedContacts" android:label="@string/activity_changed_contact">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.SAMPLE_CODE"/>
+ </intent-filter>
+ </activity>
+
<activity android:name=".content.InstallApk" android:label="@string/activity_install_apk"
android:enabled="@bool/atLeastHoneycombMR2">
<intent-filter>
@@ -1180,6 +1205,13 @@
</intent-filter>
</activity>
+ <activity android:name=".os.TriggerSensors" android:label="OS/TriggerSensors">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
<activity android:name=".os.RotationVectorDemo" android:label="OS/Rotation Vector" android:screenOrientation="nosensor">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -1372,76 +1404,93 @@
</intent-filter>
</activity>
- <activity android:name=".view.LinearLayout1" android:label="Views/Layouts/LinearLayout/1. Vertical">
+ <activity android:name=".view.LinearLayout1"
+ android:label="Views/Layouts/LinearLayout/01. Vertical">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
- <activity android:name=".view.LinearLayout2" android:label="Views/Layouts/LinearLayout/2. Vertical (Fill Screen)">
+ <activity android:name=".view.LinearLayout2"
+ android:label="Views/Layouts/LinearLayout/02. Vertical (Fill Screen)">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
- <activity android:name=".view.LinearLayout3" android:label="Views/Layouts/LinearLayout/3. Vertical (Padded)">
+ <activity android:name=".view.LinearLayout3"
+ android:label="Views/Layouts/LinearLayout/03. Vertical (Padded)">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
- <activity android:name=".view.LinearLayout4" android:label="Views/Layouts/LinearLayout/4. Horizontal">
+ <activity android:name=".view.LinearLayout4"
+ android:label="Views/Layouts/LinearLayout/04. Horizontal">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
- <activity android:name=".view.LinearLayout5" android:label="Views/Layouts/LinearLayout/5. Simple Form">
+ <activity android:name=".view.LinearLayout5"
+ android:label="Views/Layouts/LinearLayout/05. Simple Form">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
- <activity android:name=".view.LinearLayout6" android:label="Views/Layouts/LinearLayout/6. Uniform Size">
+ <activity android:name=".view.LinearLayout6"
+ android:label="Views/Layouts/LinearLayout/06. Uniform Size">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
- <activity android:name=".view.LinearLayout7" android:label="Views/Layouts/LinearLayout/7. Fill Parent">
+ <activity android:name=".view.LinearLayout7"
+ android:label="Views/Layouts/LinearLayout/07. Fill Parent">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
- <activity android:name=".view.LinearLayout8" android:label="Views/Layouts/LinearLayout/8. Gravity">
+ <activity android:name=".view.LinearLayout8"
+ android:label="Views/Layouts/LinearLayout/08. Gravity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
- <activity android:name=".view.LinearLayout9" android:label="Views/Layouts/LinearLayout/9. Layout Weight">
+ <activity android:name=".view.LinearLayout9"
+ android:label="Views/Layouts/LinearLayout/09. Layout Weight">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
- <activity android:name=".view.LinearLayout10" android:label="Views/Layouts/LinearLayout/10. Background Image">
+ <activity android:name=".view.LinearLayout10"
+ android:label="Views/Layouts/LinearLayout/10. Background Image">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
+ <activity android:name=".view.CustomLayoutActivity"
+ android:label="Views/Layouts/CustomLayout">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
<activity android:name=".view.RadioGroup1" android:label="Views/Radio Group">
<intent-filter>
@@ -2194,6 +2243,14 @@
</intent-filter>
</activity>
+ <activity android:name=".view.WindowFocusObserver"
+ android:label="Views/Focus/6. Window Focus Observer">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
<activity android:name=".view.DateWidgets1" android:label="Views/Date Widgets/1. Dialog">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -2288,9 +2345,20 @@
</intent-filter>
</activity>
- <activity android:name=".view.OverscanActivity"
+ <activity android:name=".view.SystemUIModes"
android:label="Views/System UI Visibility/System UI Modes"
- android:uiOptions="splitActionBarWhenNarrow">
+ android:uiOptions="splitActionBarWhenNarrow"
+ android:enabled="@bool/atLeastJellyBeanMR2">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name=".view.SystemUIModesOverlay"
+ android:label="Views/System UI Visibility/System UI Modes Overlay"
+ android:uiOptions="splitActionBarWhenNarrow"
+ android:enabled="@bool/atLeastJellyBean">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -2300,7 +2368,8 @@
<activity android:name=".view.ContentBrowserActivity"
android:label="Views/System UI Visibility/Content Browser"
android:theme="@android:style/Theme.Holo.Light.DarkActionBar"
- android:uiOptions="splitActionBarWhenNarrow">
+ android:uiOptions="splitActionBarWhenNarrow"
+ android:enabled="@bool/atLeastJellyBean">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -2310,7 +2379,8 @@
<activity android:name=".view.VideoPlayerActivity"
android:label="Views/System UI Visibility/Video Player"
android:theme="@android:style/Theme.Holo"
- android:uiOptions="splitActionBarWhenNarrow">
+ android:uiOptions="splitActionBarWhenNarrow"
+ android:enabled="@bool/atLeastJellyBean">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -2837,6 +2907,13 @@
</intent-filter>
</activity>
+ <activity android:name=".security.KeyStoreUsage" android:label="Security/KeyStore"
+ android:windowSoftInputMode="adjustPan">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
</application>
<instrumentation android:name=".app.LocalSampleInstrumentation"
diff --git a/samples/ApiDemos/res/drawable/box.xml b/samples/ApiDemos/res/drawable/box.xml
index 825de8495..482648bbb 100644
--- a/samples/ApiDemos/res/drawable/box.xml
+++ b/samples/ApiDemos/res/drawable/box.xml
@@ -18,7 +18,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#00000000"/>
- <stroke android:width="1dp" color="#ff000000"/>
+ <stroke android:width="1dp" android:color="#ff000000"/>
<padding android:left="1dp" android:top="1dp"
android:right="1dp" android:bottom="1dp" />
</shape>
diff --git a/samples/ApiDemos/res/drawable/box_white.xml b/samples/ApiDemos/res/drawable/box_white.xml
new file mode 100644
index 000000000..40b3cfc18
--- /dev/null
+++ b/samples/ApiDemos/res/drawable/box_white.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+** Copyright 2013, 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.
+*/
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <stroke android:width="1dp" android:color="#ffffffff"/>
+</shape>
diff --git a/samples/ApiDemos/res/drawable/filled_box.xml b/samples/ApiDemos/res/drawable/filled_box.xml
index 75d15a00b..f3839009f 100644
--- a/samples/ApiDemos/res/drawable/filled_box.xml
+++ b/samples/ApiDemos/res/drawable/filled_box.xml
@@ -18,7 +18,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#f0600000"/>
- <stroke android:width="3dp" color="#ffff8080"/>
+ <stroke android:width="3dp" android:color="#ffff8080"/>
<corners android:radius="3dp" />
<padding android:left="10dp" android:top="10dp"
android:right="10dp" android:bottom="10dp" />
diff --git a/samples/ApiDemos/res/drawable/hover_background_active.xml b/samples/ApiDemos/res/drawable/hover_background_active.xml
index 8819ce213..0881491f6 100644
--- a/samples/ApiDemos/res/drawable/hover_background_active.xml
+++ b/samples/ApiDemos/res/drawable/hover_background_active.xml
@@ -16,7 +16,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffdddd00"/>
- <stroke android:width="3dp" color="#ff000000"/>
+ <stroke android:width="3dp" android:color="#ff000000"/>
<corners android:radius="3dp" />
<padding android:left="10dp" android:top="10dp"
android:right="10dp" android:bottom="10dp" />
diff --git a/samples/ApiDemos/res/drawable/hover_background_inactive.xml b/samples/ApiDemos/res/drawable/hover_background_inactive.xml
index 5ddab3a24..0f6cb303f 100644
--- a/samples/ApiDemos/res/drawable/hover_background_inactive.xml
+++ b/samples/ApiDemos/res/drawable/hover_background_inactive.xml
@@ -16,7 +16,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#f0600000"/>
- <stroke android:width="3dp" color="#ffff8080"/>
+ <stroke android:width="3dp" android:color="#ffff8080"/>
<corners android:radius="3dp" />
<padding android:left="10dp" android:top="10dp"
android:right="10dp" android:bottom="10dp" />
diff --git a/samples/ApiDemos/res/layout/action_bar_display_options.xml b/samples/ApiDemos/res/layout/action_bar_display_options.xml
index 1718fdbc2..d4216f5dd 100644
--- a/samples/ApiDemos/res/layout/action_bar_display_options.xml
+++ b/samples/ApiDemos/res/layout/action_bar_display_options.xml
@@ -13,36 +13,47 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
- <Button android:id="@+id/toggle_home_as_up"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/toggle_home_as_up" />
- <Button android:id="@+id/toggle_show_home"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/toggle_show_home" />
- <Button android:id="@+id/toggle_use_logo"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/toggle_use_logo" />
- <Button android:id="@+id/toggle_show_title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/toggle_show_title" />
- <Button android:id="@+id/toggle_show_custom"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/toggle_show_custom" />
- <Button android:id="@+id/toggle_navigation"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/toggle_navigation" />
- <Button android:id="@+id/cycle_custom_gravity"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/cycle_custom_gravity" />
-</LinearLayout>
+ android:layout_height="match_parent">
+ <LinearLayout android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+ <Button android:id="@+id/toggle_home_as_up"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_home_as_up" />
+ <Button android:id="@+id/toggle_show_home"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_show_home" />
+ <Button android:id="@+id/toggle_use_logo"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_use_logo" />
+ <Button android:id="@+id/toggle_show_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_show_title" />
+ <Button android:id="@+id/toggle_show_custom"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_show_custom" />
+ <Button android:id="@+id/toggle_navigation"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_navigation" />
+ <Button android:id="@+id/cycle_custom_gravity"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/cycle_custom_gravity" />
+ <Button android:id="@+id/toggle_visibility"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_visibility" />
+ <Button android:id="@+id/toggle_system_ui"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_system_ui" />
+ </LinearLayout>
+</ScrollView> \ No newline at end of file
diff --git a/samples/ApiDemos/res/layout/custom_layout.xml b/samples/ApiDemos/res/layout/custom_layout.xml
new file mode 100644
index 000000000..ff3cfc4bc
--- /dev/null
+++ b/samples/ApiDemos/res/layout/custom_layout.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<!-- Demonstrates use of CustomLayout -->
+
+<!-- BEGIN_INCLUDE(Complete) -->
+<com.example.android.apis.view.CustomLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res/com.example.android.apis"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <!-- put first view to left. -->
+ <TextView
+ android:background="@drawable/filled_box"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:layout_position="left"
+ android:layout_gravity="fill_vertical|center_horizontal"
+ android:text="l1"/>
+
+ <!-- stack second view to left. -->
+ <TextView
+ android:background="@drawable/filled_box"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:layout_position="left"
+ android:layout_gravity="fill_vertical|center_horizontal"
+ android:text="l2"/>
+
+ <!-- also put a view on the right. -->
+ <TextView
+ android:background="@drawable/filled_box"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:layout_position="right"
+ android:layout_gravity="fill_vertical|center_horizontal"
+ android:text="r1"/>
+
+ <!-- by default views go in the middle; use fill vertical gravity -->
+ <TextView
+ android:background="@drawable/green"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="fill_vertical|center_horizontal"
+ android:text="fill-vert"/>
+
+ <!-- by default views go in the middle; use fill horizontal gravity -->
+ <TextView
+ android:background="@drawable/green"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical|fill_horizontal"
+ android:text="fill-horiz"/>
+
+ <!-- by default views go in the middle; use top-left gravity -->
+ <TextView
+ android:background="@drawable/blue"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="top|left"
+ android:text="top-left"/>
+
+ <!-- by default views go in the middle; use center gravity -->
+ <TextView
+ android:background="@drawable/blue"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:text="center"/>
+
+ <!-- by default views go in the middle; use bottom-right -->
+ <TextView
+ android:background="@drawable/blue"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom|right"
+ android:text="bottom-right"/>
+
+</com.example.android.apis.view.CustomLayout>
+<!-- END_INCLUDE(Complete) -->
diff --git a/samples/ApiDemos/res/layout/keystore_usage.xml b/samples/ApiDemos/res/layout/keystore_usage.xml
new file mode 100644
index 000000000..2bf784555
--- /dev/null
+++ b/samples/ApiDemos/res/layout/keystore_usage.xml
@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2013 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.
+-->
+
+<!--
+ Layout for using the AndroidKeyStore provider.
+ See src/com/android/sdk/security/AndroidKeyStoreUsage.java
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/LinearLayout1"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:padding="6dip" >
+
+ <RelativeLayout
+ android:id="@+id/entries_list_group"
+ android:layout_width="fill_parent"
+ android:layout_height="0dp"
+ android:layout_marginBottom="12dp"
+ android:layout_weight="1" >
+
+ <TextView
+ android:id="@+id/entries_list_label"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="12dp"
+ android:layout_marginTop="12dp"
+ android:text="@string/keystore_entries_list" />
+
+ <ListView
+ android:id="@+id/entries_list"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignLeft="@+id/entries_list_label"
+ android:layout_below="@+id/entries_list_label"
+ android:layout_marginBottom="12dp"
+ android:choiceMode="singleChoice" >
+
+ <requestFocus />
+ </ListView>
+
+ </RelativeLayout>
+
+ <RelativeLayout
+ android:id="@+id/sign_group"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="12dp"
+ android:layout_marginTop="12dp" >
+
+ <TextView
+ android:id="@+id/key_ops_header"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentTop="true"
+ android:layout_marginBottom="6dp"
+ android:text="@string/keystore_key_ops_header"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <TextView
+ android:id="@+id/plaintext_label"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignLeft="@id/key_ops_header"
+ android:layout_below="@id/key_ops_header"
+ android:layout_marginLeft="6dp"
+ android:text="@string/keystore_plaintext" />
+
+ <EditText
+ android:id="@+id/plaintext"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignBaseline="@+id/plaintext_label"
+ android:layout_alignParentRight="true"
+ android:layout_below="@+id/key_ops_header"
+ android:layout_toRightOf="@id/plaintext_label"
+ android:ems="10"
+ android:maxLines="1" />
+
+ <TextView
+ android:id="@+id/ciphertext_label"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignLeft="@id/plaintext_label"
+ android:layout_below="@+id/plaintext"
+ android:text="@string/keystore_ciphertext" />
+
+ <EditText
+ android:id="@+id/ciphertext"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignBaseline="@+id/ciphertext_label"
+ android:layout_alignParentRight="true"
+ android:layout_below="@+id/plaintext"
+ android:layout_toRightOf="@id/ciphertext_label"
+ android:maxLines="1" />
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignLeft="@id/plaintext_label"
+ android:layout_below="@+id/ciphertext" >
+
+ <Button
+ android:id="@+id/sign_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:enabled="false"
+ android:text="@string/keystore_sign" />
+
+ <Button
+ android:id="@+id/verify_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:enabled="false"
+ android:text="@string/keystore_verify" />
+
+ <Button
+ android:id="@+id/delete_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:enabled="false"
+ android:text="@string/keystore_delete" />
+
+ </LinearLayout>
+ </RelativeLayout>
+
+ <RelativeLayout
+ android:id="@+id/generate_group"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:layout_marginTop="12dp" >
+
+ <TextView
+ android:id="@+id/generating_header"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentTop="true"
+ android:text="@string/keystore_generating_header"
+ android:layout_marginBottom="6dp"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <TextView
+ android:id="@+id/entry_name_label"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/generating_header"
+ android:layout_marginBottom="12dp"
+ android:layout_marginLeft="6dp"
+ android:layout_alignLeft="@id/generating_header"
+ android:text="@string/keystore_entry_alias" />
+
+ <Button
+ android:id="@+id/generate_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignLeft="@id/entry_name_label"
+ android:layout_below="@+id/entry_name"
+ android:text="@string/keystore_generate" />
+
+ <EditText
+ android:id="@+id/entry_name"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignBaseline="@+id/entry_name_label"
+ android:layout_alignParentRight="true"
+ android:layout_marginBottom="12dp"
+ android:layout_toRightOf="@+id/entry_name_label"
+ android:ems="10" />
+ </RelativeLayout>
+
+</LinearLayout> \ No newline at end of file
diff --git a/samples/ApiDemos/res/layout/overscan.xml b/samples/ApiDemos/res/layout/overscan.xml
deleted file mode 100644
index ebae5cc92..000000000
--- a/samples/ApiDemos/res/layout/overscan.xml
+++ /dev/null
@@ -1,202 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent" android:layout_height="match_parent"
- >
- <view class="com.example.android.apis.view.OverscanActivity$IV"
- android:id="@+id/image"
- android:src="@drawable/frantic"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:scaleType="center"
- />
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fitsSystemWindows="true">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginLeft="25dp"
- android:layout_marginRight="25dp"
- android:layout_marginBottom="25dp"
- android:layout_gravity="bottom|center"
- android:background="#60000000"
- android:padding="8dp"
- android:orientation="vertical"
- >
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:baselineAligned="true"
- >
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:textColor="#FFFFFFFF"
- android:textSize="16dp"
- android:textStyle="bold"
- android:gravity="left"
- android:text="Mode:"
- />
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:baselineAlignedChildIndex="0"
- >
- <CheckBox
- android:id="@+id/modeLowProfile"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="#FFFFFFFF"
- android:text="LOW_PROFILE"
- />
- <CheckBox
- android:id="@+id/modeFullscreen"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="-10dp"
- android:textColor="#FFFFFFFF"
- android:text="FULLSCREEN"
- />
- <CheckBox
- android:id="@+id/modeHideNavigation"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="-10dp"
- android:textColor="#FFFFFFFF"
- android:text="HIDE_NAVIGATION"
- />
- </LinearLayout>
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:baselineAligned="true"
- >
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:textColor="#FFFFFFFF"
- android:textSize="16dp"
- android:textStyle="bold"
- android:gravity="left"
- android:text="Layout:"
- />
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:baselineAlignedChildIndex="0"
- >
- <CheckBox
- android:id="@+id/layoutStable"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="#FFFFFFFF"
- android:text="STABLE"
- />
- <CheckBox
- android:id="@+id/layoutFullscreen"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="-10dp"
- android:textColor="#FFFFFFFF"
- android:text="FULLSCREEN"
- />
- <CheckBox
- android:id="@+id/layoutHideNavigation"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="-10dp"
- android:textColor="#FFFFFFFF"
- android:text="HIDE_NAVIGATION"
- />
- </LinearLayout>
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:baselineAligned="true"
- >
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:textColor="#FFFFFFFF"
- android:textSize="16dp"
- android:textStyle="bold"
- android:gravity="left"
- android:text="Window:"
- />
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:baselineAlignedChildIndex="0"
- >
- <CheckBox
- android:id="@+id/windowFullscreen"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="#FFFFFFFF"
- android:text="FULLSCREEN"
- />
- <CheckBox
- android:id="@+id/windowHideActionBar"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="-10dp"
- android:textColor="#FFFFFFFF"
- android:text="Hide ActionBar"
- />
- <CheckBox
- android:id="@+id/windowActionMode"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="-10dp"
- android:textColor="#FFFFFFFF"
- android:text="Action Mode"
- />
- <!-- Crappy hack to make these the same size as the
- above groups. You'd never do this in real code. -->
- <CheckBox
- android:layout_width="wrap_content"
- android:layout_height="0dp"
- android:textColor="#FFFFFFFF"
- android:text="HIDE_NAVIGATION"
- />
- </LinearLayout>
- </LinearLayout>
- <TextView
- android:id="@+id/metricsText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textColor="#FFFFFFFF"
- android:textSize="11dp"
- android:textStyle="bold"
- android:gravity="center"
- />
- </LinearLayout>
- </FrameLayout>
-</FrameLayout>
diff --git a/samples/ApiDemos/res/layout/overscan_activity.xml b/samples/ApiDemos/res/layout/overscan_activity.xml
new file mode 100644
index 000000000..961067555
--- /dev/null
+++ b/samples/ApiDemos/res/layout/overscan_activity.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<!-- BEGIN_INCLUDE(complete) -->
+<!-- This layout is designed for use with FLAG_LAYOUT_IN_OVERSCAN, so its window will
+ be placed into the overscan region of the display (if there is one). Thus the contents
+ of the top-level view may be obscured around the edges by the display, leaving the
+ edge of the box background used here invisible. -->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@drawable/box_white">
+
+ <!-- This is still in the same position as the top-level FrameLayout, so the contentx
+ of this TextView may also be obscured. -->
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="3dp"
+ android:layout_marginLeft="3dp"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:text="Overscan" />
+
+ <!-- This FrameLayout uses android:fitsSystemWindows to have its padding adjusted so
+ that within that space its content is offset to not be obscured by the overscan
+ region (or also system decors that are covering its UI. -->
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fitsSystemWindows="true">
+
+ <!-- Now that we are within the padding region of the parent FrameLayout, we can
+ safely place content that will be visible to the user. -->
+ <ImageView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:src="@drawable/frantic"
+ android:scaleType="fitXY" />
+ <ImageView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@drawable/box_white" />
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="3dp"
+ android:layout_marginLeft="3dp"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:text="Content" />
+
+ </FrameLayout>
+
+</FrameLayout>
+<!-- END_INCLUDE(complete) -->
diff --git a/samples/ApiDemos/res/layout/rotation_animation.xml b/samples/ApiDemos/res/layout/rotation_animation.xml
new file mode 100644
index 000000000..4ca08195c
--- /dev/null
+++ b/samples/ApiDemos/res/layout/rotation_animation.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="#FFFFFFFF"
+ android:textSize="16sp"
+ android:textStyle="bold"
+ android:text="@string/rotation_animation_description"
+ />
+ <CheckBox
+ android:id="@+id/windowFullscreen"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:text="@string/rotation_animation_fullscreen"
+ />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:orientation="vertical"
+ >
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="#FFFFFFFF"
+ android:textSize="16sp"
+ android:textStyle="bold"
+ android:text="@string/rotation_animation_choices"
+ />
+ <RadioGroup
+ android:id="@+id/rotation_radio_group"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:checkedButton="@+id/rotation_anim_selection"
+ >
+ <RadioButton
+ android:id="@+id/rotate"
+ android:checked="true"
+ android:text="@string/rotation_animation_rotate"
+ />
+ <RadioButton
+ android:id="@+id/crossfade"
+ android:layout_marginStart="6dp"
+ android:text="@string/rotation_animation_crossfade"
+ />
+ <RadioButton
+ android:id="@+id/jumpcut"
+ android:layout_marginStart="6dp"
+ android:text="@string/rotation_animation_jumpcut"
+ />
+ </RadioGroup>
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/ApiDemos/res/layout/system_ui_modes.xml b/samples/ApiDemos/res/layout/system_ui_modes.xml
new file mode 100644
index 000000000..aaf6c1a21
--- /dev/null
+++ b/samples/ApiDemos/res/layout/system_ui_modes.xml
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent" android:layout_height="match_parent"
+ >
+ <view class="com.example.android.apis.view.SystemUIModes$IV"
+ android:id="@+id/image"
+ android:src="@drawable/frantic"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scaleType="fitXY"
+ />
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fitsSystemWindows="true">
+ <GridLayout android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="25dp"
+ android:layout_marginRight="25dp"
+ android:layout_marginBottom="25dp"
+ android:layout_gravity="bottom|center"
+ android:background="#60000000"
+ android:padding="8dp"
+ android:columnCount="2">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="#FFFFFFFF"
+ android:textSize="16dp"
+ android:textStyle="bold"
+ android:gravity="left"
+ android:text="Mode:"
+ />
+ <CheckBox
+ android:id="@+id/modeFullscreen"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="#FFFFFFFF"
+ android:text="FULLSCRN"
+ />
+ <CheckBox
+ android:id="@+id/modeLowProfile"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="#FFFFFFFF"
+ android:text="LOW_PROFILE"
+ />
+ <CheckBox
+ android:id="@+id/modeHideNavigation"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="#FFFFFFFF"
+ android:text="HIDE_NAV"
+ />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="#FFFFFFFF"
+ android:textSize="16dp"
+ android:textStyle="bold"
+ android:gravity="left"
+ android:text="Layout:"
+ />
+ <CheckBox
+ android:id="@+id/layoutFullscreen"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="#FFFFFFFF"
+ android:text="FULLSCRN"
+ />
+ <CheckBox
+ android:id="@+id/layoutStable"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="#FFFFFFFF"
+ android:text="STABLE"
+ />
+ <CheckBox
+ android:id="@+id/layoutHideNavigation"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="#FFFFFFFF"
+ android:text="HIDE_NAV"
+ />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_columnSpan="2"
+ android:textColor="#FFFFFFFF"
+ android:textSize="16dp"
+ android:textStyle="bold"
+ android:gravity="left"
+ android:text="Window:"
+ />
+ <CheckBox
+ android:id="@+id/windowHideActionBar"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="#FFFFFFFF"
+ android:text="No ActionBar"
+ />
+ <CheckBox
+ android:id="@+id/windowFullscreen"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="#FFFFFFFF"
+ android:text="FULLSCRN"
+ />
+ <CheckBox
+ android:id="@+id/windowActionMode"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="#FFFFFFFF"
+ android:text="Action Mode"
+ />
+ <CheckBox
+ android:id="@+id/windowOverscan"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="#FFFFFFFF"
+ android:text="OVERSCAN"
+ />
+ <TextView
+ android:id="@+id/metricsText"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_columnSpan="2"
+ android:textColor="#FFFFFFFF"
+ android:textSize="11dp"
+ android:textStyle="bold"
+ android:gravity="center"
+ />
+ </GridLayout>
+ </FrameLayout>
+</FrameLayout>
diff --git a/samples/ApiDemos/res/layout/textclock.xml b/samples/ApiDemos/res/layout/textclock.xml
index f86f61666..b7a3770c7 100644
--- a/samples/ApiDemos/res/layout/textclock.xml
+++ b/samples/ApiDemos/res/layout/textclock.xml
@@ -45,10 +45,18 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
+ <!-- Use styles -->
+ <TextClock
+ android:format12Hour="@string/styled_12_hour_clock2"
+ android:format24Hour="@string/styled_24_hour_clock2"
+
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
<!-- Shows seconds -->
<TextClock
- android:format12Hour="hh:mm:ss aa"
- android:format24Hour="kk:mm:ss"
+ android:format12Hour="hh:mm:ss a"
+ android:format24Hour="HH:mm:ss"
android:textSize="20sp"
android:shadowColor="#7fffffff"
@@ -59,8 +67,8 @@
<!-- Use a fixed time zone -->
<TextClock
- android:format12Hour="'Time in Paris:' MMM dd, yyyy h:mmaa"
- android:format24Hour="'Time in Paris:' MMM dd, yyyy k:mm"
+ android:format12Hour="'Time in Paris:' MMM dd, yyyy h:mma"
+ android:format24Hour="'Time in Paris:' MMM dd, yyyy HH:mm"
android:timeZone="Europe/Paris"
android:layout_width="wrap_content"
diff --git a/samples/ApiDemos/res/layout/trigger_sensors.xml b/samples/ApiDemos/res/layout/trigger_sensors.xml
new file mode 100644
index 000000000..c4156e0c5
--- /dev/null
+++ b/samples/ApiDemos/res/layout/trigger_sensors.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/text"
+ android:textSize="20sp"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/box"
+ android:layout_weight="1"
+ android:scrollbars="vertical"/>
+ />
+</LinearLayout>
diff --git a/samples/ApiDemos/res/layout/videoview.xml b/samples/ApiDemos/res/layout/videoview.xml
index db97a1114..ff636b99a 100644
--- a/samples/ApiDemos/res/layout/videoview.xml
+++ b/samples/ApiDemos/res/layout/videoview.xml
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<VideoView
android:id="@+id/surface_view"
- android:layout_width="320px"
- android:layout_height="240px"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
/>
-</LinearLayout>
+</FrameLayout>
diff --git a/samples/ApiDemos/res/layout/window_focus_observer.xml b/samples/ApiDemos/res/layout/window_focus_observer.xml
new file mode 100644
index 000000000..5c13b61a9
--- /dev/null
+++ b/samples/ApiDemos/res/layout/window_focus_observer.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical" android:padding="4dip"
+ android:gravity="center_horizontal"
+ android:layout_width="match_parent" android:layout_height="match_parent">
+
+ <TextView
+ android:layout_width="match_parent" android:layout_height="wrap_content"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:text="Demonstration of WindowInputToken.FocusObserver to monitor the focus state of a window."/>
+
+ <TextView android:id="@+id/focus_state"
+ android:layout_width="match_parent" android:layout_height="wrap_content"
+ android:layout_weight="0" android:paddingBottom="16dip"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+</LinearLayout>
diff --git a/samples/ApiDemos/res/raw/videoviewdemo.mp4 b/samples/ApiDemos/res/raw/videoviewdemo.mp4
new file mode 100644
index 000000000..57728106d
--- /dev/null
+++ b/samples/ApiDemos/res/raw/videoviewdemo.mp4
Binary files differ
diff --git a/samples/ApiDemos/res/values-v18/bools.xml b/samples/ApiDemos/res/values-v18/bools.xml
new file mode 100644
index 000000000..4449479da
--- /dev/null
+++ b/samples/ApiDemos/res/values-v18/bools.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<resources>
+ <!-- True if running under JellyBean MR2 or later. -->
+ <bool name="atLeastJellyBeanMR2">true</bool>
+</resources>
diff --git a/samples/ApiDemos/res/values/arrays.xml b/samples/ApiDemos/res/values/arrays.xml
index 150861371..b06220975 100644
--- a/samples/ApiDemos/res/values/arrays.xml
+++ b/samples/ApiDemos/res/values/arrays.xml
@@ -121,6 +121,10 @@
<item>REVERSE_LANDSCAPE</item>
<item>REVERSE_PORTRAIT</item>
<item>FULL_SENSOR</item>
+ <item>USER_LANDSCAPE</item>
+ <item>USER_PORTRAIT</item>
+ <item>FULL_USER</item>
+ <item>LOCKED</item>
</string-array>
<!-- Used in view/Secure View examples -->
diff --git a/samples/ApiDemos/res/values/attrs.xml b/samples/ApiDemos/res/values/attrs.xml
index 35f224ef5..bf33788cb 100644
--- a/samples/ApiDemos/res/values/attrs.xml
+++ b/samples/ApiDemos/res/values/attrs.xml
@@ -33,6 +33,19 @@
<attr name="textSize" format="dimension" />
</declare-styleable>
+ <!-- These are the attributes that we want to retrieve for
+ view/CustomLayout.java -->
+<!-- BEGIN_INCLUDE(CustomLayout) -->
+ <declare-styleable name="CustomLayoutLP">
+ <attr name="android:layout_gravity" />
+ <attr name="layout_position">
+ <enum name="middle" value="0" />
+ <enum name="left" value="1" />
+ <enum name="right" value="2" />
+ </attr>
+ </declare-styleable>
+<!-- END_INCLUDE(CustomLayout) -->
+
<!-- These are attributes used with 'DraggableDot' drawables in
view/DragAndDropActivity.java and view/DraggableDot.java -->
<declare-styleable name="DraggableDot">
diff --git a/samples/ApiDemos/res/values/bools.xml b/samples/ApiDemos/res/values/bools.xml
index 38c602e74..366d7337a 100644
--- a/samples/ApiDemos/res/values/bools.xml
+++ b/samples/ApiDemos/res/values/bools.xml
@@ -38,5 +38,10 @@
API level. The default value is false; an alternative value
for JellyBean MR 1 is true. -->
<bool name="atLeastJellyBeanMR1">false</bool>
-
+
+ <!-- This resource is true if running under at least JellyBean MR2
+ API level. The default value is false; an alternative value
+ for JellyBean MR 2 is true. -->
+ <bool name="atLeastJellyBeanMR2">false</bool>
+
</resources>
diff --git a/samples/ApiDemos/res/values/strings.xml b/samples/ApiDemos/res/values/strings.xml
index ee1241eab..5a1df82de 100644
--- a/samples/ApiDemos/res/values/strings.xml
+++ b/samples/ApiDemos/res/values/strings.xml
@@ -21,8 +21,12 @@
<!-- app/activity examples strings -->
<!-- =============================== -->
- <string name="styled_12_hour_clock">MM/<font fgcolor="#ffff0000"><b>dd</b></font>/yy h<font fgcolor="#ffff0000"><sup><small>mm</small></sup></font><b>aa</b></string>
- <string name="styled_24_hour_clock">MM/<font fgcolor="#ffff0000"><b>dd</b></font>/yy k<font fgcolor="#ffff0000"><sup><small>mm</small></sup></font></string>
+ <!-- The "color" attribute is an alias for "fgcolor" and was introduced in API level 18. -->
+ <string name="styled_12_hour_clock">MM/<font color="red"><b>dd</b></font>/yy h<font color="#ffff0000"><sup><small>mm</small></sup></font><b>aa</b></string>
+ <string name="styled_24_hour_clock">MM/<font color="red"><b>dd</b></font>/yy k<font color="#ffff0000"><sup><small>mm</small></sup></font></string>
+
+ <string name="styled_12_hour_clock2">\'Custom font:\' <font color="@android:color/primary_text_holo_dark" face="sans-serif-thin">MM/dd/yy h:mm aa</font></string>
+ <string name="styled_24_hour_clock2">\'Custom font:\' <font color="@android:color/primary_text_holo_dark" face="sans-serif-thin">MM/dd/yy k:mm</font></string>
<string name="tabs_1_tab_1">tab1</string>
<string name="tabs_1_tab_2">tab2</string>
@@ -43,6 +47,8 @@
custom Theme.Dialog theme to make an activity that looks like a
customized dialog, here with an ugly frame.</string>
+ <string name="activity_overscan">App/Activity/Overscan</string>
+
<string name="quick_contacts_demo">App/Activity/QuickContactsDemo</string>
<string name="activity_wallpaper">App/Activity/Wallpaper</string>
@@ -381,6 +387,8 @@
<string name="reorder_four_text">This is the last in a sequence of four Activities.</string>
<string name="reorder_second_to_front">Bring the second in front</string>
+ <string name ="activity_rotation_animation">App/Activity/Rotation Animation</string>
+
<string name="menu_from_xml_title">App/Menu/Inflate from XML</string>
<string name="menu_from_xml_instructions_press_menu">Select a menu resource and press the menu key.</string>
<string name="menu_from_xml_instructions_go_back">If you want to choose another menu resource, go back and re-run this activity.</string>
@@ -442,6 +450,8 @@
<string name="pick_phone">Pick a Phone</string>
<string name="pick_address">Pick an Address</string>
+ <string name="activity_changed_contact">Content/Provider/Changed Contacts</string>
+
<string name="activity_install_apk">Content/Packages/Install Apk</string>
<!-- ============================== -->
@@ -839,6 +849,8 @@
<string name="toggle_show_custom">DISPLAY_SHOW_CUSTOM</string>
<string name="toggle_navigation">Navigation</string>
<string name="cycle_custom_gravity">Cycle Custom View Gravity</string>
+ <string name="toggle_visibility">Toggle Visibility</string>
+ <string name="toggle_system_ui">Toggle System UI</string>
<string name="display_options_custom_button">Custom View!</string>
<string name="display_options_menu_item">Menu Item</string>
@@ -867,6 +879,14 @@
<string name="local_audio">Play Audio from Local File</string>
<string name="res_audio">Play Audio from Resources</string>
+ <!-- =========================== -->
+ <!-- os examples strings -->
+ <!-- =========================== -->
+ <string name="no_sig_motion">Significant Motion Sensor Not Detected</string>
+ <string name="sig_motion">Significant Motion Sensor Detected</string>
+ <string name="sig_motion_enabled">Significant Motion Sensor Enabled</string>
+ <string name="sig_motion_auto_disabled">Significant Motion Sensor Auto Disabled</string>
+
<!-- ============================ -->
<!-- views examples strings -->
<!-- ============================ -->
@@ -1150,6 +1170,16 @@
<string name="relative_layout_2_instructions">Type here:</string>
<string name="relative_layout_2_ok">Ok</string>
<string name="relative_layout_2_cancel">Cancel</string>
+ <string name="rotation_animation_description">
+ Change the default rotation animation from rotating to fade or jumpcut.
+ Only works if FLAG_FULLSCREEN is set and there are no dialogs up.
+ Try rotating with and without the Power Off dialog visible.
+ </string>
+ <string name="rotation_animation_fullscreen">FULLSCREEN</string>
+ <string name="rotation_animation_choices">Rotation Animation:</string>
+ <string name="rotation_animation_rotate">ROTATE</string>
+ <string name="rotation_animation_crossfade">XFADE</string>
+ <string name="rotation_animation_jumpcut">JUMPCUT</string>
<string name="scroll_view_1_text_1">Text View 1</string>
<string name="scroll_view_1_button_1">Button 1</string>
<string name="scroll_view_1_text_2">Text View 2</string>
@@ -1434,4 +1464,21 @@
<string name="task_complete">is complete</string>
<string name="task_not_complete">is not complete</string>
+ <!-- =========================== -->
+ <!-- Security API demo strings -->
+ <!-- =========================== --> <skip />
+
+ <string name="keystore_entries_list">List of entries:</string>
+
+ <string name="keystore_key_ops_header">Key operations</string>
+ <string name="keystore_plaintext">Plaintext:</string>
+ <string name="keystore_ciphertext">Ciphertext:</string>
+ <string name="keystore_sign">Sign</string>
+ <string name="keystore_verify">Verify</string>
+ <string name="keystore_delete">Delete</string>
+
+ <string name="keystore_generating_header">Generating</string>
+ <string name="keystore_entry_alias">Entry alias:</string>
+ <string name="keystore_generate">Generate</string>
+ <string name="keystore_no_alias_error">Must supply an alias</string>
</resources>
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/ActionBarDisplayOptions.java b/samples/ApiDemos/src/com/example/android/apis/app/ActionBarDisplayOptions.java
index 257f0cd44..73d8db967 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/ActionBarDisplayOptions.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/ActionBarDisplayOptions.java
@@ -46,6 +46,8 @@ public class ActionBarDisplayOptions extends Activity
findViewById(R.id.toggle_show_custom).setOnClickListener(this);
findViewById(R.id.toggle_navigation).setOnClickListener(this);
findViewById(R.id.cycle_custom_gravity).setOnClickListener(this);
+ findViewById(R.id.toggle_visibility).setOnClickListener(this);
+ findViewById(R.id.toggle_system_ui).setOnClickListener(this);
mCustomView = getLayoutInflater().inflate(R.layout.action_bar_display_options_custom, null);
// Configure several action bar elements that will be toggled by display options.
@@ -107,6 +109,22 @@ public class ActionBarDisplayOptions extends Activity
lp.gravity = lp.gravity & ~Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK | newGravity;
bar.setCustomView(mCustomView, lp);
return;
+ case R.id.toggle_visibility:
+ if (bar.isShowing()) {
+ bar.hide();
+ } else {
+ bar.show();
+ }
+ return;
+ case R.id.toggle_system_ui:
+ if ((getWindow().getDecorView().getSystemUiVisibility()
+ & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0) {
+ getWindow().getDecorView().setSystemUiVisibility(0);
+ } else {
+ getWindow().getDecorView().setSystemUiVisibility(
+ View.SYSTEM_UI_FLAG_FULLSCREEN);
+ }
+ return;
}
int change = bar.getDisplayOptions() ^ flags;
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/OverscanActivity.java b/samples/ApiDemos/src/com/example/android/apis/app/OverscanActivity.java
new file mode 100644
index 000000000..38f4a0a64
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/app/OverscanActivity.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2013 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.example.android.apis.app;
+
+// Need the following import to get access to the app resources, since this
+// class is in a sub-package.
+import android.widget.ImageView;
+import com.example.android.apis.R;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+/**
+ * <h3>Overscan Activity</h3>
+ *
+ * <p>This demonstrates the how to write an activity that extends into the
+ * overscan region.</p>
+ */
+public class OverscanActivity extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.overscan_activity);
+ }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/RotationAnimation.java b/samples/ApiDemos/src/com/example/android/apis/app/RotationAnimation.java
new file mode 100644
index 000000000..44bd1e6fa
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/app/RotationAnimation.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2013 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.example.android.apis.app;
+
+import com.example.android.apis.R;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.Window;
+import android.view.WindowManager;
+import android.view.WindowManager.LayoutParams;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.RadioGroup;
+
+
+public class RotationAnimation extends Activity {
+
+ private int mRotationAnimation = LayoutParams.ROTATION_ANIMATION_ROTATE;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setRotationAnimation(mRotationAnimation);
+
+ setContentView(R.layout.rotation_animation);
+
+ ((CheckBox)findViewById(R.id.windowFullscreen)).setOnCheckedChangeListener(
+ new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ setFullscreen(isChecked);
+ }
+ }
+ );
+
+ ((RadioGroup)findViewById(R.id.rotation_radio_group)).setOnCheckedChangeListener(
+ new RadioGroup.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(RadioGroup group, int checkedId) {
+ switch (checkedId) {
+ default:
+ case R.id.rotate:
+ mRotationAnimation = LayoutParams.ROTATION_ANIMATION_ROTATE;
+ break;
+ case R.id.crossfade:
+ mRotationAnimation = LayoutParams.ROTATION_ANIMATION_CROSSFADE;
+ break;
+ case R.id.jumpcut:
+ mRotationAnimation = LayoutParams.ROTATION_ANIMATION_JUMPCUT;
+ break;
+ }
+ setRotationAnimation(mRotationAnimation);
+ }
+ }
+ );
+ }
+
+ private void setFullscreen(boolean on) {
+ Window win = getWindow();
+ WindowManager.LayoutParams winParams = win.getAttributes();
+ if (on) {
+ winParams.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
+ } else {
+ winParams.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
+ }
+ win.setAttributes(winParams);
+ }
+
+ private void setRotationAnimation(int rotationAnimation) {
+ Window win = getWindow();
+ WindowManager.LayoutParams winParams = win.getAttributes();
+ winParams.rotationAnimation = rotationAnimation;
+ win.setAttributes(winParams);
+ }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/ScreenOrientation.java b/samples/ApiDemos/src/com/example/android/apis/app/ScreenOrientation.java
index 3946b2a9b..01eb5246a 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/ScreenOrientation.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/ScreenOrientation.java
@@ -46,6 +46,10 @@ public class ScreenOrientation extends Activity {
ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE,
ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT,
ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR,
+ ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE,
+ ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT,
+ ActivityInfo.SCREEN_ORIENTATION_FULL_USER,
+ ActivityInfo.SCREEN_ORIENTATION_LOCKED,
};
@Override
diff --git a/samples/ApiDemos/src/com/example/android/apis/content/ChangedContacts.java b/samples/ApiDemos/src/com/example/android/apis/content/ChangedContacts.java
new file mode 100644
index 000000000..412a3c6dc
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/content/ChangedContacts.java
@@ -0,0 +1,348 @@
+/*
+ * Copyright (C) 2013 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.example.android.apis.content;
+
+import android.app.Activity;
+import android.app.LoaderManager;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.CursorLoader;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.Loader;
+import android.content.SharedPreferences;
+import android.database.Cursor;
+import android.database.CursorWrapper;
+import android.os.Bundle;
+import android.provider.ContactsContract;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.CursorAdapter;
+import android.widget.LinearLayout;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+/**
+ * Demonstrates selecting contacts that have changed since a certain time.
+ */
+public class ChangedContacts extends Activity implements LoaderManager.LoaderCallbacks<Cursor> {
+
+ private static final String CLASS = ChangedContacts.class.getSimpleName();
+
+ private static final String PREF_KEY_CHANGE = "timestamp_change";
+ private static final String PREF_KEY_DELETE = "timestamp_delete";
+
+ private static final int ID_CHANGE_LOADER = 1;
+ private static final int ID_DELETE_LOADER = 2;
+
+ /**
+ * To see this in action, "clear data" for the contacts storage app in the system settings.
+ * Then come into this app and hit any of the delta buttons. This will cause the contacts
+ * database to be re-created.
+ */
+ private BroadcastReceiver mReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Toast toast = Toast.makeText(context, "Contacts database created.", Toast.LENGTH_SHORT);
+ toast.show();
+ }
+ };
+
+ private DeleteAdapter mDeleteAdapter;
+ private ChangeAdapter mChangeAdapter;
+ private long mSearchTime;
+ private TextView mDisplayView;
+ private ListView mList;
+ private Button mDeleteButton;
+ private Button mChangeButton;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ mDeleteAdapter = new DeleteAdapter(this, null, 0);
+ mChangeAdapter = new ChangeAdapter(this, null, 0);
+
+ LinearLayout main = new LinearLayout(this);
+ main.setOrientation(LinearLayout.VERTICAL);
+
+ mChangeButton = new Button(this);
+ mChangeButton.setText("Changed since " + getLastTimestamp(0, PREF_KEY_CHANGE));
+ mChangeButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ changeClick();
+ }
+ });
+
+ mDeleteButton = new Button(this);
+ mDeleteButton.setText("Deleted since " + getLastTimestamp(0, PREF_KEY_DELETE));
+ mDeleteButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ deleteClick();
+ }
+ });
+
+ main.addView(mChangeButton);
+ main.addView(mDeleteButton);
+
+ mDisplayView = new TextView(this);
+ mDisplayView.setPadding(5, 5, 5, 5);
+ main.addView(mDisplayView);
+
+ mList = new ListView(this);
+ mList.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
+ ViewGroup.LayoutParams.WRAP_CONTENT, 1f));
+ main.addView(mList);
+
+ setContentView(main);
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(ContactsContract.Intents.CONTACTS_DATABASE_CREATED);
+ registerReceiver(mReceiver, filter);
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ unregisterReceiver(mReceiver);
+ }
+
+ private void changeClick() {
+ mChangeAdapter.swapCursor(null);
+ LoaderManager manager = getLoaderManager();
+ manager.destroyLoader(ID_DELETE_LOADER);
+ manager.restartLoader(ID_CHANGE_LOADER, null, this);
+ }
+
+ private void deleteClick() {
+ mChangeAdapter.swapCursor(null);
+ LoaderManager manager = getLoaderManager();
+ manager.destroyLoader(ID_CHANGE_LOADER);
+ manager.restartLoader(ID_DELETE_LOADER, null, this);
+ }
+
+ private void saveLastTimestamp(long time, String key) {
+ SharedPreferences pref = getSharedPreferences(CLASS, Context.MODE_PRIVATE);
+ SharedPreferences.Editor editor = pref.edit();
+ editor.putLong(key, time);
+ editor.commit();
+ }
+
+ private long getLastTimestamp(long time, String key) {
+ SharedPreferences pref = getSharedPreferences(CLASS, Context.MODE_PRIVATE);
+ return pref.getLong(key, time);
+ }
+
+ @Override
+ public Loader<Cursor> onCreateLoader(int id, Bundle args) {
+ switch(id) {
+ case ID_CHANGE_LOADER:
+ return getChangeLoader();
+ case ID_DELETE_LOADER:
+ return getDeleteLoader();
+ }
+ return null;
+ }
+
+ private CursorLoader getChangeLoader() {
+ String[] projection = new String[]{
+ ContactsContract.Data._ID,
+ ContactsContract.Data.CONTACT_ID,
+ ContactsContract.Data.DISPLAY_NAME,
+ ContactsContract.Data.CONTACT_LAST_UPDATED_TIMESTAMP
+ };
+
+ mSearchTime = getLastTimestamp(0, PREF_KEY_CHANGE);
+
+ String selection = ContactsContract.Data.CONTACT_LAST_UPDATED_TIMESTAMP + " > ?";
+ String[] bindArgs = new String[]{mSearchTime + ""};
+ return new CursorLoader(this, ContactsContract.Data.CONTENT_URI, projection,
+ selection, bindArgs, ContactsContract.Data.CONTACT_LAST_UPDATED_TIMESTAMP
+ + " desc, " + ContactsContract.Data.CONTACT_ID + " desc");
+ }
+
+ private CursorLoader getDeleteLoader() {
+ String[] projection = new String[]{
+ ContactsContract.DeletedContacts.CONTACT_ID,
+ ContactsContract.DeletedContacts.CONTACT_DELETED_TIMESTAMP
+ };
+
+ mSearchTime = getLastTimestamp(0, PREF_KEY_DELETE);
+
+ String selection = ContactsContract.DeletedContacts.CONTACT_DELETED_TIMESTAMP + " > ?";
+ String[] bindArgs = new String[]{mSearchTime + ""};
+ return new CursorLoader(this, ContactsContract.DeletedContacts.CONTENT_URI, projection,
+ selection, bindArgs, ContactsContract.DeletedContacts.CONTACT_DELETED_TIMESTAMP +
+ " desc");
+ }
+
+ @Override
+ public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor data) {
+ long timestamp = 0;
+
+
+ switch (cursorLoader.getId()) {
+ case ID_CHANGE_LOADER:
+ mDisplayView.setText(data.getCount() + " change(s) since " + mSearchTime);
+ mList.setAdapter(mChangeAdapter);
+ mChangeAdapter.swapCursor(data);
+
+ // Save the largest timestamp returned. Only need the first one due to the sort
+ // order.
+ if (data.moveToNext()) {
+ timestamp = data.getLong(data.getColumnIndex(
+ ContactsContract.Data.CONTACT_LAST_UPDATED_TIMESTAMP));
+ data.moveToPrevious();
+ }
+ if (timestamp > 0) {
+ saveLastTimestamp(timestamp, PREF_KEY_CHANGE);
+ mChangeButton.setText("Changed since " + timestamp);
+ }
+ break;
+ case ID_DELETE_LOADER:
+ mDisplayView.setText(data.getCount() + " delete(s) since " + mSearchTime);
+ mList.setAdapter(mDeleteAdapter);
+ mDeleteAdapter.swapCursor(new DeleteCursorWrapper(data));
+ if (data.moveToNext()) {
+ timestamp = data.getLong(data.getColumnIndex(
+ ContactsContract.DeletedContacts.CONTACT_DELETED_TIMESTAMP));
+ data.moveToPrevious();
+ }
+ if (timestamp > 0) {
+ saveLastTimestamp(timestamp, PREF_KEY_DELETE);
+ mDeleteButton.setText("Deleted since " + timestamp);
+ }
+ break;
+ }
+ }
+
+ @Override
+ public void onLoaderReset(Loader<Cursor> cursorLoader) {
+ mDisplayView.setText("");
+ switch (cursorLoader.getId()) {
+ case ID_CHANGE_LOADER:
+ mChangeAdapter.swapCursor(null);
+ break;
+ case ID_DELETE_LOADER:
+ mDeleteAdapter.swapCursor(null);
+ break;
+ }
+ }
+
+ private class DeleteCursorWrapper extends CursorWrapper {
+
+ /**
+ * Creates a cursor wrapper.
+ *
+ * @param cursor The underlying cursor to wrap.
+ */
+ public DeleteCursorWrapper(Cursor cursor) {
+ super(cursor);
+ }
+
+ @Override
+ public int getColumnIndexOrThrow(String columnName) {
+ if (columnName.equals("_id")) {
+ return super.getColumnIndex(ContactsContract.DeletedContacts.CONTACT_ID);
+ }
+ return super.getColumnIndex(columnName);
+ }
+ }
+
+ private static class DeleteAdapter extends CursorAdapter {
+
+ private Context mContext;
+
+ public DeleteAdapter(Context context, Cursor c, int flags) {
+ super(context, c, flags);
+ this.mContext = context;
+ }
+
+ @Override
+ public View newView(Context context, Cursor cursor, ViewGroup parent) {
+ LinearLayout item = new LinearLayout(mContext);
+ item.addView(buildText(context));
+ item.addView(buildText(context));
+ return item;
+ }
+
+ @Override
+ public void bindView(View view, Context context, Cursor cursor) {
+ LinearLayout item = (LinearLayout) view;
+ String id = cursor.getString(cursor.getColumnIndex(
+ ContactsContract.DeletedContacts.CONTACT_ID));
+ String timestamp = cursor.getString(cursor.getColumnIndex(
+ ContactsContract.DeletedContacts.CONTACT_DELETED_TIMESTAMP));
+
+ setText(item.getChildAt(0), id);
+ setText(item.getChildAt(1), timestamp);
+ }
+ }
+
+ private static class ChangeAdapter extends CursorAdapter {
+
+ private Context mContext;
+
+ public ChangeAdapter(Context context, Cursor c, int flags) {
+ super(context, c, flags);
+ mContext = context;
+ }
+
+ @Override
+ public View newView(Context context, Cursor cursor, ViewGroup parent) {
+ LinearLayout item = new LinearLayout(mContext);
+ item.addView(buildText(context));
+ item.addView(buildText(context));
+ item.addView(buildText(context));
+ return item;
+ }
+
+ @Override
+ public void bindView(View view, Context context, Cursor cursor) {
+ LinearLayout item = (LinearLayout) view;
+
+ String id = cursor.getString(cursor.getColumnIndex(ContactsContract.Data.CONTACT_ID));
+ String name = cursor.getString(cursor.getColumnIndex(
+ ContactsContract.Data.DISPLAY_NAME));
+ String timestamp = cursor.getString(cursor.getColumnIndex(
+ ContactsContract.Data.CONTACT_LAST_UPDATED_TIMESTAMP));
+
+ setText(item.getChildAt(0), id);
+ setText(item.getChildAt(1), name);
+ setText(item.getChildAt(2), timestamp);
+ }
+ }
+
+ private static void setText(View view, String value) {
+ TextView text = (TextView) view;
+ text.setText(value);
+ }
+
+ private static TextView buildText(Context context) {
+ TextView view = new TextView(context);
+ view.setPadding(3, 3, 3, 3);
+ return view;
+ }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/content/FileProvider.java b/samples/ApiDemos/src/com/example/android/apis/content/FileProvider.java
index 156625a67..f26bcdaf4 100644
--- a/samples/ApiDemos/src/com/example/android/apis/content/FileProvider.java
+++ b/samples/ApiDemos/src/com/example/android/apis/content/FileProvider.java
@@ -26,9 +26,11 @@ import android.content.ContentValues;
import android.content.ContentProvider.PipeDataWriter;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
+import android.database.MatrixCursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
+import android.provider.OpenableColumns;
import android.util.Log;
/**
@@ -45,8 +47,43 @@ public class FileProvider extends ContentProvider
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder) {
- // Don't support queries.
- return null;
+
+ // content providers that support open and openAssetFile should support queries for all
+ // android.provider.OpenableColumns.
+
+ int displayNameIndex = -1;
+ int sizeIndex = -1;
+
+ // If projection is null, return all columns.
+ if (projection == null) {
+ projection = new String[] {
+ OpenableColumns.DISPLAY_NAME,
+ OpenableColumns.SIZE};
+ }
+
+ for (int i = 0; i < projection.length; i++) {
+ if (OpenableColumns.DISPLAY_NAME.equals(projection[i])) {
+ displayNameIndex = i;
+ }
+ if (OpenableColumns.SIZE.equals(projection[i])) {
+ sizeIndex = i;
+ }
+ }
+
+ MatrixCursor cursor = new MatrixCursor(projection);
+ Object[] result = new Object[projection.length];
+
+ for (int i = 0; i < result.length; i++) {
+ if (i == displayNameIndex) {
+ result[i] = uri.getPath();
+ }
+ if (i == sizeIndex) {
+ result[i] = null; // Size is unknown, so null, if it was known, it would go here.
+ }
+ }
+
+ cursor.addRow(result);
+ return cursor;
}
@Override
diff --git a/samples/ApiDemos/src/com/example/android/apis/media/VideoViewDemo.java b/samples/ApiDemos/src/com/example/android/apis/media/VideoViewDemo.java
index e72c077a6..dacff56f2 100644
--- a/samples/ApiDemos/src/com/example/android/apis/media/VideoViewDemo.java
+++ b/samples/ApiDemos/src/com/example/android/apis/media/VideoViewDemo.java
@@ -18,6 +18,7 @@ package com.example.android.apis.media;
import com.example.android.apis.R;
import android.app.Activity;
+import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.Toast;
@@ -29,7 +30,6 @@ public class VideoViewDemo extends Activity {
* TODO: Set the path variable to a streaming video URL or a local media
* file path.
*/
- private String path = "";
private VideoView mVideoView;
@Override
@@ -38,24 +38,13 @@ public class VideoViewDemo extends Activity {
setContentView(R.layout.videoview);
mVideoView = (VideoView) findViewById(R.id.surface_view);
- if (path == "") {
- // Tell the user to provide a media file URL/path.
- Toast.makeText(
- VideoViewDemo.this,
- "Please edit VideoViewDemo Activity, and set path"
- + " variable to your media file URL/path",
- Toast.LENGTH_LONG).show();
- } else {
-
- /*
- * Alternatively,for streaming media you can use
- * mVideoView.setVideoURI(Uri.parse(URLstring));
- */
- mVideoView.setVideoPath(path);
- mVideoView.setMediaController(new MediaController(this));
- mVideoView.requestFocus();
-
- }
+ /*
+ * Alternatively, you can use mVideoView.setVideoPath(<path>);
+ */
+ mVideoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() +
+ "/" + R.raw.videoviewdemo));
+ mVideoView.setMediaController(new MediaController(this));
+ mVideoView.requestFocus();
}
}
diff --git a/samples/ApiDemos/src/com/example/android/apis/os/TriggerSensors.java b/samples/ApiDemos/src/com/example/android/apis/os/TriggerSensors.java
new file mode 100644
index 000000000..7d4b4168c
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/os/TriggerSensors.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2013 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.example.android.apis.os;
+
+import android.app.Activity;
+import android.content.Context;
+import android.view.View;
+import android.hardware.Sensor;
+import android.hardware.TriggerEvent;
+import android.hardware.TriggerEventListener;
+import android.hardware.SensorManager;
+import android.os.Bundle;
+import android.widget.TextView;
+import com.example.android.apis.R;
+
+/**
+ * <h3>Application showing the Trigger Sensor API for the Significant Motion sensor. </h3>
+
+<p>This demonstrates the {@link android.hardware.SensorManager android.hardware.SensorManager
+ android.hardware.TriggerEventListener} class.
+
+<h4>Demo</h4>
+OS / TriggerSensors
+
+<h4>Source files</h4>
+ * <table class="LinkTable">
+ * <tr>
+ * <td >src/com.example.android.apis/os/TriggerSensors.java</td>
+ * <td >TriggerSensors</td>
+ * </tr>
+ * </table>
+ */
+
+
+class TriggerListener extends TriggerEventListener {
+ private Context mContext;
+ private TextView mTextView;
+
+ TriggerListener(Context context, TextView textView) {
+ mContext = context;
+ mTextView = textView;
+ }
+
+ @Override
+ public void onTrigger(TriggerEvent event) {
+ if (event.values[0] == 1) {
+ mTextView.append(mContext.getString(R.string.sig_motion) + "\n");
+ mTextView.append(mContext.getString(R.string.sig_motion_auto_disabled) + "\n");
+ }
+ // Sensor is auto disabled.
+ }
+}
+
+public class TriggerSensors extends Activity {
+ private SensorManager mSensorManager;
+ private Sensor mSigMotion;
+ private TriggerListener mListener;
+ private TextView mTextView;
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ if (mSigMotion != null && mSensorManager.requestTriggerSensor(mListener, mSigMotion))
+ mTextView.append(getString(R.string.sig_motion_enabled) + "\n");
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ // Call disable only if needed for cleanup.
+ // The sensor is auto disabled when triggered.
+ if (mSigMotion != null) mSensorManager.cancelTriggerSensor(mListener, mSigMotion);
+ }
+
+
+ /**
+ * Initialization of the Activity after it is first created. Must at least
+ * call {@link android.app.Activity#setContentView setContentView()} to
+ * describe what is to be displayed in the screen.
+ */
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.trigger_sensors);
+ mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
+ mSigMotion = mSensorManager.getDefaultSensor(Sensor.TYPE_SIGNIFICANT_MOTION);
+ mTextView = (TextView)findViewById(R.id.text);
+ mListener = new TriggerListener(this, mTextView);
+ if (mSigMotion == null) {
+ mTextView.append(getString(R.string.no_sig_motion) + "\n");
+ }
+ }
+
+ @Override
+ protected void onStop() {
+ if (mSigMotion != null) mSensorManager.cancelTriggerSensor(mListener, mSigMotion);
+ super.onStop();
+ }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/security/KeyStoreUsage.java b/samples/ApiDemos/src/com/example/android/apis/security/KeyStoreUsage.java
new file mode 100644
index 000000000..901806ac5
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/security/KeyStoreUsage.java
@@ -0,0 +1,526 @@
+/*
+ * Copyright 2013 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.example.android.apis.security;
+
+import com.example.android.apis.R;
+
+import android.app.Activity;
+import android.content.Context;
+import android.database.DataSetObserver;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.security.KeyPairGeneratorSpec;
+import android.util.Base64;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.View.OnFocusChangeListener;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ListAdapter;
+import android.widget.ListView;
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.KeyStore;
+import java.security.KeyStore.PrivateKeyEntry;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Signature;
+import java.security.SignatureException;
+import java.security.UnrecoverableEntryException;
+import java.security.cert.CertificateException;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.List;
+
+import javax.security.auth.x500.X500Principal;
+
+public class KeyStoreUsage extends Activity {
+ private static final String TAG = "AndroidKeyStoreUsage";
+
+ /**
+ * An instance of {@link java.security.KeyStore} through which this app
+ * talks to the {@code AndroidKeyStore}.
+ */
+ KeyStore mKeyStore;
+
+ /**
+ * Used by the {@code ListView} in our layout to list the keys available in
+ * our {@code KeyStore} by their alias names.
+ */
+ AliasAdapter mAdapter;
+
+ /**
+ * Button in the UI that causes a new keypair to be generated in the
+ * {@code KeyStore}.
+ */
+ Button mGenerateButton;
+
+ /**
+ * Button in the UI that causes data to be signed by a key we selected from
+ * the list available in the {@code KeyStore}.
+ */
+ Button mSignButton;
+
+ /**
+ * Button in the UI that causes data to be signed by a key we selected from
+ * the list available in the {@code KeyStore}.
+ */
+ Button mVerifyButton;
+
+ /**
+ * Button in the UI that causes a key entry to be deleted from the
+ * {@code KeyStore}.
+ */
+ Button mDeleteButton;
+
+ /**
+ * Text field in the UI that holds plaintext.
+ */
+ EditText mPlainText;
+
+ /**
+ * Text field in the UI that holds the signature.
+ */
+ EditText mCipherText;
+
+ /**
+ * The alias of the selected entry in the KeyStore.
+ */
+ private String mSelectedAlias;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.keystore_usage);
+
+ /*
+ * Set up our {@code ListView} with an adapter that allows
+ * us to choose from the available entry aliases.
+ */
+ ListView lv = (ListView) findViewById(R.id.entries_list);
+ mAdapter = new AliasAdapter(getApplicationContext());
+ lv.setAdapter(mAdapter);
+ lv.setOnItemClickListener(new OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ mSelectedAlias = mAdapter.getItem(position);
+ setKeyActionButtonsEnabled(true);
+ }
+ });
+
+ // This is alias the user wants for a generated key.
+ final EditText aliasInput = (EditText) findViewById(R.id.entry_name);
+ mGenerateButton = (Button) findViewById(R.id.generate_button);
+ mGenerateButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ /*
+ * When the user presses the "Generate" button, we'll
+ * check the alias isn't blank here.
+ */
+ final String alias = aliasInput.getText().toString();
+ if (alias == null || alias.length() == 0) {
+ aliasInput.setError(getResources().getText(R.string.keystore_no_alias_error));
+ } else {
+ /*
+ * It's not blank, so disable the generate button while
+ * the generation of the key is happening. It will be
+ * enabled by the {@code AsyncTask} later after its
+ * work is done.
+ */
+ aliasInput.setError(null);
+ mGenerateButton.setEnabled(false);
+ new GenerateTask().execute(alias);
+ }
+ }
+ });
+
+ mSignButton = (Button) findViewById(R.id.sign_button);
+ mSignButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ final String alias = mSelectedAlias;
+ final String data = mPlainText.getText().toString();
+ if (alias != null) {
+ setKeyActionButtonsEnabled(false);
+ new SignTask().execute(alias, data);
+ }
+ }
+ });
+
+ mVerifyButton = (Button) findViewById(R.id.verify_button);
+ mVerifyButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ final String alias = mSelectedAlias;
+ final String data = mPlainText.getText().toString();
+ final String signature = mCipherText.getText().toString();
+ if (alias != null) {
+ setKeyActionButtonsEnabled(false);
+ new VerifyTask().execute(alias, data, signature);
+ }
+ }
+ });
+
+ mDeleteButton = (Button) findViewById(R.id.delete_button);
+ mDeleteButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ final String alias = mSelectedAlias;
+ if (alias != null) {
+ setKeyActionButtonsEnabled(false);
+ new DeleteTask().execute(alias);
+ }
+ }
+ });
+
+ mPlainText = (EditText) findViewById(R.id.plaintext);
+ mPlainText.setOnFocusChangeListener(new OnFocusChangeListener() {
+ @Override
+ public void onFocusChange(View v, boolean hasFocus) {
+ mPlainText.setTextColor(getResources().getColor(android.R.color.primary_text_dark));
+ }
+ });
+
+ mCipherText = (EditText) findViewById(R.id.ciphertext);
+ mCipherText.setOnFocusChangeListener(new OnFocusChangeListener() {
+ @Override
+ public void onFocusChange(View v, boolean hasFocus) {
+ mCipherText
+ .setTextColor(getResources().getColor(android.R.color.primary_text_dark));
+ }
+ });
+
+ updateKeyList();
+ }
+
+ private class AliasAdapter extends ArrayAdapter<String> {
+ public AliasAdapter(Context context) {
+ // We want users to choose a key, so use the appropriate layout.
+ super(context, android.R.layout.simple_list_item_single_choice);
+ }
+
+ /**
+ * This clears out all previous aliases and replaces it with the
+ * current entries.
+ */
+ public void setAliases(List<String> items) {
+ clear();
+ addAll(items);
+ notifyDataSetChanged();
+ }
+ }
+
+ private void updateKeyList() {
+ setKeyActionButtonsEnabled(false);
+ new UpdateKeyListTask().execute();
+ }
+
+ /**
+ * Sets all the buttons related to actions that act on an existing key to
+ * enabled or disabled.
+ */
+ private void setKeyActionButtonsEnabled(boolean enabled) {
+ mSignButton.setEnabled(enabled);
+ mVerifyButton.setEnabled(enabled);
+ mDeleteButton.setEnabled(enabled);
+ }
+
+ private class UpdateKeyListTask extends AsyncTask<Void, Void, Enumeration<String>> {
+ @Override
+ protected Enumeration<String> doInBackground(Void... params) {
+ try {
+// BEGIN_INCLUDE(list)
+ /*
+ * Load the Android KeyStore instance using the the
+ * "AndroidKeyStore" provider to list out what entries are
+ * currently stored.
+ */
+ KeyStore ks = KeyStore.getInstance("AndroidKeyStore");
+ ks.load(null);
+ Enumeration<String> aliases = ks.aliases();
+// END_INCLUDE(list)
+ return aliases;
+ } catch (KeyStoreException e) {
+ Log.w(TAG, "Could not list keys", e);
+ return null;
+ } catch (NoSuchAlgorithmException e) {
+ Log.w(TAG, "Could not list keys", e);
+ return null;
+ } catch (CertificateException e) {
+ Log.w(TAG, "Could not list keys", e);
+ return null;
+ } catch (IOException e) {
+ Log.w(TAG, "Could not list keys", e);
+ return null;
+ }
+ }
+
+ @Override
+ protected void onPostExecute(Enumeration<String> result) {
+ List<String> aliases = new ArrayList<String>();
+ while (result.hasMoreElements()) {
+ aliases.add(result.nextElement());
+ }
+ mAdapter.setAliases(aliases);
+ }
+ }
+
+ private class GenerateTask extends AsyncTask<String, Void, Boolean> {
+ @Override
+ protected Boolean doInBackground(String... params) {
+ final String alias = params[0];
+ try {
+// BEGIN_INCLUDE(generate)
+ /*
+ * Generate a new entry in the KeyStore by using the
+ * KeyPairGenerator API. We have to specify the attributes for a
+ * self-signed X.509 certificate here so the KeyStore can attach
+ * the public key part to it. It can be replaced later with a
+ * certificate signed by a Certificate Authority (CA) if needed.
+ */
+ Calendar cal = Calendar.getInstance();
+ Date now = cal.getTime();
+ cal.add(Calendar.YEAR, 1);
+ Date end = cal.getTime();
+
+ KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", "AndroidKeyStore");
+ kpg.initialize(new KeyPairGeneratorSpec.Builder(getApplicationContext())
+ .setAlias(alias)
+ .setStartDate(now)
+ .setEndDate(end)
+ .setSerialNumber(BigInteger.valueOf(1))
+ .setSubject(new X500Principal("CN=test1"))
+ .build());
+
+ KeyPair kp = kpg.generateKeyPair();
+// END_INCLUDE(generate)
+ return true;
+ } catch (NoSuchAlgorithmException e) {
+ Log.w(TAG, "Could not generate key", e);
+ return false;
+ } catch (InvalidAlgorithmParameterException e) {
+ Log.w(TAG, "Could not generate key", e);
+ return false;
+ } catch (NoSuchProviderException e) {
+ Log.w(TAG, "Could not generate key", e);
+ return false;
+ }
+ }
+
+ @Override
+ protected void onPostExecute(Boolean result) {
+ updateKeyList();
+ mGenerateButton.setEnabled(true);
+ }
+
+ @Override
+ protected void onCancelled() {
+ mGenerateButton.setEnabled(true);
+ }
+ }
+
+ private class SignTask extends AsyncTask<String, Void, String> {
+ @Override
+ protected String doInBackground(String... params) {
+ final String alias = params[0];
+ final String dataString = params[1];
+ try {
+ byte[] data = dataString.getBytes();
+// BEGIN_INCLUDE(sign)
+ /*
+ * Use a PrivateKey in the KeyStore to create a signature over
+ * some data.
+ */
+ KeyStore ks = KeyStore.getInstance("AndroidKeyStore");
+ ks.load(null);
+ KeyStore.Entry entry = ks.getEntry(alias, null);
+ if (!(entry instanceof PrivateKeyEntry)) {
+ Log.w(TAG, "Not an instance of a PrivateKeyEntry");
+ return null;
+ }
+ Signature s = Signature.getInstance("SHA256withRSA");
+ s.initSign(((PrivateKeyEntry) entry).getPrivateKey());
+ s.update(data);
+ byte[] signature = s.sign();
+// END_INCLUDE(sign)
+ return Base64.encodeToString(signature, Base64.DEFAULT);
+ } catch (NoSuchAlgorithmException e) {
+ Log.w(TAG, "Could not generate key", e);
+ return null;
+ } catch (KeyStoreException e) {
+ Log.w(TAG, "Could not generate key", e);
+ return null;
+ } catch (CertificateException e) {
+ Log.w(TAG, "Could not generate key", e);
+ return null;
+ } catch (IOException e) {
+ Log.w(TAG, "Could not generate key", e);
+ return null;
+ } catch (UnrecoverableEntryException e) {
+ Log.w(TAG, "Could not generate key", e);
+ return null;
+ } catch (InvalidKeyException e) {
+ Log.w(TAG, "Could not generate key", e);
+ return null;
+ } catch (SignatureException e) {
+ Log.w(TAG, "Could not generate key", e);
+ return null;
+ }
+ }
+
+ @Override
+ protected void onPostExecute(String result) {
+ mCipherText.setText(result);
+ setKeyActionButtonsEnabled(true);
+ }
+
+ @Override
+ protected void onCancelled() {
+ mCipherText.setText("error!");
+ setKeyActionButtonsEnabled(true);
+ }
+ }
+
+ private class VerifyTask extends AsyncTask<String, Void, Boolean> {
+ @Override
+ protected Boolean doInBackground(String... params) {
+ final String alias = params[0];
+ final String dataString = params[1];
+ final String signatureString = params[2];
+ try {
+ byte[] data = dataString.getBytes();
+ byte[] signature;
+ try {
+ signature = Base64.decode(signatureString, Base64.DEFAULT);
+ } catch (IllegalArgumentException e) {
+ signature = new byte[0];
+ }
+// BEGIN_INCLUDE(verify)
+ /*
+ * Verify a signature previously made by a PrivateKey in our
+ * KeyStore. This uses the X.509 certificate attached to our
+ * private key in the KeyStore to validate a previously
+ * generated signature.
+ */
+ KeyStore ks = KeyStore.getInstance("AndroidKeyStore");
+ ks.load(null);
+ KeyStore.Entry entry = ks.getEntry(alias, null);
+ if (!(entry instanceof PrivateKeyEntry)) {
+ Log.w(TAG, "Not an instance of a PrivateKeyEntry");
+ return false;
+ }
+ Signature s = Signature.getInstance("SHA256withRSA");
+ s.initVerify(((PrivateKeyEntry) entry).getCertificate());
+ s.update(data);
+ boolean valid = s.verify(signature);
+// END_INCLUDE(verify)
+ return valid;
+ } catch (NoSuchAlgorithmException e) {
+ Log.w(TAG, "Could not generate key", e);
+ return false;
+ } catch (KeyStoreException e) {
+ Log.w(TAG, "Could not generate key", e);
+ return false;
+ } catch (CertificateException e) {
+ Log.w(TAG, "Could not generate key", e);
+ return false;
+ } catch (IOException e) {
+ Log.w(TAG, "Could not generate key", e);
+ return false;
+ } catch (UnrecoverableEntryException e) {
+ Log.w(TAG, "Could not generate key", e);
+ return false;
+ } catch (InvalidKeyException e) {
+ Log.w(TAG, "Could not generate key", e);
+ return false;
+ } catch (SignatureException e) {
+ Log.w(TAG, "Could not generate key", e);
+ return false;
+ }
+ }
+
+ @Override
+ protected void onPostExecute(Boolean result) {
+ if (result) {
+ mCipherText.setTextColor(getResources().getColor(R.color.solid_green));
+ } else {
+ mCipherText.setTextColor(getResources().getColor(R.color.solid_red));
+ }
+ setKeyActionButtonsEnabled(true);
+ }
+
+ @Override
+ protected void onCancelled() {
+ mCipherText.setText("error!");
+ setKeyActionButtonsEnabled(true);
+ mCipherText.setTextColor(getResources().getColor(android.R.color.primary_text_dark));
+ }
+ }
+
+ private class DeleteTask extends AsyncTask<String, Void, Void> {
+ @Override
+ protected Void doInBackground(String... params) {
+ final String alias = params[0];
+ try {
+// BEGIN_INCLUDE(delete)
+ /*
+ * Deletes a previously generated or stored entry in the
+ * KeyStore.
+ */
+ KeyStore ks = KeyStore.getInstance("AndroidKeyStore");
+ ks.load(null);
+ ks.deleteEntry(alias);
+// END_INCLUDE(delete)
+ } catch (NoSuchAlgorithmException e) {
+ Log.w(TAG, "Could not generate key", e);
+ } catch (KeyStoreException e) {
+ Log.w(TAG, "Could not generate key", e);
+ } catch (CertificateException e) {
+ Log.w(TAG, "Could not generate key", e);
+ } catch (IOException e) {
+ Log.w(TAG, "Could not generate key", e);
+ }
+ return null;
+ }
+
+ @Override
+ protected void onPostExecute(Void result) {
+ updateKeyList();
+ }
+
+ @Override
+ protected void onCancelled() {
+ updateKeyList();
+ }
+ }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/CustomLayout.java b/samples/ApiDemos/src/com/example/android/apis/view/CustomLayout.java
new file mode 100644
index 000000000..dfd886a60
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/view/CustomLayout.java
@@ -0,0 +1,245 @@
+/*
+ * Copyright (C) 2013 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.example.android.apis.view;
+
+// Need the following import to get access to the app resources, since this
+// class is in a sub-package.
+import android.graphics.Rect;
+import com.example.android.apis.R;
+
+//BEGIN_INCLUDE(Complete)
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.util.AttributeSet;
+import android.view.Gravity;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.RemoteViews;
+
+/**
+ * Example of writing a custom layout manager. This is a fairly full-featured
+ * layout manager that is relatively general, handling all layout cases. You
+ * can simplify it for more specific cases.
+ */
+@RemoteViews.RemoteView
+public class CustomLayout extends ViewGroup {
+ /** The amount of space used by children in the left gutter. */
+ private int mLeftWidth;
+
+ /** The amount of space used by children in the right gutter. */
+ private int mRightWidth;
+
+ /** These are used for computing child frames based on their gravity. */
+ private final Rect mTmpContainerRect = new Rect();
+ private final Rect mTmpChildRect = new Rect();
+
+ public CustomLayout(Context context) {
+ super(context);
+ }
+
+ public CustomLayout(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public CustomLayout(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ /**
+ * Any layout manager that doesn't scroll will want this.
+ */
+ @Override
+ public boolean shouldDelayChildPressedState() {
+ return false;
+ }
+
+ /**
+ * Ask all children to measure themselves and compute the measurement of this
+ * layout based on the children.
+ */
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ int count = getChildCount();
+
+ // These keep track of the space we are using on the left and right for
+ // views positioned there; we need member variables so we can also use
+ // these for layout later.
+ mLeftWidth = 0;
+ mRightWidth = 0;
+
+ // Measurement will ultimately be computing these values.
+ int maxHeight = 0;
+ int maxWidth = 0;
+ int childState = 0;
+
+ // Iterate through all children, measuring them and computing our dimensions
+ // from their size.
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
+ if (child.getVisibility() != GONE) {
+ // Measure the child.
+ measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0);
+
+ // Update our size information based on the layout params. Children
+ // that asked to be positioned on the left or right go in those gutters.
+ final LayoutParams lp = (LayoutParams) child.getLayoutParams();
+ if (lp.position == LayoutParams.POSITION_LEFT) {
+ mLeftWidth += Math.max(maxWidth,
+ child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin);
+ } else if (lp.position == LayoutParams.POSITION_RIGHT) {
+ mRightWidth += Math.max(maxWidth,
+ child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin);
+ } else {
+ maxWidth = Math.max(maxWidth,
+ child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin);
+ }
+ maxHeight = Math.max(maxHeight,
+ child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin);
+ childState = combineMeasuredStates(childState, child.getMeasuredState());
+ }
+ }
+
+ // Total width is the maximum width of all inner children plus the gutters.
+ maxWidth += mLeftWidth + mRightWidth;
+
+ // Check against our minimum height and width
+ maxHeight = Math.max(maxHeight, getSuggestedMinimumHeight());
+ maxWidth = Math.max(maxWidth, getSuggestedMinimumWidth());
+
+ // Report our final dimensions.
+ setMeasuredDimension(resolveSizeAndState(maxWidth, widthMeasureSpec, childState),
+ resolveSizeAndState(maxHeight, heightMeasureSpec,
+ childState << MEASURED_HEIGHT_STATE_SHIFT));
+ }
+
+ /**
+ * Position all children within this layout.
+ */
+ @Override
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ final int count = getChildCount();
+
+ // These are the far left and right edges in which we are performing layout.
+ int leftPos = getPaddingLeft();
+ int rightPos = right - left - getPaddingRight();
+
+ // This is the middle region inside of the gutter.
+ final int middleLeft = leftPos + mLeftWidth;
+ final int middleRight = rightPos - mRightWidth;
+
+ // These are the top and bottom edges in which we are performing layout.
+ final int parentTop = getPaddingTop();
+ final int parentBottom = bottom - top - getPaddingBottom();
+
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
+ if (child.getVisibility() != GONE) {
+ final LayoutParams lp = (LayoutParams) child.getLayoutParams();
+
+ final int width = child.getMeasuredWidth();
+ final int height = child.getMeasuredHeight();
+
+ // Compute the frame in which we are placing this child.
+ if (lp.position == LayoutParams.POSITION_LEFT) {
+ mTmpContainerRect.left = leftPos + lp.leftMargin;
+ mTmpContainerRect.right = leftPos + width + lp.rightMargin;
+ leftPos = mTmpContainerRect.right;
+ } else if (lp.position == LayoutParams.POSITION_RIGHT) {
+ mTmpContainerRect.right = rightPos - lp.rightMargin;
+ mTmpContainerRect.left = rightPos - width - lp.leftMargin;
+ rightPos = mTmpContainerRect.left;
+ } else {
+ mTmpContainerRect.left = middleLeft + lp.leftMargin;
+ mTmpContainerRect.right = middleRight - lp.rightMargin;
+ }
+ mTmpContainerRect.top = parentTop + lp.topMargin;
+ mTmpContainerRect.bottom = parentBottom - lp.bottomMargin;
+
+ // Use the child's gravity and size to determine its final
+ // frame within its container.
+ Gravity.apply(lp.gravity, width, height, mTmpContainerRect, mTmpChildRect);
+
+ // Place the child.
+ child.layout(mTmpChildRect.left, mTmpChildRect.top,
+ mTmpChildRect.right, mTmpChildRect.bottom);
+ }
+ }
+ }
+
+ // ----------------------------------------------------------------------
+ // The rest of the implementation is for custom per-child layout parameters.
+ // If you do not need these (for example you are writing a layout manager
+ // that does fixed positioning of its children), you can drop all of this.
+
+ @Override
+ public LayoutParams generateLayoutParams(AttributeSet attrs) {
+ return new CustomLayout.LayoutParams(getContext(), attrs);
+ }
+
+ @Override
+ protected LayoutParams generateDefaultLayoutParams() {
+ return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
+ }
+
+ @Override
+ protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) {
+ return new LayoutParams(p);
+ }
+
+ @Override
+ protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
+ return p instanceof LayoutParams;
+ }
+
+ /**
+ * Custom per-child layout information.
+ */
+ public static class LayoutParams extends MarginLayoutParams {
+ /**
+ * The gravity to apply with the View to which these layout parameters
+ * are associated.
+ */
+ public int gravity = Gravity.TOP | Gravity.START;
+
+ public static int POSITION_MIDDLE = 0;
+ public static int POSITION_LEFT = 1;
+ public static int POSITION_RIGHT = 2;
+
+ public int position = POSITION_MIDDLE;
+
+ public LayoutParams(Context c, AttributeSet attrs) {
+ super(c, attrs);
+
+ // Pull the layout param values from the layout XML during
+ // inflation. This is not needed if you don't care about
+ // changing the layout behavior in XML.
+ TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.CustomLayoutLP);
+ gravity = a.getInt(R.styleable.CustomLayoutLP_android_layout_gravity, gravity);
+ position = a.getInt(R.styleable.CustomLayoutLP_layout_position, position);
+ a.recycle();
+ }
+
+ public LayoutParams(int width, int height) {
+ super(width, height);
+ }
+
+ public LayoutParams(ViewGroup.LayoutParams source) {
+ super(source);
+ }
+ }
+}
+//END_INCLUDE(Complete)
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/CustomLayoutActivity.java b/samples/ApiDemos/src/com/example/android/apis/view/CustomLayoutActivity.java
new file mode 100644
index 000000000..171656933
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/view/CustomLayoutActivity.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2013 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.example.android.apis.view;
+
+// Need the following import to get access to the app resources, since this
+// class is in a sub-package.
+import com.example.android.apis.R;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class CustomLayoutActivity extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.custom_layout);
+ }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList1.java b/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList1.java
index bda366beb..ef8c03c66 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList1.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList1.java
@@ -118,7 +118,9 @@ public class ExpandableList1 extends ExpandableListActivity {
// Center the text vertically
textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
// Set the text starting position
- textView.setPadding(36, 0, 0, 0);
+ textView.setPaddingRelative(36, 0, 0, 0);
+ // Set the text alignment
+ textView.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
return textView;
}
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/GameControllerInput.java b/samples/ApiDemos/src/com/example/android/apis/view/GameControllerInput.java
index ce7c749df..10b2f9a72 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/GameControllerInput.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/GameControllerInput.java
@@ -142,7 +142,7 @@ public class GameControllerInput extends Activity
public boolean dispatchGenericMotionEvent(MotionEvent event) {
// Check that the event came from a joystick since a generic motion event
// could be almost anything.
- if (isJoystick(event.getSource())
+ if (event.isFromSource(InputDevice.SOURCE_CLASS_JOYSTICK)
&& event.getAction() == MotionEvent.ACTION_MOVE) {
// Update device state for visualization and logging.
InputDeviceState state = getInputDeviceState(event.getDeviceId());
@@ -195,10 +195,6 @@ public class GameControllerInput extends Activity
}
}
- private static boolean isJoystick(int source) {
- return (source & InputDevice.SOURCE_CLASS_JOYSTICK) != 0;
- }
-
/**
* Tracks the state of joystick axes and game controller buttons for a particular
* input device for diagnostic purposes.
@@ -215,7 +211,7 @@ public class GameControllerInput extends Activity
int numAxes = 0;
final List<MotionRange> ranges = device.getMotionRanges();
for (MotionRange range : ranges) {
- if ((range.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
+ if (range.isFromSource(InputDevice.SOURCE_CLASS_JOYSTICK)) {
numAxes += 1;
}
}
@@ -224,7 +220,7 @@ public class GameControllerInput extends Activity
mAxisValues = new float[numAxes];
int i = 0;
for (MotionRange range : ranges) {
- if ((range.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
+ if (range.isFromSource(InputDevice.SOURCE_CLASS_JOYSTICK)) {
mAxes[i++] = range.getAxis();
}
}
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/GameView.java b/samples/ApiDemos/src/com/example/android/apis/view/GameView.java
index 2904147ef..d7f039bdd 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/GameView.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/GameView.java
@@ -209,7 +209,7 @@ public class GameView extends View {
// Check that the event came from a joystick since a generic motion event
// could be almost anything.
- if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0
+ if (event.isFromSource(InputDevice.SOURCE_CLASS_JOYSTICK)
&& event.getAction() == MotionEvent.ACTION_MOVE) {
// Cache the most recently obtained device information.
// The device information may change over time but it can be
@@ -771,4 +771,4 @@ public class GameView extends View {
return 0.25f;
}
}
-} \ No newline at end of file
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/OverscanActivity.java b/samples/ApiDemos/src/com/example/android/apis/view/SystemUIModes.java
index 309799270..730534a90 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/OverscanActivity.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/SystemUIModes.java
@@ -27,12 +27,10 @@ import android.os.Bundle;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.ActionMode;
-import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
-import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.CheckBox;
@@ -51,10 +49,10 @@ import com.example.android.apis.R;
* the system decor, in order to better focus the user's attention or use available screen real
* estate on the task at hand.
*/
-public class OverscanActivity extends Activity
+public class SystemUIModes extends Activity
implements OnQueryTextListener, ActionBar.TabListener {
public static class IV extends ImageView implements View.OnSystemUiVisibilityChangeListener {
- private OverscanActivity mActivity;
+ private SystemUIModes mActivity;
private ActionMode mActionMode;
public IV(Context context) {
super(context);
@@ -62,7 +60,7 @@ public class OverscanActivity extends Activity
public IV(Context context, AttributeSet attrs) {
super(context, attrs);
}
- public void setActivity(OverscanActivity act) {
+ public void setActivity(SystemUIModes act) {
setOnSystemUiVisibilityChangeListener(this);
mActivity = act;
}
@@ -126,6 +124,18 @@ public class OverscanActivity extends Activity
win.setAttributes(winParams);
}
+ private void setOverscan(boolean on) {
+ Window win = getWindow();
+ WindowManager.LayoutParams winParams = win.getAttributes();
+ final int bits = WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN;
+ if (on) {
+ winParams.flags |= bits;
+ } else {
+ winParams.flags &= ~bits;
+ }
+ win.setAttributes(winParams);
+ }
+
private String getDisplaySize() {
DisplayMetrics dm = getResources().getDisplayMetrics();
return String.format("DisplayMetrics = (%d x %d)", dm.widthPixels, dm.heightPixels);
@@ -149,16 +159,14 @@ public class OverscanActivity extends Activity
};
TextView mMetricsText;
- public OverscanActivity() {
+ public SystemUIModes() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
-
- setContentView(R.layout.overscan);
+ setContentView(R.layout.system_ui_modes);
mImage = (IV) findViewById(R.id.image);
mImage.setActivity(this);
@@ -185,6 +193,14 @@ public class OverscanActivity extends Activity
}
}
);
+ ((CheckBox) findViewById(R.id.windowOverscan)).setOnCheckedChangeListener(
+ new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ setOverscan(isChecked);
+ }
+ }
+ );
((CheckBox) findViewById(R.id.windowHideActionBar)).setOnCheckedChangeListener(
new CompoundButton.OnCheckedChangeListener() {
@Override
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/SystemUIModesOverlay.java b/samples/ApiDemos/src/com/example/android/apis/view/SystemUIModesOverlay.java
new file mode 100644
index 000000000..73eadb1dd
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/view/SystemUIModesOverlay.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2013 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.example.android.apis.view;
+
+import android.os.Bundle;
+import android.view.Window;
+
+/**
+ * Version of demo that uses the action bar in overlay mode.
+ */
+public class SystemUIModesOverlay extends SystemUIModes {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
+ super.onCreate(savedInstanceState);
+ }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/VideoPlayerActivity.java b/samples/ApiDemos/src/com/example/android/apis/view/VideoPlayerActivity.java
index e5333d705..3bee59460 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/VideoPlayerActivity.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/VideoPlayerActivity.java
@@ -167,7 +167,7 @@ public class VideoPlayerActivity extends Activity
h.removeCallbacks(mNavHider);
if (!mMenusOpen && !mPaused) {
// If the menus are open or play is paused, we will not auto-hide.
- h.postDelayed(mNavHider, 1500);
+ h.postDelayed(mNavHider, 3000);
}
}
}
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/WindowFocusObserver.java b/samples/ApiDemos/src/com/example/android/apis/view/WindowFocusObserver.java
new file mode 100644
index 000000000..83c47288a
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/view/WindowFocusObserver.java
@@ -0,0 +1,106 @@
+/*
+ * 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.example.android.apis.view;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.WindowId;
+import android.view.WindowId.FocusObserver;
+import android.widget.SearchView;
+import android.widget.ShareActionProvider;
+import android.widget.TextView;
+import android.widget.Toast;
+import com.example.android.apis.R;
+
+public class WindowFocusObserver extends Activity implements SearchView.OnQueryTextListener {
+ TextView mState;
+
+ final FocusObserver mObserver = new WindowId.FocusObserver() {
+
+ @Override
+ public void onFocusGained(WindowId token) {
+ mState.setText("Gained focus");
+ }
+
+ @Override
+ public void onFocusLost(WindowId token) {
+ mState.setText("Lost focus");
+ }
+ };
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.window_focus_observer);
+ mState = (TextView)findViewById(R.id.focus_state);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.content_actions, menu);
+ SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
+ searchView.setOnQueryTextListener(this);
+
+ // Set file with share history to the provider and set the share intent.
+ MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar);
+ ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider();
+ actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
+ // Note that you can set/change the intent any time,
+ // say when the user has selected an image.
+ Intent shareIntent = new Intent(Intent.ACTION_SEND);
+ shareIntent.setType("image/*");
+ Uri uri = Uri.fromFile(getFileStreamPath("shared.png"));
+ shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
+ actionProvider.setShareIntent(shareIntent);
+ return true;
+ }
+
+ public void onSort(MenuItem item) {
+ }
+
+ @Override
+ public boolean onQueryTextChange(String newText) {
+ return true;
+ }
+
+ @Override
+ public boolean onQueryTextSubmit(String query) {
+ Toast.makeText(this, "Searching for: " + query + "...", Toast.LENGTH_SHORT).show();
+ return true;
+ }
+
+ @Override
+ public void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ WindowId token = getWindow().getDecorView().getWindowId();
+ token.registerFocusObserver(mObserver);
+ mState.setText(token.isFocused() ? "Focused" : "Not focused");
+ }
+
+ @Override
+ public void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ getWindow().getDecorView().getWindowId().unregisterFocusObserver(mObserver);
+ }
+}
diff --git a/samples/AppLimits/Android.mk b/samples/AppLimits/Android.mk
new file mode 100644
index 000000000..27252761a
--- /dev/null
+++ b/samples/AppLimits/Android.mk
@@ -0,0 +1,17 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := samples tests
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := AppLimits
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
+
+LOCAL_PROGUARD_FLAG_FILES := proguard.flags
+
+# Use the following include to make our test apk.
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/samples/AppLimits/AndroidManifest.xml b/samples/AppLimits/AndroidManifest.xml
new file mode 100644
index 000000000..8133fe9b3
--- /dev/null
+++ b/samples/AppLimits/AndroidManifest.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<manifest android:versionCode="1"
+ android:versionName="1"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.applimits">
+
+ <application android:label="@string/app_name"
+ android:requiredForAllUsers="true">
+
+ <activity android:name="CustomRestrictionsActivity"
+ android:exported="true"
+ android:label="@string/restrictions_activity_label">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ <receiver android:name="GetRestrictionsReceiver"
+ android:exported="true">
+ <intent-filter>
+ <action android:name="android.intent.action.GET_RESTRICTION_ENTRIES" />
+ </intent-filter>
+ </receiver>
+
+ </application>
+</manifest>
diff --git a/samples/AppLimits/res/values/strings.xml b/samples/AppLimits/res/values/strings.xml
new file mode 100644
index 000000000..d5b7721ba
--- /dev/null
+++ b/samples/AppLimits/res/values/strings.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="app_name">AppLimits Demo</string>
+ <string name="restrictions_activity_label">Custom app restrictions</string>
+ <string name="app_limits_main_label">App Limits</string>
+ <string name="custom_or_not_title">Test Custom Restrictions</string>
+ <string name="choice_entry_title">Test choice type</string>
+ <string name="multi_entry_title">Test multi-select type</string>
+
+ <string-array name="multi_entry_entries">
+ <item>Ice Cream</item>
+ <item>Jelly Bean</item>
+ <item>More Jelly Bean</item>
+ </string-array>
+
+ <string-array name="multi_entry_values" translateable="false">
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ </string-array>
+
+ <string-array name="choice_entry_entries">
+ <item>Ice Cream</item>
+ <item>Jelly Bean</item>
+ <item>More Jelly Bean</item>
+ </string-array>
+
+ <string-array name="choice_entry_values" translateable="false">
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ </string-array>
+
+</resources> \ No newline at end of file
diff --git a/samples/AppLimits/res/xml/custom_prefs.xml b/samples/AppLimits/res/xml/custom_prefs.xml
new file mode 100644
index 000000000..2b4512582
--- /dev/null
+++ b/samples/AppLimits/res/xml/custom_prefs.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ android:title="@string/restrictions_activity_label">
+
+ <CheckBoxPreference android:key="custom"
+ android:title="@string/custom_or_not_title" />
+
+ <ListPreference android:key="choice"
+ android:title="@string/choice_entry_title"
+ android:entries="@array/choice_entry_entries"
+ android:entryValues="@array/choice_entry_values" />
+
+ <MultiSelectListPreference android:key="multi"
+ android:title="@string/multi_entry_title"
+ android:entries="@array/multi_entry_entries"
+ android:entryValues="@array/multi_entry_values" />
+
+</PreferenceScreen>
diff --git a/samples/AppLimits/src/com/example/android/applimits/CustomRestrictionsActivity.java b/samples/AppLimits/src/com/example/android/applimits/CustomRestrictionsActivity.java
new file mode 100644
index 000000000..963aa2171
--- /dev/null
+++ b/samples/AppLimits/src/com/example/android/applimits/CustomRestrictionsActivity.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright (C) 2013 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.example.android.applimits;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.RestrictionEntry;
+import android.os.Bundle;
+import android.os.UserManager;
+import android.preference.CheckBoxPreference;
+import android.preference.ListPreference;
+import android.preference.MultiSelectListPreference;
+import android.preference.Preference;
+import android.preference.Preference.OnPreferenceChangeListener;
+import android.preference.PreferenceActivity;
+
+import com.example.android.applimits.GetRestrictionsReceiver;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class CustomRestrictionsActivity extends PreferenceActivity
+ implements OnPreferenceChangeListener {
+
+ private static final String KEY_CUSTOM_PREF = "custom";
+ private static final String KEY_CHOICE_PREF = "choice";
+ private static final String KEY_MULTI_PREF = "multi";
+
+ List<RestrictionEntry> mRestrictions;
+ private Bundle mRestrictionsBundle;
+
+ CheckBoxPreference mCustomPref;
+ ListPreference mChoicePref;
+ MultiSelectListPreference mMultiPref;
+
+ RestrictionEntry mCustomEntry;
+ RestrictionEntry mChoiceEntry;
+ RestrictionEntry mMultiEntry;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ mRestrictionsBundle = getIntent().getBundleExtra(Intent.EXTRA_RESTRICTIONS_BUNDLE);
+ if (mRestrictionsBundle == null) {
+ mRestrictionsBundle =
+ ((UserManager) getSystemService(Context.USER_SERVICE))
+ .getApplicationRestrictions(getPackageName());
+ }
+ if (mRestrictionsBundle == null) {
+ mRestrictionsBundle = new Bundle();
+ }
+
+ if (savedInstanceState != null
+ && savedInstanceState.containsKey(Intent.EXTRA_RESTRICTIONS_LIST)) {
+ mRestrictions = savedInstanceState.getParcelableArrayList(
+ Intent.EXTRA_RESTRICTIONS_LIST);
+ }
+
+ this.addPreferencesFromResource(R.xml.custom_prefs);
+ mCustomPref = (CheckBoxPreference) findPreference(KEY_CUSTOM_PREF);
+ mChoicePref = (ListPreference) findPreference(KEY_CHOICE_PREF);
+ mMultiPref = (MultiSelectListPreference) findPreference(KEY_MULTI_PREF);
+
+ // Transfer the saved values into the preference hierarchy
+ if (mRestrictions != null) {
+ for (RestrictionEntry entry : mRestrictions) {
+ if (entry.getKey().equals(GetRestrictionsReceiver.KEY_CUSTOM)) {
+ mCustomPref.setChecked(entry.getSelectedState());
+ mCustomEntry = entry;
+ } else if (entry.getKey().equals(GetRestrictionsReceiver.KEY_CHOICE)) {
+ mChoicePref.setValue(entry.getSelectedString());
+ mChoiceEntry = entry;
+ } else if (entry.getKey().equals(GetRestrictionsReceiver.KEY_MULTI_SELECT)) {
+ HashSet<String> set = new HashSet<String>();
+ for (String value : entry.getAllSelectedStrings()) {
+ set.add(value);
+ }
+ mMultiPref.setValues(set);
+ mMultiEntry = entry;
+ }
+ }
+ } else {
+ mRestrictions = new ArrayList<RestrictionEntry>();
+ mCustomEntry = new RestrictionEntry(GetRestrictionsReceiver.KEY_CUSTOM,
+ mRestrictionsBundle.getBoolean(GetRestrictionsReceiver.KEY_CUSTOM, false));
+ mCustomEntry.setType(RestrictionEntry.TYPE_BOOLEAN);
+ mCustomPref.setChecked(mCustomEntry.getSelectedState());
+ mChoiceEntry = new RestrictionEntry(GetRestrictionsReceiver.KEY_CHOICE,
+ mRestrictionsBundle.getString(GetRestrictionsReceiver.KEY_CHOICE));
+ mChoiceEntry.setType(RestrictionEntry.TYPE_CHOICE);
+ mChoicePref.setValue(mChoiceEntry.getSelectedString());
+ mMultiEntry = new RestrictionEntry(GetRestrictionsReceiver.KEY_MULTI_SELECT,
+ mRestrictionsBundle.getStringArray(GetRestrictionsReceiver.KEY_MULTI_SELECT));
+ mMultiEntry.setType(RestrictionEntry.TYPE_MULTI_SELECT);
+ if (mMultiEntry.getAllSelectedStrings() != null) {
+ HashSet<String> set = new HashSet<String>();
+ for (String value : mRestrictionsBundle.getStringArray(
+ GetRestrictionsReceiver.KEY_MULTI_SELECT)) {
+ set.add(value);
+ }
+ mMultiPref.setValues(set);
+ }
+ mRestrictions.add(mCustomEntry);
+ mRestrictions.add(mChoiceEntry);
+ mRestrictions.add(mMultiEntry);
+ }
+ mCustomPref.setOnPreferenceChangeListener(this);
+ mChoicePref.setOnPreferenceChangeListener(this);
+ mMultiPref.setOnPreferenceChangeListener(this);
+ Intent intent = new Intent(getIntent());
+ intent.putParcelableArrayListExtra(Intent.EXTRA_RESTRICTIONS_LIST,
+ new ArrayList<RestrictionEntry>(mRestrictions));
+ setResult(RESULT_OK, intent);
+ }
+
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putParcelableArrayList(Intent.EXTRA_RESTRICTIONS_LIST,
+ new ArrayList<RestrictionEntry>(mRestrictions));
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ if (preference == mCustomPref) {
+ mCustomEntry.setSelectedState((Boolean) newValue);
+ } else if (preference == mChoicePref) {
+ mChoiceEntry.setSelectedString((String) newValue);
+ } else if (preference == mMultiPref) {
+ String[] selectedStrings = new String[((Set<String>)newValue).size()];
+ int i = 0;
+ for (String value : (Set<String>) newValue) {
+ selectedStrings[i++] = value;
+ }
+ mMultiEntry.setAllSelectedStrings(selectedStrings);
+ }
+ Intent intent = new Intent(getIntent());
+ intent.putParcelableArrayListExtra(Intent.EXTRA_RESTRICTIONS_LIST,
+ new ArrayList<RestrictionEntry>(mRestrictions));
+ setResult(RESULT_OK, intent);
+ return true;
+ }
+}
diff --git a/samples/AppLimits/src/com/example/android/applimits/GetRestrictionsReceiver.java b/samples/AppLimits/src/com/example/android/applimits/GetRestrictionsReceiver.java
new file mode 100644
index 000000000..0249911e3
--- /dev/null
+++ b/samples/AppLimits/src/com/example/android/applimits/GetRestrictionsReceiver.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2013 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.example.android.applimits;
+
+import android.app.Activity;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.RestrictionEntry;
+import android.content.BroadcastReceiver.PendingResult;
+import android.content.res.Resources;
+import android.os.Bundle;
+import android.util.Log;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class GetRestrictionsReceiver extends BroadcastReceiver {
+ private static final String TAG = "AppLimits$GetRestrictionsReceiver";
+
+ static final String KEY_CUSTOM = "custom_or_not";
+ static final String KEY_CHOICE = "choice";
+ static final String KEY_MULTI_SELECT = "multi";
+
+ @Override
+ public void onReceive(final Context context, Intent intent) {
+ final PendingResult result = goAsync();
+ final Bundle oldRestrictions =
+ intent.getBundleExtra(Intent.EXTRA_RESTRICTIONS_BUNDLE);
+ Log.i(TAG, "oldRestrictions = " + oldRestrictions);
+ new Thread() {
+ public void run() {
+ createRestrictions(context, result, oldRestrictions);
+ }
+ }.start();
+ }
+
+ public static void populateCustomEntry(Resources res, RestrictionEntry entry) {
+ entry.setType(RestrictionEntry.TYPE_BOOLEAN);
+ entry.setTitle(res.getString(R.string.custom_or_not_title));
+ }
+
+ public static void populateChoiceEntry(Resources res, RestrictionEntry reSingleChoice) {
+ String[] choiceEntries = res.getStringArray(R.array.choice_entry_entries);
+ String[] choiceValues = res.getStringArray(R.array.choice_entry_values);
+ if (reSingleChoice.getSelectedString() == null) {
+ reSingleChoice.setSelectedString(choiceValues[0]);
+ }
+ reSingleChoice.setTitle(res.getString(R.string.choice_entry_title));
+ reSingleChoice.setChoiceEntries(choiceEntries);
+ reSingleChoice.setChoiceValues(choiceValues);
+ reSingleChoice.setType(RestrictionEntry.TYPE_CHOICE);
+ }
+
+ public static void populateMultiEntry(Resources res, RestrictionEntry reMultiSelect) {
+ String[] multiEntries = res.getStringArray(R.array.multi_entry_entries);
+ String[] multiValues = res.getStringArray(R.array.multi_entry_values);
+ if (reMultiSelect.getAllSelectedStrings() == null) {
+ reMultiSelect.setAllSelectedStrings(new String[0]);
+ }
+ reMultiSelect.setTitle(res.getString(R.string.multi_entry_title));
+ reMultiSelect.setChoiceEntries(multiEntries);
+ reMultiSelect.setChoiceValues(multiValues);
+ reMultiSelect.setType(RestrictionEntry.TYPE_MULTI_SELECT);
+ }
+
+ private ArrayList<RestrictionEntry> initRestrictions(Context context) {
+ ArrayList<RestrictionEntry> newRestrictions = new ArrayList<RestrictionEntry>();
+ Resources res = context.getResources();
+
+ RestrictionEntry reCustomOrNot = new RestrictionEntry(KEY_CUSTOM, false);
+ populateCustomEntry(res, reCustomOrNot);
+ newRestrictions.add(reCustomOrNot);
+
+ RestrictionEntry reSingleChoice = new RestrictionEntry(KEY_CHOICE, (String) null);
+ populateChoiceEntry(res, reSingleChoice);
+ newRestrictions.add(reSingleChoice);
+
+ RestrictionEntry reMultiSelect = new RestrictionEntry(KEY_MULTI_SELECT, (String[]) null);
+ populateMultiEntry(res, reMultiSelect);
+ newRestrictions.add(reMultiSelect);
+
+ return newRestrictions;
+ }
+
+ private void createRestrictions(Context context, PendingResult result, Bundle old) {
+ Resources res = context.getResources();
+
+ ArrayList<RestrictionEntry> newEntries = initRestrictions(context);
+ // If this is the first time, create the default restrictions entries and return them.
+ if (old == null) {
+ Bundle extras = new Bundle();
+ extras.putParcelableArrayList(Intent.EXTRA_RESTRICTIONS_LIST, newEntries);
+ result.setResult(Activity.RESULT_OK, null, extras);
+ result.finish();
+ return;
+ }
+
+ boolean custom = old.getBoolean(KEY_CUSTOM, false);
+ for (RestrictionEntry entry : newEntries) {
+ final String key = entry.getKey();
+ if (KEY_CUSTOM.equals(key)) {
+ entry.setSelectedState(custom);
+ } else if (KEY_CHOICE.equals(key)) {
+ if (old.containsKey(KEY_CHOICE)) {
+ entry.setSelectedString(old.getString(KEY_CHOICE));
+ }
+ } else if (KEY_MULTI_SELECT.equals(key)) {
+ if (old.containsKey(KEY_MULTI_SELECT)) {
+ entry.setAllSelectedStrings(old.getStringArray(key));
+ }
+ }
+ }
+
+ Bundle extras = new Bundle();
+ if (custom) {
+ Intent customIntent = new Intent();
+ customIntent.setClass(context, CustomRestrictionsActivity.class);
+ extras.putParcelable(Intent.EXTRA_RESTRICTIONS_INTENT, customIntent);
+ }
+ extras.putParcelableArrayList(Intent.EXTRA_RESTRICTIONS_LIST, newEntries);
+ result.setResult(Activity.RESULT_OK, null, extras);
+ result.finish();
+ }
+}
diff --git a/samples/BluetoothLeGatt/Android.mk b/samples/BluetoothLeGatt/Android.mk
new file mode 100644
index 000000000..1e30b2242
--- /dev/null
+++ b/samples/BluetoothLeGatt/Android.mk
@@ -0,0 +1,16 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := samples
+
+# Only compile source java files in this apk.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := BluetoothLeGatt
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
+
+# Use the following include to make our test apk.
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/samples/BluetoothLeGatt/AndroidManifest.xml b/samples/BluetoothLeGatt/AndroidManifest.xml
new file mode 100644
index 000000000..019d2587d
--- /dev/null
+++ b/samples/BluetoothLeGatt/AndroidManifest.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2013 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.bluetooth.le"
+ android:versionCode="1"
+ android:versionName="1.0">
+ <uses-sdk android:minSdkVersion="18"
+ android:targetSdkVersion="18"/>
+ <!-- Declare this required feature if you want to make the app available to BLE-capable
+ devices only. If you want to make your app available to devices that don't support BLE,
+ you should omit this in the manifest. Instead, determine BLE capability by using
+ PackageManager.hasSystemFeature(FEATURE_BLUETOOTH_LE) -->
+ <uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
+
+ <uses-permission android:name="android.permission.BLUETOOTH"/>
+ <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
+
+ <application android:label="@string/app_name"
+ android:icon="@drawable/ic_launcher"
+ android:theme="@android:style/Theme.Holo.Light">
+ <activity android:name=".DeviceScanActivity"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity>
+ <activity android:name=".DeviceControlActivity"/>
+ <service android:name=".BluetoothLeService" android:enabled="true"/>
+ </application>
+</manifest>
diff --git a/samples/BluetoothLeGatt/res/drawable-hdpi/ic_launcher.png b/samples/BluetoothLeGatt/res/drawable-hdpi/ic_launcher.png
new file mode 100755
index 000000000..15367c050
--- /dev/null
+++ b/samples/BluetoothLeGatt/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/BluetoothLeGatt/res/drawable-mdpi/ic_launcher.png b/samples/BluetoothLeGatt/res/drawable-mdpi/ic_launcher.png
new file mode 100755
index 000000000..ba810a766
--- /dev/null
+++ b/samples/BluetoothLeGatt/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/BluetoothLeGatt/res/drawable-xhdpi/ic_launcher.png b/samples/BluetoothLeGatt/res/drawable-xhdpi/ic_launcher.png
new file mode 100755
index 000000000..14f1d7467
--- /dev/null
+++ b/samples/BluetoothLeGatt/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/BluetoothLeGatt/res/drawable-xxhdpi/ic_launcher.png b/samples/BluetoothLeGatt/res/drawable-xxhdpi/ic_launcher.png
new file mode 100755
index 000000000..81ff9cc8b
--- /dev/null
+++ b/samples/BluetoothLeGatt/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/BluetoothLeGatt/res/layout/actionbar_indeterminate_progress.xml b/samples/BluetoothLeGatt/res/layout/actionbar_indeterminate_progress.xml
new file mode 100644
index 000000000..a950833f8
--- /dev/null
+++ b/samples/BluetoothLeGatt/res/layout/actionbar_indeterminate_progress.xml
@@ -0,0 +1,23 @@
+<!--
+ Copyright 2013 Google Inc.
+
+ 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.
+ -->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_height="wrap_content"
+ android:layout_width="56dp"
+ android:minWidth="56dp">
+ <ProgressBar android:layout_width="32dp"
+ android:layout_height="32dp"
+ android:layout_gravity="center"/>
+</FrameLayout>
diff --git a/samples/BluetoothLeGatt/res/layout/gatt_services_characteristics.xml b/samples/BluetoothLeGatt/res/layout/gatt_services_characteristics.xml
new file mode 100644
index 000000000..2f3106103
--- /dev/null
+++ b/samples/BluetoothLeGatt/res/layout/gatt_services_characteristics.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dp">
+ <LinearLayout android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dp">
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/label_device_address"
+ android:textSize="18sp"/>
+ <Space android:layout_width="5dp"
+ android:layout_height="wrap_content"/>
+ <TextView android:id="@+id/device_address"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="18sp"/>
+ </LinearLayout>
+ <LinearLayout android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dp">
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/label_state"
+ android:textSize="18sp"/>
+ <Space android:layout_width="5dp"
+ android:layout_height="wrap_content"/>
+ <TextView android:id="@+id/connection_state"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/disconnected"
+ android:textSize="18sp"/>
+ </LinearLayout>
+ <LinearLayout android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dp">
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/label_data"
+ android:textSize="18sp"/>
+ <Space android:layout_width="5dp"
+ android:layout_height="wrap_content"/>
+ <TextView android:id="@+id/data_value"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/no_data"
+ android:textSize="18sp"/>
+ </LinearLayout>
+ <ExpandableListView android:id="@+id/gatt_services_list"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"/>
+</LinearLayout> \ No newline at end of file
diff --git a/samples/BluetoothLeGatt/res/layout/listitem_device.xml b/samples/BluetoothLeGatt/res/layout/listitem_device.xml
new file mode 100644
index 000000000..eff44fcdd
--- /dev/null
+++ b/samples/BluetoothLeGatt/res/layout/listitem_device.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <TextView android:id="@+id/device_name"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="24dp"/>
+ <TextView android:id="@+id/device_address"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="12dp"/>
+</LinearLayout> \ No newline at end of file
diff --git a/samples/BluetoothLeGatt/res/menu/gatt_services.xml b/samples/BluetoothLeGatt/res/menu/gatt_services.xml
new file mode 100644
index 000000000..464d32ff7
--- /dev/null
+++ b/samples/BluetoothLeGatt/res/menu/gatt_services.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/menu_refresh"
+ android:checkable="false"
+ android:orderInCategory="1"
+ android:showAsAction="ifRoom"/>
+ <item android:id="@+id/menu_connect"
+ android:title="@string/menu_connect"
+ android:orderInCategory="100"
+ android:showAsAction="ifRoom|withText"/>
+ <item android:id="@+id/menu_disconnect"
+ android:title="@string/menu_disconnect"
+ android:orderInCategory="101"
+ android:showAsAction="ifRoom|withText"/>
+</menu>
diff --git a/samples/BluetoothLeGatt/res/menu/main.xml b/samples/BluetoothLeGatt/res/menu/main.xml
new file mode 100644
index 000000000..39dd66aa4
--- /dev/null
+++ b/samples/BluetoothLeGatt/res/menu/main.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/menu_refresh"
+ android:checkable="false"
+ android:orderInCategory="1"
+ android:showAsAction="ifRoom"/>
+ <item android:id="@+id/menu_scan"
+ android:title="@string/menu_scan"
+ android:orderInCategory="100"
+ android:showAsAction="ifRoom|withText"/>
+ <item android:id="@+id/menu_stop"
+ android:title="@string/menu_stop"
+ android:orderInCategory="101"
+ android:showAsAction="ifRoom|withText"/>
+</menu>
diff --git a/samples/BluetoothLeGatt/res/values/strings.xml b/samples/BluetoothLeGatt/res/values/strings.xml
new file mode 100644
index 000000000..d828aa018
--- /dev/null
+++ b/samples/BluetoothLeGatt/res/values/strings.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+ <string name="app_name">BLE Sample</string>
+ <string name="ble_not_supported">BLE is not supported</string>
+ <string name="label_data">Data:</string>
+ <string name="label_device_address">Device address:</string>
+ <string name="label_state">State:</string>
+ <string name="no_data">No data</string>
+ <string name="connected">Connected</string>
+ <string name="disconnected">Disconnected</string>
+ <string name="title_devices">BLE Device Scan</string>
+ <string name="error_bluetooth_not_supported">Bluetooth not supported.</string>
+
+ <string name="unknown_device">Unknown device</string>
+ <string name="unknown_characteristic">Unknown characteristic</string>
+ <string name="unknown_service">Unknown service</string>
+
+ <!-- Menu items -->
+ <string name="menu_connect">Connect</string>
+ <string name="menu_disconnect">Disconnect</string>
+ <string name="menu_scan">Scan</string>
+ <string name="menu_stop">Stop</string>
+</resources>
diff --git a/samples/BluetoothLeGatt/src/com/example/bluetooth/le/BluetoothLeService.java b/samples/BluetoothLeGatt/src/com/example/bluetooth/le/BluetoothLeService.java
new file mode 100644
index 000000000..9e7aabd83
--- /dev/null
+++ b/samples/BluetoothLeGatt/src/com/example/bluetooth/le/BluetoothLeService.java
@@ -0,0 +1,319 @@
+/*
+ * Copyright (C) 2013 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.example.bluetooth.le;
+
+import android.app.Service;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothGatt;
+import android.bluetooth.BluetoothGattCallback;
+import android.bluetooth.BluetoothGattCharacteristic;
+import android.bluetooth.BluetoothGattDescriptor;
+import android.bluetooth.BluetoothGattService;
+import android.bluetooth.BluetoothManager;
+import android.bluetooth.BluetoothProfile;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Binder;
+import android.os.IBinder;
+import android.util.Log;
+
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * Service for managing connection and data communication with a GATT server hosted on a
+ * given Bluetooth LE device.
+ */
+public class BluetoothLeService extends Service {
+ private final static String TAG = BluetoothLeService.class.getSimpleName();
+
+ private BluetoothManager mBluetoothManager;
+ private BluetoothAdapter mBluetoothAdapter;
+ private String mBluetoothDeviceAddress;
+ private BluetoothGatt mBluetoothGatt;
+ private int mConnectionState = STATE_DISCONNECTED;
+
+ private static final int STATE_DISCONNECTED = 0;
+ private static final int STATE_CONNECTING = 1;
+ private static final int STATE_CONNECTED = 2;
+
+ public final static String ACTION_GATT_CONNECTED =
+ "com.example.bluetooth.le.ACTION_GATT_CONNECTED";
+ public final static String ACTION_GATT_DISCONNECTED =
+ "com.example.bluetooth.le.ACTION_GATT_DISCONNECTED";
+ public final static String ACTION_GATT_SERVICES_DISCOVERED =
+ "com.example.bluetooth.le.ACTION_GATT_SERVICES_DISCOVERED";
+ public final static String ACTION_DATA_AVAILABLE =
+ "com.example.bluetooth.le.ACTION_DATA_AVAILABLE";
+ public final static String EXTRA_DATA =
+ "com.example.bluetooth.le.EXTRA_DATA";
+
+ public final static UUID UUID_HEART_RATE_MEASUREMENT =
+ UUID.fromString(SampleGattAttributes.HEART_RATE_MEASUREMENT);
+
+ // Implements callback methods for GATT events that the app cares about. For example,
+ // connection change and services discovered.
+ private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
+ @Override
+ public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
+ String intentAction;
+ if (newState == BluetoothProfile.STATE_CONNECTED) {
+ intentAction = ACTION_GATT_CONNECTED;
+ mConnectionState = STATE_CONNECTED;
+ broadcastUpdate(intentAction);
+ Log.i(TAG, "Connected to GATT server.");
+ // Attempts to discover services after successful connection.
+ Log.i(TAG, "Attempting to start service discovery:" +
+ mBluetoothGatt.discoverServices());
+
+ } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
+ intentAction = ACTION_GATT_DISCONNECTED;
+ mConnectionState = STATE_DISCONNECTED;
+ Log.i(TAG, "Disconnected from GATT server.");
+ broadcastUpdate(intentAction);
+ }
+ }
+
+ @Override
+ public void onServicesDiscovered(BluetoothGatt gatt, int status) {
+ if (status == BluetoothGatt.GATT_SUCCESS) {
+ broadcastUpdate(ACTION_GATT_SERVICES_DISCOVERED);
+ } else {
+ Log.w(TAG, "onServicesDiscovered received: " + status);
+ }
+ }
+
+ @Override
+ public void onCharacteristicRead(BluetoothGatt gatt,
+ BluetoothGattCharacteristic characteristic,
+ int status) {
+ if (status == BluetoothGatt.GATT_SUCCESS) {
+ broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic);
+ }
+ }
+
+ @Override
+ public void onCharacteristicChanged(BluetoothGatt gatt,
+ BluetoothGattCharacteristic characteristic) {
+ broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic);
+ }
+ };
+
+ private void broadcastUpdate(final String action) {
+ final Intent intent = new Intent(action);
+ sendBroadcast(intent);
+ }
+
+ private void broadcastUpdate(final String action,
+ final BluetoothGattCharacteristic characteristic) {
+ final Intent intent = new Intent(action);
+
+ // This is special handling for the Heart Rate Measurement profile. Data parsing is
+ // carried out as per profile specifications:
+ // http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml
+ if (UUID_HEART_RATE_MEASUREMENT.equals(characteristic.getUuid())) {
+ int flag = characteristic.getProperties();
+ int format = -1;
+ if ((flag & 0x01) != 0) {
+ format = BluetoothGattCharacteristic.FORMAT_UINT16;
+ Log.d(TAG, "Heart rate format UINT16.");
+ } else {
+ format = BluetoothGattCharacteristic.FORMAT_UINT8;
+ Log.d(TAG, "Heart rate format UINT8.");
+ }
+ final int heartRate = characteristic.getIntValue(format, 1);
+ Log.d(TAG, String.format("Received heart rate: %d", heartRate));
+ intent.putExtra(EXTRA_DATA, String.valueOf(heartRate));
+ } else {
+ // For all other profiles, writes the data formatted in HEX.
+ final byte[] data = characteristic.getValue();
+ if (data != null && data.length > 0) {
+ final StringBuilder stringBuilder = new StringBuilder(data.length);
+ for(byte byteChar : data)
+ stringBuilder.append(String.format("%02X ", byteChar));
+ intent.putExtra(EXTRA_DATA, new String(data) + "\n" + stringBuilder.toString());
+ }
+ }
+ sendBroadcast(intent);
+ }
+
+ public class LocalBinder extends Binder {
+ BluetoothLeService getService() {
+ return BluetoothLeService.this;
+ }
+ }
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return mBinder;
+ }
+
+ @Override
+ public boolean onUnbind(Intent intent) {
+ // After using a given device, you should make sure that BluetoothGatt.close() is called
+ // such that resources are cleaned up properly. In this particular example, close() is
+ // invoked when the UI is disconnected from the Service.
+ close();
+ return super.onUnbind(intent);
+ }
+
+ private final IBinder mBinder = new LocalBinder();
+
+ /**
+ * Initializes a reference to the local Bluetooth adapter.
+ *
+ * @return Return true if the initialization is successful.
+ */
+ public boolean initialize() {
+ // For API level 18 and above, get a reference to BluetoothAdapter through
+ // BluetoothManager.
+ if (mBluetoothManager == null) {
+ mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
+ if (mBluetoothManager == null) {
+ Log.e(TAG, "Unable to initialize BluetoothManager.");
+ return false;
+ }
+ }
+
+ mBluetoothAdapter = mBluetoothManager.getAdapter();
+ if (mBluetoothAdapter == null) {
+ Log.e(TAG, "Unable to obtain a BluetoothAdapter.");
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Connects to the GATT server hosted on the Bluetooth LE device.
+ *
+ * @param address The device address of the destination device.
+ *
+ * @return Return true if the connection is initiated successfully. The connection result
+ * is reported asynchronously through the
+ * {@code BluetoothGattCallback#onConnectionStateChange(android.bluetooth.BluetoothGatt, int, int)}
+ * callback.
+ */
+ public boolean connect(final String address) {
+ if (mBluetoothAdapter == null || address == null) {
+ Log.w(TAG, "BluetoothAdapter not initialized or unspecified address.");
+ return false;
+ }
+
+ // Previously connected device. Try to reconnect.
+ if (mBluetoothDeviceAddress != null && address.equals(mBluetoothDeviceAddress)
+ && mBluetoothGatt != null) {
+ Log.d(TAG, "Trying to use an existing mBluetoothGatt for connection.");
+ if (mBluetoothGatt.connect()) {
+ mConnectionState = STATE_CONNECTING;
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ final BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address);
+ if (device == null) {
+ Log.w(TAG, "Device not found. Unable to connect.");
+ return false;
+ }
+ // We want to directly connect to the device, so we are setting the autoConnect
+ // parameter to false.
+ mBluetoothGatt = device.connectGatt(this, false, mGattCallback);
+ Log.d(TAG, "Trying to create a new connection.");
+ mBluetoothDeviceAddress = address;
+ mConnectionState = STATE_CONNECTING;
+ return true;
+ }
+
+ /**
+ * Disconnects an existing connection or cancel a pending connection. The disconnection result
+ * is reported asynchronously through the
+ * {@code BluetoothGattCallback#onConnectionStateChange(android.bluetooth.BluetoothGatt, int, int)}
+ * callback.
+ */
+ public void disconnect() {
+ if (mBluetoothAdapter == null || mBluetoothGatt == null) {
+ Log.w(TAG, "BluetoothAdapter not initialized");
+ return;
+ }
+ mBluetoothGatt.disconnect();
+ }
+
+ /**
+ * After using a given BLE device, the app must call this method to ensure resources are
+ * released properly.
+ */
+ public void close() {
+ if (mBluetoothGatt == null) {
+ return;
+ }
+ mBluetoothGatt.close();
+ mBluetoothGatt = null;
+ }
+
+ /**
+ * Request a read on a given {@code BluetoothGattCharacteristic}. The read result is reported
+ * asynchronously through the {@code BluetoothGattCallback#onCharacteristicRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int)}
+ * callback.
+ *
+ * @param characteristic The characteristic to read from.
+ */
+ public void readCharacteristic(BluetoothGattCharacteristic characteristic) {
+ if (mBluetoothAdapter == null || mBluetoothGatt == null) {
+ Log.w(TAG, "BluetoothAdapter not initialized");
+ return;
+ }
+ mBluetoothGatt.readCharacteristic(characteristic);
+ }
+
+ /**
+ * Enables or disables notification on a give characteristic.
+ *
+ * @param characteristic Characteristic to act on.
+ * @param enabled If true, enable notification. False otherwise.
+ */
+ public void setCharacteristicNotification(BluetoothGattCharacteristic characteristic,
+ boolean enabled) {
+ if (mBluetoothAdapter == null || mBluetoothGatt == null) {
+ Log.w(TAG, "BluetoothAdapter not initialized");
+ return;
+ }
+ mBluetoothGatt.setCharacteristicNotification(characteristic, enabled);
+
+ // This is specific to Heart Rate Measurement.
+ if (UUID_HEART_RATE_MEASUREMENT.equals(characteristic.getUuid())) {
+ BluetoothGattDescriptor descriptor = characteristic.getDescriptor(
+ UUID.fromString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG));
+ descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
+ mBluetoothGatt.writeDescriptor(descriptor);
+ }
+ }
+
+ /**
+ * Retrieves a list of supported GATT services on the connected device. This should be
+ * invoked only after {@code BluetoothGatt#discoverServices()} completes successfully.
+ *
+ * @return A {@code List} of supported services.
+ */
+ public List<BluetoothGattService> getSupportedGattServices() {
+ if (mBluetoothGatt == null) return null;
+
+ return mBluetoothGatt.getServices();
+ }
+}
diff --git a/samples/BluetoothLeGatt/src/com/example/bluetooth/le/DeviceControlActivity.java b/samples/BluetoothLeGatt/src/com/example/bluetooth/le/DeviceControlActivity.java
new file mode 100644
index 000000000..06b3bb465
--- /dev/null
+++ b/samples/BluetoothLeGatt/src/com/example/bluetooth/le/DeviceControlActivity.java
@@ -0,0 +1,309 @@
+/*
+ * Copyright (C) 2013 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.example.bluetooth.le;
+
+import android.app.Activity;
+import android.bluetooth.BluetoothGattCharacteristic;
+import android.bluetooth.BluetoothGattService;
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.ExpandableListView;
+import android.widget.SimpleExpandableListAdapter;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * For a given BLE device, this Activity provides the user interface to connect, display data,
+ * and display GATT services and characteristics supported by the device. The Activity
+ * communicates with {@code BluetoothLeService}, which in turn interacts with the
+ * Bluetooth LE API.
+ */
+public class DeviceControlActivity extends Activity {
+ private final static String TAG = DeviceControlActivity.class.getSimpleName();
+
+ public static final String EXTRAS_DEVICE_NAME = "DEVICE_NAME";
+ public static final String EXTRAS_DEVICE_ADDRESS = "DEVICE_ADDRESS";
+
+ private TextView mConnectionState;
+ private TextView mDataField;
+ private String mDeviceName;
+ private String mDeviceAddress;
+ private ExpandableListView mGattServicesList;
+ private BluetoothLeService mBluetoothLeService;
+ private ArrayList<ArrayList<BluetoothGattCharacteristic>> mGattCharacteristics =
+ new ArrayList<ArrayList<BluetoothGattCharacteristic>>();
+ private boolean mConnected = false;
+ private BluetoothGattCharacteristic mNotifyCharacteristic;
+
+ private final String LIST_NAME = "NAME";
+ private final String LIST_UUID = "UUID";
+
+ // Code to manage Service lifecycle.
+ private final ServiceConnection mServiceConnection = new ServiceConnection() {
+
+ @Override
+ public void onServiceConnected(ComponentName componentName, IBinder service) {
+ mBluetoothLeService = ((BluetoothLeService.LocalBinder) service).getService();
+ if (!mBluetoothLeService.initialize()) {
+ Log.e(TAG, "Unable to initialize Bluetooth");
+ finish();
+ }
+ // Automatically connects to the device upon successful start-up initialization.
+ mBluetoothLeService.connect(mDeviceAddress);
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName componentName) {
+ mBluetoothLeService = null;
+ }
+ };
+
+ // Handles various events fired by the Service.
+ // ACTION_GATT_CONNECTED: connected to a GATT server.
+ // ACTION_GATT_DISCONNECTED: disconnected from a GATT server.
+ // ACTION_GATT_SERVICES_DISCOVERED: discovered GATT services.
+ // ACTION_DATA_AVAILABLE: received data from the device. This can be a result of read
+ // or notification operations.
+ private final BroadcastReceiver mGattUpdateReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ final String action = intent.getAction();
+ if (BluetoothLeService.ACTION_GATT_CONNECTED.equals(action)) {
+ mConnected = true;
+ updateConnectionState(R.string.connected);
+ invalidateOptionsMenu();
+ } else if (BluetoothLeService.ACTION_GATT_DISCONNECTED.equals(action)) {
+ mConnected = false;
+ updateConnectionState(R.string.disconnected);
+ invalidateOptionsMenu();
+ clearUI();
+ } else if (BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED.equals(action)) {
+ // Show all the supported services and characteristics on the user interface.
+ displayGattServices(mBluetoothLeService.getSupportedGattServices());
+ } else if (BluetoothLeService.ACTION_DATA_AVAILABLE.equals(action)) {
+ displayData(intent.getStringExtra(BluetoothLeService.EXTRA_DATA));
+ }
+ }
+ };
+
+ // If a given GATT characteristic is selected, check for supported features. This sample
+ // demonstrates 'Read' and 'Notify' features. See
+ // http://d.android.com/reference/android/bluetooth/BluetoothGatt.html for the complete
+ // list of supported characteristic features.
+ private final ExpandableListView.OnChildClickListener servicesListClickListner =
+ new ExpandableListView.OnChildClickListener() {
+ @Override
+ public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
+ int childPosition, long id) {
+ if (mGattCharacteristics != null) {
+ final BluetoothGattCharacteristic characteristic =
+ mGattCharacteristics.get(groupPosition).get(childPosition);
+ final int charaProp = characteristic.getProperties();
+ if ((charaProp | BluetoothGattCharacteristic.PROPERTY_READ) > 0) {
+ // If there is an active notification on a characteristic, clear
+ // it first so it doesn't update the data field on the user interface.
+ if (mNotifyCharacteristic != null) {
+ mBluetoothLeService.setCharacteristicNotification(
+ mNotifyCharacteristic, false);
+ mNotifyCharacteristic = null;
+ }
+ mBluetoothLeService.readCharacteristic(characteristic);
+ }
+ if ((charaProp | BluetoothGattCharacteristic.PROPERTY_NOTIFY) > 0) {
+ mNotifyCharacteristic = characteristic;
+ mBluetoothLeService.setCharacteristicNotification(
+ characteristic, true);
+ }
+ return true;
+ }
+ return false;
+ }
+ };
+
+ private void clearUI() {
+ mGattServicesList.setAdapter((SimpleExpandableListAdapter) null);
+ mDataField.setText(R.string.no_data);
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.gatt_services_characteristics);
+
+ final Intent intent = getIntent();
+ mDeviceName = intent.getStringExtra(EXTRAS_DEVICE_NAME);
+ mDeviceAddress = intent.getStringExtra(EXTRAS_DEVICE_ADDRESS);
+
+ // Sets up UI references.
+ ((TextView) findViewById(R.id.device_address)).setText(mDeviceAddress);
+ mGattServicesList = (ExpandableListView) findViewById(R.id.gatt_services_list);
+ mGattServicesList.setOnChildClickListener(servicesListClickListner);
+ mConnectionState = (TextView) findViewById(R.id.connection_state);
+ mDataField = (TextView) findViewById(R.id.data_value);
+
+ getActionBar().setTitle(mDeviceName);
+ getActionBar().setDisplayHomeAsUpEnabled(true);
+ Intent gattServiceIntent = new Intent(this, BluetoothLeService.class);
+ bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE);
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ registerReceiver(mGattUpdateReceiver, makeGattUpdateIntentFilter());
+ if (mBluetoothLeService != null) {
+ final boolean result = mBluetoothLeService.connect(mDeviceAddress);
+ Log.d(TAG, "Connect request result=" + result);
+ }
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ unregisterReceiver(mGattUpdateReceiver);
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ unbindService(mServiceConnection);
+ mBluetoothLeService = null;
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.gatt_services, menu);
+ if (mConnected) {
+ menu.findItem(R.id.menu_connect).setVisible(false);
+ menu.findItem(R.id.menu_disconnect).setVisible(true);
+ } else {
+ menu.findItem(R.id.menu_connect).setVisible(true);
+ menu.findItem(R.id.menu_disconnect).setVisible(false);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch(item.getItemId()) {
+ case R.id.menu_connect:
+ mBluetoothLeService.connect(mDeviceAddress);
+ return true;
+ case R.id.menu_disconnect:
+ mBluetoothLeService.disconnect();
+ return true;
+ case android.R.id.home:
+ onBackPressed();
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ private void updateConnectionState(final int resourceId) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mConnectionState.setText(resourceId);
+ }
+ });
+ }
+
+ private void displayData(String data) {
+ if (data != null) {
+ mDataField.setText(data);
+ }
+ }
+
+ // Demonstrates how to iterate through the supported GATT Services/Characteristics.
+ // In this sample, we populate the data structure that is bound to the ExpandableListView
+ // on the UI.
+ private void displayGattServices(List<BluetoothGattService> gattServices) {
+ if (gattServices == null) return;
+ String uuid = null;
+ String unknownServiceString = getResources().getString(R.string.unknown_service);
+ String unknownCharaString = getResources().getString(R.string.unknown_characteristic);
+ ArrayList<HashMap<String, String>> gattServiceData = new ArrayList<HashMap<String, String>>();
+ ArrayList<ArrayList<HashMap<String, String>>> gattCharacteristicData
+ = new ArrayList<ArrayList<HashMap<String, String>>>();
+ mGattCharacteristics = new ArrayList<ArrayList<BluetoothGattCharacteristic>>();
+
+ // Loops through available GATT Services.
+ for (BluetoothGattService gattService : gattServices) {
+ HashMap<String, String> currentServiceData = new HashMap<String, String>();
+ uuid = gattService.getUuid().toString();
+ currentServiceData.put(
+ LIST_NAME, SampleGattAttributes.lookup(uuid, unknownServiceString));
+ currentServiceData.put(LIST_UUID, uuid);
+ gattServiceData.add(currentServiceData);
+
+ ArrayList<HashMap<String, String>> gattCharacteristicGroupData =
+ new ArrayList<HashMap<String, String>>();
+ List<BluetoothGattCharacteristic> gattCharacteristics =
+ gattService.getCharacteristics();
+ ArrayList<BluetoothGattCharacteristic> charas =
+ new ArrayList<BluetoothGattCharacteristic>();
+
+ // Loops through available Characteristics.
+ for (BluetoothGattCharacteristic gattCharacteristic : gattCharacteristics) {
+ charas.add(gattCharacteristic);
+ HashMap<String, String> currentCharaData = new HashMap<String, String>();
+ uuid = gattCharacteristic.getUuid().toString();
+ currentCharaData.put(
+ LIST_NAME, SampleGattAttributes.lookup(uuid, unknownCharaString));
+ currentCharaData.put(LIST_UUID, uuid);
+ gattCharacteristicGroupData.add(currentCharaData);
+ }
+ mGattCharacteristics.add(charas);
+ gattCharacteristicData.add(gattCharacteristicGroupData);
+ }
+
+ SimpleExpandableListAdapter gattServiceAdapter = new SimpleExpandableListAdapter(
+ this,
+ gattServiceData,
+ android.R.layout.simple_expandable_list_item_2,
+ new String[] {LIST_NAME, LIST_UUID},
+ new int[] { android.R.id.text1, android.R.id.text2 },
+ gattCharacteristicData,
+ android.R.layout.simple_expandable_list_item_2,
+ new String[] {LIST_NAME, LIST_UUID},
+ new int[] { android.R.id.text1, android.R.id.text2 }
+ );
+ mGattServicesList.setAdapter(gattServiceAdapter);
+ }
+
+ private static IntentFilter makeGattUpdateIntentFilter() {
+ final IntentFilter intentFilter = new IntentFilter();
+ intentFilter.addAction(BluetoothLeService.ACTION_GATT_CONNECTED);
+ intentFilter.addAction(BluetoothLeService.ACTION_GATT_DISCONNECTED);
+ intentFilter.addAction(BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED);
+ intentFilter.addAction(BluetoothLeService.ACTION_DATA_AVAILABLE);
+ return intentFilter;
+ }
+}
diff --git a/samples/BluetoothLeGatt/src/com/example/bluetooth/le/DeviceScanActivity.java b/samples/BluetoothLeGatt/src/com/example/bluetooth/le/DeviceScanActivity.java
new file mode 100644
index 000000000..1cc954df2
--- /dev/null
+++ b/samples/BluetoothLeGatt/src/com/example/bluetooth/le/DeviceScanActivity.java
@@ -0,0 +1,269 @@
+/*
+ * Copyright (C) 2013 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.example.bluetooth.le;
+
+import android.app.Activity;
+import android.app.ListActivity;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothManager;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.os.Handler;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import java.util.ArrayList;
+import java.util.UUID;
+
+/**
+ * Activity for scanning and displaying available Bluetooth LE devices.
+ */
+public class DeviceScanActivity extends ListActivity {
+ private LeDeviceListAdapter mLeDeviceListAdapter;
+ private BluetoothAdapter mBluetoothAdapter;
+ private boolean mScanning;
+ private Handler mHandler;
+
+ private static final int REQUEST_ENABLE_BT = 1;
+ // Stops scanning after 10 seconds.
+ private static final long SCAN_PERIOD = 10000;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ getActionBar().setTitle(R.string.title_devices);
+ mHandler = new Handler();
+
+ // Use this check to determine whether BLE is supported on the device. Then you can
+ // selectively disable BLE-related features.
+ if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
+ Toast.makeText(this, R.string.ble_not_supported, Toast.LENGTH_SHORT).show();
+ finish();
+ }
+
+ // Initializes a Bluetooth adapter. For API level 18 and above, get a reference to
+ // BluetoothAdapter through BluetoothManager.
+ final BluetoothManager bluetoothManager =
+ (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
+ mBluetoothAdapter = bluetoothManager.getAdapter();
+
+ // Checks if Bluetooth is supported on the device.
+ if (mBluetoothAdapter == null) {
+ Toast.makeText(this, R.string.error_bluetooth_not_supported, Toast.LENGTH_SHORT).show();
+ finish();
+ return;
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.main, menu);
+ if (!mScanning) {
+ menu.findItem(R.id.menu_stop).setVisible(false);
+ menu.findItem(R.id.menu_scan).setVisible(true);
+ menu.findItem(R.id.menu_refresh).setActionView(null);
+ } else {
+ menu.findItem(R.id.menu_stop).setVisible(true);
+ menu.findItem(R.id.menu_scan).setVisible(false);
+ menu.findItem(R.id.menu_refresh).setActionView(
+ R.layout.actionbar_indeterminate_progress);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.menu_scan:
+ mLeDeviceListAdapter.clear();
+ scanLeDevice(true);
+ break;
+ case R.id.menu_stop:
+ scanLeDevice(false);
+ break;
+ }
+ return true;
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+ // Ensures Bluetooth is enabled on the device. If Bluetooth is not currently enabled,
+ // fire an intent to display a dialog asking the user to grant permission to enable it.
+ if (!mBluetoothAdapter.isEnabled()) {
+ if (!mBluetoothAdapter.isEnabled()) {
+ Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
+ startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
+ }
+ }
+
+ // Initializes list view adapter.
+ mLeDeviceListAdapter = new LeDeviceListAdapter();
+ setListAdapter(mLeDeviceListAdapter);
+ scanLeDevice(true);
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ // User chose not to enable Bluetooth.
+ if (requestCode == REQUEST_ENABLE_BT && resultCode == Activity.RESULT_CANCELED) {
+ finish();
+ return;
+ }
+ super.onActivityResult(requestCode, resultCode, data);
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ scanLeDevice(false);
+ mLeDeviceListAdapter.clear();
+ }
+
+ @Override
+ protected void onListItemClick(ListView l, View v, int position, long id) {
+ final BluetoothDevice device = mLeDeviceListAdapter.getDevice(position);
+ if (device == null) return;
+ final Intent intent = new Intent(this, DeviceControlActivity.class);
+ intent.putExtra(DeviceControlActivity.EXTRAS_DEVICE_NAME, device.getName());
+ intent.putExtra(DeviceControlActivity.EXTRAS_DEVICE_ADDRESS, device.getAddress());
+ if (mScanning) {
+ mBluetoothAdapter.stopLeScan(mLeScanCallback);
+ mScanning = false;
+ }
+ startActivity(intent);
+ }
+
+ private void scanLeDevice(final boolean enable) {
+ if (enable) {
+ // Stops scanning after a pre-defined scan period.
+ mHandler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ mScanning = false;
+ mBluetoothAdapter.stopLeScan(mLeScanCallback);
+ invalidateOptionsMenu();
+ }
+ }, SCAN_PERIOD);
+
+ mScanning = true;
+ mBluetoothAdapter.startLeScan(mLeScanCallback);
+ } else {
+ mScanning = false;
+ mBluetoothAdapter.stopLeScan(mLeScanCallback);
+ }
+ invalidateOptionsMenu();
+ }
+
+ // Adapter for holding devices found through scanning.
+ private class LeDeviceListAdapter extends BaseAdapter {
+ private ArrayList<BluetoothDevice> mLeDevices;
+ private LayoutInflater mInflator;
+
+ public LeDeviceListAdapter() {
+ super();
+ mLeDevices = new ArrayList<BluetoothDevice>();
+ mInflator = DeviceScanActivity.this.getLayoutInflater();
+ }
+
+ public void addDevice(BluetoothDevice device) {
+ if(!mLeDevices.contains(device)) {
+ mLeDevices.add(device);
+ }
+ }
+
+ public BluetoothDevice getDevice(int position) {
+ return mLeDevices.get(position);
+ }
+
+ public void clear() {
+ mLeDevices.clear();
+ }
+
+ @Override
+ public int getCount() {
+ return mLeDevices.size();
+ }
+
+ @Override
+ public Object getItem(int i) {
+ return mLeDevices.get(i);
+ }
+
+ @Override
+ public long getItemId(int i) {
+ return i;
+ }
+
+ @Override
+ public View getView(int i, View view, ViewGroup viewGroup) {
+ ViewHolder viewHolder;
+ // General ListView optimization code.
+ if (view == null) {
+ view = mInflator.inflate(R.layout.listitem_device, null);
+ viewHolder = new ViewHolder();
+ viewHolder.deviceAddress = (TextView) view.findViewById(R.id.device_address);
+ viewHolder.deviceName = (TextView) view.findViewById(R.id.device_name);
+ view.setTag(viewHolder);
+ } else {
+ viewHolder = (ViewHolder) view.getTag();
+ }
+
+ BluetoothDevice device = mLeDevices.get(i);
+ final String deviceName = device.getName();
+ if (deviceName != null && deviceName.length() > 0)
+ viewHolder.deviceName.setText(deviceName);
+ else
+ viewHolder.deviceName.setText(R.string.unknown_device);
+ viewHolder.deviceAddress.setText(device.getAddress());
+
+ return view;
+ }
+ }
+
+ // Device scan callback.
+ private BluetoothAdapter.LeScanCallback mLeScanCallback =
+ new BluetoothAdapter.LeScanCallback() {
+
+ @Override
+ public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mLeDeviceListAdapter.addDevice(device);
+ mLeDeviceListAdapter.notifyDataSetChanged();
+ }
+ });
+ }
+ };
+
+ static class ViewHolder {
+ TextView deviceName;
+ TextView deviceAddress;
+ }
+} \ No newline at end of file
diff --git a/samples/BluetoothLeGatt/src/com/example/bluetooth/le/SampleGattAttributes.java b/samples/BluetoothLeGatt/src/com/example/bluetooth/le/SampleGattAttributes.java
new file mode 100644
index 000000000..255653eb0
--- /dev/null
+++ b/samples/BluetoothLeGatt/src/com/example/bluetooth/le/SampleGattAttributes.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2013 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.example.bluetooth.le;
+
+import java.util.HashMap;
+
+/**
+ * This class includes a small subset of standard GATT attributes for demonstration purposes.
+ */
+public class SampleGattAttributes {
+ private static HashMap<String, String> attributes = new HashMap();
+ public static String HEART_RATE_MEASUREMENT = "00002a37-0000-1000-8000-00805f9b34fb";
+ public static String CLIENT_CHARACTERISTIC_CONFIG = "00002902-0000-1000-8000-00805f9b34fb";
+
+ static {
+ // Sample Services.
+ attributes.put("0000180d-0000-1000-8000-00805f9b34fb", "Heart Rate Service");
+ attributes.put("0000180a-0000-1000-8000-00805f9b34fb", "Device Information Service");
+ // Sample Characteristics.
+ attributes.put(HEART_RATE_MEASUREMENT, "Heart Rate Measurement");
+ attributes.put("00002a29-0000-1000-8000-00805f9b34fb", "Manufacturer Name String");
+ }
+
+ public static String lookup(String uuid, String defaultName) {
+ String name = attributes.get(uuid);
+ return name == null ? defaultName : name;
+ }
+}
diff --git a/samples/BrowserPlugin/Android.mk b/samples/BrowserPlugin/Android.mk
deleted file mode 100644
index 1eee450fa..000000000
--- a/samples/BrowserPlugin/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (C) 2009 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.
-#
-
-TOP_LOCAL_PATH:= $(call my-dir)
-
-# Build application
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_PACKAGE_NAME := SampleBrowserPlugin
-
-LOCAL_JNI_SHARED_LIBRARIES := libsampleplugin
-
-# TODO: doesn't compile with this set
-#LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
-
-# ============================================================
-
-# Also build all of the sub-targets under this one: the shared library.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/samples/BrowserPlugin/MODULE_LICENSE_APACHE2 b/samples/BrowserPlugin/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb..000000000
--- a/samples/BrowserPlugin/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/samples/BrowserPlugin/NOTICE b/samples/BrowserPlugin/NOTICE
deleted file mode 100644
index c5b1efa7a..000000000
--- a/samples/BrowserPlugin/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
- Copyright (c) 2005-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.
-
- 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.
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
diff --git a/samples/BrowserPlugin/README b/samples/BrowserPlugin/README
deleted file mode 100644
index 29797b285..000000000
--- a/samples/BrowserPlugin/README
+++ /dev/null
@@ -1,177 +0,0 @@
-# Copyright (C) 2009 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.
-#
-
-##############################
-######### CONTENTS ###########
-A. INTRODUCTION
-B. PLUGIN STRUCTURE
-C. HOW TO DEPLOY
-D. SUB-PLUGINS
- 1. ANIMATION
- 2. AUDIO
- 3. BACKGROUND
- 4. FORM
- 5. PAINT
-
-
-##############################
-## (A) INTRODUCTION ##########
-
-The sample plugin is intended to give plugin developers a point of reference to
-see how an android browser plugin is created and how to use the available APIs.
-A plugin is packaged like a standard apk and can be installed either via the
-market or adb. The sample plugin attempts to exercise as many of the APIs as
-possible but unfortunately not all are covered.
-
-Trying to have a single plugin demonstrate all possible API interactions on one
-screen was not practical. On the other hand we also didn't want a separate
-plugin for each interction, as that would result in many separate apk's that
-would need to be maintained. To solve this problem we developed the idea to use
-"sub-plugins". With a sub-plugin only one specific feature of the plugin would
-be active at a time, but they would all share as much common code as possible.
-A detailed description of each sub-plugin and its function can be found in the
-sub-plugins section.
-
-##############################
-## (B) PLUGIN STRUCTURE ######
-
-The sample plugin is packaged as one plugin but contains many unique sub-plugins
-(e.g. audio and paint). The package consists of two pieces: (1) Java code
-containing the config; (2) C++ shared library containing the brower/plugin
-bindings and the sub-plugin classes.
-
-~~~~ (1) JAVA ~~~~~
-Android.mk: specifies the name of the APK (SampleBrowserPlugin) as well as which
- shared libraries to include.
-
-AndroidManifest.xml: similar to a standard android manifest file, except that it
- must contain the "uses-permission" and "service"
- elements that are plugin specific. The "service" element
- contains sub-elements that describe the java component of
- the service.
-
-src/*: location of the java source files. This contains the SamplePlugin.class
- which is the java component of our plugin. The component must exist and
- implement the required interfaces, though simply returning null is valid.
-
-res/*: location of the static resources (e.g. an icon for the plugin)
-
-~~~~ (2) C++ ~~~~~
-jni/Android.mk: specifies the build parameters for the shared library that is to
- be included with the apk. The library contains all the bindings
- between the plugin and the browser.
-
-jni/main.*: this code is the binding point between the plugin and the browser.
- It supports all of the functions required for a standard netscape
- style plugin as well as all the android specific APIs. The initial
- starting point for the plugin is the NP_Initialize function. The
- NPP_New function is responsible for reading the input args and
- selecting the appropriate sub-plugin to instantiate. Most other
- functions either return fixed values or pass their inputs to the
- sub-plugin for processing.
-
-jni/PluginObject.*: The pluginObject provides a convenient container in which to
- store variables (the plugin's state). This objects two main
- responsibilities are (1) to construct and store the NPClass
- object (done using code provided by Apple) and (2) provide
- the abstract class for the sub-plugin objects and a place to
- store the sub-plugin after it is instantiated.
-
-jni/*/*: Each of the sub-plugins has a folder that contains its class definition
- and logic. The sub-plugin receives events from the browser and it can
- also communicate with the browser using the netscape plugin functions
- as well as the specialized android interfaces.
-
-
-##############################
-## (C) HOW TO DEPLOY #########
-
-To compile and install a plugin on a device/emulator simply...
-
-1. run "make SampleBrowserPlugin" (compiles libsampleplugin.so and builds the apk)
-2. the previous command produces an apk file so record its location
-3. run "adb install [apk_file]" to install it on a device/emulator
-4. the browser will auto recognize the plugin is available
-
-Now that the plugin is installed you can manage it just like you would any other
-application via Settings -> Applications -> Manage applications. To execute the
-plugin you need to include an html snippet (similar to the one found below) in
-a document that is accessible by the browser. The mime-type cannot change but
-you can change the width, height, and parameters. The parameters are used to
-notify the plugin which sub-plugin to execute and which drawing model to use.
-
-<object type="application/x-testbrowserplugin" height=50 width=250>
- <param name="DrawingModel" value="Surface" />
- <param name="PluginType" value="Background" />
-</object>
-
-
-##############################
-## (D) SUB-PLUGINS ###########
-
-Each sub-plugin corresponds to exactly one plugin type and can support one or
-more drawing models. In the subsections below there are descriptions of each of
-the sub-plugins as well as the information required to create the html snippets.
-
-#######################
-## (D1) ANIMATION #####
-
-PLUGIN TYPE: Animation
-DRAWING MODEL: Bitmap
-
-This plugin draws a ball bouncing around the screen. If the plugin is not entirely
-on the screen and it it touched, then it will attempt to center itself on screen.
-
-#######################
-## (D2) AUDIO #########
-
-PLUGIN TYPE: Audio
-DRAWING MODEL: Bitmap
-
-This plugin plays a raw audio file located at /sdcard/sample.raw (need to supply
-your own). It uses touch to trigger the play, pause, and stop buttons.
-
-#######################
-## (D3) BACKGROUND ####
-
-PLUGIN TYPE: Background
-DRAWING MODEL: Surface
-
-This plugin has minimal visual components but mainly runs API tests in the
-background. The plugin handles scaling its own bitmap on zoom which in this
-case is a simple string of text. The output of this plugin is found in the logs
-as it prints errors if it detects any API failures. Some of the API's tested are
-timers, javascript access, and bitmap formatting.
-
-#######################
-## (D4) FORM ##########
-
-PLUGIN TYPE: Form
-DRAWING MODEL: Bitmap
-
-This plugin mimics a simple username/password form. You can select a textbox by
-either touching it or using the navigation keys. Once selected the box will
-highlight and the keyboard will appear. If the textbox selected is not fully
-in view then the plugin will ensure it is centered on the screen.
-
-#######################
-## (D5) PAINT #########
-
-PLUGIN TYPE: Paint
-DRAWING MODEL: Surface
-
-This plugin provides a surface that the user can "paint" on. The inputs method
-can be toggled between mouse (dots) and touch (lines). This plugin has a fixed
-surface and allows the browser to scale the surface when zooming.
diff --git a/samples/BrowserPlugin/jni/Android.mk b/samples/BrowserPlugin/jni/Android.mk
deleted file mode 100644
index 7636de9bc..000000000
--- a/samples/BrowserPlugin/jni/Android.mk
+++ /dev/null
@@ -1,79 +0,0 @@
-##
-##
-## Copyright 2008, The Android Open Source Project
-##
-## Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions
-## are met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in the
-## documentation and/or other materials provided with the distribution.
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
-## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
-## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-##
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- main.cpp \
- PluginObject.cpp \
- RenderingThread.cpp \
- animation/AnimationPlugin.cpp \
- animation/AnimationThread.cpp \
- audio/AudioPlugin.cpp \
- background/BackgroundPlugin.cpp \
- form/FormPlugin.cpp \
- navigation/NavigationPlugin.cpp \
- paint/PaintPlugin.cpp \
- video/VideoPlugin.cpp \
- jni-bridge.cpp \
-
-WEBCORE_PATH := external/webkit/Source/WebCore
-
-LOCAL_C_INCLUDES += \
- $(JNI_H_INCLUDE) \
- $(LOCAL_PATH) \
- $(LOCAL_PATH)/animation \
- $(LOCAL_PATH)/audio \
- $(LOCAL_PATH)/background \
- $(LOCAL_PATH)/form \
- $(LOCAL_PATH)/navigation \
- $(LOCAL_PATH)/paint \
- $(LOCAL_PATH)/video \
- $(WEBCORE_PATH)/bridge \
- $(WEBCORE_PATH)/plugins \
- $(WEBCORE_PATH)/platform/android/JavaVM \
- external/webkit/Source/WebKit/android/plugins \
- external/skia/include/core
-
-LOCAL_SHARED_LIBRARIES := \
- libnativehelper \
- libandroid \
- libutils \
- libcutils \
- libEGL \
- libGLESv2 \
- libskia
-
-LOCAL_CFLAGS += -fvisibility=hidden
-
-
-LOCAL_MODULE:= libsampleplugin
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
-
diff --git a/samples/BrowserPlugin/jni/PluginObject.cpp b/samples/BrowserPlugin/jni/PluginObject.cpp
deleted file mode 100644
index 16925c892..000000000
--- a/samples/BrowserPlugin/jni/PluginObject.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
- consideration of your agreement to the following terms, and your use, installation,
- modification or redistribution of this Apple software constitutes acceptance of these
- terms. If you do not agree with these terms, please do not use, install, modify or
- redistribute this Apple software.
-
- In consideration of your agreement to abide by the following terms, and subject to these
- terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in
- this original Apple software (the "Apple Software"), to use, reproduce, modify and
- redistribute the Apple Software, with or without modifications, in source and/or binary
- forms; provided that if you redistribute the Apple Software in its entirety and without
- modifications, you must retain this notice and the following text and disclaimers in all
- such redistributions of the Apple Software. Neither the name, trademarks, service marks
- or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
- the Apple Software without specific prior written permission from Apple. Except as expressly
- stated in this notice, no other rights or licenses, express or implied, are granted by Apple
- herein, including but not limited to any patent rights that may be infringed by your
- derivative works or by other works in which the Apple Software may be incorporated.
-
- The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES,
- EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
- USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
- REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
- WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
- OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-#include "main.h"
-#include "PluginObject.h"
-
-int SubPlugin::getPluginWidth() {
- PluginObject *obj = (PluginObject*) inst()->pdata;
- return obj->window->width;
-}
-
-int SubPlugin::getPluginHeight() {
- PluginObject *obj = (PluginObject*) inst()->pdata;
- return obj->window->height;
-}
-
-SurfaceSubPlugin::~SurfaceSubPlugin() {
- setContext(NULL);
-}
-
-bool SurfaceSubPlugin::supportsDrawingModel(ANPDrawingModel model) {
- return (model == kSurface_ANPDrawingModel);
-}
-
-void SurfaceSubPlugin::setContext(jobject context) {
- JNIEnv* env = NULL;
- if (gVM->GetEnv((void**) &env, JNI_VERSION_1_4) == JNI_OK) {
-
- // if one exists then free its global reference
- if (m_context) {
- env->DeleteGlobalRef(m_context);
- m_context = NULL;
- }
-
- // create a new global ref
- if (context) {
- context = env->NewGlobalRef(context);
- }
-
- // set the value
- m_context = context;
- }
-}
-
-static void pluginInvalidate(NPObject *obj);
-static bool pluginHasProperty(NPObject *obj, NPIdentifier name);
-static bool pluginHasMethod(NPObject *obj, NPIdentifier name);
-static bool pluginGetProperty(NPObject *obj, NPIdentifier name, NPVariant *variant);
-static bool pluginSetProperty(NPObject *obj, NPIdentifier name, const NPVariant *variant);
-static bool pluginInvoke(NPObject *obj, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result);
-static bool pluginInvokeDefault(NPObject *obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
-static NPObject *pluginAllocate(NPP npp, NPClass *theClass);
-static void pluginDeallocate(NPObject *obj);
-static bool pluginRemoveProperty(NPObject *npobj, NPIdentifier name);
-static bool pluginEnumerate(NPObject *npobj, NPIdentifier **value, uint32_t *count);
-
-
-
-static NPClass pluginClass = {
- NP_CLASS_STRUCT_VERSION,
- pluginAllocate,
- pluginDeallocate,
- pluginInvalidate,
- pluginHasMethod,
- pluginInvoke,
- pluginInvokeDefault,
- pluginHasProperty,
- pluginGetProperty,
- pluginSetProperty,
- pluginRemoveProperty,
- pluginEnumerate
-};
-
-NPClass *getPluginClass(void)
-{
- return &pluginClass;
-}
-
-static bool identifiersInitialized = false;
-
-#define ID_TESTFILE_PROPERTY 0
-#define NUM_PROPERTY_IDENTIFIERS 1
-
-static NPIdentifier pluginPropertyIdentifiers[NUM_PROPERTY_IDENTIFIERS];
-static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
- "testfile"
-};
-
-#define ID_GETTESTFILE_METHOD 0
-#define NUM_METHOD_IDENTIFIERS 1
-
-static NPIdentifier pluginMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
-static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
- "getTestFile"
-};
-
-static void initializeIdentifiers(void)
-{
- browser->getstringidentifiers(pluginPropertyIdentifierNames, NUM_PROPERTY_IDENTIFIERS, pluginPropertyIdentifiers);
- browser->getstringidentifiers(pluginMethodIdentifierNames, NUM_METHOD_IDENTIFIERS, pluginMethodIdentifiers);
-}
-
-static bool pluginHasProperty(NPObject *obj, NPIdentifier name)
-{
- int i;
- for (i = 0; i < NUM_PROPERTY_IDENTIFIERS; i++)
- if (name == pluginPropertyIdentifiers[i])
- return true;
- return false;
-}
-
-static bool pluginHasMethod(NPObject *obj, NPIdentifier name)
-{
- int i;
- for (i = 0; i < NUM_METHOD_IDENTIFIERS; i++)
- if (name == pluginMethodIdentifiers[i])
- return true;
- return false;
-}
-
-static bool pluginGetProperty(NPObject *obj, NPIdentifier name, NPVariant *variant)
-{
- PluginObject *plugin = (PluginObject *)obj;
- if (name == pluginPropertyIdentifiers[ID_TESTFILE_PROPERTY]) {
- BOOLEAN_TO_NPVARIANT(true, *variant);
- return true;
- }
- return false;
-}
-
-static bool pluginSetProperty(NPObject *obj, NPIdentifier name, const NPVariant *variant)
-{
- return false;
-}
-
-static bool pluginInvoke(NPObject *obj, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result)
-{
- PluginObject *plugin = (PluginObject *)obj;
- if (name == pluginMethodIdentifiers[ID_GETTESTFILE_METHOD]) {
- return true;
- }
- return false;
-}
-
-static bool pluginInvokeDefault(NPObject *obj, const NPVariant *args, uint32_t argCount, NPVariant *result)
-{
- return false;
-}
-
-static void pluginInvalidate(NPObject *obj)
-{
- // Release any remaining references to JavaScript objects.
-}
-
-static NPObject *pluginAllocate(NPP npp, NPClass *theClass)
-{
- PluginObject *newInstance = (PluginObject*) malloc(sizeof(PluginObject));
- newInstance->header._class = theClass;
- newInstance->header.referenceCount = 1;
-
- if (!identifiersInitialized) {
- identifiersInitialized = true;
- initializeIdentifiers();
- }
-
- newInstance->npp = npp;
-
- return &newInstance->header;
-}
-
-static void pluginDeallocate(NPObject *obj)
-{
- free(obj);
-}
-
-static bool pluginRemoveProperty(NPObject *npobj, NPIdentifier name)
-{
- return false;
-}
-
-static bool pluginEnumerate(NPObject *npobj, NPIdentifier **value, uint32_t *count)
-{
- return false;
-}
diff --git a/samples/BrowserPlugin/jni/PluginObject.h b/samples/BrowserPlugin/jni/PluginObject.h
deleted file mode 100644
index e0f4424d6..000000000
--- a/samples/BrowserPlugin/jni/PluginObject.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
- consideration of your agreement to the following terms, and your use, installation,
- modification or redistribution of this Apple software constitutes acceptance of these
- terms. If you do not agree with these terms, please do not use, install, modify or
- redistribute this Apple software.
-
- In consideration of your agreement to abide by the following terms, and subject to these
- terms, Apple grants you a personal, non-exclusive license, under Apple�s copyrights in
- this original Apple software (the "Apple Software"), to use, reproduce, modify and
- redistribute the Apple Software, with or without modifications, in source and/or binary
- forms; provided that if you redistribute the Apple Software in its entirety and without
- modifications, you must retain this notice and the following text and disclaimers in all
- such redistributions of the Apple Software. Neither the name, trademarks, service marks
- or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
- the Apple Software without specific prior written permission from Apple. Except as expressly
- stated in this notice, no other rights or licenses, express or implied, are granted by Apple
- herein, including but not limited to any patent rights that may be infringed by your
- derivative works or by other works in which the Apple Software may be incorporated.
-
- The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES,
- EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
- USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
- REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
- WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
- OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef PluginObject__DEFINED
-#define PluginObject__DEFINED
-
-#include "main.h"
-#include <jni.h>
-
-enum CustomEventTypes {
- kSurfaceCreated_CustomEvent = 0,
- kSurfaceChanged_CustomEvent = 1,
- kSurfaceDestroyed_CustomEvent = 2,
-};
-typedef int32_t CustomEventType;
-
-class SubPlugin {
-public:
- SubPlugin(NPP inst) : m_inst(inst) {}
- virtual ~SubPlugin() {}
- virtual int16_t handleEvent(const ANPEvent* evt) = 0;
- virtual bool supportsDrawingModel(ANPDrawingModel) = 0;
-
- int getPluginWidth();
- int getPluginHeight();
-
- NPP inst() const { return m_inst; }
-
-private:
- NPP m_inst;
-};
-
-class SurfaceSubPlugin : public SubPlugin {
-public:
- SurfaceSubPlugin(NPP inst) : SubPlugin(inst) { m_context = NULL; }
- virtual ~SurfaceSubPlugin();
- virtual jobject getSurface() = 0;
- virtual bool supportsDrawingModel(ANPDrawingModel);
-
- void setContext(jobject context);
-
- jobject m_context;
-};
-
-enum PluginTypes {
- kAnimation_PluginType = 1,
- kAudio_PluginType = 2,
- kBackground_PluginType = 3,
- kForm_PluginType = 4,
- kText_PluginType = 5,
- kPaint_PluginType = 6,
- kVideo_PluginType = 7,
- kNavigation_PluginType = 8,
-};
-typedef uint32_t PluginType;
-
-typedef struct PluginObject {
- NPObject header;
- NPP npp;
- NPWindow* window;
-
- PluginType pluginType;
- SubPlugin* activePlugin;
-
-} PluginObject;
-
-NPClass *getPluginClass(void);
-
-#endif // PluginObject__DEFINED
diff --git a/samples/BrowserPlugin/jni/RenderingThread.cpp b/samples/BrowserPlugin/jni/RenderingThread.cpp
deleted file mode 100644
index 5e27f288d..000000000
--- a/samples/BrowserPlugin/jni/RenderingThread.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "RenderingThread.h"
-
-#include "ANPNativeWindow_npapi.h"
-
-#include <android/native_window.h>
-
-extern ANPLogInterfaceV0 gLogI;
-extern ANPNativeWindowInterfaceV0 gNativeWindowI;
-
-RenderingThread::RenderingThread(NPP npp) : android::Thread() {
- m_npp = npp;
- m_width = -1;
- m_height = -1;
-
- m_ANW = NULL;
-#if (!USE_SOFTWARE_RENDERING)
- m_eglSurface = EGL_NO_SURFACE;
- m_eglContext = EGL_NO_CONTEXT;
- m_eglDisplay = EGL_NO_DISPLAY;
-#endif
-}
-
-android::status_t RenderingThread::readyToRun() {
- gLogI.log(kError_ANPLogType, "thread %p acquiring native window...", this);
- while (m_ANW == NULL) {
- m_ANW = gNativeWindowI.acquireNativeWindow(m_npp);
- if (!m_ANW)
- gLogI.log(kError_ANPLogType, "thread %p acquire native window FAILED!", this);
-
- }
- gLogI.log(kError_ANPLogType, "thread %p acquired native window successfully!", this);
-
-#if (!USE_SOFTWARE_RENDERING)
- m_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
-
- //initialize context
- EGLint numConfigs;
- static const EGLint configAttribs[] = {
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_RED_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_BLUE_SIZE, 8,
- EGL_ALPHA_SIZE, 8,
- EGL_NONE
- };
-
- eglChooseConfig(m_eglDisplay, configAttribs, &m_eglConfig, 1, &numConfigs);
- checkGlError("eglChooseConfig");
-
- static const EGLint contextAttribs[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_NONE
- };
-
- m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, NULL, contextAttribs);
- checkGlError("eglCreateContext");
-#endif
-
- return android::NO_ERROR;
-}
-
-void RenderingThread::setDimensions(int width, int height) {
- android::Mutex::Autolock lock(m_sync);
- m_width = width;
- m_height = height;
-}
-
-void RenderingThread::getDimensions(int& width, int& height) {
- android::Mutex::Autolock lock(m_sync);
- width = m_width;
- height = m_height;
-}
-
-void RenderingThread::printGLString(const char *name, GLenum s) {
- const char *v = (const char *) glGetString(s);
- gLogI.log(kError_ANPLogType, "GL %s = %s\n", name, v);
-}
-
-void RenderingThread::checkGlError(const char* op) {
- for (GLint error = glGetError(); error; error
- = glGetError()) {
- gLogI.log(kError_ANPLogType, "after %s() glError (0x%x)\n", op, error);
- }
-}
-
-GLenum RenderingThread::getInternalFormat(SkBitmap::Config config)
-{
- switch(config) {
- case SkBitmap::kA8_Config:
- return GL_ALPHA;
- case SkBitmap::kARGB_4444_Config:
- return GL_RGBA;
- case SkBitmap::kARGB_8888_Config:
- return GL_RGBA;
- case SkBitmap::kRGB_565_Config:
- return GL_RGB;
- default:
- return -1;
- }
-}
-
-GLenum RenderingThread::getType(SkBitmap::Config config)
-{
- switch(config) {
- case SkBitmap::kA8_Config:
- return GL_UNSIGNED_BYTE;
- case SkBitmap::kARGB_4444_Config:
- return GL_UNSIGNED_SHORT_4_4_4_4;
- case SkBitmap::kARGB_8888_Config:
- return GL_UNSIGNED_BYTE;
- case SkBitmap::kIndex8_Config:
- return -1; // No type for compressed data.
- case SkBitmap::kRGB_565_Config:
- return GL_UNSIGNED_SHORT_5_6_5;
- default:
- return -1;
- }
-}
-
-void RenderingThread::setupNativeWindow(ANativeWindow* ANW, const SkBitmap& bitmap)
-{
- int result = ANativeWindow_setBuffersGeometry(ANW, bitmap.width(),
- bitmap.height(), WINDOW_FORMAT_RGBA_8888);
-
- if (android::NO_ERROR != result) {
- gLogI.log(kError_ANPLogType, "ERROR setBuffersGeometry() status is (%d)", result);
- }
-
-#if (!USE_SOFTWARE_RENDERING)
- if (m_eglSurface != EGL_NO_SURFACE) {
- gLogI.log(kDebug_ANPLogType, "destroying old surface");
- eglDestroySurface(m_eglDisplay, m_eglSurface);
- }
-
- m_eglSurface = eglCreateWindowSurface(m_eglDisplay, m_eglConfig, ANW, NULL);
- checkGlError("eglCreateWindowSurface");
-
- eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext);
-
- //optional: enable async mode
- //eglSwapInterval(m_eglDisplay, 0);
-#endif
-
- updateNativeWindow(ANW, bitmap);
-}
-
-void RenderingThread::updateNativeWindow(ANativeWindow* ANW,
- const SkBitmap& bitmap)
-{
-#if USE_SOFTWARE_RENDERING
- if (bitmap.height() == 0 || bitmap.width() == 0)
- return;
-
- //STEP 1: lock the ANW, getting a buffer
- ANativeWindow_Buffer buffer;
- if (ANativeWindow_lock(ANW, &buffer, NULL) < 0 ) // todo: use rect parameter for efficiency
- return;
-
- //STEP 2: draw into the buffer
- uint8_t* img = (uint8_t*)buffer.bits;
- int row, col;
- int bpp = 4; // Here we only deal with RGBA8888 format.
- bitmap.lockPixels();
- uint8_t* bitmapOrigin = static_cast<uint8_t*>(bitmap.getPixels());
- // Copy line by line to handle offsets and stride
- for (row = 0 ; row < bitmap.height(); row ++) {
- uint8_t* dst = &(img[(buffer.stride * (row + 0) + 0) * bpp]);
- uint8_t* src = &(bitmapOrigin[bitmap.width() * row * bpp]);
- memcpy(dst, src, bpp * bitmap.width());
- }
- bitmap.unlockPixels();
-
- //STEP 3: push the buffer to the queue
- ANativeWindow_unlockAndPost(ANW);
-
-#else
-
- //rotate the intensity of the green channel, other channels fixed
- static int i = 0;
- i = (i >= 245) ? 0 : i+10;
-
- glClearColor(0.6, (i*1.0/256), 0.6, 0.6);
- glClear(GL_COLOR_BUFFER_BIT);
-
- eglSwapBuffers(m_eglDisplay, m_eglSurface);
-#endif
-}
-
diff --git a/samples/BrowserPlugin/jni/RenderingThread.h b/samples/BrowserPlugin/jni/RenderingThread.h
deleted file mode 100644
index 6136019bf..000000000
--- a/samples/BrowserPlugin/jni/RenderingThread.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "android_npapi.h"
-#include "SkCanvas.h"
-#include "SkBitmap.h"
-
-#include <utils/threads.h>
-#include <EGL/egl.h>
-#include <GLES2/gl2.h>
-
-#ifndef RenderingThread__DEFINED
-#define RenderingThread__DEFINED
-
-#define USE_SOFTWARE_RENDERING false
-#define MS_PER_FRAME 17 // approx 60 fps
-
-class RenderingThread : public android::Thread {
-public:
- RenderingThread(NPP npp);
- virtual ~RenderingThread() {};
- virtual android::status_t readyToRun();
-
- void setDimensions(int width, int height);
- void getDimensions(int& width, int& height);
-
-protected:
- NPP m_npp;
- ANativeWindow* m_ANW;
-
- static void printGLString(const char *name, GLenum s);
- static void checkGlError(const char* op);
- static GLenum getInternalFormat(SkBitmap::Config config);
- static GLenum getType(SkBitmap::Config config);
- void setupNativeWindow(ANativeWindow* ANW, const SkBitmap& bitmap);
- void updateNativeWindow(ANativeWindow* ANW, const SkBitmap& bitmap);
-
-private:
- virtual bool threadLoop() = 0;
-
- android::Mutex m_sync;
- int m_width;
- int m_height;
-
-#if (!USE_SOFTWARE_RENDERING)
- EGLDisplay m_eglDisplay;
- EGLSurface m_eglSurface;
- EGLContext m_eglContext;
- EGLConfig m_eglConfig;
-#endif
-};
-
-
-
-
-#endif // RenderingThread__DEFINED
diff --git a/samples/BrowserPlugin/jni/animation/AnimationPlugin.cpp b/samples/BrowserPlugin/jni/animation/AnimationPlugin.cpp
deleted file mode 100644
index f9af879db..000000000
--- a/samples/BrowserPlugin/jni/animation/AnimationPlugin.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright 2008, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "AnimationPlugin.h"
-
-#include <math.h>
-#include <string.h>
-
-extern NPNetscapeFuncs* browser;
-extern ANPLogInterfaceV0 gLogI;
-extern ANPCanvasInterfaceV0 gCanvasI;
-extern ANPPaintInterfaceV0 gPaintI;
-extern ANPPathInterfaceV0 gPathI;
-extern ANPSystemInterfaceV0 gSystemI;
-extern ANPWindowInterfaceV1 gWindowI;
-
-static uint16_t rnd16(float x, int inset) {
- int ix = (int)roundf(x) + inset;
- if (ix < 0) {
- ix = 0;
- }
- return static_cast<uint16_t>(ix);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-BallAnimation::BallAnimation(NPP inst) : SurfaceSubPlugin(inst) {
- //register for touch events
- ANPEventFlags flags = kTouch_ANPEventFlag;
- NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags);
- if (err != NPERR_NO_ERROR) {
- gLogI.log(kError_ANPLogType, "Error selecting input events.");
- }
-
- gLogI.log(kError_ANPLogType, "Starting Rendering Thread");
-
- //start a thread and do your drawing there
- m_renderingThread = new AnimationThread(inst);
- m_renderingThread->incStrong(inst);
- m_renderingThread->run("AnimationThread");
-}
-
-BallAnimation::~BallAnimation() {
- m_renderingThread->requestExitAndWait();
- destroySurface();
-}
-
-bool BallAnimation::supportsDrawingModel(ANPDrawingModel model) {
- return (model == kOpenGL_ANPDrawingModel);
-}
-
-jobject BallAnimation::getSurface() {
-
- if (m_surface) {
- return m_surface;
- }
-
- // load the appropriate java class and instantiate it
- JNIEnv* env = NULL;
- if (gVM->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
- gLogI.log(kError_ANPLogType, " ---- getSurface: failed to get env");
- return NULL;
- }
-
- const char* className = "com.android.sampleplugin.AnimationSurface";
- jclass fullScreenClass = gSystemI.loadJavaClass(inst(), className);
-
- if(!fullScreenClass) {
- gLogI.log(kError_ANPLogType, " ---- getSurface: failed to load class");
- return NULL;
- }
-
- jmethodID constructor = env->GetMethodID(fullScreenClass, "<init>", "(Landroid/content/Context;)V");
- jobject fullScreenSurface = env->NewObject(fullScreenClass, constructor, m_context);
-
- if(!fullScreenSurface) {
- gLogI.log(kError_ANPLogType, " ---- getSurface: failed to construct object");
- return NULL;
- }
-
- gLogI.log(kError_ANPLogType, " ---- object %p", fullScreenSurface);
-
- m_surface = env->NewGlobalRef(fullScreenSurface);
- return m_surface;
-}
-
-void BallAnimation::destroySurface() {
- JNIEnv* env = NULL;
- if (m_surface && gVM->GetEnv((void**) &env, JNI_VERSION_1_4) == JNI_OK) {
- env->DeleteGlobalRef(m_surface);
- m_surface = NULL;
- }
-}
-
-void BallAnimation::showEntirePluginOnScreen() {
- NPP instance = this->inst();
- PluginObject *obj = (PluginObject*) instance->pdata;
- NPWindow *window = obj->window;
-
- // log the current visible rect
- ANPRectI visibleRect = gWindowI.visibleRect(instance);
- gLogI.log(kDebug_ANPLogType, "Current VisibleRect: (%d,%d,%d,%d)",
- visibleRect.left, visibleRect.top, visibleRect.right, visibleRect.bottom);
-
- ANPRectI visibleRects[1];
-
- visibleRects[0].left = 0;
- visibleRects[0].top = 0;
- visibleRects[0].right = window->width;
- visibleRects[0].bottom = window->height;
-
- gWindowI.setVisibleRects(instance, visibleRects, 1);
- gWindowI.clearVisibleRects(instance);
-}
-
-int16_t BallAnimation::handleEvent(const ANPEvent* evt) {
- NPP instance = this->inst();
-
- switch (evt->eventType) {
- case kDraw_ANPEventType:
- switch (evt->data.draw.model) {
- case kOpenGL_ANPDrawingModel: {
- //send the width and height to the rendering thread
- int width = evt->data.draw.data.surface.width;
- int height = evt->data.draw.data.surface.height;
- gLogI.log(kError_ANPLogType, "New Dimensions (%d,%d)", width, height);
- m_renderingThread->setDimensions(width, height);
- return 1;
- }
- default:
- return 0; // unknown drawing model
- }
- case kTouch_ANPEventType:
- if (kDown_ANPTouchAction == evt->data.touch.action) {
- showEntirePluginOnScreen();
- }
- else if (kDoubleTap_ANPTouchAction == evt->data.touch.action) {
- browser->geturl(inst(), "javascript:alert('Detected double tap event.')", 0);
- gWindowI.requestFullScreen(inst());
- }
- return 1;
- default:
- break;
- }
- return 0; // unknown or unhandled event
-}
diff --git a/samples/BrowserPlugin/jni/animation/AnimationPlugin.h b/samples/BrowserPlugin/jni/animation/AnimationPlugin.h
deleted file mode 100644
index 870b67c22..000000000
--- a/samples/BrowserPlugin/jni/animation/AnimationPlugin.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "PluginObject.h"
-#include "AnimationThread.h"
-
-#ifndef pluginGraphics__DEFINED
-#define pluginGraphics__DEFINED
-
-class BallAnimation : public SurfaceSubPlugin {
-public:
- BallAnimation(NPP inst);
- virtual ~BallAnimation();
- virtual bool supportsDrawingModel(ANPDrawingModel);
- virtual int16_t handleEvent(const ANPEvent* evt);
-
- virtual jobject getSurface();
-private:
- void showEntirePluginOnScreen();
- void destroySurface();
-
- jobject m_surface;
- AnimationThread* m_renderingThread;
-};
-
-#endif // pluginGraphics__DEFINED
diff --git a/samples/BrowserPlugin/jni/animation/AnimationThread.cpp b/samples/BrowserPlugin/jni/animation/AnimationThread.cpp
deleted file mode 100644
index 2729a532f..000000000
--- a/samples/BrowserPlugin/jni/animation/AnimationThread.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "AnimationThread.h"
-
-#include <utils/SystemClock.h>
-#include "ANPNativeWindow_npapi.h"
-
-extern ANPLogInterfaceV0 gLogI;
-extern ANPNativeWindowInterfaceV0 gNativeWindowI;
-
-AnimationThread::AnimationThread(NPP npp) : RenderingThread(npp) {
- m_counter = 0;
- m_lastPrintTime = android::uptimeMillis();
- m_executionTime = 0;
- m_idleTime = 0;
-
- m_x = m_y = 0;
- m_dx = 0;
- m_dy = 0;
-
- memset(&m_oval, 0, sizeof(m_oval));
-
- m_paint = new SkPaint;
- m_paint->setAntiAlias(true);
-
- m_bitmap = constructBitmap(0, 0);
- m_canvas = new SkCanvas(*m_bitmap);
-
- m_startExecutionTime = 0;
- m_startTime = android::uptimeMillis();
- m_stallTime = android::uptimeMillis();
-
-}
-
-AnimationThread::~AnimationThread() {
- delete m_paint;
- delete m_canvas;
- delete m_bitmap;
-}
-
-SkBitmap* AnimationThread::constructBitmap(int width, int height) {
- SkBitmap* bitmap = new SkBitmap;
- bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height);
- bitmap->allocPixels();
- bitmap->eraseColor(0x00000000);
- return bitmap;
-}
-
-static void bounce(float* x, float* dx, const float max) {
- *x += *dx;
- if (*x < 0) {
- *x = 0;
- if (*dx < 0) {
- *dx = -*dx;
- }
- } else if (*x > max) {
- *x = max;
- if (*dx > 0) {
- *dx = -*dx;
- }
- }
-}
-
-bool AnimationThread::threadLoop() {
- if (android::uptimeMillis() - m_stallTime < MS_PER_FRAME)
- return true;
- m_stallTime = android::uptimeMillis();
-
- m_idleTime += android::uptimeMillis() - m_startIdleTime;
- m_startExecutionTime = android::uptimeMillis();
-
- bool reCreateFlag = false;
- int width, height;
- getDimensions(width, height);
-
- if (m_bitmap->width() != width || m_bitmap->height() != height) {
- delete m_canvas;
- delete m_bitmap;
- m_bitmap = constructBitmap(width, height);
- m_canvas = new SkCanvas(*m_bitmap);
-
- // change the ball's speed to match the size
- m_dx = width * .005f;
- m_dy = height * .007f;
- reCreateFlag = true;
- }
-
- // setup variables
- const float OW = width * .125f;
- const float OH = height * .125f;
-
- // clear the old oval
- m_bitmap->eraseColor(0x880000FF);
-
- // update the coordinates of the oval
- bounce(&m_x, &m_dx, width - OW);
- bounce(&m_y, &m_dy, height - OH);
-
- // draw the new oval
- m_oval.fLeft = m_x;
- m_oval.fTop = m_y;
- m_oval.fRight = m_x + OW;
- m_oval.fBottom = m_y + OH;
- m_paint->setColor(0xAAFF0000);
- m_canvas->drawOval(m_oval, *m_paint);
-
- if (!reCreateFlag) {
- updateNativeWindow(m_ANW, *m_bitmap);
- } else {
- setupNativeWindow(m_ANW, *m_bitmap);
- }
-
- m_executionTime += android::uptimeMillis() - m_startExecutionTime;
- m_counter++;
-
- if (android::uptimeMillis() - m_lastPrintTime > 5000) {
- float fps = m_counter / ((android::uptimeMillis() - m_startTime) / 1000);
- float spf = ((android::uptimeMillis() - m_startTime)) / m_counter;
- float lpf = (m_idleTime) / m_counter;
- float exe = (m_executionTime) / m_counter;
- gLogI.log(kError_ANPLogType, "TEXT: counter(%d) fps(%f) spf(%f) lock(%f) execution(%f)\n", (int)m_counter, fps, spf, lpf, exe);
- m_lastPrintTime = android::uptimeMillis();
-
- m_counter = 0;
- m_executionTime = 0;
- m_idleTime = 0;
- m_startExecutionTime = 0;
- m_startTime = android::uptimeMillis();
- }
-
- m_startIdleTime = android::uptimeMillis(); // count delay between frames
- return true;
-}
diff --git a/samples/BrowserPlugin/jni/animation/AnimationThread.h b/samples/BrowserPlugin/jni/animation/AnimationThread.h
deleted file mode 100644
index 8222a7ee2..000000000
--- a/samples/BrowserPlugin/jni/animation/AnimationThread.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "RenderingThread.h"
-#include "SkCanvas.h"
-#include "SkBitmap.h"
-#include "SkRect.h"
-#include "SkPaint.h"
-
-#ifndef AnimationThread__DEFINED
-#define AnimationThread__DEFINED
-
-class AnimationThread : public RenderingThread {
-public:
- AnimationThread(NPP npp);
- virtual ~AnimationThread();
-
-private:
- virtual bool threadLoop();
- SkBitmap* constructBitmap(int width, int height);
-
- float m_counter;
-
- int64_t m_lastPrintTime;
- int64_t m_executionTime;
- int64_t m_idleTime;
- int64_t m_startTime;
- int64_t m_startExecutionTime;
- int64_t m_startIdleTime;
- int64_t m_stallTime;
-
- float m_x;
- float m_y;
- float m_dx;
- float m_dy;
-
- SkRect m_oval;
- SkPaint* m_paint;
- SkBitmap* m_bitmap;
- SkCanvas* m_canvas;
-};
-
-
-
-#endif // AnimationThread__DEFINED
diff --git a/samples/BrowserPlugin/jni/audio/AudioPlugin.cpp b/samples/BrowserPlugin/jni/audio/AudioPlugin.cpp
deleted file mode 100644
index 8defef4d0..000000000
--- a/samples/BrowserPlugin/jni/audio/AudioPlugin.cpp
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * Copyright 2008, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "AudioPlugin.h"
-
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <time.h>
-#include <math.h>
-#include <string.h>
-
-extern NPNetscapeFuncs* browser;
-extern ANPLogInterfaceV0 gLogI;
-extern ANPCanvasInterfaceV0 gCanvasI;
-extern ANPPaintInterfaceV0 gPaintI;
-extern ANPAudioTrackInterfaceV0 gSoundI;
-extern ANPTypefaceInterfaceV0 gTypefaceI;
-
-
-static void inval(NPP instance) {
- browser->invalidaterect(instance, NULL);
-}
-
-static uint16_t rnd16(float x, int inset) {
- int ix = (int)roundf(x) + inset;
- if (ix < 0) {
- ix = 0;
- }
- return static_cast<uint16_t>(ix);
-}
-
-static void inval(NPP instance, const ANPRectF& r, bool doAA) {
- const int inset = doAA ? -1 : 0;
-
- PluginObject *obj = reinterpret_cast<PluginObject*>(instance->pdata);
- NPRect inval;
- inval.left = rnd16(r.left, inset);
- inval.top = rnd16(r.top, inset);
- inval.right = rnd16(r.right, -inset);
- inval.bottom = rnd16(r.bottom, -inset);
- browser->invalidaterect(instance, &inval);
-}
-
-static void audioCallback(ANPAudioEvent evt, void* user, ANPAudioBuffer* buffer) {
- switch (evt) {
- case kMoreData_ANPAudioEvent: {
- SoundPlay* play = reinterpret_cast<SoundPlay*>(user);
- size_t amount = fread(buffer->bufferData, 1, buffer->size, play->file);
- buffer->size = amount;
- if (amount == 0) {
- gSoundI.stop(play->track);
- fclose(play->file);
- play->file = NULL;
- // TODO need to notify our main thread to delete the track now
- }
-
- if (play->fileSize > 0) {
- // TODO we need to properly update the progress value
- play->progress = 1;
- inval(play->instance);
- }
-
-
- break;
- }
- default:
- break;
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-AudioPlugin::AudioPlugin(NPP inst) : SubPlugin(inst) {
-
- const char path[] = "/sdcard/sample.raw";
-
- // open a file stream
- FILE* f = fopen(path, "r");
- gLogI.log(kDebug_ANPLogType, "--- path %s FILE %p", path, f);
-
- // setup our private audio struct's default values
- m_soundPlay = new SoundPlay;
- m_soundPlay->instance = inst;
- m_soundPlay->progress = 0;
- m_soundPlay->fileSize = 0;
- m_soundPlay->file = f;
- m_soundPlay->track = NULL;
-
- // create the audio track
- if (f) {
- m_soundPlay->track = gSoundI.newTrack(44100, kPCM16Bit_ANPSampleFormat, 2, audioCallback, m_soundPlay);
- if (!m_soundPlay->track) {
- fclose(f);
- m_soundPlay->file = NULL;
- }
- }
-
- // get the audio file's size
- int fileDescriptor = open(path, O_RDONLY);
- struct stat fileStatus;
-
- if(fileDescriptor <= 0) {
- gLogI.log(kError_ANPLogType, "fopen error");
- }
- else if (fstat(fileDescriptor, &fileStatus) != 0) {
- gLogI.log(kDebug_ANPLogType, "File Size: %d", fileStatus.st_size);
- m_soundPlay->fileSize = fileStatus.st_size;
- } else {
- gLogI.log(kError_ANPLogType, "fstat error");
- }
-
- // configure the UI elements
- m_activeTouch = false;
-
- memset(&m_trackRect, 0, sizeof(m_trackRect));
- memset(&m_playRect, 0, sizeof(m_playRect));
- memset(&m_pauseRect, 0, sizeof(m_pauseRect));
- memset(&m_stopRect, 0, sizeof(m_stopRect));
-
- m_paintTrack = gPaintI.newPaint();
- gPaintI.setFlags(m_paintTrack, gPaintI.getFlags(m_paintTrack) | kAntiAlias_ANPPaintFlag);
- gPaintI.setColor(m_paintTrack, 0xFFC0C0C0);
-
- m_paintRect = gPaintI.newPaint();
- gPaintI.setFlags(m_paintRect, gPaintI.getFlags(m_paintRect) | kAntiAlias_ANPPaintFlag);
- gPaintI.setColor(m_paintRect, 0xFFA8A8A8);
-
- m_paintText = gPaintI.newPaint();
- gPaintI.setFlags(m_paintText, gPaintI.getFlags(m_paintText) | kAntiAlias_ANPPaintFlag);
- gPaintI.setColor(m_paintText, 0xFF2F4F4F);
- gPaintI.setTextSize(m_paintText, 18);
-
- m_paintTrackProgress = gPaintI.newPaint();
- gPaintI.setFlags(m_paintTrackProgress, gPaintI.getFlags(m_paintTrackProgress) | kAntiAlias_ANPPaintFlag);
- gPaintI.setColor(m_paintTrackProgress, 0xFF545454);
-
- m_paintActiveRect = gPaintI.newPaint();
- gPaintI.setFlags(m_paintActiveRect, gPaintI.getFlags(m_paintActiveRect) | kAntiAlias_ANPPaintFlag);
- gPaintI.setColor(m_paintActiveRect, 0xFF545454);
-
- ANPTypeface* tf = gTypefaceI.createFromName("serif", kItalic_ANPTypefaceStyle);
- gPaintI.setTypeface(m_paintText, tf);
- gTypefaceI.unref(tf);
-
- //register for touch events
- ANPEventFlags flags = kTouch_ANPEventFlag;
- NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags);
- if (err != NPERR_NO_ERROR) {
- gLogI.log(kError_ANPLogType, "Error selecting input events.");
- }
-}
-
-AudioPlugin::~AudioPlugin() {
- gPaintI.deletePaint(m_paintTrack);
- gPaintI.deletePaint(m_paintRect);
- gPaintI.deletePaint(m_paintText);
- gPaintI.deletePaint(m_paintTrackProgress);
- gPaintI.deletePaint(m_paintActiveRect);
- if(m_soundPlay->track)
- gSoundI.deleteTrack(m_soundPlay->track);
- delete m_soundPlay;
-}
-
-bool AudioPlugin::supportsDrawingModel(ANPDrawingModel model) {
- return (model == kBitmap_ANPDrawingModel);
-}
-
-void AudioPlugin::drawPlugin(const ANPBitmap& bitmap, const ANPRectI& clip) {
- ANPCanvas* canvas = gCanvasI.newCanvas(&bitmap);
-
- ANPRectF clipR;
- clipR.left = clip.left;
- clipR.top = clip.top;
- clipR.right = clip.right;
- clipR.bottom = clip.bottom;
- gCanvasI.clipRect(canvas, &clipR);
-
- draw(canvas);
- gCanvasI.deleteCanvas(canvas);
-}
-
-void AudioPlugin::draw(ANPCanvas* canvas) {
-
- PluginObject *obj = (PluginObject*) this->inst()->pdata;
-
- gLogI.log(kError_ANPLogType, "Drawing");
-
- const float trackHeight = 30;
- const float buttonWidth = 60;
- const float buttonHeight = 30;
- const int W = obj->window->width;
- const int H = obj->window->height;
-
- // color the plugin canvas
- gCanvasI.drawColor(canvas, 0xFFCDCDCD);
-
- // get font metrics
- ANPFontMetrics fontMetrics;
- gPaintI.getFontMetrics(m_paintText, &fontMetrics);
-
- // draw the track box (1 px from the edge)
- m_trackRect.left = 1;
- m_trackRect.top = 1;
- m_trackRect.right = W - 2;
- m_trackRect.bottom = 1 + trackHeight;
- gCanvasI.drawRect(canvas, &m_trackRect, m_paintTrack);
-
- // draw the progress bar
- if (m_soundPlay->progress > 0) {
- // TODO need to draw progress bar to cover the proper percentage of the track bar
- gCanvasI.drawRect(canvas, &m_trackRect, m_paintTrackProgress);
- }
-
- // draw the play box (under track box)
- m_playRect.left = m_trackRect.left + 5;
- m_playRect.top = m_trackRect.bottom + 10;
- m_playRect.right = m_playRect.left + buttonWidth;
- m_playRect.bottom = m_playRect.top + buttonHeight;
- gCanvasI.drawRect(canvas, &m_playRect, getPaint(&m_playRect));
- // draw the play box (under track box)
- const char playText[] = "Play";
- gCanvasI.drawText(canvas, playText, sizeof(playText)-1, m_playRect.left + 5,
- m_playRect.top - fontMetrics.fTop, m_paintText);
-
- // draw the pause box (under track box)
- m_pauseRect.left = m_playRect.right + 20;
- m_pauseRect.top = m_trackRect.bottom + 10;
- m_pauseRect.right = m_pauseRect.left + buttonWidth;
- m_pauseRect.bottom = m_pauseRect.top + buttonHeight;
- gCanvasI.drawRect(canvas, &m_pauseRect, getPaint(&m_pauseRect));
- // draw the text in the pause box
- const char pauseText[] = "Pause";
- gCanvasI.drawText(canvas, pauseText, sizeof(pauseText)-1, m_pauseRect.left + 5,
- m_pauseRect.top - fontMetrics.fTop, m_paintText);
-
- // draw the stop box (under track box)
- m_stopRect.left = m_pauseRect.right + 20;
- m_stopRect.top = m_trackRect.bottom + 10;
- m_stopRect.right = m_stopRect.left + buttonWidth;
- m_stopRect.bottom = m_stopRect.top + buttonHeight;
- gCanvasI.drawRect(canvas, &m_stopRect, getPaint(&m_stopRect));
- // draw the text in the pause box
- const char stopText[] = "Stop";
- gCanvasI.drawText(canvas, stopText, sizeof(stopText)-1, m_stopRect.left + 5,
- m_stopRect.top - fontMetrics.fTop, m_paintText);
-}
-
-ANPPaint* AudioPlugin::getPaint(ANPRectF* input) {
- return (input == m_activeRect) ? m_paintActiveRect : m_paintRect;
-}
-
-int16_t AudioPlugin::handleEvent(const ANPEvent* evt) {
- NPP instance = this->inst();
-
- switch (evt->eventType) {
- case kDraw_ANPEventType:
- switch (evt->data.draw.model) {
- case kBitmap_ANPDrawingModel:
- drawPlugin(evt->data.draw.data.bitmap, evt->data.draw.clip);
- return 1;
- default:
- break; // unknown drawing model
- }
-
- case kTouch_ANPEventType: {
- int x = evt->data.touch.x;
- int y = evt->data.touch.y;
- if (kDown_ANPTouchAction == evt->data.touch.action) {
-
- m_activeTouchRect = validTouch(x,y);
- if(m_activeTouchRect) {
- m_activeTouch = true;
- return 1;
- }
-
- } else if (kUp_ANPTouchAction == evt->data.touch.action && m_activeTouch) {
- handleTouch(x, y);
- m_activeTouch = false;
- return 1;
- } else if (kCancel_ANPTouchAction == evt->data.touch.action) {
- m_activeTouch = false;
- }
- break;
- }
- default:
- break;
- }
- return 0; // unknown or unhandled event
-}
-
-void AudioPlugin::invalActiveRect() {
-
-}
-
-ANPRectF* AudioPlugin::validTouch(int x, int y) {
-
- if (m_playRect.left && x < m_playRect.right && y > m_playRect.top && y < m_playRect.bottom)
- return &m_playRect;
- else if (m_pauseRect.left && x < m_pauseRect.right && y > m_pauseRect.top && y < m_pauseRect.bottom)
- return &m_pauseRect;
- else if (x > m_stopRect.left && x < m_stopRect.right && y > m_stopRect.top && y < m_stopRect.bottom)
- return &m_stopRect;
- else
- return NULL;
-}
-
-void AudioPlugin::handleTouch(int x, int y) {
- NPP instance = this->inst();
-
- // if the track is null then return
- if (NULL == m_soundPlay->track) {
- gLogI.log(kError_ANPLogType, "---- %p unable to create track",
- instance);
- return;
- }
-
- // check to make sure the currentRect matches the activeRect
- ANPRectF* currentRect = validTouch(x,y);
- if (m_activeTouchRect != currentRect)
- return;
-
- if (currentRect == &m_playRect) {
-
- gLogI.log(kDebug_ANPLogType, "---- %p starting track (%d)",
- m_soundPlay->track, gSoundI.isStopped(m_soundPlay->track));
-
- if (gSoundI.isStopped(m_soundPlay->track)) {
- gSoundI.start(m_soundPlay->track);
- }
- }
- else if (currentRect == &m_pauseRect) {
-
- gLogI.log(kDebug_ANPLogType, "---- %p pausing track (%d)",
- m_soundPlay->track, gSoundI.isStopped(m_soundPlay->track));
-
- if (!gSoundI.isStopped(m_soundPlay->track)) {
- gSoundI.pause(m_soundPlay->track);
- }
- }
- else if (currentRect == &m_stopRect) {
-
- gLogI.log(kDebug_ANPLogType, "---- %p stopping track (%d)",
- m_soundPlay->track, gSoundI.isStopped(m_soundPlay->track));
-
- if (!gSoundI.isStopped(m_soundPlay->track)) {
- gSoundI.stop(m_soundPlay->track);
- }
- if (m_soundPlay->file) {
- fseek(m_soundPlay->file, 0, SEEK_SET);
- }
- }
- else {
- return;
- }
-
- // set the currentRect to be the activeRect
- m_activeRect = currentRect;
- inval(instance);
-}
diff --git a/samples/BrowserPlugin/jni/audio/AudioPlugin.h b/samples/BrowserPlugin/jni/audio/AudioPlugin.h
deleted file mode 100644
index 0f88a9206..000000000
--- a/samples/BrowserPlugin/jni/audio/AudioPlugin.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2008, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "PluginObject.h"
-#include <stdio.h>
-
-#ifndef audioPlugin__DEFINED
-#define audioPlugin__DEFINED
-
-struct SoundPlay {
- NPP instance;
- ANPAudioTrack* track;
- FILE* file;
- int fileSize;
- int progress; // value between 0 and 100
-};
-
-class AudioPlugin : public SubPlugin {
-public:
- AudioPlugin(NPP inst);
- virtual ~AudioPlugin();
- virtual bool supportsDrawingModel(ANPDrawingModel);
- virtual int16_t handleEvent(const ANPEvent* evt);
-private:
- void draw(ANPCanvas*);
- void drawPlugin(const ANPBitmap& bitmap, const ANPRectI& clip);
-
- void handleTouch(int x, int y);
- void invalActiveRect();
- ANPPaint* getPaint(ANPRectF*);
- ANPRectF* validTouch(int x, int y);
-
- ANPRectF m_trackRect;
- ANPRectF m_playRect;
- ANPRectF m_pauseRect;
- ANPRectF m_stopRect;
-
- ANPPaint* m_paintTrack;
- ANPPaint* m_paintRect;
- ANPPaint* m_paintText;
-
- ANPPaint* m_paintTrackProgress;
- ANPPaint* m_paintActiveRect;
-
- SoundPlay* m_soundPlay;
-
- bool m_activeTouch;
- ANPRectF* m_activeTouchRect;
- ANPRectF* m_activeRect;
-};
-
-#endif // audioPlugin__DEFINED
diff --git a/samples/BrowserPlugin/jni/background/BackgroundPlugin.cpp b/samples/BrowserPlugin/jni/background/BackgroundPlugin.cpp
deleted file mode 100644
index 515acbe58..000000000
--- a/samples/BrowserPlugin/jni/background/BackgroundPlugin.cpp
+++ /dev/null
@@ -1,499 +0,0 @@
-/*
- * Copyright 2008, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "BackgroundPlugin.h"
-#include "android_npapi.h"
-
-#include <stdio.h>
-#include <sys/time.h>
-#include <time.h>
-#include <math.h>
-#include <string.h>
-
-extern NPNetscapeFuncs* browser;
-extern ANPBitmapInterfaceV0 gBitmapI;
-extern ANPCanvasInterfaceV0 gCanvasI;
-extern ANPLogInterfaceV0 gLogI;
-extern ANPPaintInterfaceV0 gPaintI;
-extern ANPSurfaceInterfaceV0 gSurfaceI;
-extern ANPSystemInterfaceV0 gSystemI;
-extern ANPTypefaceInterfaceV0 gTypefaceI;
-extern ANPWindowInterfaceV0 gWindowI;
-
-#define ARRAY_COUNT(array) (sizeof(array) / sizeof(array[0]))
-
-static uint32_t getMSecs() {
- struct timeval tv;
- gettimeofday(&tv, NULL);
- return (uint32_t) (tv.tv_sec * 1000 + tv.tv_usec / 1000 ); // microseconds to milliseconds
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-BackgroundPlugin::BackgroundPlugin(NPP inst) : SurfaceSubPlugin(inst) {
-
- // initialize the drawing surface
- m_surface = NULL;
-
- //initialize bitmap transparency variables
- mFinishedStageOne = false;
- mFinishedStageTwo = false;
- mFinishedStageThree = false;
-
- // test basic plugin functionality
- test_logging(); // android logging
- test_timers(); // plugin timers
- test_bitmaps(); // android bitmaps
- test_domAccess();
- test_javascript();
- test_loadJavaClass();
-
- //register for touch events
- ANPEventFlags flags = kTouch_ANPEventFlag;
- NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags);
- if (err != NPERR_NO_ERROR) {
- gLogI.log(kError_ANPLogType, "Error selecting input events.");
- }
-}
-
-BackgroundPlugin::~BackgroundPlugin() {
- setContext(NULL);
- destroySurface();
-}
-
-jobject BackgroundPlugin::getSurface() {
-
- if (m_surface) {
- return m_surface;
- }
-
- // load the appropriate java class and instantiate it
- JNIEnv* env = NULL;
- if (gVM->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
- gLogI.log(kError_ANPLogType, " ---- getSurface: failed to get env");
- return NULL;
- }
-
- const char* className = "com.android.sampleplugin.BackgroundSurface";
- jclass backgroundClass = gSystemI.loadJavaClass(inst(), className);
-
- if(!backgroundClass) {
- gLogI.log(kError_ANPLogType, " ---- getSurface: failed to load class");
- return NULL;
- }
-
- jmethodID constructor = env->GetMethodID(backgroundClass, "<init>", "(Landroid/content/Context;)V");
- jobject backgroundSurface = env->NewObject(backgroundClass, constructor, m_context);
-
- if(!backgroundSurface) {
- gLogI.log(kError_ANPLogType, " ---- getSurface: failed to construct object");
- return NULL;
- }
-
- m_surface = env->NewGlobalRef(backgroundSurface);
- return m_surface;
-}
-
-void BackgroundPlugin::destroySurface() {
- JNIEnv* env = NULL;
- if (m_surface && gVM->GetEnv((void**) &env, JNI_VERSION_1_4) == JNI_OK) {
- env->DeleteGlobalRef(m_surface);
- m_surface = NULL;
- }
-}
-
-void BackgroundPlugin::drawPlugin(int surfaceWidth, int surfaceHeight) {
-
- // get the plugin's dimensions according to the DOM
- PluginObject *obj = (PluginObject*) inst()->pdata;
- const int W = obj->window->width;
- const int H = obj->window->height;
-
- // compute the current zoom level
- const float zoomFactorW = static_cast<float>(surfaceWidth) / W;
- const float zoomFactorH = static_cast<float>(surfaceHeight) / H;
-
- // check to make sure the zoom level is uniform
- if (zoomFactorW + .01 < zoomFactorH && zoomFactorW - .01 > zoomFactorH)
- gLogI.log(kError_ANPLogType, " ------ %p zoom is out of sync (%f,%f)",
- inst(), zoomFactorW, zoomFactorH);
-
- // scale the variables based on the zoom level
- const int fontSize = (int)(zoomFactorW * 16);
- const int leftMargin = (int)(zoomFactorW * 10);
-
- // lock the surface
- ANPBitmap bitmap;
- JNIEnv* env = NULL;
- if (!m_surface || gVM->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK ||
- !gSurfaceI.lock(env, m_surface, &bitmap, NULL)) {
- gLogI.log(kError_ANPLogType, " ------ %p unable to lock the plugin", inst());
- return;
- }
-
- // create a canvas
- ANPCanvas* canvas = gCanvasI.newCanvas(&bitmap);
- gCanvasI.drawColor(canvas, 0xFFFFFFFF);
-
- ANPPaint* paint = gPaintI.newPaint();
- gPaintI.setFlags(paint, gPaintI.getFlags(paint) | kAntiAlias_ANPPaintFlag);
- gPaintI.setColor(paint, 0xFFFF0000);
- gPaintI.setTextSize(paint, fontSize);
-
- ANPTypeface* tf = gTypefaceI.createFromName("serif", kItalic_ANPTypefaceStyle);
- gPaintI.setTypeface(paint, tf);
- gTypefaceI.unref(tf);
-
- ANPFontMetrics fm;
- gPaintI.getFontMetrics(paint, &fm);
-
- gPaintI.setColor(paint, 0xFF0000FF);
- const char c[] = "This is a background plugin.";
- gCanvasI.drawText(canvas, c, sizeof(c)-1, leftMargin, -fm.fTop, paint);
-
- // clean up variables and unlock the surface
- gPaintI.deletePaint(paint);
- gCanvasI.deleteCanvas(canvas);
- gSurfaceI.unlock(env, m_surface);
-}
-
-int16_t BackgroundPlugin::handleEvent(const ANPEvent* evt) {
- switch (evt->eventType) {
- case kDraw_ANPEventType:
- gLogI.log(kError_ANPLogType, " ------ %p the plugin did not request draw events", inst());
- break;
- case kLifecycle_ANPEventType:
- switch (evt->data.lifecycle.action) {
- case kOnLoad_ANPLifecycleAction:
- gLogI.log(kDebug_ANPLogType, " ------ %p onLoad", inst());
- return 1;
- case kOnScreen_ANPLifecycleAction:
- gLogI.log(kDebug_ANPLogType, " ------ %p onScreen", inst());
- return 1;
- case kOffScreen_ANPLifecycleAction:
- gLogI.log(kDebug_ANPLogType, " ------ %p offScreen", inst());
- return 1;
- }
- break; // end kLifecycle_ANPEventType
- case kTouch_ANPEventType:
- if (kLongPress_ANPTouchAction == evt->data.touch.action) {
- browser->geturl(inst(), "javascript:alert('Detected long press event.')", 0);
- gWindowI.requestFullScreen(inst());
- }
- else if (kDoubleTap_ANPTouchAction == evt->data.touch.action)
- browser->geturl(inst(), "javascript:alert('Detected double tap event.')", 0);
- break;
- case kKey_ANPEventType:
- gLogI.log(kError_ANPLogType, " ------ %p the plugin did not request key events", inst());
- break;
- default:
- break;
- }
- return 0; // unknown or unhandled event
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// LOGGING TESTS
-///////////////////////////////////////////////////////////////////////////////
-
-
-void BackgroundPlugin::test_logging() {
- NPP instance = this->inst();
-
- //LOG_ERROR(instance, " ------ %p Testing Log Error", instance);
- gLogI.log(kError_ANPLogType, " ------ %p Testing Log Error", instance);
- gLogI.log(kWarning_ANPLogType, " ------ %p Testing Log Warning", instance);
- gLogI.log(kDebug_ANPLogType, " ------ %p Testing Log Debug", instance);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// TIMER TESTS
-///////////////////////////////////////////////////////////////////////////////
-
-#define TIMER_INTERVAL 50
-static void timer_oneshot(NPP instance, uint32_t timerID);
-static void timer_repeat(NPP instance, uint32_t timerID);
-static void timer_neverfires(NPP instance, uint32_t timerID);
-static void timer_latency(NPP instance, uint32_t timerID);
-
-void BackgroundPlugin::test_timers() {
- NPP instance = this->inst();
-
- //Setup the testing counters
- mTimerRepeatCount = 5;
- mTimerLatencyCount = 5;
-
- // test for bogus timerID
- browser->unscheduletimer(instance, 999999);
- // test one-shot
- browser->scheduletimer(instance, 100, false, timer_oneshot);
- // test repeat
- browser->scheduletimer(instance, 50, true, timer_repeat);
- // test timer latency
- browser->scheduletimer(instance, TIMER_INTERVAL, true, timer_latency);
- mStartTime = mPrevTime = getMSecs();
- // test unschedule immediately
- uint32_t id = browser->scheduletimer(instance, 100, false, timer_neverfires);
- browser->unscheduletimer(instance, id);
- // test double unschedule (should be no-op)
- browser->unscheduletimer(instance, id);
-
-}
-
-static void timer_oneshot(NPP instance, uint32_t timerID) {
- gLogI.log(kDebug_ANPLogType, "-------- oneshot timer\n");
-}
-
-static void timer_repeat(NPP instance, uint32_t timerID) {
- BackgroundPlugin *obj = ((BackgroundPlugin*) ((PluginObject*) instance->pdata)->activePlugin);
-
- gLogI.log(kDebug_ANPLogType, "-------- repeat timer %d\n",
- obj->mTimerRepeatCount);
- if (--obj->mTimerRepeatCount == 0) {
- browser->unscheduletimer(instance, timerID);
- }
-}
-
-static void timer_neverfires(NPP instance, uint32_t timerID) {
- gLogI.log(kError_ANPLogType, "-------- timer_neverfires!!!\n");
-}
-
-static void timer_latency(NPP instance, uint32_t timerID) {
- BackgroundPlugin *obj = ((BackgroundPlugin*) ((PluginObject*) instance->pdata)->activePlugin);
-
- obj->mTimerLatencyCurrentCount += 1;
-
- uint32_t now = getMSecs();
- uint32_t interval = now - obj->mPrevTime;
- uint32_t dur = now - obj->mStartTime;
- uint32_t expectedDur = obj->mTimerLatencyCurrentCount * TIMER_INTERVAL;
- int32_t drift = dur - expectedDur;
- int32_t avgDrift = drift / obj->mTimerLatencyCurrentCount;
-
- obj->mPrevTime = now;
-
- gLogI.log(kDebug_ANPLogType,
- "-------- latency test: [%3d] interval %d expected %d, total %d expected %d, drift %d avg %d\n",
- obj->mTimerLatencyCurrentCount, interval, TIMER_INTERVAL, dur,
- expectedDur, drift, avgDrift);
-
- if (--obj->mTimerLatencyCount == 0) {
- browser->unscheduletimer(instance, timerID);
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// BITMAP TESTS
-///////////////////////////////////////////////////////////////////////////////
-
-static void test_formats(NPP instance);
-
-void BackgroundPlugin::test_bitmaps() {
- test_formats(this->inst());
-}
-
-static void test_formats(NPP instance) {
-
- // TODO pull names from enum in npapi instead of hardcoding them
- static const struct {
- ANPBitmapFormat fFormat;
- const char* fName;
- } gRecs[] = {
- { kUnknown_ANPBitmapFormat, "unknown" },
- { kRGBA_8888_ANPBitmapFormat, "8888" },
- { kRGB_565_ANPBitmapFormat, "565" },
- };
-
- ANPPixelPacking packing;
- for (size_t i = 0; i < ARRAY_COUNT(gRecs); i++) {
- if (gBitmapI.getPixelPacking(gRecs[i].fFormat, &packing)) {
- gLogI.log(kDebug_ANPLogType,
- "pixel format [%d] %s has packing ARGB [%d %d] [%d %d] [%d %d] [%d %d]\n",
- gRecs[i].fFormat, gRecs[i].fName,
- packing.AShift, packing.ABits,
- packing.RShift, packing.RBits,
- packing.GShift, packing.GBits,
- packing.BShift, packing.BBits);
- } else {
- gLogI.log(kDebug_ANPLogType,
- "pixel format [%d] %s has no packing\n",
- gRecs[i].fFormat, gRecs[i].fName);
- }
- }
-}
-
-void BackgroundPlugin::test_bitmap_transparency(const ANPEvent* evt) {
- NPP instance = this->inst();
-
- // check default & set transparent
- if (!mFinishedStageOne) {
-
- gLogI.log(kDebug_ANPLogType, "BEGIN: testing bitmap transparency");
-
- //check to make sure it is not transparent
- if (evt->data.draw.data.bitmap.format == kRGBA_8888_ANPBitmapFormat) {
- gLogI.log(kError_ANPLogType, "bitmap default format is transparent");
- }
-
- //make it transparent (any non-null value will set it to true)
- bool value = true;
- NPError err = browser->setvalue(instance, NPPVpluginTransparentBool, &value);
- if (err != NPERR_NO_ERROR) {
- gLogI.log(kError_ANPLogType, "Error setting transparency.");
- }
-
- mFinishedStageOne = true;
- browser->invalidaterect(instance, NULL);
- }
- // check transparent & set opaque
- else if (!mFinishedStageTwo) {
-
- //check to make sure it is transparent
- if (evt->data.draw.data.bitmap.format != kRGBA_8888_ANPBitmapFormat) {
- gLogI.log(kError_ANPLogType, "bitmap did not change to transparent format");
- }
-
- //make it opaque
- NPError err = browser->setvalue(instance, NPPVpluginTransparentBool, NULL);
- if (err != NPERR_NO_ERROR) {
- gLogI.log(kError_ANPLogType, "Error setting transparency.");
- }
-
- mFinishedStageTwo = true;
- }
- // check opaque
- else if (!mFinishedStageThree) {
-
- //check to make sure it is not transparent
- if (evt->data.draw.data.bitmap.format == kRGBA_8888_ANPBitmapFormat) {
- gLogI.log(kError_ANPLogType, "bitmap default format is transparent");
- }
-
- gLogI.log(kDebug_ANPLogType, "END: testing bitmap transparency");
-
- mFinishedStageThree = true;
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// DOM TESTS
-///////////////////////////////////////////////////////////////////////////////
-
-void BackgroundPlugin::test_domAccess() {
- NPP instance = this->inst();
-
- gLogI.log(kDebug_ANPLogType, " ------ %p Testing DOM Access", instance);
-
- // Get the plugin's DOM object
- NPObject* windowObject = NULL;
- browser->getvalue(instance, NPNVWindowNPObject, &windowObject);
-
- if (!windowObject)
- gLogI.log(kError_ANPLogType, " ------ %p Unable to retrieve DOM Window", instance);
-
- // Retrieve a property from the plugin's DOM object
- NPIdentifier topIdentifier = browser->getstringidentifier("top");
- NPVariant topObjectVariant;
- browser->getproperty(instance, windowObject, topIdentifier, &topObjectVariant);
-
- if (topObjectVariant.type != NPVariantType_Object)
- gLogI.log(kError_ANPLogType, " ------ %p Invalid Variant type for DOM Property: %d,%d", instance, topObjectVariant.type, NPVariantType_Object);
-}
-
-
-///////////////////////////////////////////////////////////////////////////////
-// JAVASCRIPT TESTS
-///////////////////////////////////////////////////////////////////////////////
-
-
-void BackgroundPlugin::test_javascript() {
- NPP instance = this->inst();
-
- gLogI.log(kDebug_ANPLogType, " ------ %p Testing JavaScript Access", instance);
-
- // Get the plugin's DOM object
- NPObject* windowObject = NULL;
- browser->getvalue(instance, NPNVWindowNPObject, &windowObject);
-
- if (!windowObject)
- gLogI.log(kError_ANPLogType, " ------ %p Unable to retrieve DOM Window", instance);
-
- // create a string (JS code) that is stored in memory allocated by the browser
- const char* jsString = "1200 + 34";
- void* stringMem = browser->memalloc(strlen(jsString));
- memcpy(stringMem, jsString, strlen(jsString));
-
- // execute the javascript in the plugin's DOM object
- NPString script = { (char*)stringMem, strlen(jsString) };
- NPVariant scriptVariant;
- if (!browser->evaluate(instance, windowObject, &script, &scriptVariant))
- gLogI.log(kError_ANPLogType, " ------ %p Unable to eval the JS.", instance);
-
- if (scriptVariant.type == NPVariantType_Int32) {
- if (scriptVariant.value.intValue != 1234)
- gLogI.log(kError_ANPLogType, " ------ %p Invalid Value for JS Return: %d,1234", instance, scriptVariant.value.intValue);
- } else {
- gLogI.log(kError_ANPLogType, " ------ %p Invalid Variant type for JS Return: %d,%d", instance, scriptVariant.type, NPVariantType_Int32);
- }
-
- // free the memory allocated within the browser
- browser->memfree(stringMem);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Load Java Classes Tests
-///////////////////////////////////////////////////////////////////////////////
-
-void BackgroundPlugin::test_loadJavaClass() {
-
- JNIEnv* env = NULL;
- if (gVM->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
- gLogI.log(kError_ANPLogType, " ---- LoadJavaTest: failed to get env");
- return;
- }
-
- const char* className = "com.android.sampleplugin.BackgroundTest";
- jclass backgroundClass = gSystemI.loadJavaClass(inst(), className);
-
- if(!backgroundClass) {
- gLogI.log(kError_ANPLogType, " ---- LoadJavaTest: failed to load class");
- return;
- }
-
- jmethodID constructor = env->GetMethodID(backgroundClass, "<init>", "()V");
- jmethodID addMethod = env->GetMethodID(backgroundClass, "addInt", "(II)I");
- jobject backgroundObject = env->NewObject(backgroundClass, constructor);
-
- if(!backgroundObject) {
- gLogI.log(kError_ANPLogType, " ---- LoadJavaTest: failed to construct object");
- return;
- }
-
- jint result = env->CallIntMethod(backgroundObject, addMethod, 2, 2);
-
- if (result != 4) {
- gLogI.log(kError_ANPLogType, " ---- LoadJavaTest: invalid result (%d != 4)", result);
- }
-}
diff --git a/samples/BrowserPlugin/jni/background/BackgroundPlugin.h b/samples/BrowserPlugin/jni/background/BackgroundPlugin.h
deleted file mode 100644
index e0b0597db..000000000
--- a/samples/BrowserPlugin/jni/background/BackgroundPlugin.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2008, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "PluginObject.h"
-
-#ifndef backgroundPlugin__DEFINED
-#define backgroundPlugin__DEFINED
-
-class BackgroundPlugin : public SurfaceSubPlugin {
-public:
- BackgroundPlugin(NPP inst);
- virtual ~BackgroundPlugin();
- virtual int16_t handleEvent(const ANPEvent* evt);
- virtual jobject getSurface();
-
- // Timer Testing Variables
- uint32_t mStartTime;
- uint32_t mPrevTime;
- int mTimerRepeatCount;
- int mTimerLatencyCount;
- int mTimerLatencyCurrentCount;
-
- // Bitmap Transparency Variables
- bool mFinishedStageOne; // check default & set transparent
- bool mFinishedStageTwo; // check transparent & set opaque
- bool mFinishedStageThree; // check opaque
-
-private:
- void drawPlugin(int surfaceWidth, int surfaceHeight);
- void destroySurface();
-
- jobject m_surface;
-
- void test_logging();
- void test_timers();
- void test_bitmaps();
- void test_bitmap_transparency(const ANPEvent* evt);
- void test_domAccess();
- void test_javascript();
- void test_loadJavaClass();
-
-};
-
-#endif // backgroundPlugin__DEFINED
diff --git a/samples/BrowserPlugin/jni/form/FormPlugin.cpp b/samples/BrowserPlugin/jni/form/FormPlugin.cpp
deleted file mode 100644
index 110afaaa4..000000000
--- a/samples/BrowserPlugin/jni/form/FormPlugin.cpp
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * Copyright 2008, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "FormPlugin.h"
-
-#include <stdio.h>
-#include <sys/time.h>
-#include <time.h>
-#include <math.h>
-#include <string.h>
-
-extern NPNetscapeFuncs* browser;
-extern ANPLogInterfaceV0 gLogI;
-extern ANPCanvasInterfaceV0 gCanvasI;
-extern ANPPaintInterfaceV0 gPaintI;
-extern ANPTypefaceInterfaceV0 gTypefaceI;
-extern ANPWindowInterfaceV0 gWindowI;
-
-
-static void inval(NPP instance) {
- browser->invalidaterect(instance, NULL);
-}
-
-static uint16_t rnd16(float x, int inset) {
- int ix = (int)roundf(x) + inset;
- if (ix < 0) {
- ix = 0;
- }
- return static_cast<uint16_t>(ix);
-}
-
-static void inval(NPP instance, const ANPRectF& r, bool doAA) {
- const int inset = doAA ? -1 : 0;
-
- PluginObject *obj = reinterpret_cast<PluginObject*>(instance->pdata);
- NPRect inval;
- inval.left = rnd16(r.left, inset);
- inval.top = rnd16(r.top, inset);
- inval.right = rnd16(r.right, -inset);
- inval.bottom = rnd16(r.bottom, -inset);
- browser->invalidaterect(instance, &inval);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-FormPlugin::FormPlugin(NPP inst) : SubPlugin(inst) {
-
- m_hasFocus = false;
- m_activeInput = NULL;
-
- memset(&m_usernameInput, 0, sizeof(m_usernameInput));
- memset(&m_passwordInput, 0, sizeof(m_passwordInput));
-
- m_usernameInput.text[0] = '\0';
- m_usernameInput.charPtr = 0;
-
- m_passwordInput.text[0] = '\0';
- m_passwordInput.charPtr = 0;
-
- m_paintInput = gPaintI.newPaint();
- gPaintI.setFlags(m_paintInput, gPaintI.getFlags(m_paintInput) | kAntiAlias_ANPPaintFlag);
- gPaintI.setColor(m_paintInput, 0xFFFFFFFF);
-
- m_paintActive = gPaintI.newPaint();
- gPaintI.setFlags(m_paintActive, gPaintI.getFlags(m_paintActive) | kAntiAlias_ANPPaintFlag);
- gPaintI.setColor(m_paintActive, 0xFFFFFF00);
-
- m_paintText = gPaintI.newPaint();
- gPaintI.setFlags(m_paintText, gPaintI.getFlags(m_paintText) | kAntiAlias_ANPPaintFlag);
- gPaintI.setColor(m_paintText, 0xFF000000);
- gPaintI.setTextSize(m_paintText, 18);
-
- ANPTypeface* tf = gTypefaceI.createFromName("serif", kItalic_ANPTypefaceStyle);
- gPaintI.setTypeface(m_paintText, tf);
- gTypefaceI.unref(tf);
-
- //register for key and visibleRect events
- ANPEventFlags flags = kKey_ANPEventFlag;
- NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags);
- if (err != NPERR_NO_ERROR) {
- gLogI.log(kError_ANPLogType, "Error selecting input events.");
- }
-}
-
-FormPlugin::~FormPlugin() {
- gPaintI.deletePaint(m_paintInput);
- gPaintI.deletePaint(m_paintActive);
- gPaintI.deletePaint(m_paintText);
-}
-
-bool FormPlugin::supportsDrawingModel(ANPDrawingModel model) {
- return (model == kBitmap_ANPDrawingModel);
-}
-
-void FormPlugin::drawPlugin(const ANPBitmap& bitmap, const ANPRectI& clip) {
- ANPCanvas* canvas = gCanvasI.newCanvas(&bitmap);
-
- ANPRectF clipR;
- clipR.left = clip.left;
- clipR.top = clip.top;
- clipR.right = clip.right;
- clipR.bottom = clip.bottom;
- gCanvasI.clipRect(canvas, &clipR);
-
- draw(canvas);
- gCanvasI.deleteCanvas(canvas);
-}
-
-void FormPlugin::draw(ANPCanvas* canvas) {
- NPP instance = this->inst();
- PluginObject *obj = (PluginObject*) instance->pdata;
-
- const float inputWidth = 60;
- const float inputHeight = 30;
- const int W = obj->window->width;
- const int H = obj->window->height;
-
- // color the plugin canvas
- gCanvasI.drawColor(canvas, (m_hasFocus) ? 0xFFCDCDCD : 0xFF545454);
-
- // draw the username box (5 px from the top edge)
- m_usernameInput.rect.left = 5;
- m_usernameInput.rect.top = 5;
- m_usernameInput.rect.right = W - 5;
- m_usernameInput.rect.bottom = m_usernameInput.rect.top + inputHeight;
- gCanvasI.drawRect(canvas, &m_usernameInput.rect, getPaint(&m_usernameInput));
- drawText(canvas, m_usernameInput);
-
- // draw the password box (5 px from the bottom edge)
- m_passwordInput.rect.left = 5;
- m_passwordInput.rect.top = H - (inputHeight + 5);
- m_passwordInput.rect.right = W - 5;
- m_passwordInput.rect.bottom = m_passwordInput.rect.top + inputHeight;
- gCanvasI.drawRect(canvas, &m_passwordInput.rect, getPaint(&m_passwordInput));
- drawPassword(canvas, m_passwordInput);
-
- //invalidate the canvas
- //inval(instance);
-}
-
-ANPPaint* FormPlugin::getPaint(TextInput* input) {
- return (input == m_activeInput) ? m_paintActive : m_paintInput;
-}
-
-void FormPlugin::drawText(ANPCanvas* canvas, TextInput textInput) {
-
- // get font metrics
- ANPFontMetrics fontMetrics;
- gPaintI.getFontMetrics(m_paintText, &fontMetrics);
-
- gCanvasI.drawText(canvas, textInput.text, textInput.charPtr,
- textInput.rect.left + 5,
- textInput.rect.bottom - fontMetrics.fBottom, m_paintText);
-}
-
-void FormPlugin::drawPassword(ANPCanvas* canvas, TextInput passwordInput) {
-
- // get font metrics
- ANPFontMetrics fontMetrics;
- gPaintI.getFontMetrics(m_paintText, &fontMetrics);
-
- // comput the circle dimensions and initial location
- float initialX = passwordInput.rect.left + 5;
- float ovalBottom = passwordInput.rect.bottom - 2;
- float ovalTop = ovalBottom - (fontMetrics.fBottom - fontMetrics.fTop);
- float ovalWidth = ovalBottom - ovalTop;
- float ovalSpacing = 3;
-
- // draw circles instead of the actual text
- for (uint32_t x = 0; x < passwordInput.charPtr; x++) {
- ANPRectF oval;
- oval.left = initialX + ((ovalWidth + ovalSpacing) * (float) x);
- oval.right = oval.left + ovalWidth;
- oval.top = ovalTop;
- oval.bottom = ovalBottom;
- gCanvasI.drawOval(canvas, &oval, m_paintText);
- }
-}
-
-int16_t FormPlugin::handleEvent(const ANPEvent* evt) {
- NPP instance = this->inst();
-
- switch (evt->eventType) {
- case kDraw_ANPEventType:
- switch (evt->data.draw.model) {
- case kBitmap_ANPDrawingModel:
- drawPlugin(evt->data.draw.data.bitmap, evt->data.draw.clip);
- return 1;
- default:
- break; // unknown drawing model
- }
- break;
-
- case kLifecycle_ANPEventType:
- if (evt->data.lifecycle.action == kLoseFocus_ANPLifecycleAction) {
- gLogI.log(kDebug_ANPLogType, "----%p Loosing Focus", instance);
-
- if (m_activeInput) {
- // hide the keyboard
- gWindowI.showKeyboard(instance, false);
-
- //reset the activeInput
- m_activeInput = NULL;
- }
-
- m_hasFocus = false;
- inval(instance);
- return 1;
- }
- else if (evt->data.lifecycle.action == kGainFocus_ANPLifecycleAction) {
- gLogI.log(kDebug_ANPLogType, "----%p Gaining Focus", instance);
- m_hasFocus = true;
- inval(instance);
- return 1;
- }
- break;
-
- case kMouse_ANPEventType: {
-
- int x = evt->data.mouse.x;
- int y = evt->data.mouse.y;
- if (kDown_ANPMouseAction == evt->data.mouse.action) {
-
- TextInput* currentInput = validTap(x,y);
-
- if (currentInput)
- gWindowI.showKeyboard(instance, true);
- else if (m_activeInput)
- gWindowI.showKeyboard(instance, false);
-
- if (currentInput != m_activeInput)
- switchActiveInput(currentInput);
-
- return 1;
- }
- break;
- }
-
- case kKey_ANPEventType:
- if (evt->data.key.action == kDown_ANPKeyAction) {
-
- //handle navigation keys
- if (evt->data.key.nativeCode >= kDpadUp_ANPKeyCode
- && evt->data.key.nativeCode <= kDpadCenter_ANPKeyCode) {
- return handleNavigation(evt->data.key.nativeCode) ? 1 : 0;
- }
-
- if (m_activeInput) {
- handleTextInput(m_activeInput, evt->data.key.nativeCode,
- evt->data.key.unichar);
- inval(instance, m_activeInput->rect, true);
- }
- }
- return 1;
-
- default:
- break;
- }
- return 0; // unknown or unhandled event
-}
-
-void FormPlugin::switchActiveInput(TextInput* newInput) {
- NPP instance = this->inst();
-
- if (m_activeInput) {
- inval(instance, m_activeInput->rect, true); // inval the old
- gWindowI.clearVisibleRects(instance);
- }
-
- m_activeInput = newInput; // set the new active input
-
- if (m_activeInput) {
- inval(instance, m_activeInput->rect, true); // inval the new
- scrollIntoView(m_activeInput);
- }
-}
-
-bool FormPlugin::handleNavigation(ANPKeyCode keyCode) {
- NPP instance = this->inst();
-
- gLogI.log(kDebug_ANPLogType, "----%p Recvd Nav Key %d", instance, keyCode);
-
- if (!m_activeInput) {
- gWindowI.showKeyboard(instance, true);
- switchActiveInput(&m_usernameInput);
- }
- else if (m_activeInput == &m_usernameInput) {
- if (keyCode == kDpadDown_ANPKeyCode) {
- switchActiveInput(&m_passwordInput);
- }
- else if (keyCode == kDpadCenter_ANPKeyCode)
- gWindowI.showKeyboard(instance, false);
- else if (keyCode == kDpadUp_ANPKeyCode)
- return false;
- }
- else if (m_activeInput == &m_passwordInput) {
- if (keyCode == kDpadUp_ANPKeyCode) {
- switchActiveInput(&m_usernameInput);
- }
- else if (keyCode == kDpadCenter_ANPKeyCode)
- gWindowI.showKeyboard(instance, false);
- else if (keyCode == kDpadDown_ANPKeyCode)
- return false;
- }
-
- return true;
-}
-
-void FormPlugin::handleTextInput(TextInput* input, ANPKeyCode keyCode, int32_t unichar) {
- NPP instance = this->inst();
-
- //make sure the input field is in view
- scrollIntoView(input);
-
- //handle the delete operation
- if (keyCode == kDel_ANPKeyCode) {
- if (input->charPtr > 0) {
- input->charPtr--;
- }
- return;
- }
-
- //check to see that the input is not full
- if (input->charPtr >= (sizeof(input->text) - 1))
- return;
-
- //add the character
- input->text[input->charPtr] = static_cast<char>(unichar);
- input->charPtr++;
-
- gLogI.log(kDebug_ANPLogType, "----%p Text: %c", instance, unichar);
-}
-
-void FormPlugin::scrollIntoView(TextInput* input) {
- NPP instance = this->inst();
- PluginObject *obj = (PluginObject*) instance->pdata;
- NPWindow *window = obj->window;
-
- // find the textInput's global rect coordinates
- ANPRectI visibleRects[1];
- visibleRects[0].left = input->rect.left;
- visibleRects[0].top = input->rect.top;
- visibleRects[0].right = input->rect.right;
- visibleRects[0].bottom = input->rect.bottom;
-
- gWindowI.setVisibleRects(instance, visibleRects, 1);
-}
-
-TextInput* FormPlugin::validTap(int x, int y) {
-
- if (x > m_usernameInput.rect.left && x < m_usernameInput.rect.right &&
- y > m_usernameInput.rect.top && y < m_usernameInput.rect.bottom)
- return &m_usernameInput;
- else if (x >m_passwordInput.rect.left && x < m_passwordInput.rect.right &&
- y > m_passwordInput.rect.top && y < m_passwordInput.rect.bottom)
- return &m_passwordInput;
- else
- return NULL;
-}
diff --git a/samples/BrowserPlugin/jni/form/FormPlugin.h b/samples/BrowserPlugin/jni/form/FormPlugin.h
deleted file mode 100644
index 9f985a3c6..000000000
--- a/samples/BrowserPlugin/jni/form/FormPlugin.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2008, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "PluginObject.h"
-
-#ifndef formPlugin__DEFINED
-#define formPlugin__DEFINED
-
-struct TextInput {
- ANPRectF rect;
- char text[30];
- uint32_t charPtr;
-};
-
-class FormPlugin : public SubPlugin {
-public:
- FormPlugin(NPP inst);
- virtual ~FormPlugin();
- virtual bool supportsDrawingModel(ANPDrawingModel);
- virtual int16_t handleEvent(const ANPEvent* evt);
-private:
- void draw(ANPCanvas*);
- void drawPlugin(const ANPBitmap& bitmap, const ANPRectI& clip);
-
- bool m_hasFocus;
-
- TextInput* m_activeInput;
- TextInput m_usernameInput;
- TextInput m_passwordInput;
-
- ANPPaint* m_paintInput;
- ANPPaint* m_paintActive;
- ANPPaint* m_paintText;
-
- ANPRectI m_visibleRect;
-
- void drawText(ANPCanvas*, TextInput);
- void drawPassword(ANPCanvas*, TextInput);
-
- bool handleNavigation(ANPKeyCode keyCode);
- void handleTextInput(TextInput* input, ANPKeyCode keyCode, int32_t unichar);
- void scrollIntoView(TextInput* input);
- void switchActiveInput(TextInput* input);
-
- ANPPaint* getPaint(TextInput*);
- TextInput* validTap(int x, int y);
-
-};
-
-#endif // formPlugin__DEFINED
diff --git a/samples/BrowserPlugin/jni/jni-bridge.cpp b/samples/BrowserPlugin/jni/jni-bridge.cpp
deleted file mode 100644
index 9ba8a3215..000000000
--- a/samples/BrowserPlugin/jni/jni-bridge.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- *
- */
-#include <string.h>
-#include <jni.h>
-#include <JNIHelp.h>
-#include <utils/Log.h>
-
-#include "PluginObject.h"
-
-#define EXPORT __attribute__((visibility("default")))
-
-extern ANPEventInterfaceV0 gEventI;
-
-static void surfaceCreated(JNIEnv* env, jobject thiz, jint npp, jobject surface) {
-
- // send custom event
- ANPEvent event;
- event.inSize = sizeof(ANPEvent);
- event.eventType = kCustom_ANPEventType;
- event.data.other[0] = kSurfaceCreated_CustomEvent;
-
- gEventI.postEvent((NPP)npp, &event);
-}
-
-static void surfaceChanged(JNIEnv* env, jobject thiz, jint npp, jint format, jint width, jint height) {
- // send custom event
- ANPEvent event;
- event.inSize = sizeof(ANPEvent);
- event.eventType = kCustom_ANPEventType;
- event.data.other[0] = kSurfaceChanged_CustomEvent;
- event.data.other[1] = width;
- event.data.other[2] = height;
-
- gEventI.postEvent((NPP)npp, &event);
-}
-
-static void surfaceDestroyed(JNIEnv* env, jobject thiz, jint npp) {
- // send custom event
- ANPEvent event;
- event.inSize = sizeof(ANPEvent);
- event.eventType = kCustom_ANPEventType;
- event.data.other[0] = kSurfaceDestroyed_CustomEvent;
-
- gEventI.postEvent((NPP)npp, &event);
-}
-
-/*
- * JNI registration.
- */
-static JNINativeMethod gPaintSurfaceMethods[] = {
- { "nativeSurfaceCreated", "(I)V", (void*) surfaceCreated },
- { "nativeSurfaceChanged", "(IIII)V", (void*) surfaceChanged },
- { "nativeSurfaceDestroyed", "(I)V", (void*) surfaceDestroyed },
-};
-
-EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
-
- JNIEnv* env = NULL;
-
- if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
- return -1;
- }
-
- jniRegisterNativeMethods(env, "com/android/sampleplugin/PaintSurface",
- gPaintSurfaceMethods, NELEM(gPaintSurfaceMethods));
-
- return JNI_VERSION_1_4;
-}
diff --git a/samples/BrowserPlugin/jni/main.cpp b/samples/BrowserPlugin/jni/main.cpp
deleted file mode 100644
index f6e340029..000000000
--- a/samples/BrowserPlugin/jni/main.cpp
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * Copyright 2008, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include "main.h"
-#include "PluginObject.h"
-#include "AnimationPlugin.h"
-#include "AudioPlugin.h"
-#include "BackgroundPlugin.h"
-#include "FormPlugin.h"
-#include "NavigationPlugin.h"
-#include "PaintPlugin.h"
-#include "VideoPlugin.h"
-
-NPNetscapeFuncs* browser;
-JavaVM* gVM;
-
-#define EXPORT __attribute__((visibility("default")))
-
-NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc,
- char* argn[], char* argv[], NPSavedData* saved);
-NPError NPP_Destroy(NPP instance, NPSavedData** save);
-NPError NPP_SetWindow(NPP instance, NPWindow* window);
-NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream,
- NPBool seekable, uint16_t* stype);
-NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
-int32_t NPP_WriteReady(NPP instance, NPStream* stream);
-int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len,
- void* buffer);
-void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
-void NPP_Print(NPP instance, NPPrint* platformPrint);
-int16_t NPP_HandleEvent(NPP instance, void* event);
-void NPP_URLNotify(NPP instance, const char* URL, NPReason reason,
- void* notifyData);
-NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value);
-NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value);
-
-extern "C" {
-EXPORT NPError NP_Initialize(NPNetscapeFuncs* browserFuncs, NPPluginFuncs* pluginFuncs, void *java_env);
-EXPORT NPError NP_GetValue(NPP instance, NPPVariable variable, void *value);
-EXPORT const char* NP_GetMIMEDescription(void);
-EXPORT void NP_Shutdown(void);
-};
-
-ANPAudioTrackInterfaceV0 gSoundI;
-ANPBitmapInterfaceV0 gBitmapI;
-ANPCanvasInterfaceV0 gCanvasI;
-ANPEventInterfaceV0 gEventI;
-ANPLogInterfaceV0 gLogI;
-ANPPaintInterfaceV0 gPaintI;
-ANPPathInterfaceV0 gPathI;
-ANPSurfaceInterfaceV0 gSurfaceI;
-ANPSystemInterfaceV0 gSystemI;
-ANPTypefaceInterfaceV0 gTypefaceI;
-ANPWindowInterfaceV1 gWindowI;
-ANPNativeWindowInterfaceV0 gNativeWindowI;
-
-#define ARRAY_COUNT(array) (sizeof(array) / sizeof(array[0]))
-#define DEBUG_PLUGIN_EVENTS 0
-
-NPError NP_Initialize(NPNetscapeFuncs* browserFuncs, NPPluginFuncs* pluginFuncs, void *java_env)
-{
- // Make sure we have a function table equal or larger than we are built against.
- if (browserFuncs->size < sizeof(NPNetscapeFuncs)) {
- return NPERR_GENERIC_ERROR;
- }
-
- // Copy the function table (structure)
- browser = (NPNetscapeFuncs*) malloc(sizeof(NPNetscapeFuncs));
- memcpy(browser, browserFuncs, sizeof(NPNetscapeFuncs));
-
- // Build the plugin function table
- pluginFuncs->version = 11;
- pluginFuncs->size = sizeof(pluginFuncs);
- pluginFuncs->newp = NPP_New;
- pluginFuncs->destroy = NPP_Destroy;
- pluginFuncs->setwindow = NPP_SetWindow;
- pluginFuncs->newstream = NPP_NewStream;
- pluginFuncs->destroystream = NPP_DestroyStream;
- pluginFuncs->asfile = NPP_StreamAsFile;
- pluginFuncs->writeready = NPP_WriteReady;
- pluginFuncs->write = (NPP_WriteProcPtr)NPP_Write;
- pluginFuncs->print = NPP_Print;
- pluginFuncs->event = NPP_HandleEvent;
- pluginFuncs->urlnotify = NPP_URLNotify;
- pluginFuncs->getvalue = NPP_GetValue;
- pluginFuncs->setvalue = NPP_SetValue;
-
- static const struct {
- NPNVariable v;
- uint32_t size;
- ANPInterface* i;
- } gPairs[] = {
- { kAudioTrackInterfaceV0_ANPGetValue, sizeof(gSoundI), &gSoundI },
- { kBitmapInterfaceV0_ANPGetValue, sizeof(gBitmapI), &gBitmapI },
- { kCanvasInterfaceV0_ANPGetValue, sizeof(gCanvasI), &gCanvasI },
- { kEventInterfaceV0_ANPGetValue, sizeof(gEventI), &gEventI },
- { kLogInterfaceV0_ANPGetValue, sizeof(gLogI), &gLogI },
- { kPaintInterfaceV0_ANPGetValue, sizeof(gPaintI), &gPaintI },
- { kPathInterfaceV0_ANPGetValue, sizeof(gPathI), &gPathI },
- { kSurfaceInterfaceV0_ANPGetValue, sizeof(gSurfaceI), &gSurfaceI },
- { kSystemInterfaceV0_ANPGetValue, sizeof(gSystemI), &gSystemI },
- { kTypefaceInterfaceV0_ANPGetValue, sizeof(gTypefaceI), &gTypefaceI },
- { kWindowInterfaceV1_ANPGetValue, sizeof(gWindowI), &gWindowI },
- { kNativeWindowInterfaceV0_ANPGetValue, sizeof(gNativeWindowI), &gNativeWindowI },
- };
- for (size_t i = 0; i < ARRAY_COUNT(gPairs); i++) {
- gPairs[i].i->inSize = gPairs[i].size;
- NPError err = browser->getvalue(NULL, gPairs[i].v, gPairs[i].i);
- if (err) {
- return err;
- }
- }
-
- // store the JavaVM for the plugin
- JNIEnv* env = (JNIEnv*)java_env;
- env->GetJavaVM(&gVM);
-
- return NPERR_NO_ERROR;
-}
-
-void NP_Shutdown(void)
-{
-
-}
-
-const char *NP_GetMIMEDescription(void)
-{
- return "application/x-testbrowserplugin:tst:Test plugin mimetype is application/x-testbrowserplugin";
-}
-
-NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc,
- char* argn[], char* argv[], NPSavedData* saved)
-{
-
- /* BEGIN: STANDARD PLUGIN FRAMEWORK */
- PluginObject *obj = NULL;
-
- // Scripting functions appeared in NPAPI version 14
- if (browser->version >= 14) {
- instance->pdata = browser->createobject (instance, getPluginClass());
- obj = static_cast<PluginObject*>(instance->pdata);
- obj->pluginType = 0;
- }
- /* END: STANDARD PLUGIN FRAMEWORK */
-
- // select the drawing model based on user input
- ANPDrawingModel model = kBitmap_ANPDrawingModel;
-
- for (int i = 0; i < argc; i++) {
- if (!strcmp(argn[i], "DrawingModel")) {
- if (!strcmp(argv[i], "Bitmap")) {
- model = kBitmap_ANPDrawingModel;
- }
- else if (!strcmp(argv[i], "Surface")) {
- model = kSurface_ANPDrawingModel;
- }
- else if (!strcmp(argv[i], "OpenGL")) {
- model = kOpenGL_ANPDrawingModel;
- }
- gLogI.log(kDebug_ANPLogType, "------ %p DrawingModel is %d", instance, model);
- break;
- }
- }
-
- // notify the plugin API of the drawing model we wish to use. This must be
- // done prior to creating certain subPlugin objects (e.g. surfaceViews)
- NPError err = browser->setvalue(instance, kRequestDrawingModel_ANPSetValue,
- reinterpret_cast<void*>(model));
- if (err) {
- gLogI.log(kError_ANPLogType, "request model %d err %d", model, err);
- return err;
- }
-
- const char* path = gSystemI.getApplicationDataDirectory();
- if (path) {
- gLogI.log(kDebug_ANPLogType, "Application data dir is %s", path);
- } else {
- gLogI.log(kError_ANPLogType, "Can't find Application data dir");
- }
-
- // select the pluginType
- for (int i = 0; i < argc; i++) {
- if (!strcmp(argn[i], "PluginType")) {
- if (!strcmp(argv[i], "Animation")) {
- obj->pluginType = kAnimation_PluginType;
- obj->activePlugin = new BallAnimation(instance);
- }
- else if (!strcmp(argv[i], "Audio")) {
- obj->pluginType = kAudio_PluginType;
- obj->activePlugin = new AudioPlugin(instance);
- }
- else if (!strcmp(argv[i], "Background")) {
- obj->pluginType = kBackground_PluginType;
- obj->activePlugin = new BackgroundPlugin(instance);
- }
- else if (!strcmp(argv[i], "Form")) {
- obj->pluginType = kForm_PluginType;
- obj->activePlugin = new FormPlugin(instance);
- }
- else if (!strcmp(argv[i], "Navigation")) {
- obj->pluginType = kNavigation_PluginType;
- obj->activePlugin = new NavigationPlugin(instance);
- }
- else if (!strcmp(argv[i], "Paint")) {
- obj->pluginType = kPaint_PluginType;
- obj->activePlugin = new PaintPlugin(instance);
- }
- else if (!strcmp(argv[i], "Video")) {
- obj->pluginType = kVideo_PluginType;
- obj->activePlugin = new VideoPlugin(instance);
- }
- else {
- gLogI.log(kError_ANPLogType, "PluginType %s unknown!", argv[i]);
- }
- break;
- }
- }
-
- // if no pluginType is specified then default to Animation
- if (!obj->pluginType) {
- gLogI.log(kError_ANPLogType, "------ %p No PluginType attribute was found", instance);
- obj->pluginType = kAnimation_PluginType;
- obj->activePlugin = new BallAnimation(instance);
- }
-
- gLogI.log(kDebug_ANPLogType, "------ %p PluginType is %d", instance, obj->pluginType);
-
- // check to ensure the pluginType supports the model
- if (!obj->activePlugin->supportsDrawingModel(model)) {
- gLogI.log(kError_ANPLogType, "------ %p Unsupported DrawingModel (%d)", instance, model);
- return NPERR_GENERIC_ERROR;
- }
-
- // if the plugin uses the surface drawing model then set the java context
- if (model == kSurface_ANPDrawingModel || model == kOpenGL_ANPDrawingModel) {
- SurfaceSubPlugin* surfacePlugin = static_cast<SurfaceSubPlugin*>(obj->activePlugin);
-
- jobject context;
- NPError err = browser->getvalue(instance, kJavaContext_ANPGetValue,
- static_cast<void*>(&context));
- if (err) {
- gLogI.log(kError_ANPLogType, "request context err: %d", err);
- return err;
- }
-
- surfacePlugin->setContext(context);
- }
-
-
- return NPERR_NO_ERROR;
-}
-
-NPError NPP_Destroy(NPP instance, NPSavedData** save)
-{
- PluginObject *obj = (PluginObject*) instance->pdata;
- if (obj) {
- delete obj->activePlugin;
- browser->releaseobject(&obj->header);
- }
-
- return NPERR_NO_ERROR;
-}
-
-NPError NPP_SetWindow(NPP instance, NPWindow* window)
-{
- PluginObject *obj = (PluginObject*) instance->pdata;
-
- // Do nothing if browser didn't support NPN_CreateObject which would have created the PluginObject.
- if (obj != NULL) {
- obj->window = window;
- }
-
- browser->invalidaterect(instance, NULL);
-
- return NPERR_NO_ERROR;
-}
-
-NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype)
-{
- *stype = NP_ASFILEONLY;
- return NPERR_NO_ERROR;
-}
-
-NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason)
-{
- return NPERR_NO_ERROR;
-}
-
-int32_t NPP_WriteReady(NPP instance, NPStream* stream)
-{
- return 0;
-}
-
-int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer)
-{
- return 0;
-}
-
-void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
-{
-}
-
-void NPP_Print(NPP instance, NPPrint* platformPrint)
-{
-}
-
-int16_t NPP_HandleEvent(NPP instance, void* event)
-{
- PluginObject *obj = reinterpret_cast<PluginObject*>(instance->pdata);
- const ANPEvent* evt = reinterpret_cast<const ANPEvent*>(event);
-
-#if DEBUG_PLUGIN_EVENTS
- switch (evt->eventType) {
- case kDraw_ANPEventType:
-
- if (evt->data.draw.model == kBitmap_ANPDrawingModel) {
-
- static ANPBitmapFormat currentFormat = -1;
- if (evt->data.draw.data.bitmap.format != currentFormat) {
- currentFormat = evt->data.draw.data.bitmap.format;
- gLogI.log(kDebug_ANPLogType, "---- %p Draw (bitmap)"
- " clip=%d,%d,%d,%d format=%d", instance,
- evt->data.draw.clip.left,
- evt->data.draw.clip.top,
- evt->data.draw.clip.right,
- evt->data.draw.clip.bottom,
- evt->data.draw.data.bitmap.format);
- }
- }
- break;
-
- case kKey_ANPEventType:
- gLogI.log(kDebug_ANPLogType, "---- %p Key action=%d"
- " code=%d vcode=%d unichar=%d repeat=%d mods=%x", instance,
- evt->data.key.action,
- evt->data.key.nativeCode,
- evt->data.key.virtualCode,
- evt->data.key.unichar,
- evt->data.key.repeatCount,
- evt->data.key.modifiers);
- break;
-
- case kLifecycle_ANPEventType:
- gLogI.log(kDebug_ANPLogType, "---- %p Lifecycle action=%d",
- instance, evt->data.lifecycle.action);
- break;
-
- case kTouch_ANPEventType:
- gLogI.log(kDebug_ANPLogType, "---- %p Touch action=%d [%d %d]",
- instance, evt->data.touch.action, evt->data.touch.x,
- evt->data.touch.y);
- break;
-
- case kMouse_ANPEventType:
- gLogI.log(kDebug_ANPLogType, "---- %p Mouse action=%d [%d %d]",
- instance, evt->data.mouse.action, evt->data.mouse.x,
- evt->data.mouse.y);
- break;
-
- case kVisibleRect_ANPEventType:
- gLogI.log(kDebug_ANPLogType, "---- %p VisibleRect [%d %d %d %d]",
- instance, evt->data.visibleRect.rect.left, evt->data.visibleRect.rect.top,
- evt->data.visibleRect.rect.right, evt->data.visibleRect.rect.bottom);
- break;
-
- default:
- gLogI.log(kError_ANPLogType, "---- %p Unknown Event [%d]",
- instance, evt->eventType);
- break;
- }
-#endif
-
- if(!obj->activePlugin) {
- gLogI.log(kError_ANPLogType, "the active plugin is null.");
- return 0; // unknown or unhandled event
- }
- else {
- return obj->activePlugin->handleEvent(evt);
- }
-}
-
-void NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData)
-{
-
-}
-
-EXPORT NPError NP_GetValue(NPP instance, NPPVariable variable, void *value) {
-
- if (variable == NPPVpluginNameString) {
- const char **str = (const char **)value;
- *str = "Test Plugin";
- return NPERR_NO_ERROR;
- }
-
- if (variable == NPPVpluginDescriptionString) {
- const char **str = (const char **)value;
- *str = "Description of Test Plugin";
- return NPERR_NO_ERROR;
- }
-
- return NPERR_GENERIC_ERROR;
-}
-
-NPError NPP_GetValue(NPP instance, NPPVariable variable, void* value)
-{
- if (variable == NPPVpluginScriptableNPObject) {
- void **v = (void **)value;
- PluginObject *obj = (PluginObject*) instance->pdata;
-
- if (obj)
- browser->retainobject(&obj->header);
-
- *v = &(obj->header);
- return NPERR_NO_ERROR;
- }
-
- if (variable == kJavaSurface_ANPGetValue) {
- //get the surface sub-plugin
- PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
- if (obj && obj->activePlugin) {
-
- if(obj->activePlugin->supportsDrawingModel(kSurface_ANPDrawingModel)
- || obj->activePlugin->supportsDrawingModel(kOpenGL_ANPDrawingModel)) {
- SurfaceSubPlugin* plugin = static_cast<SurfaceSubPlugin*>(obj->activePlugin);
- jobject* surface = static_cast<jobject*>(value);
- *surface = plugin->getSurface();
- return NPERR_NO_ERROR;
- } else {
- gLogI.log(kError_ANPLogType,
- "-- %p Tried to retrieve surface for non-surface plugin",
- instance);
- }
- }
- }
-
- return NPERR_GENERIC_ERROR;
-}
-
-NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value)
-{
- return NPERR_GENERIC_ERROR;
-}
-
diff --git a/samples/BrowserPlugin/jni/main.h b/samples/BrowserPlugin/jni/main.h
deleted file mode 100644
index b50ad5638..000000000
--- a/samples/BrowserPlugin/jni/main.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2008, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <npapi.h>
-#include <npfunctions.h>
-#include <npruntime.h>
-#include "android_npapi.h"
-#include "ANPNativeWindow_npapi.h"
-#include "ANPSurface_npapi.h"
-#include "ANPSystem_npapi.h"
-
-extern NPNetscapeFuncs* browser;
-extern JavaVM* gVM;
diff --git a/samples/BrowserPlugin/jni/navigation/NavigationPlugin.cpp b/samples/BrowserPlugin/jni/navigation/NavigationPlugin.cpp
deleted file mode 100644
index 01d9a7914..000000000
--- a/samples/BrowserPlugin/jni/navigation/NavigationPlugin.cpp
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "NavigationPlugin.h"
-
-#include <stdio.h>
-#include <sys/time.h>
-#include <time.h>
-#include <math.h>
-#include <string.h>
-
-extern NPNetscapeFuncs* browser;
-extern ANPLogInterfaceV0 gLogI;
-extern ANPCanvasInterfaceV0 gCanvasI;
-extern ANPPaintInterfaceV0 gPaintI;
-extern ANPTypefaceInterfaceV0 gTypefaceI;
-extern ANPWindowInterfaceV0 gWindowI;
-
-
-static void inval(NPP instance) {
- browser->invalidaterect(instance, NULL);
-}
-
-static uint16_t rnd16(float x, int inset) {
- int ix = (int)roundf(x) + inset;
- if (ix < 0) {
- ix = 0;
- }
- return static_cast<uint16_t>(ix);
-}
-
-static void inval(NPP instance, const ANPRectF& r, bool doAA) {
- const int inset = doAA ? -1 : 0;
-
- PluginObject *obj = reinterpret_cast<PluginObject*>(instance->pdata);
- NPRect inval;
- inval.left = rnd16(r.left, inset);
- inval.top = rnd16(r.top, inset);
- inval.right = rnd16(r.right, -inset);
- inval.bottom = rnd16(r.bottom, -inset);
- browser->invalidaterect(instance, &inval);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-NavigationPlugin::NavigationPlugin(NPP inst) : SubPlugin(inst) {
-
- m_hasFocus = false;
- m_activeNav = NULL;
-
- m_paintDisabled = gPaintI.newPaint();
- gPaintI.setFlags(m_paintDisabled, gPaintI.getFlags(m_paintDisabled) | kAntiAlias_ANPPaintFlag);
- gPaintI.setColor(m_paintDisabled, 0xFFFFFFFF);
-
- m_paintActive = gPaintI.newPaint();
- gPaintI.setFlags(m_paintActive, gPaintI.getFlags(m_paintActive) | kAntiAlias_ANPPaintFlag);
- gPaintI.setColor(m_paintActive, 0xFFFFFF00);
-
- //register for key events
- ANPEventFlags flags = kKey_ANPEventFlag;
- NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags);
- if (err != NPERR_NO_ERROR) {
- gLogI.log(kError_ANPLogType, "Error selecting input events.");
- }
-}
-
-NavigationPlugin::~NavigationPlugin() {
- gPaintI.deletePaint(m_paintDisabled);
- gPaintI.deletePaint(m_paintActive);
-}
-
-bool NavigationPlugin::supportsDrawingModel(ANPDrawingModel model) {
- return (model == kBitmap_ANPDrawingModel);
-}
-
-void NavigationPlugin::drawPlugin(const ANPBitmap& bitmap, const ANPRectI& clip) {
- ANPCanvas* canvas = gCanvasI.newCanvas(&bitmap);
-
- ANPRectF clipR;
- clipR.left = clip.left;
- clipR.top = clip.top;
- clipR.right = clip.right;
- clipR.bottom = clip.bottom;
- gCanvasI.clipRect(canvas, &clipR);
-
- draw(canvas);
- gCanvasI.deleteCanvas(canvas);
-}
-
-void NavigationPlugin::draw(ANPCanvas* canvas) {
- NPP instance = this->inst();
- PluginObject *obj = (PluginObject*) instance->pdata;
-
- const int W = obj->window->width;
- const int H = obj->window->height;
- const int Wm = W/2;
- const int Hm = H/2;
-
- // color the plugin canvas
- gCanvasI.drawColor(canvas, (m_hasFocus) ? 0xFFCDCDCD : 0xFF545454);
-
- // draw the nav up box (5 px from the top edge)
- m_navUp.left = Wm - 15;
- m_navUp.top = 5;
- m_navUp.right = m_navUp.left + 30;
- m_navUp.bottom = m_navUp.top + 30;
- gCanvasI.drawRect(canvas, &m_navUp, getPaint(&m_navUp));
-
- // draw the nav down box (5 px from the bottom edge)
- m_navDown.left = Wm - 15;
- m_navDown.top = H - (30 + 5);
- m_navDown.right = m_navDown.left + 30;
- m_navDown.bottom = m_navDown.top + 30;
- gCanvasI.drawRect(canvas, &m_navDown, getPaint(&m_navDown));
-
- // draw the nav left box (5 px from the left edge)
- m_navLeft.left = 5;
- m_navLeft.top = Hm - 15;
- m_navLeft.right = m_navLeft.left + 30;
- m_navLeft.bottom = m_navLeft.top + 30;
- gCanvasI.drawRect(canvas, &m_navLeft, getPaint(&m_navLeft));
-
- // draw the nav right box (5 px from the right edge)
- m_navRight.left = W - (30 + 5);
- m_navRight.top = Hm - 15;
- m_navRight.right = m_navRight.left + 30;
- m_navRight.bottom = m_navRight.top + 30;
- gCanvasI.drawRect(canvas, &m_navRight, getPaint(&m_navRight));
-
- // draw the nav center box
- m_navCenter.left = Wm - 15;
- m_navCenter.top = Hm - 15;
- m_navCenter.right = m_navCenter.left + 30;
- m_navCenter.bottom = m_navCenter.top + 30;
- gCanvasI.drawRect(canvas, &m_navCenter, getPaint(&m_navCenter));
-
- gLogI.log(kDebug_ANPLogType, "----%p Drawing Plugin", inst());
-}
-
-ANPPaint* NavigationPlugin::getPaint(ANPRectF* input) {
- return (input == m_activeNav) ? m_paintActive : m_paintDisabled;
-}
-
-int16_t NavigationPlugin::handleEvent(const ANPEvent* evt) {
- NPP instance = this->inst();
-
- switch (evt->eventType) {
- case kDraw_ANPEventType:
- switch (evt->data.draw.model) {
- case kBitmap_ANPDrawingModel:
- drawPlugin(evt->data.draw.data.bitmap, evt->data.draw.clip);
- return 1;
- default:
- break; // unknown drawing model
- }
- break;
-
- case kLifecycle_ANPEventType:
- if (evt->data.lifecycle.action == kLoseFocus_ANPLifecycleAction) {
- gLogI.log(kDebug_ANPLogType, "----%p Loosing Focus", instance);
- m_hasFocus = false;
- inval(instance);
- return 1;
- }
- else if (evt->data.lifecycle.action == kGainFocus_ANPLifecycleAction) {
- gLogI.log(kDebug_ANPLogType, "----%p Gaining Focus", instance);
- m_hasFocus = true;
- inval(instance);
- return 1;
- }
- break;
-
- case kMouse_ANPEventType:
- return 1;
-
- case kKey_ANPEventType:
- if (evt->data.key.action == kDown_ANPKeyAction) {
- bool result = handleNavigation(evt->data.key.nativeCode);
- inval(instance);
- return result;
- }
- return 1;
-
- default:
- break;
- }
- return 0; // unknown or unhandled event
-}
-
-bool NavigationPlugin::handleNavigation(ANPKeyCode keyCode) {
- NPP instance = this->inst();
-
- gLogI.log(kDebug_ANPLogType, "----%p Received Key %d", instance, keyCode);
-
- switch (keyCode) {
- case kDpadUp_ANPKeyCode:
- m_activeNav = &m_navUp;
- break;
- case kDpadDown_ANPKeyCode:
- m_activeNav = &m_navDown;
- break;
- case kDpadLeft_ANPKeyCode:
- m_activeNav = &m_navLeft;
- break;
- case kDpadRight_ANPKeyCode:
- m_activeNav = &m_navRight;
- break;
- case kDpadCenter_ANPKeyCode:
- m_activeNav = &m_navCenter;
- break;
- case kQ_ANPKeyCode:
- case kDel_ANPKeyCode:
- m_activeNav = NULL;
- return false;
- default:
- m_activeNav = NULL;
- break;
- }
- return true;
-}
diff --git a/samples/BrowserPlugin/jni/navigation/NavigationPlugin.h b/samples/BrowserPlugin/jni/navigation/NavigationPlugin.h
deleted file mode 100644
index c2044bbc6..000000000
--- a/samples/BrowserPlugin/jni/navigation/NavigationPlugin.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "PluginObject.h"
-
-#ifndef navigationPlugin__DEFINED
-#define navigationPlugin__DEFINED
-
-class NavigationPlugin : public SubPlugin {
-public:
- NavigationPlugin(NPP inst);
- virtual ~NavigationPlugin();
- virtual bool supportsDrawingModel(ANPDrawingModel);
- virtual int16_t handleEvent(const ANPEvent* evt);
-private:
- void draw(ANPCanvas*);
- void drawPlugin(const ANPBitmap& bitmap, const ANPRectI& clip);
-
- bool m_hasFocus;
-
- ANPRectF* m_activeNav;
- ANPRectF m_navUp;
- ANPRectF m_navDown;
- ANPRectF m_navLeft;
- ANPRectF m_navRight;
- ANPRectF m_navCenter;
-
- ANPPaint* m_paintDisabled;
- ANPPaint* m_paintActive;
-
- bool handleNavigation(ANPKeyCode keyCode);
- ANPPaint* getPaint(ANPRectF*);
-};
-
-#endif // navigationPlugin__DEFINED
diff --git a/samples/BrowserPlugin/jni/paint/PaintPlugin.cpp b/samples/BrowserPlugin/jni/paint/PaintPlugin.cpp
deleted file mode 100644
index abe6805ce..000000000
--- a/samples/BrowserPlugin/jni/paint/PaintPlugin.cpp
+++ /dev/null
@@ -1,462 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "PaintPlugin.h"
-
-#include <fcntl.h>
-#include <math.h>
-#include <string.h>
-
-extern NPNetscapeFuncs* browser;
-extern ANPLogInterfaceV0 gLogI;
-extern ANPCanvasInterfaceV0 gCanvasI;
-extern ANPPaintInterfaceV0 gPaintI;
-extern ANPPathInterfaceV0 gPathI;
-extern ANPSurfaceInterfaceV0 gSurfaceI;
-extern ANPSystemInterfaceV0 gSystemI;
-extern ANPTypefaceInterfaceV0 gTypefaceI;
-extern ANPWindowInterfaceV0 gWindowI;
-
-///////////////////////////////////////////////////////////////////////////////
-
-PaintPlugin::PaintPlugin(NPP inst) : SurfaceSubPlugin(inst) {
-
- m_isTouchActive = false;
- m_isTouchCurrentInput = true;
- m_activePaintColor = s_redColor;
-
- memset(&m_drawingSurface, 0, sizeof(m_drawingSurface));
- memset(&m_inputToggle, 0, sizeof(m_inputToggle));
- memset(&m_colorToggle, 0, sizeof(m_colorToggle));
- memset(&m_fullScreenToggle, 0, sizeof(m_fullScreenToggle));
- memset(&m_clearSurface, 0, sizeof(m_clearSurface));
-
- // initialize the drawing surface
- m_surface = NULL;
-
- // initialize the path
- m_touchPath = gPathI.newPath();
- if(!m_touchPath)
- gLogI.log(kError_ANPLogType, "----%p Unable to create the touch path", inst);
-
- // initialize the paint colors
- m_paintSurface = gPaintI.newPaint();
- gPaintI.setFlags(m_paintSurface, gPaintI.getFlags(m_paintSurface) | kAntiAlias_ANPPaintFlag);
- gPaintI.setColor(m_paintSurface, 0xFFC0C0C0);
- gPaintI.setTextSize(m_paintSurface, 18);
-
- m_paintButton = gPaintI.newPaint();
- gPaintI.setFlags(m_paintButton, gPaintI.getFlags(m_paintButton) | kAntiAlias_ANPPaintFlag);
- gPaintI.setColor(m_paintButton, 0xFFA8A8A8);
-
- // initialize the typeface (set the colors)
- ANPTypeface* tf = gTypefaceI.createFromName("serif", kItalic_ANPTypefaceStyle);
- gPaintI.setTypeface(m_paintSurface, tf);
- gTypefaceI.unref(tf);
-
- //register for touch events
- ANPEventFlags flags = kTouch_ANPEventFlag;
- NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags);
- if (err != NPERR_NO_ERROR) {
- gLogI.log(kError_ANPLogType, "Error selecting input events.");
- }
-}
-
-PaintPlugin::~PaintPlugin() {
- gPathI.deletePath(m_touchPath);
- gPaintI.deletePaint(m_paintSurface);
- gPaintI.deletePaint(m_paintButton);
-
- setContext(NULL);
- destroySurface();
-}
-
-ANPCanvas* PaintPlugin::getCanvas(ANPRectI* dirtyRect) {
-
- ANPBitmap bitmap;
- JNIEnv* env = NULL;
- if (!m_surface || gVM->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK ||
- !gSurfaceI.lock(env, m_surface, &bitmap, dirtyRect)) {
- return NULL;
- }
-
- ANPCanvas* canvas = gCanvasI.newCanvas(&bitmap);
-
- // clip the canvas to the dirty rect b/c the surface is only required to
- // copy a minimum of the dirty rect and may copy more. The clipped canvas
- // however will never write to pixels outside of the clipped area.
- if (dirtyRect) {
- ANPRectF clipR;
- clipR.left = dirtyRect->left;
- clipR.top = dirtyRect->top;
- clipR.right = dirtyRect->right;
- clipR.bottom = dirtyRect->bottom;
- gCanvasI.clipRect(canvas, &clipR);
- }
-
- return canvas;
-}
-
-ANPCanvas* PaintPlugin::getCanvas(ANPRectF* dirtyRect) {
-
- ANPRectI newRect;
- newRect.left = (int) dirtyRect->left;
- newRect.top = (int) dirtyRect->top;
- newRect.right = (int) dirtyRect->right;
- newRect.bottom = (int) dirtyRect->bottom;
-
- return getCanvas(&newRect);
-}
-
-void PaintPlugin::releaseCanvas(ANPCanvas* canvas) {
- JNIEnv* env = NULL;
- if (m_surface && gVM->GetEnv((void**) &env, JNI_VERSION_1_4) == JNI_OK) {
- gSurfaceI.unlock(env, m_surface);
- }
- gCanvasI.deleteCanvas(canvas);
-}
-
-void PaintPlugin::drawCleanPlugin(ANPCanvas* canvas) {
- NPP instance = this->inst();
- PluginObject *obj = (PluginObject*) instance->pdata;
-
- // if no canvas get a locked canvas
- if (!canvas)
- canvas = getCanvas();
-
- if (!canvas)
- return;
-
- const float buttonWidth = 60;
- const float buttonHeight = 30;
- const int W = obj->window->width;
- const int H = obj->window->height;
-
- // color the plugin canvas
- gCanvasI.drawColor(canvas, 0xFFCDCDCD);
-
- // get font metrics
- ANPFontMetrics fontMetrics;
- gPaintI.getFontMetrics(m_paintSurface, &fontMetrics);
-
- // draw the input toggle button
- m_inputToggle.left = 5;
- m_inputToggle.top = H - buttonHeight - 5;
- m_inputToggle.right = m_inputToggle.left + buttonWidth;
- m_inputToggle.bottom = m_inputToggle.top + buttonHeight;
- gCanvasI.drawRect(canvas, &m_inputToggle, m_paintButton);
- const char* inputText = m_isTouchCurrentInput ? "Touch" : "Mouse";
- gCanvasI.drawText(canvas, inputText, strlen(inputText), m_inputToggle.left + 5,
- m_inputToggle.top - fontMetrics.fTop, m_paintSurface);
-
- // draw the color selector button
- m_colorToggle.left = (W/3) - (buttonWidth/2);
- m_colorToggle.top = H - buttonHeight - 5;
- m_colorToggle.right = m_colorToggle.left + buttonWidth;
- m_colorToggle.bottom = m_colorToggle.top + buttonHeight;
- gCanvasI.drawRect(canvas, &m_colorToggle, m_paintButton);
- const char* colorText = getColorText();
- gCanvasI.drawText(canvas, colorText, strlen(colorText), m_colorToggle.left + 5,
- m_colorToggle.top - fontMetrics.fTop, m_paintSurface);
-
- // draw the full-screen toggle button
- m_fullScreenToggle.left = ((W*2)/3) - (buttonWidth/2);
- m_fullScreenToggle.top = H - buttonHeight - 5;
- m_fullScreenToggle.right = m_fullScreenToggle.left + buttonWidth;
- m_fullScreenToggle.bottom = m_fullScreenToggle.top + buttonHeight;
- gCanvasI.drawRect(canvas, &m_fullScreenToggle, m_paintButton);
- const char* fullScreenText = "Full";
- gCanvasI.drawText(canvas, fullScreenText, strlen(fullScreenText),
- m_fullScreenToggle.left + 5,
- m_fullScreenToggle.top - fontMetrics.fTop, m_paintSurface);
-
- // draw the clear canvas button
- m_clearSurface.left = W - buttonWidth - 5;
- m_clearSurface.top = H - buttonHeight - 5;
- m_clearSurface.right = m_clearSurface.left + buttonWidth;
- m_clearSurface.bottom = m_clearSurface.top + buttonHeight;
- gCanvasI.drawRect(canvas, &m_clearSurface, m_paintButton);
- const char* clearText = "Clear";
- gCanvasI.drawText(canvas, clearText, strlen(clearText), m_clearSurface.left + 5,
- m_clearSurface.top - fontMetrics.fTop, m_paintSurface);
-
- // draw the drawing surface box (5 px from the edge)
- m_drawingSurface.left = 5;
- m_drawingSurface.top = 5;
- m_drawingSurface.right = W - 5;
- m_drawingSurface.bottom = m_colorToggle.top - 5;
- gCanvasI.drawRect(canvas, &m_drawingSurface, m_paintSurface);
-
- // release the canvas
- releaseCanvas(canvas);
-}
-
-const char* PaintPlugin::getColorText() {
-
- if (m_activePaintColor == s_blueColor)
- return "Blue";
- else if (m_activePaintColor == s_greenColor)
- return "Green";
- else
- return "Red";
-}
-
-jobject PaintPlugin::getSurface() {
- if (m_surface) {
- return m_surface;
- }
-
- // load the appropriate java class and instantiate it
- JNIEnv* env = NULL;
- if (gVM->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
- gLogI.log(kError_ANPLogType, " ---- getSurface: failed to get env");
- return NULL;
- }
-
- const char* className = "com.android.sampleplugin.PaintSurface";
- jclass paintClass = gSystemI.loadJavaClass(inst(), className);
-
- if(!paintClass) {
- gLogI.log(kError_ANPLogType, " ---- getSurface: failed to load class");
- return NULL;
- }
-
- PluginObject *obj = (PluginObject*) inst()->pdata;
- const int pW = obj->window->width;
- const int pH = obj->window->height;
-
- jmethodID constructor = env->GetMethodID(paintClass, "<init>", "(Landroid/content/Context;III)V");
- jobject paintSurface = env->NewObject(paintClass, constructor, m_context, (int)inst(), pW, pH);
-
- if(!paintSurface) {
- gLogI.log(kError_ANPLogType, " ---- getSurface: failed to construct object");
- return NULL;
- }
-
- m_surface = env->NewGlobalRef(paintSurface);
- return m_surface;
-}
-
-void PaintPlugin::destroySurface() {
- JNIEnv* env = NULL;
- if (m_surface && gVM->GetEnv((void**) &env, JNI_VERSION_1_4) == JNI_OK) {
-
- // detach the native code from the object
- jclass javaClass = env->GetObjectClass(m_surface);
- jmethodID invalMethod = env->GetMethodID(javaClass, "invalidateNPP", "()V");
- env->CallVoidMethod(m_surface, invalMethod);
-
- env->DeleteGlobalRef(m_surface);
- m_surface = NULL;
- }
-}
-
-int16_t PaintPlugin::handleEvent(const ANPEvent* evt) {
- switch (evt->eventType) {
- case kTouch_ANPEventType: {
- float x = (float) evt->data.touch.x;
- float y = (float) evt->data.touch.y;
- if (kDown_ANPTouchAction == evt->data.touch.action && m_isTouchCurrentInput) {
-
- ANPRectF* rect = validTouch(evt->data.touch.x, evt->data.touch.y);
- if(rect == &m_drawingSurface) {
- m_isTouchActive = true;
- gPathI.moveTo(m_touchPath, x, y);
- paintTouch();
- return 1;
- }
-
- } else if (kMove_ANPTouchAction == evt->data.touch.action && m_isTouchActive) {
- gPathI.lineTo(m_touchPath, x, y);
- paintTouch();
- return 1;
- } else if (kUp_ANPTouchAction == evt->data.touch.action && m_isTouchActive) {
- gPathI.lineTo(m_touchPath, x, y);
- paintTouch();
- m_isTouchActive = false;
- gPathI.reset(m_touchPath);
- return 1;
- } else if (kCancel_ANPTouchAction == evt->data.touch.action) {
- m_isTouchActive = false;
- gPathI.reset(m_touchPath);
- return 1;
- } else if (kDoubleTap_ANPTouchAction == evt->data.touch.action) {
- gWindowI.requestCenterFitZoom(inst());
- return 1;
-
- }
- break;
- }
- case kMouse_ANPEventType: {
-
- if (m_isTouchActive)
- gLogI.log(kError_ANPLogType, "----%p Received unintended mouse event", inst());
-
- if (kDown_ANPMouseAction == evt->data.mouse.action) {
- ANPRectF* rect = validTouch(evt->data.mouse.x, evt->data.mouse.y);
- if (rect == &m_drawingSurface)
- paintMouse(evt->data.mouse.x, evt->data.mouse.y);
- else if (rect == &m_inputToggle)
- toggleInputMethod();
- else if (rect == &m_colorToggle)
- togglePaintColor();
- else if (rect == &m_fullScreenToggle)
- gWindowI.requestFullScreen(inst());
- else if (rect == &m_clearSurface)
- drawCleanPlugin();
- }
- return 1;
- }
- case kCustom_ANPEventType: {
-
- switch (evt->data.other[0]) {
- case kSurfaceCreated_CustomEvent:
- gLogI.log(kDebug_ANPLogType, " ---- customEvent: surfaceCreated");
- /* The second draw call is added to cover up a problem in this
- plugin and is not a recommended usage pattern. This plugin
- does not correctly make partial updates to the double
- buffered surface and this second call hides that problem.
- */
- drawCleanPlugin();
- drawCleanPlugin();
- break;
- case kSurfaceChanged_CustomEvent: {
- gLogI.log(kDebug_ANPLogType, " ---- customEvent: surfaceChanged");
-
- int width = evt->data.other[1];
- int height = evt->data.other[2];
-
- PluginObject *obj = (PluginObject*) inst()->pdata;
- const int pW = obj->window->width;
- const int pH = obj->window->height;
- // compare to the plugin's surface dimensions
- if (pW != width || pH != height)
- gLogI.log(kError_ANPLogType,
- "----%p Invalid Surface Dimensions (%d,%d):(%d,%d)",
- inst(), pW, pH, width, height);
- break;
- }
- case kSurfaceDestroyed_CustomEvent:
- gLogI.log(kDebug_ANPLogType, " ---- customEvent: surfaceDestroyed");
- break;
- }
- break; // end KCustom_ANPEventType
- }
- default:
- break;
- }
- return 0; // unknown or unhandled event
-}
-
-ANPRectF* PaintPlugin::validTouch(int x, int y) {
-
- //convert to float
- float fx = (int) x;
- float fy = (int) y;
-
- if (fx > m_drawingSurface.left && fx < m_drawingSurface.right && fy > m_drawingSurface.top && fy < m_drawingSurface.bottom)
- return &m_drawingSurface;
- else if (fx > m_inputToggle.left && fx < m_inputToggle.right && fy > m_inputToggle.top && fy < m_inputToggle.bottom)
- return &m_inputToggle;
- else if (fx > m_colorToggle.left && fx < m_colorToggle.right && fy > m_colorToggle.top && fy < m_colorToggle.bottom)
- return &m_colorToggle;
- else if (fx > m_fullScreenToggle.left && fx < m_fullScreenToggle.right && fy > m_fullScreenToggle.top && fy < m_fullScreenToggle.bottom)
- return &m_fullScreenToggle;
- else if (fx > m_clearSurface.left && fx < m_clearSurface.right && fy > m_clearSurface.top && fy < m_clearSurface.bottom)
- return &m_clearSurface;
- else
- return NULL;
-}
-
-void PaintPlugin::toggleInputMethod() {
- m_isTouchCurrentInput = !m_isTouchCurrentInput;
-
- // lock only the input toggle and redraw the canvas
- ANPCanvas* lockedCanvas = getCanvas(&m_inputToggle);
- drawCleanPlugin(lockedCanvas);
-}
-
-void PaintPlugin::togglePaintColor() {
- if (m_activePaintColor == s_blueColor)
- m_activePaintColor = s_redColor;
- else if (m_activePaintColor == s_greenColor)
- m_activePaintColor = s_blueColor;
- else
- m_activePaintColor = s_greenColor;
-
- // lock only the color toggle and redraw the canvas
- ANPCanvas* lockedCanvas = getCanvas(&m_colorToggle);
- drawCleanPlugin(lockedCanvas);
-}
-
-void PaintPlugin::paintMouse(int x, int y) {
- //TODO do not paint outside the drawing surface
-
- //create the paint color
- ANPPaint* fillPaint = gPaintI.newPaint();
- gPaintI.setFlags(fillPaint, gPaintI.getFlags(fillPaint) | kAntiAlias_ANPPaintFlag);
- gPaintI.setStyle(fillPaint, kFill_ANPPaintStyle);
- gPaintI.setColor(fillPaint, m_activePaintColor);
-
- // handle the simple "mouse" paint (draw a point)
- ANPRectF point;
- point.left = (float) x-3;
- point.top = (float) y-3;
- point.right = (float) x+3;
- point.bottom = (float) y+3;
-
- // get a canvas that is only locked around the point and draw it
- ANPCanvas* canvas = getCanvas(&point);
- gCanvasI.drawOval(canvas, &point, fillPaint);
-
- // clean up
- releaseCanvas(canvas);
- gPaintI.deletePaint(fillPaint);
-}
-
-void PaintPlugin::paintTouch() {
- //TODO do not paint outside the drawing surface
-
- //create the paint color
- ANPPaint* strokePaint = gPaintI.newPaint();
- gPaintI.setFlags(strokePaint, gPaintI.getFlags(strokePaint) | kAntiAlias_ANPPaintFlag);
- gPaintI.setColor(strokePaint, m_activePaintColor);
- gPaintI.setStyle(strokePaint, kStroke_ANPPaintStyle);
- gPaintI.setStrokeWidth(strokePaint, 6.0);
- gPaintI.setStrokeCap(strokePaint, kRound_ANPPaintCap);
- gPaintI.setStrokeJoin(strokePaint, kRound_ANPPaintJoin);
-
- // handle the complex "touch" paint (draw a line)
- ANPRectF bounds;
- gPathI.getBounds(m_touchPath, &bounds);
-
- // get a canvas that is only locked around the point and draw the path
- ANPCanvas* canvas = getCanvas(&bounds);
- gCanvasI.drawPath(canvas, m_touchPath, strokePaint);
-
- // clean up
- releaseCanvas(canvas);
- gPaintI.deletePaint(strokePaint);
-}
diff --git a/samples/BrowserPlugin/jni/paint/PaintPlugin.h b/samples/BrowserPlugin/jni/paint/PaintPlugin.h
deleted file mode 100644
index ffdf6248c..000000000
--- a/samples/BrowserPlugin/jni/paint/PaintPlugin.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "PluginObject.h"
-#include <stdio.h>
-
-#ifndef paintPlugin__DEFINED
-#define paintPlugin__DEFINED
-
-class PaintPlugin : public SurfaceSubPlugin {
-public:
- PaintPlugin(NPP inst);
- virtual ~PaintPlugin();
- virtual int16_t handleEvent(const ANPEvent* evt);
- virtual jobject getSurface();
-
-private:
- void drawCleanPlugin(ANPCanvas* canvas = NULL);
- ANPCanvas* getCanvas(ANPRectI* dirtyRect = NULL);
- ANPCanvas* getCanvas(ANPRectF* dirtyRect);
- const char* getColorText();
- void destroySurface();
- void paintMouse(int x, int y);
- void paintTouch();
- void releaseCanvas(ANPCanvas*);
- void toggleInputMethod();
- void togglePaintColor();
- ANPRectF* validTouch(int x, int y);
-
- bool m_isTouchActive;
- bool m_isTouchCurrentInput;
-
- jobject m_surface;
- ANPPath* m_touchPath;
-
- ANPRectF m_drawingSurface;
- ANPRectF m_inputToggle;
- ANPRectF m_colorToggle;
- ANPRectF m_fullScreenToggle;
- ANPRectF m_clearSurface;
-
- ANPPaint* m_paintSurface;
- ANPPaint* m_paintButton;
-
- ANPColor m_activePaintColor;
- static const ANPColor s_redColor = 0xFFFF0000;
- static const ANPColor s_greenColor = 0xFF00FF00;
- static const ANPColor s_blueColor = 0xFF0000FF;
-};
-
-#endif // paintPlugin__DEFINED
diff --git a/samples/BrowserPlugin/jni/video/VideoPlugin.cpp b/samples/BrowserPlugin/jni/video/VideoPlugin.cpp
deleted file mode 100644
index bf3ab7666..000000000
--- a/samples/BrowserPlugin/jni/video/VideoPlugin.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "VideoPlugin.h"
-#include "android_npapi.h"
-
-#include <stdio.h>
-#include <sys/time.h>
-#include <time.h>
-#include <math.h>
-#include <string.h>
-
-extern NPNetscapeFuncs* browser;
-extern ANPBitmapInterfaceV0 gBitmapI;
-extern ANPCanvasInterfaceV0 gCanvasI;
-extern ANPLogInterfaceV0 gLogI;
-extern ANPPaintInterfaceV0 gPaintI;
-extern ANPSurfaceInterfaceV0 gSurfaceI;
-extern ANPSystemInterfaceV0 gSystemI;
-extern ANPTypefaceInterfaceV0 gTypefaceI;
-extern ANPWindowInterfaceV0 gWindowI;
-
-///////////////////////////////////////////////////////////////////////////////
-
-VideoPlugin::VideoPlugin(NPP inst) : SurfaceSubPlugin(inst) {
-
- // initialize the drawing surface
- m_surface = NULL;
-
- //register for touch events
- ANPEventFlags flags = kTouch_ANPEventFlag;
- NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags);
- if (err != NPERR_NO_ERROR) {
- gLogI.log(kError_ANPLogType, "Error selecting input events.");
- }
-}
-
-VideoPlugin::~VideoPlugin() {
- setContext(NULL);
- destroySurface();
-}
-
-jobject VideoPlugin::getSurface() {
-
- if (m_surface) {
- return m_surface;
- }
-
- // load the appropriate java class and instantiate it
- JNIEnv* env = NULL;
- if (gVM->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
- gLogI.log(kError_ANPLogType, " ---- getSurface: failed to get env");
- return NULL;
- }
-
- const char* className = "com.android.sampleplugin.VideoSurface";
- jclass videoClass = gSystemI.loadJavaClass(inst(), className);
-
- if(!videoClass) {
- gLogI.log(kError_ANPLogType, " ---- getSurface: failed to load class");
- return NULL;
- }
-
- jmethodID constructor = env->GetMethodID(videoClass, "<init>", "(Landroid/content/Context;)V");
- jobject videoSurface = env->NewObject(videoClass, constructor, m_context);
-
- if(!videoSurface) {
- gLogI.log(kError_ANPLogType, " ---- getSurface: failed to construct object");
- return NULL;
- }
-
- m_surface = env->NewGlobalRef(videoSurface);
- return m_surface;
-}
-
-void VideoPlugin::destroySurface() {
- JNIEnv* env = NULL;
- if (m_surface && gVM->GetEnv((void**) &env, JNI_VERSION_1_4) == JNI_OK) {
- env->DeleteGlobalRef(m_surface);
- m_surface = NULL;
- }
-}
-
-int16_t VideoPlugin::handleEvent(const ANPEvent* evt) {
- switch (evt->eventType) {
- case kLifecycle_ANPEventType: {
- switch (evt->data.lifecycle.action) {
- case kEnterFullScreen_ANPLifecycleAction:
- gLogI.log(kDebug_ANPLogType, " ---- %p entering fullscreen", inst());
- break;
- case kExitFullScreen_ANPLifecycleAction:
- gLogI.log(kDebug_ANPLogType, " ---- %p exiting fullscreen", inst());
- break;
- }
- break; // end kLifecycle_ANPEventType
- }
- case kDraw_ANPEventType:
- gLogI.log(kError_ANPLogType, " ------ %p the plugin did not request draw events", inst());
- break;
- case kTouch_ANPEventType:
- if (kDown_ANPTouchAction == evt->data.touch.action) {
- gLogI.log(kDebug_ANPLogType, " ------ %p requesting fullscreen mode", inst());
- gWindowI.requestFullScreen(inst());
- }
- return 1;
- case kKey_ANPEventType:
- gLogI.log(kError_ANPLogType, " ------ %p the plugin did not request key events", inst());
- break;
- default:
- break;
- }
- return 0; // unknown or unhandled event
-}
diff --git a/samples/BrowserPlugin/jni/video/VideoPlugin.h b/samples/BrowserPlugin/jni/video/VideoPlugin.h
deleted file mode 100644
index fb1538690..000000000
--- a/samples/BrowserPlugin/jni/video/VideoPlugin.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "PluginObject.h"
-
-#ifndef videoPlugin__DEFINED
-#define videoPlugin__DEFINED
-
-class VideoPlugin : public SurfaceSubPlugin {
-public:
- VideoPlugin(NPP inst);
- virtual ~VideoPlugin();
- virtual int16_t handleEvent(const ANPEvent* evt);
- virtual jobject getSurface();
-
-private:
- void destroySurface();
-
- jobject m_surface;
-};
-
-#endif // videoPlugin__DEFINED
diff --git a/samples/BrowserPlugin/res/drawable-hdpi/sample_browser_plugin.png b/samples/BrowserPlugin/res/drawable-hdpi/sample_browser_plugin.png
deleted file mode 100755
index 4d9d559d4..000000000
--- a/samples/BrowserPlugin/res/drawable-hdpi/sample_browser_plugin.png
+++ /dev/null
Binary files differ
diff --git a/samples/BrowserPlugin/res/drawable-mdpi/sample_browser_plugin.png b/samples/BrowserPlugin/res/drawable-mdpi/sample_browser_plugin.png
deleted file mode 100755
index 47c79d1c1..000000000
--- a/samples/BrowserPlugin/res/drawable-mdpi/sample_browser_plugin.png
+++ /dev/null
Binary files differ
diff --git a/samples/BrowserPlugin/src/com/android/sampleplugin/AnimationSurface.java b/samples/BrowserPlugin/src/com/android/sampleplugin/AnimationSurface.java
deleted file mode 100644
index e3afab662..000000000
--- a/samples/BrowserPlugin/src/com/android/sampleplugin/AnimationSurface.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.android.sampleplugin;
-
-import android.content.Context;
-import android.graphics.Color;
-import android.util.Log;
-import android.widget.TextView;
-
-public class AnimationSurface extends TextView {
-
- public AnimationSurface(Context context) {
- super(context);
-
- Log.e("AnimSurface", "IN ANIMATION SURFACE");
-
- this.setBackgroundColor(Color.GRAY);
- this.setTextColor(Color.WHITE);
- this.setText("This is a full-screen plugin");
-
- // ensure that the view system is aware that we will be drawing
- this.setWillNotDraw(false);
- }
-}
diff --git a/samples/BrowserPlugin/src/com/android/sampleplugin/BackgroundSurface.java b/samples/BrowserPlugin/src/com/android/sampleplugin/BackgroundSurface.java
deleted file mode 100644
index 5af8c8e24..000000000
--- a/samples/BrowserPlugin/src/com/android/sampleplugin/BackgroundSurface.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.android.sampleplugin;
-
-import android.content.Context;
-import android.graphics.Color;
-import android.widget.TextView;
-
-public class BackgroundSurface extends TextView {
-
- public BackgroundSurface(Context context) {
- super(context);
-
- this.setBackgroundColor(Color.BLACK);
- this.setTextColor(Color.WHITE);
- this.setText("This is a java background plugin");
-
- // ensure that the view system is aware that we will be drawing
- this.setWillNotDraw(false);
- }
-}
diff --git a/samples/BrowserPlugin/src/com/android/sampleplugin/BackgroundTest.java b/samples/BrowserPlugin/src/com/android/sampleplugin/BackgroundTest.java
deleted file mode 100644
index 1f6b0d4e4..000000000
--- a/samples/BrowserPlugin/src/com/android/sampleplugin/BackgroundTest.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.android.sampleplugin;
-
-public class BackgroundTest {
-
- public BackgroundTest() {}
-
- public int addInt(int x, int y) {
- return x + y;
- }
-
-}
diff --git a/samples/BrowserPlugin/src/com/android/sampleplugin/PaintSurface.java b/samples/BrowserPlugin/src/com/android/sampleplugin/PaintSurface.java
deleted file mode 100644
index 9582bccd9..000000000
--- a/samples/BrowserPlugin/src/com/android/sampleplugin/PaintSurface.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package com.android.sampleplugin;
-
-import android.content.Context;
-import android.graphics.PixelFormat;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
-import android.view.SurfaceHolder.Callback;
-
-public class PaintSurface extends SurfaceView {
-
- static {
- //needed for jni calls
- System.loadLibrary("sampleplugin");
- }
-
- private final int npp;
-
- private boolean validNPP = true;
- private Object nppLock = new Object();
-
- public PaintSurface(Context context, int NPP, int width, int height) {
- super(context);
-
- this.npp = NPP;
-
- this.getHolder().setFormat(PixelFormat.RGBA_8888);
- this.getHolder().addCallback(new Callback() {
-
- public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
- synchronized (nppLock) {
- if (validNPP) {
- nativeSurfaceChanged(npp, format, width, height);
- }
- }
- }
-
- public void surfaceCreated(SurfaceHolder holder) {
- synchronized (nppLock) {
- if (validNPP) {
- nativeSurfaceCreated(npp);
- }
- }
- }
-
- public void surfaceDestroyed(SurfaceHolder holder) {
- synchronized (nppLock) {
- if (validNPP) {
- nativeSurfaceDestroyed(npp);
- }
- }
- }
- });
-
- // sets the plugin's surface to a fixed size
- this.getHolder().setFixedSize(width, height);
-
- // ensure that the view system is aware that we will be drawing
- this.setWillNotDraw(false);
- }
-
- // called by JNI
- private void invalidateNPP() {
- synchronized (nppLock) {
- validNPP = false;
- }
- }
-
- private native void nativeSurfaceCreated(int npp);
- private native void nativeSurfaceChanged(int npp, int format, int width, int height);
- private native void nativeSurfaceDestroyed(int npp);
-}
diff --git a/samples/BrowserPlugin/src/com/android/sampleplugin/SamplePlugin.java b/samples/BrowserPlugin/src/com/android/sampleplugin/SamplePlugin.java
deleted file mode 100644
index b5b728eb3..000000000
--- a/samples/BrowserPlugin/src/com/android/sampleplugin/SamplePlugin.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package com.android.sampleplugin;
-
-import android.app.Service;
-import android.content.Intent;
-import android.os.IBinder;
-
-public class SamplePlugin extends Service {
-
- @Override
- public IBinder onBind(Intent intent) {
- // TODO Auto-generated method stub
- return null;
- }
-}
diff --git a/samples/BrowserPlugin/src/com/android/sampleplugin/VideoSurface.java b/samples/BrowserPlugin/src/com/android/sampleplugin/VideoSurface.java
deleted file mode 100644
index a3c80cfa7..000000000
--- a/samples/BrowserPlugin/src/com/android/sampleplugin/VideoSurface.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package com.android.sampleplugin;
-
-import com.android.sampleplugin.graphics.CubeRenderer;
-
-import android.content.Context;
-import android.opengl.GLSurfaceView;
-import android.view.WindowManager;
-import android.widget.FrameLayout;
-import android.widget.MediaController;
-import android.widget.VideoView;
-
-public class VideoSurface extends FrameLayout {
-
- public VideoSurface(Context context) {
- super(context);
-
- LayoutParams fp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
- this.setLayoutParams(fp);
-
-// VideoView video = new VideoView(context);
-// LayoutParams vp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
-// vp.setLayoutParams(vp);
-
- GLSurfaceView gl = new GLSurfaceView(context);
- LayoutParams gp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
- gl.setLayoutParams(gp);
-
- this.addView(gl);
-// this.addView(video);
-
- // Tell the cube renderer that we want to render a translucent version
- // of the cube:
- gl.setRenderer(new CubeRenderer(false));
- gl.setWindowType(WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY);
-
-// video.setVideoPath("/sdcard/test_video.3gp");
-// video.setMediaController(new MediaController(context));
-// video.requestFocus();
-
- // ensure that the view system is aware that we will be drawing
- this.setWillNotDraw(false);
- }
-}
diff --git a/samples/BrowserPlugin/src/com/android/sampleplugin/graphics/Cube.java b/samples/BrowserPlugin/src/com/android/sampleplugin/graphics/Cube.java
deleted file mode 100644
index 9ad1410ea..000000000
--- a/samples/BrowserPlugin/src/com/android/sampleplugin/graphics/Cube.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2009 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.sampleplugin.graphics;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.IntBuffer;
-
-import javax.microedition.khronos.opengles.GL10;
-
-/**
- * A vertex shaded cube.
- */
-class Cube
-{
- public Cube()
- {
- int one = 0x10000;
- int vertices[] = {
- -one, -one, -one,
- one, -one, -one,
- one, one, -one,
- -one, one, -one,
- -one, -one, one,
- one, -one, one,
- one, one, one,
- -one, one, one,
- };
-
- int colors[] = {
- 0, 0, 0, one,
- one, 0, 0, one,
- one, one, 0, one,
- 0, one, 0, one,
- 0, 0, one, one,
- one, 0, one, one,
- one, one, one, one,
- 0, one, one, one,
- };
-
- byte indices[] = {
- 0, 4, 5, 0, 5, 1,
- 1, 5, 6, 1, 6, 2,
- 2, 6, 7, 2, 7, 3,
- 3, 7, 4, 3, 4, 0,
- 4, 7, 6, 4, 6, 5,
- 3, 0, 1, 3, 1, 2
- };
-
- // Buffers to be passed to gl*Pointer() functions
- // must be direct, i.e., they must be placed on the
- // native heap where the garbage collector cannot
- // move them.
- //
- // Buffers with multi-byte datatypes (e.g., short, int, float)
- // must have their byte order set to native order
-
- ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length*4);
- vbb.order(ByteOrder.nativeOrder());
- mVertexBuffer = vbb.asIntBuffer();
- mVertexBuffer.put(vertices);
- mVertexBuffer.position(0);
-
- ByteBuffer cbb = ByteBuffer.allocateDirect(colors.length*4);
- cbb.order(ByteOrder.nativeOrder());
- mColorBuffer = cbb.asIntBuffer();
- mColorBuffer.put(colors);
- mColorBuffer.position(0);
-
- mIndexBuffer = ByteBuffer.allocateDirect(indices.length);
- mIndexBuffer.put(indices);
- mIndexBuffer.position(0);
- }
-
- public void draw(GL10 gl)
- {
- gl.glFrontFace(gl.GL_CW);
- gl.glVertexPointer(3, gl.GL_FIXED, 0, mVertexBuffer);
- gl.glColorPointer(4, gl.GL_FIXED, 0, mColorBuffer);
- gl.glDrawElements(gl.GL_TRIANGLES, 36, gl.GL_UNSIGNED_BYTE, mIndexBuffer);
- }
-
- private IntBuffer mVertexBuffer;
- private IntBuffer mColorBuffer;
- private ByteBuffer mIndexBuffer;
-}
diff --git a/samples/BrowserPlugin/src/com/android/sampleplugin/graphics/CubeRenderer.java b/samples/BrowserPlugin/src/com/android/sampleplugin/graphics/CubeRenderer.java
deleted file mode 100644
index 246ac15a0..000000000
--- a/samples/BrowserPlugin/src/com/android/sampleplugin/graphics/CubeRenderer.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2009 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.sampleplugin.graphics;
-
-import javax.microedition.khronos.egl.EGL10;
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.opengles.GL10;
-
-import android.opengl.GLSurfaceView;
-
-/**
- * Render a pair of tumbling cubes.
- */
-
-public class CubeRenderer implements GLSurfaceView.Renderer {
- public CubeRenderer(boolean useTranslucentBackground) {
- mTranslucentBackground = useTranslucentBackground;
- mCube = new Cube();
- }
-
- public void onDrawFrame(GL10 gl) {
- /*
- * Usually, the first thing one might want to do is to clear
- * the screen. The most efficient way of doing this is to use
- * glClear().
- */
-
- gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
-
- /*
- * Now we're ready to draw some 3D objects
- */
-
- gl.glMatrixMode(GL10.GL_MODELVIEW);
- gl.glLoadIdentity();
- gl.glTranslatef(0, 0, -3.0f);
- gl.glRotatef(mAngle, 0, 1, 0);
- gl.glRotatef(mAngle*0.25f, 1, 0, 0);
-
- gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
- gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
-
- mCube.draw(gl);
-
- gl.glRotatef(mAngle*2.0f, 0, 1, 1);
- gl.glTranslatef(0.5f, 0.5f, 0.5f);
-
- mCube.draw(gl);
-
- mAngle += 1.2f;
- }
-
- public void onSurfaceChanged(GL10 gl, int width, int height) {
- gl.glViewport(0, 0, width, height);
-
- /*
- * Set our projection matrix. This doesn't have to be done
- * each time we draw, but usually a new projection needs to
- * be set when the viewport is resized.
- */
-
- float ratio = (float) width / height;
- gl.glMatrixMode(GL10.GL_PROJECTION);
- gl.glLoadIdentity();
- gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);
- }
-
- public void onSurfaceCreated(GL10 gl, EGLConfig config) {
- /*
- * By default, OpenGL enables features that improve quality
- * but reduce performance. One might want to tweak that
- * especially on software renderer.
- */
- gl.glDisable(GL10.GL_DITHER);
-
- /*
- * Some one-time OpenGL initialization can be made here
- * probably based on features of this particular context
- */
- gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT,
- GL10.GL_FASTEST);
-
- if (mTranslucentBackground) {
- gl.glClearColor(0,0,0,0);
- } else {
- gl.glClearColor(1,1,1,1);
- }
- gl.glEnable(GL10.GL_CULL_FACE);
- gl.glShadeModel(GL10.GL_SMOOTH);
- gl.glEnable(GL10.GL_DEPTH_TEST);
- }
- private boolean mTranslucentBackground;
- private Cube mCube;
- private float mAngle;
-}
diff --git a/samples/LunarLander/res/layout/lunar_layout.xml b/samples/LunarLander/res/layout/lunar_layout.xml
index f1a899080..bac81881d 100644
--- a/samples/LunarLander/res/layout/lunar_layout.xml
+++ b/samples/LunarLander/res/layout/lunar_layout.xml
@@ -15,21 +15,21 @@
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
<com.example.android.lunarlander.LunarView
android:id="@+id/lunar"
- android:layout_width="match_parent"
- android:layout_height="match_parent"/>
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"/>
<RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent" >
<TextView
android:id="@+id/text"
- android:text="@string/lunar_layout_text_text"
- android:visibility="visible"
+ android:text="@string/lunar_layout_text_text"
+ android:visibility="visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
diff --git a/samples/LunarLander/src/com/example/android/lunarlander/LunarLander.java b/samples/LunarLander/src/com/example/android/lunarlander/LunarLander.java
index 15c592334..03faee9f3 100644
--- a/samples/LunarLander/src/com/example/android/lunarlander/LunarLander.java
+++ b/samples/LunarLander/src/com/example/android/lunarlander/LunarLander.java
@@ -149,8 +149,8 @@ public class LunarLander extends Activity {
*/
@Override
protected void onPause() {
- super.onPause();
mLunarView.getThread().pause(); // pause game when Activity pauses
+ super.onPause();
}
/**
diff --git a/samples/LunarLander/src/com/example/android/lunarlander/LunarView.java b/samples/LunarLander/src/com/example/android/lunarlander/LunarView.java
index 2a46147ed..81e047084 100644
--- a/samples/LunarLander/src/com/example/android/lunarlander/LunarView.java
+++ b/samples/LunarLander/src/com/example/android/lunarlander/LunarView.java
@@ -196,6 +196,8 @@ class LunarView extends SurfaceView implements SurfaceHolder.Callback {
/** Indicate whether the surface has been created & is ready to draw */
private boolean mRun = false;
+ private final Object mRunLock = new Object();
+
/** Scratch rect object. */
private RectF mScratchRect;
@@ -356,7 +358,13 @@ class LunarView extends SurfaceView implements SurfaceHolder.Callback {
c = mSurfaceHolder.lockCanvas(null);
synchronized (mSurfaceHolder) {
if (mMode == STATE_RUNNING) updatePhysics();
- doDraw(c);
+ // Critical section. Do not allow mRun to be set false until
+ // we are sure all canvas draw operations are complete.
+ //
+ // If mRun has been toggled false, inhibit canvas operations.
+ synchronized (mRunLock) {
+ if (mRun) doDraw(c);
+ }
}
} finally {
// do this in a finally so that if an exception is thrown
@@ -427,7 +435,11 @@ class LunarView extends SurfaceView implements SurfaceHolder.Callback {
* @param b true to run, false to shut down
*/
public void setRunning(boolean b) {
- mRun = b;
+ // Do not allow mRun to be modified while any canvas operations
+ // are potentially in-flight. See doDraw().
+ synchronized (mRunLock) {
+ mRun = b;
+ }
}
/**
diff --git a/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/HelloCompute.java b/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/HelloCompute.java
index 0d6c47be1..165682135 100644
--- a/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/HelloCompute.java
+++ b/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/HelloCompute.java
@@ -58,7 +58,9 @@ public class HelloCompute extends Activity {
mInAllocation = Allocation.createFromBitmap(mRS, mBitmapIn,
Allocation.MipmapControl.MIPMAP_NONE,
Allocation.USAGE_SCRIPT);
- mOutAllocation = Allocation.createTyped(mRS, mInAllocation.getType());
+ mOutAllocation = Allocation.createFromBitmap(mRS, mBitmapOut,
+ Allocation.MipmapControl.MIPMAP_NONE,
+ Allocation.USAGE_SCRIPT);
mScript = new ScriptC_mono(mRS, getResources(), R.raw.mono);
diff --git a/samples/SimpleJNI/jni/Android.mk b/samples/SimpleJNI/jni/Android.mk
index a704fcf9a..538c6a05f 100644
--- a/samples/SimpleJNI/jni/Android.mk
+++ b/samples/SimpleJNI/jni/Android.mk
@@ -32,7 +32,7 @@ LOCAL_SRC_FILES:= \
# All of the shared libraries we link against.
LOCAL_SHARED_LIBRARIES := \
- libutils
+ libutils liblog
# No static libraries.
LOCAL_STATIC_LIBRARIES :=
diff --git a/samples/Support4Demos/AndroidManifest.xml b/samples/Support4Demos/AndroidManifest.xml
index b7478761d..1b015f10e 100644
--- a/samples/Support4Demos/AndroidManifest.xml
+++ b/samples/Support4Demos/AndroidManifest.xml
@@ -23,8 +23,9 @@
package="com.example.android.supportv4">
<uses-permission android:name="android.permission.READ_CONTACTS" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
- <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="13" />
+ <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="17" />
<!-- The smallest screen this app works on is a phone. The app will
scale its UI to larger screens but doesn't make good use of them
@@ -242,6 +243,17 @@
<service android:name=".content.LocalServiceBroadcaster$LocalService"
android:stopWithTask="true" />
+ <activity android:name=".content.SimpleWakefulController"
+ android:label="@string/simple_wakeful_controller">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <receiver android:name=".content.SimpleWakefulReceiver" />
+ <service android:name=".content.SimpleWakefulService" />
+
<activity android:name=".accessibility.AccessibilityManagerSupportActivity"
android:label="@string/accessibility_manager_title">
<intent-filter>
@@ -276,8 +288,62 @@
</intent-filter>
</activity>
+ <activity android:name=".text.BidiFormatterSupport"
+ android:label="@string/bidiformatter_support_title">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name=".widget.DrawerLayoutActivity"
+ android:label="@string/drawer_layout_support">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name=".widget.SlidingPaneLayoutActivity"
+ android:label="@string/sliding_pane_layout_support">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
<provider android:authorities="com.example.supportv4.content.sharingsupportprovider"
android:name=".content.SharingSupportProvider" />
+ <!-- FileProvider Example -->
+
+ <activity android:name=".content.FileProviderExample"
+ android:label="@string/file_provider_example">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+<!-- BEGIN_INCLUDE(file_provider_declaration) -->
+ <provider
+ android:name="android.support.v4.content.FileProvider"
+ android:authorities="com.example.android.supportv4.my_files"
+ android:grantUriPermissions="true"
+ android:exported="false">
+ <meta-data
+ android:name="android.support.FILE_PROVIDER_PATHS"
+ android:resource="@xml/my_paths" />
+ </provider>
+<!-- END_INCLUDE(file_provider_declaration) -->
+
+ <activity android:name=".media.TransportControllerActivity"
+ android:label="@string/sample_transport_controller_activity">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
</application>
</manifest>
diff --git a/samples/Support4Demos/res/drawable-hdpi/drawer_shadow.9.png b/samples/Support4Demos/res/drawable-hdpi/drawer_shadow.9.png
new file mode 100644
index 000000000..224cc4ff4
--- /dev/null
+++ b/samples/Support4Demos/res/drawable-hdpi/drawer_shadow.9.png
Binary files differ
diff --git a/samples/Support4Demos/res/drawable-hdpi/ic_drawer.png b/samples/Support4Demos/res/drawable-hdpi/ic_drawer.png
new file mode 100644
index 000000000..ff7b1def9
--- /dev/null
+++ b/samples/Support4Demos/res/drawable-hdpi/ic_drawer.png
Binary files differ
diff --git a/samples/Support4Demos/res/drawable-mdpi/drawer_shadow.9.png b/samples/Support4Demos/res/drawable-mdpi/drawer_shadow.9.png
new file mode 100644
index 000000000..3797f99c0
--- /dev/null
+++ b/samples/Support4Demos/res/drawable-mdpi/drawer_shadow.9.png
Binary files differ
diff --git a/samples/Support4Demos/res/drawable-mdpi/ic_drawer.png b/samples/Support4Demos/res/drawable-mdpi/ic_drawer.png
new file mode 100644
index 000000000..fb681ba26
--- /dev/null
+++ b/samples/Support4Demos/res/drawable-mdpi/ic_drawer.png
Binary files differ
diff --git a/samples/Support4Demos/res/drawable-xhdpi/drawer_shadow.9.png b/samples/Support4Demos/res/drawable-xhdpi/drawer_shadow.9.png
new file mode 100644
index 000000000..fa3d853e9
--- /dev/null
+++ b/samples/Support4Demos/res/drawable-xhdpi/drawer_shadow.9.png
Binary files differ
diff --git a/samples/Support4Demos/res/drawable-xhdpi/ic_drawer.png b/samples/Support4Demos/res/drawable-xhdpi/ic_drawer.png
new file mode 100644
index 000000000..b9bc3d70f
--- /dev/null
+++ b/samples/Support4Demos/res/drawable-xhdpi/ic_drawer.png
Binary files differ
diff --git a/samples/Support4Demos/res/layout/bidiformater_support.xml b/samples/Support4Demos/res/layout/bidiformater_support.xml
new file mode 100644
index 000000000..92f4ae0fa
--- /dev/null
+++ b/samples/Support4Demos/res/layout/bidiformater_support.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:padding="16dp"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <LinearLayout android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="24dip"
+ android:text="@string/without_bidiformatter"
+ />
+
+ <TextView android:id="@+id/textview_without_bidiformatter"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="24dip"
+ />
+
+ </LinearLayout>
+
+ <LinearLayout android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="24dip"
+ android:text="@string/with_bidiformatter"
+ />
+
+ <TextView android:id="@+id/textview_with_bidiformatter"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="24dip"
+ />
+
+ </LinearLayout>
+
+</LinearLayout>
diff --git a/samples/Support4Demos/res/layout/drawer_layout.xml b/samples/Support4Demos/res/layout/drawer_layout.xml
new file mode 100644
index 000000000..2ab0b1abe
--- /dev/null
+++ b/samples/Support4Demos/res/layout/drawer_layout.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<!--
+ A DrawerLayout is indended to be used as the top-level content view
+ using match_parent for both width and height to consume the full space available.
+-->
+<android.support.v4.widget.DrawerLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/drawer_layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <!-- As the main content view, the view below consumes the entire
+ space available using match_parent in both dimensions. -->
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
+ android:scrollbarStyle="outsideOverlay">
+ <TextView android:id="@+id/content_text"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:text="@string/drawer_layout_summary"
+ android:textAppearance="?android:attr/textAppearanceMedium"/>
+ </ScrollView>
+ <!-- android:layout_gravity="left" tells DrawerLayout to treat
+ this as a sliding drawer on the left side. The drawer is
+ given a fixed width in dp and extends the full height of
+ the container. A solid background is used for contrast
+ with the content view. -->
+ <ListView android:id="@+id/left_drawer"
+ android:layout_width="300dp"
+ android:layout_height="match_parent"
+ android:layout_gravity="left"
+ android:background="#ff333333"/>
+</android.support.v4.widget.DrawerLayout>
+
diff --git a/apps/FontLab/res/layout/font_lab.xml b/samples/Support4Demos/res/layout/file_provider_example.xml
index ff9db319a..2e53c3b83 100644
--- a/apps/FontLab/res/layout/font_lab.xml
+++ b/samples/Support4Demos/res/layout/file_provider_example.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
+<!-- Copyright (C) 2013 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.
@@ -15,16 +15,15 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/content"
- android:layout_width="match_parent" android:layout_height="match_parent"
android:orientation="vertical"
- android:paddingLeft="4dip" android:paddingRight="4dip"
- android:paddingTop="4dip" android:paddingBottom="4dip">
-
- <TextView android:id="@+id/column1" android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1"
- android:layout_marginBottom="8dip" />
- <TextView android:id="@+id/column2" android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" />
-
-</LinearLayout>
+ android:padding="16dp"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <Button
+ android:text="@string/share_file"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:onClick="onShareFileClick" />
+</LinearLayout>
diff --git a/samples/Support4Demos/res/layout/media_controller.xml b/samples/Support4Demos/res/layout/media_controller.xml
new file mode 100644
index 000000000..b5e58b184
--- /dev/null
+++ b/samples/Support4Demos/res/layout/media_controller.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="#CC000000"
+ android:orientation="vertical"
+ android:layoutDirection="ltr">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:paddingTop="4dip"
+ android:orientation="horizontal">
+
+ <ImageButton android:id="@+id/prev" style="@android:style/MediaButton.Previous" />
+ <ImageButton android:id="@+id/rew" style="@android:style/MediaButton.Rew" />
+ <ImageButton android:id="@+id/pause" style="@android:style/MediaButton.Play" />
+ <ImageButton android:id="@+id/ffwd" style="@android:style/MediaButton.Ffwd" />
+ <ImageButton android:id="@+id/next" style="@android:style/MediaButton.Next" />
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <TextView android:id="@+id/time_current"
+ android:textSize="14sp"
+ android:textStyle="bold"
+ android:paddingTop="4dip"
+ android:paddingStart="4dip"
+ android:layout_gravity="center_horizontal"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingEnd="4dip"
+ android:textColor="?android:attr/textColorSecondary" />
+
+ <SeekBar
+ android:id="@+id/mediacontroller_progress"
+ style="?android:attr/progressBarStyleHorizontal"
+ android:layout_width="0dip"
+ android:layout_weight="1"
+ android:layout_height="32dip"
+ android:layout_alignParentStart="true"
+ android:layout_alignParentEnd="true" />
+
+ <TextView android:id="@+id/time"
+ android:textSize="14sp"
+ android:textStyle="bold"
+ android:paddingTop="4dip"
+ android:paddingEnd="4dip"
+ android:layout_gravity="center_horizontal"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingStart="4dip"
+ android:textColor="?android:attr/textColorSecondary" />
+ </LinearLayout>
+
+</LinearLayout>
diff --git a/samples/Support4Demos/res/layout/sliding_pane_layout.xml b/samples/Support4Demos/res/layout/sliding_pane_layout.xml
new file mode 100644
index 000000000..ea0ff96a4
--- /dev/null
+++ b/samples/Support4Demos/res/layout/sliding_pane_layout.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<!--
+ A SlidingPaneLayout is indended to be used as the top-level content view
+ using match_parent for both width and height to consume the full space available.
+-->
+<android.support.v4.widget.SlidingPaneLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/sliding_pane_layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <!-- The first child view becomes the left pane. When the combined
+ desired width (expressed using android:layout_width) would
+ not fit on-screen at once, the right pane is permitted to
+ overlap the left. -->
+ <ListView android:id="@+id/left_pane"
+ android:layout_width="280dp"
+ android:layout_height="match_parent"
+ android:layout_gravity="left"/>
+ <!-- The second child becomes the right (content) pane. In this
+ example, android:layout_weight is used to express that this
+ pane should grow to consume leftover available space when the
+ window is wide enough. This allows the content pane to
+ responsively grow in width on larger screens while still
+ requiring at least the minimum width expressed by
+ android:layout_width. -->
+ <ScrollView
+ android:layout_width="300dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
+ android:scrollbarStyle="outsideOverlay"
+ android:background="#ff333333">
+ <TextView android:id="@+id/content_text"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:text="@string/sliding_pane_layout_summary"
+ android:textAppearance="?android:attr/textAppearanceMedium"/>
+ </ScrollView>
+</android.support.v4.widget.SlidingPaneLayout>
+
diff --git a/samples/Support4Demos/res/layout/videoview.xml b/samples/Support4Demos/res/layout/videoview.xml
new file mode 100644
index 000000000..6d562cb9d
--- /dev/null
+++ b/samples/Support4Demos/res/layout/videoview.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<!-- BEGIN_INCLUDE(complete) -->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent" android:layout_height="match_parent"
+ >
+ <view class="com.example.android.supportv4.media.TransportControllerActivity$Content"
+ android:id="@+id/content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ />
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fitsSystemWindows="true"
+ android:animateLayoutChanges="true"
+ >
+ <com.example.android.supportv4.media.MediaController
+ android:id="@+id/media_controller"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom">
+ </com.example.android.supportv4.media.MediaController>
+ </FrameLayout>
+</FrameLayout>
+<!-- END_INCLUDE(complete) -->
diff --git a/samples/Support4Demos/res/layout/wakeful_alarm_controller.xml b/samples/Support4Demos/res/layout/wakeful_alarm_controller.xml
new file mode 100644
index 000000000..725331d78
--- /dev/null
+++ b/samples/Support4Demos/res/layout/wakeful_alarm_controller.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical" android:padding="4dip"
+ android:gravity="center_horizontal"
+ android:layout_width="match_parent" android:layout_height="match_parent">
+
+ <TextView
+ android:layout_width="match_parent" android:layout_height="wrap_content"
+ android:layout_weight="0" android:paddingBottom="4dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:text="@string/simple_wakeful_controller_msg"/>
+
+ <Button android:id="@+id/schedule"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@string/schedule_wakeful_alarm">
+ <requestFocus />
+ </Button>
+
+</LinearLayout>
+
diff --git a/samples/Support4Demos/res/raw/videoviewdemo.mp4 b/samples/Support4Demos/res/raw/videoviewdemo.mp4
new file mode 100644
index 000000000..57728106d
--- /dev/null
+++ b/samples/Support4Demos/res/raw/videoviewdemo.mp4
Binary files differ
diff --git a/samples/Support4Demos/res/values/strings.xml b/samples/Support4Demos/res/values/strings.xml
index 35cbb75c0..5860ccccf 100644
--- a/samples/Support4Demos/res/values/strings.xml
+++ b/samples/Support4Demos/res/values/strings.xml
@@ -32,7 +32,9 @@
<string name="violet">Violet</string>
<string name="receive_result_instructions">Press the button to get an activity result, which will be displayed here:</string>
<string name="receive_result_result">Get Result</string>
-
+
+ <!-- Fragment API -->
+
<string name="fragment_alert_dialog_support">Fragment/Alert Dialog</string>
<string name="fragment_arguments_support">Fragment/Arguments</string>
@@ -108,6 +110,13 @@
<string name="start_service">Start Service</string>
<string name="stop_service">Stop Service</string>
+ <string name="simple_wakeful_controller">Content/Simple WakefulReceiver</string>
+
+ <string name="simple_wakeful_controller_msg">Demonstrates use of WakefulBroadcastReceiver
+ to keep the device awake while dispatching a broadcast to a service.</string>
+ <string name="schedule_wakeful_alarm">Wakeup in 30 seconds</string>
+ <string name="simple_wakeful_scheduled">Alarm scheduled</string>
+
<!-- Accessibility API -->
<string name="accessibility_manager_title">Accessibility/Accessibility Manager</string>
@@ -131,7 +140,30 @@
<string name="share_text">Share some text</string>
<string name="share_file">Share a file</string>
<string name="share_multiple_file">Share multiple files</string>
- <string name="sharing_support_title">ShareCompat Demo</string>
+ <string name="sharing_support_title">App/ShareCompat Demo</string>
<string name="sharing_receiver_title">ShareCompat Receiver</string>
+ <string name="file_provider_example">Content/FileProvider example</string>
+
+ <!-- Text API -->
+
+ <string name="without_bidiformatter">Without BidiFormatter:</string>
+ <string name="with_bidiformatter">With BidiFormatter:</string>
+ <string name="bidiformatter_support_title">Text/BidiFormatter Demo</string>
+
+ <!-- TransportController -->
+
+ <string name="sample_transport_controller_activity">Media/TransportController</string>
+
+ <string name="drawer_layout_support">Widget/Drawer layout</string>
+
+ <string name="drawer_layout_summary">This activity illustrates the use of sliding drawers. The drawer may be pulled out from the left edge with an edge swipe. If this demo is running on Ice Cream Sandwich or newer you may tap the icon at the left side of the action bar to open the drawer as well.</string>
+
+ <string name="drawer_open">Open navigation drawer</string>
+ <string name="drawer_close">Close navigation drawer</string>
+
+ <string name="sliding_pane_layout_support">Widget/Sliding pane layout</string>
+
+ <string name="sliding_pane_layout_summary">This activity illustrates the use of sliding panes. The content pane may be slid to one side on narrow devices to reveal the left pane used to select content. Sliding panes can be used to fit a UI intended for wider screens in a smaller space. Tapping the Action Bar\'s Up button at the left side of the bar will navigate up in the hierarchy, represented by the left pane. If you rotate the device to landscape mode, on most devices you will see that both panes fit together side by side with no sliding necessary.</string>
+
</resources>
diff --git a/samples/Support4Demos/res/xml/my_paths.xml b/samples/Support4Demos/res/xml/my_paths.xml
new file mode 100644
index 000000000..1407657ed
--- /dev/null
+++ b/samples/Support4Demos/res/xml/my_paths.xml
@@ -0,0 +1,14 @@
+<!-- BEGIN_INCLUDE(file_provider_paths_declaration) -->
+<paths xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- Offer access to files under Context.getFilesDir() + "thumbs/"
+ through alias "my_thumbs" -->
+ <files-path name="my_thumbs" path="thumbs/" />
+
+ <!-- Offer access to files under Environment.getExternalStorageDirectory()
+ through alias "my_external" -->
+ <external-path name="my_external" />
+
+ <!-- Offer access to files under Context.getCacheDir() -->
+ <cache-path name="my_cache" />
+</paths>
+<!-- END_INCLUDE(file_provider_paths_declaration) -->
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/content/FileProviderExample.java b/samples/Support4Demos/src/com/example/android/supportv4/content/FileProviderExample.java
new file mode 100644
index 000000000..926c63228
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/content/FileProviderExample.java
@@ -0,0 +1,81 @@
+/*
+ * 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.example.android.supportv4.content;
+import android.app.Activity;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.net.Uri;
+import android.os.Bundle;
+import android.support.v4.content.FileProvider;
+import android.view.View;
+
+import com.example.android.supportv4.R;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * Sample that shows how private files can be easily shared.
+ */
+public class FileProviderExample extends Activity {
+ private static final String AUTHORITY = "com.example.android.supportv4.my_files";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.file_provider_example);
+ }
+
+ public void onShareFileClick(View view) {
+ // Save a thumbnail to file
+ final File thumbsDir = new File(getFilesDir(), "thumbs");
+ thumbsDir.mkdirs();
+ final File file = new File(thumbsDir, "private.png");
+ saveThumbnail(view, file);
+
+ // Now share that private file using FileProvider
+ final Uri uri = FileProvider.getUriForFile(this, AUTHORITY, file);
+ final Intent intent = new Intent(Intent.ACTION_SEND);
+ intent.setType("image/png");
+ intent.putExtra(Intent.EXTRA_STREAM, uri);
+ startActivity(intent);
+ }
+
+ /**
+ * Save thumbnail of given {@link View} to {@link File}.
+ */
+ private void saveThumbnail(View view, File file) {
+ final Bitmap bitmap = Bitmap.createBitmap(
+ view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
+ final Canvas canvas = new Canvas(bitmap);
+ view.draw(canvas);
+
+ try {
+ final OutputStream os = new FileOutputStream(file);
+ try {
+ bitmap.compress(Bitmap.CompressFormat.PNG, 100, os);
+ } finally {
+ os.close();
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/content/SimpleWakefulController.java b/samples/Support4Demos/src/com/example/android/supportv4/content/SimpleWakefulController.java
new file mode 100644
index 000000000..bf3b2c05b
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/content/SimpleWakefulController.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2013 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.example.android.supportv4.content;
+
+import com.example.android.supportv4.R;
+
+import android.app.Activity;
+import android.app.AlarmManager;
+import android.app.PendingIntent;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.Toast;
+
+import java.util.Calendar;
+
+public class SimpleWakefulController extends Activity {
+ Toast mToast;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.wakeful_alarm_controller);
+
+ // Watch for button clicks.
+ Button button = (Button)findViewById(R.id.schedule);
+ button.setOnClickListener(mScheduleListener);
+ }
+
+ private View.OnClickListener mScheduleListener = new View.OnClickListener() {
+ public void onClick(View v) {
+ // When the alarm goes off, we want to broadcast an Intent to our
+ // BroadcastReceiver. Here we make an Intent with an explicit class
+ // name to have our own receiver (which has been published in
+ // AndroidManifest.xml) instantiated and called, and then create an
+ // IntentSender to have the intent executed as a broadcast.
+ Intent intent = new Intent(SimpleWakefulController.this, SimpleWakefulReceiver.class);
+ PendingIntent sender = PendingIntent.getBroadcast(SimpleWakefulController.this,
+ 0, intent, 0);
+
+ // We want the alarm to go off 30 seconds from now.
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTimeInMillis(System.currentTimeMillis());
+ calendar.add(Calendar.SECOND, 30);
+
+ // Schedule the alarm!
+ AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
+ am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), sender);
+
+ // Tell the user about what we did.
+ if (mToast != null) {
+ mToast.cancel();
+ }
+ mToast = Toast.makeText(SimpleWakefulController.this, R.string.simple_wakeful_scheduled,
+ Toast.LENGTH_LONG);
+ mToast.show();
+ }
+ };
+}
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/content/SimpleWakefulReceiver.java b/samples/Support4Demos/src/com/example/android/supportv4/content/SimpleWakefulReceiver.java
new file mode 100644
index 000000000..d70f432f8
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/content/SimpleWakefulReceiver.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2013 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.example.android.supportv4.content;
+
+//BEGIN_INCLUDE(complete)
+import android.content.Context;
+import android.content.Intent;
+import android.os.SystemClock;
+import android.support.v4.content.WakefulBroadcastReceiver;
+import android.util.Log;
+
+public class SimpleWakefulReceiver extends WakefulBroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ // This is the Intent to deliver to our service.
+ Intent service = new Intent(context, SimpleWakefulService.class);
+
+ // Start the service, keeping the device awake while it is launching.
+ Log.i("SimpleWakefulReceiver", "Starting service @ " + SystemClock.elapsedRealtime());
+ startWakefulService(context, service);
+ }
+}
+//END_INCLUDE(complete)
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/content/SimpleWakefulService.java b/samples/Support4Demos/src/com/example/android/supportv4/content/SimpleWakefulService.java
new file mode 100644
index 000000000..b05218f17
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/content/SimpleWakefulService.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2013 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.example.android.supportv4.content;
+
+//BEGIN_INCLUDE(complete)
+import android.app.IntentService;
+import android.content.Intent;
+import android.os.SystemClock;
+import android.util.Log;
+
+public class SimpleWakefulService extends IntentService {
+ public SimpleWakefulService() {
+ super("SimpleWakefulService");
+ }
+
+ @Override
+ protected void onHandleIntent(Intent intent) {
+ // At this point SimpleWakefulReceiver is still holding a wake lock
+ // for us. We can do whatever we need to here and then tell it that
+ // it can release the wakelock. This sample just does some slow work,
+ // but more complicated implementations could take their own wake
+ // lock here before releasing the receiver's.
+ //
+ // Note that when using this approach you should be aware that if your
+ // service gets killed and restarted while in the middle of such work
+ // (so the Intent gets re-delivered to perform the work again), it will
+ // at that point no longer be holding a wake lock since we are depending
+ // on SimpleWakefulReceiver to that for us. If this is a concern, you can
+ // acquire a separate wake lock here.
+ for (int i=0; i<5; i++) {
+ Log.i("SimpleWakefulReceiver", "Running service " + (i+1)
+ + "/5 @ " + SystemClock.elapsedRealtime());
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ }
+ }
+ Log.i("SimpleWakefulReceiver", "Completed service @ " + SystemClock.elapsedRealtime());
+ SimpleWakefulReceiver.completeWakefulIntent(intent);
+ }
+}
+//END_INCLUDE(complete)
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/media/MediaController.java b/samples/Support4Demos/src/com/example/android/supportv4/media/MediaController.java
new file mode 100644
index 000000000..b8d99d4a4
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/media/MediaController.java
@@ -0,0 +1,370 @@
+/*
+ * Copyright (C) 2013 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.example.android.supportv4.media;
+
+import android.support.v4.media.TransportController;
+import android.support.v4.media.TransportMediator;
+import android.support.v4.media.TransportStateListener;
+import com.example.android.supportv4.R;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityNodeInfo;
+import android.widget.FrameLayout;
+import android.widget.ImageButton;
+import android.widget.ProgressBar;
+import android.widget.SeekBar;
+import android.widget.TextView;
+
+import java.util.Formatter;
+import java.util.Locale;
+
+/**
+ * Helper for implementing media controls in an application.
+ * Use instead of the very useful android.widget.MediaController.
+ * This version is embedded inside of an application's layout.
+ */
+public class MediaController extends FrameLayout {
+
+ private TransportController mController;
+ private Context mContext;
+ private ProgressBar mProgress;
+ private TextView mEndTime, mCurrentTime;
+ private boolean mDragging;
+ private boolean mUseFastForward;
+ private boolean mListenersSet;
+ private boolean mShowNext, mShowPrev;
+ private View.OnClickListener mNextListener, mPrevListener;
+ StringBuilder mFormatBuilder;
+ Formatter mFormatter;
+ private ImageButton mPauseButton;
+ private ImageButton mFfwdButton;
+ private ImageButton mRewButton;
+ private ImageButton mNextButton;
+ private ImageButton mPrevButton;
+
+ private TransportStateListener mStateListener = new TransportStateListener() {
+ @Override
+ public void onPlayingChanged(TransportController controller) {
+ updatePausePlay();
+ }
+ @Override
+ public void onTransportControlsChanged(TransportController controller) {
+ updateButtons();
+ }
+ };
+
+ public MediaController(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ mContext = context;
+ mUseFastForward = true;
+ LayoutInflater inflate = (LayoutInflater)
+ mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ inflate.inflate(R.layout.media_controller, this, true);
+ initControllerView();
+ }
+
+ public MediaController(Context context, boolean useFastForward) {
+ super(context);
+ mContext = context;
+ mUseFastForward = useFastForward;
+ }
+
+ public MediaController(Context context) {
+ this(context, true);
+ }
+
+ public void setMediaPlayer(TransportController controller) {
+ if (getWindowToken() != null) {
+ if (mController != null) {
+ mController.unregisterStateListener(mStateListener);
+ }
+ if (controller != null) {
+ controller.registerStateListener(mStateListener);
+ }
+ }
+ mController = controller;
+ updatePausePlay();
+ }
+
+ @Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ if (mController != null) {
+ mController.registerStateListener(mStateListener);
+ }
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ if (mController != null) {
+ mController.unregisterStateListener(mStateListener);
+ }
+ }
+
+ private void initControllerView() {
+ mPauseButton = (ImageButton) findViewById(R.id.pause);
+ if (mPauseButton != null) {
+ mPauseButton.requestFocus();
+ mPauseButton.setOnClickListener(mPauseListener);
+ }
+
+ mFfwdButton = (ImageButton) findViewById(R.id.ffwd);
+ if (mFfwdButton != null) {
+ mFfwdButton.setOnClickListener(mFfwdListener);
+ mFfwdButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
+ }
+
+ mRewButton = (ImageButton) findViewById(R.id.rew);
+ if (mRewButton != null) {
+ mRewButton.setOnClickListener(mRewListener);
+ mRewButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
+ }
+
+ // By default these are hidden. They will be enabled when setPrevNextListeners() is called
+ mNextButton = (ImageButton) findViewById(R.id.next);
+ if (mNextButton != null && !mListenersSet) {
+ mNextButton.setVisibility(View.GONE);
+ }
+ mPrevButton = (ImageButton) findViewById(R.id.prev);
+ if (mPrevButton != null && !mListenersSet) {
+ mPrevButton.setVisibility(View.GONE);
+ }
+
+ mProgress = (ProgressBar) findViewById(R.id.mediacontroller_progress);
+ if (mProgress != null) {
+ if (mProgress instanceof SeekBar) {
+ SeekBar seeker = (SeekBar) mProgress;
+ seeker.setOnSeekBarChangeListener(mSeekListener);
+ }
+ mProgress.setMax(1000);
+ }
+
+ mEndTime = (TextView) findViewById(R.id.time);
+ mCurrentTime = (TextView) findViewById(R.id.time_current);
+ mFormatBuilder = new StringBuilder();
+ mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());
+
+ installPrevNextListeners();
+ }
+
+ /**
+ * Disable pause or seek buttons if the stream cannot be paused or seeked.
+ * This requires the control interface to be a MediaPlayerControlExt
+ */
+ void updateButtons() {
+ int flags = mController.getTransportControlFlags();
+ boolean enabled = isEnabled();
+ if (mPauseButton != null) {
+ mPauseButton.setEnabled(enabled && (flags&TransportMediator.FLAG_KEY_MEDIA_PAUSE) != 0);
+ }
+ if (mRewButton != null) {
+ mRewButton.setEnabled(enabled && (flags&TransportMediator.FLAG_KEY_MEDIA_REWIND) != 0);
+ }
+ if (mFfwdButton != null) {
+ mFfwdButton.setEnabled(enabled &&
+ (flags&TransportMediator.FLAG_KEY_MEDIA_FAST_FORWARD) != 0);
+ }
+ if (mPrevButton != null) {
+ mShowPrev = (flags&TransportMediator.FLAG_KEY_MEDIA_PREVIOUS) != 0
+ || mPrevListener != null;
+ mPrevButton.setEnabled(enabled && mShowPrev);
+ }
+ if (mNextButton != null) {
+ mShowNext = (flags&TransportMediator.FLAG_KEY_MEDIA_NEXT) != 0
+ || mNextListener != null;
+ mNextButton.setEnabled(enabled && mShowNext);
+ }
+ }
+
+ public void refresh() {
+ updateProgress();
+ updateButtons();
+ updatePausePlay();
+ }
+
+ private String stringForTime(int timeMs) {
+ int totalSeconds = timeMs / 1000;
+
+ int seconds = totalSeconds % 60;
+ int minutes = (totalSeconds / 60) % 60;
+ int hours = totalSeconds / 3600;
+
+ mFormatBuilder.setLength(0);
+ if (hours > 0) {
+ return mFormatter.format("%d:%02d:%02d", hours, minutes, seconds).toString();
+ } else {
+ return mFormatter.format("%02d:%02d", minutes, seconds).toString();
+ }
+ }
+
+ public long updateProgress() {
+ if (mController == null || mDragging) {
+ return 0;
+ }
+ long position = mController.getCurrentPosition();
+ long duration = mController.getDuration();
+ if (mProgress != null) {
+ if (duration > 0) {
+ // use long to avoid overflow
+ long pos = 1000L * position / duration;
+ mProgress.setProgress( (int) pos);
+ }
+ int percent = mController.getBufferPercentage();
+ mProgress.setSecondaryProgress(percent * 10);
+ }
+
+ if (mEndTime != null)
+ mEndTime.setText(stringForTime((int)duration));
+ if (mCurrentTime != null)
+ mCurrentTime.setText(stringForTime((int)position));
+
+ return position;
+ }
+
+ private View.OnClickListener mPauseListener = new View.OnClickListener() {
+ public void onClick(View v) {
+ doPauseResume();
+ }
+ };
+
+ private void updatePausePlay() {
+ if (mPauseButton == null)
+ return;
+
+ if (mController.isPlaying()) {
+ mPauseButton.setImageResource(android.R.drawable.ic_media_pause);
+ } else {
+ mPauseButton.setImageResource(android.R.drawable.ic_media_play);
+ }
+ }
+
+ private void doPauseResume() {
+ if (mController.isPlaying()) {
+ mController.pausePlaying();
+ } else {
+ mController.startPlaying();
+ }
+ updatePausePlay();
+ }
+
+ // There are two scenarios that can trigger the seekbar listener to trigger:
+ //
+ // The first is the user using the touchpad to adjust the posititon of the
+ // seekbar's thumb. In this case onStartTrackingTouch is called followed by
+ // a number of onProgressChanged notifications, concluded by onStopTrackingTouch.
+ // We're setting the field "mDragging" to true for the duration of the dragging
+ // session to avoid jumps in the position in case of ongoing playback.
+ //
+ // The second scenario involves the user operating the scroll ball, in this
+ // case there WON'T BE onStartTrackingTouch/onStopTrackingTouch notifications,
+ // we will simply apply the updated position without suspending regular updates.
+ private SeekBar.OnSeekBarChangeListener mSeekListener = new SeekBar.OnSeekBarChangeListener() {
+ public void onStartTrackingTouch(SeekBar bar) {
+ mDragging = true;
+ }
+
+ public void onProgressChanged(SeekBar bar, int progress, boolean fromuser) {
+ if (!fromuser) {
+ // We're not interested in programmatically generated changes to
+ // the progress bar's position.
+ return;
+ }
+
+ long duration = mController.getDuration();
+ long newposition = (duration * progress) / 1000L;
+ mController.seekTo((int) newposition);
+ if (mCurrentTime != null)
+ mCurrentTime.setText(stringForTime( (int) newposition));
+ }
+
+ public void onStopTrackingTouch(SeekBar bar) {
+ mDragging = false;
+ updateProgress();
+ updatePausePlay();
+ }
+ };
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+ updateButtons();
+ }
+
+ @Override
+ public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
+ super.onInitializeAccessibilityEvent(event);
+ event.setClassName(MediaController.class.getName());
+ }
+
+ @Override
+ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
+ super.onInitializeAccessibilityNodeInfo(info);
+ info.setClassName(MediaController.class.getName());
+ }
+
+ private View.OnClickListener mRewListener = new View.OnClickListener() {
+ public void onClick(View v) {
+ long pos = mController.getCurrentPosition();
+ pos -= 5000; // milliseconds
+ mController.seekTo(pos);
+ updateProgress();
+ }
+ };
+
+ private View.OnClickListener mFfwdListener = new View.OnClickListener() {
+ public void onClick(View v) {
+ long pos = mController.getCurrentPosition();
+ pos += 15000; // milliseconds
+ mController.seekTo(pos);
+ updateProgress();
+ }
+ };
+
+ private void installPrevNextListeners() {
+ if (mNextButton != null) {
+ mNextButton.setOnClickListener(mNextListener);
+ mNextButton.setEnabled(mShowNext);
+ }
+
+ if (mPrevButton != null) {
+ mPrevButton.setOnClickListener(mPrevListener);
+ mPrevButton.setEnabled(mShowPrev);
+ }
+ }
+
+ public void setPrevNextListeners(View.OnClickListener next, View.OnClickListener prev) {
+ mNextListener = next;
+ mPrevListener = prev;
+ mListenersSet = true;
+
+ installPrevNextListeners();
+
+ if (mNextButton != null) {
+ mNextButton.setVisibility(View.VISIBLE);
+ mShowNext = true;
+ }
+ if (mPrevButton != null) {
+ mPrevButton.setVisibility(View.VISIBLE);
+ mShowPrev = true;
+ }
+ }
+}
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/media/TransportControllerActivity.java b/samples/Support4Demos/src/com/example/android/supportv4/media/TransportControllerActivity.java
new file mode 100644
index 000000000..abb3c97b8
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/media/TransportControllerActivity.java
@@ -0,0 +1,307 @@
+/*
+ * Copyright (C) 2013 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.example.android.supportv4.media;
+
+//BEGIN_INCLUDE(complete)
+import android.support.v4.media.TransportMediator;
+import android.support.v4.media.TransportPerformer;
+import com.example.android.supportv4.R;
+
+import android.app.ActionBar;
+import android.content.Context;
+import android.media.MediaPlayer;
+import android.os.Handler;
+import android.util.AttributeSet;
+import android.view.KeyEvent;
+import android.view.View;
+
+import android.app.Activity;
+import android.net.Uri;
+import android.os.Bundle;
+import android.widget.VideoView;
+
+public class TransportControllerActivity extends Activity {
+
+ /**
+ * TODO: Set the path variable to a streaming video URL or a local media
+ * file path.
+ */
+ private Content mContent;
+ private TransportMediator mTransportMediator;
+ private MediaController mMediaController;
+
+ /**
+ * Handle actions from on-screen media controls. Most of these are simple re-directs
+ * to the VideoView; some we need to capture to update our state.
+ */
+ TransportPerformer mTransportPerformer = new TransportPerformer() {
+ @Override public void onStart() {
+ mContent.start();
+ }
+
+ @Override public void onStop() {
+ mContent.pause();
+ }
+
+ @Override public void onPause() {
+ mContent.pause();
+ }
+
+ @Override public long onGetDuration() {
+ return mContent.getDuration();
+ }
+
+ @Override public long onGetCurrentPosition() {
+ return mContent.getCurrentPosition();
+ }
+
+ @Override public void onSeekTo(long pos) {
+ mContent.seekTo((int)pos);
+ }
+
+ @Override public boolean onIsPlaying() {
+ return mContent.isPlaying();
+ }
+
+ @Override public int onGetBufferPercentage() {
+ return mContent.getBufferPercentage();
+ }
+
+ @Override public int onGetTransportControlFlags() {
+ int flags = TransportMediator.FLAG_KEY_MEDIA_PLAY
+ | TransportMediator.FLAG_KEY_MEDIA_PLAY_PAUSE
+ | TransportMediator.FLAG_KEY_MEDIA_STOP;
+ if (mContent.canPause()) {
+ flags |= TransportMediator.FLAG_KEY_MEDIA_PAUSE;
+ }
+ if (mContent.canSeekBackward()) {
+ flags |= TransportMediator.FLAG_KEY_MEDIA_REWIND;
+ }
+ if (mContent.canSeekForward()) {
+ flags |= TransportMediator.FLAG_KEY_MEDIA_FAST_FORWARD;
+ }
+ return flags;
+ }
+ };
+
+ /**
+ * This is the actual video player. It is the top-level content of
+ * the activity's view hierarchy, going under the status bar and nav
+ * bar areas.
+ */
+ public static class Content extends VideoView implements
+ View.OnSystemUiVisibilityChangeListener, View.OnClickListener,
+ ActionBar.OnMenuVisibilityListener, MediaPlayer.OnPreparedListener,
+ MediaPlayer.OnCompletionListener, MediaPlayer.OnErrorListener {
+ Activity mActivity;
+ TransportMediator mTransportMediator;
+ MediaController mMediaController;
+ boolean mAddedMenuListener;
+ boolean mMenusOpen;
+ boolean mPaused;
+ boolean mNavVisible;
+ int mLastSystemUiVis;
+
+ Runnable mNavHider = new Runnable() {
+ @Override public void run() {
+ setNavVisibility(false);
+ }
+ };
+
+ Runnable mProgressUpdater = new Runnable() {
+ @Override public void run() {
+ mMediaController.updateProgress();
+ getHandler().postDelayed(this, 1000);
+ }
+ };
+
+ public Content(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ setOnSystemUiVisibilityChangeListener(this);
+ setOnClickListener(this);
+ setOnPreparedListener(this);
+ setOnCompletionListener(this);
+ setOnErrorListener(this);
+ }
+
+ public void init(Activity activity, TransportMediator transportMediator,
+ MediaController mediaController) {
+ // This called by the containing activity to supply the surrounding
+ // state of the video player that it will interact with.
+ mActivity = activity;
+ mTransportMediator = transportMediator;
+ mMediaController = mediaController;
+ pause();
+ }
+
+ @Override protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ if (mActivity != null) {
+ mAddedMenuListener = true;
+ mActivity.getActionBar().addOnMenuVisibilityListener(this);
+ }
+ }
+
+ @Override protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ if (mAddedMenuListener) {
+ mActivity.getActionBar().removeOnMenuVisibilityListener(this);
+ }
+ mNavVisible = false;
+ }
+
+ @Override public void onSystemUiVisibilityChange(int visibility) {
+ // Detect when we go out of nav-hidden mode, to clear our state
+ // back to having the full UI chrome up. Only do this when
+ // the state is changing and nav is no longer hidden.
+ int diff = mLastSystemUiVis ^ visibility;
+ mLastSystemUiVis = visibility;
+ if ((diff&SYSTEM_UI_FLAG_HIDE_NAVIGATION) != 0
+ && (visibility&SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) {
+ setNavVisibility(true);
+ }
+ }
+
+ @Override protected void onWindowVisibilityChanged(int visibility) {
+ super.onWindowVisibilityChanged(visibility);
+
+ // When we become visible or invisible, play is paused.
+ pause();
+ }
+
+ @Override public void onClick(View v) {
+ // Clicking anywhere makes the navigation visible.
+ setNavVisibility(true);
+ }
+
+ @Override public void onMenuVisibilityChanged(boolean isVisible) {
+ mMenusOpen = isVisible;
+ setNavVisibility(true);
+ }
+
+ @Override
+ public void onPrepared(MediaPlayer mp) {
+ mMediaController.setEnabled(true);
+ }
+
+ @Override
+ public void onCompletion(MediaPlayer mp) {
+ mTransportMediator.pausePlaying();
+ pause();
+ }
+
+ @Override
+ public boolean onError(MediaPlayer mp, int what, int extra) {
+ mTransportMediator.pausePlaying();
+ pause();
+ return false;
+ }
+
+ @Override public void start() {
+ super.start();
+ mPaused = false;
+ setKeepScreenOn(true);
+ setNavVisibility(true);
+ mMediaController.refresh();
+ scheduleProgressUpdater();
+ }
+
+ @Override public void pause() {
+ super.pause();
+ mPaused = true;
+ setKeepScreenOn(false);
+ setNavVisibility(true);
+ mMediaController.refresh();
+ scheduleProgressUpdater();
+ }
+
+ void scheduleProgressUpdater() {
+ Handler h = getHandler();
+ if (h != null) {
+ if (mNavVisible && !mPaused) {
+ h.removeCallbacks(mProgressUpdater);
+ h.post(mProgressUpdater);
+ } else {
+ h.removeCallbacks(mProgressUpdater);
+ }
+ }
+ }
+
+ void setNavVisibility(boolean visible) {
+ int newVis = SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | SYSTEM_UI_FLAG_LAYOUT_STABLE;
+ if (!visible) {
+ newVis |= SYSTEM_UI_FLAG_LOW_PROFILE | SYSTEM_UI_FLAG_FULLSCREEN
+ | SYSTEM_UI_FLAG_HIDE_NAVIGATION;
+ }
+
+ // If we are now visible, schedule a timer for us to go invisible.
+ if (visible) {
+ Handler h = getHandler();
+ if (h != null) {
+ h.removeCallbacks(mNavHider);
+ if (!mMenusOpen && !mPaused) {
+ // If the menus are open or play is paused, we will not auto-hide.
+ h.postDelayed(mNavHider, 3000);
+ }
+ }
+ }
+
+ // Set the new desired visibility.
+ setSystemUiVisibility(newVis);
+ mNavVisible = visible;
+ mMediaController.setVisibility(visible ? VISIBLE : INVISIBLE);
+ scheduleProgressUpdater();
+ }
+ }
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+ setContentView(R.layout.videoview);
+
+ // Find the video player in our UI.
+ mContent = (Content) findViewById(R.id.content);
+
+ // Create transport controller to control video, giving the callback
+ // interface to receive actions from.
+ mTransportMediator = new TransportMediator(this, mTransportPerformer);
+
+ // Create and initialize the media control UI.
+ mMediaController = (MediaController) findViewById(R.id.media_controller);
+ mMediaController.setMediaPlayer(mTransportMediator);
+
+ // We're just playing a built-in demo video.
+ mContent.init(this, mTransportMediator, mMediaController);
+ mContent.setVideoURI(Uri.parse("android.resource://" + getPackageName() +
+ "/" + R.raw.videoviewdemo));
+ }
+
+ @Override
+ public boolean dispatchKeyEvent(KeyEvent event) {
+ // We first dispatch keys to the transport controller -- we want it
+ // to get to consume any media keys rather than letting whoever has focus
+ // in the view hierarchy to potentially eat it.
+ if (mTransportMediator.dispatchKeyEvent(event)) {
+ return true;
+ }
+
+ return super.dispatchKeyEvent(event);
+ }
+}
+//END_INCLUDE(complete)
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/text/BidiFormatterSupport.java b/samples/Support4Demos/src/com/example/android/supportv4/text/BidiFormatterSupport.java
new file mode 100644
index 000000000..168a8b62c
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/text/BidiFormatterSupport.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2013 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.example.android.supportv4.text;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+import android.support.v4.text.BidiFormatter;
+import android.widget.TextView;
+import com.example.android.supportv4.R;
+
+/**
+ * This example illustrates a common usage of the BidiFormatter in the Android support library.
+ */
+public class BidiFormatterSupport extends Activity {
+
+ private static String text = "%s הוא עסוק";
+ private static String phone = "+1 650 253 0000";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.bidiformater_support);
+
+ String formattedText = String.format(text, phone);
+
+ TextView tv_sample = (TextView) findViewById(R.id.textview_without_bidiformatter);
+ tv_sample.setText(formattedText);
+
+ TextView tv_bidiformatter = (TextView) findViewById(R.id.textview_with_bidiformatter);
+ String wrappedPhone = BidiFormatter.getInstance(true /* rtlContext */).unicodeWrap(phone);
+ formattedText = String.format(text, wrappedPhone);
+ tv_bidiformatter.setText(formattedText);
+ }
+}
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/widget/DrawerLayoutActivity.java b/samples/Support4Demos/src/com/example/android/supportv4/widget/DrawerLayoutActivity.java
new file mode 100644
index 000000000..ce311ccc0
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/widget/DrawerLayoutActivity.java
@@ -0,0 +1,244 @@
+/*
+ * Copyright (C) 2013 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.example.android.supportv4.widget;
+
+import android.app.ActionBar;
+import android.app.Activity;
+import android.content.res.Configuration;
+import android.os.Build;
+import android.os.Bundle;
+import android.support.v4.app.ActionBarDrawerToggle;
+import android.support.v4.view.GravityCompat;
+import android.support.v4.widget.DrawerLayout;
+import android.view.Gravity;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+import com.example.android.supportv4.R;
+import com.example.android.supportv4.Shakespeare;
+
+/**
+ * This example illustrates a common usage of the DrawerLayout widget
+ * in the Android support library.
+ *
+ * <p>A DrawerLayout should be positioned at the top of your view hierarchy, placing it
+ * below the action bar but above your content views. The primary content should match_parent
+ * in both dimensions. Each drawer should define a reasonable width and match_parent for height.
+ * Drawer views should be positioned after the content view in your layout to preserve proper
+ * ordering.</p>
+ *
+ * <p>When a navigation (left) drawer is present, the host activity should detect presses of
+ * the action bar's Up affordance as a signal to open and close the navigation drawer.
+ * Items within the drawer should fall into one of two categories.</p>
+ *
+ * <ul>
+ * <li><strong>View switches</strong>. A view switch follows the same basic policies as
+ * list or tab navigation in that a view switch does not create navigation history.
+ * This pattern should only be used at the root activity of a task, leaving some form
+ * of Up navigation active for activities further down the navigation hierarchy.</li>
+ * <li><strong>Selective Up</strong>. The drawer allows the user to choose an alternate
+ * parent for Up navigation. This allows a user to jump across an app's navigation
+ * hierarchy at will. The application should treat this as it treats Up navigation from
+ * a different task, replacing the current task stack using TaskStackBuilder or similar.
+ * This is the only form of navigation drawer that should be used outside of the root
+ * activity of a task.</li>
+ * </ul>
+ *
+ * <p>Right side drawers should be used for actions, not navigation. This follows the pattern
+ * established by the Action Bar that navigation should be to the left and actions to the right.
+ * An action should be an operation performed on the current contents of the window,
+ * for example enabling or disabling a data overlay on top of the current content.</p>
+ */
+public class DrawerLayoutActivity extends Activity {
+ private DrawerLayout mDrawerLayout;
+ private ListView mDrawer;
+ private TextView mContent;
+
+ private ActionBarHelper mActionBar;
+
+ private ActionBarDrawerToggle mDrawerToggle;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.drawer_layout);
+
+ mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
+ mDrawer = (ListView) findViewById(R.id.left_drawer);
+ mContent = (TextView) findViewById(R.id.content_text);
+
+ mDrawerLayout.setDrawerListener(new DemoDrawerListener());
+ mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
+
+ mDrawer.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
+ Shakespeare.TITLES));
+ mDrawer.setOnItemClickListener(new DrawerItemClickListener());
+
+ mActionBar = createActionBarHelper();
+ mActionBar.init();
+
+ // ActionBarDrawerToggle provides convenient helpers for tying together the
+ // prescribed interactions between a top-level sliding drawer and the action bar.
+ mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
+ R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close);
+ }
+
+ @Override
+ protected void onPostCreate(Bundle savedInstanceState) {
+ super.onPostCreate(savedInstanceState);
+
+ // Sync the toggle state after onRestoreInstanceState has occurred.
+ mDrawerToggle.syncState();
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ /*
+ * The action bar home/up action should open or close the drawer.
+ * mDrawerToggle will take care of this.
+ */
+ if (mDrawerToggle.onOptionsItemSelected(item)) {
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ mDrawerToggle.onConfigurationChanged(newConfig);
+ }
+
+ /**
+ * This list item click listener implements very simple view switching by changing
+ * the primary content text. The drawer is closed when a selection is made.
+ */
+ private class DrawerItemClickListener implements ListView.OnItemClickListener {
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ mContent.setText(Shakespeare.DIALOGUE[position]);
+ mActionBar.setTitle(Shakespeare.TITLES[position]);
+ mDrawerLayout.closeDrawer(mDrawer);
+ }
+ }
+
+ /**
+ * A drawer listener can be used to respond to drawer events such as becoming
+ * fully opened or closed. You should always prefer to perform expensive operations
+ * such as drastic relayout when no animation is currently in progress, either before
+ * or after the drawer animates.
+ *
+ * When using ActionBarDrawerToggle, all DrawerLayout listener methods should be forwarded
+ * if the ActionBarDrawerToggle is not used as the DrawerLayout listener directly.
+ */
+ private class DemoDrawerListener implements DrawerLayout.DrawerListener {
+ @Override
+ public void onDrawerOpened(View drawerView) {
+ mDrawerToggle.onDrawerOpened(drawerView);
+ mActionBar.onDrawerOpened();
+ }
+
+ @Override
+ public void onDrawerClosed(View drawerView) {
+ mDrawerToggle.onDrawerClosed(drawerView);
+ mActionBar.onDrawerClosed();
+ }
+
+ @Override
+ public void onDrawerSlide(View drawerView, float slideOffset) {
+ mDrawerToggle.onDrawerSlide(drawerView, slideOffset);
+ }
+
+ @Override
+ public void onDrawerStateChanged(int newState) {
+ mDrawerToggle.onDrawerStateChanged(newState);
+ }
+ }
+
+ /**
+ * Create a compatible helper that will manipulate the action bar if available.
+ */
+ private ActionBarHelper createActionBarHelper() {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+ return new ActionBarHelperICS();
+ } else {
+ return new ActionBarHelper();
+ }
+ }
+
+ /**
+ * Stub action bar helper; this does nothing.
+ */
+ private class ActionBarHelper {
+ public void init() {}
+ public void onDrawerClosed() {}
+ public void onDrawerOpened() {}
+ public void setTitle(CharSequence title) {}
+ }
+
+ /**
+ * Action bar helper for use on ICS and newer devices.
+ */
+ private class ActionBarHelperICS extends ActionBarHelper {
+ private final ActionBar mActionBar;
+ private CharSequence mDrawerTitle;
+ private CharSequence mTitle;
+
+ ActionBarHelperICS() {
+ mActionBar = getActionBar();
+ }
+
+ @Override
+ public void init() {
+ mActionBar.setDisplayHomeAsUpEnabled(true);
+ mActionBar.setHomeButtonEnabled(true);
+ mTitle = mDrawerTitle = getTitle();
+ }
+
+ /**
+ * When the drawer is closed we restore the action bar state reflecting
+ * the specific contents in view.
+ */
+ @Override
+ public void onDrawerClosed() {
+ super.onDrawerClosed();
+ mActionBar.setTitle(mTitle);
+ }
+
+ /**
+ * When the drawer is open we set the action bar to a generic title.
+ * The action bar should only contain data relevant at the top level of
+ * the nav hierarchy represented by the drawer, as the rest of your content
+ * will be dimmed down and non-interactive.
+ */
+ @Override
+ public void onDrawerOpened() {
+ super.onDrawerOpened();
+ mActionBar.setTitle(mDrawerTitle);
+ }
+
+ @Override
+ public void setTitle(CharSequence title) {
+ mTitle = title;
+ }
+ }
+}
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/widget/SlidingPaneLayoutActivity.java b/samples/Support4Demos/src/com/example/android/supportv4/widget/SlidingPaneLayoutActivity.java
new file mode 100644
index 000000000..f26e03865
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/widget/SlidingPaneLayoutActivity.java
@@ -0,0 +1,222 @@
+/*
+ * Copyright (C) 2013 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.example.android.supportv4.widget;
+
+import android.app.ActionBar;
+import android.app.Activity;
+import android.os.Build;
+import android.os.Bundle;
+import android.support.v4.widget.SlidingPaneLayout;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewTreeObserver;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+import com.example.android.supportv4.Shakespeare;
+import com.example.android.supportv4.R;
+
+/**
+ * This example illustrates a common usage of SlidingPaneLayout in the Android support library.
+ *
+ * <p>A SlidingPaneLayout should be positioned at the top of your view hierarchy, placing it
+ * below the action bar but above your content views. It is ideal as a two-pane layout
+ * for larger screens, used in place of a horizontal LinearLayout.</p>
+ *
+ * <p>What separates SlidingPaneLayout from LinearLayout in this usage is that SlidingPaneLayout
+ * allows these wide, two-pane layouts to overlap when horizontal space is at a premium. The user
+ * can then access both panes by physically sliding the content pane into view or out of the way
+ * or implicitly by moving focus between the two panes. This can greatly simplify development
+ * of Android apps that support multiple form factors and screen sizes.</p>
+ *
+ * <p>When it comes to your navigation hierarchy, the left pane of a SlidingPaneLayout is always
+ * considered to be one level up from the right content pane. As such, your Action Bar's
+ * Up navigation should be enabled if the right pane is obscuring the left pane, and invoking it
+ * should open the panes, revealing the left pane for normal interaction. From this open state
+ * where the left pane is in primary focus, the Action Bar's Up affordance should act as if
+ * both panes were fully visible in the activity window and navigate to the activity one level up
+ * in the app's logical hierarchy. If the activity is the root of the application's task, the up
+ * affordance should be disabled when the sliding pane is open and showing the left pane.
+ * This code example illustrates this root activity case.</p>
+ *
+ * <p>Note that SlidingPaneLayout differs in usage from DrawerLayout. While DrawerLayout offers
+ * sliding utility drawers for extended navigation options and actions, the panes of a
+ * SlidingPaneLayout are firmly part of the content itself. If it would not make sense for
+ * both panes to be visible all the time on a sufficiently wide screen, DrawerLayout and its
+ * associated patterns are likely to be a better choice for your usage.</p>
+ */
+public class SlidingPaneLayoutActivity extends Activity {
+ private SlidingPaneLayout mSlidingLayout;
+ private ListView mList;
+ private TextView mContent;
+
+ private ActionBarHelper mActionBar;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.sliding_pane_layout);
+
+ mSlidingLayout = (SlidingPaneLayout) findViewById(R.id.sliding_pane_layout);
+ mList = (ListView) findViewById(R.id.left_pane);
+ mContent = (TextView) findViewById(R.id.content_text);
+
+ mSlidingLayout.setPanelSlideListener(new SliderListener());
+ mSlidingLayout.openPane();
+
+ mList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
+ Shakespeare.TITLES));
+ mList.setOnItemClickListener(new ListItemClickListener());
+
+ mActionBar = createActionBarHelper();
+ mActionBar.init();
+
+ mSlidingLayout.getViewTreeObserver().addOnGlobalLayoutListener(new FirstLayoutListener());
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ /*
+ * The action bar up action should open the slider if it is currently closed,
+ * as the left pane contains content one level up in the navigation hierarchy.
+ */
+ if (item.getItemId() == android.R.id.home && !mSlidingLayout.isOpen()) {
+ mSlidingLayout.smoothSlideOpen();
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ /**
+ * This list item click listener implements very simple view switching by changing
+ * the primary content text. The slider is closed when a selection is made to fully
+ * reveal the content.
+ */
+ private class ListItemClickListener implements ListView.OnItemClickListener {
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ mContent.setText(Shakespeare.DIALOGUE[position]);
+ mActionBar.setTitle(Shakespeare.TITLES[position]);
+ mSlidingLayout.smoothSlideClosed();
+ }
+ }
+
+ /**
+ * This panel slide listener updates the action bar accordingly for each panel state.
+ */
+ private class SliderListener extends SlidingPaneLayout.SimplePanelSlideListener {
+ @Override
+ public void onPanelOpened(View panel) {
+ mActionBar.onPanelOpened();
+ }
+
+ @Override
+ public void onPanelClosed(View panel) {
+ mActionBar.onPanelClosed();
+ }
+ }
+
+ /**
+ * This global layout listener is used to fire an event after first layout occurs
+ * and then it is removed. This gives us a chance to configure parts of the UI
+ * that adapt based on available space after they have had the opportunity to measure
+ * and layout.
+ */
+ private class FirstLayoutListener implements ViewTreeObserver.OnGlobalLayoutListener {
+ @Override
+ public void onGlobalLayout() {
+ mActionBar.onFirstLayout();
+ mSlidingLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
+ }
+ }
+
+ /**
+ * Create a compatible helper that will manipulate the action bar if available.
+ */
+ private ActionBarHelper createActionBarHelper() {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+ return new ActionBarHelperICS();
+ } else {
+ return new ActionBarHelper();
+ }
+ }
+
+ /**
+ * Stub action bar helper; this does nothing.
+ */
+ private class ActionBarHelper {
+ public void init() {}
+ public void onPanelClosed() {}
+ public void onPanelOpened() {}
+ public void onFirstLayout() {}
+ public void setTitle(CharSequence title) {}
+ }
+
+ /**
+ * Action bar helper for use on ICS and newer devices.
+ */
+ private class ActionBarHelperICS extends ActionBarHelper {
+ private final ActionBar mActionBar;
+ private CharSequence mDrawerTitle;
+ private CharSequence mTitle;
+
+ ActionBarHelperICS() {
+ mActionBar = getActionBar();
+ }
+
+ @Override
+ public void init() {
+ mActionBar.setDisplayHomeAsUpEnabled(true);
+ mActionBar.setHomeButtonEnabled(true);
+ mTitle = mDrawerTitle = getTitle();
+ }
+
+ @Override
+ public void onPanelClosed() {
+ super.onPanelClosed();
+ mActionBar.setDisplayHomeAsUpEnabled(true);
+ mActionBar.setHomeButtonEnabled(true);
+ mActionBar.setTitle(mTitle);
+ }
+
+ @Override
+ public void onPanelOpened() {
+ super.onPanelOpened();
+ mActionBar.setHomeButtonEnabled(false);
+ mActionBar.setDisplayHomeAsUpEnabled(false);
+ mActionBar.setTitle(mDrawerTitle);
+ }
+
+ @Override
+ public void onFirstLayout() {
+ if (mSlidingLayout.canSlide() && !mSlidingLayout.isOpen()) {
+ onPanelClosed();
+ } else {
+ onPanelOpened();
+ }
+ }
+
+ @Override
+ public void setTitle(CharSequence title) {
+ mTitle = title;
+ }
+ }
+
+}
diff --git a/samples/Support7Demos/Android.mk b/samples/Support7Demos/Android.mk
new file mode 100644
index 000000000..0e43e3d44
--- /dev/null
+++ b/samples/Support7Demos/Android.mk
@@ -0,0 +1,38 @@
+# Copyright (C) 2013 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.
+
+LOCAL_PATH:= $(call my-dir)
+
+# Build the samples.
+# We need to add some special AAPT flags to generate R classes
+# for resources that are included from the libraries.
+include $(CLEAR_VARS)
+LOCAL_PACKAGE_NAME := Support7Demos
+LOCAL_MODULE_TAGS := samples tests
+LOCAL_SDK_VERSION := current
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ android-support-v4 \
+ android-support-v7-appcompat \
+ android-support-v7-gridlayout \
+ android-support-v7-mediarouter
+LOCAL_RESOURCE_DIR = \
+ $(LOCAL_PATH)/res \
+ frameworks/support/v7/appcompat/res \
+ frameworks/support/v7/gridlayout/res \
+ frameworks/support/v7/mediarouter/res
+LOCAL_AAPT_FLAGS := \
+ --auto-add-overlay \
+ --extra-packages android.support.v7.appcompat:android.support.v7.gridlayout:android.support.v7.mediarouter
+include $(BUILD_PACKAGE)
diff --git a/samples/Support7Demos/AndroidManifest.xml b/samples/Support7Demos/AndroidManifest.xml
new file mode 100644
index 000000000..1edf3e658
--- /dev/null
+++ b/samples/Support7Demos/AndroidManifest.xml
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<!-- Declare the contents of this Android application. The namespace
+ attribute brings in the Android platform namespace, and the package
+ supplies a unique name for the application. When writing your
+ own application, the package name must be changed from "com.example.*"
+ to come from a domain that you own or have control over. -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.supportv7">
+
+ <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="17" />
+
+ <!-- The smallest screen this app works on is a phone. The app will
+ scale its UI to larger screens but doesn't make good use of them
+ so allow the compatibility mode button to be shown (mostly because
+ this is just convenient for testing). -->
+ <supports-screens android:requiresSmallestWidthDp="320"
+ android:compatibleWidthLimitDp="480" />
+
+ <application android:label="@string/activity_sample_code"
+ android:icon="@drawable/app_sample_code"
+ android:hardwareAccelerated="true">
+
+ <activity android:name="Support7Demos">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ <!-- MediaRouter Support Samples -->
+
+ <activity android:name=".media.SampleMediaRouterActivity"
+ android:label="@string/sample_media_router_activity_dark"
+ android:theme="@style/Theme.AppCompat">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv7.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name=".media.SampleMediaRouterActivity$Light"
+ android:label="@string/sample_media_router_activity_light"
+ android:theme="@style/Theme.AppCompat.Light">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv7.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name=".media.SampleMediaRouterActivity$LightWithDarkActionBar"
+ android:label="@string/sample_media_router_activity_light_with_dark_action_bar"
+ android:theme="@style/Theme.AppCompat.Light.DarkActionBar">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv7.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <service android:name=".media.SampleMediaRouteProviderService"
+ android:label="@string/sample_media_route_provider_service"
+ android:process=":mrp">
+ <intent-filter>
+ <action android:name="android.media.MediaRouteProviderService" />
+ </intent-filter>
+ </service>
+
+ <!-- GridLayout Support Samples -->
+
+ <activity android:name=".view.GridLayout1"
+ android:label="@string/grid_layout_1">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv7.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name=".view.GridLayout2"
+ android:label="@string/grid_layout_2">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv7.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name=".view.GridLayout3"
+ android:label="@string/grid_layout_3">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv7.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <!-- Action Bar Samples -->
+ <activity android:name=".app.ActionBarMechanics"
+ android:label="@string/action_bar_mechanics"
+ android:theme="@style/Theme.AppCompat">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv7.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name=".app.ActionBarUsage"
+ android:label="@string/action_bar_usage"
+ android:theme="@style/Theme.AppCompat">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv7.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name=".app.ActionBarDisplayOptions"
+ android:label="@string/action_bar_display_options"
+ android:logo="@drawable/apidemo_androidlogo"
+ android:theme="@style/Theme.AppCompat">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv7.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name=".app.ActionBarTabs"
+ android:label="@string/action_bar_tabs"
+ android:theme="@style/Theme.AppCompat">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv7.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name=".app.ActionBarSettingsActionProviderActivity"
+ android:label="@string/action_bar_settings_action_provider"
+ android:theme="@style/Theme.AppCompat">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv7.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name=".app.ActionBarFragmentMenu"
+ android:label="@string/action_bar_fragment_menu"
+ android:theme="@style/Theme.AppCompat">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv7.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ </application>
+</manifest>
diff --git a/samples/Support7Demos/_index.html b/samples/Support7Demos/_index.html
new file mode 100644
index 000000000..0c017ab6d
--- /dev/null
+++ b/samples/Support7Demos/_index.html
@@ -0,0 +1,30 @@
+<p>The Support v7 Demos application contains a variety of small sample
+code showing how to use key features of the Android API 7+ Support Library.
+This library contains code that you can
+build in to your application to access new features and common
+utilities while being able to run down to version 2.1 (API 7)
+of the platform.
+</p>
+
+<script type="text/javascript">
+
+// This is a totally temporary hack to display the following content only
+// when the docs are online. This will be changed once the samples get moved.
+
+if (toRoot == "/") {
+
+document.write(""+
+"<p>You'll notice that all the samples are included in a single Android "+
+"project, so the application code and other resource files for all samples are batched "+
+"together. To help you find the code that's relevant to you, here's a directory that "+
+"points to the program code for the different topics included in the project:</p>"+
+
+"<ul>"+
+"<li><a href='src/com/example/android/supportv7/app/index.html'>App</a></li>"+
+"<li><a href='src/com/example/android/supportv7/media/index.html'>Media</a></li>"+
+"<li><a href='src/com/example/android/supportv7/view/index.html'>Views</a></li>"+
+"</ul>");
+
+}
+
+</script>
diff --git a/samples/Support7Demos/res/drawable-hdpi/apidemo_androidlogo.png b/samples/Support7Demos/res/drawable-hdpi/apidemo_androidlogo.png
new file mode 100644
index 000000000..088181b91
--- /dev/null
+++ b/samples/Support7Demos/res/drawable-hdpi/apidemo_androidlogo.png
Binary files differ
diff --git a/samples/Support7Demos/res/drawable-hdpi/app_sample_code.png b/samples/Support7Demos/res/drawable-hdpi/app_sample_code.png
new file mode 100755
index 000000000..66a198496
--- /dev/null
+++ b/samples/Support7Demos/res/drawable-hdpi/app_sample_code.png
Binary files differ
diff --git a/samples/Support7Demos/res/drawable-hdpi/ic_launcher_settings.png b/samples/Support7Demos/res/drawable-hdpi/ic_launcher_settings.png
new file mode 100644
index 000000000..c02bd424f
--- /dev/null
+++ b/samples/Support7Demos/res/drawable-hdpi/ic_launcher_settings.png
Binary files differ
diff --git a/samples/Support7Demos/res/drawable-mdpi/apidemo_androidlogo.png b/samples/Support7Demos/res/drawable-mdpi/apidemo_androidlogo.png
new file mode 100644
index 000000000..11cb47b28
--- /dev/null
+++ b/samples/Support7Demos/res/drawable-mdpi/apidemo_androidlogo.png
Binary files differ
diff --git a/samples/Support7Demos/res/drawable-mdpi/app_sample_code.png b/samples/Support7Demos/res/drawable-mdpi/app_sample_code.png
new file mode 100644
index 000000000..5ae7701a8
--- /dev/null
+++ b/samples/Support7Demos/res/drawable-mdpi/app_sample_code.png
Binary files differ
diff --git a/samples/Support7Demos/res/drawable-mdpi/ic_launcher_settings.png b/samples/Support7Demos/res/drawable-mdpi/ic_launcher_settings.png
new file mode 100644
index 000000000..05cdd9aa9
--- /dev/null
+++ b/samples/Support7Demos/res/drawable-mdpi/ic_launcher_settings.png
Binary files differ
diff --git a/samples/Support7Demos/res/layout-land/grid_layout_2.xml b/samples/Support7Demos/res/layout-land/grid_layout_2.xml
new file mode 100644
index 000000000..49fceaa6f
--- /dev/null
+++ b/samples/Support7Demos/res/layout-land/grid_layout_2.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<android.support.v7.widget.GridLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ app:useDefaultMargins="true"
+ app:alignmentMode="alignBounds"
+ app:rowOrderPreserved="false"
+ app:columnCount="4"
+ >
+ <TextView
+ android:text="Email setup"
+ android:textSize="32dip"
+ app:layout_columnSpan="4"
+ app:layout_gravity="center_horizontal"
+ />
+ <TextView
+ android:text="You can configure email in a few simple steps:"
+ android:textSize="16dip"
+ app:layout_columnSpan="4"
+ app:layout_gravity="left"
+ />
+ <TextView
+ android:text="Email address:"
+ app:layout_gravity="right"
+ />
+ <EditText
+ android:ems="10"
+ />
+ <TextView
+ android:text="Password:"
+ app:layout_column="0"
+ app:layout_gravity="right"
+ />
+ <EditText
+ android:ems="8"
+ />
+ <Button
+ android:text="Manual setup"
+ app:layout_row="5"
+ app:layout_column="3"
+ />
+ <Button
+ android:text="Next"
+ app:layout_column="3"
+ app:layout_gravity="fill_horizontal"
+ />
+</android.support.v7.widget.GridLayout>
diff --git a/samples/Support7Demos/res/layout/action_bar_display_options.xml b/samples/Support7Demos/res/layout/action_bar_display_options.xml
new file mode 100644
index 000000000..2efb7c2ed
--- /dev/null
+++ b/samples/Support7Demos/res/layout/action_bar_display_options.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <LinearLayout android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+ <Button android:id="@+id/toggle_home_as_up"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_home_as_up" />
+ <Button android:id="@+id/toggle_show_home"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_show_home" />
+ <Button android:id="@+id/toggle_use_logo"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_use_logo" />
+ <Button android:id="@+id/toggle_show_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_show_title" />
+ <Button android:id="@+id/toggle_show_custom"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_show_custom" />
+ <Button android:id="@+id/toggle_navigation"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_navigation" />
+ <Button android:id="@+id/cycle_custom_gravity"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/cycle_custom_gravity" />
+ <Button android:id="@+id/toggle_visibility"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_visibility" />
+ </LinearLayout>
+</ScrollView> \ No newline at end of file
diff --git a/samples/Support7Demos/res/layout/action_bar_display_options_custom.xml b/samples/Support7Demos/res/layout/action_bar_display_options_custom.xml
new file mode 100644
index 000000000..b7f5bd952
--- /dev/null
+++ b/samples/Support7Demos/res/layout/action_bar_display_options_custom.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<Button xmlns:android="http://schemas.android.com/apk/res/android"
+ android:text="@string/display_options_custom_button" />
diff --git a/samples/Support7Demos/res/layout/action_bar_fragment_menu.xml b/samples/Support7Demos/res/layout/action_bar_fragment_menu.xml
new file mode 100644
index 000000000..d18684daa
--- /dev/null
+++ b/samples/Support7Demos/res/layout/action_bar_fragment_menu.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="8dp">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:text="@string/action_bar_fragment_menu_msg" />
+
+ <CheckBox android:id="@+id/menu1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:checked="true"
+ android:text="@string/action_bar_fragment_menu1">
+ </CheckBox>
+
+ <CheckBox android:id="@+id/menu2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:checked="true"
+ android:text="@string/action_bar_fragment_menu2">
+ </CheckBox>
+
+ <CheckBox android:id="@+id/menu3"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:checked="true"
+ android:text="@string/action_bar_fragment_menu3">
+ </CheckBox>
+
+ <CheckBox android:id="@+id/has_options_menu"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:checked="true"
+ android:text="@string/action_bar_fragment_has_options_menu">
+ </CheckBox>
+
+ <CheckBox android:id="@+id/menu_visibility"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:checked="true"
+ android:text="@string/action_bar_fragment_menu_visibility">
+ </CheckBox>
+</LinearLayout>
diff --git a/samples/Support7Demos/res/layout/action_bar_settings_action_provider.xml b/samples/Support7Demos/res/layout/action_bar_settings_action_provider.xml
new file mode 100644
index 000000000..969332aad
--- /dev/null
+++ b/samples/Support7Demos/res/layout/action_bar_settings_action_provider.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:focusable="true"
+ android:addStatesFromChildren="true"
+ android:background="?attr/actionBarItemBackground"
+ style="?attr/actionButtonStyle">
+
+ <ImageButton android:id="@+id/button"
+ android:background="@drawable/ic_launcher_settings"
+ android:layout_width="32dip"
+ android:layout_height="32dip"
+ android:layout_gravity="center"
+ android:scaleType="fitCenter"
+ android:adjustViewBounds="true" />
+
+</LinearLayout>
diff --git a/samples/Support7Demos/res/layout/action_bar_tab_content.xml b/samples/Support7Demos/res/layout/action_bar_tab_content.xml
new file mode 100644
index 000000000..c0aa7fade
--- /dev/null
+++ b/samples/Support7Demos/res/layout/action_bar_tab_content.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
diff --git a/samples/Support7Demos/res/layout/action_bar_tabs.xml b/samples/Support7Demos/res/layout/action_bar_tabs.xml
new file mode 100644
index 000000000..a51f46ef7
--- /dev/null
+++ b/samples/Support7Demos/res/layout/action_bar_tabs.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+ <FrameLayout android:id="@+id/fragment_content"
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1" />
+ <LinearLayout android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:orientation="vertical">
+ <Button android:id="@+id/btn_add_tab"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/btn_add_tab"
+ android:onClick="onAddTab" />
+ <Button android:id="@+id/btn_remove_tab"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/btn_remove_tab"
+ android:onClick="onRemoveTab" />
+ <Button android:id="@+id/btn_toggle_tabs"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/btn_toggle_tabs"
+ android:onClick="onToggleTabs" />
+ <Button android:id="@+id/btn_remove_all_tabs"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/btn_remove_all_tabs"
+ android:onClick="onRemoveAllTabs" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/Support7Demos/res/layout/grid_layout_1.xml b/samples/Support7Demos/res/layout/grid_layout_1.xml
new file mode 100644
index 000000000..c3b153794
--- /dev/null
+++ b/samples/Support7Demos/res/layout/grid_layout_1.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<!--
+ Demonstrates using GridLayout to build the "Simple Form" from the
+ LinearLayout and RelativeLayout demos.
+-->
+
+<android.support.v7.widget.GridLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/blue"
+ android:padding="10dip"
+ app:columnCount="4"
+ >
+ <TextView
+ android:text="@string/grid_layout_1_instructions"
+ />
+ <EditText
+ app:layout_gravity="fill_horizontal"
+ app:layout_column="0"
+ app:layout_columnSpan="4"
+ />
+ <Button
+ android:text="@string/grid_layout_1_cancel"
+ app:layout_column="2"
+ />
+ <Button
+ android:text="@string/grid_layout_1_ok"
+ android:layout_marginLeft="10dip"
+ />
+</android.support.v7.widget.GridLayout>
diff --git a/samples/Support7Demos/res/layout/grid_layout_2.xml b/samples/Support7Demos/res/layout/grid_layout_2.xml
new file mode 100644
index 000000000..b7ee40cb1
--- /dev/null
+++ b/samples/Support7Demos/res/layout/grid_layout_2.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<android.support.v7.widget.GridLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ app:useDefaultMargins="true"
+ app:alignmentMode="alignBounds"
+ app:columnOrderPreserved="false"
+ app:columnCount="4"
+ >
+ <TextView
+ android:text="Email setup"
+ android:textSize="32dip"
+ app:layout_columnSpan="4"
+ app:layout_gravity="center_horizontal"
+ />
+ <TextView
+ android:text="You can configure email in a few simple steps:"
+ android:textSize="16dip"
+ app:layout_columnSpan="4"
+ app:layout_gravity="left"
+ />
+ <TextView
+ android:text="Email address:"
+ app:layout_gravity="right"
+ />
+ <EditText
+ android:ems="10"
+ />
+ <TextView
+ android:text="Password:"
+ app:layout_column="0"
+ app:layout_gravity="right"
+ />
+ <EditText
+ android:ems="8"
+ />
+ <Button
+ android:text="Manual setup"
+ app:layout_row="5"
+ app:layout_column="3"
+ />
+ <Button
+ android:text="Next"
+ app:layout_column="3"
+ app:layout_gravity="fill_horizontal"
+ />
+</android.support.v7.widget.GridLayout>
diff --git a/samples/Support7Demos/res/layout/sample_media_router.xml b/samples/Support7Demos/res/layout/sample_media_router.xml
new file mode 100644
index 000000000..a8b08b1b7
--- /dev/null
+++ b/samples/Support7Demos/res/layout/sample_media_router.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<!-- See corresponding Java code SampleMediaRouterActivity.java. -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <!-- Message to show to use. -->
+ <TextView android:id="@+id/text"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:gravity="center_vertical|center_horizontal"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:text="@string/sample_media_router_text"/>
+
+ <!-- Some information about what's going on. -->
+ <TextView android:id="@+id/info"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:gravity="center_vertical|center_horizontal"
+ android:textAppearance="?android:attr/textAppearanceMedium"/>
+
+ <!-- Some media to play. -->
+ <ListView android:id="@+id/media"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"/>
+
+ <!-- Control buttons for the currently selected route. -->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="0">
+ <Button android:id="@+id/play_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:text="@string/play_button_text" />
+
+ <Button android:id="@+id/statistics_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:text="@string/statistics_button_text" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/Support7Demos/res/menu/action_bar_settings_action_provider.xml b/samples/Support7Demos/res/menu/action_bar_settings_action_provider.xml
new file mode 100644
index 000000000..e9bb931c0
--- /dev/null
+++ b/samples/Support7Demos/res/menu/action_bar_settings_action_provider.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 Google Inc.
+
+ 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.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+ <item android:id="@+id/menu_item_action_provider_action_bar"
+ android:title="@string/action_bar_settings"
+ app:showAsAction="ifRoom"
+ app:actionProviderClass="com.example.android.supportv7.app.ActionBarSettingsActionProviderActivity$SettingsActionProvider"/>
+
+ <item android:id="@+id/menu_item_action_provider_overflow"
+ android:title="@string/action_bar_settings"
+ app:showAsAction="never"
+ app:actionProviderClass="com.example.android.supportv7.app.ActionBarSettingsActionProviderActivity$SettingsActionProvider"/>
+</menu>
diff --git a/samples/Support7Demos/res/menu/actions.xml b/samples/Support7Demos/res/menu/actions.xml
new file mode 100644
index 000000000..fbae7b1c4
--- /dev/null
+++ b/samples/Support7Demos/res/menu/actions.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 Google Inc.
+
+ 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.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+ <item android:id="@+id/action_search"
+ android:icon="@android:drawable/ic_menu_search"
+ android:title="@string/action_bar_search"
+ app:showAsAction="ifRoom"
+ app:actionProviderClass="android.support.v7.widget.SearchActionProvider" />
+ <item android:id="@+id/action_add"
+ android:icon="@android:drawable/ic_menu_add"
+ android:title="@string/action_bar_add" />
+ <item android:id="@+id/action_edit"
+ android:icon="@android:drawable/ic_menu_edit"
+ android:title="@string/action_bar_edit"
+ app:showAsAction="always" />
+ <item android:id="@+id/action_share"
+ android:icon="@android:drawable/ic_menu_share"
+ android:title="@string/action_bar_share"
+ app:showAsAction="ifRoom" />
+ <item android:id="@+id/action_sort"
+ android:icon="@android:drawable/ic_menu_sort_by_size"
+ android:title="@string/action_bar_sort"
+ app:showAsAction="ifRoom">
+ <menu>
+ <item android:id="@+id/action_sort_size"
+ android:icon="@android:drawable/ic_menu_sort_by_size"
+ android:title="@string/action_bar_sort_size"
+ android:onClick="onSort" />
+ <item android:id="@+id/action_sort_alpha"
+ android:icon="@android:drawable/ic_menu_sort_alphabetically"
+ android:title="@string/action_bar_sort_alpha"
+ android:onClick="onSort" />
+ </menu>
+ </item>
+</menu>
diff --git a/samples/Support7Demos/res/menu/display_options_actions.xml b/samples/Support7Demos/res/menu/display_options_actions.xml
new file mode 100644
index 000000000..344e40d7d
--- /dev/null
+++ b/samples/Support7Demos/res/menu/display_options_actions.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+ <item android:id="@+id/simple_item"
+ android:title="@string/display_options_menu_item"
+ app:showAsAction="ifRoom" />
+</menu>
diff --git a/samples/Support7Demos/res/menu/sample_media_router_menu.xml b/samples/Support7Demos/res/menu/sample_media_router_menu.xml
new file mode 100644
index 000000000..8057fa800
--- /dev/null
+++ b/samples/Support7Demos/res/menu/sample_media_router_menu.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 Google Inc.
+
+ 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.
+-->
+
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+ <item android:id="@+id/media_route_menu_item"
+ android:title="@string/media_route_menu_title"
+ app:showAsAction="always"
+ app:actionProviderClass="android.support.v7.app.MediaRouteActionProvider"/>
+</menu>
diff --git a/samples/Support7Demos/res/values/arrays.xml b/samples/Support7Demos/res/values/arrays.xml
new file mode 100644
index 000000000..f5616a1b4
--- /dev/null
+++ b/samples/Support7Demos/res/values/arrays.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<resources>
+ <string-array name="media_names">
+ <item>My favorite video of cats</item>
+ <item>Cats on parade</item>
+ <item>Cats with hats</item>
+ <item>Hats on cats</item>
+ <item>Cats on mats</item>
+ </string-array>
+
+ <string-array name="media_uris">
+ <item>http://cats.example.com/favorite-cats.mp4</item>
+ <item>http://cats.example.com/cats-on-parade.mp4</item>
+ <item>http://cats.example.com/cats-with-hats.mp4</item>
+ <item>http://cats.example.com/hats-on-cats.mp4</item>
+ <item>http://cats.example.com/cats-on-mats.mp4</item>
+ </string-array>
+</resources>
diff --git a/samples/MailSync/res/values/ids.xml b/samples/Support7Demos/res/values/colors.xml
index ee736a635..b129b8de6 100644
--- a/samples/MailSync/res/values/ids.xml
+++ b/samples/Support7Demos/res/values/colors.xml
@@ -4,9 +4,9 @@
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.
@@ -15,7 +15,5 @@
-->
<resources>
- <item type="id" name="from" />
- <item type="id" name="snippet" />
- <item type="id" name="subject" />
+ <drawable name="blue">#770000ff</drawable>
</resources>
diff --git a/samples/Support7Demos/res/values/strings.xml b/samples/Support7Demos/res/values/strings.xml
new file mode 100644
index 000000000..6a8ac7777
--- /dev/null
+++ b/samples/Support7Demos/res/values/strings.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="activity_sample_code">Support v7 Demos</string>
+
+ <!-- MediaRouter -->
+
+ <string name="sample_media_router_activity_dark">MediaRouter/Dark Theme</string>
+ <string name="sample_media_router_activity_light">MediaRouter/Light Theme</string>
+ <string name="sample_media_router_activity_light_with_dark_action_bar">MediaRouter/Light Theme, Dark Action Bar</string>
+ <string name="sample_media_router_text">This activity demonstrates how to
+ use MediaRouter from the support library. Select a route from the action bar.</string>
+ <string name="media_route_menu_title">Play on...</string>
+
+ <string name="play_button_text">Play</string>
+ <string name="statistics_button_text">Show Statistics</string>
+
+ <string name="sample_media_route_provider_service">Media Route Provider Service Support Library Sample</string>
+ <string name="fixed_volume_route_name">Fixed Volume Remote Playback Route</string>
+ <string name="variable_volume_route_name">Variable Volume Remote Playback Route</string>
+ <string name="sample_route_description">Sample route from Support7Demos</string>
+
+ <!-- GridLayout -->
+
+ <string name="grid_layout_1">GridLayout/1. Simple Form</string>
+ <string name="grid_layout_2">GridLayout/2. Form (XML)</string>
+ <string name="grid_layout_3">GridLayout/3. Form (Java)</string>
+
+ <string name="grid_layout_1_instructions">Type here:</string>
+ <string name="grid_layout_1_ok">Ok</string>
+ <string name="grid_layout_1_cancel">Cancel</string>
+
+ <!-- ActionBar -->
+
+ <string name="action_bar_mechanics">AppCompat/Action Bar/Action Bar Mechanics</string>
+ <string name="action_bar_usage">AppCompat/Action Bar/Action Bar Usage</string>
+ <string name="action_bar_tabs">AppCompat/Action Bar/Action Bar Tabs</string>
+ <string name="action_bar_settings_action_provider">AppCompat/Action Bar/Settings Action Provider</string>
+ <string name="action_bar_settings_action_provider_no_handling">Handling in onOptionsItemSelected avoided</string>
+
+ <string name="action_bar_search">Search</string>
+ <string name="action_bar_add">Add</string>
+ <string name="action_bar_edit">Edit</string>
+ <string name="action_bar_share">Share</string>
+ <string name="action_bar_sort">Sort</string>
+ <string name="action_bar_sort_alpha">Alphabetically</string>
+ <string name="action_bar_sort_size">By size</string>
+ <string name="action_bar_settings">Settings</string>
+
+ <string name="action_bar_display_options">AppCompat/Action Bar/Display Options</string>
+ <string name="toggle_home_as_up">DISPLAY_HOME_AS_UP</string>
+ <string name="toggle_show_home">DISPLAY_SHOW_HOME</string>
+ <string name="toggle_use_logo">DISPLAY_USE_LOGO</string>
+ <string name="toggle_show_title">DISPLAY_SHOW_TITLE</string>
+ <string name="toggle_show_custom">DISPLAY_SHOW_CUSTOM</string>
+ <string name="toggle_navigation">Navigation</string>
+ <string name="cycle_custom_gravity">Cycle Custom View Gravity</string>
+ <string name="toggle_visibility">Toggle Visibility</string>
+
+ <string name="display_options_custom_button">Custom View!</string>
+ <string name="display_options_menu_item">Menu Item</string>
+
+ <string name="btn_add_tab">Add new tab</string>
+ <string name="btn_remove_tab">Remove last tab</string>
+ <string name="btn_toggle_tabs">Toggle tab mode</string>
+ <string name="btn_remove_all_tabs">Remove all tabs</string>
+
+ <string name="action_bar_fragment_menu">AppCompat/Action Bar/Fragment Menu</string>
+ <string name="action_bar_fragment_menu_msg">Build menus from three fragments, the last one
+ nested, allowing you to hide them to remove them...</string>
+ <string name="action_bar_fragment_menu1">Show fragment 1</string>
+ <string name="action_bar_fragment_menu2">Show fragment 2</string>
+ <string name="action_bar_fragment_menu3">Show nested fragment (within fragment 2)</string>
+ <string name="action_bar_fragment_has_options_menu">Set has options menu to true</string>
+ <string name="action_bar_fragment_menu_visibility">Set menu visibility to true</string>
+
+</resources>
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/Support7Demos.java b/samples/Support7Demos/src/com/example/android/supportv7/Support7Demos.java
new file mode 100644
index 000000000..a135649bd
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/Support7Demos.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2013 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.example.android.supportv7;
+
+import android.app.ListActivity;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ListView;
+import android.widget.SimpleAdapter;
+
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Support7Demos extends ListActivity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ Intent intent = getIntent();
+ String path = intent.getStringExtra("com.example.android.apis.Path");
+
+ if (path == null) {
+ path = "";
+ }
+
+ setListAdapter(new SimpleAdapter(this, getData(path),
+ android.R.layout.simple_list_item_1, new String[] { "title" },
+ new int[] { android.R.id.text1 }));
+ getListView().setTextFilterEnabled(true);
+ }
+
+ protected List<Map<String, Object>> getData(String prefix) {
+ List<Map<String, Object>> myData = new ArrayList<Map<String, Object>>();
+
+ Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
+ mainIntent.addCategory("com.example.android.supportv7.SAMPLE_CODE");
+
+ PackageManager pm = getPackageManager();
+ List<ResolveInfo> list = pm.queryIntentActivities(mainIntent, 0);
+
+ if (null == list)
+ return myData;
+
+ String[] prefixPath;
+ String prefixWithSlash = prefix;
+
+ if (prefix.equals("")) {
+ prefixPath = null;
+ } else {
+ prefixPath = prefix.split("/");
+ prefixWithSlash = prefix + "/";
+ }
+
+ int len = list.size();
+
+ Map<String, Boolean> entries = new HashMap<String, Boolean>();
+
+ for (int i = 0; i < len; i++) {
+ ResolveInfo info = list.get(i);
+ CharSequence labelSeq = info.loadLabel(pm);
+ String label = labelSeq != null
+ ? labelSeq.toString()
+ : info.activityInfo.name;
+
+ if (prefixWithSlash.length() == 0 || label.startsWith(prefixWithSlash)) {
+
+ String[] labelPath = label.split("/");
+
+ String nextLabel = prefixPath == null ? labelPath[0] : labelPath[prefixPath.length];
+
+ if ((prefixPath != null ? prefixPath.length : 0) == labelPath.length - 1) {
+ addItem(myData, nextLabel, activityIntent(
+ info.activityInfo.applicationInfo.packageName,
+ info.activityInfo.name));
+ } else {
+ if (entries.get(nextLabel) == null) {
+ addItem(myData, nextLabel, browseIntent(
+ prefix.equals("") ? nextLabel : prefix + "/" + nextLabel));
+ entries.put(nextLabel, true);
+ }
+ }
+ }
+ }
+
+ Collections.sort(myData, sDisplayNameComparator);
+
+ return myData;
+ }
+
+ private final static Comparator<Map<String, Object>> sDisplayNameComparator =
+ new Comparator<Map<String, Object>>() {
+ private final Collator collator = Collator.getInstance();
+
+ @Override
+ public int compare(Map<String, Object> map1, Map<String, Object> map2) {
+ return collator.compare(map1.get("title"), map2.get("title"));
+ }
+ };
+
+ protected Intent activityIntent(String pkg, String componentName) {
+ Intent result = new Intent();
+ result.setClassName(pkg, componentName);
+ return result;
+ }
+
+ protected Intent browseIntent(String path) {
+ Intent result = new Intent();
+ result.setClass(this, Support7Demos.class);
+ result.putExtra("com.example.android.apis.Path", path);
+ return result;
+ }
+
+ protected void addItem(List<Map<String, Object>> data, String name, Intent intent) {
+ Map<String, Object> temp = new HashMap<String, Object>();
+ temp.put("title", name);
+ temp.put("intent", intent);
+ data.add(temp);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void onListItemClick(ListView l, View v, int position, long id) {
+ Map<String, Object> map = (Map<String, Object>)l.getItemAtPosition(position);
+
+ Intent intent = (Intent) map.get("intent");
+ startActivity(intent);
+ }
+}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/_package.html b/samples/Support7Demos/src/com/example/android/supportv7/_package.html
new file mode 100644
index 000000000..be85e7887
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/_package.html
@@ -0,0 +1,24 @@
+<html>
+<head>
+<link rel="stylesheet" type="text/css" href="assets/style.css" />
+<script type="text/javascript" src="http://www.corp.google.com/style/prettify.js"></script>
+<script src="http://www.corp.google.com/eng/techpubs/include/navbar.js" type="text/javascript"></script>
+
+
+
+</head>
+
+<body>
+
+<p>
+Examples of how to use support library APIs. See:
+
+<ol>
+ <li> <a href="com.example.android.supportv7.app">sdk.app</a> for examples
+ of using the application package support APIs.
+</ol>
+</p>
+
+
+</body>
+</html>
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarDisplayOptions.java b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarDisplayOptions.java
new file mode 100644
index 000000000..b7b25e8f8
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarDisplayOptions.java
@@ -0,0 +1,144 @@
+/*
+ * 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 com.example.android.supportv7.app;
+
+import android.os.Bundle;
+import android.support.v4.app.FragmentTransaction;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.ActionBar.Tab;
+import android.support.v7.app.ActionBarActivity;
+import android.view.Gravity;
+import android.view.Menu;
+import android.view.View;
+import android.view.ViewGroup.LayoutParams;
+
+import com.example.android.supportv7.R;
+
+/**
+ * This demo shows how various action bar display option flags can be combined and their effects.
+ */
+public class ActionBarDisplayOptions extends ActionBarActivity
+ implements View.OnClickListener, ActionBar.TabListener {
+ private View mCustomView;
+ private ActionBar.LayoutParams mCustomViewLayoutParams;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.action_bar_display_options);
+
+ findViewById(R.id.toggle_home_as_up).setOnClickListener(this);
+ findViewById(R.id.toggle_show_home).setOnClickListener(this);
+ findViewById(R.id.toggle_use_logo).setOnClickListener(this);
+ findViewById(R.id.toggle_show_title).setOnClickListener(this);
+ findViewById(R.id.toggle_show_custom).setOnClickListener(this);
+ findViewById(R.id.toggle_navigation).setOnClickListener(this);
+ findViewById(R.id.cycle_custom_gravity).setOnClickListener(this);
+ findViewById(R.id.toggle_visibility).setOnClickListener(this);
+
+ // Configure several action bar elements that will be toggled by display options.
+ mCustomView = getLayoutInflater().inflate(R.layout.action_bar_display_options_custom, null);
+ mCustomViewLayoutParams = new ActionBar.LayoutParams(
+ LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
+
+ final ActionBar bar = getSupportActionBar();
+ bar.setCustomView(mCustomView, mCustomViewLayoutParams);
+ bar.addTab(bar.newTab().setText("Tab 1").setTabListener(this));
+ bar.addTab(bar.newTab().setText("Tab 2").setTabListener(this));
+ bar.addTab(bar.newTab().setText("Tab 3").setTabListener(this));
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.display_options_actions, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onSupportNavigateUp() {
+ finish();
+ return true;
+ }
+
+ @Override
+ public void onClick(View v) {
+ final ActionBar bar = getSupportActionBar();
+ int flags = 0;
+ switch (v.getId()) {
+ case R.id.toggle_home_as_up:
+ flags = ActionBar.DISPLAY_HOME_AS_UP;
+ break;
+ case R.id.toggle_show_home:
+ flags = ActionBar.DISPLAY_SHOW_HOME;
+ break;
+ case R.id.toggle_use_logo:
+ flags = ActionBar.DISPLAY_USE_LOGO;
+ break;
+ case R.id.toggle_show_title:
+ flags = ActionBar.DISPLAY_SHOW_TITLE;
+ break;
+ case R.id.toggle_show_custom:
+ flags = ActionBar.DISPLAY_SHOW_CUSTOM;
+ break;
+ case R.id.toggle_navigation:
+ bar.setNavigationMode(
+ bar.getNavigationMode() == ActionBar.NAVIGATION_MODE_STANDARD
+ ? ActionBar.NAVIGATION_MODE_TABS
+ : ActionBar.NAVIGATION_MODE_STANDARD);
+ return;
+ case R.id.cycle_custom_gravity: {
+ ActionBar.LayoutParams lp = mCustomViewLayoutParams;
+ int newGravity = 0;
+ switch (lp.gravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
+ case Gravity.LEFT:
+ newGravity = Gravity.CENTER_HORIZONTAL;
+ break;
+ case Gravity.CENTER_HORIZONTAL:
+ newGravity = Gravity.RIGHT;
+ break;
+ case Gravity.RIGHT:
+ newGravity = Gravity.LEFT;
+ break;
+ }
+ lp.gravity = lp.gravity & ~Gravity.HORIZONTAL_GRAVITY_MASK | newGravity;
+ bar.setCustomView(mCustomView, lp);
+ return;
+ }
+ case R.id.toggle_visibility:
+ if (bar.isShowing()) {
+ bar.hide();
+ } else {
+ bar.show();
+ }
+ return;
+ }
+
+ int change = bar.getDisplayOptions() ^ flags;
+ bar.setDisplayOptions(change, flags);
+ }
+
+ @Override
+ public void onTabSelected(Tab tab, FragmentTransaction ft) {
+ }
+
+ @Override
+ public void onTabUnselected(Tab tab, FragmentTransaction ft) {
+ }
+
+ @Override
+ public void onTabReselected(Tab tab, FragmentTransaction ft) {
+ }
+}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarFragmentMenu.java b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarFragmentMenu.java
new file mode 100644
index 000000000..207631e78
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarFragmentMenu.java
@@ -0,0 +1,237 @@
+/*
+ * Copyright (C) 2013 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.example.android.supportv7.app;
+
+import android.support.v4.view.MenuItemCompat;
+import android.view.Menu;
+import android.view.MenuItem;
+import com.example.android.supportv7.R;
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentTransaction;
+import android.support.v7.app.ActionBarActivity;
+import android.view.MenuInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.CheckBox;
+import android.widget.Toast;
+
+/**
+ * Demonstrates how fragments can participate in the options menu.
+ */
+public class ActionBarFragmentMenu extends ActionBarActivity {
+ MenuFragment mFragment1;
+ Menu2Fragment mFragment2;
+ CheckBox mCheckBox1;
+ CheckBox mCheckBox2;
+ CheckBox mCheckBox3;
+ CheckBox mHasOptionsMenu;
+ CheckBox mMenuVisibility;
+
+ // Update fragment visibility when check boxes are changed.
+ final OnClickListener mClickListener = new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ updateFragmentVisibility();
+ }
+ };
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.action_bar_fragment_menu);
+
+ // Make sure the two menu fragments are created.
+ FragmentManager fm = getSupportFragmentManager();
+ FragmentTransaction ft = fm.beginTransaction();
+ mFragment1 = (MenuFragment)fm.findFragmentByTag("f1");
+ if (mFragment1 == null) {
+ mFragment1 = new MenuFragment();
+ ft.add(mFragment1, "f1");
+ }
+ mFragment2 = (Menu2Fragment)fm.findFragmentByTag("f2");
+ if (mFragment2 == null) {
+ mFragment2 = new Menu2Fragment();
+ ft.add(mFragment2, "f2");
+ }
+ ft.commit();
+
+ // Watch check box clicks.
+ mCheckBox1 = (CheckBox)findViewById(R.id.menu1);
+ mCheckBox1.setOnClickListener(mClickListener);
+ mCheckBox2 = (CheckBox)findViewById(R.id.menu2);
+ mCheckBox2.setOnClickListener(mClickListener);
+ mCheckBox3 = (CheckBox)findViewById(R.id.menu3);
+ mCheckBox3.setOnClickListener(mClickListener);
+ mHasOptionsMenu = (CheckBox)findViewById(R.id.has_options_menu);
+ mHasOptionsMenu.setOnClickListener(mClickListener);
+ mMenuVisibility = (CheckBox)findViewById(R.id.menu_visibility);
+ mMenuVisibility.setOnClickListener(mClickListener);
+
+ // Make sure fragments start out with correct visibility.
+ updateFragmentVisibility();
+ }
+
+ @Override
+ protected void onRestoreInstanceState(Bundle savedInstanceState) {
+ super.onRestoreInstanceState(savedInstanceState);
+ // Make sure fragments are updated after check box view state is restored.
+ updateFragmentVisibility();
+ }
+
+ // Update fragment visibility based on current check box state.
+ void updateFragmentVisibility() {
+ // Update top level fragments.
+ FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
+ if (mCheckBox1.isChecked()) ft.show(mFragment1);
+ else ft.hide(mFragment1);
+ if (mCheckBox2.isChecked()) ft.show(mFragment2);
+ else ft.hide(mFragment2);
+ ft.commit();
+
+ mFragment1.setHasOptionsMenu(mHasOptionsMenu.isChecked());
+ mFragment1.setMenuVisibility(mMenuVisibility.isChecked());
+ mFragment2.setHasOptionsMenu(mHasOptionsMenu.isChecked());
+ mFragment2.setMenuVisibility(mMenuVisibility.isChecked());
+
+ // Update the nested fragment.
+ if (mFragment2.mFragment3 != null) {
+ ft = mFragment2.getFragmentManager().beginTransaction();
+ if (mCheckBox3.isChecked()) ft.show(mFragment2.mFragment3);
+ else ft.hide(mFragment2.mFragment3);
+ ft.commit();
+
+ mFragment2.mFragment3.setHasOptionsMenu(mHasOptionsMenu.isChecked());
+ mFragment2.mFragment3.setMenuVisibility(mMenuVisibility.isChecked());
+ }
+ }
+
+ /**
+ * A fragment that displays a menu. This fragment happens to not
+ * have a UI (it does not implement onCreateView), but it could also
+ * have one if it wanted.
+ */
+ public static class MenuFragment extends Fragment {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setHasOptionsMenu(true);
+ }
+
+ @Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+ MenuItemCompat.setShowAsAction(menu.add("Menu 1a"), MenuItem.SHOW_AS_ACTION_IF_ROOM);
+ MenuItemCompat.setShowAsAction(menu.add("Menu 1b"), MenuItem.SHOW_AS_ACTION_IF_ROOM);
+ super.onCreateOptionsMenu(menu, inflater);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getTitle().equals("Menu 1a")) {
+ Toast.makeText(getActivity(), "Selected Menu 1a.", Toast.LENGTH_SHORT).show();
+ return true;
+ }
+ if (item.getTitle().equals("Menu 1b")) {
+ Toast.makeText(getActivity(), "Selected Menu 1b.", Toast.LENGTH_SHORT).show();
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
+ /**
+ * Second fragment with a menu.
+ */
+ public static class Menu2Fragment extends Fragment {
+ Menu3Fragment mFragment3;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setHasOptionsMenu(true);
+
+ FragmentManager fm = getChildFragmentManager();
+ FragmentTransaction ft = fm.beginTransaction();
+ mFragment3 = (Menu3Fragment)fm.findFragmentByTag("f3");
+ if (mFragment3 == null) {
+ mFragment3 = new Menu3Fragment();
+ ft.add(mFragment3, "f3");
+ }
+ ft.commit();
+ }
+
+ @Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+ MenuItemCompat.setShowAsAction(menu.add("Menu 2"), MenuItem.SHOW_AS_ACTION_IF_ROOM);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getTitle().equals("Menu 2")) {
+ Toast.makeText(getActivity(), "Selected Menu 2.", Toast.LENGTH_SHORT).show();
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /**
+ * Third fragment with a menu.
+ * This one is nested within the second.
+ */
+ public static class Menu3Fragment extends Fragment {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setHasOptionsMenu(true);
+ }
+
+ @Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+ Toast.makeText(getActivity(), "Created nested fragment's menu.",
+ Toast.LENGTH_SHORT).show();
+ inflater.inflate(R.menu.display_options_actions, menu);
+ super.onCreateOptionsMenu(menu, inflater);
+ }
+
+ @Override
+ public void onDestroyOptionsMenu() {
+ Toast.makeText(getActivity(), "Destroyed nested fragment's menu.",
+ Toast.LENGTH_SHORT).show();
+ super.onDestroyOptionsMenu();
+ }
+
+ @Override
+ public void onPrepareOptionsMenu(Menu menu) {
+ Toast.makeText(getActivity(), "Prepared nested fragment's menu.",
+ Toast.LENGTH_SHORT).show();
+ super.onPrepareOptionsMenu(menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == R.id.simple_item) {
+ Toast.makeText(getActivity(), "Selected nested fragment's menu item.",
+ Toast.LENGTH_SHORT).show();
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+ }
+}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarMechanics.java b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarMechanics.java
new file mode 100644
index 000000000..ed4b97bd5
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarMechanics.java
@@ -0,0 +1,73 @@
+/*
+ * 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 com.example.android.supportv7.app;
+
+import android.os.Bundle;
+import android.support.v4.view.MenuItemCompat;
+import android.support.v4.view.WindowCompat;
+import android.support.v7.app.ActionBarActivity;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.widget.Toast;
+
+/**
+ * This demonstrates the basics of the Action Bar and how it interoperates with the
+ * standard options menu. This demo is for informative purposes only; see ActionBarUsage for
+ * an example of using the Action Bar in a more idiomatic manner.
+ */
+public class ActionBarMechanics extends ActionBarActivity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // The Action Bar is a window feature. The feature must be requested
+ // before setting a content view. Normally this is set automatically
+ // by your Activity's theme in your manifest. The provided system
+ // theme Theme.WithActionBar enables this for you. Use it as you would
+ // use Theme.NoTitleBar. You can add an Action Bar to your own themes
+ // by adding the element <item name="android:windowActionBar">true</item>
+ // to your style definition.
+ supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Menu items default to never show in the action bar. On most devices this means
+ // they will show in the standard options menu panel when the menu button is pressed.
+ // On xlarge-screen devices a "More" button will appear in the far right of the
+ // Action Bar that will display remaining items in a cascading menu.
+ menu.add("Normal item");
+
+ MenuItem actionItem = menu.add("Action Button");
+
+ // Items that show as actions should favor the "if room" setting, which will
+ // prevent too many buttons from crowding the bar. Extra items will show in the
+ // overflow area.
+ MenuItemCompat.setShowAsAction(actionItem, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
+
+ // Items that show as actions are strongly encouraged to use an icon.
+ // These icons are shown without a text description, and therefore should
+ // be sufficiently descriptive on their own.
+ actionItem.setIcon(android.R.drawable.ic_menu_share);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ Toast.makeText(this, "Selected Item: " + item.getTitle(), Toast.LENGTH_SHORT).show();
+ return true;
+ }
+}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarSettingsActionProviderActivity.java b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarSettingsActionProviderActivity.java
new file mode 100644
index 000000000..ba1ccbe28
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarSettingsActionProviderActivity.java
@@ -0,0 +1,93 @@
+/*
+ * 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.example.android.supportv7.app;
+
+import android.content.Context;
+import android.content.Intent;
+import android.provider.Settings;
+import android.support.v7.app.ActionBarActivity;
+import android.support.v4.view.ActionProvider;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.ImageButton;
+import android.widget.Toast;
+import com.example.android.supportv7.R;
+
+/**
+ * This activity demonstrates how to implement an {@link android.view.ActionProvider}
+ * for adding functionality to the Action Bar. In particular this demo creates an
+ * ActionProvider for launching the system settings and adds a menu item with that
+ * provider.
+ */
+public class ActionBarSettingsActionProviderActivity extends ActionBarActivity {
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ super.onCreateOptionsMenu(menu);
+ getMenuInflater().inflate(R.menu.action_bar_settings_action_provider, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ // If this callback does not handle the item click, onPerformDefaultAction
+ // of the ActionProvider is invoked. Hence, the provider encapsulates the
+ // complete functionality of the menu item.
+ Toast.makeText(this, R.string.action_bar_settings_action_provider_no_handling,
+ Toast.LENGTH_SHORT).show();
+ return false;
+ }
+
+ public static class SettingsActionProvider extends ActionProvider {
+ /** An intent for launching the system settings. */
+ private static final Intent sSettingsIntent = new Intent(Settings.ACTION_SETTINGS);
+
+ /**
+ * Creates a new instance.
+ *
+ * @param context Context for accessing resources.
+ */
+ public SettingsActionProvider(Context context) {
+ super(context);
+ }
+
+ @Override
+ public View onCreateActionView() {
+ // Inflate the action view to be shown on the action bar.
+ LayoutInflater layoutInflater = LayoutInflater.from(getContext());
+ View view = layoutInflater.inflate(R.layout.action_bar_settings_action_provider, null);
+ ImageButton button = (ImageButton) view.findViewById(R.id.button);
+ // Attach a click listener for launching the system settings.
+ button.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ getContext().startActivity(sSettingsIntent);
+ }
+ });
+ return view;
+ }
+
+ @Override
+ public boolean onPerformDefaultAction() {
+ // This is called if the host menu item placed in the overflow menu of the
+ // action bar is clicked and the host activity did not handle the click.
+ getContext().startActivity(sSettingsIntent);
+ return true;
+ }
+ }
+}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarTabs.java b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarTabs.java
new file mode 100644
index 000000000..aaa916cf3
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarTabs.java
@@ -0,0 +1,134 @@
+/*
+ * 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 com.example.android.supportv7.app;
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentTransaction;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.ActionBar.Tab;
+import android.support.v7.app.ActionBarActivity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+import android.widget.Toast;
+import com.example.android.supportv7.R;
+
+/**
+ * This demonstrates the use of action bar tabs and how they interact
+ * with other action bar features.
+ */
+public class ActionBarTabs extends ActionBarActivity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.action_bar_tabs);
+ }
+
+ public void onAddTab(View v) {
+ final ActionBar bar = getSupportActionBar();
+ final int tabCount = bar.getTabCount();
+ final String text = "Tab " + tabCount;
+ bar.addTab(bar.newTab()
+ .setText(text)
+ .setTabListener(new TabListener(new TabContentFragment(text))));
+ }
+
+ public void onRemoveTab(View v) {
+ final ActionBar bar = getSupportActionBar();
+ if (bar.getTabCount() > 0) {
+ bar.removeTabAt(bar.getTabCount() - 1);
+ }
+ }
+
+ public void onToggleTabs(View v) {
+ final ActionBar bar = getSupportActionBar();
+
+ if (bar.getNavigationMode() == ActionBar.NAVIGATION_MODE_TABS) {
+ bar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
+ bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);
+ } else {
+ bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
+ bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
+ }
+ }
+
+ public void onRemoveAllTabs(View v) {
+ getSupportActionBar().removeAllTabs();
+ }
+
+ /**
+ * A TabListener receives event callbacks from the action bar as tabs
+ * are deselected, selected, and reselected. A FragmentTransaction
+ * is provided to each of these callbacks; if any operations are added
+ * to it, it will be committed at the end of the full tab switch operation.
+ * This lets tab switches be atomic without the app needing to track
+ * the interactions between different tabs.
+ *
+ * NOTE: This is a very simple implementation that does not retain
+ * fragment state of the non-visible tabs across activity instances.
+ * Look at the FragmentTabs example for how to do a more complete
+ * implementation.
+ */
+ private class TabListener implements ActionBar.TabListener {
+ private TabContentFragment mFragment;
+
+ public TabListener(TabContentFragment fragment) {
+ mFragment = fragment;
+ }
+
+ @Override
+ public void onTabSelected(Tab tab, FragmentTransaction ft) {
+ ft.add(R.id.fragment_content, mFragment, mFragment.getText());
+ }
+
+ @Override
+ public void onTabUnselected(Tab tab, FragmentTransaction ft) {
+ ft.remove(mFragment);
+ }
+
+ @Override
+ public void onTabReselected(Tab tab, FragmentTransaction ft) {
+ Toast.makeText(ActionBarTabs.this, "Reselected!", Toast.LENGTH_SHORT).show();
+ }
+
+ }
+
+ private class TabContentFragment extends Fragment {
+ private String mText;
+
+ public TabContentFragment(String text) {
+ mText = text;
+ }
+
+ public String getText() {
+ return mText;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View fragView = inflater.inflate(R.layout.action_bar_tab_content, container, false);
+
+ TextView text = (TextView) fragView.findViewById(R.id.text);
+ text.setText(mText);
+
+ return fragView;
+ }
+ }
+}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarUsage.java b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarUsage.java
new file mode 100644
index 000000000..d6152cc5e
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarUsage.java
@@ -0,0 +1,99 @@
+/*
+ * 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 com.example.android.supportv7.app;
+
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.support.v4.view.MenuItemCompat;
+import android.support.v4.widget.SearchViewCompat;
+import android.support.v7.app.ActionBarActivity;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.TextView;
+import android.widget.Toast;
+import com.example.android.supportv7.R;
+
+/**
+ * This demonstrates idiomatic usage of the Action Bar. The default Honeycomb theme
+ * includes the action bar by default and a menu resource is used to populate the
+ * menu data itself. If you'd like to see how these things work under the hood, see
+ * ActionBarMechanics.
+ */
+public class ActionBarUsage extends ActionBarActivity {
+ TextView mSearchText;
+ int mSortMode = -1;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mSearchText = new TextView(this);
+ setContentView(mSearchText);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.actions, menu);
+ View searchView = MenuItemCompat.getActionView(menu.findItem(R.id.action_search));
+ SearchViewCompat.setOnQueryTextListener(searchView, mOnQueryTextListener);
+ return true;
+ }
+
+ @Override
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ if (mSortMode != -1) {
+ Drawable icon = menu.findItem(mSortMode).getIcon();
+ menu.findItem(R.id.action_sort).setIcon(icon);
+ }
+ return super.onPrepareOptionsMenu(menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ Toast.makeText(this, "Selected Item: " + item.getTitle(), Toast.LENGTH_SHORT).show();
+ return true;
+ }
+
+ // This method is specified as an onClick handler in the menu xml and will
+ // take precedence over the Activity's onOptionsItemSelected method.
+ // See res/menu/actions.xml for more info.
+ public void onSort(MenuItem item) {
+ mSortMode = item.getItemId();
+ // Request a call to onPrepareOptionsMenu so we can change the sort icon
+ supportInvalidateOptionsMenu();
+ }
+
+ // The following callbacks are called for the SearchView.OnQueryChangeListener
+ // For more about using SearchView, see src/.../view/SearchView1.java and SearchView2.java
+ private final SearchViewCompat.OnQueryTextListenerCompat mOnQueryTextListener =
+ new SearchViewCompat.OnQueryTextListenerCompat() {
+ @Override
+ public boolean onQueryTextChange(String newText) {
+ newText = newText.isEmpty() ? "" : "Query so far: " + newText;
+ mSearchText.setText(newText);
+ return true;
+ }
+
+ @Override
+ public boolean onQueryTextSubmit(String query) {
+ Toast.makeText(ActionBarUsage.this,
+ "Searching for: " + query + "...", Toast.LENGTH_SHORT).show();
+ return true;
+ }
+ };
+}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/app/_index.html b/samples/Support7Demos/src/com/example/android/supportv7/app/_index.html
new file mode 100644
index 000000000..c316d1bfc
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/app/_index.html
@@ -0,0 +1,33 @@
+
+<p>This section includes samples showing the use of the application
+package features of the static support library.</p>
+<ul>
+ <li><a href="#ActionBar">Action Bar</a></li>
+</ul>
+
+
+<h3 id="ActionBar">Action Bar</h3>
+<dl>
+ <dt><a href="ActionBarMechanics.html">Action Bar Mechanics</a></dt>
+ <dd>Demonstrates the basics of the Action Bar and how it interoperates with the standard options
+menu. This demo is for informative purposes only; see Usage for an example of using the
+Action Bar in a more idiomatic manner.</dd>
+
+ <dt><a href="ActionBarTabs.html">Action Bar Tabs</a></dt>
+ <dd>Demonstrates the use of Action Bar tabs and how they interact with other action bar
+features. Also see the <a href="FragmentTabs.html">Fragment Tabs</a> for a more
+complete example of how to switch between fragments.</dd>
+
+ <dt><a href="ActionBarUsage.html">Action Bar Usage</a></dt>
+ <dd>Demonstrates simple usage of the Action Bar, including a SearchView as an action item. The
+default Honeycomb theme includes the Action Bar by default and a menu resource is used to populate
+the menu data itself. If you'd like to see how these things work under the hood, see
+Mechanics.</dd>
+
+ <dt><a href="ActionBarActionProviderSettingsActivity.html">Settings Action Provider</a></dt>
+ <dd>Shows how to implement an ActionProvider for launching the system settings that supplies a
+ menu item with a specialized action view and handles standard menu item clicks in one place.</dd>
+
+ <dt><a href="ActionBarDisplayOptions.html">Display Options</a></dt>
+ <dd>Shows how various Action Bar display option flags can be combined and their effects.</dd>
+</dl>
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProvider.java b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProvider.java
new file mode 100644
index 000000000..0d5c21d39
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProvider.java
@@ -0,0 +1,262 @@
+/*
+ * Copyright (C) 2013 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.example.android.supportv7.media;
+
+import com.example.android.supportv7.R;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.IntentFilter.MalformedMimeTypeException;
+import android.content.res.Resources;
+import android.media.MediaRouter;
+import android.net.Uri;
+import android.os.Bundle;
+import android.support.v7.media.MediaControlIntent;
+import android.support.v7.media.MediaItemStatus;
+import android.support.v7.media.MediaRouteProvider;
+import android.support.v7.media.MediaRouter.ControlRequestCallback;
+import android.support.v7.media.MediaRouteProviderDescriptor;
+import android.support.v7.media.MediaRouteDescriptor;
+import android.util.Log;
+import android.widget.Toast;
+
+import java.util.ArrayList;
+import java.util.UUID;
+
+/**
+ * Demonstrates how to create a custom media route provider.
+ *
+ * @see SampleMediaRouteProviderService
+ */
+final class SampleMediaRouteProvider extends MediaRouteProvider {
+ private static final String TAG = "SampleMediaRouteProvider";
+
+ private static final String FIXED_VOLUME_ROUTE_ID = "fixed";
+ private static final String VARIABLE_VOLUME_ROUTE_ID = "variable";
+ private static final int VOLUME_MAX = 10;
+
+ /**
+ * A custom media control intent category for special requests that are
+ * supported by this provider's routes.
+ */
+ public static final String CATEGORY_SAMPLE_ROUTE =
+ "com.example.android.supportv7.media.CATEGORY_SAMPLE_ROUTE";
+
+ /**
+ * A custom media control intent action for special requests that are
+ * supported by this provider's routes.
+ * <p>
+ * This particular request is designed to return a bundle of not very
+ * interesting statistics for demonstration purposes.
+ * </p>
+ *
+ * @see #DATA_PLAYBACK_COUNT
+ */
+ public static final String ACTION_GET_STATISTICS =
+ "com.example.android.supportv7.media.ACTION_GET_STATISTICS";
+
+ /**
+ * {@link #ACTION_GET_STATISTICS} result data: Number of times the
+ * playback action was invoked.
+ */
+ public static final String DATA_PLAYBACK_COUNT =
+ "com.example.android.supportv7.media.EXTRA_PLAYBACK_COUNT";
+
+ private static final ArrayList<IntentFilter> CONTROL_FILTERS;
+ static {
+ IntentFilter f1 = new IntentFilter();
+ f1.addCategory(CATEGORY_SAMPLE_ROUTE);
+ f1.addAction(ACTION_GET_STATISTICS);
+
+ IntentFilter f2 = new IntentFilter();
+ f2.addCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK);
+ f2.addAction(MediaControlIntent.ACTION_PLAY);
+ f2.addDataScheme("http");
+ f2.addDataScheme("https");
+ addDataTypeUnchecked(f2, "video/*");
+
+ CONTROL_FILTERS = new ArrayList<IntentFilter>();
+ CONTROL_FILTERS.add(f1);
+ CONTROL_FILTERS.add(f2);
+ }
+
+ private static void addDataTypeUnchecked(IntentFilter filter, String type) {
+ try {
+ filter.addDataType(type);
+ } catch (MalformedMimeTypeException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ private int mVolume = 5;
+ private int mPlaybackCount;
+
+ public SampleMediaRouteProvider(Context context) {
+ super(context);
+
+ publishRoutes();
+ }
+
+ @Override
+ public RouteController onCreateRouteController(String routeId) {
+ return new SampleRouteController(routeId);
+ }
+
+ private void publishRoutes() {
+ Resources r = getContext().getResources();
+
+ MediaRouteDescriptor routeDescriptor1 = new MediaRouteDescriptor.Builder(
+ FIXED_VOLUME_ROUTE_ID,
+ r.getString(R.string.fixed_volume_route_name))
+ .setDescription(r.getString(R.string.sample_route_description))
+ .addControlFilters(CONTROL_FILTERS)
+ .setPlaybackType(MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE)
+ .setVolumeHandling(MediaRouter.RouteInfo.PLAYBACK_VOLUME_FIXED)
+ .setVolume(VOLUME_MAX)
+ .build();
+
+ MediaRouteDescriptor routeDescriptor2 = new MediaRouteDescriptor.Builder(
+ VARIABLE_VOLUME_ROUTE_ID,
+ r.getString(R.string.variable_volume_route_name))
+ .setDescription(r.getString(R.string.sample_route_description))
+ .addControlFilters(CONTROL_FILTERS)
+ .setPlaybackType(MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE)
+ .setVolumeHandling(MediaRouter.RouteInfo.PLAYBACK_VOLUME_VARIABLE)
+ .setVolumeMax(VOLUME_MAX)
+ .setVolume(mVolume)
+ .build();
+
+ MediaRouteProviderDescriptor providerDescriptor =
+ new MediaRouteProviderDescriptor.Builder()
+ .addRoute(routeDescriptor1)
+ .addRoute(routeDescriptor2)
+ .build();
+ setDescriptor(providerDescriptor);
+ }
+
+ private String generateStreamId() {
+ return UUID.randomUUID().toString();
+ }
+
+ private final class SampleRouteController extends MediaRouteProvider.RouteController {
+ private final String mRouteId;
+
+ public SampleRouteController(String routeId) {
+ mRouteId = routeId;
+ Log.d(TAG, mRouteId + ": Controller created");
+ }
+
+ @Override
+ public void onRelease() {
+ Log.d(TAG, mRouteId + ": Controller released");
+ }
+
+ @Override
+ public void onSelect() {
+ Log.d(TAG, mRouteId + ": Selected");
+ }
+
+ @Override
+ public void onUnselect() {
+ Log.d(TAG, mRouteId + ": Unselected");
+ }
+
+ @Override
+ public void onSetVolume(int volume) {
+ Log.d(TAG, mRouteId + ": Set volume to " + volume);
+ if (mRouteId.equals(VARIABLE_VOLUME_ROUTE_ID)) {
+ setVolumeInternal(volume);
+ }
+ }
+
+ @Override
+ public void onUpdateVolume(int delta) {
+ Log.d(TAG, mRouteId + ": Update volume by " + delta);
+ if (mRouteId.equals(VARIABLE_VOLUME_ROUTE_ID)) {
+ setVolumeInternal(mVolume + delta);
+ }
+ }
+
+ private void setVolumeInternal(int volume) {
+ if (volume >= 0 && volume <= VOLUME_MAX) {
+ mVolume = volume;
+ Log.d(TAG, mRouteId + ": New volume is " + mVolume);
+ publishRoutes();
+ }
+ }
+
+ @Override
+ public boolean onControlRequest(Intent intent, ControlRequestCallback callback) {
+ Log.d(TAG, mRouteId + ": Received control request " + intent);
+ if (intent.getAction().equals(MediaControlIntent.ACTION_PLAY)
+ && intent.hasCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)
+ && intent.getData() != null) {
+ mPlaybackCount +=1;
+
+ // TODO: Handle queue ids.
+ Uri uri = intent.getData();
+ long contentPositionMillis = intent.getLongExtra(
+ MediaControlIntent.EXTRA_ITEM_CONTENT_POSITION, 0);
+ Bundle metadata = intent.getBundleExtra(MediaControlIntent.EXTRA_ITEM_METADATA);
+ Bundle headers = intent.getBundleExtra(
+ MediaControlIntent.EXTRA_ITEM_HTTP_HEADERS);
+
+ Log.d(TAG, mRouteId + ": Received play request, uri=" + uri
+ + ", contentPositionMillis=" + contentPositionMillis
+ + ", metadata=" + metadata
+ + ", headers=" + headers);
+
+ if (uri.toString().contains("hats")) {
+ // Simulate generating an error whenever the uri contains the word 'hats'.
+ Toast.makeText(getContext(), "Route rejected play request: uri=" + uri
+ + ", no hats allowed!", Toast.LENGTH_LONG).show();
+ if (callback != null) {
+ callback.onError("Simulated error. No hats allowed!", null);
+ }
+ } else {
+ Toast.makeText(getContext(), "Route received play request: uri=" + uri,
+ Toast.LENGTH_LONG).show();
+ String streamId = generateStreamId();
+ if (callback != null) {
+ MediaItemStatus status = new MediaItemStatus.Builder(
+ MediaItemStatus.PLAYBACK_STATE_PLAYING)
+ .setContentPosition(contentPositionMillis)
+ .build();
+
+ Bundle result = new Bundle();
+ result.putString(MediaControlIntent.EXTRA_ITEM_ID, streamId);
+ result.putBundle(MediaControlIntent.EXTRA_ITEM_STATUS, status.asBundle());
+ callback.onResult(result);
+ }
+ }
+ return true;
+ }
+
+ if (intent.getAction().equals(ACTION_GET_STATISTICS)
+ && intent.hasCategory(CATEGORY_SAMPLE_ROUTE)) {
+ Bundle data = new Bundle();
+ data.putInt(DATA_PLAYBACK_COUNT, mPlaybackCount);
+ if (callback != null) {
+ callback.onResult(data);
+ }
+ return true;
+ }
+ return false;
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProviderService.java b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProviderService.java
new file mode 100644
index 000000000..bb0aa07e2
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProviderService.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2013 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.example.android.supportv7.media;
+
+import android.support.v7.media.MediaRouteProvider;
+import android.support.v7.media.MediaRouteProviderService;
+
+/**
+ * Demonstrates how to register a custom media route provider service
+ * using the support library.
+ *
+ * @see SampleMediaRouteProvider
+ */
+public class SampleMediaRouteProviderService extends MediaRouteProviderService {
+ @Override
+ public MediaRouteProvider onCreateMediaRouteProvider() {
+ return new SampleMediaRouteProvider(this);
+ }
+}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouterActivity.java b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouterActivity.java
new file mode 100644
index 000000000..456bd156f
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouterActivity.java
@@ -0,0 +1,385 @@
+/*
+ * Copyright (C) 2013 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.example.android.supportv7.media;
+
+import com.example.android.supportv7.R;
+
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.view.MenuItemCompat;
+import android.support.v7.app.ActionBarActivity;
+import android.support.v7.app.MediaRouteActionProvider;
+import android.support.v7.app.MediaRouteDiscoveryFragment;
+import android.support.v7.media.MediaControlIntent;
+import android.support.v7.media.MediaRouter;
+import android.support.v7.media.MediaRouter.Callback;
+import android.support.v7.media.MediaRouter.RouteInfo;
+import android.support.v7.media.MediaRouter.ProviderInfo;
+import android.support.v7.media.MediaRouteSelector;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+/**
+ * <h3>Media Router Support Activity</h3>
+ *
+ * <p>
+ * This demonstrates how to use the {@link MediaRouter} API to build an
+ * application that allows the user to send content to various rendering
+ * targets.
+ * </p>
+ */
+public class SampleMediaRouterActivity extends ActionBarActivity {
+ private static final String TAG = "MediaRouterSupport";
+ private static final String DISCOVERY_FRAGMENT_TAG = "DiscoveryFragment";
+
+ private MediaRouter mMediaRouter;
+ private MediaRouteSelector mSelector;
+ private ArrayAdapter<MediaItem> mMediaItems;
+ private TextView mInfoTextView;
+ private ListView mMediaListView;
+ private Button mPlayButton;
+ private Button mStatisticsButton;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ // Be sure to call the super class.
+ super.onCreate(savedInstanceState);
+
+ // Get the media router service.
+ mMediaRouter = MediaRouter.getInstance(this);
+
+ // Create a route selector for the type of routes that we care about.
+ mSelector = new MediaRouteSelector.Builder()
+ .addControlCategory(MediaControlIntent.CATEGORY_LIVE_AUDIO)
+ .addControlCategory(MediaControlIntent.CATEGORY_LIVE_VIDEO)
+ .addControlCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)
+ .addControlCategory(SampleMediaRouteProvider.CATEGORY_SAMPLE_ROUTE)
+ .build();
+
+ // Add a fragment to take care of media route discovery.
+ // This fragment automatically adds or removes a callback whenever the activity
+ // is started or stopped.
+ FragmentManager fm = getSupportFragmentManager();
+ if (fm.findFragmentByTag(DISCOVERY_FRAGMENT_TAG) == null) {
+ DiscoveryFragment fragment = new DiscoveryFragment();
+ fragment.setRouteSelector(mSelector);
+ fm.beginTransaction()
+ .add(fragment, DISCOVERY_FRAGMENT_TAG)
+ .commit();
+ }
+
+ // Populate an array adapter with fake media items.
+ String[] mediaNames = getResources().getStringArray(R.array.media_names);
+ String[] mediaUris = getResources().getStringArray(R.array.media_uris);
+ mMediaItems = new ArrayAdapter<MediaItem>(this,
+ android.R.layout.simple_list_item_single_choice, android.R.id.text1);
+ for (int i = 0; i < mediaNames.length; i++) {
+ mMediaItems.add(new MediaItem(mediaNames[i], Uri.parse(mediaUris[i])));
+ }
+
+ // Initialize the layout.
+ setContentView(R.layout.sample_media_router);
+
+ mInfoTextView = (TextView)findViewById(R.id.info);
+
+ mMediaListView = (ListView)findViewById(R.id.media);
+ mMediaListView.setAdapter(mMediaItems);
+ mMediaListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
+ mMediaListView.setOnItemClickListener(new OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ updateButtons();
+ }
+ });
+
+ mPlayButton = (Button)findViewById(R.id.play_button);
+ mPlayButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ play();
+ }
+ });
+
+ mStatisticsButton = (Button)findViewById(R.id.statistics_button);
+ mStatisticsButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ showStatistics();
+ }
+ });
+ }
+
+ @Override
+ public void onStart() {
+ // Be sure to call the super class.
+ super.onStart();
+
+ updateRouteDescription();
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Be sure to call the super class.
+ super.onCreateOptionsMenu(menu);
+
+ // Inflate the menu and configure the media router action provider.
+ getMenuInflater().inflate(R.menu.sample_media_router_menu, menu);
+
+ MenuItem mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item);
+ MediaRouteActionProvider mediaRouteActionProvider =
+ (MediaRouteActionProvider)MenuItemCompat.getActionProvider(mediaRouteMenuItem);
+ mediaRouteActionProvider.setRouteSelector(mSelector);
+
+ // Return true to show the menu.
+ return true;
+ }
+
+ private void updateRouteDescription() {
+ RouteInfo route = mMediaRouter.getSelectedRoute();
+ mInfoTextView.setText("Currently selected route: " + route.getName()
+ + " from provider " + route.getProvider().getPackageName()
+ + ", description: " + route.getDescription());
+ updateButtons();
+ }
+
+ private void updateButtons() {
+ MediaRouter.RouteInfo route = mMediaRouter.getSelectedRoute();
+
+ MediaItem item = getCheckedMediaItem();
+ if (item != null) {
+ mPlayButton.setEnabled(route.supportsControlRequest(makePlayIntent(item)));
+ } else {
+ mPlayButton.setEnabled(false);
+ }
+
+ mStatisticsButton.setEnabled(route.supportsControlRequest(makeStatisticsIntent()));
+ }
+
+ private void play() {
+ final MediaItem item = getCheckedMediaItem();
+ if (item == null) {
+ return;
+ }
+
+ MediaRouter.RouteInfo route = mMediaRouter.getSelectedRoute();
+ Intent intent = makePlayIntent(item);
+ if (route.supportsControlRequest(intent)) {
+ MediaRouter.ControlRequestCallback callback =
+ new MediaRouter.ControlRequestCallback() {
+ @Override
+ public void onResult(Bundle data) {
+ String streamId = data != null ? data.getString(
+ MediaControlIntent.EXTRA_ITEM_ID) : null;
+
+ Log.d(TAG, "Play request succeeded: data=" + data + " , streamId=" + streamId);
+ Toast.makeText(SampleMediaRouterActivity.this,
+ "Now playing " + item.mName,
+ Toast.LENGTH_LONG).show();
+ }
+
+ @Override
+ public void onError(String error, Bundle data) {
+ Log.d(TAG, "Play request failed: error=" + error + ", data=" + data);
+ Toast.makeText(SampleMediaRouterActivity.this,
+ "Unable to play " + item.mName + ", error: " + error,
+ Toast.LENGTH_LONG).show();
+ }
+ };
+
+ Log.d(TAG, "Sending play request: intent=" + intent);
+ route.sendControlRequest(intent, callback);
+ } else {
+ Log.d(TAG, "Play request not supported: intent=" + intent);
+ Toast.makeText(SampleMediaRouterActivity.this,
+ "Play not supported for " + item.mName, Toast.LENGTH_LONG).show();
+ }
+ }
+
+ private void showStatistics() {
+ MediaRouter.RouteInfo route = mMediaRouter.getSelectedRoute();
+ Intent intent = makeStatisticsIntent();
+ if (route.supportsControlRequest(intent)) {
+ MediaRouter.ControlRequestCallback callback = new MediaRouter.ControlRequestCallback() {
+ @Override
+ public void onResult(Bundle data) {
+ Log.d(TAG, "Statistics request succeeded: data=" + data);
+ if (data != null) {
+ int playbackCount = data.getInt(
+ SampleMediaRouteProvider.DATA_PLAYBACK_COUNT, -1);
+ Toast.makeText(SampleMediaRouterActivity.this,
+ "Total playback count: " + playbackCount,
+ Toast.LENGTH_LONG).show();
+ } else {
+ Toast.makeText(SampleMediaRouterActivity.this,
+ "Statistics query did not return any data",
+ Toast.LENGTH_LONG).show();
+ }
+ }
+
+ @Override
+ public void onError(String error, Bundle data) {
+ Log.d(TAG, "Statistics request failed: error=" + error + ", data=" + data);
+ Toast.makeText(SampleMediaRouterActivity.this,
+ "Unable to query statistics, error: " + error,
+ Toast.LENGTH_LONG).show();
+ }
+ };
+
+ Log.d(TAG, "Sent statistics request: intent=" + intent);
+ route.sendControlRequest(intent, callback);
+ } else {
+ Log.d(TAG, "Statistics request not supported: intent=" + intent);
+ Toast.makeText(SampleMediaRouterActivity.this,
+ "Statistics not supported.", Toast.LENGTH_LONG).show();
+ }
+ }
+
+ private Intent makePlayIntent(MediaItem item) {
+ Intent intent = new Intent(MediaControlIntent.ACTION_PLAY);
+ intent.addCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK);
+ intent.setDataAndType(item.mUri, "video/mp4");
+ return intent;
+ }
+
+ private Intent makeStatisticsIntent() {
+ Intent intent = new Intent(SampleMediaRouteProvider.ACTION_GET_STATISTICS);
+ intent.addCategory(SampleMediaRouteProvider.CATEGORY_SAMPLE_ROUTE);
+ return intent;
+ }
+
+ private MediaItem getCheckedMediaItem() {
+ int index = mMediaListView.getCheckedItemPosition();
+ if (index >= 0 && index < mMediaItems.getCount()) {
+ return mMediaItems.getItem(index);
+ }
+ return null;
+ }
+
+ private final class DiscoveryFragment extends MediaRouteDiscoveryFragment {
+ @Override
+ public Callback onCreateCallback() {
+ // Return a custom callback that will simply log all of the route events
+ // for demonstration purposes.
+ return new MediaRouter.Callback() {
+ @Override
+ public void onRouteAdded(MediaRouter router, RouteInfo route) {
+ Log.d(TAG, "onRouteAdded: route=" + route);
+ }
+
+ @Override
+ public void onRouteChanged(MediaRouter router, RouteInfo route) {
+ Log.d(TAG, "onRouteChanged: route=" + route);
+ updateRouteDescription();
+ }
+
+ @Override
+ public void onRouteRemoved(MediaRouter router, RouteInfo route) {
+ Log.d(TAG, "onRouteRemoved: route=" + route);
+ }
+
+ @Override
+ public void onRouteSelected(MediaRouter router, RouteInfo route) {
+ Log.d(TAG, "onRouteSelected: route=" + route);
+ updateRouteDescription();
+ }
+
+ @Override
+ public void onRouteUnselected(MediaRouter router, RouteInfo route) {
+ Log.d(TAG, "onRouteUnselected: route=" + route);
+ updateRouteDescription();
+ }
+
+ @Override
+ public void onRouteVolumeChanged(MediaRouter router, RouteInfo route) {
+ Log.d(TAG, "onRouteVolumeChanged: route=" + route);
+ }
+
+ @Override
+ public void onRoutePresentationDisplayChanged(
+ MediaRouter router, RouteInfo route) {
+ Log.d(TAG, "onRoutePresentationDisplayChanged: route=" + route);
+ }
+
+ @Override
+ public void onProviderAdded(MediaRouter router, ProviderInfo provider) {
+ Log.d(TAG, "onRouteProviderAdded: provider=" + provider);
+ }
+
+ @Override
+ public void onProviderRemoved(MediaRouter router, ProviderInfo provider) {
+ Log.d(TAG, "onRouteProviderRemoved: provider=" + provider);
+ }
+
+ @Override
+ public void onProviderChanged(MediaRouter router, ProviderInfo provider) {
+ Log.d(TAG, "onRouteProviderChanged: provider=" + provider);
+ }
+ };
+ }
+
+ @Override
+ public int onPrepareCallbackFlags() {
+ // Add the CALLBACK_FLAG_UNFILTERED_EVENTS flag to ensure that we will
+ // observe and log all route events including those that are for routes
+ // that do not match our selector. This is only for demonstration purposes
+ // and should not be needed by most applications.
+ return super.onPrepareCallbackFlags()
+ | MediaRouter.CALLBACK_FLAG_UNFILTERED_EVENTS;
+ }
+ }
+
+ private static final class MediaItem {
+ public final String mName;
+ public final Uri mUri;
+
+ public MediaItem(String name, Uri uri) {
+ mName = name;
+ mUri = uri;
+ }
+
+ @Override
+ public String toString() {
+ return mName;
+ }
+ }
+
+ /**
+ * Trivial subclass of this activity used to provide another copy of the
+ * same activity using a light theme instead of the dark theme.
+ */
+ public static class Light extends SampleMediaRouterActivity {
+ }
+
+ /**
+ * Trivial subclass of this activity used to provide another copy of the
+ * same activity using a light theme with dark action bar instead of the dark theme.
+ */
+ public static class LightWithDarkActionBar extends SampleMediaRouterActivity {
+ }
+}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/media/_index.html b/samples/Support7Demos/src/com/example/android/supportv7/media/_index.html
new file mode 100644
index 000000000..0802cae76
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/media/_index.html
@@ -0,0 +1,23 @@
+
+<p>This section includes samples showing the use of the application
+package features of the static support library.</p>
+<ul>
+ <li><a href="#MediaRouter">Media Router</a></li>
+</ul>
+
+
+<h3 id="MediaRouter">Media Router</h3>
+<dl>
+ <dt><a href="SampleMediaRouteProvider.html">Media Route Provider</a></dt>
+ <dd>Demonstrates how to implement a MediaRouteProvider to discover,
+ publish and control custom media routes.</dd>
+
+ <dt><a href="SampleMediaRouteProviderService.html">Media Route Provider Service</a></dt>
+ <dd>Demonstrates how to make a MediaRouteProvider available to all
+ running applications by registering it as a service.</dd>
+
+ <dt><a href="SampleMediaRouterActivity.html">Media Router Activity</a></dt>
+ <dd>Demonstrates how to use MediaRouter within an Activity to support
+ remote media playback.</dd>
+</dl>
+ \ No newline at end of file
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/view/GridLayout1.java b/samples/Support7Demos/src/com/example/android/supportv7/view/GridLayout1.java
new file mode 100644
index 000000000..6b27a2d43
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/view/GridLayout1.java
@@ -0,0 +1,34 @@
+/*
+ * 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.example.android.supportv7.view;
+
+import com.example.android.supportv7.R;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+/**
+ * Demonstrates using GridLayout to build the same "Simple Form" as in the
+ * LinearLayout and RelativeLayout demos.
+ */
+public class GridLayout1 extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.grid_layout_1);
+ }
+}
diff --git a/tools/emulator/system/libqemu/test_util.h b/samples/Support7Demos/src/com/example/android/supportv7/view/GridLayout2.java
index 28e5115c0..86258aabc 100644
--- a/tools/emulator/system/libqemu/test_util.h
+++ b/samples/Support7Demos/src/com/example/android/supportv7/view/GridLayout2.java
@@ -13,23 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef TEST_UTIL_H
-#define TEST_UTIL_H
-#include <stddef.h>
-#include <hardware/qemu_pipe.h>
+package com.example.android.supportv7.view;
+import com.example.android.supportv7.R;
-double now_secs(void);
+import android.app.Activity;
+import android.os.Bundle;
-typedef struct {
- int socket;
-} Pipe;
-
-int pipe_openSocket( Pipe* pipe, int port );
-int pipe_openQemuPipe( Pipe* pipe, const char* pipename );
-int pipe_send( Pipe* pipe, const void* buff, size_t bufflen );
-int pipe_recv( Pipe* pipe, void* buff, size_t bufflen );
-void pipe_close( Pipe* pipe );
-
-#endif /* TEST_UTIL_H */
+/**
+ * A form, showing use of the GridLayout API from XML.
+ */
+public class GridLayout2 extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.grid_layout_2);
+ }
+}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/view/GridLayout3.java b/samples/Support7Demos/src/com/example/android/supportv7/view/GridLayout3.java
new file mode 100644
index 000000000..71dffe5a1
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/view/GridLayout3.java
@@ -0,0 +1,129 @@
+/*
+ * 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.example.android.supportv7.view;
+
+import static android.support.v7.widget.GridLayout.ALIGN_BOUNDS;
+import static android.support.v7.widget.GridLayout.BASELINE;
+import static android.support.v7.widget.GridLayout.CENTER;
+import static android.support.v7.widget.GridLayout.FILL;
+import static android.support.v7.widget.GridLayout.LEFT;
+import static android.support.v7.widget.GridLayout.RIGHT;
+import static android.support.v7.widget.GridLayout.spec;
+import static android.text.InputType.TYPE_CLASS_TEXT;
+import static android.text.InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
+import static android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.support.v7.widget.GridLayout;
+import android.support.v7.widget.GridLayout.LayoutParams;
+import android.support.v7.widget.GridLayout.Spec;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.TextView;
+
+/**
+ * A form, showing use of the GridLayout API. Here we demonstrate use of the row/column order
+ * preserved property which allows rows and or columns to pass over each other when needed.
+ * The two buttons in the bottom right corner need to be separated from the other UI elements.
+ * This can either be done by separating rows or separating columns - but we don't need
+ * to do both and may only have enough space to do one or the other.
+ */
+public class GridLayout3 extends Activity {
+ public static View create(Context context) {
+ GridLayout p = new GridLayout(context);
+ p.setUseDefaultMargins(true);
+ p.setAlignmentMode(ALIGN_BOUNDS);
+ Configuration configuration = context.getResources().getConfiguration();
+ if ((configuration.orientation == Configuration.ORIENTATION_PORTRAIT)) {
+ p.setColumnOrderPreserved(false);
+ } else {
+ p.setRowOrderPreserved(false);
+ }
+
+ Spec titleRow = spec(0);
+ Spec introRow = spec(1);
+ Spec emailRow = spec(2, BASELINE);
+ Spec passwordRow = spec(3, BASELINE);
+ Spec button1Row = spec(5);
+ Spec button2Row = spec(6);
+
+ Spec centerInAllColumns = spec(0, 4, CENTER);
+ Spec leftAlignInAllColumns = spec(0, 4, LEFT);
+ Spec labelColumn = spec(0, RIGHT);
+ Spec fieldColumn = spec(1, LEFT);
+ Spec defineLastColumn = spec(3);
+ Spec fillLastColumn = spec(3, FILL);
+
+ {
+ TextView c = new TextView(context);
+ c.setTextSize(32);
+ c.setText("Email setup");
+ p.addView(c, new LayoutParams(titleRow, centerInAllColumns));
+ }
+ {
+ TextView c = new TextView(context);
+ c.setTextSize(16);
+ c.setText("You can configure email in a few simple steps:");
+ p.addView(c, new LayoutParams(introRow, leftAlignInAllColumns));
+ }
+ {
+ TextView c = new TextView(context);
+ c.setText("Email address:");
+ p.addView(c, new LayoutParams(emailRow, labelColumn));
+ }
+ {
+ EditText c = new EditText(context);
+ c.setEms(10);
+ c.setInputType(TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
+ p.addView(c, new LayoutParams(emailRow, fieldColumn));
+ }
+ {
+ TextView c = new TextView(context);
+ c.setText("Password:");
+ p.addView(c, new LayoutParams(passwordRow, labelColumn));
+ }
+ {
+ EditText c = new EditText(context);
+ c.setEms(8);
+ c.setInputType(TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_PASSWORD);
+ p.addView(c, new LayoutParams(passwordRow, fieldColumn));
+ }
+ {
+ Button c = new Button(context);
+ c.setText("Manual setup");
+ p.addView(c, new LayoutParams(button1Row, defineLastColumn));
+ }
+ {
+ Button c = new Button(context);
+ c.setText("Next");
+ p.addView(c, new LayoutParams(button2Row, fillLastColumn));
+ }
+
+ return p;
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(create(this));
+ }
+
+} \ No newline at end of file
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/view/_index.html b/samples/Support7Demos/src/com/example/android/supportv7/view/_index.html
new file mode 100644
index 000000000..072967a1a
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/view/_index.html
@@ -0,0 +1,22 @@
+
+<p>This section includes samples showing the use of the view
+package features of the static support library.</p>
+<ul>
+ <li><a href="#GridLayout">Grid Layout</a></li>
+</ul>
+
+
+<h3 id="GridLayout">Grid Layout</h3>
+<dl>
+ <dt><a href="GridLayout1.html">Grid Layout Simple Form</a></dt>
+ <dd>Demonstrates how to use GridLayout to create a simple data entry form.</dd>
+
+ <dt><a href="GridLayout2.html">Grid Layout Form (XML)</a></dt>
+ <dd>Demonstrates how to use GridLayout to create a more complex
+ data entry form using XML layout resources.</dd>
+
+ <dt><a href="GridLayout3.html">Grid Layout Form (Java)</a></dt>
+ <dd>Demonstrates how to use GridLayout to create a more complex
+ data entry form programmatically.</dd>
+</dl>
+ \ No newline at end of file
diff --git a/samples/devbytes/animation/ActivityAnimations/AndroidManifest.xml b/samples/devbytes/animation/ActivityAnimations/AndroidManifest.xml
new file mode 100644
index 000000000..eeb53781e
--- /dev/null
+++ b/samples/devbytes/animation/ActivityAnimations/AndroidManifest.xml
@@ -0,0 +1,45 @@
+<!-- Copyright (C) 2013 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.activityanim"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="16"
+ android:targetSdkVersion="17" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name="com.example.android.activityanim.ActivityAnimations"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity
+ android:name="com.example.android.activityanim.PictureDetailsActivity"
+ android:label="@string/subactivity_name"
+ android:theme="@style/Transparent" >
+ </activity>
+ </application>
+
+</manifest> \ No newline at end of file
diff --git a/samples/devbytes/animation/ActivityAnimations/res/drawable-hdpi/ic_launcher.png b/samples/devbytes/animation/ActivityAnimations/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..96a442e5b
--- /dev/null
+++ b/samples/devbytes/animation/ActivityAnimations/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/ActivityAnimations/res/drawable-mdpi/ic_launcher.png b/samples/devbytes/animation/ActivityAnimations/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..359047dfa
--- /dev/null
+++ b/samples/devbytes/animation/ActivityAnimations/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p1.jpg b/samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p1.jpg
new file mode 100644
index 000000000..974581894
--- /dev/null
+++ b/samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p1.jpg
Binary files differ
diff --git a/samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p2.jpg b/samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p2.jpg
new file mode 100644
index 000000000..db8731f01
--- /dev/null
+++ b/samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p2.jpg
Binary files differ
diff --git a/samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p3.jpg b/samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p3.jpg
new file mode 100644
index 000000000..b240b3a02
--- /dev/null
+++ b/samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p3.jpg
Binary files differ
diff --git a/samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p4.jpg b/samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p4.jpg
new file mode 100644
index 000000000..4de929221
--- /dev/null
+++ b/samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p4.jpg
Binary files differ
diff --git a/samples/devbytes/animation/ActivityAnimations/res/drawable-xhdpi/ic_launcher.png b/samples/devbytes/animation/ActivityAnimations/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..71c6d760f
--- /dev/null
+++ b/samples/devbytes/animation/ActivityAnimations/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/ActivityAnimations/res/layout/activity_animations.xml b/samples/devbytes/animation/ActivityAnimations/res/layout/activity_animations.xml
new file mode 100644
index 000000000..c11a568e7
--- /dev/null
+++ b/samples/devbytes/animation/ActivityAnimations/res/layout/activity_animations.xml
@@ -0,0 +1,21 @@
+<!-- Copyright (C) 2013 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.
+-->
+<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_gravity="center_horizontal"
+ android:id="@+id/gridLayout" >
+
+</GridLayout> \ No newline at end of file
diff --git a/samples/devbytes/animation/ActivityAnimations/res/layout/picture_info.xml b/samples/devbytes/animation/ActivityAnimations/res/layout/picture_info.xml
new file mode 100644
index 000000000..cb2ced229
--- /dev/null
+++ b/samples/devbytes/animation/ActivityAnimations/res/layout/picture_info.xml
@@ -0,0 +1,41 @@
+<!-- Copyright (C) 2013 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.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/topLevelLayout">
+
+ <view
+ class="com.example.android.activityanim.ShadowLayout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/shadowLayout"
+ android:visibility="visible" >
+
+ <TextView
+ android:id="@+id/description"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/imageView" />
+ <ImageView
+ android:id="@+id/imageView"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_centerInParent="true"
+ android:scaleType="centerInside" />
+
+
+ </view>
+</FrameLayout> \ No newline at end of file
diff --git a/samples/devbytes/animation/ActivityAnimations/res/menu/activity_better_window_animations.xml b/samples/devbytes/animation/ActivityAnimations/res/menu/activity_better_window_animations.xml
new file mode 100644
index 000000000..aab540e09
--- /dev/null
+++ b/samples/devbytes/animation/ActivityAnimations/res/menu/activity_better_window_animations.xml
@@ -0,0 +1,24 @@
+<!-- Copyright (C) 2013 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.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <item
+ android:id="@+id/menu_slow"
+ android:orderInCategory="100"
+ android:showAsAction="never"
+ android:title="@string/menu_slow_animations"
+ android:checkable="true"/>
+
+</menu> \ No newline at end of file
diff --git a/samples/devbytes/animation/ActivityAnimations/res/values/strings.xml b/samples/devbytes/animation/ActivityAnimations/res/values/strings.xml
new file mode 100644
index 000000000..f9409b551
--- /dev/null
+++ b/samples/devbytes/animation/ActivityAnimations/res/values/strings.xml
@@ -0,0 +1,21 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <string name="app_name">Activity Animations</string>
+ <string name="subactivity_name">PictureInfo!</string>
+ <string name="menu_slow_animations">Slow</string>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/ActivityAnimations/res/values/styles.xml b/samples/devbytes/animation/ActivityAnimations/res/values/styles.xml
new file mode 100644
index 000000000..9d8334244
--- /dev/null
+++ b/samples/devbytes/animation/ActivityAnimations/res/values/styles.xml
@@ -0,0 +1,39 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <!--
+ Base application theme, dependent on API level. This theme is replaced
+ by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
+ <!--
+ Theme customizations available in newer API levels can go in
+ res/values-vXX/styles.xml, while customizations related to
+ backward-compatibility can go here.
+ -->
+ </style>
+
+ <!-- Application theme. -->
+ <style name="AppTheme" parent="AppBaseTheme">
+ <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+ </style>
+
+ <style name="Transparent">
+ <item name="android:windowNoTitle">true</item>
+ <item name="android:windowIsTranslucent">true</item>
+ <item name="android:windowBackground">@android:color/transparent</item>
+ </style>
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/ActivityAnimations.java b/samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/ActivityAnimations.java
new file mode 100644
index 000000000..4a3e0d95b
--- /dev/null
+++ b/samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/ActivityAnimations.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2013 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.example.android.activityanim;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.res.Resources;
+import android.graphics.ColorMatrix;
+import android.graphics.ColorMatrixColorFilter;
+import android.graphics.drawable.BitmapDrawable;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.GridLayout;
+import android.widget.ImageView;
+
+/**
+ * This example shows how to create a custom activity animation when you want something more
+ * than window animations can provide. The idea is to disable window animations for the
+ * activities and to instead launch or return from the sub-activity immediately, but use
+ * property animations inside the activities to customize the transition.
+ *
+ * Watch the associated video for this demo on the DevBytes channel of developer.android.com
+ * or on the DevBytes playlist in the androiddevelopers channel on YouTube at
+ * https://www.youtube.com/playlist?list=PLWz5rJ2EKKc_XOgcRukSoKKjewFJZrKV0.
+ */
+public class ActivityAnimations extends Activity {
+
+ private static final String PACKAGE = "com.example.android.activityanim";
+ static float sAnimatorScale = 1;
+
+ GridLayout mGridLayout;
+ HashMap<ImageView, PictureData> mPicturesData = new HashMap<ImageView, PictureData>();
+ BitmapUtils mBitmapUtils = new BitmapUtils();
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_animations);
+
+ // Grayscale filter used on all thumbnails
+ ColorMatrix grayMatrix = new ColorMatrix();
+ grayMatrix.setSaturation(0);
+ ColorMatrixColorFilter grayscaleFilter = new ColorMatrixColorFilter(grayMatrix);
+
+ mGridLayout = (GridLayout) findViewById(R.id.gridLayout);
+ mGridLayout.setColumnCount(3);
+ mGridLayout.setUseDefaultMargins(true);
+
+ // add all photo thumbnails to layout
+ Resources resources = getResources();
+ ArrayList<PictureData> pictures = mBitmapUtils.loadPhotos(resources);
+ for (int i = 0; i < pictures.size(); ++i) {
+ PictureData pictureData = pictures.get(i);
+ BitmapDrawable thumbnailDrawable =
+ new BitmapDrawable(resources, pictureData.thumbnail);
+ thumbnailDrawable.setColorFilter(grayscaleFilter);
+ ImageView imageView = new ImageView(this);
+ imageView.setOnClickListener(thumbnailClickListener);
+ imageView.setImageDrawable(thumbnailDrawable);
+ mPicturesData.put(imageView, pictureData);
+ mGridLayout.addView(imageView);
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.activity_better_window_animations, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == R.id.menu_slow) {
+ sAnimatorScale = item.isChecked() ? 1 : 5;
+ item.setChecked(!item.isChecked());
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ /**
+ * When the user clicks a thumbnail, bundle up information about it and launch the
+ * details activity.
+ */
+ private View.OnClickListener thumbnailClickListener = new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ // Interesting data to pass across are the thumbnail size/location, the
+ // resourceId of the source bitmap, the picture description, and the
+ // orientation (to avoid returning back to an obsolete configuration if
+ // the device rotates again in the meantime)
+ int[] screenLocation = new int[2];
+ v.getLocationOnScreen(screenLocation);
+ PictureData info = mPicturesData.get(v);
+ Intent subActivity = new Intent(ActivityAnimations.this,
+ PictureDetailsActivity.class);
+ int orientation = getResources().getConfiguration().orientation;
+ subActivity.
+ putExtra(PACKAGE + ".orientation", orientation).
+ putExtra(PACKAGE + ".resourceId", info.resourceId).
+ putExtra(PACKAGE + ".left", screenLocation[0]).
+ putExtra(PACKAGE + ".top", screenLocation[1]).
+ putExtra(PACKAGE + ".width", v.getWidth()).
+ putExtra(PACKAGE + ".height", v.getHeight()).
+ putExtra(PACKAGE + ".description", info.description);
+ startActivity(subActivity);
+
+ // Override transitions: we don't want the normal window animation in addition
+ // to our custom one
+ overridePendingTransition(0, 0);
+ }
+ };
+
+}
diff --git a/samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/BitmapUtils.java b/samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/BitmapUtils.java
new file mode 100644
index 000000000..a8034dce4
--- /dev/null
+++ b/samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/BitmapUtils.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2013 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.example.android.activityanim;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.drawable.BitmapDrawable;
+import android.widget.ImageView;
+
+public class BitmapUtils {
+
+ int[] mPhotos = {
+ R.drawable.p1,
+ R.drawable.p2,
+ R.drawable.p3,
+ R.drawable.p4
+ };
+
+ String[] mDescriptions = {
+ "This picture was taken while sunbathing in a natural hot spring, which was " +
+ "unfortunately filled with acid, which is a lasting memory from that trip, whenever I " +
+ "I look at my own skin.",
+ "I took this shot with a pinhole camera mounted on a tripod constructed out of " +
+ "soda straws. I felt that that combination best captured the beauty of the landscape " +
+ "in juxtaposition with the detritus of mankind.",
+ "I don't remember where or when I took this picture. All I know is that I was really " +
+ "drunk at the time, and I woke up without my left sock.",
+ "Right before I took this picture, there was a busload of school children right " +
+ "in my way. I knew the perfect shot was coming, so I quickly yelled 'Free candy!!!' " +
+ "and they scattered.",
+ };
+
+ static HashMap<Integer, Bitmap> sBitmapResourceMap = new HashMap<Integer, Bitmap>();
+
+ /**
+ * Load pictures and descriptions. A real app wouldn't do it this way, but that's
+ * not the point of this animation demo. Loading asynchronously is a better way to go
+ * for what can be time-consuming operations.
+ */
+ public ArrayList<PictureData> loadPhotos(Resources resources) {
+ ArrayList<PictureData> pictures = new ArrayList<PictureData>();
+ for (int i = 0; i < 30; ++i) {
+ int resourceId = mPhotos[(int) (Math.random() * mPhotos.length)];
+ Bitmap bitmap = getBitmap(resources, resourceId);
+ Bitmap thumbnail = getThumbnail(bitmap, 200);
+ String description = mDescriptions[(int) (Math.random() * mDescriptions.length)];
+ pictures.add(new PictureData(resourceId, description, thumbnail));
+ }
+ return pictures;
+ }
+
+ /**
+ * Utility method to get bitmap from cache or, if not there, load it
+ * from its resource.
+ */
+ static Bitmap getBitmap(Resources resources, int resourceId) {
+ Bitmap bitmap = sBitmapResourceMap.get(resourceId);
+ if (bitmap == null) {
+ bitmap = BitmapFactory.decodeResource(resources, resourceId);
+ sBitmapResourceMap.put(resourceId, bitmap);
+ }
+ return bitmap;
+ }
+
+ /**
+ * Create and return a thumbnail image given the original source bitmap and a max
+ * dimension (width or height).
+ */
+ private Bitmap getThumbnail(Bitmap original, int maxDimension) {
+ int width = original.getWidth();
+ int height = original.getHeight();
+ int scaledWidth, scaledHeight;
+ if (width >= height) {
+ float scaleFactor = (float) maxDimension / width;
+ scaledWidth = 200;
+ scaledHeight = (int) (scaleFactor * height);
+ } else {
+ float scaleFactor = (float) maxDimension / height;
+ scaledWidth = (int) (scaleFactor * width);
+ scaledHeight = 200;
+ }
+ Bitmap thumbnail = Bitmap.createScaledBitmap(original, scaledWidth, scaledHeight, true);
+
+ return thumbnail;
+ }
+
+
+}
diff --git a/ndk/sources/android/libportable/arch-arm/socket.c b/samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/PictureData.java
index 7e7ca9b38..eb2d1264a 100644
--- a/ndk/sources/android/libportable/arch-arm/socket.c
+++ b/samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/PictureData.java
@@ -1,11 +1,11 @@
/*
- * Copyright 2012, The Android Open Source Project
+ * Copyright (C) 2013 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
+ * 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,
@@ -14,10 +14,18 @@
* limitations under the License.
*/
-#include <unistd.h>
-#include <sys/socket.h>
-#include <sys/linux-syscalls.h>
+package com.example.android.activityanim;
-int socket_portable(int domain, int type, int protocol) {
- return socket(domain, type, protocol);
+import android.graphics.Bitmap;
+
+public class PictureData {
+ int resourceId;
+ String description;
+ Bitmap thumbnail;
+
+ public PictureData(int resourceId, String description, Bitmap thumbnail) {
+ this.resourceId = resourceId;
+ this.description = description;
+ this.thumbnail = thumbnail;
+ }
}
diff --git a/samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/PictureDetailsActivity.java b/samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/PictureDetailsActivity.java
new file mode 100644
index 000000000..e1674c91e
--- /dev/null
+++ b/samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/PictureDetailsActivity.java
@@ -0,0 +1,280 @@
+/*
+ * Copyright (C) 2013 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.example.android.activityanim;
+
+import android.animation.ObjectAnimator;
+import android.animation.TimeInterpolator;
+import android.app.Activity;
+import android.graphics.Bitmap;
+import android.graphics.Color;
+import android.graphics.ColorMatrix;
+import android.graphics.ColorMatrixColorFilter;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.ColorDrawable;
+import android.os.Bundle;
+import android.view.View;
+import android.view.ViewTreeObserver;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.DecelerateInterpolator;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+/**
+ * This sub-activity shows a zoomed-in view of a specific photo, along with the
+ * picture's text description. Most of the logic is for the animations that will
+ * be run when the activity is being launched and exited. When launching,
+ * the large version of the picture will resize from the thumbnail version in the
+ * main activity, colorizing it from the thumbnail's grayscale version at the
+ * same time. Meanwhile, the black background of the activity will fade in and
+ * the description will eventually slide into place. The exit animation runs all
+ * of this in reverse.
+ *
+ */
+public class PictureDetailsActivity extends Activity {
+
+ private static final TimeInterpolator sDecelerator = new DecelerateInterpolator();
+ private static final TimeInterpolator sAccelerator = new AccelerateInterpolator();
+ private static final String PACKAGE_NAME = "com.example.android.activityanim";
+ private static final int ANIM_DURATION = 500;
+
+ private BitmapDrawable mBitmapDrawable;
+ private ColorMatrix colorizerMatrix = new ColorMatrix();
+ ColorDrawable mBackground;
+ int mLeftDelta;
+ int mTopDelta;
+ float mWidthScale;
+ float mHeightScale;
+ private ImageView mImageView;
+ private TextView mTextView;
+ private FrameLayout mTopLevelLayout;
+ private ShadowLayout mShadowLayout;
+ private int mOriginalOrientation;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.picture_info);
+ mImageView = (ImageView) findViewById(R.id.imageView);
+ mTopLevelLayout = (FrameLayout) findViewById(R.id.topLevelLayout);
+ mShadowLayout = (ShadowLayout) findViewById(R.id.shadowLayout);
+ mTextView = (TextView) findViewById(R.id.description);
+
+ // Retrieve the data we need for the picture/description to display and
+ // the thumbnail to animate it from
+ Bundle bundle = getIntent().getExtras();
+ Bitmap bitmap = BitmapUtils.getBitmap(getResources(),
+ bundle.getInt(PACKAGE_NAME + ".resourceId"));
+ String description = bundle.getString(PACKAGE_NAME + ".description");
+ final int thumbnailTop = bundle.getInt(PACKAGE_NAME + ".top");
+ final int thumbnailLeft = bundle.getInt(PACKAGE_NAME + ".left");
+ final int thumbnailWidth = bundle.getInt(PACKAGE_NAME + ".width");
+ final int thumbnailHeight = bundle.getInt(PACKAGE_NAME + ".height");
+ mOriginalOrientation = bundle.getInt(PACKAGE_NAME + ".orientation");
+
+ mBitmapDrawable = new BitmapDrawable(getResources(), bitmap);
+ mImageView.setImageDrawable(mBitmapDrawable);
+ mTextView.setText(description);
+
+ mBackground = new ColorDrawable(Color.BLACK);
+ mTopLevelLayout.setBackground(mBackground);
+
+ // Only run the animation if we're coming from the parent activity, not if
+ // we're recreated automatically by the window manager (e.g., device rotation)
+ if (savedInstanceState == null) {
+ ViewTreeObserver observer = mImageView.getViewTreeObserver();
+ observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
+
+ @Override
+ public boolean onPreDraw() {
+ mImageView.getViewTreeObserver().removeOnPreDrawListener(this);
+
+ // Figure out where the thumbnail and full size versions are, relative
+ // to the screen and each other
+ int[] screenLocation = new int[2];
+ mImageView.getLocationOnScreen(screenLocation);
+ mLeftDelta = thumbnailLeft - screenLocation[0];
+ mTopDelta = thumbnailTop - screenLocation[1];
+
+ // Scale factors to make the large version the same size as the thumbnail
+ mWidthScale = (float) thumbnailWidth / mImageView.getWidth();
+ mHeightScale = (float) thumbnailHeight / mImageView.getHeight();
+
+ runEnterAnimation();
+
+ return true;
+ }
+ });
+ }
+ }
+
+ /**
+ * The enter animation scales the picture in from its previous thumbnail
+ * size/location, colorizing it in parallel. In parallel, the background of the
+ * activity is fading in. When the pictue is in place, the text description
+ * drops down.
+ */
+ public void runEnterAnimation() {
+ final long duration = (long) (ANIM_DURATION * ActivityAnimations.sAnimatorScale);
+
+ // Set starting values for properties we're going to animate. These
+ // values scale and position the full size version down to the thumbnail
+ // size/location, from which we'll animate it back up
+ mImageView.setPivotX(0);
+ mImageView.setPivotY(0);
+ mImageView.setScaleX(mWidthScale);
+ mImageView.setScaleY(mHeightScale);
+ mImageView.setTranslationX(mLeftDelta);
+ mImageView.setTranslationY(mTopDelta);
+
+ // We'll fade the text in later
+ mTextView.setAlpha(0);
+
+ // Animate scale and translation to go from thumbnail to full size
+ mImageView.animate().setDuration(duration).
+ scaleX(1).scaleY(1).
+ translationX(0).translationY(0).
+ setInterpolator(sDecelerator).
+ withEndAction(new Runnable() {
+ public void run() {
+ // Animate the description in after the image animation
+ // is done. Slide and fade the text in from underneath
+ // the picture.
+ mTextView.setTranslationY(-mTextView.getHeight());
+ mTextView.animate().setDuration(duration/2).
+ translationY(0).alpha(1).
+ setInterpolator(sDecelerator);
+ }
+ });
+
+ // Fade in the black background
+ ObjectAnimator bgAnim = ObjectAnimator.ofInt(mBackground, "alpha", 0, 255);
+ bgAnim.setDuration(duration);
+ bgAnim.start();
+
+ // Animate a color filter to take the image from grayscale to full color.
+ // This happens in parallel with the image scaling and moving into place.
+ ObjectAnimator colorizer = ObjectAnimator.ofFloat(PictureDetailsActivity.this,
+ "saturation", 0, 1);
+ colorizer.setDuration(duration);
+ colorizer.start();
+
+ // Animate a drop-shadow of the image
+ ObjectAnimator shadowAnim = ObjectAnimator.ofFloat(mShadowLayout, "shadowDepth", 0, 1);
+ shadowAnim.setDuration(duration);
+ shadowAnim.start();
+ }
+
+ /**
+ * The exit animation is basically a reverse of the enter animation, except that if
+ * the orientation has changed we simply scale the picture back into the center of
+ * the screen.
+ *
+ * @param endAction This action gets run after the animation completes (this is
+ * when we actually switch activities)
+ */
+ public void runExitAnimation(final Runnable endAction) {
+ final long duration = (long) (ANIM_DURATION * ActivityAnimations.sAnimatorScale);
+
+ // No need to set initial values for the reverse animation; the image is at the
+ // starting size/location that we want to start from. Just animate to the
+ // thumbnail size/location that we retrieved earlier
+
+ // Caveat: configuration change invalidates thumbnail positions; just animate
+ // the scale around the center. Also, fade it out since it won't match up with
+ // whatever's actually in the center
+ final boolean fadeOut;
+ if (getResources().getConfiguration().orientation != mOriginalOrientation) {
+ mImageView.setPivotX(mImageView.getWidth() / 2);
+ mImageView.setPivotY(mImageView.getHeight() / 2);
+ mLeftDelta = 0;
+ mTopDelta = 0;
+ fadeOut = true;
+ } else {
+ fadeOut = false;
+ }
+
+ // First, slide/fade text out of the way
+ mTextView.animate().translationY(-mTextView.getHeight()).alpha(0).
+ setDuration(duration/2).setInterpolator(sAccelerator).
+ withEndAction(new Runnable() {
+ public void run() {
+ // Animate image back to thumbnail size/location
+ mImageView.animate().setDuration(duration).
+ scaleX(mWidthScale).scaleY(mHeightScale).
+ translationX(mLeftDelta).translationY(mTopDelta).
+ withEndAction(endAction);
+ if (fadeOut) {
+ mImageView.animate().alpha(0);
+ }
+ // Fade out background
+ ObjectAnimator bgAnim = ObjectAnimator.ofInt(mBackground, "alpha", 0);
+ bgAnim.setDuration(duration);
+ bgAnim.start();
+
+ // Animate the shadow of the image
+ ObjectAnimator shadowAnim = ObjectAnimator.ofFloat(mShadowLayout,
+ "shadowDepth", 1, 0);
+ shadowAnim.setDuration(duration);
+ shadowAnim.start();
+
+ // Animate a color filter to take the image back to grayscale,
+ // in parallel with the image scaling and moving into place.
+ ObjectAnimator colorizer =
+ ObjectAnimator.ofFloat(PictureDetailsActivity.this,
+ "saturation", 1, 0);
+ colorizer.setDuration(duration);
+ colorizer.start();
+ }
+ });
+
+
+ }
+
+ /**
+ * Overriding this method allows us to run our exit animation first, then exiting
+ * the activity when it is complete.
+ */
+ @Override
+ public void onBackPressed() {
+ runExitAnimation(new Runnable() {
+ public void run() {
+ // *Now* go ahead and exit the activity
+ finish();
+ }
+ });
+ }
+
+ /**
+ * This is called by the colorizing animator. It sets a saturation factor that is then
+ * passed onto a filter on the picture's drawable.
+ * @param value
+ */
+ public void setSaturation(float value) {
+ colorizerMatrix.setSaturation(value);
+ ColorMatrixColorFilter colorizerFilter = new ColorMatrixColorFilter(colorizerMatrix);
+ mBitmapDrawable.setColorFilter(colorizerFilter);
+ }
+
+ @Override
+ public void finish() {
+ super.finish();
+
+ // override transitions to skip the standard window animations
+ overridePendingTransition(0, 0);
+ }
+}
diff --git a/samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/ShadowLayout.java b/samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/ShadowLayout.java
new file mode 100644
index 000000000..b3bc96180
--- /dev/null
+++ b/samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/ShadowLayout.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2013 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.example.android.activityanim;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BlurMaskFilter;
+import android.graphics.BlurMaskFilter.Blur;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.Paint.Style;
+import android.graphics.Rect;
+import android.graphics.RectF;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.RelativeLayout;
+
+/**
+ * This custom layout paints a drop shadow behind all children. The size and opacity
+ * of the drop shadow is determined by a "depth" factor that can be set and animated.
+ */
+public class ShadowLayout extends RelativeLayout {
+
+ Paint mShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ float mShadowDepth;
+ Bitmap mShadowBitmap;
+ static final int BLUR_RADIUS = 6;
+ static final RectF sShadowRectF = new RectF(0, 0, 200, 200);
+ static final Rect sShadowRect = new Rect(0, 0, 200 + 2 * BLUR_RADIUS, 200 + 2 * BLUR_RADIUS);
+ static RectF tempShadowRectF = new RectF(0, 0, 0, 0);
+
+ public ShadowLayout(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ init();
+ }
+
+ public ShadowLayout(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init();
+ }
+
+ public ShadowLayout(Context context) {
+ super(context);
+ init();
+ }
+
+ /**
+ * Called by the constructors - sets up the drawing parameters for the drop shadow.
+ */
+ private void init() {
+ mShadowPaint.setColor(Color.BLACK);
+ mShadowPaint.setStyle(Style.FILL);
+ setWillNotDraw(false);
+ mShadowBitmap = Bitmap.createBitmap(sShadowRect.width(),
+ sShadowRect.height(), Bitmap.Config.ARGB_8888);
+ Canvas c = new Canvas(mShadowBitmap);
+ mShadowPaint.setMaskFilter(new BlurMaskFilter(BLUR_RADIUS, Blur.NORMAL));
+ c.translate(BLUR_RADIUS, BLUR_RADIUS);
+ c.drawRoundRect(sShadowRectF, sShadowRectF.width() / 40,
+ sShadowRectF.height() / 40, mShadowPaint);
+ }
+
+ /**
+ * The "depth" factor determines the offset distance and opacity of the shadow (shadows that
+ * are further away from the source are offset greater and are more translucent).
+ * @param depth
+ */
+ public void setShadowDepth(float depth) {
+ if (depth != mShadowDepth) {
+ mShadowDepth = depth;
+ mShadowPaint.setAlpha((int) (100 + 150 * (1 - mShadowDepth)));
+ invalidate(); // We need to redraw when the shadow attributes change
+ }
+ }
+
+ /**
+ * Overriding onDraw allows us to draw shadows behind every child of this container.
+ * onDraw() is called to draw a layout's content before the children are drawn, so the
+ * shadows will be drawn first, behind the children (which is what we want).
+ */
+ @Override
+ protected void onDraw(Canvas canvas) {
+ for (int i = 0; i < getChildCount(); ++i) {
+ View child = getChildAt(i);
+ if (child.getVisibility() != View.VISIBLE || child.getAlpha() == 0) {
+ continue;
+ }
+ int depthFactor = (int) (80 * mShadowDepth);
+ canvas.save();
+ canvas.translate(child.getLeft() + depthFactor,
+ child.getTop() + depthFactor);
+ canvas.concat(child.getMatrix());
+ tempShadowRectF.right = child.getWidth();
+ tempShadowRectF.bottom = child.getHeight();
+ canvas.drawBitmap(mShadowBitmap, sShadowRect, tempShadowRectF, mShadowPaint);
+ canvas.restore();
+ }
+ }
+
+
+}
diff --git a/samples/devbytes/animation/Anticipation/AndroidManifest.xml b/samples/devbytes/animation/Anticipation/AndroidManifest.xml
new file mode 100644
index 000000000..c9415245f
--- /dev/null
+++ b/samples/devbytes/animation/Anticipation/AndroidManifest.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.anticipation"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="14"
+ android:targetSdkVersion="17" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name="com.example.android.anticipation.Anticipation"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest> \ No newline at end of file
diff --git a/samples/devbytes/animation/Anticipation/res/drawable-hdpi/ic_launcher.png b/samples/devbytes/animation/Anticipation/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..96a442e5b
--- /dev/null
+++ b/samples/devbytes/animation/Anticipation/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/Anticipation/res/drawable-mdpi/ic_launcher.png b/samples/devbytes/animation/Anticipation/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..359047dfa
--- /dev/null
+++ b/samples/devbytes/animation/Anticipation/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/Anticipation/res/drawable-xhdpi/ic_launcher.png b/samples/devbytes/animation/Anticipation/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..71c6d760f
--- /dev/null
+++ b/samples/devbytes/animation/Anticipation/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/Anticipation/res/layout/main.xml b/samples/devbytes/animation/Anticipation/res/layout/main.xml
new file mode 100644
index 000000000..7da093f48
--- /dev/null
+++ b/samples/devbytes/animation/Anticipation/res/layout/main.xml
@@ -0,0 +1,28 @@
+<!-- Copyright (C) 2013 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/container"
+ android:clipChildren="false"
+ tools:context=".Anticipation" >
+
+ <view
+ class="com.example.android.anticipation.AnticiButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="AnticiButton"/>
+</LinearLayout> \ No newline at end of file
diff --git a/samples/devbytes/animation/Anticipation/res/values-v14/styles.xml b/samples/devbytes/animation/Anticipation/res/values-v14/styles.xml
new file mode 100644
index 000000000..6e9521a16
--- /dev/null
+++ b/samples/devbytes/animation/Anticipation/res/values-v14/styles.xml
@@ -0,0 +1,26 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!--
+ Base application theme for API 14+. This theme completely replaces
+ AppBaseTheme from BOTH res/values/styles.xml and
+ res/values-v11/styles.xml on API 14+ devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+ <!-- API 14 theme customizations can go here. -->
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/Anticipation/res/values/strings.xml b/samples/devbytes/animation/Anticipation/res/values/strings.xml
new file mode 100644
index 000000000..90976294b
--- /dev/null
+++ b/samples/devbytes/animation/Anticipation/res/values/strings.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <string name="app_name">Anticipation</string>
+ <string name="hello_world">Hello world!</string>
+ <string name="menu_settings">Settings</string>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/Anticipation/res/values/styles.xml b/samples/devbytes/animation/Anticipation/res/values/styles.xml
new file mode 100644
index 000000000..27658b7d6
--- /dev/null
+++ b/samples/devbytes/animation/Anticipation/res/values/styles.xml
@@ -0,0 +1,34 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!--
+ Base application theme, dependent on API level. This theme is replaced
+ by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Light">
+ <!--
+ Theme customizations available in newer API levels can go in
+ res/values-vXX/styles.xml, while customizations related to
+ backward-compatibility can go here.
+ -->
+ </style>
+
+ <!-- Application theme. -->
+ <style name="AppTheme" parent="AppBaseTheme">
+ <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/Anticipation/src/com/example/android/anticipation/AnticiButton.java b/samples/devbytes/animation/Anticipation/src/com/example/android/anticipation/AnticiButton.java
new file mode 100644
index 000000000..707765bb9
--- /dev/null
+++ b/samples/devbytes/animation/Anticipation/src/com/example/android/anticipation/AnticiButton.java
@@ -0,0 +1,230 @@
+/*
+ * Copyright (C) 2013 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.example.android.anticipation;
+
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Matrix;
+import android.graphics.RectF;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.DecelerateInterpolator;
+import android.view.animation.LinearInterpolator;
+import android.view.animation.OvershootInterpolator;
+import android.widget.Button;
+
+/**
+ * Custom button which can be deformed by skewing the top left and right, to simulate
+ * anticipation and follow-through animation effects. Clicking on the button runs
+ * an animation which moves the button left or right, applying the skew effect to the
+ * button. The logic of drawing the button with a skew transform is handled in the
+ * draw() override.
+ */
+public class AnticiButton extends Button {
+
+ private static final LinearInterpolator sLinearInterpolator = new LinearInterpolator();
+ private static final DecelerateInterpolator sDecelerator = new DecelerateInterpolator(8);
+ private static final AccelerateInterpolator sAccelerator = new AccelerateInterpolator();
+ private static final OvershootInterpolator sOvershooter = new OvershootInterpolator();
+ private static final DecelerateInterpolator sQuickDecelerator = new DecelerateInterpolator();
+
+ private float mSkewX = 0;
+ ObjectAnimator downAnim = null;
+ boolean mOnLeft = true;
+ RectF mTempRect = new RectF();
+
+ public AnticiButton(Context context) {
+ super(context);
+ init();
+ }
+
+ public AnticiButton(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ init();
+ }
+
+ public AnticiButton(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init();
+ }
+
+ private void init() {
+ setOnTouchListener(mTouchListener);
+ setOnClickListener(new OnClickListener() {
+ public void onClick(View v) {
+ runClickAnim();
+ }
+ });
+ }
+
+ /**
+ * The skew effect is handled by changing the transform of the Canvas
+ * and then calling the usual superclass draw() method.
+ */
+ @Override
+ public void draw(Canvas canvas) {
+ if (mSkewX != 0) {
+ canvas.translate(0, getHeight());
+ canvas.skew(mSkewX, 0);
+ canvas.translate(0, -getHeight());
+ }
+ super.draw(canvas);
+ }
+
+ /**
+ * Anticipate the future animation by rearing back, away from the direction of travel
+ */
+ private void runPressAnim() {
+ downAnim = ObjectAnimator.ofFloat(this, "skewX", mOnLeft ? .5f : -.5f);
+ downAnim.setDuration(2500);
+ downAnim.setInterpolator(sDecelerator);
+ downAnim.start();
+ }
+
+ /**
+ * Finish the "anticipation" animation (skew the button back from the direction of
+ * travel), animate it to the other side of the screen, then un-skew the button
+ * with an Overshoot effect.
+ */
+ private void runClickAnim() {
+ // Anticipation
+ ObjectAnimator finishDownAnim = null;
+ if (downAnim != null && downAnim.isRunning()) {
+ // finish the skew animation quickly
+ downAnim.cancel();
+ finishDownAnim = ObjectAnimator.ofFloat(this, "skewX",
+ mOnLeft ? .5f : -.5f);
+ finishDownAnim.setDuration(150);
+ finishDownAnim.setInterpolator(sQuickDecelerator);
+ }
+
+ // Slide. Use LinearInterpolator in this rare situation where we want to start
+ // and end fast (no acceleration or deceleration, since we're doing that part
+ // during the anticipation and overshoot phases).
+ ObjectAnimator moveAnim = ObjectAnimator.ofFloat(this,
+ View.TRANSLATION_X, mOnLeft ? 400 : 0);
+ moveAnim.setInterpolator(sLinearInterpolator);
+ moveAnim.setDuration(150);
+
+ // Then overshoot by stopping the movement but skewing the button as if it couldn't
+ // all stop at once
+ ObjectAnimator skewAnim = ObjectAnimator.ofFloat(this, "skewX",
+ mOnLeft ? -.5f : .5f);
+ skewAnim.setInterpolator(sQuickDecelerator);
+ skewAnim.setDuration(100);
+ // and wobble it
+ ObjectAnimator wobbleAnim = ObjectAnimator.ofFloat(this, "skewX", 0);
+ wobbleAnim.setInterpolator(sOvershooter);
+ wobbleAnim.setDuration(150);
+ AnimatorSet set = new AnimatorSet();
+ set.playSequentially(moveAnim, skewAnim, wobbleAnim);
+ if (finishDownAnim != null) {
+ set.play(finishDownAnim).before(moveAnim);
+ }
+ set.start();
+ mOnLeft = !mOnLeft;
+ }
+
+ /**
+ * Restore the button to its un-pressed state
+ */
+ private void runCancelAnim() {
+ if (downAnim != null && downAnim.isRunning()) {
+ downAnim.cancel();
+ ObjectAnimator reverser = ObjectAnimator.ofFloat(this, "skewX", 0);
+ reverser.setDuration(200);
+ reverser.setInterpolator(sAccelerator);
+ reverser.start();
+ downAnim = null;
+ }
+ }
+
+ /**
+ * Handle touch events directly since we want to react on down/up events, not just
+ * button clicks
+ */
+ private View.OnTouchListener mTouchListener = new View.OnTouchListener() {
+
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ switch (event.getAction()) {
+ case MotionEvent.ACTION_UP:
+ if (isPressed()) {
+ performClick();
+ setPressed(false);
+ break;
+ }
+ // No click: Fall through; equivalent to cancel event
+ case MotionEvent.ACTION_CANCEL:
+ // Run the cancel animation in either case
+ runCancelAnim();
+ break;
+ case MotionEvent.ACTION_MOVE:
+ float x = event.getX();
+ float y = event.getY();
+ boolean isInside = (x > 0 && x < getWidth() &&
+ y > 0 && y < getHeight());
+ if (isPressed() != isInside) {
+ setPressed(isInside);
+ }
+ break;
+ case MotionEvent.ACTION_DOWN:
+ setPressed(true);
+ runPressAnim();
+ break;
+ default:
+ break;
+ }
+ return true;
+ }
+ };
+
+ public float getSkewX() {
+ return mSkewX;
+ }
+
+ /**
+ * Sets the amount of left/right skew on the button, which determines how far the button
+ * leans.
+ */
+ public void setSkewX(float value) {
+ if (value != mSkewX) {
+ mSkewX = value;
+ invalidate(); // force button to redraw with new skew value
+ invalidateSkewedBounds(); // also invalidate appropriate area of parent
+ }
+ }
+
+ /**
+ * Need to invalidate proper area of parent for skewed bounds
+ */
+ private void invalidateSkewedBounds() {
+ if (mSkewX != 0) {
+ Matrix matrix = new Matrix();
+ matrix.setSkew(-mSkewX, 0);
+ mTempRect.set(0, 0, getRight(), getBottom());
+ matrix.mapRect(mTempRect);
+ mTempRect.offset(getLeft() + getTranslationX(), getTop() + getTranslationY());
+ ((View) getParent()).invalidate((int) mTempRect.left, (int) mTempRect.top,
+ (int) (mTempRect.right +.5f), (int) (mTempRect.bottom + .5f));
+ }
+ }
+}
diff --git a/samples/devbytes/animation/Anticipation/src/com/example/android/anticipation/Anticipation.java b/samples/devbytes/animation/Anticipation/src/com/example/android/anticipation/Anticipation.java
new file mode 100644
index 000000000..4ef8f62db
--- /dev/null
+++ b/samples/devbytes/animation/Anticipation/src/com/example/android/anticipation/Anticipation.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2013 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.example.android.anticipation;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.ViewGroup;
+import android.view.ViewGroup.LayoutParams;
+
+/**
+ * This example shows how to animate some simple deformations on a standard UI widget
+ * to achieve some interactive and cartoon-ish effects.
+ *
+ * Watch the associated video for this demo on the DevBytes channel of developer.android.com
+ * or on the DevBytes playlist in the androiddevelopers channel on YouTube at
+ * https://www.youtube.com/playlist?list=PLWz5rJ2EKKc_XOgcRukSoKKjewFJZrKV0.
+ */
+public class Anticipation extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
+ }
+
+}
diff --git a/samples/devbytes/animation/CurvedMotion/AndroidManifest.xml b/samples/devbytes/animation/CurvedMotion/AndroidManifest.xml
new file mode 100644
index 000000000..195faae23
--- /dev/null
+++ b/samples/devbytes/animation/CurvedMotion/AndroidManifest.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.curvedmotion"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="11"
+ android:targetSdkVersion="11" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name="com.example.android.curvedmotion.CurvedMotion"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest> \ No newline at end of file
diff --git a/samples/devbytes/animation/CurvedMotion/res/drawable-hdpi/ic_launcher.png b/samples/devbytes/animation/CurvedMotion/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..96a442e5b
--- /dev/null
+++ b/samples/devbytes/animation/CurvedMotion/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/CurvedMotion/res/drawable-mdpi/ic_launcher.png b/samples/devbytes/animation/CurvedMotion/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..359047dfa
--- /dev/null
+++ b/samples/devbytes/animation/CurvedMotion/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/CurvedMotion/res/drawable-xhdpi/ic_launcher.png b/samples/devbytes/animation/CurvedMotion/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..71c6d760f
--- /dev/null
+++ b/samples/devbytes/animation/CurvedMotion/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/CurvedMotion/res/layout/activity_curved_motion.xml b/samples/devbytes/animation/CurvedMotion/res/layout/activity_curved_motion.xml
new file mode 100644
index 000000000..10adea314
--- /dev/null
+++ b/samples/devbytes/animation/CurvedMotion/res/layout/activity_curved_motion.xml
@@ -0,0 +1,33 @@
+<!-- Copyright (C) 2013 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.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:paddingLeft="@dimen/activity_horizontal_margin"
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingTop="@dimen/activity_vertical_margin"
+ tools:context=".CurvedMotion" >
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentTop="true"
+ android:id="@+id/button"
+ android:text="Click Me!" />
+
+</RelativeLayout> \ No newline at end of file
diff --git a/samples/devbytes/animation/CurvedMotion/res/values-v11/styles.xml b/samples/devbytes/animation/CurvedMotion/res/values-v11/styles.xml
new file mode 100644
index 000000000..556d2da2c
--- /dev/null
+++ b/samples/devbytes/animation/CurvedMotion/res/values-v11/styles.xml
@@ -0,0 +1,25 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!--
+ Base application theme for API 11+. This theme completely replaces
+ AppBaseTheme from res/values/styles.xml on API 11+ devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
+ <!-- API 11 theme customizations can go here. -->
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/CurvedMotion/res/values-v14/styles.xml b/samples/devbytes/animation/CurvedMotion/res/values-v14/styles.xml
new file mode 100644
index 000000000..6e9521a16
--- /dev/null
+++ b/samples/devbytes/animation/CurvedMotion/res/values-v14/styles.xml
@@ -0,0 +1,26 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!--
+ Base application theme for API 14+. This theme completely replaces
+ AppBaseTheme from BOTH res/values/styles.xml and
+ res/values-v11/styles.xml on API 14+ devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+ <!-- API 14 theme customizations can go here. -->
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/CurvedMotion/res/values/dimens.xml b/samples/devbytes/animation/CurvedMotion/res/values/dimens.xml
new file mode 100644
index 000000000..90db76b39
--- /dev/null
+++ b/samples/devbytes/animation/CurvedMotion/res/values/dimens.xml
@@ -0,0 +1,21 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!-- Default screen margins, per the Android Design guidelines. -->
+ <dimen name="activity_horizontal_margin">16dp</dimen>
+ <dimen name="activity_vertical_margin">16dp</dimen>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/CurvedMotion/res/values/strings.xml b/samples/devbytes/animation/CurvedMotion/res/values/strings.xml
new file mode 100644
index 000000000..a070e157f
--- /dev/null
+++ b/samples/devbytes/animation/CurvedMotion/res/values/strings.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <string name="app_name">CurvedMotion</string>
+ <string name="action_settings">Settings</string>
+ <string name="hello_world">Hello world!</string>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/CurvedMotion/res/values/styles.xml b/samples/devbytes/animation/CurvedMotion/res/values/styles.xml
new file mode 100644
index 000000000..27658b7d6
--- /dev/null
+++ b/samples/devbytes/animation/CurvedMotion/res/values/styles.xml
@@ -0,0 +1,34 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!--
+ Base application theme, dependent on API level. This theme is replaced
+ by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Light">
+ <!--
+ Theme customizations available in newer API levels can go in
+ res/values-vXX/styles.xml, while customizations related to
+ backward-compatibility can go here.
+ -->
+ </style>
+
+ <!-- Application theme. -->
+ <style name="AppTheme" parent="AppBaseTheme">
+ <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/CurvedMotion/src/com/example/android/curvedmotion/AnimatorPath.java b/samples/devbytes/animation/CurvedMotion/src/com/example/android/curvedmotion/AnimatorPath.java
new file mode 100644
index 000000000..d030c6a16
--- /dev/null
+++ b/samples/devbytes/animation/CurvedMotion/src/com/example/android/curvedmotion/AnimatorPath.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2013 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.example.android.curvedmotion;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * A simple Path object that holds information about the points along
+ * a path. The API allows you to specify a move location (which essentially
+ * jumps from the previous point in the path to the new one), a line location
+ * (which creates a line segment from the previous location) and a curve
+ * location (which creates a B�zier curve from the previous location).
+ */
+public class AnimatorPath {
+
+ // The points in the path
+ ArrayList<PathPoint> mPoints = new ArrayList<PathPoint>();
+
+
+ /**
+ * Move from the current path point to the new one
+ * specified by x and y. This will create a discontinuity if this point is
+ * neither the first point in the path nor the same as the previous point
+ * in the path.
+ */
+ public void moveTo(float x, float y) {
+ mPoints.add(PathPoint.moveTo(x, y));
+ }
+
+ /**
+ * Create a straight line from the current path point to the new one
+ * specified by x and y.
+ */
+ public void lineTo(float x, float y) {
+ mPoints.add(PathPoint.lineTo(x, y));
+ }
+
+ /**
+ * Create a quadratic B�zier curve from the current path point to the new one
+ * specified by x and y. The curve uses the current path location as the first anchor
+ * point, the control points (c0X, c0Y) and (c1X, c1Y), and (x, y) as the end anchor.
+ */
+ public void curveTo(float c0X, float c0Y, float c1X, float c1Y, float x, float y) {
+ mPoints.add(PathPoint.curveTo(c0X, c0Y, c1X, c1Y, x, y));
+ }
+
+ /**
+ * Returns a Collection of PathPoint objects that describe all points in the path.
+ */
+ public Collection<PathPoint> getPoints() {
+ return mPoints;
+ }
+}
diff --git a/samples/devbytes/animation/CurvedMotion/src/com/example/android/curvedmotion/CurvedMotion.java b/samples/devbytes/animation/CurvedMotion/src/com/example/android/curvedmotion/CurvedMotion.java
new file mode 100644
index 000000000..357d72de9
--- /dev/null
+++ b/samples/devbytes/animation/CurvedMotion/src/com/example/android/curvedmotion/CurvedMotion.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2013 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.example.android.curvedmotion;
+
+import android.animation.ObjectAnimator;
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.View;
+import android.view.ViewTreeObserver;
+import android.view.animation.DecelerateInterpolator;
+import android.widget.Button;
+import android.widget.RelativeLayout;
+import android.widget.RelativeLayout.LayoutParams;
+
+/**
+ * This app shows how to move a view in a curved path between two endpoints.
+ * The real work is done by PathEvaluator, which interpolates along a path
+ * using Bezier control and anchor points in the path.
+ *
+ * Watch the associated video for this demo on the DevBytes channel of developer.android.com
+ * or on the DevBytes playlist in the androiddevelopers channel on YouTube at
+ * https://www.youtube.com/playlist?list=PLWz5rJ2EKKc_XOgcRukSoKKjewFJZrKV0.
+ */
+public class CurvedMotion extends Activity {
+
+ private static final DecelerateInterpolator sDecelerateInterpolator =
+ new DecelerateInterpolator();
+ boolean mTopLeft = true;
+ Button mButton;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_curved_motion);
+
+ mButton = (Button) findViewById(R.id.button);
+ mButton.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ // Capture current location of button
+ final int oldLeft = mButton.getLeft();
+ final int oldTop = mButton.getTop();
+
+ // Change layout parameters of button to move it
+ moveButton();
+
+ // Add OnPreDrawListener to catch button after layout but before drawing
+ mButton.getViewTreeObserver().addOnPreDrawListener(
+ new ViewTreeObserver.OnPreDrawListener() {
+ public boolean onPreDraw() {
+ mButton.getViewTreeObserver().removeOnPreDrawListener(this);
+
+ // Capture new location
+ int left = mButton.getLeft();
+ int top = mButton.getTop();
+ int deltaX = left - oldLeft;
+ int deltaY = top - oldTop;
+
+ // Set up path to new location using a B�zier spline curve
+ AnimatorPath path = new AnimatorPath();
+ path.moveTo(-deltaX, -deltaY);
+ path.curveTo(-(deltaX/2), -deltaY, 0, -deltaY/2, 0, 0);
+
+ // Set up the animation
+ final ObjectAnimator anim = ObjectAnimator.ofObject(
+ CurvedMotion.this, "buttonLoc",
+ new PathEvaluator(), path.getPoints().toArray());
+ anim.setInterpolator(sDecelerateInterpolator);
+ anim.start();
+ return true;
+ }
+ });
+ }
+ });
+ }
+
+ /**
+ * Toggles button location on click between top-left and bottom-right
+ */
+ private void moveButton() {
+ LayoutParams params = (LayoutParams) mButton.getLayoutParams();
+ if (mTopLeft) {
+ params.removeRule(RelativeLayout.ALIGN_PARENT_LEFT);
+ params.removeRule(RelativeLayout.ALIGN_PARENT_TOP);
+ params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
+ params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
+ } else {
+ params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
+ params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
+ params.removeRule(RelativeLayout.ALIGN_PARENT_RIGHT);
+ params.removeRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
+ }
+ mButton.setLayoutParams(params);
+ mTopLeft = !mTopLeft;
+ }
+
+ /**
+ * We need this setter to translate between the information the animator
+ * produces (a new "PathPoint" describing the current animated location)
+ * and the information that the button requires (an xy location). The
+ * setter will be called by the ObjectAnimator given the 'buttonLoc'
+ * property string.
+ */
+ public void setButtonLoc(PathPoint newLoc) {
+ mButton.setTranslationX(newLoc.mX);
+ mButton.setTranslationY(newLoc.mY);
+ }
+
+}
diff --git a/samples/devbytes/animation/CurvedMotion/src/com/example/android/curvedmotion/PathEvaluator.java b/samples/devbytes/animation/CurvedMotion/src/com/example/android/curvedmotion/PathEvaluator.java
new file mode 100644
index 000000000..e68d4cdae
--- /dev/null
+++ b/samples/devbytes/animation/CurvedMotion/src/com/example/android/curvedmotion/PathEvaluator.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2013 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.example.android.curvedmotion;
+
+import android.animation.TypeEvaluator;
+
+/**
+ * This evaluator interpolates between two PathPoint values given the value t, the
+ * proportion traveled between those points. The value of the interpolation depends
+ * on the operation specified by the endValue (the operation for the interval between
+ * PathPoints is always specified by the end point of that interval).
+ */
+public class PathEvaluator implements TypeEvaluator<PathPoint> {
+ @Override
+ public PathPoint evaluate(float t, PathPoint startValue, PathPoint endValue) {
+ float x, y;
+ if (endValue.mOperation == PathPoint.CURVE) {
+ float oneMinusT = 1 - t;
+ x = oneMinusT * oneMinusT * oneMinusT * startValue.mX +
+ 3 * oneMinusT * oneMinusT * t * endValue.mControl0X +
+ 3 * oneMinusT * t * t * endValue.mControl1X +
+ t * t * t * endValue.mX;
+ y = oneMinusT * oneMinusT * oneMinusT * startValue.mY +
+ 3 * oneMinusT * oneMinusT * t * endValue.mControl0Y +
+ 3 * oneMinusT * t * t * endValue.mControl1Y +
+ t * t * t * endValue.mY;
+ } else if (endValue.mOperation == PathPoint.LINE) {
+ x = startValue.mX + t * (endValue.mX - startValue.mX);
+ y = startValue.mY + t * (endValue.mY - startValue.mY);
+ } else {
+ x = endValue.mX;
+ y = endValue.mY;
+ }
+ return PathPoint.moveTo(x, y);
+ }
+}
diff --git a/samples/devbytes/animation/CurvedMotion/src/com/example/android/curvedmotion/PathPoint.java b/samples/devbytes/animation/CurvedMotion/src/com/example/android/curvedmotion/PathPoint.java
new file mode 100644
index 000000000..ba1a05ecc
--- /dev/null
+++ b/samples/devbytes/animation/CurvedMotion/src/com/example/android/curvedmotion/PathPoint.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2013 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.example.android.curvedmotion;
+
+/**
+ * A class that holds information about a location and how the path should get to that
+ * location from the previous path location (if any). Any PathPoint holds the information for
+ * its location as well as the instructions on how to traverse the preceding interval from the
+ * previous location.
+ */
+public class PathPoint {
+
+ /**
+ * The possible path operations that describe how to move from a preceding PathPoint to the
+ * location described by this PathPoint.
+ */
+ public static final int MOVE = 0;
+ public static final int LINE = 1;
+ public static final int CURVE = 2;
+
+ /**
+ * The location of this PathPoint
+ */
+ float mX, mY;
+
+ /**
+ * The first control point, if any, for a PathPoint of type CURVE
+ */
+ float mControl0X, mControl0Y;
+
+ /**
+ * The second control point, if any, for a PathPoint of type CURVE
+ */
+ float mControl1X, mControl1Y;
+
+ /**
+ * The motion described by the path to get from the previous PathPoint in an AnimatorPath
+ * to the location of this PathPoint. This can be one of MOVE, LINE, or CURVE.
+ */
+ int mOperation;
+
+
+
+ /**
+ * Line/Move constructor
+ */
+ private PathPoint(int operation, float x, float y) {
+ mOperation = operation;
+ mX = x;
+ mY = y;
+ }
+
+ /**
+ * Curve constructor
+ */
+ private PathPoint(float c0X, float c0Y, float c1X, float c1Y, float x, float y) {
+ mControl0X = c0X;
+ mControl0Y = c0Y;
+ mControl1X = c1X;
+ mControl1Y = c1Y;
+ mX = x;
+ mY = y;
+ mOperation = CURVE;
+ }
+
+ /**
+ * Constructs and returns a PathPoint object that describes a line to the given xy location.
+ */
+ public static PathPoint lineTo(float x, float y) {
+ return new PathPoint(LINE, x, y);
+ }
+
+ /**
+ * Constructs and returns a PathPoint object that describes a curve to the given xy location
+ * with the control points at c0 and c1.
+ */
+ public static PathPoint curveTo(float c0X, float c0Y, float c1X, float c1Y, float x, float y) {
+ return new PathPoint(c0X, c0Y, c1X, c1Y, x, y);
+ }
+
+ /**
+ * Constructs and returns a PathPoint object that describes a discontinuous move to the given
+ * xy location.
+ */
+ public static PathPoint moveTo(float x, float y) {
+ return new PathPoint(MOVE, x, y);
+ }
+}
diff --git a/samples/devbytes/animation/ListViewItemAnimations/AndroidManifest.xml b/samples/devbytes/animation/ListViewItemAnimations/AndroidManifest.xml
new file mode 100644
index 000000000..173b18852
--- /dev/null
+++ b/samples/devbytes/animation/ListViewItemAnimations/AndroidManifest.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.listviewitemanimations"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="9"
+ android:targetSdkVersion="16" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:theme="@style/WithoutBackground"
+ android:name="com.example.android.listviewitemanimations.ListViewItemAnimations"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest> \ No newline at end of file
diff --git a/samples/devbytes/animation/ListViewItemAnimations/res/drawable-hdpi/ic_launcher.png b/samples/devbytes/animation/ListViewItemAnimations/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..96a442e5b
--- /dev/null
+++ b/samples/devbytes/animation/ListViewItemAnimations/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/ListViewItemAnimations/res/drawable-mdpi/ic_launcher.png b/samples/devbytes/animation/ListViewItemAnimations/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..359047dfa
--- /dev/null
+++ b/samples/devbytes/animation/ListViewItemAnimations/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/ListViewItemAnimations/res/drawable-xhdpi/ic_launcher.png b/samples/devbytes/animation/ListViewItemAnimations/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..71c6d760f
--- /dev/null
+++ b/samples/devbytes/animation/ListViewItemAnimations/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/ListViewItemAnimations/res/drawable-xhdpi/shadowed_background.9.png b/samples/devbytes/animation/ListViewItemAnimations/res/drawable-xhdpi/shadowed_background.9.png
new file mode 100644
index 000000000..6226b9e76
--- /dev/null
+++ b/samples/devbytes/animation/ListViewItemAnimations/res/drawable-xhdpi/shadowed_background.9.png
Binary files differ
diff --git a/samples/devbytes/animation/ListViewItemAnimations/res/drawable-xhdpi/tv_background_with_divider.9.png b/samples/devbytes/animation/ListViewItemAnimations/res/drawable-xhdpi/tv_background_with_divider.9.png
new file mode 100644
index 000000000..e6e3cd58d
--- /dev/null
+++ b/samples/devbytes/animation/ListViewItemAnimations/res/drawable-xhdpi/tv_background_with_divider.9.png
Binary files differ
diff --git a/samples/devbytes/animation/ListViewItemAnimations/res/layout-v9/activity_list_view_item_animations.xml b/samples/devbytes/animation/ListViewItemAnimations/res/layout-v9/activity_list_view_item_animations.xml
new file mode 100644
index 000000000..8290927c0
--- /dev/null
+++ b/samples/devbytes/animation/ListViewItemAnimations/res/layout-v9/activity_list_view_item_animations.xml
@@ -0,0 +1,37 @@
+<!-- Copyright (C) 2013 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".ListViewAnimations" >
+
+ <view
+ class="com.example.android.listviewitemanimations.BackgroundContainer"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/listViewBackground">
+
+ <ListView
+ android:id="@+id/listview"
+ android:divider="@null"
+ android:dividerHeight="0dp"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ </view>
+
+</LinearLayout>
diff --git a/samples/devbytes/animation/ListViewItemAnimations/res/layout-v9/opaque_text_view.xml b/samples/devbytes/animation/ListViewItemAnimations/res/layout-v9/opaque_text_view.xml
new file mode 100644
index 000000000..aa03362c9
--- /dev/null
+++ b/samples/devbytes/animation/ListViewItemAnimations/res/layout-v9/opaque_text_view.xml
@@ -0,0 +1,25 @@
+<!-- Copyright (C) 2013 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.
+-->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/tv_background_with_divider"
+ android:textAppearance="?android:attr/textAppearanceListItemSmall"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:textSize="20dp"
+ android:gravity="center_vertical"
+ android:minHeight="48dp"
+ />
diff --git a/samples/devbytes/animation/ListViewItemAnimations/res/layout/activity_list_view_item_animations.xml b/samples/devbytes/animation/ListViewItemAnimations/res/layout/activity_list_view_item_animations.xml
new file mode 100644
index 000000000..8290927c0
--- /dev/null
+++ b/samples/devbytes/animation/ListViewItemAnimations/res/layout/activity_list_view_item_animations.xml
@@ -0,0 +1,37 @@
+<!-- Copyright (C) 2013 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".ListViewAnimations" >
+
+ <view
+ class="com.example.android.listviewitemanimations.BackgroundContainer"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/listViewBackground">
+
+ <ListView
+ android:id="@+id/listview"
+ android:divider="@null"
+ android:dividerHeight="0dp"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ </view>
+
+</LinearLayout>
diff --git a/samples/devbytes/animation/ListViewItemAnimations/res/layout/opaque_text_view.xml b/samples/devbytes/animation/ListViewItemAnimations/res/layout/opaque_text_view.xml
new file mode 100644
index 000000000..c37f62d31
--- /dev/null
+++ b/samples/devbytes/animation/ListViewItemAnimations/res/layout/opaque_text_view.xml
@@ -0,0 +1,24 @@
+<!-- Copyright (C) 2013 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.
+-->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/tv_background_with_divider"
+ android:textAppearance="?android:attr/textAppearanceListItemSmall"
+ android:gravity="center_vertical"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
+/>
diff --git a/samples/devbytes/animation/ListViewItemAnimations/res/values-v11/styles.xml b/samples/devbytes/animation/ListViewItemAnimations/res/values-v11/styles.xml
new file mode 100644
index 000000000..556d2da2c
--- /dev/null
+++ b/samples/devbytes/animation/ListViewItemAnimations/res/values-v11/styles.xml
@@ -0,0 +1,25 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!--
+ Base application theme for API 11+. This theme completely replaces
+ AppBaseTheme from res/values/styles.xml on API 11+ devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
+ <!-- API 11 theme customizations can go here. -->
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/ListViewItemAnimations/res/values-v14/styles.xml b/samples/devbytes/animation/ListViewItemAnimations/res/values-v14/styles.xml
new file mode 100644
index 000000000..6e9521a16
--- /dev/null
+++ b/samples/devbytes/animation/ListViewItemAnimations/res/values-v14/styles.xml
@@ -0,0 +1,26 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!--
+ Base application theme for API 14+. This theme completely replaces
+ AppBaseTheme from BOTH res/values/styles.xml and
+ res/values-v11/styles.xml on API 14+ devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+ <!-- API 14 theme customizations can go here. -->
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/ListViewItemAnimations/res/values/dimens.xml b/samples/devbytes/animation/ListViewItemAnimations/res/values/dimens.xml
new file mode 100644
index 000000000..90db76b39
--- /dev/null
+++ b/samples/devbytes/animation/ListViewItemAnimations/res/values/dimens.xml
@@ -0,0 +1,21 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!-- Default screen margins, per the Android Design guidelines. -->
+ <dimen name="activity_horizontal_margin">16dp</dimen>
+ <dimen name="activity_vertical_margin">16dp</dimen>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/ListViewItemAnimations/res/values/strings.xml b/samples/devbytes/animation/ListViewItemAnimations/res/values/strings.xml
new file mode 100644
index 000000000..2cc5f7135
--- /dev/null
+++ b/samples/devbytes/animation/ListViewItemAnimations/res/values/strings.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <string name="app_name">ListViewItemAnimations</string>
+ <string name="action_settings">Settings</string>
+ <string name="hello_world">Hello world!</string>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/ListViewItemAnimations/res/values/styles.xml b/samples/devbytes/animation/ListViewItemAnimations/res/values/styles.xml
new file mode 100644
index 000000000..ee3c56cea
--- /dev/null
+++ b/samples/devbytes/animation/ListViewItemAnimations/res/values/styles.xml
@@ -0,0 +1,38 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!--
+ Base application theme, dependent on API level. This theme is replaced
+ by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Light">
+ <!--
+ Theme customizations available in newer API levels can go in
+ res/values-vXX/styles.xml, while customizations related to
+ backward-compatibility can go here.
+ -->
+ </style>
+
+ <!-- Application theme. -->
+ <style name="AppTheme" parent="AppBaseTheme">
+ <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+ </style>
+
+ <style name="WithoutBackground" parent="AppTheme">
+ <item name="android:windowBackground">@null</item>
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/ListViewItemAnimations/src/com/example/android/listviewitemanimations/BackgroundContainer.java b/samples/devbytes/animation/ListViewItemAnimations/src/com/example/android/listviewitemanimations/BackgroundContainer.java
new file mode 100644
index 000000000..40ac39af7
--- /dev/null
+++ b/samples/devbytes/animation/ListViewItemAnimations/src/com/example/android/listviewitemanimations/BackgroundContainer.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2013 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.example.android.listviewitemanimations;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.widget.FrameLayout;
+
+public class BackgroundContainer extends FrameLayout {
+
+ boolean mShowing = false;
+ Drawable mShadowedBackground;
+ int mOpenAreaTop, mOpenAreaBottom, mOpenAreaHeight;
+ boolean mUpdateBounds = false;
+
+ public BackgroundContainer(Context context) {
+ super(context);
+ init();
+ }
+
+ public BackgroundContainer(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init();
+ }
+
+ public BackgroundContainer(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ init();
+ }
+
+ private void init() {
+ mShadowedBackground = getContext().getResources().getDrawable(R.drawable.shadowed_background);
+ }
+
+ public void showBackground(int top, int bottom) {
+ setWillNotDraw(false);
+ mOpenAreaTop = top;
+ mOpenAreaHeight = bottom;
+ mShowing = true;
+ mUpdateBounds = true;
+ }
+
+ public void hideBackground() {
+ setWillNotDraw(true);
+ mShowing = false;
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ if (mShowing) {
+ if (mUpdateBounds) {
+ mShadowedBackground.setBounds(0, 0, getWidth(), mOpenAreaHeight);
+ }
+ canvas.save();
+ canvas.translate(0, mOpenAreaTop);
+ mShadowedBackground.draw(canvas);
+ canvas.restore();
+ }
+ }
+
+}
diff --git a/samples/devbytes/animation/ListViewItemAnimations/src/com/example/android/listviewitemanimations/Cheeses.java b/samples/devbytes/animation/ListViewItemAnimations/src/com/example/android/listviewitemanimations/Cheeses.java
new file mode 100644
index 000000000..52410224e
--- /dev/null
+++ b/samples/devbytes/animation/ListViewItemAnimations/src/com/example/android/listviewitemanimations/Cheeses.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2013 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.example.android.listviewitemanimations;
+
+public class Cheeses {
+
+ public static final String[] sCheeseStrings = {
+ "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "Abondance", "Ackawi",
+ "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale",
+ "Aisy Cendre", "Allgauer Emmentaler", "Alverca", "Ambert", "American Cheese",
+ "Ami du Chambertin", "Anejo Enchilado", "Anneau du Vic-Bilh", "Anthoriro", "Appenzell",
+ "Aragon", "Ardi Gasna", "Ardrahan", "Armenian String", "Aromes au Gene de Marc",
+ "Asadero", "Asiago", "Aubisque Pyrenees", "Autun", "Avaxtskyr", "Baby Swiss",
+ "Babybel", "Baguette Laonnaise", "Bakers", "Baladi", "Balaton", "Bandal", "Banon",
+ "Barry's Bay Cheddar", "Basing", "Basket Cheese", "Bath Cheese", "Bavarian Bergkase",
+ "Baylough", "Beaufort", "Beauvoorde", "Beenleigh Blue", "Beer Cheese", "Bel Paese",
+ "Bergader", "Bergere Bleue", "Berkswell", "Beyaz Peynir", "Bierkase", "Bishop Kennedy",
+ "Blarney", "Bleu d'Auvergne", "Bleu de Gex", "Bleu de Laqueuille",
+ "Bleu de Septmoncel", "Bleu Des Causses", "Blue", "Blue Castello", "Blue Rathgore",
+ "Blue Vein (Australian)", "Blue Vein Cheeses", "Bocconcini", "Bocconcini (Australian)",
+ "Boeren Leidenkaas", "Bonchester", "Bosworth", "Bougon", "Boule Du Roves",
+ "Boulette d'Avesnes", "Boursault", "Boursin", "Bouyssou", "Bra", "Braudostur",
+ "Breakfast Cheese", "Brebis du Lavort", "Brebis du Lochois", "Brebis du Puyfaucon",
+ "Bresse Bleu", "Brick", "Brie", "Brie de Meaux", "Brie de Melun", "Brillat-Savarin",
+ "Brin", "Brin d' Amour", "Brin d'Amour", "Brinza (Burduf Brinza)",
+ "Briquette de Brebis", "Briquette du Forez", "Broccio", "Broccio Demi-Affine",
+ "Brousse du Rove", "Bruder Basil", "Brusselae Kaas (Fromage de Bruxelles)", "Bryndza",
+ "Buchette d'Anjou", "Buffalo", "Burgos", "Butte", "Butterkase", "Button (Innes)",
+ "Buxton Blue", "Cabecou", "Caboc", "Cabrales", "Cachaille", "Caciocavallo", "Caciotta",
+ "Caerphilly", "Cairnsmore", "Calenzana", "Cambazola", "Camembert de Normandie",
+ "Canadian Cheddar", "Canestrato", "Cantal", "Caprice des Dieux", "Capricorn Goat",
+ "Capriole Banon", "Carre de l'Est", "Casciotta di Urbino", "Cashel Blue", "Castellano",
+ "Castelleno", "Castelmagno", "Castelo Branco", "Castigliano", "Cathelain",
+ "Celtic Promise", "Cendre d'Olivet", "Cerney", "Chabichou", "Chabichou du Poitou",
+ "Chabis de Gatine", "Chaource", "Charolais", "Chaumes", "Cheddar",
+ "Cheddar Clothbound", "Cheshire", "Chevres", "Chevrotin des Aravis", "Chontaleno",
+ "Civray", "Coeur de Camembert au Calvados", "Coeur de Chevre", "Colby", "Cold Pack",
+ "Comte", "Coolea", "Cooleney", "Coquetdale", "Corleggy", "Cornish Pepper",
+ "Cotherstone", "Cotija", "Cottage Cheese", "Cottage Cheese (Australian)",
+ "Cougar Gold", "Coulommiers", "Coverdale", "Crayeux de Roncq", "Cream Cheese",
+ "Cream Havarti", "Crema Agria", "Crema Mexicana", "Creme Fraiche", "Crescenza",
+ "Croghan", "Crottin de Chavignol", "Crottin du Chavignol", "Crowdie", "Crowley",
+ "Cuajada", "Curd", "Cure Nantais", "Curworthy", "Cwmtawe Pecorino",
+ "Cypress Grove Chevre", "Danablu (Danish Blue)", "Danbo", "Danish Fontina",
+ "Daralagjazsky", "Dauphin", "Delice des Fiouves", "Denhany Dorset Drum", "Derby",
+ "Dessertnyj Belyj", "Devon Blue", "Devon Garland", "Dolcelatte", "Doolin",
+ "Doppelrhamstufel", "Dorset Blue Vinney", "Double Gloucester", "Double Worcester",
+ "Dreux a la Feuille", "Dry Jack", "Duddleswell", "Dunbarra", "Dunlop", "Dunsyre Blue",
+ "Duroblando", "Durrus", "Dutch Mimolette (Commissiekaas)", "Edam", "Edelpilz",
+ "Emental Grand Cru", "Emlett", "Emmental", "Epoisses de Bourgogne", "Esbareich",
+ "Esrom", "Etorki", "Evansdale Farmhouse Brie", "Evora De L'Alentejo", "Exmoor Blue",
+ "Explorateur", "Feta", "Feta (Australian)", "Figue", "Filetta", "Fin-de-Siecle",
+ "Finlandia Swiss", "Finn", "Fiore Sardo", "Fleur du Maquis", "Flor de Guia",
+ "Flower Marie", "Folded", "Folded cheese with mint", "Fondant de Brebis",
+ "Fontainebleau", "Fontal", "Fontina Val d'Aosta", "Formaggio di capra", "Fougerus",
+ "Four Herb Gouda", "Fourme d' Ambert", "Fourme de Haute Loire", "Fourme de Montbrison",
+ "Fresh Jack", "Fresh Mozzarella", "Fresh Ricotta", "Fresh Truffles", "Fribourgeois",
+ "Friesekaas", "Friesian", "Friesla", "Frinault", "Fromage a Raclette", "Fromage Corse",
+ "Fromage de Montagne de Savoie", "Fromage Frais", "Fruit Cream Cheese",
+ "Frying Cheese", "Fynbo", "Gabriel", "Galette du Paludier", "Galette Lyonnaise",
+ "Galloway Goat's Milk Gems", "Gammelost", "Gaperon a l'Ail", "Garrotxa", "Gastanberra",
+ "Geitost", "Gippsland Blue", "Gjetost", "Gloucester", "Golden Cross", "Gorgonzola",
+ "Gornyaltajski", "Gospel Green", "Gouda", "Goutu", "Gowrie", "Grabetto", "Graddost",
+ "Grafton Village Cheddar", "Grana", "Grana Padano", "Grand Vatel",
+ "Grataron d' Areches", "Gratte-Paille", "Graviera", "Greuilh", "Greve",
+ "Gris de Lille", "Gruyere", "Gubbeen", "Guerbigny", "Halloumi",
+ "Halloumy (Australian)", "Haloumi-Style Cheese", "Harbourne Blue", "Havarti",
+ "Heidi Gruyere", "Hereford Hop", "Herrgardsost", "Herriot Farmhouse", "Herve",
+ "Hipi Iti", "Hubbardston Blue Cow", "Hushallsost", "Iberico", "Idaho Goatster",
+ "Idiazabal", "Il Boschetto al Tartufo", "Ile d'Yeu", "Isle of Mull", "Jarlsberg",
+ "Jermi Tortes", "Jibneh Arabieh", "Jindi Brie", "Jubilee Blue", "Juustoleipa",
+ "Kadchgall", "Kaseri", "Kashta", "Kefalotyri", "Kenafa", "Kernhem", "Kervella Affine",
+ "Kikorangi", "King Island Cape Wickham Brie", "King River Gold", "Klosterkaese",
+ "Knockalara", "Kugelkase", "L'Aveyronnais", "L'Ecir de l'Aubrac", "La Taupiniere",
+ "La Vache Qui Rit", "Laguiole", "Lairobell", "Lajta", "Lanark Blue", "Lancashire",
+ "Langres", "Lappi", "Laruns", "Lavistown", "Le Brin", "Le Fium Orbo", "Le Lacandou",
+ "Le Roule", "Leafield", "Lebbene", "Leerdammer", "Leicester", "Leyden", "Limburger",
+ "Lincolnshire Poacher", "Lingot Saint Bousquet d'Orb", "Liptauer", "Little Rydings",
+ "Livarot", "Llanboidy", "Llanglofan Farmhouse", "Loch Arthur Farmhouse",
+ "Loddiswell Avondale", "Longhorn", "Lou Palou", "Lou Pevre", "Lyonnais", "Maasdam",
+ "Macconais", "Mahoe Aged Gouda", "Mahon", "Malvern", "Mamirolle", "Manchego",
+ "Manouri", "Manur", "Marble Cheddar", "Marbled Cheeses", "Maredsous", "Margotin",
+ "Maribo", "Maroilles", "Mascares", "Mascarpone", "Mascarpone (Australian)",
+ "Mascarpone Torta", "Matocq", "Maytag Blue", "Meira", "Menallack Farmhouse",
+ "Menonita", "Meredith Blue", "Mesost", "Metton (Cancoillotte)", "Meyer Vintage Gouda",
+ "Mihalic Peynir", "Milleens", "Mimolette", "Mine-Gabhar", "Mini Baby Bells", "Mixte",
+ "Molbo", "Monastery Cheeses", "Mondseer", "Mont D'or Lyonnais", "Montasio",
+ "Monterey Jack", "Monterey Jack Dry", "Morbier", "Morbier Cru de Montagne",
+ "Mothais a la Feuille", "Mozzarella", "Mozzarella (Australian)",
+ "Mozzarella di Bufala", "Mozzarella Fresh, in water", "Mozzarella Rolls", "Munster",
+ "Murol", "Mycella", "Myzithra", "Naboulsi", "Nantais", "Neufchatel",
+ "Neufchatel (Australian)", "Niolo", "Nokkelost", "Northumberland", "Oaxaca",
+ "Olde York", "Olivet au Foin", "Olivet Bleu", "Olivet Cendre",
+ "Orkney Extra Mature Cheddar", "Orla", "Oschtjepka", "Ossau Fermier", "Ossau-Iraty",
+ "Oszczypek", "Oxford Blue", "P'tit Berrichon", "Palet de Babligny", "Paneer", "Panela",
+ "Pannerone", "Pant ys Gawn", "Parmesan (Parmigiano)", "Parmigiano Reggiano",
+ "Pas de l'Escalette", "Passendale", "Pasteurized Processed", "Pate de Fromage",
+ "Patefine Fort", "Pave d'Affinois", "Pave d'Auge", "Pave de Chirac", "Pave du Berry",
+ "Pecorino", "Pecorino in Walnut Leaves", "Pecorino Romano", "Peekskill Pyramid",
+ "Pelardon des Cevennes", "Pelardon des Corbieres", "Penamellera", "Penbryn",
+ "Pencarreg", "Perail de Brebis", "Petit Morin", "Petit Pardou", "Petit-Suisse",
+ "Picodon de Chevre", "Picos de Europa", "Piora", "Pithtviers au Foin",
+ "Plateau de Herve", "Plymouth Cheese", "Podhalanski", "Poivre d'Ane", "Polkolbin",
+ "Pont l'Eveque", "Port Nicholson", "Port-Salut", "Postel", "Pouligny-Saint-Pierre",
+ "Pourly", "Prastost", "Pressato", "Prince-Jean", "Processed Cheddar", "Provolone",
+ "Provolone (Australian)", "Pyengana Cheddar", "Pyramide", "Quark",
+ "Quark (Australian)", "Quartirolo Lombardo", "Quatre-Vents", "Quercy Petit",
+ "Queso Blanco", "Queso Blanco con Frutas --Pina y Mango", "Queso de Murcia",
+ "Queso del Montsec", "Queso del Tietar", "Queso Fresco", "Queso Fresco (Adobera)",
+ "Queso Iberico", "Queso Jalapeno", "Queso Majorero", "Queso Media Luna",
+ "Queso Para Frier", "Queso Quesadilla", "Rabacal", "Raclette", "Ragusano", "Raschera",
+ "Reblochon", "Red Leicester", "Regal de la Dombes", "Reggianito", "Remedou",
+ "Requeson", "Richelieu", "Ricotta", "Ricotta (Australian)", "Ricotta Salata", "Ridder",
+ "Rigotte", "Rocamadour", "Rollot", "Romano", "Romans Part Dieu", "Roncal", "Roquefort",
+ "Roule", "Rouleau De Beaulieu", "Royalp Tilsit", "Rubens", "Rustinu", "Saaland Pfarr",
+ "Saanenkaese", "Saga", "Sage Derby", "Sainte Maure", "Saint-Marcellin",
+ "Saint-Nectaire", "Saint-Paulin", "Salers", "Samso", "San Simon", "Sancerre",
+ "Sap Sago", "Sardo", "Sardo Egyptian", "Sbrinz", "Scamorza", "Schabzieger", "Schloss",
+ "Selles sur Cher", "Selva", "Serat", "Seriously Strong Cheddar", "Serra da Estrela",
+ "Sharpam", "Shelburne Cheddar", "Shropshire Blue", "Siraz", "Sirene", "Smoked Gouda",
+ "Somerset Brie", "Sonoma Jack", "Sottocenare al Tartufo", "Soumaintrain",
+ "Sourire Lozerien", "Spenwood", "Sraffordshire Organic", "St. Agur Blue Cheese",
+ "Stilton", "Stinking Bishop", "String", "Sussex Slipcote", "Sveciaost", "Swaledale",
+ "Sweet Style Swiss", "Swiss", "Syrian (Armenian String)", "Tala", "Taleggio", "Tamie",
+ "Tasmania Highland Chevre Log", "Taupiniere", "Teifi", "Telemea", "Testouri",
+ "Tete de Moine", "Tetilla", "Texas Goat Cheese", "Tibet", "Tillamook Cheddar",
+ "Tilsit", "Timboon Brie", "Toma", "Tomme Brulee", "Tomme d'Abondance",
+ "Tomme de Chevre", "Tomme de Romans", "Tomme de Savoie", "Tomme des Chouans", "Tommes",
+ "Torta del Casar", "Toscanello", "Touree de L'Aubier", "Tourmalet",
+ "Trappe (Veritable)", "Trois Cornes De Vendee", "Tronchon", "Trou du Cru", "Truffe",
+ "Tupi", "Turunmaa", "Tymsboro", "Tyn Grug", "Tyning", "Ubriaco", "Ulloa",
+ "Vacherin-Fribourgeois", "Valencay", "Vasterbottenost", "Venaco", "Vendomois",
+ "Vieux Corse", "Vignotte", "Vulscombe", "Waimata Farmhouse Blue",
+ "Washed Rind Cheese (Australian)", "Waterloo", "Weichkaese", "Wellington",
+ "Wensleydale", "White Stilton", "Whitestone Farmhouse", "Wigmore", "Woodside Cabecou",
+ "Xanadu", "Xynotyro", "Yarg Cornish", "Yarra Valley Pyramid", "Yorkshire Blue",
+ "Zamorano", "Zanetti Grana Padano", "Zanetti Parmigiano Reggiano"
+ };
+
+}
diff --git a/samples/devbytes/animation/ListViewItemAnimations/src/com/example/android/listviewitemanimations/ListViewItemAnimations.java b/samples/devbytes/animation/ListViewItemAnimations/src/com/example/android/listviewitemanimations/ListViewItemAnimations.java
new file mode 100644
index 000000000..68a765125
--- /dev/null
+++ b/samples/devbytes/animation/ListViewItemAnimations/src/com/example/android/listviewitemanimations/ListViewItemAnimations.java
@@ -0,0 +1,402 @@
+/*
+ * Copyright (C) 2013 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.example.android.listviewitemanimations;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.ObjectAnimator;
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewConfiguration;
+import android.view.ViewTreeObserver;
+import android.view.animation.AlphaAnimation;
+import android.view.animation.Animation;
+import android.view.animation.Animation.AnimationListener;
+import android.view.animation.AnimationSet;
+import android.view.animation.TranslateAnimation;
+import android.widget.ListView;
+
+/**
+ * This example shows how to use a swipe effect to remove items from a ListView,
+ * and how to use animations to complete the swipe as well as to animate the other
+ * items in the list into their final places. This code works on runtimes back to Gingerbread
+ * (Android 2.3), by using the android.view.animation classes on earlier releases.
+ *
+ * Watch the associated video for this demo on the DevBytes channel of developer.android.com
+ * or on the DevBytes playlist in the androiddevelopers channel on YouTube at
+ * https://www.youtube.com/playlist?list=PLWz5rJ2EKKc_XOgcRukSoKKjewFJZrKV0.
+ */
+public class ListViewItemAnimations extends Activity {
+
+ final ArrayList<View> mCheckedViews = new ArrayList<View>();
+ StableArrayAdapter mAdapter;
+ ListView mListView;
+ BackgroundContainer mBackgroundContainer;
+ boolean mSwiping = false;
+ boolean mItemPressed = false;
+ HashMap<Long, Integer> mItemIdTopMap = new HashMap<Long, Integer>();
+ boolean mAnimating = false;
+ float mCurrentX = 0;
+ float mCurrentAlpha = 1;
+
+ private static final int SWIPE_DURATION = 250;
+ private static final int MOVE_DURATION = 150;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_list_view_item_animations);
+
+ mBackgroundContainer = (BackgroundContainer) findViewById(R.id.listViewBackground);
+ mListView = (ListView) findViewById(R.id.listview);
+ final ArrayList<String> cheeseList = new ArrayList<String>();
+ for (int i = 0; i < Cheeses.sCheeseStrings.length; ++i) {
+ cheeseList.add(Cheeses.sCheeseStrings[i]);
+ }
+ mAdapter = new StableArrayAdapter(this,R.layout.opaque_text_view, cheeseList,
+ mTouchListener);
+ mListView.setAdapter(mAdapter);
+ }
+
+ /**
+ * Returns true if the current runtime is Honeycomb or later
+ */
+ private boolean isRuntimePostGingerbread() {
+ return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB;
+ }
+
+ private View.OnTouchListener mTouchListener = new View.OnTouchListener() {
+
+ float mDownX;
+ private int mSwipeSlop = -1;
+
+ @SuppressLint("NewApi")
+ @Override
+ public boolean onTouch(final View v, MotionEvent event) {
+ if (mSwipeSlop < 0) {
+ mSwipeSlop = ViewConfiguration.get(ListViewItemAnimations.this).
+ getScaledTouchSlop();
+ }
+ switch (event.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ if (mAnimating) {
+ // Multi-item swipes not handled
+ return true;
+ }
+ mItemPressed = true;
+ mDownX = event.getX();
+ break;
+ case MotionEvent.ACTION_CANCEL:
+ setSwipePosition(v, 0);
+ mItemPressed = false;
+ break;
+ case MotionEvent.ACTION_MOVE:
+ {
+ if (mAnimating) {
+ return true;
+ }
+ float x = event.getX();
+ if (isRuntimePostGingerbread()) {
+ x += v.getTranslationX();
+ }
+ float deltaX = x - mDownX;
+ float deltaXAbs = Math.abs(deltaX);
+ if (!mSwiping) {
+ if (deltaXAbs > mSwipeSlop) {
+ mSwiping = true;
+ mListView.requestDisallowInterceptTouchEvent(true);
+ mBackgroundContainer.showBackground(v.getTop(), v.getHeight());
+ }
+ }
+ if (mSwiping) {
+ setSwipePosition(v, deltaX);
+ }
+ }
+ break;
+ case MotionEvent.ACTION_UP:
+ {
+ if (mAnimating) {
+ return true;
+ }
+ // User let go - figure out whether to animate the view out, or back into place
+ if (mSwiping) {
+ float x = event.getX();
+ if (isRuntimePostGingerbread()) {
+ x += v.getTranslationX();
+ }
+ float deltaX = x - mDownX;
+ float deltaXAbs = Math.abs(deltaX);
+ float fractionCovered;
+ float endX;
+ final boolean remove;
+ if (deltaXAbs > v.getWidth() / 4) {
+ // Greater than a quarter of the width - animate it out
+ fractionCovered = deltaXAbs / v.getWidth();
+ endX = deltaX < 0 ? -v.getWidth() : v.getWidth();
+ remove = true;
+ } else {
+ // Not far enough - animate it back
+ fractionCovered = 1 - (deltaXAbs / v.getWidth());
+ endX = 0;
+ remove = false;
+ }
+ // Animate position and alpha
+ long duration = (int) ((1 - fractionCovered) * SWIPE_DURATION);
+ animateSwipe(v, endX, duration, remove);
+ } else {
+ mItemPressed = false;
+ }
+ }
+ break;
+ default:
+ return false;
+ }
+ return true;
+ }
+ };
+
+ /**
+ * Animates a swipe of the item either back into place or out of the listview container.
+ * NOTE: This is a simplified version of swipe behavior, for the purposes of this demo
+ * about animation. A real version should use velocity (via the VelocityTracker class)
+ * to send the item off or back at an appropriate speed.
+ */
+ @SuppressLint("NewApi")
+ private void animateSwipe(final View view, float endX, long duration, final boolean remove) {
+ mAnimating = true;
+ mListView.setEnabled(false);
+ if (isRuntimePostGingerbread()) {
+ view.animate().setDuration(duration).
+ alpha(remove ? 0 : 1).translationX(endX).
+ setListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ // Restore animated values
+ view.setAlpha(1);
+ view.setTranslationX(0);
+ if (remove) {
+ animateOtherViews(mListView, view);
+ } else {
+ mBackgroundContainer.hideBackground();
+ mSwiping = false;
+ mAnimating = false;
+ mListView.setEnabled(true);
+ }
+ mItemPressed = false;
+ }
+ });
+ } else {
+ TranslateAnimation swipeAnim = new TranslateAnimation(mCurrentX, endX, 0, 0);
+ AlphaAnimation alphaAnim = new AlphaAnimation(mCurrentAlpha, remove ? 0 : 1);
+ AnimationSet set = new AnimationSet(true);
+ set.addAnimation(swipeAnim);
+ set.addAnimation(alphaAnim);
+ set.setDuration(duration);
+ view.startAnimation(set);
+ setAnimationEndAction(set, new Runnable() {
+ @Override
+ public void run() {
+ if (remove) {
+ animateOtherViews(mListView, view);
+ } else {
+ mBackgroundContainer.hideBackground();
+ mSwiping = false;
+ mAnimating = false;
+ mListView.setEnabled(true);
+ }
+ mItemPressed = false;
+ }
+ });
+ }
+
+ }
+
+ /**
+ * Sets the horizontal position and translucency of the view being swiped.
+ */
+ @SuppressLint("NewApi")
+ private void setSwipePosition(View view, float deltaX) {
+ float fraction = Math.abs(deltaX) / view.getWidth();
+ if (isRuntimePostGingerbread()) {
+ view.setTranslationX(deltaX);
+ view.setAlpha(1 - fraction);
+ } else {
+ // Hello, Gingerbread!
+ TranslateAnimation swipeAnim = new TranslateAnimation(deltaX, deltaX, 0, 0);
+ mCurrentX = deltaX;
+ mCurrentAlpha = (1 - fraction);
+ AlphaAnimation alphaAnim = new AlphaAnimation(mCurrentAlpha, mCurrentAlpha);
+ AnimationSet set = new AnimationSet(true);
+ set.addAnimation(swipeAnim);
+ set.addAnimation(alphaAnim);
+ set.setFillAfter(true);
+ set.setFillEnabled(true);
+ view.startAnimation(set);
+ }
+ }
+
+ /**
+ * This method animates all other views in the ListView container (not including ignoreView)
+ * into their final positions. It is called after ignoreView has been removed from the
+ * adapter, but before layout has been run. The approach here is to figure out where
+ * everything is now, then allow layout to run, then figure out where everything is after
+ * layout, and then to run animations between all of those start/end positions.
+ */
+ private void animateOtherViews(final ListView listview, View viewToRemove) {
+ int firstVisiblePosition = listview.getFirstVisiblePosition();
+ for (int i = 0; i < listview.getChildCount(); ++i) {
+ View child = listview.getChildAt(i);
+ int position = firstVisiblePosition + i;
+ long itemId = mAdapter.getItemId(position);
+ if (child != viewToRemove) {
+ mItemIdTopMap.put(itemId, child.getTop());
+ }
+ }
+ // Delete the item from the adapter
+ int position = mListView.getPositionForView(viewToRemove);
+ mAdapter.remove(mAdapter.getItem(position));
+
+ // After layout runs, capture position of all itemIDs, compare to pre-layout
+ // positions, and animate changes
+ final ViewTreeObserver observer = listview.getViewTreeObserver();
+ observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
+ public boolean onPreDraw() {
+ observer.removeOnPreDrawListener(this);
+ boolean firstAnimation = true;
+ int firstVisiblePosition = listview.getFirstVisiblePosition();
+ for (int i = 0; i < listview.getChildCount(); ++i) {
+ final View child = listview.getChildAt(i);
+ int position = firstVisiblePosition + i;
+ long itemId = mAdapter.getItemId(position);
+ Integer startTop = mItemIdTopMap.get(itemId);
+ int top = child.getTop();
+ if (startTop == null) {
+ // Animate new views along with the others. The catch is that they did not
+ // exist in the start state, so we must calculate their starting position
+ // based on whether they're coming in from the bottom (i > 0) or top.
+ int childHeight = child.getHeight() + listview.getDividerHeight();
+ startTop = top + (i > 0 ? childHeight : -childHeight);
+ }
+ int delta = startTop - top;
+ if (delta != 0) {
+ Runnable endAction = firstAnimation ?
+ new Runnable() {
+ public void run() {
+ mBackgroundContainer.hideBackground();
+ mSwiping = false;
+ mAnimating = false;
+ mListView.setEnabled(true);
+ }
+ } :
+ null;
+ firstAnimation = false;
+ moveView(child, 0, 0, delta, 0, endAction);
+ }
+ }
+ mItemIdTopMap.clear();
+ return true;
+ }
+ });
+ }
+
+ /**
+ * Animate a view between start and end X/Y locations, using either old (pre-3.0) or
+ * new animation APIs.
+ */
+ @SuppressLint("NewApi")
+ private void moveView(View view, float startX, float endX, float startY, float endY,
+ Runnable endAction) {
+ final Runnable finalEndAction = endAction;
+ if (isRuntimePostGingerbread()) {
+ view.animate().setDuration(MOVE_DURATION);
+ if (startX != endX) {
+ ObjectAnimator anim = ObjectAnimator.ofFloat(view, View.TRANSLATION_X, startX, endX);
+ anim.setDuration(MOVE_DURATION);
+ anim.start();
+ setAnimatorEndAction(anim, endAction);
+ endAction = null;
+ }
+ if (startY != endY) {
+ ObjectAnimator anim = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y, startY, endY);
+ anim.setDuration(MOVE_DURATION);
+ anim.start();
+ setAnimatorEndAction(anim, endAction);
+ }
+ } else {
+ TranslateAnimation translator = new TranslateAnimation(startX, endX, startY, endY);
+ translator.setDuration(MOVE_DURATION);
+ view.startAnimation(translator);
+ if (endAction != null) {
+ view.getAnimation().setAnimationListener(new AnimationListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animation animation) {
+ finalEndAction.run();
+ }
+ });
+ }
+ }
+ }
+
+ @SuppressLint("NewApi")
+ private void setAnimatorEndAction(Animator animator, final Runnable endAction) {
+ if (endAction != null) {
+ animator.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ endAction.run();
+ }
+ });
+ }
+ }
+
+ private void setAnimationEndAction(Animation animation, final Runnable endAction) {
+ if (endAction != null) {
+ animation.setAnimationListener(new AnimationListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animation animation) {
+ endAction.run();
+ }
+ });
+ }
+ }
+
+ /**
+ * Utility, to avoid having to implement every method in AnimationListener in
+ * every implementation class
+ */
+ static class AnimationListenerAdapter implements AnimationListener {
+
+ @Override
+ public void onAnimationEnd(Animation animation) {
+ }
+
+ @Override
+ public void onAnimationRepeat(Animation animation) {
+ }
+
+ @Override
+ public void onAnimationStart(Animation animation) {
+ }
+ }
+
+}
diff --git a/samples/devbytes/animation/ListViewItemAnimations/src/com/example/android/listviewitemanimations/StableArrayAdapter.java b/samples/devbytes/animation/ListViewItemAnimations/src/com/example/android/listviewitemanimations/StableArrayAdapter.java
new file mode 100644
index 000000000..4bddc5eaa
--- /dev/null
+++ b/samples/devbytes/animation/ListViewItemAnimations/src/com/example/android/listviewitemanimations/StableArrayAdapter.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2013 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.example.android.listviewitemanimations;
+
+import java.util.HashMap;
+import java.util.List;
+
+import android.content.Context;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+
+public class StableArrayAdapter extends ArrayAdapter<String> {
+
+ HashMap<String, Integer> mIdMap = new HashMap<String, Integer>();
+ View.OnTouchListener mTouchListener;
+
+ public StableArrayAdapter(Context context, int textViewResourceId,
+ List<String> objects, View.OnTouchListener listener) {
+ super(context, textViewResourceId, objects);
+ mTouchListener = listener;
+ for (int i = 0; i < objects.size(); ++i) {
+ mIdMap.put(objects.get(i), i);
+ }
+ }
+
+ @Override
+ public long getItemId(int position) {
+ String item = getItem(position);
+ return mIdMap.get(item);
+ }
+
+ @Override
+ public boolean hasStableIds() {
+ return true;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View view = super.getView(position, convertView, parent);
+ if (view != convertView) {
+ // Add touch listener to every new view to track swipe motion
+ view.setOnTouchListener(mTouchListener);
+ }
+ return view;
+ }
+
+}
diff --git a/samples/devbytes/animation/ListViewRemovalAnimation/AndroidManifest.xml b/samples/devbytes/animation/ListViewRemovalAnimation/AndroidManifest.xml
new file mode 100644
index 000000000..f03074726
--- /dev/null
+++ b/samples/devbytes/animation/ListViewRemovalAnimation/AndroidManifest.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.listviewremovalanimation"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="16"
+ android:targetSdkVersion="16" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:theme="@style/WithoutBackground"
+ android:name="com.example.android.listviewremovalanimation.ListViewRemovalAnimation"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
diff --git a/samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-hdpi/ic_launcher.png b/samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..96a442e5b
--- /dev/null
+++ b/samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-mdpi/ic_launcher.png b/samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..359047dfa
--- /dev/null
+++ b/samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-xhdpi/ic_launcher.png b/samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..71c6d760f
--- /dev/null
+++ b/samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-xhdpi/shadowed_background.9.png b/samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-xhdpi/shadowed_background.9.png
new file mode 100644
index 000000000..f905bbc46
--- /dev/null
+++ b/samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-xhdpi/shadowed_background.9.png
Binary files differ
diff --git a/samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-xhdpi/tv_background_with_divider.9.png b/samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-xhdpi/tv_background_with_divider.9.png
new file mode 100644
index 000000000..e6e3cd58d
--- /dev/null
+++ b/samples/devbytes/animation/ListViewRemovalAnimation/res/drawable-xhdpi/tv_background_with_divider.9.png
Binary files differ
diff --git a/samples/devbytes/animation/ListViewRemovalAnimation/res/layout/activity_list_view_deletion.xml b/samples/devbytes/animation/ListViewRemovalAnimation/res/layout/activity_list_view_deletion.xml
new file mode 100644
index 000000000..26aa1230a
--- /dev/null
+++ b/samples/devbytes/animation/ListViewRemovalAnimation/res/layout/activity_list_view_deletion.xml
@@ -0,0 +1,37 @@
+<!-- Copyright (C) 2013 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".ListViewAnimations" >
+
+ <view
+ class="com.example.android.listviewremovalanimation.BackgroundContainer"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/listViewBackground">
+
+ <ListView
+ android:id="@+id/listview"
+ android:divider="@null"
+ android:dividerHeight="0dp"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ </view>
+
+</LinearLayout>
diff --git a/samples/devbytes/animation/ListViewRemovalAnimation/res/layout/opaque_text_view.xml b/samples/devbytes/animation/ListViewRemovalAnimation/res/layout/opaque_text_view.xml
new file mode 100644
index 000000000..c37f62d31
--- /dev/null
+++ b/samples/devbytes/animation/ListViewRemovalAnimation/res/layout/opaque_text_view.xml
@@ -0,0 +1,24 @@
+<!-- Copyright (C) 2013 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.
+-->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/tv_background_with_divider"
+ android:textAppearance="?android:attr/textAppearanceListItemSmall"
+ android:gravity="center_vertical"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
+/>
diff --git a/samples/devbytes/animation/ListViewRemovalAnimation/res/values-v11/styles.xml b/samples/devbytes/animation/ListViewRemovalAnimation/res/values-v11/styles.xml
new file mode 100644
index 000000000..139d283c1
--- /dev/null
+++ b/samples/devbytes/animation/ListViewRemovalAnimation/res/values-v11/styles.xml
@@ -0,0 +1,25 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!--
+ Base application theme for API 11+. This theme completely replaces
+ AppBaseTheme from res/values/styles.xml on API 11+ devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
+ <!-- API 11 theme customizations can go here. -->
+ </style>
+
+</resources>
diff --git a/samples/devbytes/animation/ListViewRemovalAnimation/res/values-v14/styles.xml b/samples/devbytes/animation/ListViewRemovalAnimation/res/values-v14/styles.xml
new file mode 100644
index 000000000..8ac452213
--- /dev/null
+++ b/samples/devbytes/animation/ListViewRemovalAnimation/res/values-v14/styles.xml
@@ -0,0 +1,26 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!--
+ Base application theme for API 14+. This theme completely replaces
+ AppBaseTheme from BOTH res/values/styles.xml and
+ res/values-v11/styles.xml on API 14+ devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+ <!-- API 14 theme customizations can go here. -->
+ </style>
+
+</resources>
diff --git a/samples/devbytes/animation/ListViewRemovalAnimation/res/values/strings.xml b/samples/devbytes/animation/ListViewRemovalAnimation/res/values/strings.xml
new file mode 100644
index 000000000..71256184e
--- /dev/null
+++ b/samples/devbytes/animation/ListViewRemovalAnimation/res/values/strings.xml
@@ -0,0 +1,21 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <string name="app_name">ListViewRemovalAnimation</string>
+ <string name="use_positions">Use Positions</string>
+ <string name="delete_selected">Delete Selected</string>
+
+</resources>
diff --git a/samples/devbytes/animation/ListViewRemovalAnimation/res/values/styles.xml b/samples/devbytes/animation/ListViewRemovalAnimation/res/values/styles.xml
new file mode 100644
index 000000000..c7f2e7966
--- /dev/null
+++ b/samples/devbytes/animation/ListViewRemovalAnimation/res/values/styles.xml
@@ -0,0 +1,37 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!--
+ Base application theme, dependent on API level. This theme is replaced
+ by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Light">
+ <!--
+ Theme customizations available in newer API levels can go in
+ res/values-vXX/styles.xml, while customizations related to
+ backward-compatibility can go here.
+ -->
+ </style>
+
+ <!-- Application theme. -->
+ <style name="AppTheme" parent="AppBaseTheme">
+ <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+ </style>
+
+ <style name="WithoutBackground" parent="AppTheme">
+ <item name="android:windowBackground">@null</item>
+ </style>
+</resources>
diff --git a/samples/devbytes/animation/ListViewRemovalAnimation/src/com/example/android/listviewremovalanimation/BackgroundContainer.java b/samples/devbytes/animation/ListViewRemovalAnimation/src/com/example/android/listviewremovalanimation/BackgroundContainer.java
new file mode 100644
index 000000000..1d0e806fa
--- /dev/null
+++ b/samples/devbytes/animation/ListViewRemovalAnimation/src/com/example/android/listviewremovalanimation/BackgroundContainer.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2013 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.example.android.listviewremovalanimation;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.widget.FrameLayout;
+
+public class BackgroundContainer extends FrameLayout {
+
+ boolean mShowing = false;
+ Drawable mShadowedBackground;
+ int mOpenAreaTop, mOpenAreaBottom, mOpenAreaHeight;
+ boolean mUpdateBounds = false;
+
+ public BackgroundContainer(Context context) {
+ super(context);
+ init();
+ }
+
+ public BackgroundContainer(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init();
+ }
+
+ public BackgroundContainer(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ init();
+ }
+
+ private void init() {
+ mShadowedBackground =
+ getContext().getResources().getDrawable(R.drawable.shadowed_background);
+ }
+
+ public void showBackground(int top, int bottom) {
+ setWillNotDraw(false);
+ mOpenAreaTop = top;
+ mOpenAreaHeight = bottom;
+ mShowing = true;
+ mUpdateBounds = true;
+ }
+
+ public void hideBackground() {
+ setWillNotDraw(true);
+ mShowing = false;
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ if (mShowing) {
+ if (mUpdateBounds) {
+ mShadowedBackground.setBounds(0, 0, getWidth(), mOpenAreaHeight);
+ }
+ canvas.save();
+ canvas.translate(0, mOpenAreaTop);
+ mShadowedBackground.draw(canvas);
+ canvas.restore();
+ }
+ }
+
+}
diff --git a/samples/devbytes/animation/ListViewRemovalAnimation/src/com/example/android/listviewremovalanimation/Cheeses.java b/samples/devbytes/animation/ListViewRemovalAnimation/src/com/example/android/listviewremovalanimation/Cheeses.java
new file mode 100644
index 000000000..4f4b88bc1
--- /dev/null
+++ b/samples/devbytes/animation/ListViewRemovalAnimation/src/com/example/android/listviewremovalanimation/Cheeses.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2013 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.example.android.listviewremovalanimation;
+
+public class Cheeses {
+
+ public static final String[] sCheeseStrings = {
+ "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "Abondance", "Ackawi",
+ "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale",
+ "Aisy Cendre", "Allgauer Emmentaler", "Alverca", "Ambert", "American Cheese",
+ "Ami du Chambertin", "Anejo Enchilado", "Anneau du Vic-Bilh", "Anthoriro", "Appenzell",
+ "Aragon", "Ardi Gasna", "Ardrahan", "Armenian String", "Aromes au Gene de Marc",
+ "Asadero", "Asiago", "Aubisque Pyrenees", "Autun", "Avaxtskyr", "Baby Swiss",
+ "Babybel", "Baguette Laonnaise", "Bakers", "Baladi", "Balaton", "Bandal", "Banon",
+ "Barry's Bay Cheddar", "Basing", "Basket Cheese", "Bath Cheese", "Bavarian Bergkase",
+ "Baylough", "Beaufort", "Beauvoorde", "Beenleigh Blue", "Beer Cheese", "Bel Paese",
+ "Bergader", "Bergere Bleue", "Berkswell", "Beyaz Peynir", "Bierkase", "Bishop Kennedy",
+ "Blarney", "Bleu d'Auvergne", "Bleu de Gex", "Bleu de Laqueuille",
+ "Bleu de Septmoncel", "Bleu Des Causses", "Blue", "Blue Castello", "Blue Rathgore",
+ "Blue Vein (Australian)", "Blue Vein Cheeses", "Bocconcini", "Bocconcini (Australian)",
+ "Boeren Leidenkaas", "Bonchester", "Bosworth", "Bougon", "Boule Du Roves",
+ "Boulette d'Avesnes", "Boursault", "Boursin", "Bouyssou", "Bra", "Braudostur",
+ "Breakfast Cheese", "Brebis du Lavort", "Brebis du Lochois", "Brebis du Puyfaucon",
+ "Bresse Bleu", "Brick", "Brie", "Brie de Meaux", "Brie de Melun", "Brillat-Savarin",
+ "Brin", "Brin d' Amour", "Brin d'Amour", "Brinza (Burduf Brinza)",
+ "Briquette de Brebis", "Briquette du Forez", "Broccio", "Broccio Demi-Affine",
+ "Brousse du Rove", "Bruder Basil", "Brusselae Kaas (Fromage de Bruxelles)", "Bryndza",
+ "Buchette d'Anjou", "Buffalo", "Burgos", "Butte", "Butterkase", "Button (Innes)",
+ "Buxton Blue", "Cabecou", "Caboc", "Cabrales", "Cachaille", "Caciocavallo", "Caciotta",
+ "Caerphilly", "Cairnsmore", "Calenzana", "Cambazola", "Camembert de Normandie",
+ "Canadian Cheddar", "Canestrato", "Cantal", "Caprice des Dieux", "Capricorn Goat",
+ "Capriole Banon", "Carre de l'Est", "Casciotta di Urbino", "Cashel Blue", "Castellano",
+ "Castelleno", "Castelmagno", "Castelo Branco", "Castigliano", "Cathelain",
+ "Celtic Promise", "Cendre d'Olivet", "Cerney", "Chabichou", "Chabichou du Poitou",
+ "Chabis de Gatine", "Chaource", "Charolais", "Chaumes", "Cheddar",
+ "Cheddar Clothbound", "Cheshire", "Chevres", "Chevrotin des Aravis", "Chontaleno",
+ "Civray", "Coeur de Camembert au Calvados", "Coeur de Chevre", "Colby", "Cold Pack",
+ "Comte", "Coolea", "Cooleney", "Coquetdale", "Corleggy", "Cornish Pepper",
+ "Cotherstone", "Cotija", "Cottage Cheese", "Cottage Cheese (Australian)",
+ "Cougar Gold", "Coulommiers", "Coverdale", "Crayeux de Roncq", "Cream Cheese",
+ "Cream Havarti", "Crema Agria", "Crema Mexicana", "Creme Fraiche", "Crescenza",
+ "Croghan", "Crottin de Chavignol", "Crottin du Chavignol", "Crowdie", "Crowley",
+ "Cuajada", "Curd", "Cure Nantais", "Curworthy", "Cwmtawe Pecorino",
+ "Cypress Grove Chevre", "Danablu (Danish Blue)", "Danbo", "Danish Fontina",
+ "Daralagjazsky", "Dauphin", "Delice des Fiouves", "Denhany Dorset Drum", "Derby",
+ "Dessertnyj Belyj", "Devon Blue", "Devon Garland", "Dolcelatte", "Doolin",
+ "Doppelrhamstufel", "Dorset Blue Vinney", "Double Gloucester", "Double Worcester",
+ "Dreux a la Feuille", "Dry Jack", "Duddleswell", "Dunbarra", "Dunlop", "Dunsyre Blue",
+ "Duroblando", "Durrus", "Dutch Mimolette (Commissiekaas)", "Edam", "Edelpilz",
+ "Emental Grand Cru", "Emlett", "Emmental", "Epoisses de Bourgogne", "Esbareich",
+ "Esrom", "Etorki", "Evansdale Farmhouse Brie", "Evora De L'Alentejo", "Exmoor Blue",
+ "Explorateur", "Feta", "Feta (Australian)", "Figue", "Filetta", "Fin-de-Siecle",
+ "Finlandia Swiss", "Finn", "Fiore Sardo", "Fleur du Maquis", "Flor de Guia",
+ "Flower Marie", "Folded", "Folded cheese with mint", "Fondant de Brebis",
+ "Fontainebleau", "Fontal", "Fontina Val d'Aosta", "Formaggio di capra", "Fougerus",
+ "Four Herb Gouda", "Fourme d' Ambert", "Fourme de Haute Loire", "Fourme de Montbrison",
+ "Fresh Jack", "Fresh Mozzarella", "Fresh Ricotta", "Fresh Truffles", "Fribourgeois",
+ "Friesekaas", "Friesian", "Friesla", "Frinault", "Fromage a Raclette", "Fromage Corse",
+ "Fromage de Montagne de Savoie", "Fromage Frais", "Fruit Cream Cheese",
+ "Frying Cheese", "Fynbo", "Gabriel", "Galette du Paludier", "Galette Lyonnaise",
+ "Galloway Goat's Milk Gems", "Gammelost", "Gaperon a l'Ail", "Garrotxa", "Gastanberra",
+ "Geitost", "Gippsland Blue", "Gjetost", "Gloucester", "Golden Cross", "Gorgonzola",
+ "Gornyaltajski", "Gospel Green", "Gouda", "Goutu", "Gowrie", "Grabetto", "Graddost",
+ "Grafton Village Cheddar", "Grana", "Grana Padano", "Grand Vatel",
+ "Grataron d' Areches", "Gratte-Paille", "Graviera", "Greuilh", "Greve",
+ "Gris de Lille", "Gruyere", "Gubbeen", "Guerbigny", "Halloumi",
+ "Halloumy (Australian)", "Haloumi-Style Cheese", "Harbourne Blue", "Havarti",
+ "Heidi Gruyere", "Hereford Hop", "Herrgardsost", "Herriot Farmhouse", "Herve",
+ "Hipi Iti", "Hubbardston Blue Cow", "Hushallsost", "Iberico", "Idaho Goatster",
+ "Idiazabal", "Il Boschetto al Tartufo", "Ile d'Yeu", "Isle of Mull", "Jarlsberg",
+ "Jermi Tortes", "Jibneh Arabieh", "Jindi Brie", "Jubilee Blue", "Juustoleipa",
+ "Kadchgall", "Kaseri", "Kashta", "Kefalotyri", "Kenafa", "Kernhem", "Kervella Affine",
+ "Kikorangi", "King Island Cape Wickham Brie", "King River Gold", "Klosterkaese",
+ "Knockalara", "Kugelkase", "L'Aveyronnais", "L'Ecir de l'Aubrac", "La Taupiniere",
+ "La Vache Qui Rit", "Laguiole", "Lairobell", "Lajta", "Lanark Blue", "Lancashire",
+ "Langres", "Lappi", "Laruns", "Lavistown", "Le Brin", "Le Fium Orbo", "Le Lacandou",
+ "Le Roule", "Leafield", "Lebbene", "Leerdammer", "Leicester", "Leyden", "Limburger",
+ "Lincolnshire Poacher", "Lingot Saint Bousquet d'Orb", "Liptauer", "Little Rydings",
+ "Livarot", "Llanboidy", "Llanglofan Farmhouse", "Loch Arthur Farmhouse",
+ "Loddiswell Avondale", "Longhorn", "Lou Palou", "Lou Pevre", "Lyonnais", "Maasdam",
+ "Macconais", "Mahoe Aged Gouda", "Mahon", "Malvern", "Mamirolle", "Manchego",
+ "Manouri", "Manur", "Marble Cheddar", "Marbled Cheeses", "Maredsous", "Margotin",
+ "Maribo", "Maroilles", "Mascares", "Mascarpone", "Mascarpone (Australian)",
+ "Mascarpone Torta", "Matocq", "Maytag Blue", "Meira", "Menallack Farmhouse",
+ "Menonita", "Meredith Blue", "Mesost", "Metton (Cancoillotte)", "Meyer Vintage Gouda",
+ "Mihalic Peynir", "Milleens", "Mimolette", "Mine-Gabhar", "Mini Baby Bells", "Mixte",
+ "Molbo", "Monastery Cheeses", "Mondseer", "Mont D'or Lyonnais", "Montasio",
+ "Monterey Jack", "Monterey Jack Dry", "Morbier", "Morbier Cru de Montagne",
+ "Mothais a la Feuille", "Mozzarella", "Mozzarella (Australian)",
+ "Mozzarella di Bufala", "Mozzarella Fresh, in water", "Mozzarella Rolls", "Munster",
+ "Murol", "Mycella", "Myzithra", "Naboulsi", "Nantais", "Neufchatel",
+ "Neufchatel (Australian)", "Niolo", "Nokkelost", "Northumberland", "Oaxaca",
+ "Olde York", "Olivet au Foin", "Olivet Bleu", "Olivet Cendre",
+ "Orkney Extra Mature Cheddar", "Orla", "Oschtjepka", "Ossau Fermier", "Ossau-Iraty",
+ "Oszczypek", "Oxford Blue", "P'tit Berrichon", "Palet de Babligny", "Paneer", "Panela",
+ "Pannerone", "Pant ys Gawn", "Parmesan (Parmigiano)", "Parmigiano Reggiano",
+ "Pas de l'Escalette", "Passendale", "Pasteurized Processed", "Pate de Fromage",
+ "Patefine Fort", "Pave d'Affinois", "Pave d'Auge", "Pave de Chirac", "Pave du Berry",
+ "Pecorino", "Pecorino in Walnut Leaves", "Pecorino Romano", "Peekskill Pyramid",
+ "Pelardon des Cevennes", "Pelardon des Corbieres", "Penamellera", "Penbryn",
+ "Pencarreg", "Perail de Brebis", "Petit Morin", "Petit Pardou", "Petit-Suisse",
+ "Picodon de Chevre", "Picos de Europa", "Piora", "Pithtviers au Foin",
+ "Plateau de Herve", "Plymouth Cheese", "Podhalanski", "Poivre d'Ane", "Polkolbin",
+ "Pont l'Eveque", "Port Nicholson", "Port-Salut", "Postel", "Pouligny-Saint-Pierre",
+ "Pourly", "Prastost", "Pressato", "Prince-Jean", "Processed Cheddar", "Provolone",
+ "Provolone (Australian)", "Pyengana Cheddar", "Pyramide", "Quark",
+ "Quark (Australian)", "Quartirolo Lombardo", "Quatre-Vents", "Quercy Petit",
+ "Queso Blanco", "Queso Blanco con Frutas --Pina y Mango", "Queso de Murcia",
+ "Queso del Montsec", "Queso del Tietar", "Queso Fresco", "Queso Fresco (Adobera)",
+ "Queso Iberico", "Queso Jalapeno", "Queso Majorero", "Queso Media Luna",
+ "Queso Para Frier", "Queso Quesadilla", "Rabacal", "Raclette", "Ragusano", "Raschera",
+ "Reblochon", "Red Leicester", "Regal de la Dombes", "Reggianito", "Remedou",
+ "Requeson", "Richelieu", "Ricotta", "Ricotta (Australian)", "Ricotta Salata", "Ridder",
+ "Rigotte", "Rocamadour", "Rollot", "Romano", "Romans Part Dieu", "Roncal", "Roquefort",
+ "Roule", "Rouleau De Beaulieu", "Royalp Tilsit", "Rubens", "Rustinu", "Saaland Pfarr",
+ "Saanenkaese", "Saga", "Sage Derby", "Sainte Maure", "Saint-Marcellin",
+ "Saint-Nectaire", "Saint-Paulin", "Salers", "Samso", "San Simon", "Sancerre",
+ "Sap Sago", "Sardo", "Sardo Egyptian", "Sbrinz", "Scamorza", "Schabzieger", "Schloss",
+ "Selles sur Cher", "Selva", "Serat", "Seriously Strong Cheddar", "Serra da Estrela",
+ "Sharpam", "Shelburne Cheddar", "Shropshire Blue", "Siraz", "Sirene", "Smoked Gouda",
+ "Somerset Brie", "Sonoma Jack", "Sottocenare al Tartufo", "Soumaintrain",
+ "Sourire Lozerien", "Spenwood", "Sraffordshire Organic", "St. Agur Blue Cheese",
+ "Stilton", "Stinking Bishop", "String", "Sussex Slipcote", "Sveciaost", "Swaledale",
+ "Sweet Style Swiss", "Swiss", "Syrian (Armenian String)", "Tala", "Taleggio", "Tamie",
+ "Tasmania Highland Chevre Log", "Taupiniere", "Teifi", "Telemea", "Testouri",
+ "Tete de Moine", "Tetilla", "Texas Goat Cheese", "Tibet", "Tillamook Cheddar",
+ "Tilsit", "Timboon Brie", "Toma", "Tomme Brulee", "Tomme d'Abondance",
+ "Tomme de Chevre", "Tomme de Romans", "Tomme de Savoie", "Tomme des Chouans", "Tommes",
+ "Torta del Casar", "Toscanello", "Touree de L'Aubier", "Tourmalet",
+ "Trappe (Veritable)", "Trois Cornes De Vendee", "Tronchon", "Trou du Cru", "Truffe",
+ "Tupi", "Turunmaa", "Tymsboro", "Tyn Grug", "Tyning", "Ubriaco", "Ulloa",
+ "Vacherin-Fribourgeois", "Valencay", "Vasterbottenost", "Venaco", "Vendomois",
+ "Vieux Corse", "Vignotte", "Vulscombe", "Waimata Farmhouse Blue",
+ "Washed Rind Cheese (Australian)", "Waterloo", "Weichkaese", "Wellington",
+ "Wensleydale", "White Stilton", "Whitestone Farmhouse", "Wigmore", "Woodside Cabecou",
+ "Xanadu", "Xynotyro", "Yarg Cornish", "Yarra Valley Pyramid", "Yorkshire Blue",
+ "Zamorano", "Zanetti Grana Padano", "Zanetti Parmigiano Reggiano"
+ };
+
+}
diff --git a/samples/devbytes/animation/ListViewRemovalAnimation/src/com/example/android/listviewremovalanimation/ListViewRemovalAnimation.java b/samples/devbytes/animation/ListViewRemovalAnimation/src/com/example/android/listviewremovalanimation/ListViewRemovalAnimation.java
new file mode 100644
index 000000000..1e3ee8c44
--- /dev/null
+++ b/samples/devbytes/animation/ListViewRemovalAnimation/src/com/example/android/listviewremovalanimation/ListViewRemovalAnimation.java
@@ -0,0 +1,248 @@
+/*
+ * Copyright (C) 2013 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.example.android.listviewremovalanimation;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewConfiguration;
+import android.view.ViewTreeObserver;
+import android.widget.ListView;
+
+/**
+ * This example shows how to use a swipe effect to remove items from a ListView,
+ * and how to use animations to complete the swipe as well as to animate the other
+ * items in the list into their final places.
+ *
+ * Watch the associated video for this demo on the DevBytes channel of developer.android.com
+ * or on YouTube at https://www.youtube.com/watch?v=NewCSg2JKLk.
+ */
+public class ListViewRemovalAnimation extends Activity {
+
+ StableArrayAdapter mAdapter;
+ ListView mListView;
+ BackgroundContainer mBackgroundContainer;
+ boolean mSwiping = false;
+ boolean mItemPressed = false;
+ HashMap<Long, Integer> mItemIdTopMap = new HashMap<Long, Integer>();
+
+ private static final int SWIPE_DURATION = 250;
+ private static final int MOVE_DURATION = 150;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_list_view_deletion);
+
+ mBackgroundContainer = (BackgroundContainer) findViewById(R.id.listViewBackground);
+ mListView = (ListView) findViewById(R.id.listview);
+ android.util.Log.d("Debug", "d=" + mListView.getDivider());
+ final ArrayList<String> cheeseList = new ArrayList<String>();
+ for (int i = 0; i < Cheeses.sCheeseStrings.length; ++i) {
+ cheeseList.add(Cheeses.sCheeseStrings[i]);
+ }
+ mAdapter = new StableArrayAdapter(this,R.layout.opaque_text_view, cheeseList,
+ mTouchListener);
+ mListView.setAdapter(mAdapter);
+ }
+
+ /**
+ * Handle touch events to fade/move dragged items as they are swiped out
+ */
+ private View.OnTouchListener mTouchListener = new View.OnTouchListener() {
+
+ float mDownX;
+ private int mSwipeSlop = -1;
+
+ @Override
+ public boolean onTouch(final View v, MotionEvent event) {
+ if (mSwipeSlop < 0) {
+ mSwipeSlop = ViewConfiguration.get(ListViewRemovalAnimation.this).
+ getScaledTouchSlop();
+ }
+ switch (event.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ if (mItemPressed) {
+ // Multi-item swipes not handled
+ return false;
+ }
+ mItemPressed = true;
+ mDownX = event.getX();
+ break;
+ case MotionEvent.ACTION_CANCEL:
+ v.setAlpha(1);
+ v.setTranslationX(0);
+ mItemPressed = false;
+ break;
+ case MotionEvent.ACTION_MOVE:
+ {
+ float x = event.getX() + v.getTranslationX();
+ float deltaX = x - mDownX;
+ float deltaXAbs = Math.abs(deltaX);
+ if (!mSwiping) {
+ if (deltaXAbs > mSwipeSlop) {
+ mSwiping = true;
+ mListView.requestDisallowInterceptTouchEvent(true);
+ mBackgroundContainer.showBackground(v.getTop(), v.getHeight());
+ }
+ }
+ if (mSwiping) {
+ v.setTranslationX((x - mDownX));
+ v.setAlpha(1 - deltaXAbs / v.getWidth());
+ }
+ }
+ break;
+ case MotionEvent.ACTION_UP:
+ {
+ // User let go - figure out whether to animate the view out, or back into place
+ if (mSwiping) {
+ float x = event.getX() + v.getTranslationX();
+ float deltaX = x - mDownX;
+ float deltaXAbs = Math.abs(deltaX);
+ float fractionCovered;
+ float endX;
+ float endAlpha;
+ final boolean remove;
+ if (deltaXAbs > v.getWidth() / 4) {
+ // Greater than a quarter of the width - animate it out
+ fractionCovered = deltaXAbs / v.getWidth();
+ endX = deltaX < 0 ? -v.getWidth() : v.getWidth();
+ endAlpha = 0;
+ remove = true;
+ } else {
+ // Not far enough - animate it back
+ fractionCovered = 1 - (deltaXAbs / v.getWidth());
+ endX = 0;
+ endAlpha = 1;
+ remove = false;
+ }
+ // Animate position and alpha of swiped item
+ // NOTE: This is a simplified version of swipe behavior, for the
+ // purposes of this demo about animation. A real version should use
+ // velocity (via the VelocityTracker class) to send the item off or
+ // back at an appropriate speed.
+ long duration = (int) ((1 - fractionCovered) * SWIPE_DURATION);
+ mListView.setEnabled(false);
+ v.animate().setDuration(duration).
+ alpha(endAlpha).translationX(endX).
+ withEndAction(new Runnable() {
+ @Override
+ public void run() {
+ // Restore animated values
+ v.setAlpha(1);
+ v.setTranslationX(0);
+ if (remove) {
+ animateRemoval(mListView, v);
+ } else {
+ mBackgroundContainer.hideBackground();
+ mSwiping = false;
+ mListView.setEnabled(true);
+ }
+ }
+ });
+ }
+ }
+ mItemPressed = false;
+ break;
+ default:
+ return false;
+ }
+ return true;
+ }
+ };
+
+ /**
+ * This method animates all other views in the ListView container (not including ignoreView)
+ * into their final positions. It is called after ignoreView has been removed from the
+ * adapter, but before layout has been run. The approach here is to figure out where
+ * everything is now, then allow layout to run, then figure out where everything is after
+ * layout, and then to run animations between all of those start/end positions.
+ */
+ private void animateRemoval(final ListView listview, View viewToRemove) {
+ int firstVisiblePosition = listview.getFirstVisiblePosition();
+ for (int i = 0; i < listview.getChildCount(); ++i) {
+ View child = listview.getChildAt(i);
+ if (child != viewToRemove) {
+ int position = firstVisiblePosition + i;
+ long itemId = mAdapter.getItemId(position);
+ mItemIdTopMap.put(itemId, child.getTop());
+ }
+ }
+ // Delete the item from the adapter
+ int position = mListView.getPositionForView(viewToRemove);
+ mAdapter.remove(mAdapter.getItem(position));
+
+ final ViewTreeObserver observer = listview.getViewTreeObserver();
+ observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
+ public boolean onPreDraw() {
+ observer.removeOnPreDrawListener(this);
+ boolean firstAnimation = true;
+ int firstVisiblePosition = listview.getFirstVisiblePosition();
+ for (int i = 0; i < listview.getChildCount(); ++i) {
+ final View child = listview.getChildAt(i);
+ int position = firstVisiblePosition + i;
+ long itemId = mAdapter.getItemId(position);
+ Integer startTop = mItemIdTopMap.get(itemId);
+ int top = child.getTop();
+ if (startTop != null) {
+ if (startTop != top) {
+ int delta = startTop - top;
+ child.setTranslationY(delta);
+ child.animate().setDuration(MOVE_DURATION).translationY(0);
+ if (firstAnimation) {
+ child.animate().withEndAction(new Runnable() {
+ public void run() {
+ mBackgroundContainer.hideBackground();
+ mSwiping = false;
+ mListView.setEnabled(true);
+ }
+ });
+ firstAnimation = false;
+ }
+ }
+ } else {
+ // Animate new views along with the others. The catch is that they did not
+ // exist in the start state, so we must calculate their starting position
+ // based on neighboring views.
+ int childHeight = child.getHeight() + listview.getDividerHeight();
+ startTop = top + (i > 0 ? childHeight : -childHeight);
+ int delta = startTop - top;
+ child.setTranslationY(delta);
+ child.animate().setDuration(MOVE_DURATION).translationY(0);
+ if (firstAnimation) {
+ child.animate().withEndAction(new Runnable() {
+ public void run() {
+ mBackgroundContainer.hideBackground();
+ mSwiping = false;
+ mListView.setEnabled(true);
+ }
+ });
+ firstAnimation = false;
+ }
+ }
+ }
+ mItemIdTopMap.clear();
+ return true;
+ }
+ });
+ }
+
+}
diff --git a/samples/devbytes/animation/ListViewRemovalAnimation/src/com/example/android/listviewremovalanimation/StableArrayAdapter.java b/samples/devbytes/animation/ListViewRemovalAnimation/src/com/example/android/listviewremovalanimation/StableArrayAdapter.java
new file mode 100644
index 000000000..948676e7e
--- /dev/null
+++ b/samples/devbytes/animation/ListViewRemovalAnimation/src/com/example/android/listviewremovalanimation/StableArrayAdapter.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2013 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.example.android.listviewremovalanimation;
+
+import java.util.HashMap;
+import java.util.List;
+
+import android.content.Context;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+
+public class StableArrayAdapter extends ArrayAdapter<String> {
+
+ HashMap<String, Integer> mIdMap = new HashMap<String, Integer>();
+ View.OnTouchListener mTouchListener;
+
+ public StableArrayAdapter(Context context, int textViewResourceId,
+ List<String> objects, View.OnTouchListener listener) {
+ super(context, textViewResourceId, objects);
+ mTouchListener = listener;
+ for (int i = 0; i < objects.size(); ++i) {
+ mIdMap.put(objects.get(i), i);
+ }
+ }
+
+ @Override
+ public long getItemId(int position) {
+ String item = getItem(position);
+ return mIdMap.get(item);
+ }
+
+ @Override
+ public boolean hasStableIds() {
+ return true;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View view = super.getView(position, convertView, parent);
+ if (view != convertView) {
+ // Add touch listener to every new view to track swipe motion
+ view.setOnTouchListener(mTouchListener);
+ }
+ return view;
+ }
+
+}
diff --git a/samples/devbytes/animation/LiveButton/AndroidManifest.xml b/samples/devbytes/animation/LiveButton/AndroidManifest.xml
new file mode 100644
index 000000000..280c2f8e3
--- /dev/null
+++ b/samples/devbytes/animation/LiveButton/AndroidManifest.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.livebutton"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="14"
+ android:targetSdkVersion="17" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name="com.example.android.livebutton.LiveButton"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest> \ No newline at end of file
diff --git a/samples/devbytes/animation/LiveButton/res/drawable-hdpi/ic_launcher.png b/samples/devbytes/animation/LiveButton/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..96a442e5b
--- /dev/null
+++ b/samples/devbytes/animation/LiveButton/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/LiveButton/res/drawable-mdpi/ic_launcher.png b/samples/devbytes/animation/LiveButton/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..359047dfa
--- /dev/null
+++ b/samples/devbytes/animation/LiveButton/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/LiveButton/res/drawable-xhdpi/ic_launcher.png b/samples/devbytes/animation/LiveButton/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..71c6d760f
--- /dev/null
+++ b/samples/devbytes/animation/LiveButton/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/LiveButton/res/layout/activity_overshoot.xml b/samples/devbytes/animation/LiveButton/res/layout/activity_overshoot.xml
new file mode 100644
index 000000000..6900650e1
--- /dev/null
+++ b/samples/devbytes/animation/LiveButton/res/layout/activity_overshoot.xml
@@ -0,0 +1,29 @@
+<!-- Copyright (C) 2013 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.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".LiveButton" >
+
+ <Button
+ android:id="@+id/clickMe"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerHorizontal="true"
+ android:layout_centerVertical="true"
+ android:text="Click me!" />
+
+</RelativeLayout> \ No newline at end of file
diff --git a/samples/devbytes/animation/LiveButton/res/values-v14/styles.xml b/samples/devbytes/animation/LiveButton/res/values-v14/styles.xml
new file mode 100644
index 000000000..6e9521a16
--- /dev/null
+++ b/samples/devbytes/animation/LiveButton/res/values-v14/styles.xml
@@ -0,0 +1,26 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!--
+ Base application theme for API 14+. This theme completely replaces
+ AppBaseTheme from BOTH res/values/styles.xml and
+ res/values-v11/styles.xml on API 14+ devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+ <!-- API 14 theme customizations can go here. -->
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/LiveButton/res/values/strings.xml b/samples/devbytes/animation/LiveButton/res/values/strings.xml
new file mode 100644
index 000000000..5c5ff1757
--- /dev/null
+++ b/samples/devbytes/animation/LiveButton/res/values/strings.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <string name="app_name">LiveButton</string>
+ <string name="hello_world">Hello world!</string>
+ <string name="menu_settings">Settings</string>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/LiveButton/res/values/styles.xml b/samples/devbytes/animation/LiveButton/res/values/styles.xml
new file mode 100644
index 000000000..27658b7d6
--- /dev/null
+++ b/samples/devbytes/animation/LiveButton/res/values/styles.xml
@@ -0,0 +1,34 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!--
+ Base application theme, dependent on API level. This theme is replaced
+ by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Light">
+ <!--
+ Theme customizations available in newer API levels can go in
+ res/values-vXX/styles.xml, while customizations related to
+ backward-compatibility can go here.
+ -->
+ </style>
+
+ <!-- Application theme. -->
+ <style name="AppTheme" parent="AppBaseTheme">
+ <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/LiveButton/src/com/example/android/livebutton/LiveButton.java b/samples/devbytes/animation/LiveButton/src/com/example/android/livebutton/LiveButton.java
new file mode 100644
index 000000000..d9f8d5e7d
--- /dev/null
+++ b/samples/devbytes/animation/LiveButton/src/com/example/android/livebutton/LiveButton.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2013 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.example.android.livebutton;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.animation.DecelerateInterpolator;
+import android.view.animation.OvershootInterpolator;
+import android.widget.Button;
+
+/**
+ * This app shows a simple application of anticipation and follow-through techniques as
+ * the button animates into its pressed state and animates back out of it, overshooting
+ * end state before resolving.
+ *
+ * Watch the associated video for this demo on the DevBytes channel of developer.android.com
+ * or on the DevBytes playlist in the androiddevelopers channel on YouTube at
+ * https://www.youtube.com/playlist?list=PLWz5rJ2EKKc_XOgcRukSoKKjewFJZrKV0.
+ */
+public class LiveButton extends Activity {
+
+ DecelerateInterpolator sDecelerator = new DecelerateInterpolator();
+ OvershootInterpolator sOvershooter = new OvershootInterpolator(10f);
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_overshoot);
+
+ final Button clickMeButton = (Button) findViewById(R.id.clickMe);
+ clickMeButton.animate().setDuration(200);
+
+ clickMeButton.setOnTouchListener(new View.OnTouchListener() {
+
+ @Override
+ public boolean onTouch(View arg0, MotionEvent arg1) {
+ if (arg1.getAction() == MotionEvent.ACTION_DOWN) {
+ clickMeButton.animate().setInterpolator(sDecelerator).
+ scaleX(.7f).scaleY(.7f);
+ } else if (arg1.getAction() == MotionEvent.ACTION_UP) {
+ clickMeButton.animate().setInterpolator(sOvershooter).
+ scaleX(1f).scaleY(1f);
+ }
+ return false;
+ }
+ });
+
+ }
+}
diff --git a/samples/devbytes/animation/MultiPropertyAnimations/AndroidManifest.xml b/samples/devbytes/animation/MultiPropertyAnimations/AndroidManifest.xml
new file mode 100644
index 000000000..6a7a5935b
--- /dev/null
+++ b/samples/devbytes/animation/MultiPropertyAnimations/AndroidManifest.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.multipropertyanimations"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="14"
+ android:targetSdkVersion="17" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name="com.example.android.multipropertyanimations.MultiPropertyAnimations"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest> \ No newline at end of file
diff --git a/samples/devbytes/animation/MultiPropertyAnimations/res/drawable-hdpi/ic_launcher.png b/samples/devbytes/animation/MultiPropertyAnimations/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..96a442e5b
--- /dev/null
+++ b/samples/devbytes/animation/MultiPropertyAnimations/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/MultiPropertyAnimations/res/drawable-mdpi/ic_launcher.png b/samples/devbytes/animation/MultiPropertyAnimations/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..359047dfa
--- /dev/null
+++ b/samples/devbytes/animation/MultiPropertyAnimations/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/MultiPropertyAnimations/res/drawable-xhdpi/ic_launcher.png b/samples/devbytes/animation/MultiPropertyAnimations/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..71c6d760f
--- /dev/null
+++ b/samples/devbytes/animation/MultiPropertyAnimations/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/MultiPropertyAnimations/res/layout/activity_multi_property_animations.xml b/samples/devbytes/animation/MultiPropertyAnimations/res/layout/activity_multi_property_animations.xml
new file mode 100644
index 000000000..f4826b6fb
--- /dev/null
+++ b/samples/devbytes/animation/MultiPropertyAnimations/res/layout/activity_multi_property_animations.xml
@@ -0,0 +1,46 @@
+<!-- Copyright (C) 2013 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ tools:context=".MultiPropertyAnimations" >
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:onClick="runValueAnimator"
+ android:text="Animate Me!" />
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:onClick="runViewPropertyAnimator"
+ android:text="Animate Me!" />
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:onClick="runObjectAnimators"
+ android:text="Animate Me!" />
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:onClick="runObjectAnimator"
+ android:text="Animate Me!" />
+
+</LinearLayout> \ No newline at end of file
diff --git a/samples/devbytes/animation/MultiPropertyAnimations/res/values-v14/styles.xml b/samples/devbytes/animation/MultiPropertyAnimations/res/values-v14/styles.xml
new file mode 100644
index 000000000..6e9521a16
--- /dev/null
+++ b/samples/devbytes/animation/MultiPropertyAnimations/res/values-v14/styles.xml
@@ -0,0 +1,26 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!--
+ Base application theme for API 14+. This theme completely replaces
+ AppBaseTheme from BOTH res/values/styles.xml and
+ res/values-v11/styles.xml on API 14+ devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+ <!-- API 14 theme customizations can go here. -->
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/MultiPropertyAnimations/res/values/dimens.xml b/samples/devbytes/animation/MultiPropertyAnimations/res/values/dimens.xml
new file mode 100644
index 000000000..90db76b39
--- /dev/null
+++ b/samples/devbytes/animation/MultiPropertyAnimations/res/values/dimens.xml
@@ -0,0 +1,21 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!-- Default screen margins, per the Android Design guidelines. -->
+ <dimen name="activity_horizontal_margin">16dp</dimen>
+ <dimen name="activity_vertical_margin">16dp</dimen>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/MultiPropertyAnimations/res/values/strings.xml b/samples/devbytes/animation/MultiPropertyAnimations/res/values/strings.xml
new file mode 100644
index 000000000..5487857b5
--- /dev/null
+++ b/samples/devbytes/animation/MultiPropertyAnimations/res/values/strings.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <string name="app_name">MultiPropertyAnimations</string>
+ <string name="action_settings">Settings</string>
+ <string name="hello_world">Hello world!</string>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/MultiPropertyAnimations/res/values/styles.xml b/samples/devbytes/animation/MultiPropertyAnimations/res/values/styles.xml
new file mode 100644
index 000000000..27658b7d6
--- /dev/null
+++ b/samples/devbytes/animation/MultiPropertyAnimations/res/values/styles.xml
@@ -0,0 +1,34 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!--
+ Base application theme, dependent on API level. This theme is replaced
+ by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Light">
+ <!--
+ Theme customizations available in newer API levels can go in
+ res/values-vXX/styles.xml, while customizations related to
+ backward-compatibility can go here.
+ -->
+ </style>
+
+ <!-- Application theme. -->
+ <style name="AppTheme" parent="AppBaseTheme">
+ <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/MultiPropertyAnimations/src/com/example/android/multipropertyanimations/MultiPropertyAnimations.java b/samples/devbytes/animation/MultiPropertyAnimations/src/com/example/android/multipropertyanimations/MultiPropertyAnimations.java
new file mode 100644
index 000000000..e1c805457
--- /dev/null
+++ b/samples/devbytes/animation/MultiPropertyAnimations/src/com/example/android/multipropertyanimations/MultiPropertyAnimations.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2013 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.example.android.multipropertyanimations;
+
+import android.animation.ObjectAnimator;
+import android.animation.PropertyValuesHolder;
+import android.animation.ValueAnimator;
+import android.animation.ValueAnimator.AnimatorUpdateListener;
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.View;
+
+/**
+ * This example shows various ways of animating multiple properties in parallel.
+ *
+ * Watch the associated video for this demo on the DevBytes channel of developer.android.com
+ * or on the DevBytes playlist in the androiddevelopers channel on YouTube at
+ * https://www.youtube.com/playlist?list=PLWz5rJ2EKKc_XOgcRukSoKKjewFJZrKV0.
+ */
+public class MultiPropertyAnimations extends Activity {
+
+ private static final float TX_START = 0;
+ private static final float TY_START = 0;
+ private static final float TX_END = 400;
+ private static final float TY_END = 200;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_multi_property_animations);
+ }
+
+ /**
+ * A very manual approach to animation uses a ValueAnimator to animate a fractional
+ * value and then turns that value into the final property values which are then set
+ * directly on the target object.
+ */
+ public void runValueAnimator(final View view) {
+ ValueAnimator anim = ValueAnimator.ofFloat(0, 400);
+ anim.addUpdateListener(new AnimatorUpdateListener() {
+ @Override
+ public void onAnimationUpdate(ValueAnimator animator) {
+ float fraction = animator.getAnimatedFraction();
+ view.setTranslationX(TX_START + fraction * (TX_END - TX_START));
+ view.setTranslationY(TY_START + fraction * (TY_END - TY_START));
+ }
+ });
+ anim.start();
+ }
+
+ /**
+ * ViewPropertyAnimator is the cleanest and most efficient way of animating
+ * View properties, even when there are multiple properties to be animated
+ * in parallel.
+ */
+ public void runViewPropertyAnimator(View view) {
+ view.animate().translationX(TX_END).translationY(TY_END);
+ }
+
+ /**
+ * Multiple ObjectAnimator objects can be created and run in parallel.
+ */
+ public void runObjectAnimators(View view) {
+ ObjectAnimator.ofFloat(view, View.TRANSLATION_X, TX_END).start();
+ ObjectAnimator.ofFloat(view, View.TRANSLATION_Y, TY_END).start();
+ // Optional: use an AnimatorSet to run these in parallel
+ }
+
+ /**
+ * Using PropertyValuesHolder objects enables the use of a single ObjectAnimator
+ * per target, even when there are multiple properties being animated on that target.
+ */
+ public void runObjectAnimator(View view) {
+ PropertyValuesHolder pvhTX = PropertyValuesHolder.ofFloat(View.TRANSLATION_X, TX_END);
+ PropertyValuesHolder pvhTY = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, TY_END);
+ ObjectAnimator.ofPropertyValuesHolder(view, pvhTX, pvhTY).start();
+ }
+}
diff --git a/samples/devbytes/animation/SquashAndStretch/AndroidManifest.xml b/samples/devbytes/animation/SquashAndStretch/AndroidManifest.xml
new file mode 100644
index 000000000..82e9b1b48
--- /dev/null
+++ b/samples/devbytes/animation/SquashAndStretch/AndroidManifest.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.squashandstretch"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="14"
+ android:targetSdkVersion="17" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name="com.example.squashandstretch.SquashAndStretch"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest> \ No newline at end of file
diff --git a/samples/devbytes/animation/SquashAndStretch/res/drawable-hdpi/ic_launcher.png b/samples/devbytes/animation/SquashAndStretch/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..96a442e5b
--- /dev/null
+++ b/samples/devbytes/animation/SquashAndStretch/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/SquashAndStretch/res/drawable-mdpi/ic_launcher.png b/samples/devbytes/animation/SquashAndStretch/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..359047dfa
--- /dev/null
+++ b/samples/devbytes/animation/SquashAndStretch/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/SquashAndStretch/res/drawable-xhdpi/ic_launcher.png b/samples/devbytes/animation/SquashAndStretch/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..71c6d760f
--- /dev/null
+++ b/samples/devbytes/animation/SquashAndStretch/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/SquashAndStretch/res/layout/main.xml b/samples/devbytes/animation/SquashAndStretch/res/layout/main.xml
new file mode 100644
index 000000000..ea6793ddc
--- /dev/null
+++ b/samples/devbytes/animation/SquashAndStretch/res/layout/main.xml
@@ -0,0 +1,31 @@
+<!-- Copyright (C) 2013 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.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/container"
+ tools:context=".SquashAndStretch" >
+
+ <Button
+ android:id="@+id/button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:layout_centerHorizontal="true"
+ android:onClick="onButtonClick"
+ android:text="Click Me!" />
+
+</RelativeLayout> \ No newline at end of file
diff --git a/samples/devbytes/animation/SquashAndStretch/res/menu/main.xml b/samples/devbytes/animation/SquashAndStretch/res/menu/main.xml
new file mode 100644
index 000000000..aab540e09
--- /dev/null
+++ b/samples/devbytes/animation/SquashAndStretch/res/menu/main.xml
@@ -0,0 +1,24 @@
+<!-- Copyright (C) 2013 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.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <item
+ android:id="@+id/menu_slow"
+ android:orderInCategory="100"
+ android:showAsAction="never"
+ android:title="@string/menu_slow_animations"
+ android:checkable="true"/>
+
+</menu> \ No newline at end of file
diff --git a/samples/devbytes/animation/SquashAndStretch/res/values-v14/styles.xml b/samples/devbytes/animation/SquashAndStretch/res/values-v14/styles.xml
new file mode 100644
index 000000000..6e9521a16
--- /dev/null
+++ b/samples/devbytes/animation/SquashAndStretch/res/values-v14/styles.xml
@@ -0,0 +1,26 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!--
+ Base application theme for API 14+. This theme completely replaces
+ AppBaseTheme from BOTH res/values/styles.xml and
+ res/values-v11/styles.xml on API 14+ devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+ <!-- API 14 theme customizations can go here. -->
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/SquashAndStretch/res/values/strings.xml b/samples/devbytes/animation/SquashAndStretch/res/values/strings.xml
new file mode 100644
index 000000000..3fb1b9672
--- /dev/null
+++ b/samples/devbytes/animation/SquashAndStretch/res/values/strings.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <string name="app_name">SquashAndStretch</string>
+ <string name="hello_world">Hello world!</string>
+ <string name="menu_slow_animations">Slow</string>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/SquashAndStretch/res/values/styles.xml b/samples/devbytes/animation/SquashAndStretch/res/values/styles.xml
new file mode 100644
index 000000000..27658b7d6
--- /dev/null
+++ b/samples/devbytes/animation/SquashAndStretch/res/values/styles.xml
@@ -0,0 +1,34 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!--
+ Base application theme, dependent on API level. This theme is replaced
+ by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Light">
+ <!--
+ Theme customizations available in newer API levels can go in
+ res/values-vXX/styles.xml, while customizations related to
+ backward-compatibility can go here.
+ -->
+ </style>
+
+ <!-- Application theme. -->
+ <style name="AppTheme" parent="AppBaseTheme">
+ <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/SquashAndStretch/src/com/example/squashandstretch/SquashAndStretch.java b/samples/devbytes/animation/SquashAndStretch/src/com/example/squashandstretch/SquashAndStretch.java
new file mode 100644
index 000000000..328dd5018
--- /dev/null
+++ b/samples/devbytes/animation/SquashAndStretch/src/com/example/squashandstretch/SquashAndStretch.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2013 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.example.squashandstretch;
+
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
+import android.animation.PropertyValuesHolder;
+import android.animation.ValueAnimator;
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.DecelerateInterpolator;
+
+/**
+ * This example shows how to add some life to a view during animation by deforming the shape.
+ * As the button "falls", it stretches along the line of travel. When it hits the bottom, it
+ * squashes, like a real object when hitting a surface. Then the button reverses these actions
+ * to bounce back up to the start.
+ *
+ * Watch the associated video for this demo on the DevBytes channel of developer.android.com
+ * or on the DevBytes playlist in the androiddevelopers channel on YouTube at
+ * https://www.youtube.com/playlist?list=PLWz5rJ2EKKc_XOgcRukSoKKjewFJZrKV0.
+ */
+public class SquashAndStretch extends Activity {
+
+ private static final AccelerateInterpolator sAccelerator = new AccelerateInterpolator();
+ private static final DecelerateInterpolator sDecelerator = new DecelerateInterpolator();
+
+ ViewGroup mContainer = null;
+ private static final long BASE_DURATION = 300;
+ private long sAnimatorScale = 1;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
+
+ mContainer = (ViewGroup) findViewById(R.id.container);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.main, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == R.id.menu_slow) {
+ sAnimatorScale = item.isChecked() ? 1 : 5;
+ item.setChecked(!item.isChecked());
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ public void onButtonClick(View view) {
+ long animationDuration = (long) (BASE_DURATION * sAnimatorScale);
+
+ // Scale around bottom/middle to simplify squash against the window bottom
+ view.setPivotX(view.getWidth() / 2);
+ view.setPivotY(view.getHeight());
+
+ // Animate the button down, accelerating, while also stretching in Y and squashing in X
+ PropertyValuesHolder pvhTY = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y,
+ mContainer.getHeight() - view.getHeight());
+ PropertyValuesHolder pvhSX = PropertyValuesHolder.ofFloat(View.SCALE_X, .7f);
+ PropertyValuesHolder pvhSY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1.2f);
+ ObjectAnimator downAnim = ObjectAnimator.ofPropertyValuesHolder(
+ view, pvhTY, pvhSX, pvhSY);
+ downAnim.setInterpolator(sAccelerator);
+ downAnim.setDuration((long) (animationDuration * 2));
+
+ // Stretch in X, squash in Y, then reverse
+ pvhSX = PropertyValuesHolder.ofFloat(View.SCALE_X, 2);
+ pvhSY = PropertyValuesHolder.ofFloat(View.SCALE_Y, .5f);
+ ObjectAnimator stretchAnim =
+ ObjectAnimator.ofPropertyValuesHolder(view, pvhSX, pvhSY);
+ stretchAnim.setRepeatCount(1);
+ stretchAnim.setRepeatMode(ValueAnimator.REVERSE);
+ stretchAnim.setInterpolator(sDecelerator);
+ stretchAnim.setDuration(animationDuration);
+
+ // Animate back to the start
+ pvhTY = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, 0);
+ pvhSX = PropertyValuesHolder.ofFloat(View.SCALE_X, 1);
+ pvhSY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1);
+ ObjectAnimator upAnim =
+ ObjectAnimator.ofPropertyValuesHolder(view, pvhTY, pvhSX, pvhSY);
+ upAnim.setDuration((long) (animationDuration * 2));
+ upAnim.setInterpolator(sDecelerator);
+
+ AnimatorSet set = new AnimatorSet();
+ set.playSequentially(downAnim, stretchAnim, upAnim);
+ set.start();
+ }
+}
diff --git a/samples/devbytes/animation/ToonGame/AndroidManifest.xml b/samples/devbytes/animation/ToonGame/AndroidManifest.xml
new file mode 100644
index 000000000..505b7ce9f
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/AndroidManifest.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.toongame"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="16"
+ android:targetSdkVersion="17" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name="com.example.android.toongame.ToonGame"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity
+ android:name="com.example.android.toongame.PlayerSetupActivity"
+ android:windowSoftInputMode="adjustResize"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest> \ No newline at end of file
diff --git a/samples/devbytes/animation/ToonGame/res/drawable-hdpi/ic_launcher.png b/samples/devbytes/animation/ToonGame/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..96a442e5b
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/ToonGame/res/drawable-mdpi/blue_oval.xml b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/blue_oval.xml
new file mode 100644
index 000000000..2ffe16a3e
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/blue_oval.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval">
+
+ <solid android:color="#00f"/>
+
+</shape> \ No newline at end of file
diff --git a/samples/devbytes/animation/ToonGame/res/drawable-mdpi/cyan_oval.xml b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/cyan_oval.xml
new file mode 100644
index 000000000..53ea6aca3
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/cyan_oval.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval">
+
+ <solid android:color="#0ff"/>
+
+</shape> \ No newline at end of file
diff --git a/samples/devbytes/animation/ToonGame/res/drawable-mdpi/green_button.xml b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/green_button.xml
new file mode 100644
index 000000000..3ed5b67dc
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/green_button.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android" >
+ <item android:drawable="@drawable/green_down" android:state_pressed="true"/>
+ <item android:drawable="@drawable/green_up"/>
+</selector> \ No newline at end of file
diff --git a/samples/devbytes/animation/ToonGame/res/drawable-mdpi/green_down.9.png b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/green_down.9.png
new file mode 100644
index 000000000..db974ba2f
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/green_down.9.png
Binary files differ
diff --git a/samples/devbytes/animation/ToonGame/res/drawable-mdpi/green_oval.xml b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/green_oval.xml
new file mode 100644
index 000000000..03b83c3e6
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/green_oval.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval">
+
+ <solid android:color="#0f0"/>
+
+</shape> \ No newline at end of file
diff --git a/samples/devbytes/animation/ToonGame/res/drawable-mdpi/green_up.9.png b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/green_up.9.png
new file mode 100644
index 000000000..0c2f5c850
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/green_up.9.png
Binary files differ
diff --git a/samples/devbytes/animation/ToonGame/res/drawable-mdpi/ic_launcher.png b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..359047dfa
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/ToonGame/res/drawable-mdpi/magenta_oval.xml b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/magenta_oval.xml
new file mode 100644
index 000000000..675b0dcc1
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/magenta_oval.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval">
+
+ <solid android:color="#f0f"/>
+
+</shape> \ No newline at end of file
diff --git a/samples/devbytes/animation/ToonGame/res/drawable-mdpi/red_oval.xml b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/red_oval.xml
new file mode 100644
index 000000000..f2276a6cf
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/red_oval.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval">
+
+ <solid android:color="#f00"/>
+
+</shape> \ No newline at end of file
diff --git a/samples/devbytes/animation/ToonGame/res/drawable-mdpi/yellow_oval.xml b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/yellow_oval.xml
new file mode 100644
index 000000000..d03f684ee
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/res/drawable-mdpi/yellow_oval.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval">
+
+ <solid android:color="#ff0"/>
+
+</shape> \ No newline at end of file
diff --git a/samples/devbytes/animation/ToonGame/res/drawable-xhdpi/ic_launcher.png b/samples/devbytes/animation/ToonGame/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..71c6d760f
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/devbytes/animation/ToonGame/res/layout/activity_toon_game.xml b/samples/devbytes/animation/ToonGame/res/layout/activity_toon_game.xml
new file mode 100644
index 000000000..d65301b5f
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/res/layout/activity_toon_game.xml
@@ -0,0 +1,47 @@
+<!-- Copyright (C) 2013 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.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/container"
+ tools:context=".ToonGame" >
+
+ <Button
+ android:id="@+id/startButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="64dip"
+ android:layout_centerHorizontal="true"
+ android:layout_centerVertical="true"
+ android:textColor="#00c"
+ android:text="Play!"
+ android:background="@drawable/green_button"
+ android:visibility="invisible"
+ android:onClick="play"
+ android:textStyle="bold" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_above="@+id/startButton"
+ android:layout_centerHorizontal="true"
+ android:layout_marginBottom="39dp"
+ android:text="@string/welcome"
+ android:textColor="@android:color/holo_blue_bright"
+ android:textSize="64dip"
+ android:textStyle="bold" />
+
+</RelativeLayout> \ No newline at end of file
diff --git a/samples/devbytes/animation/ToonGame/res/layout/player_setup_layout.xml b/samples/devbytes/animation/ToonGame/res/layout/player_setup_layout.xml
new file mode 100644
index 000000000..c55d39be5
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/res/layout/player_setup_layout.xml
@@ -0,0 +1,187 @@
+<!-- Copyright (C) 2013 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.
+-->
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
+
+ <RelativeLayout
+ android:id="@+id/container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:clipChildren="false">
+
+ <view
+ android:id="@+id/nameTV"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:layout_centerHorizontal="true"
+ android:layout_marginTop="120dp"
+ class="com.example.android.toongame.SkewableTextView"
+ android:text="Name?"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textSize="@dimen/bigText" />
+
+ <view
+ class="com.example.android.toongame.SkewableTextView"
+ android:id="@+id/ageTV"
+ android:visibility="gone"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:layout_centerHorizontal="true"
+ android:layout_marginTop="120dp"
+ android:text="Difficulty?"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textSize="@dimen/bigText" />
+
+ <view
+ class="com.example.android.toongame.SkewableTextView"
+ android:id="@+id/creditTV"
+ android:visibility="gone"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:layout_centerHorizontal="true"
+ android:layout_marginTop="120dp"
+ android:gravity="center"
+ android:text="Parent's Credit Card Number?"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textSize="64sp" />
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerHorizontal="true"
+ android:layout_alignParentBottom="true"
+ android:visibility="gone"
+ android:id="@+id/nameButtons"
+ android:layout_marginBottom="132dp" >
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dip"
+ android:padding="15dip"
+ android:background="@drawable/green_oval"
+ android:text="Bob"
+ android:textSize="36sp"
+ android:textColor="#fff"
+ android:textStyle="bold"
+ android:onClick="selectName"
+ android:id="@+id/bobButton"/>
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dip"
+ android:padding="15dip"
+ android:background="@drawable/blue_oval"
+ android:text="Jane"
+ android:textSize="36sp"
+ android:textColor="#fff"
+ android:textStyle="bold"
+ android:onClick="selectName"
+ android:id="@+id/janeButton"/>
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dip"
+ android:padding="15dip"
+ android:background="@drawable/magenta_oval"
+ android:text="Pat"
+ android:textSize="36sp"
+ android:textColor="#fff"
+ android:textStyle="bold"
+ android:onClick="selectName"
+ android:id="@+id/patButton"/>
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerHorizontal="true"
+ android:layout_alignParentBottom="true"
+ android:visibility="gone"
+ android:gravity="center"
+ android:orientation="vertical"
+ android:id="@+id/difficultyButtons"
+ android:layout_marginBottom="50dp" >
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dip"
+ android:padding="15dip"
+ android:background="@drawable/green_oval"
+ android:text="Easy"
+ android:textSize="36sp"
+ android:textColor="#fff"
+ android:textStyle="bold"
+ android:onClick="selectDifficulty"
+ android:id="@+id/easyButton"/>
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dip"
+ android:padding="15dip"
+ android:background="@drawable/blue_oval"
+ android:text="Hard"
+ android:textSize="36sp"
+ android:textColor="#fff"
+ android:textStyle="bold"
+ android:onClick="selectDifficulty"
+ android:id="@+id/hardButton"/>
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dip"
+ android:padding="15dip"
+ android:background="@drawable/red_oval"
+ android:text="Mega Hard"
+ android:textSize="36sp"
+ android:textColor="#000"
+ android:textStyle="bold|italic"
+ android:onClick="selectDifficulty"
+ android:id="@+id/megaHardButton"/>
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerHorizontal="true"
+ android:layout_alignParentBottom="true"
+ android:visibility="gone"
+ android:id="@+id/creditButtons1"
+ android:layout_marginBottom="132dp" />
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerHorizontal="true"
+ android:layout_alignParentBottom="true"
+ android:visibility="gone"
+ android:id="@+id/creditButtons2"
+ android:layout_marginBottom="70dp" />
+
+
+ </RelativeLayout>
+</FrameLayout> \ No newline at end of file
diff --git a/samples/devbytes/animation/ToonGame/res/values/dimens.xml b/samples/devbytes/animation/ToonGame/res/values/dimens.xml
new file mode 100644
index 000000000..fc229f68e
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/res/values/dimens.xml
@@ -0,0 +1,22 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!-- Default screen margins, per the Android Design guidelines. -->
+ <dimen name="activity_horizontal_margin">16dp</dimen>
+ <dimen name="activity_vertical_margin">16dp</dimen>
+ <dimen name="bigText">64dip</dimen>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/ToonGame/res/values/strings.xml b/samples/devbytes/animation/ToonGame/res/values/strings.xml
new file mode 100644
index 000000000..fb256e6c2
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/res/values/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <string name="app_name">ToonGame</string>
+ <string name="action_settings">Settings</string>
+ <string name="hello_world">Hello world!</string>
+ <string name="welcome">Welcome!</string>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/ToonGame/res/values/styles.xml b/samples/devbytes/animation/ToonGame/res/values/styles.xml
new file mode 100644
index 000000000..9d91d6a8e
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/res/values/styles.xml
@@ -0,0 +1,34 @@
+<!-- Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!--
+ Base application theme, dependent on API level. This theme is replaced
+ by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Light">
+ <!--
+ Theme customizations available in newer API levels can go in
+ res/values-vXX/styles.xml, while customizations related to
+ backward-compatibility can go here.
+ -->
+ </style>
+
+ <!-- Application theme. -->
+ <style name="AppTheme" parent="AppBaseTheme">
+ <item name="android:windowNoTitle">true</item>
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/samples/devbytes/animation/ToonGame/src/com/example/android/toongame/PlayerSetupActivity.java b/samples/devbytes/animation/ToonGame/src/com/example/android/toongame/PlayerSetupActivity.java
new file mode 100644
index 000000000..fce11c3ef
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/src/com/example/android/toongame/PlayerSetupActivity.java
@@ -0,0 +1,360 @@
+/*
+ * Copyright (C) 2013 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.example.android.toongame;
+
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
+import android.animation.PropertyValuesHolder;
+import android.animation.TimeInterpolator;
+import android.animation.ValueAnimator;
+import android.app.Activity;
+import android.content.res.ColorStateList;
+import android.graphics.Color;
+import android.graphics.Typeface;
+import android.graphics.drawable.ShapeDrawable;
+import android.graphics.drawable.shapes.OvalShape;
+import android.os.Bundle;
+import android.util.TypedValue;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewTreeObserver;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.DecelerateInterpolator;
+import android.view.animation.LinearInterpolator;
+import android.view.animation.OvershootInterpolator;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.RelativeLayout;
+
+/**
+ * This activity, launched from the ToonGame activity, takes the user between three
+ * different setup screens where they choose a name, choose a difficulty rating, and
+ * enter important financial information. All of the screens are meant to be
+ * simple, engaging, and fun.
+ */
+public class PlayerSetupActivity extends Activity {
+
+ private static final AccelerateInterpolator sAccelerator = new AccelerateInterpolator();
+ private static final LinearInterpolator sLinearInterpolator = new LinearInterpolator();
+ ViewGroup mContainer;
+ EditText mEditText;
+
+ private static final int NAME_STATE = 0;
+ private static final int DIFFICULTY_STATE = 1;
+ private static final int CREDIT_STATE = 2;
+ private int mEntryState = NAME_STATE;
+
+ SkewableTextView mNameTV, mDifficultyTV, mCreditTV;
+
+ ViewGroup mNameButtons, mDifficultyButtons, mCreditButtons1, mCreditButtons2;
+
+ Button mBobButton, mJaneButton, mPatButton;
+
+ private static final TimeInterpolator sOvershooter = new OvershootInterpolator();
+ private static final DecelerateInterpolator sDecelerator = new DecelerateInterpolator();
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.player_setup_layout);
+ overridePendingTransition(0, 0);
+
+ mContainer = (ViewGroup) findViewById(R.id.container);
+ mContainer.getViewTreeObserver().addOnPreDrawListener(mPreDrawListener);
+
+ mNameTV = (SkewableTextView) findViewById(R.id.nameTV);
+ mDifficultyTV = (SkewableTextView) findViewById(R.id.ageTV);
+ mCreditTV = (SkewableTextView) findViewById(R.id.creditTV);
+
+ mBobButton = setupButton(R.id.bobButton);
+ setupButton(R.id.janeButton);
+ setupButton(R.id.patButton);
+ setupButton(R.id.easyButton);
+ setupButton(R.id.hardButton);
+ setupButton(R.id.megaHardButton);
+
+ mNameButtons = (ViewGroup) findViewById(R.id.nameButtons);
+ mDifficultyButtons = (ViewGroup) findViewById(R.id.difficultyButtons);
+ mCreditButtons1 = (ViewGroup) findViewById(R.id.creditButtons1);
+ mCreditButtons2 = (ViewGroup) findViewById(R.id.creditButtons2);
+ }
+
+ @Override
+ public void finish() {
+ super.finish();
+ overridePendingTransition(0, 0);
+ }
+
+ private Button setupButton(int resourceId) {
+ Button button = (Button) findViewById(resourceId);
+ button.setOnTouchListener(mButtonPressListener);
+ return button;
+ }
+
+ private View.OnTouchListener mButtonPressListener =
+ new View.OnTouchListener() {
+ public boolean onTouch(View v, MotionEvent event) {
+ switch (event.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ v.animate().setDuration(ToonGame.SHORT_DURATION).
+ scaleX(.8f).scaleY(.8f).setInterpolator(sDecelerator);
+ break;
+ case MotionEvent.ACTION_UP:
+ v.animate().setDuration(ToonGame.SHORT_DURATION).
+ scaleX(1).scaleY(1).setInterpolator(sAccelerator);
+ break;
+ default:
+ break;
+ }
+ return false;
+ }
+ };
+
+ public void buttonClick(View clickedView, int alignmentRule) {
+ ViewGroup parent = (ViewGroup) clickedView.getParent();
+ for (int i = 0; i < parent.getChildCount(); ++i) {
+ Button child = (Button) parent.getChildAt(i);
+ if (child != clickedView) {
+ child.animate().alpha(0);
+ } else {
+ final Button buttonCopy = new Button(this);
+ child.setVisibility(View.INVISIBLE);
+ buttonCopy.setBackground(child.getBackground());
+ buttonCopy.setText(((Button) child).getText());
+ RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
+ RelativeLayout.LayoutParams.WRAP_CONTENT,
+ RelativeLayout.LayoutParams.WRAP_CONTENT);
+ params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
+ params.addRule(alignmentRule);
+ params.setMargins(25, 50, 25, 50);
+ buttonCopy.setLayoutParams(params);
+ buttonCopy.setPadding(child.getPaddingLeft(), child.getPaddingTop(),
+ child.getPaddingRight(), child.getPaddingBottom());
+ buttonCopy.setTextSize(TypedValue.COMPLEX_UNIT_PX, child.getTextSize());
+ buttonCopy.setTypeface(child.getTypeface(), Typeface.BOLD);
+ ColorStateList colors = child.getTextColors();
+ buttonCopy.setTextColor(colors.getDefaultColor());
+ final int[] oldLocationInWindow = new int[2];
+ child.getLocationInWindow(oldLocationInWindow);
+ mContainer.addView(buttonCopy);
+ buttonCopy.getViewTreeObserver().addOnPreDrawListener(
+ new ViewTreeObserver.OnPreDrawListener() {
+
+ @Override
+ public boolean onPreDraw() {
+ buttonCopy.getViewTreeObserver().removeOnPreDrawListener(this);
+ int[] locationInWindow = new int[2];
+ buttonCopy.getLocationInWindow(locationInWindow);
+ float deltaX = oldLocationInWindow[0] - locationInWindow[0];
+ float deltaY = oldLocationInWindow[1] - locationInWindow[1];
+
+ buttonCopy.setTranslationX(deltaX);
+ buttonCopy.setTranslationY(deltaY);
+
+ PropertyValuesHolder pvhSX =
+ PropertyValuesHolder.ofFloat(View.SCALE_X, 3);
+ PropertyValuesHolder pvhSY =
+ PropertyValuesHolder.ofFloat(View.SCALE_Y, 3);
+ ObjectAnimator bounceAnim = ObjectAnimator.ofPropertyValuesHolder(
+ buttonCopy, pvhSX, pvhSY);
+ bounceAnim.setRepeatCount(1);
+ bounceAnim.setRepeatMode(ValueAnimator.REVERSE);
+ bounceAnim.setInterpolator(sDecelerator);
+ bounceAnim.setDuration(300);
+
+ PropertyValuesHolder pvhTX =
+ PropertyValuesHolder.ofFloat(View.TRANSLATION_X, 0);
+ PropertyValuesHolder pvhTY =
+ PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, 0);
+ ObjectAnimator moveAnim = ObjectAnimator.ofPropertyValuesHolder(
+ buttonCopy, pvhTX, pvhTY);
+ moveAnim.setDuration(600);
+ bounceAnim.start();
+ moveAnim.start();
+ moveAnim.addListener(new AnimatorListenerAdapter() {
+ public void onAnimationEnd(Animator animation) {
+ switch (mEntryState) {
+ case (NAME_STATE) :
+ {
+ Runnable runnable = new Runnable() {
+ public void run() {
+ mDifficultyButtons.setVisibility(View.VISIBLE);
+ mNameButtons.setVisibility(View.GONE);
+ popChildrenIn(mDifficultyButtons, null);
+ }
+ };
+ slideToNext(mNameTV, mDifficultyTV, runnable);
+ mEntryState = DIFFICULTY_STATE;
+ break;
+ }
+ case (DIFFICULTY_STATE) :
+ {
+ mDifficultyButtons.setVisibility(View.GONE);
+ for (int i = 0; i < 5; ++i) {
+ mCreditButtons1.addView(setupNumberButton(i));
+ }
+ for (int i = 5; i < 10; ++i) {
+ mCreditButtons2.addView(setupNumberButton(i));
+ }
+ Runnable runnable = new Runnable() {
+ public void run() {
+ mCreditButtons1.setVisibility(View.VISIBLE);
+ Runnable runnable = new Runnable() {
+ public void run() {
+ mCreditButtons2.setVisibility(View.VISIBLE);
+ popChildrenIn(mCreditButtons2, null);
+ }
+ };
+ popChildrenIn(mCreditButtons1, runnable);
+ }
+ };
+ slideToNext(mDifficultyTV, mCreditTV, runnable);
+ mEntryState = CREDIT_STATE;
+ }
+ break;
+ }
+ }
+ });
+ return true;
+ }
+ });
+ }
+ }
+ }
+
+ public void selectDifficulty(View clickedView) {
+ buttonClick(clickedView, RelativeLayout.ALIGN_PARENT_RIGHT);
+ }
+
+ public void selectName(View clickedView) {
+ buttonClick(clickedView, RelativeLayout.ALIGN_PARENT_LEFT);
+ }
+
+ private Button setupNumberButton(int number) {
+ Button button = new Button(PlayerSetupActivity.this);
+ button.setTextSize(15);
+ button.setTextColor(Color.WHITE);
+ button.setTypeface(mBobButton.getTypeface(), Typeface.BOLD);
+ button.setText(Integer.toString(number));
+ button.setPadding(0, 0, 0, 0);
+
+ OvalShape oval = new OvalShape();
+ ShapeDrawable drawable = new ShapeDrawable(oval);
+ drawable.getPaint().setColor(0xFF << 24 | (int) (50 + 150 * Math.random()) << 16 |
+ (int) (50 + 150 * Math.random()) << 8 | (int) (50 + 150 * Math.random()));
+ button.setBackground(drawable);
+
+ button.setOnTouchListener(mButtonPressListener);
+
+ return button;
+ }
+
+ ViewTreeObserver.OnPreDrawListener mPreDrawListener =
+ new ViewTreeObserver.OnPreDrawListener() {
+
+ @Override
+ public boolean onPreDraw() {
+ mContainer.getViewTreeObserver().removeOnPreDrawListener(this);
+ mContainer.setScaleX(0);
+ mContainer.setScaleY(0);
+ mContainer.animate().scaleX(1).scaleY(1).setInterpolator(new OvershootInterpolator());
+ mContainer.animate().setDuration(ToonGame.LONG_DURATION).withEndAction(new Runnable() {
+
+ @Override
+ public void run() {
+ ViewGroup buttonsParent = (ViewGroup) findViewById(R.id.nameButtons);
+ buttonsParent.setVisibility(View.VISIBLE);
+ popChildrenIn(buttonsParent, null);
+ }
+ });
+ return false;
+ }
+ };
+
+ private void popChildrenIn(ViewGroup parent, final Runnable endAction) {
+ // for all children, scale in one at a time
+ TimeInterpolator overshooter = new OvershootInterpolator();
+ int childCount = parent.getChildCount();
+ ObjectAnimator[] childAnims = new ObjectAnimator[childCount];
+ for (int i = 0; i < childCount; ++i) {
+ View child = parent.getChildAt(i);
+ child.setScaleX(0);
+ child.setScaleY(0);
+ PropertyValuesHolder pvhSX = PropertyValuesHolder.ofFloat(View.SCALE_X, 1);
+ PropertyValuesHolder pvhSY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1);
+ ObjectAnimator anim = ObjectAnimator.ofPropertyValuesHolder(child, pvhSX, pvhSY);
+ anim.setDuration(150);
+ anim.setInterpolator(overshooter);
+ childAnims[i] = anim;
+ }
+ AnimatorSet set = new AnimatorSet();
+ set.playSequentially(childAnims);
+ set.start();
+ if (endAction != null) {
+ set.addListener(new AnimatorListenerAdapter() {
+ public void onAnimationEnd(Animator animation) {
+ endAction.run();
+ }
+ });
+ }
+ }
+
+ private void slideToNext(final SkewableTextView currentView,
+ final SkewableTextView nextView, final Runnable endAction) {
+ // skew/anticipate current view, slide off, set GONE, restore translation
+ ObjectAnimator currentSkewer = ObjectAnimator.ofFloat(currentView, "skewX", -.5f);
+ currentSkewer.setInterpolator(sDecelerator);
+ ObjectAnimator currentMover = ObjectAnimator.ofFloat(currentView, View.TRANSLATION_X,
+ -mContainer.getWidth());
+ currentMover.setInterpolator(sLinearInterpolator);
+ currentMover.setDuration(ToonGame.MEDIUM_DURATION);
+
+ // set next view visible, translate off to right, skew,
+ // slide on in parallel, overshoot/wobble, unskew
+ nextView.setVisibility(View.VISIBLE);
+ nextView.setSkewX(-.5f);
+ nextView.setTranslationX(mContainer.getWidth());
+
+ ObjectAnimator nextMover = ObjectAnimator.ofFloat(nextView, View.TRANSLATION_X, 0);
+ nextMover.setInterpolator(sAccelerator);
+ nextMover.setDuration(ToonGame.MEDIUM_DURATION);
+ ObjectAnimator nextSkewer = ObjectAnimator.ofFloat(nextView, "skewX", 0);
+ nextSkewer.setInterpolator(sOvershooter);
+
+ AnimatorSet moverSet = new AnimatorSet();
+ moverSet.playTogether(currentMover, nextMover);
+ AnimatorSet fullSet = new AnimatorSet();
+ fullSet.playSequentially(currentSkewer, moverSet, nextSkewer);
+ fullSet.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ currentView.setSkewX(0);
+ currentView.setVisibility(View.GONE);
+ currentView.setTranslationX(0);
+ if (endAction != null) {
+ endAction.run();
+ }
+ }
+ });
+
+ fullSet.start();
+ }
+
+}
diff --git a/samples/devbytes/animation/ToonGame/src/com/example/android/toongame/SkewableTextView.java b/samples/devbytes/animation/ToonGame/src/com/example/android/toongame/SkewableTextView.java
new file mode 100644
index 000000000..9ea15cada
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/src/com/example/android/toongame/SkewableTextView.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2013 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.example.android.toongame;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Matrix;
+import android.graphics.RectF;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.TextView;
+
+/**
+ * This custom TextView can be skewed to the left or right to enable anticipation and
+ * follow-through effects
+ */
+public class SkewableTextView extends TextView {
+
+ private float mSkewX;
+ RectF mTempRect = new RectF();
+
+ public SkewableTextView(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ public SkewableTextView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public SkewableTextView(Context context) {
+ super(context);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ if (mSkewX != 0) {
+ canvas.translate(0, getHeight());
+ canvas.skew(mSkewX, 0);
+ canvas.translate(0, -getHeight());
+ }
+ super.onDraw(canvas);
+ }
+
+ public float getSkewX() {
+ return mSkewX;
+ }
+
+ public void setSkewX(float value) {
+ if (value != mSkewX) {
+ mSkewX = value;
+ invalidate(); // force redraw with new skew value
+ invalidateSkewedBounds(); // also invalidate appropriate area of parent
+ }
+ }
+
+ /**
+ * Need to invalidate proper area of parent for skewed bounds
+ */
+ private void invalidateSkewedBounds() {
+ if (mSkewX != 0) {
+ Matrix matrix = new Matrix();
+ matrix.setSkew(-mSkewX, 0);
+ mTempRect.set(0, 0, getRight(), getBottom());
+ matrix.mapRect(mTempRect);
+ mTempRect.offset(getLeft() + getTranslationX(), getTop() + getTranslationY());
+ ((View) getParent()).invalidate((int) mTempRect.left, (int) mTempRect.top,
+ (int) (mTempRect.right +.5f), (int) (mTempRect.bottom + .5f));
+ }
+ }
+}
diff --git a/samples/devbytes/animation/ToonGame/src/com/example/android/toongame/ToonGame.java b/samples/devbytes/animation/ToonGame/src/com/example/android/toongame/ToonGame.java
new file mode 100644
index 000000000..b03eeeb17
--- /dev/null
+++ b/samples/devbytes/animation/ToonGame/src/com/example/android/toongame/ToonGame.java
@@ -0,0 +1,219 @@
+/*
+ * Copyright (C) 2013 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.example.android.toongame;
+
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
+import android.animation.PropertyValuesHolder;
+import android.animation.ValueAnimator;
+import android.app.Activity;
+import android.content.Intent;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnTouchListener;
+import android.view.ViewGroup;
+import android.view.ViewTreeObserver;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.DecelerateInterpolator;
+import android.view.animation.LinearInterpolator;
+import android.widget.Button;
+
+/**
+ * This application shows various cartoon animation techniques in the context of
+ * a larger application, to show how such animations might be used to create a more
+ * interactive, fun, and engaging experience.
+ *
+ * This main activity launches a sub-activity when the Play button is clicked. The
+ * main action in this master activity is bouncing the Play button in, randomly
+ * bouncing it while waiting for input, and animating its press and click behaviors
+ * when the user interacts with it.
+ *
+ * Watch the associated video for this demo on the DevBytes channel of developer.android.com
+ * or on the DevBytes playlist in the androiddevelopers channel on YouTube at
+ * https://www.youtube.com/playlist?list=PLWz5rJ2EKKc_XOgcRukSoKKjewFJZrKV0.
+ */
+public class ToonGame extends Activity {
+
+ Button mStarter;
+ ViewGroup mContainer;
+ private static final AccelerateInterpolator sAccelerator = new AccelerateInterpolator();
+ private static final DecelerateInterpolator sDecelerator = new DecelerateInterpolator();
+ private static final LinearInterpolator sLinearInterpolator = new LinearInterpolator();
+ static long SHORT_DURATION = 100;
+ static long MEDIUM_DURATION = 200;
+ static long REGULAR_DURATION = 300;
+ static long LONG_DURATION = 500;
+
+ private static float sDurationScale = 1f;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ overridePendingTransition(0, 0);
+ setContentView(R.layout.activity_toon_game);
+
+ mStarter = (Button) findViewById(R.id.startButton);
+ mContainer = (ViewGroup) findViewById(R.id.container);
+ mStarter.setOnTouchListener(funButtonListener);
+ mStarter.animate().setDuration(100);
+
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ mContainer.setScaleX(1);
+ mContainer.setScaleY(1);
+ mContainer.setAlpha(1);
+ mStarter.setVisibility(View.INVISIBLE);
+ mContainer.getViewTreeObserver().addOnPreDrawListener(mOnPreDrawListener);
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ mStarter.removeCallbacks(mSquishRunnable);
+ }
+
+ private OnTouchListener funButtonListener = new OnTouchListener() {
+
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ switch (event.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ mStarter.animate().scaleX(.8f).scaleY(.8f).setInterpolator(sDecelerator);
+ mStarter.setTextColor(Color.CYAN);
+ mStarter.removeCallbacks(mSquishRunnable);
+ mStarter.setPressed(true);
+ break;
+ case MotionEvent.ACTION_MOVE:
+ float x = event.getX();
+ float y = event.getY();
+ boolean isInside = (x > 0 && x < mStarter.getWidth() &&
+ y > 0 && y < mStarter.getHeight());
+ if (mStarter.isPressed() != isInside) {
+ mStarter.setPressed(isInside);
+ }
+ break;
+ case MotionEvent.ACTION_UP:
+ if (mStarter.isPressed()) {
+ mStarter.performClick();
+ mStarter.setPressed(false);
+ } else {
+ mStarter.animate().scaleX(1).scaleY(1).setInterpolator(sAccelerator);
+ }
+ mStarter.setTextColor(Color.BLUE);
+ break;
+ }
+ return true;
+ }
+ };
+
+ private Runnable mSquishRunnable = new Runnable() {
+ public void run() {
+ squishyBounce(mStarter, 0,
+ mContainer.getHeight() - mStarter.getTop() - mStarter.getHeight(),
+ 0, .5f, 1.5f);
+ }
+ };
+
+ public void play(View view) {
+ mContainer.animate().scaleX(5).scaleY(5).alpha(0).setDuration(LONG_DURATION).
+ setInterpolator(sLinearInterpolator).
+ withEndAction(new Runnable() {
+ @Override
+ public void run() {
+ mStarter.postOnAnimation(new Runnable() {
+ public void run() {
+ Intent intent = new Intent(ToonGame.this,
+ PlayerSetupActivity.class);
+ startActivity(intent);
+ overridePendingTransition(0, 0);
+ }
+ });
+ }
+ });
+ view.removeCallbacks(mSquishRunnable);
+ }
+
+ private ViewTreeObserver.OnPreDrawListener mOnPreDrawListener =
+ new ViewTreeObserver.OnPreDrawListener() {
+
+ @Override
+ public boolean onPreDraw() {
+ mContainer.getViewTreeObserver().removeOnPreDrawListener(this);
+ mContainer.postDelayed(new Runnable() {
+ public void run() {
+ // Drop in the button from off the top of the screen
+ mStarter.setVisibility(View.VISIBLE);
+ mStarter.setY(-mStarter.getHeight());
+ squishyBounce(mStarter,
+ -(mStarter.getTop() + mStarter.getHeight()),
+ mContainer.getHeight() - mStarter.getTop() -
+ mStarter.getHeight(),
+ 0, .5f, 1.5f);
+ }
+ }, 500);
+ return true;
+ }
+ };
+
+ private void squishyBounce(final View view, final float startTY, final float bottomTY,
+ final float endTY, final float squash, final float stretch) {
+ view.setPivotX(view.getWidth() / 2);
+ view.setPivotY(view.getHeight());
+ PropertyValuesHolder pvhTY = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y,
+ startTY, bottomTY);
+ PropertyValuesHolder pvhSX = PropertyValuesHolder.ofFloat(View.SCALE_X, .7f);
+ PropertyValuesHolder pvhSY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1.2f);
+ ObjectAnimator downAnim = ObjectAnimator.ofPropertyValuesHolder(view, pvhTY, pvhSX, pvhSY);
+ downAnim.setInterpolator(sAccelerator);
+
+ pvhTY = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, bottomTY, endTY);
+ pvhSX = PropertyValuesHolder.ofFloat(View.SCALE_X, 1);
+ pvhSY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1);
+ ObjectAnimator upAnim = ObjectAnimator.ofPropertyValuesHolder(view, pvhTY, pvhSX, pvhSY);
+ upAnim.setInterpolator(sDecelerator);
+
+ pvhSX = PropertyValuesHolder.ofFloat(View.SCALE_X, stretch);
+ pvhSY = PropertyValuesHolder.ofFloat(View.SCALE_Y, squash);
+ ObjectAnimator stretchAnim = ObjectAnimator.ofPropertyValuesHolder(view, pvhSX, pvhSY);
+ stretchAnim.setRepeatCount(1);
+ stretchAnim.setRepeatMode(ValueAnimator.REVERSE);
+ stretchAnim.setInterpolator(sDecelerator);
+
+ AnimatorSet set = new AnimatorSet();
+ set.playSequentially(downAnim, stretchAnim, upAnim);
+ set.setDuration(getDuration(SHORT_DURATION));
+ set.start();
+ set.addListener(new AnimatorListenerAdapter() {
+ public void onAnimationEnd(Animator animation) {
+ view.postDelayed(mSquishRunnable, (long) (500 + Math.random() * 2000));
+ }
+ });
+ }
+
+ public static long getDuration(long baseDuration) {
+ return (long) (baseDuration * sDurationScale);
+ }
+
+
+}
diff --git a/samples/training/ContactsList/AndroidManifest.xml b/samples/training/ContactsList/AndroidManifest.xml
new file mode 100644
index 000000000..025e9cf3f
--- /dev/null
+++ b/samples/training/ContactsList/AndroidManifest.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.contactslist"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="5"
+ android:targetSdkVersion="17" />
+
+ <uses-permission android:name="android.permission.READ_CONTACTS" />
+
+ <application
+ android:description="@string/app_description"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme"
+ android:allowBackup="true">
+
+ <!-- When the soft keyboard is showing the views of this activity should be resized in the
+ remaining space so that inline searching can take place without having to dismiss the
+ keyboard to see all the content. Therefore windowSoftInputMode is set to
+ adjustResize. -->
+ <activity
+ android:name=".ui.ContactsListActivity"
+ android:label="@string/activity_contacts_list"
+ android:windowSoftInputMode="adjustResize">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ <!-- Add intent-filter for search intent action and specify searchable configuration
+ via meta-data tag. This allows this activity to receive search intents via the
+ system hooks. In this sample this is only used on older OS versions (pre-Honeycomb)
+ via the activity search dialog. See the Search API guide for more information:
+ http://developer.android.com/guide/topics/search/search-dialog.html -->
+ <intent-filter>
+ <action android:name="android.intent.action.SEARCH" />
+ </intent-filter>
+ <meta-data android:name="android.app.searchable"
+ android:resource="@xml/searchable_contacts" />
+ </activity>
+ <activity
+ android:name=".ui.ContactDetailActivity"
+ android:label="@string/activity_contact_detail"
+ android:parentActivityName=".ui.ContactsListActivity">
+ <!-- Define hierarchical parent of this activity, both via the system
+ parentActivityName attribute (added in API Level 16) and via meta-data annotation.
+ This allows use of the support library NavUtils class in a way that works over
+ all Android versions. See the "Tasks and Back Stack" guide for more information:
+ http://developer.android.com/guide/components/tasks-and-back-stack.html
+ -->
+ <meta-data android:name="android.support.PARENT_ACTIVITY"
+ android:value=".ui.ContactsListActivity" />
+ </activity>
+ </application>
+</manifest>
diff --git a/samples/training/ContactsList/libs/android-support-v4.jar b/samples/training/ContactsList/libs/android-support-v4.jar
new file mode 100644
index 000000000..65ebaf8dc
--- /dev/null
+++ b/samples/training/ContactsList/libs/android-support-v4.jar
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-hdpi-v11/ic_action_add.png b/samples/training/ContactsList/res/drawable-hdpi-v11/ic_action_add.png
new file mode 100644
index 000000000..0e4f33474
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-hdpi-v11/ic_action_add.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-hdpi-v11/ic_action_edit.png b/samples/training/ContactsList/res/drawable-hdpi-v11/ic_action_edit.png
new file mode 100644
index 000000000..9d4c9343b
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-hdpi-v11/ic_action_edit.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-hdpi-v11/ic_action_search.png b/samples/training/ContactsList/res/drawable-hdpi-v11/ic_action_search.png
new file mode 100644
index 000000000..6b7ce8d9e
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-hdpi-v11/ic_action_search.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-hdpi/ic_action_add.png b/samples/training/ContactsList/res/drawable-hdpi/ic_action_add.png
new file mode 100644
index 000000000..644d1c107
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-hdpi/ic_action_add.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-hdpi/ic_action_edit.png b/samples/training/ContactsList/res/drawable-hdpi/ic_action_edit.png
new file mode 100644
index 000000000..d423b9e9b
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-hdpi/ic_action_edit.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-hdpi/ic_action_map.png b/samples/training/ContactsList/res/drawable-hdpi/ic_action_map.png
new file mode 100644
index 000000000..c23391432
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-hdpi/ic_action_map.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-hdpi/ic_action_search.png b/samples/training/ContactsList/res/drawable-hdpi/ic_action_search.png
new file mode 100644
index 000000000..1ef4a82d1
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-hdpi/ic_action_search.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-hdpi/ic_contact_picture_180_holo_light.png b/samples/training/ContactsList/res/drawable-hdpi/ic_contact_picture_180_holo_light.png
new file mode 100644
index 000000000..38e4c30f0
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-hdpi/ic_contact_picture_180_holo_light.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-hdpi/ic_contact_picture_holo_light.png b/samples/training/ContactsList/res/drawable-hdpi/ic_contact_picture_holo_light.png
new file mode 100644
index 000000000..4c0e35e32
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-hdpi/ic_contact_picture_holo_light.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-hdpi/ic_launcher.png b/samples/training/ContactsList/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..2b3a35a64
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-hdpi/quickcontact_badge_small_pressed.9.png b/samples/training/ContactsList/res/drawable-hdpi/quickcontact_badge_small_pressed.9.png
new file mode 100644
index 000000000..ee030fbe7
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-hdpi/quickcontact_badge_small_pressed.9.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-hdpi/quickcontact_badge_small_unpressed.9.png b/samples/training/ContactsList/res/drawable-hdpi/quickcontact_badge_small_unpressed.9.png
new file mode 100644
index 000000000..71409578b
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-hdpi/quickcontact_badge_small_unpressed.9.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-mdpi-v11/ic_action_add.png b/samples/training/ContactsList/res/drawable-mdpi-v11/ic_action_add.png
new file mode 100644
index 000000000..86097d840
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-mdpi-v11/ic_action_add.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-mdpi-v11/ic_action_edit.png b/samples/training/ContactsList/res/drawable-mdpi-v11/ic_action_edit.png
new file mode 100644
index 000000000..71fb427e6
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-mdpi-v11/ic_action_edit.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-mdpi-v11/ic_action_search.png b/samples/training/ContactsList/res/drawable-mdpi-v11/ic_action_search.png
new file mode 100644
index 000000000..aad37b58e
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-mdpi-v11/ic_action_search.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-mdpi/ic_action_add.png b/samples/training/ContactsList/res/drawable-mdpi/ic_action_add.png
new file mode 100644
index 000000000..d7ba6fe04
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-mdpi/ic_action_add.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-mdpi/ic_action_edit.png b/samples/training/ContactsList/res/drawable-mdpi/ic_action_edit.png
new file mode 100644
index 000000000..6a3afe2ba
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-mdpi/ic_action_edit.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-mdpi/ic_action_map.png b/samples/training/ContactsList/res/drawable-mdpi/ic_action_map.png
new file mode 100644
index 000000000..68499c56b
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-mdpi/ic_action_map.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-mdpi/ic_action_search.png b/samples/training/ContactsList/res/drawable-mdpi/ic_action_search.png
new file mode 100644
index 000000000..6b3d131cd
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-mdpi/ic_action_search.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-mdpi/ic_contact_picture_180_holo_light.png b/samples/training/ContactsList/res/drawable-mdpi/ic_contact_picture_180_holo_light.png
new file mode 100644
index 000000000..0b5268339
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-mdpi/ic_contact_picture_180_holo_light.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-mdpi/ic_contact_picture_holo_light.png b/samples/training/ContactsList/res/drawable-mdpi/ic_contact_picture_holo_light.png
new file mode 100644
index 000000000..ead9718b9
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-mdpi/ic_contact_picture_holo_light.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-mdpi/ic_launcher.png b/samples/training/ContactsList/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..1baf72309
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-mdpi/quickcontact_badge_small_pressed.9.png b/samples/training/ContactsList/res/drawable-mdpi/quickcontact_badge_small_pressed.9.png
new file mode 100644
index 000000000..b23e92146
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-mdpi/quickcontact_badge_small_pressed.9.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-mdpi/quickcontact_badge_small_unpressed.9.png b/samples/training/ContactsList/res/drawable-mdpi/quickcontact_badge_small_unpressed.9.png
new file mode 100644
index 000000000..38f14f75b
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-mdpi/quickcontact_badge_small_unpressed.9.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-xhdpi-v11/ic_action_add.png b/samples/training/ContactsList/res/drawable-xhdpi-v11/ic_action_add.png
new file mode 100644
index 000000000..1ebdb432b
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-xhdpi-v11/ic_action_add.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-xhdpi-v11/ic_action_edit.png b/samples/training/ContactsList/res/drawable-xhdpi-v11/ic_action_edit.png
new file mode 100644
index 000000000..6f7e335b9
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-xhdpi-v11/ic_action_edit.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-xhdpi-v11/ic_action_search.png b/samples/training/ContactsList/res/drawable-xhdpi-v11/ic_action_search.png
new file mode 100644
index 000000000..340031b80
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-xhdpi-v11/ic_action_search.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-xhdpi/ic_action_add.png b/samples/training/ContactsList/res/drawable-xhdpi/ic_action_add.png
new file mode 100644
index 000000000..b06447660
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-xhdpi/ic_action_add.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-xhdpi/ic_action_edit.png b/samples/training/ContactsList/res/drawable-xhdpi/ic_action_edit.png
new file mode 100644
index 000000000..6f2eb5985
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-xhdpi/ic_action_edit.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-xhdpi/ic_action_map.png b/samples/training/ContactsList/res/drawable-xhdpi/ic_action_map.png
new file mode 100644
index 000000000..4aed873a6
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-xhdpi/ic_action_map.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-xhdpi/ic_action_search.png b/samples/training/ContactsList/res/drawable-xhdpi/ic_action_search.png
new file mode 100644
index 000000000..c2b58df9e
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-xhdpi/ic_action_search.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-xhdpi/ic_contact_picture_180_holo_light.png b/samples/training/ContactsList/res/drawable-xhdpi/ic_contact_picture_180_holo_light.png
new file mode 100644
index 000000000..f6fd17269
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-xhdpi/ic_contact_picture_180_holo_light.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-xhdpi/ic_contact_picture_holo_light.png b/samples/training/ContactsList/res/drawable-xhdpi/ic_contact_picture_holo_light.png
new file mode 100644
index 000000000..05a65f609
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-xhdpi/ic_contact_picture_holo_light.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-xhdpi/ic_launcher.png b/samples/training/ContactsList/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..e0b49dfe0
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable-xxhdpi/ic_launcher.png b/samples/training/ContactsList/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 000000000..e9e152707
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/ContactsList/res/drawable/quickcontact_badge_small.xml b/samples/training/ContactsList/res/drawable/quickcontact_badge_small.xml
new file mode 100644
index 000000000..9e68152f7
--- /dev/null
+++ b/samples/training/ContactsList/res/drawable/quickcontact_badge_small.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+<!-- Refer to documentation for the <selector> element. -->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item
+ android:state_focused="false"
+ android:state_selected="false"
+ android:state_pressed="false"
+ android:drawable="@drawable/quickcontact_badge_small_unpressed"/>
+
+ <item
+ android:state_pressed="true"
+ android:drawable="@drawable/quickcontact_badge_small_pressed"/>
+
+</selector>
diff --git a/samples/training/ContactsList/res/layout-land/contact_detail_fragment.xml b/samples/training/ContactsList/res/layout-land/contact_detail_fragment.xml
new file mode 100644
index 000000000..a6dd3815c
--- /dev/null
+++ b/samples/training/ContactsList/res/layout-land/contact_detail_fragment.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal"
+ android:weightSum="100">
+
+ <ImageView
+ android:id="@+id/contact_image"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="@integer/contact_detail_photo_percent"
+ android:scaleType="centerCrop"
+ android:src="@drawable/ic_contact_picture_180_holo_light"
+ android:contentDescription="@string/imageview_description"/>
+
+ <LinearLayout
+ android:layout_height="match_parent"
+ android:layout_width="0dp"
+ android:layout_weight="@integer/contact_detail_info_percent"
+ android:orientation="vertical">
+
+ <TextView android:id="@+id/contact_name"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingLeft="@dimen/padding"
+ android:paddingRight="@dimen/padding"
+ android:paddingTop="@dimen/padding"
+ android:visibility="gone"
+ android:textAppearance="@style/contactNameTitle"/>
+
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <LinearLayout
+ android:id="@+id/contact_details_layout"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingBottom="@dimen/padding"
+ android:orientation="vertical">
+ </LinearLayout>
+
+ </ScrollView>
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ <!-- This view will be displayed when the views above are hidden. That happens when in two-pane
+ layout mode and no contact is currently selected and therefore the this fragment will
+ simply show a text message instead of contact details. -->
+ <TextView android:id="@id/android:empty"
+ android:gravity="center"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:text="@string/no_contact_selected"
+ android:fontFamily="sans-serif-light"
+ android:visibility="gone"
+ android:textAppearance="?android:attr/textAppearanceLarge"/>
+
+</FrameLayout>
diff --git a/samples/training/ContactsList/res/layout/activity_main.xml b/samples/training/ContactsList/res/layout/activity_main.xml
new file mode 100644
index 000000000..20fe26bce
--- /dev/null
+++ b/samples/training/ContactsList/res/layout/activity_main.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+
+<!-- Main Activity single pane layout. This layout contains a single ContactsListFragment that
+ displays a list of contacts. Tapping on a contact will start a new activity to display the
+ contact details. -->
+
+<fragment xmlns:android="http://schemas.android.com/apk/res/android"
+ android:name="com.example.android.contactslist.ui.ContactsListFragment"
+ android:id="@+id/contact_list"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"/>
diff --git a/samples/training/ContactsList/res/layout/activity_main_twopanes.xml b/samples/training/ContactsList/res/layout/activity_main_twopanes.xml
new file mode 100644
index 000000000..d67f54811
--- /dev/null
+++ b/samples/training/ContactsList/res/layout/activity_main_twopanes.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+
+<!-- Main Activity two-pane layout. This layout has two panes, a ContactsListFragment on the left
+ and a ContactDetailFragment on the right. Tapping on a contact in the list loads the details
+ of that contact on the right. -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal"
+ android:showDividers="middle"
+ android:divider="?android:attr/listDivider"
+ android:weightSum="100"
+ android:baselineAligned="false">
+
+ <fragment class="com.example.android.contactslist.ui.ContactsListFragment"
+ android:id="@+id/contact_list"
+ android:layout_height="match_parent"
+ android:layout_width="0dp"
+ android:layout_weight="@integer/contact_list_percent"/>
+
+ <fragment class="com.example.android.contactslist.ui.ContactDetailFragment"
+ android:id="@+id/contact_detail"
+ android:layout_height="match_parent"
+ android:layout_width="0dp"
+ android:layout_weight="@integer/contact_detail_percent"/>
+
+</LinearLayout>
diff --git a/samples/training/ContactsList/res/layout/contact_detail_fragment.xml b/samples/training/ContactsList/res/layout/contact_detail_fragment.xml
new file mode 100644
index 000000000..1676e2ec4
--- /dev/null
+++ b/samples/training/ContactsList/res/layout/contact_detail_fragment.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+
+<!-- This layout is used by ContactDetailFragment to show contact details: contact photo, contact
+ display name and a dynamic number of addresses (if the contact has any) inside a ScrollView.
+-->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:weightSum="100">
+
+ <ImageView
+ android:id="@+id/contact_image"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="@integer/contact_detail_photo_percent"
+ android:scaleType="centerCrop"
+ android:src="@drawable/ic_contact_picture_180_holo_light"
+ android:contentDescription="@string/imageview_description"/>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="@integer/contact_detail_info_percent"
+ android:orientation="vertical">
+
+ <TextView android:id="@+id/contact_name"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingLeft="@dimen/padding"
+ android:paddingRight="@dimen/padding"
+ android:paddingTop="@dimen/padding"
+ android:visibility="gone"
+ style="@style/contactNameTitle"/>
+
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <LinearLayout
+ android:id="@+id/contact_details_layout"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingBottom="@dimen/padding"
+ android:orientation="vertical">
+ </LinearLayout>
+
+ </ScrollView>
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ <!-- This view will be displayed when the views above are hidden. That happens when in two-pane
+ layout mode and no contact is currently selected and therefore the this fragment will
+ simply show a text message instead of contact details. -->
+ <TextView android:id="@id/android:empty"
+ android:gravity="center"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:text="@string/no_contact_selected"
+ android:fontFamily="sans-serif-light"
+ android:visibility="gone"
+ android:textAppearance="?android:attr/textAppearanceLarge"/>
+
+</FrameLayout>
diff --git a/samples/training/ContactsList/res/layout/contact_detail_item.xml b/samples/training/ContactsList/res/layout/contact_detail_item.xml
new file mode 100644
index 000000000..b1e832aad
--- /dev/null
+++ b/samples/training/ContactsList/res/layout/contact_detail_item.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+
+<!-- This layout is used to display a single mailing address for a contact. In the case of multiple
+ mailing addresses it could be inflated multiple times and displayed in a ScrollView container
+ to let the user more easily scroll over all addresses. -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:paddingTop="@dimen/padding"
+ android:paddingLeft="@dimen/padding"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <TextView
+ android:id="@+id/contact_detail_header"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ style="@style/addressHeader"/>
+
+ <LinearLayout android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:showDividers="middle"
+ android:dividerPadding="12dp"
+ android:minHeight="48dp"
+ android:divider="?android:attr/listDivider">
+
+ <TextView
+ android:id="@+id/contact_detail_item"
+ android:layout_height="wrap_content"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:paddingRight="@dimen/padding"
+ android:layout_gravity="center"
+ style="@style/addressDetail"/>
+
+ <ImageButton
+ android:id="@+id/button_view_address"
+ android:src="@drawable/ic_action_map"
+ android:layout_height="match_parent"
+ android:layout_width="wrap_content"
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:layout_gravity="center"
+ android:contentDescription="@string/address_button_description"
+ style="@style/addressButton"/>
+
+ </LinearLayout>
+
+</LinearLayout>
diff --git a/samples/training/ContactsList/res/layout/contact_list_fragment.xml b/samples/training/ContactsList/res/layout/contact_list_fragment.xml
new file mode 100644
index 000000000..3fc2ae41b
--- /dev/null
+++ b/samples/training/ContactsList/res/layout/contact_list_fragment.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <!-- Use standard android.R class list id instead of app specific id. This is just useful for
+ consistency. -->
+ <ListView android:id="@id/android:list"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ style="@style/ContactListView"/>
+
+ <!-- Use standard android.R class empty id instead of app specific id. This is just useful for
+ consistency. -->
+ <TextView android:id="@id/android:empty"
+ android:gravity="center"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:text="@string/no_contacts"
+ android:fontFamily="sans-serif-light"
+ android:textAppearance="?android:attr/textAppearanceLarge"/>
+
+</FrameLayout>
diff --git a/samples/training/ContactsList/res/layout/contact_list_item.xml b/samples/training/ContactsList/res/layout/contact_list_item.xml
new file mode 100644
index 000000000..1ca24ad72
--- /dev/null
+++ b/samples/training/ContactsList/res/layout/contact_list_item.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="?android:attr/listPreferredItemHeight"
+ style="@style/listViewActivatedStyle">
+
+ <!-- Use standard android.R class icon id instead of app specific id. This is just useful for
+ consistency. Use scaleType=centerCrop to give a nice full cropped image in the assigned
+ space -->
+ <QuickContactBadge android:id="@android:id/icon"
+ android:layout_height="?android:attr/listPreferredItemHeight"
+ android:layout_width="?android:attr/listPreferredItemHeight"
+ android:scaleType="centerCrop"
+ style="@style/quickContactBadgeStyle"
+ android:src="@drawable/ic_contact_picture_holo_light"/>
+
+ <!-- Use standard android.R class text2 id instead of app specific id. This is just useful for
+ consistency. This is secondary text and not always visible so by default is has its
+ visibility set to gone -->
+ <TextView android:id="@android:id/text2"
+ android:paddingLeft="@dimen/listview_item_padding"
+ android:paddingRight="@dimen/listview_item_padding"
+ android:layout_width="match_parent"
+ android:layout_height="26dp"
+ android:layout_toRightOf="@android:id/icon"
+ android:layout_alignParentBottom="true"
+ android:layout_alignParentRight="true"
+ android:fontFamily="sans-serif"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:visibility="gone"
+ android:text="@string/search_match_other"
+ android:textAppearance="?android:attr/textAppearanceSmall"/>
+
+ <!-- Use standard android.R class text1 id instead of app specific id. This is just useful for
+ consistency. This view also sets layout_alignWithParentIfMissing=true which lets the view
+ align with the parent view if the text2 view is not part of the view hierarchy (which is
+ its initial state). -->
+ <TextView android:id="@android:id/text1"
+ android:paddingLeft="@dimen/listview_item_padding"
+ android:paddingRight="@dimen/listview_item_padding"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_above="@android:id/text2"
+ android:layout_toRightOf="@android:id/icon"
+ android:gravity="center_vertical"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentTop="true"
+ android:layout_alignWithParentIfMissing="true"
+ android:fontFamily="sans-serif-light"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:textAppearance="?android:attr/textAppearanceLarge"/>
+
+</RelativeLayout>
diff --git a/samples/training/ContactsList/res/menu/contact_detail_menu.xml b/samples/training/ContactsList/res/menu/contact_detail_menu.xml
new file mode 100644
index 000000000..f2c17df54
--- /dev/null
+++ b/samples/training/ContactsList/res/menu/contact_detail_menu.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item
+ android:id="@+id/menu_edit_contact"
+ android:title="@string/menu_edit_contact"
+ android:icon="@drawable/ic_action_edit"
+ android:showAsAction="ifRoom"/>
+
+</menu>
diff --git a/samples/training/ContactsList/res/menu/contact_list_menu.xml b/samples/training/ContactsList/res/menu/contact_list_menu.xml
new file mode 100644
index 000000000..e7840547a
--- /dev/null
+++ b/samples/training/ContactsList/res/menu/contact_list_menu.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <!-- The search menu item. Honeycomb and above uses an ActionView or specifically a SearchView
+ which expands within the Action Bar directly. Note the initial collapsed state set using
+ collapseActionView in the showAsAction attribute. -->
+ <item
+ android:id="@+id/menu_search"
+ android:title="@string/menu_search"
+ android:icon="@drawable/ic_action_search"
+ android:showAsAction="ifRoom|collapseActionView"
+ android:actionViewClass="android.widget.SearchView"/>
+
+ <item
+ android:id="@+id/menu_add_contact"
+ android:title="@string/menu_add_contact"
+ android:icon="@drawable/ic_action_add"
+ android:showAsAction="ifRoom"/>
+
+</menu>
diff --git a/samples/training/ContactsList/res/values-sw360dp/styles.xml b/samples/training/ContactsList/res/values-sw360dp/styles.xml
new file mode 100644
index 000000000..eb2583244
--- /dev/null
+++ b/samples/training/ContactsList/res/values-sw360dp/styles.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!-- This style bumps up the address details font size to large on devices that have a smallest
+ width of 360dp (larger phones). -->
+ <style name="addressDetail" parent="@android:style/TextAppearance.Large">
+ <item name="android:fontFamily">sans-serif-light</item>
+ <item name="android:textIsSelectable">true</item>
+ </style>
+
+</resources>
diff --git a/samples/training/ContactsList/res/values-sw600dp-port/integers.xml b/samples/training/ContactsList/res/values-sw600dp-port/integers.xml
new file mode 100644
index 000000000..cb09a2b27
--- /dev/null
+++ b/samples/training/ContactsList/res/values-sw600dp-port/integers.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!-- On devices with a smallest width of 600dp or more in portrait orientation, the two-pane
+ layout should allocate equal space to each fragment. -->
+ <integer name="contact_list_percent">50</integer>
+ <integer name="contact_detail_percent">50</integer>
+
+</resources>
diff --git a/samples/training/ContactsList/res/values-sw600dp/bools.xml b/samples/training/ContactsList/res/values-sw600dp/bools.xml
new file mode 100644
index 000000000..69ce94264
--- /dev/null
+++ b/samples/training/ContactsList/res/values-sw600dp/bools.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!-- On devices with a smallest width of 600dp or more, switch to a two-pane layout.-->
+ <bool name="has_two_panes">true</bool>
+
+</resources>
diff --git a/samples/training/ContactsList/res/values-sw600dp/integers.xml b/samples/training/ContactsList/res/values-sw600dp/integers.xml
new file mode 100644
index 000000000..eef85472f
--- /dev/null
+++ b/samples/training/ContactsList/res/values-sw600dp/integers.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!-- On devices with a smallest width of 600dp or more, the two-pane layout should allocate
+ a larger portion of the screen to the detail fragment. -->
+ <integer name="contact_list_percent">35</integer>
+ <integer name="contact_detail_percent">65</integer>
+
+</resources>
diff --git a/samples/training/ContactsList/res/values-sw600dp/layout.xml b/samples/training/ContactsList/res/values-sw600dp/layout.xml
new file mode 100644
index 000000000..c9f88482b
--- /dev/null
+++ b/samples/training/ContactsList/res/values-sw600dp/layout.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!-- Create a layout alias so that devices with a minimum width of 600dp or more will use the
+ two-pane layout when referring to the activity_main layout identifier. -->
+ <item name="activity_main" type="layout">@layout/activity_main_twopanes</item>
+
+</resources>
diff --git a/samples/training/ContactsList/res/values-sw600dp/styles.xml b/samples/training/ContactsList/res/values-sw600dp/styles.xml
new file mode 100644
index 000000000..980fd977b
--- /dev/null
+++ b/samples/training/ContactsList/res/values-sw600dp/styles.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+<resources>
+
+ <style name="ContactListView">
+ <item name="android:verticalScrollbarPosition">left</item>
+ <item name="android:fastScrollAlwaysVisible">true</item>
+ <item name="android:scrollbarStyle">outsideInset</item>
+ </style>
+
+</resources>
diff --git a/samples/training/ContactsList/res/values-sw720dp/dimens.xml b/samples/training/ContactsList/res/values-sw720dp/dimens.xml
new file mode 100644
index 000000000..2184cd05c
--- /dev/null
+++ b/samples/training/ContactsList/res/values-sw720dp/dimens.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!-- On devices with much larger screen sizes, such as a 10" tablet like Nexus 10, bump up the
+ common padding value to add some extra white space which makes the layouts feel more
+ suitable for the larger screen. -->
+ <dimen name="padding">32dp</dimen>
+
+</resources>
diff --git a/samples/training/ContactsList/res/values-v11/styles.xml b/samples/training/ContactsList/res/values-v11/styles.xml
new file mode 100644
index 000000000..d22ffc989
--- /dev/null
+++ b/samples/training/ContactsList/res/values-v11/styles.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+
+<!-- API Level 11 and above specific resource files. Some of these styles allow us to use new
+ system styles or attributes introduced in API Level 11 and others allow overriding already
+ defined style that are only suitable for older OS versions (such as quickContactBadgeStyle).-->
+
+<resources>
+
+ <style name="AppTheme" parent="@android:style/Theme.Holo.Light"/>
+
+ <style name="listViewActivatedStyle">
+ <item name="android:background">?android:attr/activatedBackgroundIndicator</item>
+ </style>
+
+ <style name="quickContactBadgeStyle"/>
+
+ <style name="addressHeader" parent="@android:style/TextAppearance.Small">
+ <item name="android:textAllCaps">true</item>
+ <item name="android:textStyle">bold</item>
+ <item name="android:textColor">@color/holo_blue</item>
+ </style>
+
+ <style name="addressButton" parent="@android:style/Widget.Holo.Button.Borderless"/>
+
+</resources>
diff --git a/samples/training/ContactsList/res/values/bools.xml b/samples/training/ContactsList/res/values/bools.xml
new file mode 100644
index 000000000..1197eaa65
--- /dev/null
+++ b/samples/training/ContactsList/res/values/bools.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!-- Default is to use a single pane layout -->
+ <bool name="has_two_panes">false</bool>
+
+</resources>
diff --git a/samples/training/ContactsList/res/values/colors.xml b/samples/training/ContactsList/res/values/colors.xml
new file mode 100644
index 000000000..e078dcfcc
--- /dev/null
+++ b/samples/training/ContactsList/res/values/colors.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!-- Define a standard holo blue color. Useful as we can refer to it from various other
+ resource files or even code and it only needs to be updated in one place if we wanted
+ to change it. -->
+ <color name="holo_blue">#FF33B5E5</color>
+
+</resources>
diff --git a/samples/training/ContactsList/res/values/dimens.xml b/samples/training/ContactsList/res/values/dimens.xml
new file mode 100644
index 000000000..25db89d66
--- /dev/null
+++ b/samples/training/ContactsList/res/values/dimens.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!-- Define some key view padding values. This is useful because the values can be used in
+ multiple views and changed from one central location. It also gives us the ability to
+ provide alternate values for different device configurations using resource directory
+ qualifiers. -->
+ <dimen name="padding">16dp</dimen>
+ <dimen name="listview_item_padding">16dp</dimen>
+
+</resources>
diff --git a/samples/training/ContactsList/res/values/integers.xml b/samples/training/ContactsList/res/values/integers.xml
new file mode 100644
index 000000000..10596a60d
--- /dev/null
+++ b/samples/training/ContactsList/res/values/integers.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+<resources>
+
+ <!-- These are the default percent values that the contact photo and information should take up
+ in the ContactDetailFragment. -->
+ <integer name="contact_detail_photo_percent">45</integer>
+ <integer name="contact_detail_info_percent">55</integer>
+
+</resources>
diff --git a/samples/training/ContactsList/res/values/strings.xml b/samples/training/ContactsList/res/values/strings.xml
new file mode 100644
index 000000000..3253e22c6
--- /dev/null
+++ b/samples/training/ContactsList/res/values/strings.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+<resources>
+
+ <string name="app_name">Contacts List</string>
+ <string name="activity_contacts_list">Contacts List</string>
+ <string name="activity_contact_detail">Contact Detail</string>
+ <string name="contacts_list_search_results_title">Contacts List Search for \"%s\"</string>
+ <string name="app_description">This is a sample app, demonstrating use of the Android system Contacts Provider.</string>
+ <string name="imageview_description">Contact Thumbnail</string>
+ <string name="address_button_description">View Address</string>
+ <string name="menu_search">Search</string>
+ <string name="menu_add_contact">Add Contact</string>
+ <string name="menu_edit_contact">Edit Contact</string>
+ <string name="no_contacts">No Contacts Found</string>
+ <string name="no_contact_selected">No Contact Selected</string>
+ <string name="search_hint">Find contacts</string>
+
+ <!-- Used for the AlphabetIndexer in ContactsListFragment to provide quick navigation by
+ alphabet using ListView fast scroll. -->
+ <string name="alphabet">ABCDEFGHIJKLMNOPQRSTUVWXYZ</string>
+
+ <!-- When using ContactsContract.Contacts#CONTENT_FILTER_URI to search contacts, a match occurs
+ when using a number of different fields, such as name, e-mail address, address, phone
+ number, etc. When a match occurs that is not the name, there is currently no way to tell
+ which other field was matched. This string is displayed in the secondary display text in
+ ContactsListFragment when a search query match occurs that is not the display name.
+ -->
+ <string name="search_match_other">Matches Other Field</string>
+
+ <string name="no_address">No addresses found</string>
+ <string name="no_intent_found">No application found to handle this action</string>
+
+</resources>
diff --git a/samples/training/ContactsList/res/values/styles.xml b/samples/training/ContactsList/res/values/styles.xml
new file mode 100644
index 000000000..18d85f53d
--- /dev/null
+++ b/samples/training/ContactsList/res/values/styles.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+
+<!-- This file defines various styles for the application. As this file is located in the /values
+ subdirectory the styles defined here will be used by default unless the styles are redefined
+ inside a more specific resource directory such as /values-sw600dp. -->
+
+<resources>
+
+ <style name="AppTheme" parent="@android:style/Theme"/>
+
+ <style name="ContactListView">
+ <item name="android:verticalScrollbarPosition">right</item>
+ <item name="android:fastScrollAlwaysVisible">true</item>
+ <item name="android:scrollbarStyle">outsideInset</item>
+ </style>
+
+ <style name="listViewActivatedStyle"/>
+
+ <style name="quickContactBadgeStyle">
+ <item name="android:background">@drawable/quickcontact_badge_small</item>
+ </style>
+
+ <style name="searchTextHiglight">
+ <item name="android:textColor">@color/holo_blue</item>
+ <item name="android:textStyle">bold</item>
+ </style>
+
+ <style name="addressHeader" parent="@android:style/TextAppearance.Small">
+ <item name="android:textAllCaps">true</item>
+ <item name="android:textStyle">bold</item>
+ </style>
+
+ <style name="addressDetail" parent="@android:style/TextAppearance.Medium">
+ <item name="android:fontFamily">sans-serif-light</item>
+ <item name="android:textIsSelectable">true</item>
+ </style>
+
+ <style name="contactNameTitle" parent="@android:style/TextAppearance.Large">
+ <item name="android:textSize">38sp</item>
+ <item name="android:fontFamily">sans-serif</item>
+ <item name="android:textIsSelectable">true</item>
+ </style>
+
+ <style name="addressButton"/>
+
+</resources>
diff --git a/samples/training/ContactsList/res/xml/searchable_contacts.xml b/samples/training/ContactsList/res/xml/searchable_contacts.xml
new file mode 100644
index 000000000..ce52eece3
--- /dev/null
+++ b/samples/training/ContactsList/res/xml/searchable_contacts.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 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.
+-->
+
+<!-- Define a searchable configuration. See the docs for more information:
+ http://developer.android.com/guide/topics/search/searchable-config.html -->
+
+<searchable xmlns:android="http://schemas.android.com/apk/res/android"
+ android:label="@string/app_name"
+ android:inputType="textPersonName"
+ android:hint="@string/search_hint"/>
diff --git a/samples/training/ContactsList/src/com/example/android/contactslist/ui/ContactDetailActivity.java b/samples/training/ContactsList/src/com/example/android/contactslist/ui/ContactDetailActivity.java
new file mode 100644
index 000000000..d53017f4f
--- /dev/null
+++ b/samples/training/ContactsList/src/com/example/android/contactslist/ui/ContactDetailActivity.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2013 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.example.android.contactslist.ui;
+
+import android.annotation.TargetApi;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
+import android.support.v4.app.FragmentTransaction;
+import android.support.v4.app.NavUtils;
+import android.view.MenuItem;
+
+import com.example.android.contactslist.BuildConfig;
+import com.example.android.contactslist.util.Utils;
+
+/**
+ * This class defines a simple FragmentActivity as the parent of {@link ContactDetailFragment}.
+ */
+public class ContactDetailActivity extends FragmentActivity {
+ // Defines a tag for identifying the single fragment that this activity holds
+ private static final String TAG = "ContactDetailActivity";
+
+ @TargetApi(Build.VERSION_CODES.HONEYCOMB)
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ if (BuildConfig.DEBUG) {
+ // Enable strict mode checks when in debug modes
+ Utils.enableStrictMode();
+ }
+ super.onCreate(savedInstanceState);
+
+ // This activity expects to receive an intent that contains the uri of a contact
+ if (getIntent() != null) {
+
+ // For OS versions honeycomb and higher use action bar
+ if (Utils.hasHoneycomb()) {
+ // Enables action bar "up" navigation
+ getActionBar().setDisplayHomeAsUpEnabled(true);
+ }
+
+ // Fetch the data Uri from the intent provided to this activity
+ final Uri uri = getIntent().getData();
+
+ // Checks to see if fragment has already been added, otherwise adds a new
+ // ContactDetailFragment with the Uri provided in the intent
+ if (getSupportFragmentManager().findFragmentByTag(TAG) == null) {
+ final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
+
+ // Adds a newly created ContactDetailFragment that is instantiated with the
+ // data Uri
+ ft.add(android.R.id.content, ContactDetailFragment.newInstance(uri), TAG);
+ ft.commit();
+ }
+ } else {
+ // No intent provided, nothing to do so finish()
+ finish();
+ }
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case android.R.id.home:
+ // Tapping on top left ActionBar icon navigates "up" to hierarchical parent screen.
+ // The parent is defined in the AndroidManifest entry for this activity via the
+ // parentActivityName attribute (and via meta-data tag for OS versions before API
+ // Level 16). See the "Tasks and Back Stack" guide for more information:
+ // http://developer.android.com/guide/components/tasks-and-back-stack.html
+ NavUtils.navigateUpFromSameTask(this);
+ return true;
+ }
+ // Otherwise, pass the item to the super implementation for handling, as described in the
+ // documentation.
+ return super.onOptionsItemSelected(item);
+ }
+}
diff --git a/samples/training/ContactsList/src/com/example/android/contactslist/ui/ContactDetailFragment.java b/samples/training/ContactsList/src/com/example/android/contactslist/ui/ContactDetailFragment.java
new file mode 100644
index 000000000..94d477c93
--- /dev/null
+++ b/samples/training/ContactsList/src/com/example/android/contactslist/ui/ContactDetailFragment.java
@@ -0,0 +1,687 @@
+/*
+ * Copyright (C) 2013 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.example.android.contactslist.ui;
+
+import android.annotation.SuppressLint;
+import android.annotation.TargetApi;
+import android.content.ContentResolver;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.res.AssetFileDescriptor;
+import android.database.Cursor;
+import android.graphics.Bitmap;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Contacts.Photo;
+import android.provider.ContactsContract.Data;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.LoaderManager;
+import android.support.v4.content.CursorLoader;
+import android.support.v4.content.Loader;
+import android.util.DisplayMetrics;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.example.android.contactslist.BuildConfig;
+import com.example.android.contactslist.R;
+import com.example.android.contactslist.util.ImageLoader;
+import com.example.android.contactslist.util.Utils;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+/**
+ * This fragment displays details of a specific contact from the contacts provider. It shows the
+ * contact's display photo, name and all its mailing addresses. You can also modify this fragment
+ * to show other information, such as phone numbers, email addresses and so forth.
+ *
+ * This fragment appears full-screen in an activity on devices with small screen sizes, and as
+ * part of a two-pane layout on devices with larger screens, alongside the
+ * {@link ContactsListFragment}.
+ *
+ * To create an instance of this fragment, use the factory method
+ * {@link ContactDetailFragment#newInstance(android.net.Uri)}, passing as an argument the contact
+ * Uri for the contact you want to display.
+ */
+public class ContactDetailFragment extends Fragment implements
+ LoaderManager.LoaderCallbacks<Cursor> {
+
+ public static final String EXTRA_CONTACT_URI =
+ "com.example.android.contactslist.ui.EXTRA_CONTACT_URI";
+
+ // Defines a tag for identifying log entries
+ private static final String TAG = "ContactDetailFragment";
+
+ // The geo Uri scheme prefix, used with Intent.ACTION_VIEW to form a geographical address
+ // intent that will trigger available apps to handle viewing a location (such as Maps)
+ private static final String GEO_URI_SCHEME_PREFIX = "geo:0,0?q=";
+
+ // Whether or not this fragment is showing in a two pane layout
+ private boolean mIsTwoPaneLayout;
+
+ private Uri mContactUri; // Stores the contact Uri for this fragment instance
+ private ImageLoader mImageLoader; // Handles loading the contact image in a background thread
+
+ // Used to store references to key views, layouts and menu items as these need to be updated
+ // in multiple methods throughout this class.
+ private ImageView mImageView;
+ private LinearLayout mDetailsLayout;
+ private TextView mEmptyView;
+ private TextView mContactName;
+ private MenuItem mEditContactMenuItem;
+
+ /**
+ * Factory method to generate a new instance of the fragment given a contact Uri. A factory
+ * method is preferable to simply using the constructor as it handles creating the bundle and
+ * setting the bundle as an argument.
+ *
+ * @param contactUri The contact Uri to load
+ * @return A new instance of {@link ContactDetailFragment}
+ */
+ public static ContactDetailFragment newInstance(Uri contactUri) {
+ // Create new instance of this fragment
+ final ContactDetailFragment fragment = new ContactDetailFragment();
+
+ // Create and populate the args bundle
+ final Bundle args = new Bundle();
+ args.putParcelable(EXTRA_CONTACT_URI, contactUri);
+
+ // Assign the args bundle to the new fragment
+ fragment.setArguments(args);
+
+ // Return fragment
+ return fragment;
+ }
+
+ /**
+ * Fragments require an empty constructor.
+ */
+ public ContactDetailFragment() {}
+
+ /**
+ * Sets the contact that this Fragment displays, or clears the display if the contact argument
+ * is null. This will re-initialize all the views and start the queries to the system contacts
+ * provider to populate the contact information.
+ *
+ * @param contactLookupUri The contact lookup Uri to load and display in this fragment. Passing
+ * null is valid and the fragment will display a message that no
+ * contact is currently selected instead.
+ */
+ public void setContact(Uri contactLookupUri) {
+
+ // In version 3.0 and later, stores the provided contact lookup Uri in a class field. This
+ // Uri is then used at various points in this class to map to the provided contact.
+ if (Utils.hasHoneycomb()) {
+ mContactUri = contactLookupUri;
+ } else {
+ // For versions earlier than Android 3.0, stores a contact Uri that's constructed from
+ // contactLookupUri. Later on, the resulting Uri is combined with
+ // Contacts.Data.CONTENT_DIRECTORY to map to the provided contact. It's done
+ // differently for these earlier versions because Contacts.Data.CONTENT_DIRECTORY works
+ // differently for Android versions before 3.0.
+ mContactUri = Contacts.lookupContact(getActivity().getContentResolver(),
+ contactLookupUri);
+ }
+
+ // If the Uri contains data, load the contact's image and load contact details.
+ if (contactLookupUri != null) {
+ // Asynchronously loads the contact image
+ mImageLoader.loadImage(mContactUri, mImageView);
+
+ // Shows the contact photo ImageView and hides the empty view
+ mImageView.setVisibility(View.VISIBLE);
+ mEmptyView.setVisibility(View.GONE);
+
+ // Shows the edit contact action/menu item
+ if (mEditContactMenuItem != null) {
+ mEditContactMenuItem.setVisible(true);
+ }
+
+ // Starts two queries to to retrieve contact information from the Contacts Provider.
+ // restartLoader() is used instead of initLoader() as this method may be called
+ // multiple times.
+ getLoaderManager().restartLoader(ContactDetailQuery.QUERY_ID, null, this);
+ getLoaderManager().restartLoader(ContactAddressQuery.QUERY_ID, null, this);
+ } else {
+ // If contactLookupUri is null, then the method was called when no contact was selected
+ // in the contacts list. This should only happen in a two-pane layout when the user
+ // hasn't yet selected a contact. Don't display an image for the contact, and don't
+ // account for the view's space in the layout. Turn on the TextView that appears when
+ // the layout is empty, and set the contact name to the empty string. Turn off any menu
+ // items that are visible.
+ mImageView.setVisibility(View.GONE);
+ mEmptyView.setVisibility(View.VISIBLE);
+ mDetailsLayout.removeAllViews();
+ if (mContactName != null) {
+ mContactName.setText("");
+ }
+ if (mEditContactMenuItem != null) {
+ mEditContactMenuItem.setVisible(false);
+ }
+ }
+ }
+
+ /**
+ * When the Fragment is first created, this callback is invoked. It initializes some key
+ * class fields.
+ */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Check if this fragment is part of a two pane set up or a single pane
+ mIsTwoPaneLayout = getResources().getBoolean(R.bool.has_two_panes);
+
+ // Let this fragment contribute menu items
+ setHasOptionsMenu(true);
+
+ /*
+ * The ImageLoader takes care of loading and resizing images asynchronously into the
+ * ImageView. More thorough sample code demonstrating background image loading as well as
+ * details on how it works can be found in the following Android Training class:
+ * http://developer.android.com/training/displaying-bitmaps/
+ */
+ mImageLoader = new ImageLoader(getActivity(), getLargestScreenDimension()) {
+ @Override
+ protected Bitmap processBitmap(Object data) {
+ // This gets called in a background thread and passed the data from
+ // ImageLoader.loadImage().
+ return loadContactPhoto((Uri) data, getImageSize());
+
+ }
+ };
+
+ // Set a placeholder loading image for the image loader
+ mImageLoader.setLoadingImage(R.drawable.ic_contact_picture_180_holo_light);
+
+ // Tell the image loader to set the image directly when it's finished loading
+ // rather than fading in
+ mImageLoader.setImageFadeIn(false);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+
+ // Inflates the main layout to be used by this fragment
+ final View detailView =
+ inflater.inflate(R.layout.contact_detail_fragment, container, false);
+
+ // Gets handles to view objects in the layout
+ mImageView = (ImageView) detailView.findViewById(R.id.contact_image);
+ mDetailsLayout = (LinearLayout) detailView.findViewById(R.id.contact_details_layout);
+ mEmptyView = (TextView) detailView.findViewById(android.R.id.empty);
+
+ if (mIsTwoPaneLayout) {
+ // If this is a two pane view, the following code changes the visibility of the contact
+ // name in details. For a one-pane view, the contact name is displayed as a title.
+ mContactName = (TextView) detailView.findViewById(R.id.contact_name);
+ mContactName.setVisibility(View.VISIBLE);
+ }
+
+ return detailView;
+ }
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ // If not being created from a previous state
+ if (savedInstanceState == null) {
+ // Sets the argument extra as the currently displayed contact
+ setContact(getArguments() != null ?
+ (Uri) getArguments().getParcelable(EXTRA_CONTACT_URI) : null);
+ } else {
+ // If being recreated from a saved state, sets the contact from the incoming
+ // savedInstanceState Bundle
+ setContact((Uri) savedInstanceState.getParcelable(EXTRA_CONTACT_URI));
+ }
+ }
+
+ /**
+ * When the Fragment is being saved in order to change activity state, save the
+ * currently-selected contact.
+ */
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ // Saves the contact Uri
+ outState.putParcelable(EXTRA_CONTACT_URI, mContactUri);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ // When "edit" menu option selected
+ case R.id.menu_edit_contact:
+ // Standard system edit contact intent
+ Intent intent = new Intent(Intent.ACTION_EDIT, mContactUri);
+
+ // Because of an issue in Android 4.0 (API level 14), clicking Done or Back in the
+ // People app doesn't return the user to your app; instead, it displays the People
+ // app's contact list. A workaround, introduced in Android 4.0.3 (API level 15) is
+ // to set a special flag in the extended data for the Intent you send to the People
+ // app. The issue is does not appear in versions prior to Android 4.0. You can use
+ // the flag with any version of the People app; if the workaround isn't needed,
+ // the flag is ignored.
+ intent.putExtra("finishActivityOnSaveCompleted", true);
+
+ // Start the edit activity
+ startActivity(intent);
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ @Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+ super.onCreateOptionsMenu(menu, inflater);
+
+ // Inflates the options menu for this fragment
+ inflater.inflate(R.menu.contact_detail_menu, menu);
+
+ // Gets a handle to the "find" menu item
+ mEditContactMenuItem = menu.findItem(R.id.menu_edit_contact);
+
+ // If contactUri is null the edit menu item should be hidden, otherwise
+ // it is visible.
+ mEditContactMenuItem.setVisible(mContactUri != null);
+ }
+
+ @Override
+ public Loader<Cursor> onCreateLoader(int id, Bundle args) {
+ switch (id) {
+ // Two main queries to load the required information
+ case ContactDetailQuery.QUERY_ID:
+ // This query loads main contact details, see
+ // ContactDetailQuery for more information.
+ return new CursorLoader(getActivity(), mContactUri,
+ ContactDetailQuery.PROJECTION,
+ null, null, null);
+ case ContactAddressQuery.QUERY_ID:
+ // This query loads contact address details, see
+ // ContactAddressQuery for more information.
+ final Uri uri = Uri.withAppendedPath(mContactUri, Contacts.Data.CONTENT_DIRECTORY);
+ return new CursorLoader(getActivity(), uri,
+ ContactAddressQuery.PROJECTION,
+ ContactAddressQuery.SELECTION,
+ null, null);
+ }
+ return null;
+ }
+
+ @Override
+ public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
+
+ // If this fragment was cleared while the query was running
+ // eg. from from a call like setContact(uri) then don't do
+ // anything.
+ if (mContactUri == null) {
+ return;
+ }
+
+ switch (loader.getId()) {
+ case ContactDetailQuery.QUERY_ID:
+ // Moves to the first row in the Cursor
+ if (data.moveToFirst()) {
+ // For the contact details query, fetches the contact display name.
+ // ContactDetailQuery.DISPLAY_NAME maps to the appropriate display
+ // name field based on OS version.
+ final String contactName = data.getString(ContactDetailQuery.DISPLAY_NAME);
+ if (mIsTwoPaneLayout && mContactName != null) {
+ // In the two pane layout, there is a dedicated TextView
+ // that holds the contact name.
+ mContactName.setText(contactName);
+ } else {
+ // In the single pane layout, sets the activity title
+ // to the contact name. On HC+ this will be set as
+ // the ActionBar title text.
+ getActivity().setTitle(contactName);
+ }
+ }
+ break;
+ case ContactAddressQuery.QUERY_ID:
+ // This query loads the contact address details. More than
+ // one contact address is possible, so move each one to a
+ // LinearLayout in a Scrollview so multiple addresses can
+ // be scrolled by the user.
+
+ // Each LinearLayout has the same LayoutParams so this can
+ // be created once and used for each address.
+ final LinearLayout.LayoutParams layoutParams =
+ new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.WRAP_CONTENT);
+
+ // Clears out the details layout first in case the details
+ // layout has addresses from a previous data load still
+ // added as children.
+ mDetailsLayout.removeAllViews();
+
+ // Loops through all the rows in the Cursor
+ if (data.moveToFirst()) {
+ do {
+ // Builds the address layout
+ final LinearLayout layout = buildAddressLayout(
+ data.getInt(ContactAddressQuery.TYPE),
+ data.getString(ContactAddressQuery.LABEL),
+ data.getString(ContactAddressQuery.ADDRESS));
+ // Adds the new address layout to the details layout
+ mDetailsLayout.addView(layout, layoutParams);
+ } while (data.moveToNext());
+ } else {
+ // If nothing found, adds an empty address layout
+ mDetailsLayout.addView(buildEmptyAddressLayout(), layoutParams);
+ }
+ break;
+ }
+ }
+
+ @Override
+ public void onLoaderReset(Loader<Cursor> loader) {
+ // Nothing to do here. The Cursor does not need to be released as it was never directly
+ // bound to anything (like an adapter).
+ }
+
+ /**
+ * Builds an empty address layout that just shows that no addresses
+ * were found for this contact.
+ *
+ * @return A LinearLayout to add to the contact details layout
+ */
+ private LinearLayout buildEmptyAddressLayout() {
+ return buildAddressLayout(0, null, null);
+ }
+
+ /**
+ * Builds an address LinearLayout based on address information from the Contacts Provider.
+ * Each address for the contact gets its own LinearLayout object; for example, if the contact
+ * has three postal addresses, then 3 LinearLayouts are generated.
+ *
+ * @param addressType From
+ * {@link android.provider.ContactsContract.CommonDataKinds.StructuredPostal#TYPE}
+ * @param addressTypeLabel From
+ * {@link android.provider.ContactsContract.CommonDataKinds.StructuredPostal#LABEL}
+ * @param address From
+ * {@link android.provider.ContactsContract.CommonDataKinds.StructuredPostal#FORMATTED_ADDRESS}
+ * @return A LinearLayout to add to the contact details layout,
+ * populated with the provided address details.
+ */
+ private LinearLayout buildAddressLayout(int addressType, String addressTypeLabel,
+ final String address) {
+
+ // Inflates the address layout
+ final LinearLayout addressLayout =
+ (LinearLayout) LayoutInflater.from(getActivity()).inflate(
+ R.layout.contact_detail_item, mDetailsLayout, false);
+
+ // Gets handles to the view objects in the layout
+ final TextView headerTextView =
+ (TextView) addressLayout.findViewById(R.id.contact_detail_header);
+ final TextView addressTextView =
+ (TextView) addressLayout.findViewById(R.id.contact_detail_item);
+ final ImageButton viewAddressButton =
+ (ImageButton) addressLayout.findViewById(R.id.button_view_address);
+
+ // If there's no addresses for the contact, shows the empty view and message, and hides the
+ // header and button.
+ if (addressTypeLabel == null && addressType == 0) {
+ headerTextView.setVisibility(View.GONE);
+ viewAddressButton.setVisibility(View.GONE);
+ addressTextView.setText(R.string.no_address);
+ } else {
+ // Gets postal address label type
+ CharSequence label =
+ StructuredPostal.getTypeLabel(getResources(), addressType, addressTypeLabel);
+
+ // Sets TextView objects in the layout
+ headerTextView.setText(label);
+ addressTextView.setText(address);
+
+ // Defines an onClickListener object for the address button
+ viewAddressButton.setOnClickListener(new View.OnClickListener() {
+ // Defines what to do when users click the address button
+ @Override
+ public void onClick(View view) {
+
+ final Intent viewIntent =
+ new Intent(Intent.ACTION_VIEW, constructGeoUri(address));
+
+ // A PackageManager instance is needed to verify that there's a default app
+ // that handles ACTION_VIEW and a geo Uri.
+ final PackageManager packageManager = getActivity().getPackageManager();
+
+ // Checks for an activity that can handle this intent. Preferred in this
+ // case over Intent.createChooser() as it will still let the user choose
+ // a default (or use a previously set default) for geo Uris.
+ if (packageManager.resolveActivity(
+ viewIntent, PackageManager.MATCH_DEFAULT_ONLY) != null) {
+ startActivity(viewIntent);
+ } else {
+ // If no default is found, displays a message that no activity can handle
+ // the view button.
+ Toast.makeText(getActivity(),
+ R.string.no_intent_found, Toast.LENGTH_SHORT).show();
+ }
+ }
+ });
+
+ }
+ return addressLayout;
+ }
+
+ /**
+ * Constructs a geo scheme Uri from a postal address.
+ *
+ * @param postalAddress A postal address.
+ * @return the geo:// Uri for the postal address.
+ */
+ private Uri constructGeoUri(String postalAddress) {
+ // Concatenates the geo:// prefix to the postal address. The postal address must be
+ // converted to Uri format and encoded for special characters.
+ return Uri.parse(GEO_URI_SCHEME_PREFIX + Uri.encode(postalAddress));
+ }
+
+ /**
+ * Fetches the width or height of the screen in pixels, whichever is larger. This is used to
+ * set a maximum size limit on the contact photo that is retrieved from the Contacts Provider.
+ * This limit prevents the app from trying to decode and load an image that is much larger than
+ * the available screen area.
+ *
+ * @return The largest screen dimension in pixels.
+ */
+ private int getLargestScreenDimension() {
+ // Gets a DisplayMetrics object, which is used to retrieve the display's pixel height and
+ // width
+ final DisplayMetrics displayMetrics = new DisplayMetrics();
+
+ // Retrieves a displayMetrics object for the device's default display
+ getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
+ final int height = displayMetrics.heightPixels;
+ final int width = displayMetrics.widthPixels;
+
+ // Returns the larger of the two values
+ return height > width ? height : width;
+ }
+
+ /**
+ * Decodes and returns the contact's thumbnail image.
+ * @param contactUri The Uri of the contact containing the image.
+ * @param imageSize The desired target width and height of the output image in pixels.
+ * @return If a thumbnail image exists for the contact, a Bitmap image, otherwise null.
+ */
+ @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
+ private Bitmap loadContactPhoto(Uri contactUri, int imageSize) {
+
+ // Ensures the Fragment is still added to an activity. As this method is called in a
+ // background thread, there's the possibility the Fragment is no longer attached and
+ // added to an activity. If so, no need to spend resources loading the contact photo.
+ if (!isAdded() || getActivity() == null) {
+ return null;
+ }
+
+ // Instantiates a ContentResolver for retrieving the Uri of the image
+ final ContentResolver contentResolver = getActivity().getContentResolver();
+
+ // Instantiates an AssetFileDescriptor. Given a content Uri pointing to an image file, the
+ // ContentResolver can return an AssetFileDescriptor for the file.
+ AssetFileDescriptor afd = null;
+
+ if (Utils.hasICS()) {
+ // On platforms running Android 4.0 (API version 14) and later, a high resolution image
+ // is available from Photo.DISPLAY_PHOTO.
+ try {
+ // Constructs the content Uri for the image
+ Uri displayImageUri = Uri.withAppendedPath(contactUri, Photo.DISPLAY_PHOTO);
+
+ // Retrieves an AssetFileDescriptor from the Contacts Provider, using the
+ // constructed Uri
+ afd = contentResolver.openAssetFileDescriptor(displayImageUri, "r");
+ // If the file exists
+ if (afd != null) {
+ // Reads and decodes the file to a Bitmap and scales it to the desired size
+ return ImageLoader.decodeSampledBitmapFromDescriptor(
+ afd.getFileDescriptor(), imageSize, imageSize);
+ }
+ } catch (FileNotFoundException e) {
+ // Catches file not found exceptions
+ if (BuildConfig.DEBUG) {
+ // Log debug message, this is not an error message as this exception is thrown
+ // when a contact is legitimately missing a contact photo (which will be quite
+ // frequently in a long contacts list).
+ Log.d(TAG, "Contact photo not found for contact " + contactUri.toString()
+ + ": " + e.toString());
+ }
+ } finally {
+ // Once the decode is complete, this closes the file. You must do this each time
+ // you access an AssetFileDescriptor; otherwise, every image load you do will open
+ // a new descriptor.
+ if (afd != null) {
+ try {
+ afd.close();
+ } catch (IOException e) {
+ // Closing a file descriptor might cause an IOException if the file is
+ // already closed. Nothing extra is needed to handle this.
+ }
+ }
+ }
+ }
+
+ // If the platform version is less than Android 4.0 (API Level 14), use the only available
+ // image URI, which points to a normal-sized image.
+ try {
+ // Constructs the image Uri from the contact Uri and the directory twig from the
+ // Contacts.Photo table
+ Uri imageUri = Uri.withAppendedPath(contactUri, Photo.CONTENT_DIRECTORY);
+
+ // Retrieves an AssetFileDescriptor from the Contacts Provider, using the constructed
+ // Uri
+ afd = getActivity().getContentResolver().openAssetFileDescriptor(imageUri, "r");
+
+ // If the file exists
+ if (afd != null) {
+ // Reads the image from the file, decodes it, and scales it to the available screen
+ // area
+ return ImageLoader.decodeSampledBitmapFromDescriptor(
+ afd.getFileDescriptor(), imageSize, imageSize);
+ }
+ } catch (FileNotFoundException e) {
+ // Catches file not found exceptions
+ if (BuildConfig.DEBUG) {
+ // Log debug message, this is not an error message as this exception is thrown
+ // when a contact is legitimately missing a contact photo (which will be quite
+ // frequently in a long contacts list).
+ Log.d(TAG, "Contact photo not found for contact " + contactUri.toString()
+ + ": " + e.toString());
+ }
+ } finally {
+ // Once the decode is complete, this closes the file. You must do this each time you
+ // access an AssetFileDescriptor; otherwise, every image load you do will open a new
+ // descriptor.
+ if (afd != null) {
+ try {
+ afd.close();
+ } catch (IOException e) {
+ // Closing a file descriptor might cause an IOException if the file is
+ // already closed. Ignore this.
+ }
+ }
+ }
+
+ // If none of the case selectors match, returns null.
+ return null;
+ }
+
+ /**
+ * This interface defines constants used by contact retrieval queries.
+ */
+ public interface ContactDetailQuery {
+ // A unique query ID to distinguish queries being run by the
+ // LoaderManager.
+ final static int QUERY_ID = 1;
+
+ // The query projection (columns to fetch from the provider)
+ @SuppressLint("InlinedApi")
+ final static String[] PROJECTION = {
+ Contacts._ID,
+ Utils.hasHoneycomb() ? Contacts.DISPLAY_NAME_PRIMARY : Contacts.DISPLAY_NAME,
+ };
+
+ // The query column numbers which map to each value in the projection
+ final static int ID = 0;
+ final static int DISPLAY_NAME = 1;
+ }
+
+ /**
+ * This interface defines constants used by address retrieval queries.
+ */
+ public interface ContactAddressQuery {
+ // A unique query ID to distinguish queries being run by the
+ // LoaderManager.
+ final static int QUERY_ID = 2;
+
+ // The query projection (columns to fetch from the provider)
+ final static String[] PROJECTION = {
+ StructuredPostal._ID,
+ StructuredPostal.FORMATTED_ADDRESS,
+ StructuredPostal.TYPE,
+ StructuredPostal.LABEL,
+ };
+
+ // The query selection criteria. In this case matching against the
+ // StructuredPostal content mime type.
+ final static String SELECTION =
+ Data.MIMETYPE + "='" + StructuredPostal.CONTENT_ITEM_TYPE + "'";
+
+ // The query column numbers which map to each value in the projection
+ final static int ID = 0;
+ final static int ADDRESS = 1;
+ final static int TYPE = 2;
+ final static int LABEL = 3;
+ }
+}
diff --git a/samples/training/ContactsList/src/com/example/android/contactslist/ui/ContactsListActivity.java b/samples/training/ContactsList/src/com/example/android/contactslist/ui/ContactsListActivity.java
new file mode 100644
index 000000000..3a6cab25c
--- /dev/null
+++ b/samples/training/ContactsList/src/com/example/android/contactslist/ui/ContactsListActivity.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2013 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.example.android.contactslist.ui;
+
+import android.app.SearchManager;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
+
+import com.example.android.contactslist.BuildConfig;
+import com.example.android.contactslist.R;
+import com.example.android.contactslist.util.Utils;
+
+/**
+ * FragmentActivity to hold the main {@link ContactsListFragment}. On larger screen devices which
+ * can fit two panes also load {@link ContactDetailFragment}.
+ */
+public class ContactsListActivity extends FragmentActivity implements
+ ContactsListFragment.OnContactsInteractionListener {
+
+ // Defines a tag for identifying log entries
+ private static final String TAG = "ContactsListActivity";
+
+ private ContactDetailFragment mContactDetailFragment;
+
+ // If true, this is a larger screen device which fits two panes
+ private boolean isTwoPaneLayout;
+
+ // True if this activity instance is a search result view (used on pre-HC devices that load
+ // search results in a separate instance of the activity rather than loading results in-line
+ // as the query is typed.
+ private boolean isSearchResultView = false;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ if (BuildConfig.DEBUG) {
+ Utils.enableStrictMode();
+ }
+ super.onCreate(savedInstanceState);
+
+ // Set main content view. On smaller screen devices this is a single pane view with one
+ // fragment. One larger screen devices this is a two pane view with two fragments.
+ setContentView(R.layout.activity_main);
+
+ // Check if two pane bool is set based on resource directories
+ isTwoPaneLayout = getResources().getBoolean(R.bool.has_two_panes);
+
+ // Check if this activity instance has been triggered as a result of a search query. This
+ // will only happen on pre-HC OS versions as from HC onward search is carried out using
+ // an ActionBar SearchView which carries out the search in-line without loading a new
+ // Activity.
+ if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) {
+
+ // Fetch query from intent and notify the fragment that it should display search
+ // results instead of all contacts.
+ String searchQuery = getIntent().getStringExtra(SearchManager.QUERY);
+ ContactsListFragment mContactsListFragment = (ContactsListFragment)
+ getSupportFragmentManager().findFragmentById(R.id.contact_list);
+
+ // This flag notes that the Activity is doing a search, and so the result will be
+ // search results rather than all contacts. This prevents the Activity and Fragment
+ // from trying to a search on search results.
+ isSearchResultView = true;
+ mContactsListFragment.setSearchQuery(searchQuery);
+
+ // Set special title for search results
+ String title = getString(R.string.contacts_list_search_results_title, searchQuery);
+ setTitle(title);
+ }
+
+ if (isTwoPaneLayout) {
+ // If two pane layout, locate the contact detail fragment
+ mContactDetailFragment = (ContactDetailFragment)
+ getSupportFragmentManager().findFragmentById(R.id.contact_detail);
+ }
+ }
+
+ /**
+ * This interface callback lets the main contacts list fragment notify
+ * this activity that a contact has been selected.
+ *
+ * @param contactUri The contact Uri to the selected contact.
+ */
+ @Override
+ public void onContactSelected(Uri contactUri) {
+ if (isTwoPaneLayout && mContactDetailFragment != null) {
+ // If two pane layout then update the detail fragment to show the selected contact
+ mContactDetailFragment.setContact(contactUri);
+ } else {
+ // Otherwise single pane layout, start a new ContactDetailActivity with
+ // the contact Uri
+ Intent intent = new Intent(this, ContactDetailActivity.class);
+ intent.setData(contactUri);
+ startActivity(intent);
+ }
+ }
+
+ /**
+ * This interface callback lets the main contacts list fragment notify
+ * this activity that a contact is no longer selected.
+ */
+ @Override
+ public void onSelectionCleared() {
+ if (isTwoPaneLayout && mContactDetailFragment != null) {
+ mContactDetailFragment.setContact(null);
+ }
+ }
+
+ @Override
+ public boolean onSearchRequested() {
+ // Don't allow another search if this activity instance is already showing
+ // search results. Only used pre-HC.
+ return !isSearchResultView && super.onSearchRequested();
+ }
+}
diff --git a/samples/training/ContactsList/src/com/example/android/contactslist/ui/ContactsListFragment.java b/samples/training/ContactsList/src/com/example/android/contactslist/ui/ContactsListFragment.java
new file mode 100644
index 000000000..c3a8a66b1
--- /dev/null
+++ b/samples/training/ContactsList/src/com/example/android/contactslist/ui/ContactsListFragment.java
@@ -0,0 +1,935 @@
+/*
+ * Copyright (C) 2013 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.example.android.contactslist.ui;
+
+import android.annotation.SuppressLint;
+import android.annotation.TargetApi;
+import android.app.Activity;
+import android.app.SearchManager;
+import android.content.Context;
+import android.content.Intent;
+import android.content.res.AssetFileDescriptor;
+import android.database.Cursor;
+import android.graphics.Bitmap;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Contacts.Photo;
+import android.support.v4.app.ListFragment;
+import android.support.v4.app.LoaderManager;
+import android.support.v4.content.CursorLoader;
+import android.support.v4.content.Loader;
+import android.support.v4.widget.CursorAdapter;
+import android.text.SpannableString;
+import android.text.TextUtils;
+import android.text.style.TextAppearanceSpan;
+import android.util.DisplayMetrics;
+import android.util.Log;
+import android.util.TypedValue;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AbsListView;
+import android.widget.AdapterView;
+import android.widget.AlphabetIndexer;
+import android.widget.ListView;
+import android.widget.QuickContactBadge;
+import android.widget.SearchView;
+import android.widget.SectionIndexer;
+import android.widget.TextView;
+
+import com.example.android.contactslist.BuildConfig;
+import com.example.android.contactslist.R;
+import com.example.android.contactslist.util.ImageLoader;
+import com.example.android.contactslist.util.Utils;
+
+import java.io.FileDescriptor;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Locale;
+
+/**
+ * This fragment displays a list of contacts stored in the Contacts Provider. Each item in the list
+ * shows the contact's thumbnail photo and display name. On devices with large screens, this
+ * fragment's UI appears as part of a two-pane layout, along with the UI of
+ * {@link ContactDetailFragment}. On smaller screens, this fragment's UI appears as a single pane.
+ *
+ * This Fragment retrieves contacts based on a search string. If the user doesn't enter a search
+ * string, then the list contains all the contacts in the Contacts Provider. If the user enters a
+ * search string, then the list contains only those contacts whose data matches the string. The
+ * Contacts Provider itself controls the matching algorithm, which is a "substring" search: if the
+ * search string is a substring of any of the contacts data, then there is a match.
+ *
+ * On newer API platforms, the search is implemented in a SearchView in the ActionBar; as the user
+ * types the search string, the list automatically refreshes to display results ("type to filter").
+ * On older platforms, the user must enter the full string and trigger the search. In response, the
+ * trigger starts a new Activity which loads a fresh instance of this fragment. The resulting UI
+ * displays the filtered list and disables the search feature to prevent furthering searching.
+ */
+public class ContactsListFragment extends ListFragment implements
+ AdapterView.OnItemClickListener, LoaderManager.LoaderCallbacks<Cursor> {
+
+ // Defines a tag for identifying log entries
+ private static final String TAG = "ContactsListFragment";
+
+ // Bundle key for saving previously selected search result item
+ private static final String STATE_PREVIOUSLY_SELECTED_KEY =
+ "com.example.android.contactslist.ui.SELECTED_ITEM";
+
+ private ContactsAdapter mAdapter; // The main query adapter
+ private ImageLoader mImageLoader; // Handles loading the contact image in a background thread
+ private String mSearchTerm; // Stores the current search query term
+
+ // Contact selected listener that allows the activity holding this fragment to be notified of
+ // a contact being selected
+ private OnContactsInteractionListener mOnContactSelectedListener;
+
+ // Stores the previously selected search item so that on a configuration change the same item
+ // can be reselected again
+ private int mPreviouslySelectedSearchItem = 0;
+
+ // Whether or not the search query has changed since the last time the loader was refreshed
+ private boolean mSearchQueryChanged;
+
+ // Whether or not this fragment is showing in a two-pane layout
+ private boolean mIsTwoPaneLayout;
+
+ // Whether or not this is a search result view of this fragment, only used on pre-honeycomb
+ // OS versions as search results are shown in-line via Action Bar search from honeycomb onward
+ private boolean mIsSearchResultView = false;
+
+ /**
+ * Fragments require an empty constructor.
+ */
+ public ContactsListFragment() {}
+
+ /**
+ * In platform versions prior to Android 3.0, the ActionBar and SearchView are not supported,
+ * and the UI gets the search string from an EditText. However, the fragment doesn't allow
+ * another search when search results are already showing. This would confuse the user, because
+ * the resulting search would re-query the Contacts Provider instead of searching the listed
+ * results. This method sets the search query and also a boolean that tracks if this Fragment
+ * should be displayed as a search result view or not.
+ *
+ * @param query The contacts search query.
+ */
+ public void setSearchQuery(String query) {
+ if (TextUtils.isEmpty(query)) {
+ mIsSearchResultView = false;
+ } else {
+ mSearchTerm = query;
+ mIsSearchResultView = true;
+ }
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Check if this fragment is part of a two-pane set up or a single pane by reading a
+ // boolean from the application resource directories. This lets allows us to easily specify
+ // which screen sizes should use a two-pane layout by setting this boolean in the
+ // corresponding resource size-qualified directory.
+ mIsTwoPaneLayout = getResources().getBoolean(R.bool.has_two_panes);
+
+ // Let this fragment contribute menu items
+ setHasOptionsMenu(true);
+
+ // Create the main contacts adapter
+ mAdapter = new ContactsAdapter(getActivity());
+
+ if (savedInstanceState != null) {
+ // If we're restoring state after this fragment was recreated then
+ // retrieve previous search term and previously selected search
+ // result.
+ mSearchTerm = savedInstanceState.getString(SearchManager.QUERY);
+ mPreviouslySelectedSearchItem =
+ savedInstanceState.getInt(STATE_PREVIOUSLY_SELECTED_KEY, 0);
+ }
+
+ /*
+ * An ImageLoader object loads and resizes an image in the background and binds it to the
+ * QuickContactBadge in each item layout of the ListView. ImageLoader implements memory
+ * caching for each image, which substantially improves refreshes of the ListView as the
+ * user scrolls through it.
+ *
+ * To learn more about downloading images asynchronously and caching the results, read the
+ * Android training class Displaying Bitmaps Efficiently.
+ *
+ * http://developer.android.com/training/displaying-bitmaps/
+ */
+ mImageLoader = new ImageLoader(getActivity(), getListPreferredItemHeight()) {
+ @Override
+ protected Bitmap processBitmap(Object data) {
+ // This gets called in a background thread and passed the data from
+ // ImageLoader.loadImage().
+ return loadContactPhotoThumbnail((String) data, getImageSize());
+ }
+ };
+
+ // Set a placeholder loading image for the image loader
+ mImageLoader.setLoadingImage(R.drawable.ic_contact_picture_holo_light);
+
+ // Add a cache to the image loader
+ mImageLoader.addImageCache(getActivity().getSupportFragmentManager(), 0.1f);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ // Inflate the list fragment layout
+ return inflater.inflate(R.layout.contact_list_fragment, container, false);
+ }
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+
+ // Set up ListView, assign adapter and set some listeners. The adapter was previously
+ // created in onCreate().
+ setListAdapter(mAdapter);
+ getListView().setOnItemClickListener(this);
+ getListView().setOnScrollListener(new AbsListView.OnScrollListener() {
+ @Override
+ public void onScrollStateChanged(AbsListView absListView, int scrollState) {
+ // Pause image loader to ensure smoother scrolling when flinging
+ if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_FLING) {
+ mImageLoader.setPauseWork(true);
+ } else {
+ mImageLoader.setPauseWork(false);
+ }
+ }
+
+ @Override
+ public void onScroll(AbsListView absListView, int i, int i1, int i2) {}
+ });
+
+ if (mIsTwoPaneLayout) {
+ // In a two-pane layout, set choice mode to single as there will be two panes
+ // when an item in the ListView is selected it should remain highlighted while
+ // the content shows in the second pane.
+ getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
+ }
+
+ // If there's a previously selected search item from a saved state then don't bother
+ // initializing the loader as it will be restarted later when the query is populated into
+ // the action bar search view (see onQueryTextChange() in onCreateOptionsMenu()).
+ if (mPreviouslySelectedSearchItem == 0) {
+ // Initialize the loader, and create a loader identified by ContactsQuery.QUERY_ID
+ getLoaderManager().initLoader(ContactsQuery.QUERY_ID, null, this);
+ }
+ }
+
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+
+ try {
+ // Assign callback listener which the holding activity must implement. This is used
+ // so that when a contact item is interacted with (selected by the user) the holding
+ // activity will be notified and can take further action such as populating the contact
+ // detail pane (if in multi-pane layout) or starting a new activity with the contact
+ // details (single pane layout).
+ mOnContactSelectedListener = (OnContactsInteractionListener) activity;
+ } catch (ClassCastException e) {
+ throw new ClassCastException(activity.toString()
+ + " must implement OnContactsInteractionListener");
+ }
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+
+ // In the case onPause() is called during a fling the image loader is
+ // un-paused to let any remaining background work complete.
+ mImageLoader.setPauseWork(false);
+ }
+
+ @Override
+ public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
+ // Gets the Cursor object currently bound to the ListView
+ final Cursor cursor = mAdapter.getCursor();
+
+ // Moves to the Cursor row corresponding to the ListView item that was clicked
+ cursor.moveToPosition(position);
+
+ // Creates a contact lookup Uri from contact ID and lookup_key
+ final Uri uri = Contacts.getLookupUri(
+ cursor.getLong(ContactsQuery.ID),
+ cursor.getString(ContactsQuery.LOOKUP_KEY));
+
+ // Notifies the parent activity that the user selected a contact. In a two-pane layout, the
+ // parent activity loads a ContactDetailFragment that displays the details for the selected
+ // contact. In a single-pane layout, the parent activity starts a new activity that
+ // displays contact details in its own Fragment.
+ mOnContactSelectedListener.onContactSelected(uri);
+
+ // If two-pane layout sets the selected item to checked so it remains highlighted. In a
+ // single-pane layout a new activity is started so this is not needed.
+ if (mIsTwoPaneLayout) {
+ getListView().setItemChecked(position, true);
+ }
+ }
+
+ /**
+ * Called when ListView selection is cleared, for example
+ * when search mode is finished and the currently selected
+ * contact should no longer be selected.
+ */
+ private void onSelectionCleared() {
+ // Uses callback to notify activity this contains this fragment
+ mOnContactSelectedListener.onSelectionCleared();
+
+ // Clears currently checked item
+ getListView().clearChoices();
+ }
+
+ // This method uses APIs from newer OS versions than the minimum that this app supports. This
+ // annotation tells Android lint that they are properly guarded so they won't run on older OS
+ // versions and can be ignored by lint.
+ @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
+ @Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+
+ // Inflate the menu items
+ inflater.inflate(R.menu.contact_list_menu, menu);
+ // Locate the search item
+ MenuItem searchItem = menu.findItem(R.id.menu_search);
+
+ // In versions prior to Android 3.0, hides the search item to prevent additional
+ // searches. In Android 3.0 and later, searching is done via a SearchView in the ActionBar.
+ // Since the search doesn't create a new Activity to do the searching, the menu item
+ // doesn't need to be turned off.
+ if (mIsSearchResultView) {
+ searchItem.setVisible(false);
+ }
+
+ // In version 3.0 and later, sets up and configures the ActionBar SearchView
+ if (Utils.hasHoneycomb()) {
+
+ // Retrieves the system search manager service
+ final SearchManager searchManager =
+ (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE);
+
+ // Retrieves the SearchView from the search menu item
+ final SearchView searchView = (SearchView) searchItem.getActionView();
+
+ // Assign searchable info to SearchView
+ searchView.setSearchableInfo(
+ searchManager.getSearchableInfo(getActivity().getComponentName()));
+
+ // Set listeners for SearchView
+ searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
+ @Override
+ public boolean onQueryTextSubmit(String queryText) {
+ // Nothing needs to happen when the user submits the search string
+ return true;
+ }
+
+ @Override
+ public boolean onQueryTextChange(String newText) {
+ // Called when the action bar search text has changed. Updates
+ // the search filter, and restarts the loader to do a new query
+ // using the new search string.
+ String newFilter = !TextUtils.isEmpty(newText) ? newText : null;
+
+ // Don't do anything if the filter is empty
+ if (mSearchTerm == null && newFilter == null) {
+ return true;
+ }
+
+ // Don't do anything if the new filter is the same as the current filter
+ if (mSearchTerm != null && mSearchTerm.equals(newFilter)) {
+ return true;
+ }
+
+ // Updates current filter to new filter
+ mSearchTerm = newFilter;
+
+ // Restarts the loader. This triggers onCreateLoader(), which builds the
+ // necessary content Uri from mSearchTerm.
+ mSearchQueryChanged = true;
+ getLoaderManager().restartLoader(
+ ContactsQuery.QUERY_ID, null, ContactsListFragment.this);
+ return true;
+ }
+ });
+
+ if (Utils.hasICS()) {
+ // This listener added in ICS
+ searchItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
+ @Override
+ public boolean onMenuItemActionExpand(MenuItem menuItem) {
+ // Nothing to do when the action item is expanded
+ return true;
+ }
+
+ @Override
+ public boolean onMenuItemActionCollapse(MenuItem menuItem) {
+ // When the user collapses the SearchView the current search string is
+ // cleared and the loader restarted.
+ if (!TextUtils.isEmpty(mSearchTerm)) {
+ onSelectionCleared();
+ }
+ mSearchTerm = null;
+ getLoaderManager().restartLoader(
+ ContactsQuery.QUERY_ID, null, ContactsListFragment.this);
+ return true;
+ }
+ });
+ }
+
+ if (mSearchTerm != null) {
+ // If search term is already set here then this fragment is
+ // being restored from a saved state and the search menu item
+ // needs to be expanded and populated again.
+
+ // Stores the search term (as it will be wiped out by
+ // onQueryTextChange() when the menu item is expanded).
+ final String savedSearchTerm = mSearchTerm;
+
+ // Expands the search menu item
+ if (Utils.hasICS()) {
+ searchItem.expandActionView();
+ }
+
+ // Sets the SearchView to the previous search string
+ searchView.setQuery(savedSearchTerm, false);
+ }
+ }
+ }
+
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ if (!TextUtils.isEmpty(mSearchTerm)) {
+ // Saves the current search string
+ outState.putString(SearchManager.QUERY, mSearchTerm);
+
+ // Saves the currently selected contact
+ outState.putInt(STATE_PREVIOUSLY_SELECTED_KEY, getListView().getCheckedItemPosition());
+ }
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ // Sends a request to the People app to display the create contact screen
+ case R.id.menu_add_contact:
+ final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
+ startActivity(intent);
+ break;
+ // For platforms earlier than Android 3.0, triggers the search activity
+ case R.id.menu_search:
+ if (!Utils.hasHoneycomb()) {
+ getActivity().onSearchRequested();
+ }
+ break;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ @Override
+ public Loader<Cursor> onCreateLoader(int id, Bundle args) {
+
+ // If this is the loader for finding contacts in the Contacts Provider
+ // (the only one supported)
+ if (id == ContactsQuery.QUERY_ID) {
+ Uri contentUri;
+
+ // There are two types of searches, one which displays all contacts and
+ // one which filters contacts by a search query. If mSearchTerm is set
+ // then a search query has been entered and the latter should be used.
+
+ if (mSearchTerm == null) {
+ // Since there's no search string, use the content URI that searches the entire
+ // Contacts table
+ contentUri = ContactsQuery.CONTENT_URI;
+ } else {
+ // Since there's a search string, use the special content Uri that searches the
+ // Contacts table. The URI consists of a base Uri and the search string.
+ contentUri =
+ Uri.withAppendedPath(ContactsQuery.FILTER_URI, Uri.encode(mSearchTerm));
+ }
+
+ // Returns a new CursorLoader for querying the Contacts table. No arguments are used
+ // for the selection clause. The search string is either encoded onto the content URI,
+ // or no contacts search string is used. The other search criteria are constants. See
+ // the ContactsQuery interface.
+ return new CursorLoader(getActivity(),
+ contentUri,
+ ContactsQuery.PROJECTION,
+ ContactsQuery.SELECTION,
+ null,
+ ContactsQuery.SORT_ORDER);
+ }
+
+ Log.e(TAG, "onCreateLoader - incorrect ID provided (" + id + ")");
+ return null;
+ }
+
+ @Override
+ public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
+ // This swaps the new cursor into the adapter.
+ if (loader.getId() == ContactsQuery.QUERY_ID) {
+ mAdapter.swapCursor(data);
+
+ // If this is a two-pane layout and there is a search query then
+ // there is some additional work to do around default selected
+ // search item.
+ if (mIsTwoPaneLayout && !TextUtils.isEmpty(mSearchTerm) && mSearchQueryChanged) {
+ // Selects the first item in results, unless this fragment has
+ // been restored from a saved state (like orientation change)
+ // in which case it selects the previously selected search item.
+ if (data != null && data.moveToPosition(mPreviouslySelectedSearchItem)) {
+ // Creates the content Uri for the previously selected contact by appending the
+ // contact's ID to the Contacts table content Uri
+ final Uri uri = Uri.withAppendedPath(
+ Contacts.CONTENT_URI, String.valueOf(data.getLong(ContactsQuery.ID)));
+ mOnContactSelectedListener.onContactSelected(uri);
+ getListView().setItemChecked(mPreviouslySelectedSearchItem, true);
+ } else {
+ // No results, clear selection.
+ onSelectionCleared();
+ }
+ // Only restore from saved state one time. Next time fall back
+ // to selecting first item. If the fragment state is saved again
+ // then the currently selected item will once again be saved.
+ mPreviouslySelectedSearchItem = 0;
+ mSearchQueryChanged = false;
+ }
+ }
+ }
+
+ @Override
+ public void onLoaderReset(Loader<Cursor> loader) {
+ if (loader.getId() == ContactsQuery.QUERY_ID) {
+ // When the loader is being reset, clear the cursor from the adapter. This allows the
+ // cursor resources to be freed.
+ mAdapter.swapCursor(null);
+ }
+ }
+
+ /**
+ * Gets the preferred height for each item in the ListView, in pixels, after accounting for
+ * screen density. ImageLoader uses this value to resize thumbnail images to match the ListView
+ * item height.
+ *
+ * @return The preferred height in pixels, based on the current theme.
+ */
+ private int getListPreferredItemHeight() {
+ final TypedValue typedValue = new TypedValue();
+
+ // Resolve list item preferred height theme attribute into typedValue
+ getActivity().getTheme().resolveAttribute(
+ android.R.attr.listPreferredItemHeight, typedValue, true);
+
+ // Create a new DisplayMetrics object
+ final DisplayMetrics metrics = new android.util.DisplayMetrics();
+
+ // Populate the DisplayMetrics
+ getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
+
+ // Return theme value based on DisplayMetrics
+ return (int) typedValue.getDimension(metrics);
+ }
+
+ /**
+ * Decodes and scales a contact's image from a file pointed to by a Uri in the contact's data,
+ * and returns the result as a Bitmap. The column that contains the Uri varies according to the
+ * platform version.
+ *
+ * @param photoData For platforms prior to Android 3.0, provide the Contact._ID column value.
+ * For Android 3.0 and later, provide the Contact.PHOTO_THUMBNAIL_URI value.
+ * @param imageSize The desired target width and height of the output image in pixels.
+ * @return A Bitmap containing the contact's image, resized to fit the provided image size. If
+ * no thumbnail exists, returns null.
+ */
+ private Bitmap loadContactPhotoThumbnail(String photoData, int imageSize) {
+
+ // Ensures the Fragment is still added to an activity. As this method is called in a
+ // background thread, there's the possibility the Fragment is no longer attached and
+ // added to an activity. If so, no need to spend resources loading the contact photo.
+ if (!isAdded() || getActivity() == null) {
+ return null;
+ }
+
+ // Instantiates an AssetFileDescriptor. Given a content Uri pointing to an image file, the
+ // ContentResolver can return an AssetFileDescriptor for the file.
+ AssetFileDescriptor afd = null;
+
+ // This "try" block catches an Exception if the file descriptor returned from the Contacts
+ // Provider doesn't point to an existing file.
+ try {
+ Uri thumbUri;
+ // If Android 3.0 or later, converts the Uri passed as a string to a Uri object.
+ if (Utils.hasHoneycomb()) {
+ thumbUri = Uri.parse(photoData);
+ } else {
+ // For versions prior to Android 3.0, appends the string argument to the content
+ // Uri for the Contacts table.
+ final Uri contactUri = Uri.withAppendedPath(Contacts.CONTENT_URI, photoData);
+
+ // Appends the content Uri for the Contacts.Photo table to the previously
+ // constructed contact Uri to yield a content URI for the thumbnail image
+ thumbUri = Uri.withAppendedPath(contactUri, Photo.CONTENT_DIRECTORY);
+ }
+ // Retrieves a file descriptor from the Contacts Provider. To learn more about this
+ // feature, read the reference documentation for
+ // ContentResolver#openAssetFileDescriptor.
+ afd = getActivity().getContentResolver().openAssetFileDescriptor(thumbUri, "r");
+
+ // Gets a FileDescriptor from the AssetFileDescriptor. A BitmapFactory object can
+ // decode the contents of a file pointed to by a FileDescriptor into a Bitmap.
+ FileDescriptor fileDescriptor = afd.getFileDescriptor();
+
+ if (fileDescriptor != null) {
+ // Decodes a Bitmap from the image pointed to by the FileDescriptor, and scales it
+ // to the specified width and height
+ return ImageLoader.decodeSampledBitmapFromDescriptor(
+ fileDescriptor, imageSize, imageSize);
+ }
+ } catch (FileNotFoundException e) {
+ // If the file pointed to by the thumbnail URI doesn't exist, or the file can't be
+ // opened in "read" mode, ContentResolver.openAssetFileDescriptor throws a
+ // FileNotFoundException.
+ if (BuildConfig.DEBUG) {
+ Log.d(TAG, "Contact photo thumbnail not found for contact " + photoData
+ + ": " + e.toString());
+ }
+ } finally {
+ // If an AssetFileDescriptor was returned, try to close it
+ if (afd != null) {
+ try {
+ afd.close();
+ } catch (IOException e) {
+ // Closing a file descriptor might cause an IOException if the file is
+ // already closed. Nothing extra is needed to handle this.
+ }
+ }
+ }
+
+ // If the decoding failed, returns null
+ return null;
+ }
+
+ /**
+ * This is a subclass of CursorAdapter that supports binding Cursor columns to a view layout.
+ * If those items are part of search results, the search string is marked by highlighting the
+ * query text. An {@link AlphabetIndexer} is used to allow quicker navigation up and down the
+ * ListView.
+ */
+ private class ContactsAdapter extends CursorAdapter implements SectionIndexer {
+ private LayoutInflater mInflater; // Stores the layout inflater
+ private AlphabetIndexer mAlphabetIndexer; // Stores the AlphabetIndexer instance
+ private TextAppearanceSpan highlightTextSpan; // Stores the highlight text appearance style
+
+ /**
+ * Instantiates a new Contacts Adapter.
+ * @param context A context that has access to the app's layout.
+ */
+ public ContactsAdapter(Context context) {
+ super(context, null, 0);
+
+ // Stores inflater for use later
+ mInflater = LayoutInflater.from(context);
+
+ // Loads a string containing the English alphabet. To fully localize the app, provide a
+ // strings.xml file in res/values-<x> directories, where <x> is a locale. In the file,
+ // define a string with android:name="alphabet" and contents set to all of the
+ // alphabetic characters in the language in their proper sort order, in upper case if
+ // applicable.
+ final String alphabet = context.getString(R.string.alphabet);
+
+ // Instantiates a new AlphabetIndexer bound to the column used to sort contact names.
+ // The cursor is left null, because it has not yet been retrieved.
+ mAlphabetIndexer = new AlphabetIndexer(null, ContactsQuery.SORT_KEY, alphabet);
+
+ // Defines a span for highlighting the part of a display name that matches the search
+ // string
+ highlightTextSpan = new TextAppearanceSpan(getActivity(), R.style.searchTextHiglight);
+ }
+
+ /**
+ * Identifies the start of the search string in the display name column of a Cursor row.
+ * E.g. If displayName was "Adam" and search query (mSearchTerm) was "da" this would
+ * return 1.
+ *
+ * @param displayName The contact display name.
+ * @return The starting position of the search string in the display name, 0-based. The
+ * method returns -1 if the string is not found in the display name, or if the search
+ * string is empty or null.
+ */
+ private int indexOfSearchQuery(String displayName) {
+ if (!TextUtils.isEmpty(mSearchTerm)) {
+ return displayName.toLowerCase(Locale.getDefault()).indexOf(
+ mSearchTerm.toLowerCase(Locale.getDefault()));
+ }
+ return -1;
+ }
+
+ /**
+ * Overrides newView() to inflate the list item views.
+ */
+ @Override
+ public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
+ // Inflates the list item layout.
+ final View itemLayout =
+ mInflater.inflate(R.layout.contact_list_item, viewGroup, false);
+
+ // Creates a new ViewHolder in which to store handles to each view resource. This
+ // allows bindView() to retrieve stored references instead of calling findViewById for
+ // each instance of the layout.
+ final ViewHolder holder = new ViewHolder();
+ holder.text1 = (TextView) itemLayout.findViewById(android.R.id.text1);
+ holder.text2 = (TextView) itemLayout.findViewById(android.R.id.text2);
+ holder.icon = (QuickContactBadge) itemLayout.findViewById(android.R.id.icon);
+
+ // Stores the resourceHolder instance in itemLayout. This makes resourceHolder
+ // available to bindView and other methods that receive a handle to the item view.
+ itemLayout.setTag(holder);
+
+ // Returns the item layout view
+ return itemLayout;
+ }
+
+ /**
+ * Binds data from the Cursor to the provided view.
+ */
+ @Override
+ public void bindView(View view, Context context, Cursor cursor) {
+ // Gets handles to individual view resources
+ final ViewHolder holder = (ViewHolder) view.getTag();
+
+ // For Android 3.0 and later, gets the thumbnail image Uri from the current Cursor row.
+ // For platforms earlier than 3.0, this isn't necessary, because the thumbnail is
+ // generated from the other fields in the row.
+ final String photoUri = cursor.getString(ContactsQuery.PHOTO_THUMBNAIL_DATA);
+
+ final String displayName = cursor.getString(ContactsQuery.DISPLAY_NAME);
+
+ final int startIndex = indexOfSearchQuery(displayName);
+
+ if (startIndex == -1) {
+ // If the user didn't do a search, or the search string didn't match a display
+ // name, show the display name without highlighting
+ holder.text1.setText(displayName);
+
+ if (TextUtils.isEmpty(mSearchTerm)) {
+ // If the search search is empty, hide the second line of text
+ holder.text2.setVisibility(View.GONE);
+ } else {
+ // Shows a second line of text that indicates the search string matched
+ // something other than the display name
+ holder.text2.setVisibility(View.VISIBLE);
+ }
+ } else {
+ // If the search string matched the display name, applies a SpannableString to
+ // highlight the search string with the displayed display name
+
+ // Wraps the display name in the SpannableString
+ final SpannableString highlightedName = new SpannableString(displayName);
+
+ // Sets the span to start at the starting point of the match and end at "length"
+ // characters beyond the starting point
+ highlightedName.setSpan(highlightTextSpan, startIndex,
+ startIndex + mSearchTerm.length(), 0);
+
+ // Binds the SpannableString to the display name View object
+ holder.text1.setText(highlightedName);
+
+ // Since the search string matched the name, this hides the secondary message
+ holder.text2.setVisibility(View.GONE);
+ }
+
+ // Processes the QuickContactBadge. A QuickContactBadge first appears as a contact's
+ // thumbnail image with styling that indicates it can be touched for additional
+ // information. When the user clicks the image, the badge expands into a dialog box
+ // containing the contact's details and icons for the built-in apps that can handle
+ // each detail type.
+
+ // Generates the contact lookup Uri
+ final Uri contactUri = Contacts.getLookupUri(
+ cursor.getLong(ContactsQuery.ID),
+ cursor.getString(ContactsQuery.LOOKUP_KEY));
+
+ // Binds the contact's lookup Uri to the QuickContactBadge
+ holder.icon.assignContactUri(contactUri);
+
+ // Loads the thumbnail image pointed to by photoUri into the QuickContactBadge in a
+ // background worker thread
+ mImageLoader.loadImage(photoUri, holder.icon);
+ }
+
+ /**
+ * Overrides swapCursor to move the new Cursor into the AlphabetIndex as well as the
+ * CursorAdapter.
+ */
+ @Override
+ public Cursor swapCursor(Cursor newCursor) {
+ // Update the AlphabetIndexer with new cursor as well
+ mAlphabetIndexer.setCursor(newCursor);
+ return super.swapCursor(newCursor);
+ }
+
+ /**
+ * An override of getCount that simplifies accessing the Cursor. If the Cursor is null,
+ * getCount returns zero. As a result, no test for Cursor == null is needed.
+ */
+ @Override
+ public int getCount() {
+ if (getCursor() == null) {
+ return 0;
+ }
+ return super.getCount();
+ }
+
+ /**
+ * Defines the SectionIndexer.getSections() interface.
+ */
+ @Override
+ public Object[] getSections() {
+ return mAlphabetIndexer.getSections();
+ }
+
+ /**
+ * Defines the SectionIndexer.getPositionForSection() interface.
+ */
+ @Override
+ public int getPositionForSection(int i) {
+ if (getCursor() == null) {
+ return 0;
+ }
+ return mAlphabetIndexer.getPositionForSection(i);
+ }
+
+ /**
+ * Defines the SectionIndexer.getSectionForPosition() interface.
+ */
+ @Override
+ public int getSectionForPosition(int i) {
+ if (getCursor() == null) {
+ return 0;
+ }
+ return mAlphabetIndexer.getSectionForPosition(i);
+ }
+
+ /**
+ * A class that defines fields for each resource ID in the list item layout. This allows
+ * ContactsAdapter.newView() to store the IDs once, when it inflates the layout, instead of
+ * calling findViewById in each iteration of bindView.
+ */
+ private class ViewHolder {
+ TextView text1;
+ TextView text2;
+ QuickContactBadge icon;
+ }
+ }
+
+ /**
+ * This interface must be implemented by any activity that loads this fragment. When an
+ * interaction occurs, such as touching an item from the ListView, these callbacks will
+ * be invoked to communicate the event back to the activity.
+ */
+ public interface OnContactsInteractionListener {
+ /**
+ * Called when a contact is selected from the ListView.
+ * @param contactUri The contact Uri.
+ */
+ public void onContactSelected(Uri contactUri);
+
+ /**
+ * Called when the ListView selection is cleared like when
+ * a contact search is taking place or is finishing.
+ */
+ public void onSelectionCleared();
+ }
+
+ /**
+ * This interface defines constants for the Cursor and CursorLoader, based on constants defined
+ * in the {@link android.provider.ContactsContract.Contacts} class.
+ */
+ public interface ContactsQuery {
+
+ // An identifier for the loader
+ final static int QUERY_ID = 1;
+
+ // A content URI for the Contacts table
+ final static Uri CONTENT_URI = Contacts.CONTENT_URI;
+
+ // The search/filter query Uri
+ final static Uri FILTER_URI = Contacts.CONTENT_FILTER_URI;
+
+ // The selection clause for the CursorLoader query. The search criteria defined here
+ // restrict results to contacts that have a display name and are linked to visible groups.
+ // Notice that the search on the string provided by the user is implemented by appending
+ // the search string to CONTENT_FILTER_URI.
+ @SuppressLint("InlinedApi")
+ final static String SELECTION =
+ (Utils.hasHoneycomb() ? Contacts.DISPLAY_NAME_PRIMARY : Contacts.DISPLAY_NAME) +
+ "<>''" + " AND " + Contacts.IN_VISIBLE_GROUP + "=1";
+
+ // The desired sort order for the returned Cursor. In Android 3.0 and later, the primary
+ // sort key allows for localization. In earlier versions. use the display name as the sort
+ // key.
+ @SuppressLint("InlinedApi")
+ final static String SORT_ORDER =
+ Utils.hasHoneycomb() ? Contacts.SORT_KEY_PRIMARY : Contacts.DISPLAY_NAME;
+
+ // The projection for the CursorLoader query. This is a list of columns that the Contacts
+ // Provider should return in the Cursor.
+ @SuppressLint("InlinedApi")
+ final static String[] PROJECTION = {
+
+ // The contact's row id
+ Contacts._ID,
+
+ // A pointer to the contact that is guaranteed to be more permanent than _ID. Given
+ // a contact's current _ID value and LOOKUP_KEY, the Contacts Provider can generate
+ // a "permanent" contact URI.
+ Contacts.LOOKUP_KEY,
+
+ // In platform version 3.0 and later, the Contacts table contains
+ // DISPLAY_NAME_PRIMARY, which either contains the contact's displayable name or
+ // some other useful identifier such as an email address. This column isn't
+ // available in earlier versions of Android, so you must use Contacts.DISPLAY_NAME
+ // instead.
+ Utils.hasHoneycomb() ? Contacts.DISPLAY_NAME_PRIMARY : Contacts.DISPLAY_NAME,
+
+ // In Android 3.0 and later, the thumbnail image is pointed to by
+ // PHOTO_THUMBNAIL_URI. In earlier versions, there is no direct pointer; instead,
+ // you generate the pointer from the contact's ID value and constants defined in
+ // android.provider.ContactsContract.Contacts.
+ Utils.hasHoneycomb() ? Contacts.PHOTO_THUMBNAIL_URI : Contacts._ID,
+
+ // The sort order column for the returned Cursor, used by the AlphabetIndexer
+ SORT_ORDER,
+ };
+
+ // The query column numbers which map to each value in the projection
+ final static int ID = 0;
+ final static int LOOKUP_KEY = 1;
+ final static int DISPLAY_NAME = 2;
+ final static int PHOTO_THUMBNAIL_DATA = 3;
+ final static int SORT_KEY = 4;
+ }
+}
diff --git a/samples/training/ContactsList/src/com/example/android/contactslist/util/ImageCache.java b/samples/training/ContactsList/src/com/example/android/contactslist/util/ImageCache.java
new file mode 100644
index 000000000..7e86018ef
--- /dev/null
+++ b/samples/training/ContactsList/src/com/example/android/contactslist/util/ImageCache.java
@@ -0,0 +1,227 @@
+/*
+ * Copyright (C) 2013 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.example.android.contactslist.util;
+
+import android.annotation.TargetApi;
+import android.graphics.Bitmap;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.util.LruCache;
+import android.util.Log;
+
+import com.example.android.contactslist.BuildConfig;
+
+/**
+ * This class holds our bitmap caches (memory and disk).
+ */
+public class ImageCache {
+ private static final String TAG = "ImageCache";
+ private LruCache<String, Bitmap> mMemoryCache;
+
+ /**
+ * Creating a new ImageCache object using the specified parameters.
+ *
+ * @param memCacheSizePercent The cache size as a percent of available app memory.
+ */
+ private ImageCache(float memCacheSizePercent) {
+ init(memCacheSizePercent);
+ }
+
+ /**
+ * Find and return an existing ImageCache stored in a {@link RetainFragment}, if not found a new
+ * one is created using the supplied params and saved to a {@link RetainFragment}.
+ *
+ * @param fragmentManager The fragment manager to use when dealing with the retained fragment.
+ * @param memCacheSizePercent The cache size as a percent of available app memory.
+ * @return An existing retained ImageCache object or a new one if one did not exist
+ */
+ public static ImageCache getInstance(
+ FragmentManager fragmentManager, float memCacheSizePercent) {
+
+ // Search for, or create an instance of the non-UI RetainFragment
+ final RetainFragment mRetainFragment = findOrCreateRetainFragment(fragmentManager);
+
+ // See if we already have an ImageCache stored in RetainFragment
+ ImageCache imageCache = (ImageCache) mRetainFragment.getObject();
+
+ // No existing ImageCache, create one and store it in RetainFragment
+ if (imageCache == null) {
+ imageCache = new ImageCache(memCacheSizePercent);
+ mRetainFragment.setObject(imageCache);
+ }
+
+ return imageCache;
+ }
+
+ /**
+ * Initialize the cache.
+ *
+ * @param memCacheSizePercent The cache size as a percent of available app memory.
+ */
+ private void init(float memCacheSizePercent) {
+ int memCacheSize = calculateMemCacheSize(memCacheSizePercent);
+
+ // Set up memory cache
+ if (BuildConfig.DEBUG) {
+ Log.d(TAG, "Memory cache created (size = " + memCacheSize + ")");
+ }
+ mMemoryCache = new LruCache<String, Bitmap>(memCacheSize) {
+ /**
+ * Measure item size in kilobytes rather than units which is more practical
+ * for a bitmap cache
+ */
+ @Override
+ protected int sizeOf(String key, Bitmap bitmap) {
+ final int bitmapSize = getBitmapSize(bitmap) / 1024;
+ return bitmapSize == 0 ? 1 : bitmapSize;
+ }
+ };
+ }
+
+ /**
+ * Adds a bitmap to both memory and disk cache.
+ * @param data Unique identifier for the bitmap to store
+ * @param bitmap The bitmap to store
+ */
+ public void addBitmapToCache(String data, Bitmap bitmap) {
+ if (data == null || bitmap == null) {
+ return;
+ }
+
+ // Add to memory cache
+ if (mMemoryCache != null && mMemoryCache.get(data) == null) {
+ mMemoryCache.put(data, bitmap);
+ }
+ }
+
+ /**
+ * Get from memory cache.
+ *
+ * @param data Unique identifier for which item to get
+ * @return The bitmap if found in cache, null otherwise
+ */
+ public Bitmap getBitmapFromMemCache(String data) {
+ if (mMemoryCache != null) {
+ final Bitmap memBitmap = mMemoryCache.get(data);
+ if (memBitmap != null) {
+ if (BuildConfig.DEBUG) {
+ Log.d(TAG, "Memory cache hit");
+ }
+ return memBitmap;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get the size in bytes of a bitmap.
+ *
+ * @param bitmap The bitmap to calculate the size of.
+ * @return size of bitmap in bytes.
+ */
+ @TargetApi(12)
+ public static int getBitmapSize(Bitmap bitmap) {
+ if (Utils.hasHoneycombMR1()) {
+ return bitmap.getByteCount();
+ }
+ // Pre HC-MR1
+ return bitmap.getRowBytes() * bitmap.getHeight();
+ }
+
+ /**
+ * Calculates the memory cache size based on a percentage of the max available VM memory.
+ * Eg. setting percent to 0.2 would set the memory cache to one fifth of the available
+ * memory. Throws {@link IllegalArgumentException} if percent is < 0.05 or > .8.
+ * memCacheSize is stored in kilobytes instead of bytes as this will eventually be passed
+ * to construct a LruCache which takes an int in its constructor.
+ *
+ * This value should be chosen carefully based on a number of factors
+ * Refer to the corresponding Android Training class for more discussion:
+ * http://developer.android.com/training/displaying-bitmaps/
+ *
+ * @param percent Percent of available app memory to use to size memory cache.
+ */
+ public static int calculateMemCacheSize(float percent) {
+ if (percent < 0.05f || percent > 0.8f) {
+ throw new IllegalArgumentException("setMemCacheSizePercent - percent must be "
+ + "between 0.05 and 0.8 (inclusive)");
+ }
+ return Math.round(percent * Runtime.getRuntime().maxMemory() / 1024);
+ }
+
+ /**
+ * Locate an existing instance of this Fragment or if not found, create and
+ * add it using FragmentManager.
+ *
+ * @param fm The FragmentManager manager to use.
+ * @return The existing instance of the Fragment or the new instance if just
+ * created.
+ */
+ public static RetainFragment findOrCreateRetainFragment(FragmentManager fm) {
+ // Check to see if we have retained the worker fragment.
+ RetainFragment mRetainFragment = (RetainFragment) fm.findFragmentByTag(TAG);
+
+ // If not retained (or first time running), we need to create and add it.
+ if (mRetainFragment == null) {
+ mRetainFragment = new RetainFragment();
+ fm.beginTransaction().add(mRetainFragment, TAG).commitAllowingStateLoss();
+ }
+
+ return mRetainFragment;
+ }
+
+ /**
+ * A simple non-UI Fragment that stores a single Object and is retained over configuration
+ * changes. It will be used to retain the ImageCache object.
+ */
+ public static class RetainFragment extends Fragment {
+ private Object mObject;
+
+ /**
+ * Empty constructor as per the Fragment documentation
+ */
+ public RetainFragment() {}
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Make sure this Fragment is retained over a configuration change
+ setRetainInstance(true);
+ }
+
+ /**
+ * Store a single object in this Fragment.
+ *
+ * @param object The object to store
+ */
+ public void setObject(Object object) {
+ mObject = object;
+ }
+
+ /**
+ * Get the stored object.
+ *
+ * @return The stored object
+ */
+ public Object getObject() {
+ return mObject;
+ }
+ }
+
+}
diff --git a/samples/training/ContactsList/src/com/example/android/contactslist/util/ImageLoader.java b/samples/training/ContactsList/src/com/example/android/contactslist/util/ImageLoader.java
new file mode 100644
index 000000000..7d915bbff
--- /dev/null
+++ b/samples/training/ContactsList/src/com/example/android/contactslist/util/ImageLoader.java
@@ -0,0 +1,422 @@
+/*
+ * Copyright (C) 2013 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.example.android.contactslist.util;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.TransitionDrawable;
+import android.os.AsyncTask;
+import android.support.v4.app.FragmentManager;
+import android.util.Log;
+import android.widget.ImageView;
+
+import com.example.android.contactslist.BuildConfig;
+
+import java.io.FileDescriptor;
+import java.lang.ref.WeakReference;
+
+/**
+ * This class wraps up completing some arbitrary long running work when loading a bitmap to an
+ * ImageView. It handles things like using a memory and disk cache, running the work in a background
+ * thread and setting a placeholder image.
+ */
+public abstract class ImageLoader {
+ private static final String TAG = "ImageLoader";
+ private static final int FADE_IN_TIME = 200;
+
+ private ImageCache mImageCache;
+ private Bitmap mLoadingBitmap;
+ private boolean mFadeInBitmap = true;
+ private boolean mPauseWork = false;
+ private final Object mPauseWorkLock = new Object();
+ private int mImageSize;
+ private Resources mResources;
+
+ protected ImageLoader(Context context, int imageSize) {
+ mResources = context.getResources();
+ mImageSize = imageSize;
+ }
+
+ public int getImageSize() {
+ return mImageSize;
+ }
+
+ /**
+ * Load an image specified by the data parameter into an ImageView (override
+ * {@link ImageLoader#processBitmap(Object)} to define the processing logic). If the image is
+ * found in the memory cache, it is set immediately, otherwise an {@link AsyncTask} will be
+ * created to asynchronously load the bitmap.
+ *
+ * @param data The URL of the image to download.
+ * @param imageView The ImageView to bind the downloaded image to.
+ */
+ public void loadImage(Object data, ImageView imageView) {
+ if (data == null) {
+ imageView.setImageBitmap(mLoadingBitmap);
+ return;
+ }
+
+ Bitmap bitmap = null;
+
+ if (mImageCache != null) {
+ bitmap = mImageCache.getBitmapFromMemCache(String.valueOf(data));
+ }
+
+ if (bitmap != null) {
+ // Bitmap found in memory cache
+ imageView.setImageBitmap(bitmap);
+ } else if (cancelPotentialWork(data, imageView)) {
+ final BitmapWorkerTask task = new BitmapWorkerTask(imageView);
+ final AsyncDrawable asyncDrawable =
+ new AsyncDrawable(mResources, mLoadingBitmap, task);
+ imageView.setImageDrawable(asyncDrawable);
+ task.execute(data);
+ }
+ }
+
+ /**
+ * Set placeholder bitmap that shows when the the background thread is running.
+ *
+ * @param resId Resource ID of loading image.
+ */
+ public void setLoadingImage(int resId) {
+ mLoadingBitmap = BitmapFactory.decodeResource(mResources, resId);
+ }
+
+ /**
+ * Adds an {@link ImageCache} to this image loader.
+ *
+ * @param fragmentManager A FragmentManager to use to retain the cache over configuration
+ * changes such as an orientation change.
+ * @param memCacheSizePercent The cache size as a percent of available app memory.
+ */
+ public void addImageCache(FragmentManager fragmentManager, float memCacheSizePercent) {
+ mImageCache = ImageCache.getInstance(fragmentManager, memCacheSizePercent);
+ }
+
+ /**
+ * If set to true, the image will fade-in once it has been loaded by the background thread.
+ */
+ public void setImageFadeIn(boolean fadeIn) {
+ mFadeInBitmap = fadeIn;
+ }
+
+ /**
+ * Subclasses should override this to define any processing or work that must happen to produce
+ * the final bitmap. This will be executed in a background thread and be long running. For
+ * example, you could resize a large bitmap here, or pull down an image from the network.
+ *
+ * @param data The data to identify which image to process, as provided by
+ * {@link ImageLoader#loadImage(Object, ImageView)}
+ * @return The processed bitmap
+ */
+ protected abstract Bitmap processBitmap(Object data);
+
+ /**
+ * Cancels any pending work attached to the provided ImageView.
+ */
+ public static void cancelWork(ImageView imageView) {
+ final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
+ if (bitmapWorkerTask != null) {
+ bitmapWorkerTask.cancel(true);
+ if (BuildConfig.DEBUG) {
+ final Object bitmapData = bitmapWorkerTask.data;
+ Log.d(TAG, "cancelWork - cancelled work for " + bitmapData);
+ }
+ }
+ }
+
+ /**
+ * Returns true if the current work has been canceled or if there was no work in
+ * progress on this image view.
+ * Returns false if the work in progress deals with the same data. The work is not
+ * stopped in that case.
+ */
+ public static boolean cancelPotentialWork(Object data, ImageView imageView) {
+ final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
+
+ if (bitmapWorkerTask != null) {
+ final Object bitmapData = bitmapWorkerTask.data;
+ if (bitmapData == null || !bitmapData.equals(data)) {
+ bitmapWorkerTask.cancel(true);
+ if (BuildConfig.DEBUG) {
+ Log.d(TAG, "cancelPotentialWork - cancelled work for " + data);
+ }
+ } else {
+ // The same work is already in progress.
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * @param imageView Any imageView
+ * @return Retrieve the currently active work task (if any) associated with this imageView.
+ * null if there is no such task.
+ */
+ private static BitmapWorkerTask getBitmapWorkerTask(ImageView imageView) {
+ if (imageView != null) {
+ final Drawable drawable = imageView.getDrawable();
+ if (drawable instanceof AsyncDrawable) {
+ final AsyncDrawable asyncDrawable = (AsyncDrawable) drawable;
+ return asyncDrawable.getBitmapWorkerTask();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * The actual AsyncTask that will asynchronously process the image.
+ */
+ private class BitmapWorkerTask extends AsyncTask<Object, Void, Bitmap> {
+ private Object data;
+ private final WeakReference<ImageView> imageViewReference;
+
+ public BitmapWorkerTask(ImageView imageView) {
+ imageViewReference = new WeakReference<ImageView>(imageView);
+ }
+
+ /**
+ * Background processing.
+ */
+ @Override
+ protected Bitmap doInBackground(Object... params) {
+ if (BuildConfig.DEBUG) {
+ Log.d(TAG, "doInBackground - starting work");
+ }
+
+ data = params[0];
+ final String dataString = String.valueOf(data);
+ Bitmap bitmap = null;
+
+ // Wait here if work is paused and the task is not cancelled
+ synchronized (mPauseWorkLock) {
+ while (mPauseWork && !isCancelled()) {
+ try {
+ mPauseWorkLock.wait();
+ } catch (InterruptedException e) {}
+ }
+ }
+
+ // If the task has not been cancelled by another thread and the ImageView that was
+ // originally bound to this task is still bound back to this task and our "exit early"
+ // flag is not set, then call the main process method (as implemented by a subclass)
+ if (!isCancelled() && getAttachedImageView() != null) {
+ bitmap = processBitmap(params[0]);
+ }
+
+ // If the bitmap was processed and the image cache is available, then add the processed
+ // bitmap to the cache for future use. Note we don't check if the task was cancelled
+ // here, if it was, and the thread is still running, we may as well add the processed
+ // bitmap to our cache as it might be used again in the future
+ if (bitmap != null && mImageCache != null) {
+ mImageCache.addBitmapToCache(dataString, bitmap);
+ }
+
+ if (BuildConfig.DEBUG) {
+ Log.d(TAG, "doInBackground - finished work");
+ }
+
+ return bitmap;
+ }
+
+ /**
+ * Once the image is processed, associates it to the imageView
+ */
+ @Override
+ protected void onPostExecute(Bitmap bitmap) {
+ // if cancel was called on this task or the "exit early" flag is set then we're done
+ if (isCancelled()) {
+ bitmap = null;
+ }
+
+ final ImageView imageView = getAttachedImageView();
+ if (bitmap != null && imageView != null) {
+ if (BuildConfig.DEBUG) {
+ Log.d(TAG, "onPostExecute - setting bitmap");
+ }
+ setImageBitmap(imageView, bitmap);
+ }
+ }
+
+ @Override
+ protected void onCancelled(Bitmap bitmap) {
+ super.onCancelled(bitmap);
+ synchronized (mPauseWorkLock) {
+ mPauseWorkLock.notifyAll();
+ }
+ }
+
+ /**
+ * Returns the ImageView associated with this task as long as the ImageView's task still
+ * points to this task as well. Returns null otherwise.
+ */
+ private ImageView getAttachedImageView() {
+ final ImageView imageView = imageViewReference.get();
+ final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
+
+ if (this == bitmapWorkerTask) {
+ return imageView;
+ }
+
+ return null;
+ }
+ }
+
+ /**
+ * A custom Drawable that will be attached to the imageView while the work is in progress.
+ * Contains a reference to the actual worker task, so that it can be stopped if a new binding is
+ * required, and makes sure that only the last started worker process can bind its result,
+ * independently of the finish order.
+ */
+ private static class AsyncDrawable extends BitmapDrawable {
+ private final WeakReference<BitmapWorkerTask> bitmapWorkerTaskReference;
+
+ public AsyncDrawable(Resources res, Bitmap bitmap, BitmapWorkerTask bitmapWorkerTask) {
+ super(res, bitmap);
+ bitmapWorkerTaskReference =
+ new WeakReference<BitmapWorkerTask>(bitmapWorkerTask);
+ }
+
+ public BitmapWorkerTask getBitmapWorkerTask() {
+ return bitmapWorkerTaskReference.get();
+ }
+ }
+
+ /**
+ * Called when the processing is complete and the final bitmap should be set on the ImageView.
+ *
+ * @param imageView The ImageView to set the bitmap to.
+ * @param bitmap The new bitmap to set.
+ */
+ private void setImageBitmap(ImageView imageView, Bitmap bitmap) {
+ if (mFadeInBitmap) {
+ // Transition drawable to fade from loading bitmap to final bitmap
+ final TransitionDrawable td =
+ new TransitionDrawable(new Drawable[] {
+ new ColorDrawable(android.R.color.transparent),
+ new BitmapDrawable(mResources, bitmap)
+ });
+ imageView.setBackgroundDrawable(imageView.getDrawable());
+ imageView.setImageDrawable(td);
+ td.startTransition(FADE_IN_TIME);
+ } else {
+ imageView.setImageBitmap(bitmap);
+ }
+ }
+
+ /**
+ * Pause any ongoing background work. This can be used as a temporary
+ * measure to improve performance. For example background work could
+ * be paused when a ListView or GridView is being scrolled using a
+ * {@link android.widget.AbsListView.OnScrollListener} to keep
+ * scrolling smooth.
+ * <p>
+ * If work is paused, be sure setPauseWork(false) is called again
+ * before your fragment or activity is destroyed (for example during
+ * {@link android.app.Activity#onPause()}), or there is a risk the
+ * background thread will never finish.
+ */
+ public void setPauseWork(boolean pauseWork) {
+ synchronized (mPauseWorkLock) {
+ mPauseWork = pauseWork;
+ if (!mPauseWork) {
+ mPauseWorkLock.notifyAll();
+ }
+ }
+ }
+
+ /**
+ * Decode and sample down a bitmap from a file input stream to the requested width and height.
+ *
+ * @param fileDescriptor The file descriptor to read from
+ * @param reqWidth The requested width of the resulting bitmap
+ * @param reqHeight The requested height of the resulting bitmap
+ * @return A bitmap sampled down from the original with the same aspect ratio and dimensions
+ * that are equal to or greater than the requested width and height
+ */
+ public static Bitmap decodeSampledBitmapFromDescriptor(
+ FileDescriptor fileDescriptor, int reqWidth, int reqHeight) {
+
+ // First decode with inJustDecodeBounds=true to check dimensions
+ final BitmapFactory.Options options = new BitmapFactory.Options();
+ options.inJustDecodeBounds = true;
+ BitmapFactory.decodeFileDescriptor(fileDescriptor, null, options);
+
+ // Calculate inSampleSize
+ options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
+
+ // Decode bitmap with inSampleSize set
+ options.inJustDecodeBounds = false;
+ return BitmapFactory.decodeFileDescriptor(fileDescriptor, null, options);
+ }
+
+ /**
+ * Calculate an inSampleSize for use in a {@link BitmapFactory.Options} object when decoding
+ * bitmaps using the decode* methods from {@link BitmapFactory}. This implementation calculates
+ * the closest inSampleSize that will result in the final decoded bitmap having a width and
+ * height equal to or larger than the requested width and height. This implementation does not
+ * ensure a power of 2 is returned for inSampleSize which can be faster when decoding but
+ * results in a larger bitmap which isn't as useful for caching purposes.
+ *
+ * @param options An options object with out* params already populated (run through a decode*
+ * method with inJustDecodeBounds==true
+ * @param reqWidth The requested width of the resulting bitmap
+ * @param reqHeight The requested height of the resulting bitmap
+ * @return The value to be used for inSampleSize
+ */
+ public static int calculateInSampleSize(BitmapFactory.Options options,
+ int reqWidth, int reqHeight) {
+ // Raw height and width of image
+ final int height = options.outHeight;
+ final int width = options.outWidth;
+ int inSampleSize = 1;
+
+ if (height > reqHeight || width > reqWidth) {
+
+ // Calculate ratios of height and width to requested height and width
+ final int heightRatio = Math.round((float) height / (float) reqHeight);
+ final int widthRatio = Math.round((float) width / (float) reqWidth);
+
+ // Choose the smallest ratio as inSampleSize value, this will guarantee a final image
+ // with both dimensions larger than or equal to the requested height and width.
+ inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;
+
+ // This offers some additional logic in case the image has a strange
+ // aspect ratio. For example, a panorama may have a much larger
+ // width than height. In these cases the total pixels might still
+ // end up being too large to fit comfortably in memory, so we should
+ // be more aggressive with sample down the image (=larger inSampleSize).
+
+ final float totalPixels = width * height;
+
+ // Anything more than 2x the requested pixels we'll sample down further
+ final float totalReqPixelsCap = reqWidth * reqHeight * 2;
+
+ while (totalPixels / (inSampleSize * inSampleSize) > totalReqPixelsCap) {
+ inSampleSize++;
+ }
+ }
+ return inSampleSize;
+ }
+}
diff --git a/samples/training/ContactsList/src/com/example/android/contactslist/util/Utils.java b/samples/training/ContactsList/src/com/example/android/contactslist/util/Utils.java
new file mode 100644
index 000000000..9c0cc443a
--- /dev/null
+++ b/samples/training/ContactsList/src/com/example/android/contactslist/util/Utils.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2013 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.example.android.contactslist.util;
+
+import android.annotation.TargetApi;
+import android.os.Build;
+import android.os.StrictMode;
+
+import com.example.android.contactslist.ui.ContactDetailActivity;
+import com.example.android.contactslist.ui.ContactsListActivity;
+
+/**
+ * This class contains static utility methods.
+ */
+public class Utils {
+
+ // Prevents instantiation.
+ private Utils() {}
+
+ /**
+ * Enables strict mode. This should only be called when debugging the application and is useful
+ * for finding some potential bugs or best practice violations.
+ */
+ @TargetApi(11)
+ public static void enableStrictMode() {
+ // Strict mode is only available on gingerbread or later
+ if (Utils.hasGingerbread()) {
+
+ // Enable all thread strict mode policies
+ StrictMode.ThreadPolicy.Builder threadPolicyBuilder =
+ new StrictMode.ThreadPolicy.Builder()
+ .detectAll()
+ .penaltyLog();
+
+ // Enable all VM strict mode policies
+ StrictMode.VmPolicy.Builder vmPolicyBuilder =
+ new StrictMode.VmPolicy.Builder()
+ .detectAll()
+ .penaltyLog();
+
+ // Honeycomb introduced some additional strict mode features
+ if (Utils.hasHoneycomb()) {
+ // Flash screen when thread policy is violated
+ threadPolicyBuilder.penaltyFlashScreen();
+ // For each activity class, set an instance limit of 1. Any more instances and
+ // there could be a memory leak.
+ vmPolicyBuilder
+ .setClassInstanceLimit(ContactsListActivity.class, 1)
+ .setClassInstanceLimit(ContactDetailActivity.class, 1);
+ }
+
+ // Use builders to enable strict mode policies
+ StrictMode.setThreadPolicy(threadPolicyBuilder.build());
+ StrictMode.setVmPolicy(vmPolicyBuilder.build());
+ }
+ }
+
+ /**
+ * Uses static final constants to detect if the device's platform version is Gingerbread or
+ * later.
+ */
+ public static boolean hasGingerbread() {
+ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD;
+ }
+
+ /**
+ * Uses static final constants to detect if the device's platform version is Honeycomb or
+ * later.
+ */
+ public static boolean hasHoneycomb() {
+ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
+ }
+
+ /**
+ * Uses static final constants to detect if the device's platform version is Honeycomb MR1 or
+ * later.
+ */
+ public static boolean hasHoneycombMR1() {
+ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1;
+ }
+
+ /**
+ * Uses static final constants to detect if the device's platform version is ICS or
+ * later.
+ */
+ public static boolean hasICS() {
+ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
+ }
+}
diff --git a/samples/training/EffectiveNavigation/libs/android-support-v4.jar b/samples/training/EffectiveNavigation/libs/android-support-v4.jar
new file mode 100644
index 000000000..4846ef987
--- /dev/null
+++ b/samples/training/EffectiveNavigation/libs/android-support-v4.jar
Binary files differ
diff --git a/samples/training/InteractiveChart/AndroidManifest.xml b/samples/training/InteractiveChart/AndroidManifest.xml
new file mode 100755
index 000000000..1e29155ab
--- /dev/null
+++ b/samples/training/InteractiveChart/AndroidManifest.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 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.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.interactivechart"
+ android:versionCode="1"
+ android:versionName="1.0">
+
+ <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="17" />
+
+ <application
+ android:allowBackup="true"
+ android:label="@string/app_name"
+ android:description="@string/app_description"
+ android:icon="@drawable/ic_launcher"
+ android:theme="@style/AppTheme">
+
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ </application>
+
+</manifest>
diff --git a/samples/training/InteractiveChart/libs/android-support-v4.jar b/samples/training/InteractiveChart/libs/android-support-v4.jar
new file mode 100644
index 000000000..6080877d4
--- /dev/null
+++ b/samples/training/InteractiveChart/libs/android-support-v4.jar
Binary files differ
diff --git a/samples/training/InteractiveChart/project.properties b/samples/training/InteractiveChart/project.properties
new file mode 100755
index 000000000..7c903ad04
--- /dev/null
+++ b/samples/training/InteractiveChart/project.properties
@@ -0,0 +1,27 @@
+#
+# Copyright 2013 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.
+#
+
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-17
diff --git a/samples/training/InteractiveChart/res/drawable-hdpi/ic_launcher.png b/samples/training/InteractiveChart/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..9e2d6eebb
--- /dev/null
+++ b/samples/training/InteractiveChart/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/InteractiveChart/res/drawable-mdpi/ic_launcher.png b/samples/training/InteractiveChart/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..229293037
--- /dev/null
+++ b/samples/training/InteractiveChart/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_pan_down.png b/samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_pan_down.png
new file mode 100644
index 000000000..38c7b20d7
--- /dev/null
+++ b/samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_pan_down.png
Binary files differ
diff --git a/samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_pan_left.png b/samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_pan_left.png
new file mode 100644
index 000000000..e97e910e0
--- /dev/null
+++ b/samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_pan_left.png
Binary files differ
diff --git a/samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_pan_right.png b/samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_pan_right.png
new file mode 100644
index 000000000..7dc45c0d4
--- /dev/null
+++ b/samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_pan_right.png
Binary files differ
diff --git a/samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_pan_up.png b/samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_pan_up.png
new file mode 100644
index 000000000..2ed325108
--- /dev/null
+++ b/samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_pan_up.png
Binary files differ
diff --git a/samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_zoom_in.png b/samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_zoom_in.png
new file mode 100644
index 000000000..23b9a1c18
--- /dev/null
+++ b/samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_zoom_in.png
Binary files differ
diff --git a/samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_zoom_out.png b/samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_zoom_out.png
new file mode 100644
index 000000000..bb952748c
--- /dev/null
+++ b/samples/training/InteractiveChart/res/drawable-xhdpi/ic_action_zoom_out.png
Binary files differ
diff --git a/samples/training/InteractiveChart/res/drawable-xhdpi/ic_launcher.png b/samples/training/InteractiveChart/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..b1e36137e
--- /dev/null
+++ b/samples/training/InteractiveChart/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/InteractiveChart/res/drawable-xxhdpi/ic_launcher.png b/samples/training/InteractiveChart/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 000000000..2217834da
--- /dev/null
+++ b/samples/training/InteractiveChart/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/InteractiveChart/res/layout/activity_main.xml b/samples/training/InteractiveChart/res/layout/activity_main.xml
new file mode 100755
index 000000000..285d8ae18
--- /dev/null
+++ b/samples/training/InteractiveChart/res/layout/activity_main.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 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.
+ -->
+
+<com.example.android.interactivechart.InteractiveLineGraphView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res/com.example.android.interactivechart"
+ android:id="@+id/chart"
+ android:padding="@dimen/chart_padding"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ app:labelSeparation="10dp"
+ app:labelTextSize="14sp"
+ app:labelTextColor="#d000"
+ app:axisThickness="2dp"
+ app:axisColor="#d000"
+ app:gridThickness="1dp"
+ app:gridColor="#2000"
+ app:dataColor="#a6c"
+ app:dataThickness="8dp" />
diff --git a/samples/training/InteractiveChart/res/menu/main.xml b/samples/training/InteractiveChart/res/menu/main.xml
new file mode 100644
index 000000000..ad758e52d
--- /dev/null
+++ b/samples/training/InteractiveChart/res/menu/main.xml
@@ -0,0 +1,43 @@
+<!--
+ Copyright 2013 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.
+ -->
+
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/action_zoom_in"
+ android:icon="@drawable/ic_action_zoom_in"
+ android:title="@string/action_zoom_in"
+ android:showAsAction="never" />
+ <item android:id="@+id/action_zoom_out"
+ android:icon="@drawable/ic_action_zoom_out"
+ android:title="@string/action_zoom_out"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/action_pan_left"
+ android:icon="@drawable/ic_action_pan_left"
+ android:title="@string/action_pan_left"
+ android:showAsAction="never" />
+ <item android:id="@+id/action_pan_right"
+ android:icon="@drawable/ic_action_pan_right"
+ android:title="@string/action_pan_right"
+ android:showAsAction="never" />
+ <item android:id="@+id/action_pan_up"
+ android:icon="@drawable/ic_action_pan_up"
+ android:title="@string/action_pan_up"
+ android:showAsAction="never" />
+ <item android:id="@+id/action_pan_down"
+ android:icon="@drawable/ic_action_pan_down"
+ android:title="@string/action_pan_down"
+ android:showAsAction="never" />
+</menu>
diff --git a/samples/training/InteractiveChart/res/values-sw600dp/dimens.xml b/samples/training/InteractiveChart/res/values-sw600dp/dimens.xml
new file mode 100644
index 000000000..a7073d413
--- /dev/null
+++ b/samples/training/InteractiveChart/res/values-sw600dp/dimens.xml
@@ -0,0 +1,19 @@
+<!--
+ Copyright 2013 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.
+ -->
+
+<resources>
+ <dimen name="chart_padding">48dp</dimen>
+</resources>
diff --git a/samples/training/InteractiveChart/res/values-v11/styles.xml b/samples/training/InteractiveChart/res/values-v11/styles.xml
new file mode 100644
index 000000000..8ff79ca90
--- /dev/null
+++ b/samples/training/InteractiveChart/res/values-v11/styles.xml
@@ -0,0 +1,19 @@
+<!--
+ Copyright 2013 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.
+ -->
+
+<resources>
+ <style name="AppTheme" parent="@android:style/Theme.Holo.Light" />
+</resources>
diff --git a/samples/training/InteractiveChart/res/values-v14/styles.xml b/samples/training/InteractiveChart/res/values-v14/styles.xml
new file mode 100644
index 000000000..530f994a3
--- /dev/null
+++ b/samples/training/InteractiveChart/res/values-v14/styles.xml
@@ -0,0 +1,19 @@
+<!--
+ Copyright 2013 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.
+ -->
+
+<resources>
+ <style name="AppTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar" />
+</resources>
diff --git a/samples/training/InteractiveChart/res/values/attrs.xml b/samples/training/InteractiveChart/res/values/attrs.xml
new file mode 100644
index 000000000..89e56cf73
--- /dev/null
+++ b/samples/training/InteractiveChart/res/values/attrs.xml
@@ -0,0 +1,29 @@
+<!--
+ Copyright 2013 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.
+ -->
+
+<resources>
+ <declare-styleable name="InteractiveLineGraphView">
+ <attr name="labelTextSize" format="dimension" />
+ <attr name="labelTextColor" format="color" />
+ <attr name="labelSeparation" format="dimension" />
+ <attr name="axisThickness" format="dimension" />
+ <attr name="axisColor" format="color" />
+ <attr name="dataThickness" format="dimension" />
+ <attr name="dataColor" format="color" />
+ <attr name="gridThickness" format="dimension" />
+ <attr name="gridColor" format="color" />
+ </declare-styleable>
+</resources>
diff --git a/samples/training/InteractiveChart/res/values/dimens.xml b/samples/training/InteractiveChart/res/values/dimens.xml
new file mode 100644
index 000000000..51561fd76
--- /dev/null
+++ b/samples/training/InteractiveChart/res/values/dimens.xml
@@ -0,0 +1,20 @@
+<!--
+ Copyright 2013 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.
+ -->
+
+<resources>
+ <dimen name="chart_padding">16dp</dimen>
+ <dimen name="min_chart_size">100dp</dimen>
+</resources>
diff --git a/samples/training/InteractiveChart/res/values/strings.xml b/samples/training/InteractiveChart/res/values/strings.xml
new file mode 100755
index 000000000..b08da584e
--- /dev/null
+++ b/samples/training/InteractiveChart/res/values/strings.xml
@@ -0,0 +1,26 @@
+<!--
+ Copyright 2013 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.
+ -->
+
+<resources>
+ <string name="app_name">Interactive Chart Demo</string>
+ <string name="app_description">A sample application that allows you to navigate a simple line graph using touch gestures.</string>
+ <string name="action_zoom_in">Demo zoom in</string>
+ <string name="action_zoom_out">Demo zoom out</string>
+ <string name="action_pan_left">Demo pan left</string>
+ <string name="action_pan_right">Demo pan right</string>
+ <string name="action_pan_up">Demo pan up</string>
+ <string name="action_pan_down">Demo pan down</string>
+</resources>
diff --git a/samples/training/InteractiveChart/res/values/styles.xml b/samples/training/InteractiveChart/res/values/styles.xml
new file mode 100644
index 000000000..ccb9f7edd
--- /dev/null
+++ b/samples/training/InteractiveChart/res/values/styles.xml
@@ -0,0 +1,19 @@
+<!--
+ Copyright 2013 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.
+ -->
+
+<resources>
+ <style name="AppTheme" parent="@android:style/Theme.Light" />
+</resources>
diff --git a/samples/training/InteractiveChart/src/com/example/android/interactivechart/InteractiveLineGraphView.java b/samples/training/InteractiveChart/src/com/example/android/interactivechart/InteractiveLineGraphView.java
new file mode 100644
index 000000000..9407cbc9e
--- /dev/null
+++ b/samples/training/InteractiveChart/src/com/example/android/interactivechart/InteractiveLineGraphView.java
@@ -0,0 +1,1185 @@
+/*
+ * Copyright 2013 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.example.android.interactivechart;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Point;
+import android.graphics.PointF;
+import android.graphics.Rect;
+import android.graphics.RectF;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.support.v4.os.ParcelableCompat;
+import android.support.v4.os.ParcelableCompatCreatorCallbacks;
+import android.support.v4.view.GestureDetectorCompat;
+import android.support.v4.view.ViewCompat;
+import android.support.v4.widget.EdgeEffectCompat;
+import android.util.AttributeSet;
+import android.view.GestureDetector;
+import android.view.MotionEvent;
+import android.view.ScaleGestureDetector;
+import android.view.View;
+import android.widget.OverScroller;
+
+/**
+ * A view representing a simple yet interactive line chart for the function <code>x^3 - x/4</code>.
+ * <p>
+ * This view isn't all that useful on its own; rather it serves as an example of how to correctly
+ * implement these types of gestures to perform zooming and scrolling with interesting content
+ * types.
+ * <p>
+ * The view is interactive in that it can be zoomed and panned using
+ * typical <a href="http://developer.android.com/design/patterns/gestures.html">gestures</a> such
+ * as double-touch, drag, pinch-open, and pinch-close. This is done using the
+ * {@link ScaleGestureDetector}, {@link GestureDetector}, and {@link OverScroller} classes. Note
+ * that the platform-provided view scrolling behavior (e.g. {@link View#scrollBy(int, int)} is NOT
+ * used.
+ * <p>
+ * The view also demonstrates the correct use of
+ * <a href="http://developer.android.com/design/style/touch-feedback.html">touch feedback</a> to
+ * indicate to users that they've reached the content edges after a pan or fling gesture. This
+ * is done using the {@link EdgeEffectCompat} class.
+ * <p>
+ * Finally, this class demonstrates the basics of creating a custom view, including support for
+ * custom attributes (see the constructors), a simple implementation for
+ * {@link #onMeasure(int, int)}, an implementation for {@link #onSaveInstanceState()} and a fairly
+ * straightforward {@link Canvas}-based rendering implementation in
+ * {@link #onDraw(android.graphics.Canvas)}.
+ * <p>
+ * Note that this view doesn't automatically support directional navigation or other accessibility
+ * methods. Activities using this view should generally provide alternate navigation controls.
+ * Activities using this view should also present an alternate, text-based representation of this
+ * view's content for vision-impaired users.
+ */
+public class InteractiveLineGraphView extends View {
+ private static final String TAG = "InteractiveLineGraphView";
+
+ /**
+ * The number of individual points (samples) in the chart series to draw onscreen.
+ */
+ private static final int DRAW_STEPS = 30;
+
+ /**
+ * Initial fling velocity for pan operations, in screen widths (or heights) per second.
+ *
+ * @see #panLeft()
+ * @see #panRight()
+ * @see #panUp()
+ * @see #panDown()
+ */
+ private static final float PAN_VELOCITY_FACTOR = 2f;
+
+ /**
+ * The scaling factor for a single zoom 'step'.
+ *
+ * @see #zoomIn()
+ * @see #zoomOut()
+ */
+ private static final float ZOOM_AMOUNT = 0.25f;
+
+ // Viewport extremes. See mCurrentViewport for a discussion of the viewport.
+ private static final float AXIS_X_MIN = -1f;
+ private static final float AXIS_X_MAX = 1f;
+ private static final float AXIS_Y_MIN = -1f;
+ private static final float AXIS_Y_MAX = 1f;
+
+ /**
+ * The current viewport. This rectangle represents the currently visible chart domain
+ * and range. The currently visible chart X values are from this rectangle's left to its right.
+ * The currently visible chart Y values are from this rectangle's top to its bottom.
+ * <p>
+ * Note that this rectangle's top is actually the smaller Y value, and its bottom is the larger
+ * Y value. Since the chart is drawn onscreen in such a way that chart Y values increase
+ * towards the top of the screen (decreasing pixel Y positions), this rectangle's "top" is drawn
+ * above this rectangle's "bottom" value.
+ *
+ * @see #mContentRect
+ */
+ private RectF mCurrentViewport = new RectF(AXIS_X_MIN, AXIS_Y_MIN, AXIS_X_MAX, AXIS_Y_MAX);
+
+ /**
+ * The current destination rectangle (in pixel coordinates) into which the chart data should
+ * be drawn. Chart labels are drawn outside this area.
+ *
+ * @see #mCurrentViewport
+ */
+ private Rect mContentRect = new Rect();
+
+ // Current attribute values and Paints.
+ private float mLabelTextSize;
+ private int mLabelSeparation;
+ private int mLabelTextColor;
+ private Paint mLabelTextPaint;
+ private int mMaxLabelWidth;
+ private int mLabelHeight;
+ private float mGridThickness;
+ private int mGridColor;
+ private Paint mGridPaint;
+ private float mAxisThickness;
+ private int mAxisColor;
+ private Paint mAxisPaint;
+ private float mDataThickness;
+ private int mDataColor;
+ private Paint mDataPaint;
+
+ // State objects and values related to gesture tracking.
+ private ScaleGestureDetector mScaleGestureDetector;
+ private GestureDetectorCompat mGestureDetector;
+ private OverScroller mScroller;
+ private Zoomer mZoomer;
+ private PointF mZoomFocalPoint = new PointF();
+ private RectF mScrollerStartViewport = new RectF(); // Used only for zooms and flings.
+
+ // Edge effect / overscroll tracking objects.
+ private EdgeEffectCompat mEdgeEffectTop;
+ private EdgeEffectCompat mEdgeEffectBottom;
+ private EdgeEffectCompat mEdgeEffectLeft;
+ private EdgeEffectCompat mEdgeEffectRight;
+
+ private boolean mEdgeEffectTopActive;
+ private boolean mEdgeEffectBottomActive;
+ private boolean mEdgeEffectLeftActive;
+ private boolean mEdgeEffectRightActive;
+
+ // Buffers for storing current X and Y stops. See the computeAxisStops method for more details.
+ private final AxisStops mXStopsBuffer = new AxisStops();
+ private final AxisStops mYStopsBuffer = new AxisStops();
+
+ // Buffers used during drawing. These are defined as fields to avoid allocation during
+ // draw calls.
+ private float[] mAxisXPositionsBuffer = new float[]{};
+ private float[] mAxisYPositionsBuffer = new float[]{};
+ private float[] mAxisXLinesBuffer = new float[]{};
+ private float[] mAxisYLinesBuffer = new float[]{};
+ private float[] mSeriesLinesBuffer = new float[(DRAW_STEPS + 1) * 4];
+ private final char[] mLabelBuffer = new char[100];
+ private Point mSurfaceSizeBuffer = new Point();
+
+ /**
+ * The simple math function Y = fun(X) to draw on the chart.
+ * @param x The X value
+ * @return The Y value
+ */
+ protected static float fun(float x) {
+ return (float) Math.pow(x, 3) - x / 4;
+ }
+
+ public InteractiveLineGraphView(Context context) {
+ this(context, null, 0);
+ }
+
+ public InteractiveLineGraphView(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public InteractiveLineGraphView(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+
+ TypedArray a = context.getTheme().obtainStyledAttributes(
+ attrs, R.styleable.InteractiveLineGraphView, defStyle, defStyle);
+
+ try {
+ mLabelTextColor = a.getColor(
+ R.styleable.InteractiveLineGraphView_labelTextColor, mLabelTextColor);
+ mLabelTextSize = a.getDimension(
+ R.styleable.InteractiveLineGraphView_labelTextSize, mLabelTextSize);
+ mLabelSeparation = a.getDimensionPixelSize(
+ R.styleable.InteractiveLineGraphView_labelSeparation, mLabelSeparation);
+
+ mGridThickness = a.getDimension(
+ R.styleable.InteractiveLineGraphView_gridThickness, mGridThickness);
+ mGridColor = a.getColor(
+ R.styleable.InteractiveLineGraphView_gridColor, mGridColor);
+
+ mAxisThickness = a.getDimension(
+ R.styleable.InteractiveLineGraphView_axisThickness, mAxisThickness);
+ mAxisColor = a.getColor(
+ R.styleable.InteractiveLineGraphView_axisColor, mAxisColor);
+
+ mDataThickness = a.getDimension(
+ R.styleable.InteractiveLineGraphView_dataThickness, mDataThickness);
+ mDataColor = a.getColor(
+ R.styleable.InteractiveLineGraphView_dataColor, mDataColor);
+ } finally {
+ a.recycle();
+ }
+
+ initPaints();
+
+ // Sets up interactions
+ mScaleGestureDetector = new ScaleGestureDetector(context, mScaleGestureListener);
+ mGestureDetector = new GestureDetectorCompat(context, mGestureListener);
+
+ mScroller = new OverScroller(context);
+ mZoomer = new Zoomer(context);
+
+ // Sets up edge effects
+ mEdgeEffectLeft = new EdgeEffectCompat(context);
+ mEdgeEffectTop = new EdgeEffectCompat(context);
+ mEdgeEffectRight = new EdgeEffectCompat(context);
+ mEdgeEffectBottom = new EdgeEffectCompat(context);
+ }
+
+ /**
+ * (Re)initializes {@link Paint} objects based on current attribute values.
+ */
+ private void initPaints() {
+ mLabelTextPaint = new Paint();
+ mLabelTextPaint.setAntiAlias(true);
+ mLabelTextPaint.setTextSize(mLabelTextSize);
+ mLabelTextPaint.setColor(mLabelTextColor);
+ mLabelHeight = (int) Math.abs(mLabelTextPaint.getFontMetrics().top);
+ mMaxLabelWidth = (int) mLabelTextPaint.measureText("0000");
+
+ mGridPaint = new Paint();
+ mGridPaint.setStrokeWidth(mGridThickness);
+ mGridPaint.setColor(mGridColor);
+ mGridPaint.setStyle(Paint.Style.STROKE);
+
+ mAxisPaint = new Paint();
+ mAxisPaint.setStrokeWidth(mAxisThickness);
+ mAxisPaint.setColor(mAxisColor);
+ mAxisPaint.setStyle(Paint.Style.STROKE);
+
+ mDataPaint = new Paint();
+ mDataPaint.setStrokeWidth(mDataThickness);
+ mDataPaint.setColor(mDataColor);
+ mDataPaint.setStyle(Paint.Style.STROKE);
+ mDataPaint.setAntiAlias(true);
+ }
+
+ @Override
+ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+ super.onSizeChanged(w, h, oldw, oldh);
+ mContentRect.set(
+ getPaddingLeft() + mMaxLabelWidth + mLabelSeparation,
+ getPaddingTop(),
+ getWidth() - getPaddingRight(),
+ getHeight() - getPaddingBottom() - mLabelHeight - mLabelSeparation);
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ int minChartSize = getResources().getDimensionPixelSize(R.dimen.min_chart_size);
+ setMeasuredDimension(
+ Math.max(getSuggestedMinimumWidth(),
+ resolveSize(minChartSize + getPaddingLeft() + mMaxLabelWidth
+ + mLabelSeparation + getPaddingRight(),
+ widthMeasureSpec)),
+ Math.max(getSuggestedMinimumHeight(),
+ resolveSize(minChartSize + getPaddingTop() + mLabelHeight
+ + mLabelSeparation + getPaddingBottom(),
+ heightMeasureSpec)));
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // Methods and objects related to drawing
+ //
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+
+ // Draws axes and text labels
+ drawAxes(canvas);
+
+ // Clips the next few drawing operations to the content area
+ int clipRestoreCount = canvas.save();
+ canvas.clipRect(mContentRect);
+
+ drawDataSeriesUnclipped(canvas);
+ drawEdgeEffectsUnclipped(canvas);
+
+ // Removes clipping rectangle
+ canvas.restoreToCount(clipRestoreCount);
+
+ // Draws chart container
+ canvas.drawRect(mContentRect, mAxisPaint);
+ }
+
+ /**
+ * Draws the chart axes and labels onto the canvas.
+ */
+ private void drawAxes(Canvas canvas) {
+ // Computes axis stops (in terms of numerical value and position on screen)
+ int i;
+
+ computeAxisStops(
+ mCurrentViewport.left,
+ mCurrentViewport.right,
+ mContentRect.width() / mMaxLabelWidth / 2,
+ mXStopsBuffer);
+ computeAxisStops(
+ mCurrentViewport.top,
+ mCurrentViewport.bottom,
+ mContentRect.height() / mLabelHeight / 2,
+ mYStopsBuffer);
+
+ // Avoid unnecessary allocations during drawing. Re-use allocated
+ // arrays and only reallocate if the number of stops grows.
+ if (mAxisXPositionsBuffer.length < mXStopsBuffer.numStops) {
+ mAxisXPositionsBuffer = new float[mXStopsBuffer.numStops];
+ }
+ if (mAxisYPositionsBuffer.length < mYStopsBuffer.numStops) {
+ mAxisYPositionsBuffer = new float[mYStopsBuffer.numStops];
+ }
+ if (mAxisXLinesBuffer.length < mXStopsBuffer.numStops * 4) {
+ mAxisXLinesBuffer = new float[mXStopsBuffer.numStops * 4];
+ }
+ if (mAxisYLinesBuffer.length < mYStopsBuffer.numStops * 4) {
+ mAxisYLinesBuffer = new float[mYStopsBuffer.numStops * 4];
+ }
+
+ // Compute positions
+ for (i = 0; i < mXStopsBuffer.numStops; i++) {
+ mAxisXPositionsBuffer[i] = getDrawX(mXStopsBuffer.stops[i]);
+ }
+ for (i = 0; i < mYStopsBuffer.numStops; i++) {
+ mAxisYPositionsBuffer[i] = getDrawY(mYStopsBuffer.stops[i]);
+ }
+
+ // Draws grid lines using drawLines (faster than individual drawLine calls)
+ for (i = 0; i < mXStopsBuffer.numStops; i++) {
+ mAxisXLinesBuffer[i * 4 + 0] = (float) Math.floor(mAxisXPositionsBuffer[i]);
+ mAxisXLinesBuffer[i * 4 + 1] = mContentRect.top;
+ mAxisXLinesBuffer[i * 4 + 2] = (float) Math.floor(mAxisXPositionsBuffer[i]);
+ mAxisXLinesBuffer[i * 4 + 3] = mContentRect.bottom;
+ }
+ canvas.drawLines(mAxisXLinesBuffer, 0, mXStopsBuffer.numStops * 4, mGridPaint);
+
+ for (i = 0; i < mYStopsBuffer.numStops; i++) {
+ mAxisYLinesBuffer[i * 4 + 0] = mContentRect.left;
+ mAxisYLinesBuffer[i * 4 + 1] = (float) Math.floor(mAxisYPositionsBuffer[i]);
+ mAxisYLinesBuffer[i * 4 + 2] = mContentRect.right;
+ mAxisYLinesBuffer[i * 4 + 3] = (float) Math.floor(mAxisYPositionsBuffer[i]);
+ }
+ canvas.drawLines(mAxisYLinesBuffer, 0, mYStopsBuffer.numStops * 4, mGridPaint);
+
+ // Draws X labels
+ int labelOffset;
+ int labelLength;
+ mLabelTextPaint.setTextAlign(Paint.Align.CENTER);
+ for (i = 0; i < mXStopsBuffer.numStops; i++) {
+ // Do not use String.format in high-performance code such as onDraw code.
+ labelLength = formatFloat(mLabelBuffer, mXStopsBuffer.stops[i], mXStopsBuffer.decimals);
+ labelOffset = mLabelBuffer.length - labelLength;
+ canvas.drawText(
+ mLabelBuffer, labelOffset, labelLength,
+ mAxisXPositionsBuffer[i],
+ mContentRect.bottom + mLabelHeight + mLabelSeparation,
+ mLabelTextPaint);
+ }
+
+ // Draws Y labels
+ mLabelTextPaint.setTextAlign(Paint.Align.RIGHT);
+ for (i = 0; i < mYStopsBuffer.numStops; i++) {
+ // Do not use String.format in high-performance code such as onDraw code.
+ labelLength = formatFloat(mLabelBuffer, mYStopsBuffer.stops[i], mYStopsBuffer.decimals);
+ labelOffset = mLabelBuffer.length - labelLength;
+ canvas.drawText(
+ mLabelBuffer, labelOffset, labelLength,
+ mContentRect.left - mLabelSeparation,
+ mAxisYPositionsBuffer[i] + mLabelHeight / 2,
+ mLabelTextPaint);
+ }
+ }
+
+ /**
+ * Rounds the given number to the given number of significant digits. Based on an answer on
+ * <a href="http://stackoverflow.com/questions/202302">Stack Overflow</a>.
+ */
+ private static float roundToOneSignificantFigure(double num) {
+ final float d = (float) Math.ceil((float) Math.log10(num < 0 ? -num : num));
+ final int power = 1 - (int) d;
+ final float magnitude = (float) Math.pow(10, power);
+ final long shifted = Math.round(num * magnitude);
+ return shifted / magnitude;
+ }
+
+ private static final int POW10[] = {1, 10, 100, 1000, 10000, 100000, 1000000};
+
+ /**
+ * Formats a float value to the given number of decimals. Returns the length of the string.
+ * The string begins at out.length - [return value].
+ */
+ private static int formatFloat(final char[] out, float val, int digits) {
+ boolean negative = false;
+ if (val == 0) {
+ out[out.length - 1] = '0';
+ return 1;
+ }
+ if (val < 0) {
+ negative = true;
+ val = -val;
+ }
+ if (digits > POW10.length) {
+ digits = POW10.length - 1;
+ }
+ val *= POW10[digits];
+ long lval = Math.round(val);
+ int index = out.length - 1;
+ int charCount = 0;
+ while (lval != 0 || charCount < (digits + 1)) {
+ int digit = (int) (lval % 10);
+ lval = lval / 10;
+ out[index--] = (char) (digit + '0');
+ charCount++;
+ if (charCount == digits) {
+ out[index--] = '.';
+ charCount++;
+ }
+ }
+ if (negative) {
+ out[index--] = '-';
+ charCount++;
+ }
+ return charCount;
+ }
+
+ /**
+ * Computes the set of axis labels to show given start and stop boundaries and an ideal number
+ * of stops between these boundaries.
+ *
+ * @param start The minimum extreme (e.g. the left edge) for the axis.
+ * @param stop The maximum extreme (e.g. the right edge) for the axis.
+ * @param steps The ideal number of stops to create. This should be based on available screen
+ * space; the more space there is, the more stops should be shown.
+ * @param outStops The destination {@link AxisStops} object to populate.
+ */
+ private static void computeAxisStops(float start, float stop, int steps, AxisStops outStops) {
+ double range = stop - start;
+ if (steps == 0 || range <= 0) {
+ outStops.stops = new float[]{};
+ outStops.numStops = 0;
+ return;
+ }
+
+ double rawInterval = range / steps;
+ double interval = roundToOneSignificantFigure(rawInterval);
+ double intervalMagnitude = Math.pow(10, (int) Math.log10(interval));
+ int intervalSigDigit = (int) (interval / intervalMagnitude);
+ if (intervalSigDigit > 5) {
+ // Use one order of magnitude higher, to avoid intervals like 0.9 or 90
+ interval = Math.floor(10 * intervalMagnitude);
+ }
+
+ double first = Math.ceil(start / interval) * interval;
+ double last = Math.nextUp(Math.floor(stop / interval) * interval);
+
+ double f;
+ int i;
+ int n = 0;
+ for (f = first; f <= last; f += interval) {
+ ++n;
+ }
+
+ outStops.numStops = n;
+
+ if (outStops.stops.length < n) {
+ // Ensure stops contains at least numStops elements.
+ outStops.stops = new float[n];
+ }
+
+ for (f = first, i = 0; i < n; f += interval, ++i) {
+ outStops.stops[i] = (float) f;
+ }
+
+ if (interval < 1) {
+ outStops.decimals = (int) Math.ceil(-Math.log10(interval));
+ } else {
+ outStops.decimals = 0;
+ }
+ }
+
+ /**
+ * Computes the pixel offset for the given X chart value. This may be outside the view bounds.
+ */
+ private float getDrawX(float x) {
+ return mContentRect.left
+ + mContentRect.width()
+ * (x - mCurrentViewport.left) / mCurrentViewport.width();
+ }
+
+ /**
+ * Computes the pixel offset for the given Y chart value. This may be outside the view bounds.
+ */
+ private float getDrawY(float y) {
+ return mContentRect.bottom
+ - mContentRect.height()
+ * (y - mCurrentViewport.top) / mCurrentViewport.height();
+ }
+
+ /**
+ * Draws the currently visible portion of the data series defined by {@link #fun(float)} to the
+ * canvas. This method does not clip its drawing, so users should call {@link Canvas#clipRect
+ * before calling this method.
+ */
+ private void drawDataSeriesUnclipped(Canvas canvas) {
+ mSeriesLinesBuffer[0] = mContentRect.left;
+ mSeriesLinesBuffer[1] = getDrawY(fun(mCurrentViewport.left));
+ mSeriesLinesBuffer[2] = mSeriesLinesBuffer[0];
+ mSeriesLinesBuffer[3] = mSeriesLinesBuffer[1];
+ float x;
+ for (int i = 1; i <= DRAW_STEPS; i++) {
+ mSeriesLinesBuffer[i * 4 + 0] = mSeriesLinesBuffer[(i - 1) * 4 + 2];
+ mSeriesLinesBuffer[i * 4 + 1] = mSeriesLinesBuffer[(i - 1) * 4 + 3];
+
+ x = (mCurrentViewport.left + (mCurrentViewport.width() / DRAW_STEPS * i));
+ mSeriesLinesBuffer[i * 4 + 2] = getDrawX(x);
+ mSeriesLinesBuffer[i * 4 + 3] = getDrawY(fun(x));
+ }
+ canvas.drawLines(mSeriesLinesBuffer, mDataPaint);
+ }
+
+ /**
+ * Draws the overscroll "glow" at the four edges of the chart region, if necessary. The edges
+ * of the chart region are stored in {@link #mContentRect}.
+ *
+ * @see EdgeEffectCompat
+ */
+ private void drawEdgeEffectsUnclipped(Canvas canvas) {
+ // The methods below rotate and translate the canvas as needed before drawing the glow,
+ // since EdgeEffectCompat always draws a top-glow at 0,0.
+
+ boolean needsInvalidate = false;
+
+ if (!mEdgeEffectTop.isFinished()) {
+ final int restoreCount = canvas.save();
+ canvas.translate(mContentRect.left, mContentRect.top);
+ mEdgeEffectTop.setSize(mContentRect.width(), mContentRect.height());
+ if (mEdgeEffectTop.draw(canvas)) {
+ needsInvalidate = true;
+ }
+ canvas.restoreToCount(restoreCount);
+ }
+
+ if (!mEdgeEffectBottom.isFinished()) {
+ final int restoreCount = canvas.save();
+ canvas.translate(2 * mContentRect.left - mContentRect.right, mContentRect.bottom);
+ canvas.rotate(180, mContentRect.width(), 0);
+ mEdgeEffectBottom.setSize(mContentRect.width(), mContentRect.height());
+ if (mEdgeEffectBottom.draw(canvas)) {
+ needsInvalidate = true;
+ }
+ canvas.restoreToCount(restoreCount);
+ }
+
+ if (!mEdgeEffectLeft.isFinished()) {
+ final int restoreCount = canvas.save();
+ canvas.translate(mContentRect.left, mContentRect.bottom);
+ canvas.rotate(-90, 0, 0);
+ mEdgeEffectLeft.setSize(mContentRect.height(), mContentRect.width());
+ if (mEdgeEffectLeft.draw(canvas)) {
+ needsInvalidate = true;
+ }
+ canvas.restoreToCount(restoreCount);
+ }
+
+ if (!mEdgeEffectRight.isFinished()) {
+ final int restoreCount = canvas.save();
+ canvas.translate(mContentRect.right, mContentRect.top);
+ canvas.rotate(90, 0, 0);
+ mEdgeEffectRight.setSize(mContentRect.height(), mContentRect.width());
+ if (mEdgeEffectRight.draw(canvas)) {
+ needsInvalidate = true;
+ }
+ canvas.restoreToCount(restoreCount);
+ }
+
+ if (needsInvalidate) {
+ ViewCompat.postInvalidateOnAnimation(this);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // Methods and objects related to gesture handling
+ //
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Finds the chart point (i.e. within the chart's domain and range) represented by the
+ * given pixel coordinates, if that pixel is within the chart region described by
+ * {@link #mContentRect}. If the point is found, the "dest" argument is set to the point and
+ * this function returns true. Otherwise, this function returns false and "dest" is unchanged.
+ */
+ private boolean hitTest(float x, float y, PointF dest) {
+ if (!mContentRect.contains((int) x, (int) y)) {
+ return false;
+ }
+
+ dest.set(
+ mCurrentViewport.left
+ + mCurrentViewport.width()
+ * (x - mContentRect.left) / mContentRect.width(),
+ mCurrentViewport.top
+ + mCurrentViewport.height()
+ * (y - mContentRect.bottom) / -mContentRect.height());
+ return true;
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ boolean retVal = mScaleGestureDetector.onTouchEvent(event);
+ retVal = mGestureDetector.onTouchEvent(event) || retVal;
+ return retVal || super.onTouchEvent(event);
+ }
+
+ /**
+ * The scale listener, used for handling multi-finger scale gestures.
+ */
+ private final ScaleGestureDetector.OnScaleGestureListener mScaleGestureListener
+ = new ScaleGestureDetector.SimpleOnScaleGestureListener() {
+ /**
+ * This is the active focal point in terms of the viewport. Could be a local
+ * variable but kept here to minimize per-frame allocations.
+ */
+ private PointF viewportFocus = new PointF();
+ private float lastSpanX;
+ private float lastSpanY;
+
+ @Override
+ public boolean onScaleBegin(ScaleGestureDetector scaleGestureDetector) {
+ lastSpanX = ScaleGestureDetectorCompat.getCurrentSpanX(scaleGestureDetector);
+ lastSpanY = ScaleGestureDetectorCompat.getCurrentSpanY(scaleGestureDetector);
+ return true;
+ }
+
+ @Override
+ public boolean onScale(ScaleGestureDetector scaleGestureDetector) {
+ float spanX = ScaleGestureDetectorCompat.getCurrentSpanX(scaleGestureDetector);
+ float spanY = ScaleGestureDetectorCompat.getCurrentSpanY(scaleGestureDetector);
+
+ float newWidth = lastSpanX / spanX * mCurrentViewport.width();
+ float newHeight = lastSpanY / spanY * mCurrentViewport.height();
+
+ float focusX = scaleGestureDetector.getFocusX();
+ float focusY = scaleGestureDetector.getFocusY();
+ hitTest(focusX, focusY, viewportFocus);
+
+ mCurrentViewport.set(
+ viewportFocus.x
+ - newWidth * (focusX - mContentRect.left)
+ / mContentRect.width(),
+ viewportFocus.y
+ - newHeight * (mContentRect.bottom - focusY)
+ / mContentRect.height(),
+ 0,
+ 0);
+ mCurrentViewport.right = mCurrentViewport.left + newWidth;
+ mCurrentViewport.bottom = mCurrentViewport.top + newHeight;
+ constrainViewport();
+ ViewCompat.postInvalidateOnAnimation(InteractiveLineGraphView.this);
+
+ lastSpanX = spanX;
+ lastSpanY = spanY;
+ return true;
+ }
+ };
+
+ /**
+ * Ensures that current viewport is inside the viewport extremes defined by {@link #AXIS_X_MIN},
+ * {@link #AXIS_X_MAX}, {@link #AXIS_Y_MIN} and {@link #AXIS_Y_MAX}.
+ */
+ private void constrainViewport() {
+ mCurrentViewport.left = Math.max(AXIS_X_MIN, mCurrentViewport.left);
+ mCurrentViewport.top = Math.max(AXIS_Y_MIN, mCurrentViewport.top);
+ mCurrentViewport.bottom = Math.max(Math.nextUp(mCurrentViewport.top),
+ Math.min(AXIS_Y_MAX, mCurrentViewport.bottom));
+ mCurrentViewport.right = Math.max(Math.nextUp(mCurrentViewport.left),
+ Math.min(AXIS_X_MAX, mCurrentViewport.right));
+ }
+
+ /**
+ * The gesture listener, used for handling simple gestures such as double touches, scrolls,
+ * and flings.
+ */
+ private final GestureDetector.SimpleOnGestureListener mGestureListener
+ = new GestureDetector.SimpleOnGestureListener() {
+ @Override
+ public boolean onDown(MotionEvent e) {
+ releaseEdgeEffects();
+ mScrollerStartViewport.set(mCurrentViewport);
+ mScroller.forceFinished(true);
+ ViewCompat.postInvalidateOnAnimation(InteractiveLineGraphView.this);
+ return true;
+ }
+
+ @Override
+ public boolean onDoubleTap(MotionEvent e) {
+ mZoomer.forceFinished(true);
+ if (hitTest(e.getX(), e.getY(), mZoomFocalPoint)) {
+ mZoomer.startZoom(ZOOM_AMOUNT);
+ }
+ ViewCompat.postInvalidateOnAnimation(InteractiveLineGraphView.this);
+ return true;
+ }
+
+ @Override
+ public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
+ // Scrolling uses math based on the viewport (as opposed to math using pixels).
+ /**
+ * Pixel offset is the offset in screen pixels, while viewport offset is the
+ * offset within the current viewport. For additional information on surface sizes
+ * and pixel offsets, see the docs for {@link computeScrollSurfaceSize()}. For
+ * additional information about the viewport, see the comments for
+ * {@link mCurrentViewport}.
+ */
+ float viewportOffsetX = distanceX * mCurrentViewport.width() / mContentRect.width();
+ float viewportOffsetY = -distanceY * mCurrentViewport.height() / mContentRect.height();
+ computeScrollSurfaceSize(mSurfaceSizeBuffer);
+ int scrolledX = (int) (mSurfaceSizeBuffer.x
+ * (mCurrentViewport.left + viewportOffsetX - AXIS_X_MIN)
+ / (AXIS_X_MAX - AXIS_X_MIN));
+ int scrolledY = (int) (mSurfaceSizeBuffer.y
+ * (AXIS_Y_MAX - mCurrentViewport.bottom - viewportOffsetY)
+ / (AXIS_Y_MAX - AXIS_Y_MIN));
+ boolean canScrollX = mCurrentViewport.left > AXIS_X_MIN
+ || mCurrentViewport.right < AXIS_X_MAX;
+ boolean canScrollY = mCurrentViewport.top > AXIS_Y_MIN
+ || mCurrentViewport.bottom < AXIS_Y_MAX;
+ setViewportBottomLeft(
+ mCurrentViewport.left + viewportOffsetX,
+ mCurrentViewport.bottom + viewportOffsetY);
+
+ if (canScrollX && scrolledX < 0) {
+ mEdgeEffectLeft.onPull(scrolledX / (float) mContentRect.width());
+ mEdgeEffectLeftActive = true;
+ }
+ if (canScrollY && scrolledY < 0) {
+ mEdgeEffectTop.onPull(scrolledY / (float) mContentRect.height());
+ mEdgeEffectTopActive = true;
+ }
+ if (canScrollX && scrolledX > mSurfaceSizeBuffer.x - mContentRect.width()) {
+ mEdgeEffectRight.onPull((scrolledX - mSurfaceSizeBuffer.x + mContentRect.width())
+ / (float) mContentRect.width());
+ mEdgeEffectRightActive = true;
+ }
+ if (canScrollY && scrolledY > mSurfaceSizeBuffer.y - mContentRect.height()) {
+ mEdgeEffectBottom.onPull((scrolledY - mSurfaceSizeBuffer.y + mContentRect.height())
+ / (float) mContentRect.height());
+ mEdgeEffectBottomActive = true;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
+ fling((int) -velocityX, (int) -velocityY);
+ return true;
+ }
+ };
+
+ private void releaseEdgeEffects() {
+ mEdgeEffectLeftActive
+ = mEdgeEffectTopActive
+ = mEdgeEffectRightActive
+ = mEdgeEffectBottomActive
+ = false;
+ mEdgeEffectLeft.onRelease();
+ mEdgeEffectTop.onRelease();
+ mEdgeEffectRight.onRelease();
+ mEdgeEffectBottom.onRelease();
+ }
+
+ private void fling(int velocityX, int velocityY) {
+ releaseEdgeEffects();
+ // Flings use math in pixels (as opposed to math based on the viewport).
+ computeScrollSurfaceSize(mSurfaceSizeBuffer);
+ mScrollerStartViewport.set(mCurrentViewport);
+ int startX = (int) (mSurfaceSizeBuffer.x * (mScrollerStartViewport.left - AXIS_X_MIN) / (
+ AXIS_X_MAX - AXIS_X_MIN));
+ int startY = (int) (mSurfaceSizeBuffer.y * (AXIS_Y_MAX - mScrollerStartViewport.bottom) / (
+ AXIS_Y_MAX - AXIS_Y_MIN));
+ mScroller.forceFinished(true);
+ mScroller.fling(
+ startX,
+ startY,
+ velocityX,
+ velocityY,
+ 0, mSurfaceSizeBuffer.x - mContentRect.width(),
+ 0, mSurfaceSizeBuffer.y - mContentRect.height(),
+ mContentRect.width() / 2,
+ mContentRect.height() / 2);
+ ViewCompat.postInvalidateOnAnimation(this);
+ }
+
+ /**
+ * Computes the current scrollable surface size, in pixels. For example, if the entire chart
+ * area is visible, this is simply the current size of {@link #mContentRect}. If the chart
+ * is zoomed in 200% in both directions, the returned size will be twice as large horizontally
+ * and vertically.
+ */
+ private void computeScrollSurfaceSize(Point out) {
+ out.set(
+ (int) (mContentRect.width() * (AXIS_X_MAX - AXIS_X_MIN)
+ / mCurrentViewport.width()),
+ (int) (mContentRect.height() * (AXIS_Y_MAX - AXIS_Y_MIN)
+ / mCurrentViewport.height()));
+ }
+
+ @Override
+ public void computeScroll() {
+ super.computeScroll();
+
+ boolean needsInvalidate = false;
+
+ if (mScroller.computeScrollOffset()) {
+ // The scroller isn't finished, meaning a fling or programmatic pan operation is
+ // currently active.
+
+ computeScrollSurfaceSize(mSurfaceSizeBuffer);
+ int currX = mScroller.getCurrX();
+ int currY = mScroller.getCurrY();
+
+ boolean canScrollX = (mCurrentViewport.left > AXIS_X_MIN
+ || mCurrentViewport.right < AXIS_X_MAX);
+ boolean canScrollY = (mCurrentViewport.top > AXIS_Y_MIN
+ || mCurrentViewport.bottom < AXIS_Y_MAX);
+
+ if (canScrollX
+ && currX < 0
+ && mEdgeEffectLeft.isFinished()
+ && !mEdgeEffectLeftActive) {
+ mEdgeEffectLeft.onAbsorb((int) OverScrollerCompat.getCurrVelocity(mScroller));
+ mEdgeEffectLeftActive = true;
+ needsInvalidate = true;
+ } else if (canScrollX
+ && currX > (mSurfaceSizeBuffer.x - mContentRect.width())
+ && mEdgeEffectRight.isFinished()
+ && !mEdgeEffectRightActive) {
+ mEdgeEffectRight.onAbsorb((int) OverScrollerCompat.getCurrVelocity(mScroller));
+ mEdgeEffectRightActive = true;
+ needsInvalidate = true;
+ }
+
+ if (canScrollY
+ && currY < 0
+ && mEdgeEffectTop.isFinished()
+ && !mEdgeEffectTopActive) {
+ mEdgeEffectTop.onAbsorb((int) OverScrollerCompat.getCurrVelocity(mScroller));
+ mEdgeEffectTopActive = true;
+ needsInvalidate = true;
+ } else if (canScrollY
+ && currY > (mSurfaceSizeBuffer.y - mContentRect.height())
+ && mEdgeEffectBottom.isFinished()
+ && !mEdgeEffectBottomActive) {
+ mEdgeEffectBottom.onAbsorb((int) OverScrollerCompat.getCurrVelocity(mScroller));
+ mEdgeEffectBottomActive = true;
+ needsInvalidate = true;
+ }
+
+ float currXRange = AXIS_X_MIN + (AXIS_X_MAX - AXIS_X_MIN)
+ * currX / mSurfaceSizeBuffer.x;
+ float currYRange = AXIS_Y_MAX - (AXIS_Y_MAX - AXIS_Y_MIN)
+ * currY / mSurfaceSizeBuffer.y;
+ setViewportBottomLeft(currXRange, currYRange);
+ }
+
+ if (mZoomer.computeZoom()) {
+ // Performs the zoom since a zoom is in progress (either programmatically or via
+ // double-touch).
+ float newWidth = (1f - mZoomer.getCurrZoom()) * mScrollerStartViewport.width();
+ float newHeight = (1f - mZoomer.getCurrZoom()) * mScrollerStartViewport.height();
+ float pointWithinViewportX = (mZoomFocalPoint.x - mScrollerStartViewport.left)
+ / mScrollerStartViewport.width();
+ float pointWithinViewportY = (mZoomFocalPoint.y - mScrollerStartViewport.top)
+ / mScrollerStartViewport.height();
+ mCurrentViewport.set(
+ mZoomFocalPoint.x - newWidth * pointWithinViewportX,
+ mZoomFocalPoint.y - newHeight * pointWithinViewportY,
+ mZoomFocalPoint.x + newWidth * (1 - pointWithinViewportX),
+ mZoomFocalPoint.y + newHeight * (1 - pointWithinViewportY));
+ constrainViewport();
+ needsInvalidate = true;
+ }
+
+ if (needsInvalidate) {
+ ViewCompat.postInvalidateOnAnimation(this);
+ }
+ }
+
+ /**
+ * Sets the current viewport (defined by {@link #mCurrentViewport}) to the given
+ * X and Y positions. Note that the Y value represents the topmost pixel position, and thus
+ * the bottom of the {@link #mCurrentViewport} rectangle. For more details on why top and
+ * bottom are flipped, see {@link #mCurrentViewport}.
+ */
+ private void setViewportBottomLeft(float x, float y) {
+ /**
+ * Constrains within the scroll range. The scroll range is simply the viewport extremes
+ * (AXIS_X_MAX, etc.) minus the viewport size. For example, if the extrema were 0 and 10,
+ * and the viewport size was 2, the scroll range would be 0 to 8.
+ */
+
+ float curWidth = mCurrentViewport.width();
+ float curHeight = mCurrentViewport.height();
+ x = Math.max(AXIS_X_MIN, Math.min(x, AXIS_X_MAX - curWidth));
+ y = Math.max(AXIS_Y_MIN + curHeight, Math.min(y, AXIS_Y_MAX));
+
+ mCurrentViewport.set(x, y - curHeight, x + curWidth, y);
+ ViewCompat.postInvalidateOnAnimation(this);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // Methods for programmatically changing the viewport
+ //
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Returns the current viewport (visible extremes for the chart domain and range.)
+ */
+ public RectF getCurrentViewport() {
+ return new RectF(mCurrentViewport);
+ }
+
+ /**
+ * Sets the chart's current viewport.
+ *
+ * @see #getCurrentViewport()
+ */
+ public void setCurrentViewport(RectF viewport) {
+ mCurrentViewport = viewport;
+ constrainViewport();
+ ViewCompat.postInvalidateOnAnimation(this);
+ }
+
+ /**
+ * Smoothly zooms the chart in one step.
+ */
+ public void zoomIn() {
+ mScrollerStartViewport.set(mCurrentViewport);
+ mZoomer.forceFinished(true);
+ mZoomer.startZoom(ZOOM_AMOUNT);
+ mZoomFocalPoint.set(
+ (mCurrentViewport.right + mCurrentViewport.left) / 2,
+ (mCurrentViewport.bottom + mCurrentViewport.top) / 2);
+ ViewCompat.postInvalidateOnAnimation(this);
+ }
+
+ /**
+ * Smoothly zooms the chart out one step.
+ */
+ public void zoomOut() {
+ mScrollerStartViewport.set(mCurrentViewport);
+ mZoomer.forceFinished(true);
+ mZoomer.startZoom(-ZOOM_AMOUNT);
+ mZoomFocalPoint.set(
+ (mCurrentViewport.right + mCurrentViewport.left) / 2,
+ (mCurrentViewport.bottom + mCurrentViewport.top) / 2);
+ ViewCompat.postInvalidateOnAnimation(this);
+ }
+
+ /**
+ * Smoothly pans the chart left one step.
+ */
+ public void panLeft() {
+ fling((int) (-PAN_VELOCITY_FACTOR * getWidth()), 0);
+ }
+
+ /**
+ * Smoothly pans the chart right one step.
+ */
+ public void panRight() {
+ fling((int) (PAN_VELOCITY_FACTOR * getWidth()), 0);
+ }
+
+ /**
+ * Smoothly pans the chart up one step.
+ */
+ public void panUp() {
+ fling(0, (int) (-PAN_VELOCITY_FACTOR * getHeight()));
+ }
+
+ /**
+ * Smoothly pans the chart down one step.
+ */
+ public void panDown() {
+ fling(0, (int) (PAN_VELOCITY_FACTOR * getHeight()));
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // Methods related to custom attributes
+ //
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+
+ public float getLabelTextSize() {
+ return mLabelTextSize;
+ }
+
+ public void setLabelTextSize(float labelTextSize) {
+ mLabelTextSize = labelTextSize;
+ initPaints();
+ ViewCompat.postInvalidateOnAnimation(this);
+ }
+
+ public int getLabelTextColor() {
+ return mLabelTextColor;
+ }
+
+ public void setLabelTextColor(int labelTextColor) {
+ mLabelTextColor = labelTextColor;
+ initPaints();
+ ViewCompat.postInvalidateOnAnimation(this);
+ }
+
+ public float getGridThickness() {
+ return mGridThickness;
+ }
+
+ public void setGridThickness(float gridThickness) {
+ mGridThickness = gridThickness;
+ initPaints();
+ ViewCompat.postInvalidateOnAnimation(this);
+ }
+
+ public int getGridColor() {
+ return mGridColor;
+ }
+
+ public void setGridColor(int gridColor) {
+ mGridColor = gridColor;
+ initPaints();
+ ViewCompat.postInvalidateOnAnimation(this);
+ }
+
+ public float getAxisThickness() {
+ return mAxisThickness;
+ }
+
+ public void setAxisThickness(float axisThickness) {
+ mAxisThickness = axisThickness;
+ initPaints();
+ ViewCompat.postInvalidateOnAnimation(this);
+ }
+
+ public int getAxisColor() {
+ return mAxisColor;
+ }
+
+ public void setAxisColor(int axisColor) {
+ mAxisColor = axisColor;
+ initPaints();
+ ViewCompat.postInvalidateOnAnimation(this);
+ }
+
+ public float getDataThickness() {
+ return mDataThickness;
+ }
+
+ public void setDataThickness(float dataThickness) {
+ mDataThickness = dataThickness;
+ }
+
+ public int getDataColor() {
+ return mDataColor;
+ }
+
+ public void setDataColor(int dataColor) {
+ mDataColor = dataColor;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // Methods and classes related to view state persistence.
+ //
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+
+ @Override
+ public Parcelable onSaveInstanceState() {
+ Parcelable superState = super.onSaveInstanceState();
+ SavedState ss = new SavedState(superState);
+ ss.viewport = mCurrentViewport;
+ return ss;
+ }
+
+ @Override
+ public void onRestoreInstanceState(Parcelable state) {
+ if (!(state instanceof SavedState)) {
+ super.onRestoreInstanceState(state);
+ return;
+ }
+
+ SavedState ss = (SavedState) state;
+ super.onRestoreInstanceState(ss.getSuperState());
+
+ mCurrentViewport = ss.viewport;
+ }
+
+ /**
+ * Persistent state that is saved by InteractiveLineGraphView.
+ */
+ public static class SavedState extends BaseSavedState {
+ private RectF viewport;
+
+ public SavedState(Parcelable superState) {
+ super(superState);
+ }
+
+ @Override
+ public void writeToParcel(Parcel out, int flags) {
+ super.writeToParcel(out, flags);
+ out.writeFloat(viewport.left);
+ out.writeFloat(viewport.top);
+ out.writeFloat(viewport.right);
+ out.writeFloat(viewport.bottom);
+ }
+
+ @Override
+ public String toString() {
+ return "InteractiveLineGraphView.SavedState{"
+ + Integer.toHexString(System.identityHashCode(this))
+ + " viewport=" + viewport.toString() + "}";
+ }
+
+ public static final Parcelable.Creator<SavedState> CREATOR
+ = ParcelableCompat.newCreator(new ParcelableCompatCreatorCallbacks<SavedState>() {
+ @Override
+ public SavedState createFromParcel(Parcel in, ClassLoader loader) {
+ return new SavedState(in);
+ }
+
+ @Override
+ public SavedState[] newArray(int size) {
+ return new SavedState[size];
+ }
+ });
+
+ SavedState(Parcel in) {
+ super(in);
+ viewport = new RectF(in.readFloat(), in.readFloat(), in.readFloat(), in.readFloat());
+ }
+ }
+
+ /**
+ * A simple class representing axis label values.
+ *
+ * @see #computeAxisStops
+ */
+ private static class AxisStops {
+ float[] stops = new float[]{};
+ int numStops;
+ int decimals;
+ }
+}
diff --git a/samples/training/InteractiveChart/src/com/example/android/interactivechart/MainActivity.java b/samples/training/InteractiveChart/src/com/example/android/interactivechart/MainActivity.java
new file mode 100755
index 000000000..7c1e56ca8
--- /dev/null
+++ b/samples/training/InteractiveChart/src/com/example/android/interactivechart/MainActivity.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2013 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.example.android.interactivechart;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+
+public class MainActivity extends Activity {
+ private InteractiveLineGraphView mGraphView;
+
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ mGraphView = (InteractiveLineGraphView) findViewById(R.id.chart);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ super.onCreateOptionsMenu(menu);
+ getMenuInflater().inflate(R.menu.main, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.action_zoom_in:
+ mGraphView.zoomIn();
+ return true;
+
+ case R.id.action_zoom_out:
+ mGraphView.zoomOut();
+ return true;
+
+ case R.id.action_pan_left:
+ mGraphView.panLeft();
+ return true;
+
+ case R.id.action_pan_right:
+ mGraphView.panRight();
+ return true;
+
+ case R.id.action_pan_up:
+ mGraphView.panUp();
+ return true;
+
+ case R.id.action_pan_down:
+ mGraphView.panDown();
+ return true;
+ }
+
+ return super.onOptionsItemSelected(item);
+ }
+}
diff --git a/samples/training/InteractiveChart/src/com/example/android/interactivechart/OverScrollerCompat.java b/samples/training/InteractiveChart/src/com/example/android/interactivechart/OverScrollerCompat.java
new file mode 100644
index 000000000..d33f0629b
--- /dev/null
+++ b/samples/training/InteractiveChart/src/com/example/android/interactivechart/OverScrollerCompat.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2013 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.example.android.interactivechart;
+
+import android.annotation.TargetApi;
+import android.os.Build;
+import android.widget.OverScroller;
+
+/**
+ * A utility class for using {@link android.widget.OverScroller} in a backward-compatible fashion.
+ */
+public class OverScrollerCompat {
+ /**
+ * Disallow instantiation.
+ */
+ private OverScrollerCompat() {
+ }
+
+ /**
+ * @see android.view.ScaleGestureDetector#getCurrentSpanY()
+ */
+ @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
+ public static float getCurrVelocity(OverScroller overScroller) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+ return overScroller.getCurrVelocity();
+ } else {
+ return 0;
+ }
+ }
+}
diff --git a/samples/training/InteractiveChart/src/com/example/android/interactivechart/ScaleGestureDetectorCompat.java b/samples/training/InteractiveChart/src/com/example/android/interactivechart/ScaleGestureDetectorCompat.java
new file mode 100644
index 000000000..fecd9d7f5
--- /dev/null
+++ b/samples/training/InteractiveChart/src/com/example/android/interactivechart/ScaleGestureDetectorCompat.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2013 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.example.android.interactivechart;
+
+import android.annotation.TargetApi;
+import android.os.Build;
+import android.view.ScaleGestureDetector;
+
+/**
+ * A utility class for using {@link android.view.ScaleGestureDetector} in a backward-compatible
+ * fashion.
+ */
+public class ScaleGestureDetectorCompat {
+ /**
+ * Disallow instantiation.
+ */
+ private ScaleGestureDetectorCompat() {
+ }
+
+ /**
+ * @see android.view.ScaleGestureDetector#getCurrentSpanX()
+ */
+ @TargetApi(Build.VERSION_CODES.HONEYCOMB)
+ public static float getCurrentSpanX(ScaleGestureDetector scaleGestureDetector) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ return scaleGestureDetector.getCurrentSpanX();
+ } else {
+ return scaleGestureDetector.getCurrentSpan();
+ }
+ }
+
+ /**
+ * @see android.view.ScaleGestureDetector#getCurrentSpanY()
+ */
+ @TargetApi(Build.VERSION_CODES.HONEYCOMB)
+ public static float getCurrentSpanY(ScaleGestureDetector scaleGestureDetector) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ return scaleGestureDetector.getCurrentSpanY();
+ } else {
+ return scaleGestureDetector.getCurrentSpan();
+ }
+ }
+}
diff --git a/samples/training/InteractiveChart/src/com/example/android/interactivechart/Zoomer.java b/samples/training/InteractiveChart/src/com/example/android/interactivechart/Zoomer.java
new file mode 100644
index 000000000..1ae67e4a8
--- /dev/null
+++ b/samples/training/InteractiveChart/src/com/example/android/interactivechart/Zoomer.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2013 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.example.android.interactivechart;
+
+import android.content.Context;
+import android.os.SystemClock;
+import android.view.animation.DecelerateInterpolator;
+import android.view.animation.Interpolator;
+
+/**
+ * A simple class that animates double-touch zoom gestures. Functionally similar to a {@link
+ * android.widget.Scroller}.
+ */
+public class Zoomer {
+ /**
+ * The interpolator, used for making zooms animate 'naturally.'
+ */
+ private Interpolator mInterpolator;
+
+ /**
+ * The total animation duration for a zoom.
+ */
+ private int mAnimationDurationMillis;
+
+ /**
+ * Whether or not the current zoom has finished.
+ */
+ private boolean mFinished = true;
+
+ /**
+ * The current zoom value; computed by {@link #computeZoom()}.
+ */
+ private float mCurrentZoom;
+
+ /**
+ * The time the zoom started, computed using {@link android.os.SystemClock#elapsedRealtime()}.
+ */
+ private long mStartRTC;
+
+ /**
+ * The destination zoom factor.
+ */
+ private float mEndZoom;
+
+ public Zoomer(Context context) {
+ mInterpolator = new DecelerateInterpolator();
+ mAnimationDurationMillis = context.getResources().getInteger(
+ android.R.integer.config_shortAnimTime);
+ }
+
+ /**
+ * Forces the zoom finished state to the given value. Unlike {@link #abortAnimation()}, the
+ * current zoom value isn't set to the ending value.
+ *
+ * @see android.widget.Scroller#forceFinished(boolean)
+ */
+ public void forceFinished(boolean finished) {
+ mFinished = finished;
+ }
+
+ /**
+ * Aborts the animation, setting the current zoom value to the ending value.
+ *
+ * @see android.widget.Scroller#abortAnimation()
+ */
+ public void abortAnimation() {
+ mFinished = true;
+ mCurrentZoom = mEndZoom;
+ }
+
+ /**
+ * Starts a zoom from 1.0 to (1.0 + endZoom). That is, to zoom from 100% to 125%, endZoom should
+ * by 0.25f.
+ *
+ * @see android.widget.Scroller#startScroll(int, int, int, int)
+ */
+ public void startZoom(float endZoom) {
+ mStartRTC = SystemClock.elapsedRealtime();
+ mEndZoom = endZoom;
+
+ mFinished = false;
+ mCurrentZoom = 1f;
+ }
+
+ /**
+ * Computes the current zoom level, returning true if the zoom is still active and false if the
+ * zoom has finished.
+ *
+ * @see android.widget.Scroller#computeScrollOffset()
+ */
+ public boolean computeZoom() {
+ if (mFinished) {
+ return false;
+ }
+
+ long tRTC = SystemClock.elapsedRealtime() - mStartRTC;
+ if (tRTC >= mAnimationDurationMillis) {
+ mFinished = true;
+ mCurrentZoom = mEndZoom;
+ return false;
+ }
+
+ float t = tRTC * 1f / mAnimationDurationMillis;
+ mCurrentZoom = mEndZoom * mInterpolator.getInterpolation(t);
+ return true;
+ }
+
+ /**
+ * Returns the current zoom level.
+ *
+ * @see android.widget.Scroller#getCurrX()
+ */
+ public float getCurrZoom() {
+ return mCurrentZoom;
+ }
+}
diff --git a/samples/training/NavigationDrawer/AndroidManifest.xml b/samples/training/NavigationDrawer/AndroidManifest.xml
new file mode 100755
index 000000000..e48ee243b
--- /dev/null
+++ b/samples/training/NavigationDrawer/AndroidManifest.xml
@@ -0,0 +1,40 @@
+<!--
+ Copyright 2013 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.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.navigationdrawerexample"
+ android:versionCode="1"
+ android:versionName="1.0">
+
+ <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" />
+
+ <application
+ android:label="@string/app_name"
+ android:icon="@drawable/ic_launcher"
+ android:theme="@android:style/Theme.Holo.Light.DarkActionBar">
+
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ </application>
+
+</manifest>
diff --git a/samples/training/NavigationDrawer/libs/android-support-v4.jar b/samples/training/NavigationDrawer/libs/android-support-v4.jar
new file mode 100644
index 000000000..ee6f13aa8
--- /dev/null
+++ b/samples/training/NavigationDrawer/libs/android-support-v4.jar
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-hdpi/action_search.png b/samples/training/NavigationDrawer/res/drawable-hdpi/action_search.png
new file mode 100755
index 000000000..f12e005eb
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-hdpi/action_search.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-hdpi/drawer_shadow.9.png b/samples/training/NavigationDrawer/res/drawable-hdpi/drawer_shadow.9.png
new file mode 100644
index 000000000..224cc4ff4
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-hdpi/drawer_shadow.9.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-hdpi/ic_drawer.png b/samples/training/NavigationDrawer/res/drawable-hdpi/ic_drawer.png
new file mode 100644
index 000000000..ff7b1def9
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-hdpi/ic_drawer.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-hdpi/ic_launcher.png b/samples/training/NavigationDrawer/res/drawable-hdpi/ic_launcher.png
new file mode 100755
index 000000000..b460d6021
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-mdpi/action_search.png b/samples/training/NavigationDrawer/res/drawable-mdpi/action_search.png
new file mode 100755
index 000000000..587d9e0bf
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-mdpi/action_search.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-mdpi/drawer_shadow.9.png b/samples/training/NavigationDrawer/res/drawable-mdpi/drawer_shadow.9.png
new file mode 100644
index 000000000..3797f99c0
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-mdpi/drawer_shadow.9.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-mdpi/ic_drawer.png b/samples/training/NavigationDrawer/res/drawable-mdpi/ic_drawer.png
new file mode 100644
index 000000000..fb681ba26
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-mdpi/ic_drawer.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-mdpi/ic_launcher.png b/samples/training/NavigationDrawer/res/drawable-mdpi/ic_launcher.png
new file mode 100755
index 000000000..dee53f408
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-xhdpi/action_search.png b/samples/training/NavigationDrawer/res/drawable-xhdpi/action_search.png
new file mode 100755
index 000000000..3549f84dd
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-xhdpi/action_search.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-xhdpi/drawer_shadow.9.png b/samples/training/NavigationDrawer/res/drawable-xhdpi/drawer_shadow.9.png
new file mode 100644
index 000000000..fa3d853e9
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-xhdpi/drawer_shadow.9.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-xhdpi/ic_drawer.png b/samples/training/NavigationDrawer/res/drawable-xhdpi/ic_drawer.png
new file mode 100644
index 000000000..b9bc3d70f
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-xhdpi/ic_drawer.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-xhdpi/ic_launcher.png b/samples/training/NavigationDrawer/res/drawable-xhdpi/ic_launcher.png
new file mode 100755
index 000000000..d4e121531
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-xxhdpi/ic_launcher.png b/samples/training/NavigationDrawer/res/drawable-xxhdpi/ic_launcher.png
new file mode 100755
index 000000000..2cc3275b7
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable/earth.jpg b/samples/training/NavigationDrawer/res/drawable/earth.jpg
new file mode 100644
index 000000000..6cabbf4ac
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable/earth.jpg
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable/jupiter.jpg b/samples/training/NavigationDrawer/res/drawable/jupiter.jpg
new file mode 100644
index 000000000..24e8eea35
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable/jupiter.jpg
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable/mars.jpg b/samples/training/NavigationDrawer/res/drawable/mars.jpg
new file mode 100644
index 000000000..db253ef5e
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable/mars.jpg
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable/mercury.jpg b/samples/training/NavigationDrawer/res/drawable/mercury.jpg
new file mode 100644
index 000000000..531790b99
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable/mercury.jpg
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable/neptune.jpg b/samples/training/NavigationDrawer/res/drawable/neptune.jpg
new file mode 100644
index 000000000..88467c5f7
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable/neptune.jpg
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable/saturn.jpg b/samples/training/NavigationDrawer/res/drawable/saturn.jpg
new file mode 100644
index 000000000..8219d1879
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable/saturn.jpg
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable/uranus.jpg b/samples/training/NavigationDrawer/res/drawable/uranus.jpg
new file mode 100644
index 000000000..fa32e3796
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable/uranus.jpg
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable/venus.jpg b/samples/training/NavigationDrawer/res/drawable/venus.jpg
new file mode 100644
index 000000000..e04f0789e
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable/venus.jpg
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/layout/activity_main.xml b/samples/training/NavigationDrawer/res/layout/activity_main.xml
new file mode 100755
index 000000000..f097cd000
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/layout/activity_main.xml
@@ -0,0 +1,47 @@
+<!--
+ Copyright 2013 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.
+ -->
+
+
+<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
+<android.support.v4.widget.DrawerLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/drawer_layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <!-- As the main content view, the view below consumes the entire
+ space available using match_parent in both dimensions. -->
+ <FrameLayout
+ android:id="@+id/content_frame"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+ <!-- android:layout_gravity="start" tells DrawerLayout to treat
+ this as a sliding drawer on the left side for left-to-right
+ languages and on the right side for right-to-left languages.
+ The drawer is given a fixed width in dp and extends the full height of
+ the container. A solid background is used for contrast
+ with the content view. -->
+ <ListView
+ android:id="@+id/left_drawer"
+ android:layout_width="240dp"
+ android:layout_height="match_parent"
+ android:layout_gravity="start"
+ android:choiceMode="singleChoice"
+ android:divider="@android:color/transparent"
+ android:dividerHeight="0dp"
+ android:background="#111"/>
+</android.support.v4.widget.DrawerLayout>
diff --git a/samples/training/NavigationDrawer/res/layout/drawer_list_item.xml b/samples/training/NavigationDrawer/res/layout/drawer_list_item.xml
new file mode 100644
index 000000000..ab525754f
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/layout/drawer_list_item.xml
@@ -0,0 +1,27 @@
+<!--
+ Copyright 2013 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.
+ -->
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@android:id/text1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceListItemSmall"
+ android:gravity="center_vertical"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
+ android:textColor="#fff"
+ android:background="?android:attr/activatedBackgroundIndicator"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"/> \ No newline at end of file
diff --git a/samples/training/NavigationDrawer/res/layout/fragment_planet.xml b/samples/training/NavigationDrawer/res/layout/fragment_planet.xml
new file mode 100644
index 000000000..4fe5bbe61
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/layout/fragment_planet.xml
@@ -0,0 +1,23 @@
+<!--
+ Copyright 2013 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.
+ -->
+
+<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/image"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="#000000"
+ android:gravity="center"
+ android:padding="32dp" />
diff --git a/samples/training/NavigationDrawer/res/menu/main.xml b/samples/training/NavigationDrawer/res/menu/main.xml
new file mode 100644
index 000000000..970c16a91
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/menu/main.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 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.
+ -->
+
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/action_websearch"
+ android:icon="@drawable/action_search"
+ android:title="@string/action_websearch"
+ android:showAsAction="ifRoom|withText" />
+</menu> \ No newline at end of file
diff --git a/samples/training/NavigationDrawer/res/values/strings.xml b/samples/training/NavigationDrawer/res/values/strings.xml
new file mode 100755
index 000000000..3112f4079
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/values/strings.xml
@@ -0,0 +1,33 @@
+<!--
+ Copyright 2013 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.
+ -->
+
+<resources>
+ <string name="app_name">Navigation Drawer Example</string>
+ <string-array name="planets_array">
+ <item>Mercury</item>
+ <item>Venus</item>
+ <item>Earth</item>
+ <item>Mars</item>
+ <item>Jupiter</item>
+ <item>Saturn</item>
+ <item>Uranus</item>
+ <item>Neptune</item>
+ </string-array>
+ <string name="drawer_open">Open navigation drawer</string>
+ <string name="drawer_close">Close navigation drawer</string>
+ <string name="action_websearch">Web search</string>
+ <string name="app_not_available">Sorry, there\'s no web browser available</string>
+</resources>
diff --git a/samples/training/NavigationDrawer/src/com/example/android/navigationdrawerexample/MainActivity.java b/samples/training/NavigationDrawer/src/com/example/android/navigationdrawerexample/MainActivity.java
new file mode 100755
index 000000000..70ffac3a3
--- /dev/null
+++ b/samples/training/NavigationDrawer/src/com/example/android/navigationdrawerexample/MainActivity.java
@@ -0,0 +1,240 @@
+/*
+ * Copyright 2013 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.example.android.navigationdrawerexample;
+
+import java.util.Locale;
+
+import android.app.Activity;
+import android.app.Fragment;
+import android.app.FragmentManager;
+import android.app.SearchManager;
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.support.v4.app.ActionBarDrawerToggle;
+import android.support.v4.view.GravityCompat;
+import android.support.v4.widget.DrawerLayout;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.Toast;
+
+/**
+ * This example illustrates a common usage of the DrawerLayout widget
+ * in the Android support library.
+ * <p/>
+ * <p>When a navigation (left) drawer is present, the host activity should detect presses of
+ * the action bar's Up affordance as a signal to open and close the navigation drawer. The
+ * ActionBarDrawerToggle facilitates this behavior.
+ * Items within the drawer should fall into one of two categories:</p>
+ * <p/>
+ * <ul>
+ * <li><strong>View switches</strong>. A view switch follows the same basic policies as
+ * list or tab navigation in that a view switch does not create navigation history.
+ * This pattern should only be used at the root activity of a task, leaving some form
+ * of Up navigation active for activities further down the navigation hierarchy.</li>
+ * <li><strong>Selective Up</strong>. The drawer allows the user to choose an alternate
+ * parent for Up navigation. This allows a user to jump across an app's navigation
+ * hierarchy at will. The application should treat this as it treats Up navigation from
+ * a different task, replacing the current task stack using TaskStackBuilder or similar.
+ * This is the only form of navigation drawer that should be used outside of the root
+ * activity of a task.</li>
+ * </ul>
+ * <p/>
+ * <p>Right side drawers should be used for actions, not navigation. This follows the pattern
+ * established by the Action Bar that navigation should be to the left and actions to the right.
+ * An action should be an operation performed on the current contents of the window,
+ * for example enabling or disabling a data overlay on top of the current content.</p>
+ */
+public class MainActivity extends Activity {
+ private DrawerLayout mDrawerLayout;
+ private ListView mDrawerList;
+ private ActionBarDrawerToggle mDrawerToggle;
+
+ private CharSequence mDrawerTitle;
+ private CharSequence mTitle;
+ private String[] mPlanetTitles;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ mTitle = mDrawerTitle = getTitle();
+ mPlanetTitles = getResources().getStringArray(R.array.planets_array);
+ mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
+ mDrawerList = (ListView) findViewById(R.id.left_drawer);
+
+ // set a custom shadow that overlays the main content when the drawer opens
+ mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
+ // set up the drawer's list view with items and click listener
+ mDrawerList.setAdapter(new ArrayAdapter<String>(this,
+ R.layout.drawer_list_item, mPlanetTitles));
+ mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
+
+ // enable ActionBar app icon to behave as action to toggle nav drawer
+ getActionBar().setDisplayHomeAsUpEnabled(true);
+ getActionBar().setHomeButtonEnabled(true);
+
+ // ActionBarDrawerToggle ties together the the proper interactions
+ // between the sliding drawer and the action bar app icon
+ mDrawerToggle = new ActionBarDrawerToggle(
+ this, /* host Activity */
+ mDrawerLayout, /* DrawerLayout object */
+ R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
+ R.string.drawer_open, /* "open drawer" description for accessibility */
+ R.string.drawer_close /* "close drawer" description for accessibility */
+ ) {
+ public void onDrawerClosed(View view) {
+ getActionBar().setTitle(mTitle);
+ invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
+ }
+
+ public void onDrawerOpened(View drawerView) {
+ getActionBar().setTitle(mDrawerTitle);
+ invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
+ }
+ };
+ mDrawerLayout.setDrawerListener(mDrawerToggle);
+
+ if (savedInstanceState == null) {
+ selectItem(0);
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.main, menu);
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ /* Called whenever we call invalidateOptionsMenu() */
+ @Override
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ // If the nav drawer is open, hide action items related to the content view
+ boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList);
+ menu.findItem(R.id.action_websearch).setVisible(!drawerOpen);
+ return super.onPrepareOptionsMenu(menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ // The action bar home/up action should open or close the drawer.
+ // ActionBarDrawerToggle will take care of this.
+ if (mDrawerToggle.onOptionsItemSelected(item)) {
+ return true;
+ }
+ // Handle action buttons
+ switch(item.getItemId()) {
+ case R.id.action_websearch:
+ // create intent to perform web search for this planet
+ Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
+ intent.putExtra(SearchManager.QUERY, getActionBar().getTitle());
+ // catch event that there's no activity to handle intent
+ if (intent.resolveActivity(getPackageManager()) != null) {
+ startActivity(intent);
+ } else {
+ Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show();
+ }
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
+ /* The click listner for ListView in the navigation drawer */
+ private class DrawerItemClickListener implements ListView.OnItemClickListener {
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ selectItem(position);
+ }
+ }
+
+ private void selectItem(int position) {
+ // update the main content by replacing fragments
+ Fragment fragment = new PlanetFragment();
+ Bundle args = new Bundle();
+ args.putInt(PlanetFragment.ARG_PLANET_NUMBER, position);
+ fragment.setArguments(args);
+
+ FragmentManager fragmentManager = getFragmentManager();
+ fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
+
+ // update selected item and title, then close the drawer
+ mDrawerList.setItemChecked(position, true);
+ setTitle(mPlanetTitles[position]);
+ mDrawerLayout.closeDrawer(mDrawerList);
+ }
+
+ @Override
+ public void setTitle(CharSequence title) {
+ mTitle = title;
+ getActionBar().setTitle(mTitle);
+ }
+
+ /**
+ * When using the ActionBarDrawerToggle, you must call it during
+ * onPostCreate() and onConfigurationChanged()...
+ */
+
+ @Override
+ protected void onPostCreate(Bundle savedInstanceState) {
+ super.onPostCreate(savedInstanceState);
+ // Sync the toggle state after onRestoreInstanceState has occurred.
+ mDrawerToggle.syncState();
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ // Pass any configuration change to the drawer toggls
+ mDrawerToggle.onConfigurationChanged(newConfig);
+ }
+
+ /**
+ * Fragment that appears in the "content_frame", shows a planet
+ */
+ public static class PlanetFragment extends Fragment {
+ public static final String ARG_PLANET_NUMBER = "planet_number";
+
+ public PlanetFragment() {
+ // Empty constructor required for fragment subclasses
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View rootView = inflater.inflate(R.layout.fragment_planet, container, false);
+ int i = getArguments().getInt(ARG_PLANET_NUMBER);
+ String planet = getResources().getStringArray(R.array.planets_array)[i];
+
+ int imageId = getResources().getIdentifier(planet.toLowerCase(Locale.getDefault()),
+ "drawable", getActivity().getPackageName());
+ ((ImageView) rootView.findViewById(R.id.image)).setImageResource(imageId);
+ getActivity().setTitle(planet);
+ return rootView;
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/training/bitmapfun/src/com/example/android/bitmapfun/provider/Images.java b/samples/training/bitmapfun/src/com/example/android/bitmapfun/provider/Images.java
index 809d73b5d..b5557847c 100644
--- a/samples/training/bitmapfun/src/com/example/android/bitmapfun/provider/Images.java
+++ b/samples/training/bitmapfun/src/com/example/android/bitmapfun/provider/Images.java
@@ -24,92 +24,222 @@ public class Images {
/**
* This are PicasaWeb URLs and could potentially change. Ideally the PicasaWeb API should be
* used to fetch the URLs.
+ *
+ * Credit to Romain Guy for the photos:
+ * http://www.curious-creature.org/
+ * https://plus.google.com/109538161516040592207/about
+ * http://www.flickr.com/photos/romainguy
*/
public final static String[] imageUrls = new String[] {
- "http://lh6.googleusercontent.com/-jZgveEqb6pg/T3R4kXScycI/AAAAAAAAAE0/xQ7CvpfXDzc/s1024/sample_image_01.jpg",
- "http://lh4.googleusercontent.com/-K2FMuOozxU0/T3R4lRAiBTI/AAAAAAAAAE8/a3Eh9JvnnzI/s1024/sample_image_02.jpg",
- "http://lh5.googleusercontent.com/-SCS5C646rxM/T3R4l7QB6xI/AAAAAAAAAFE/xLcuVv3CUyA/s1024/sample_image_03.jpg",
- "http://lh6.googleusercontent.com/-f0NJR6-_Thg/T3R4mNex2wI/AAAAAAAAAFI/45oug4VE8MI/s1024/sample_image_04.jpg",
- "http://lh3.googleusercontent.com/-n-xcJmiI0pg/T3R4mkSchHI/AAAAAAAAAFU/EoiNNb7kk3A/s1024/sample_image_05.jpg",
- "http://lh3.googleusercontent.com/-X43vAudm7f4/T3R4nGSChJI/AAAAAAAAAFk/3bna6D-2EE8/s1024/sample_image_06.jpg",
- "http://lh5.googleusercontent.com/-MpZneqIyjXU/T3R4nuGO1aI/AAAAAAAAAFg/r09OPjLx1ZY/s1024/sample_image_07.jpg",
- "http://lh6.googleusercontent.com/-ql3YNfdClJo/T3XvW9apmFI/AAAAAAAAAL4/_6HFDzbahc4/s1024/sample_image_08.jpg",
- "http://lh5.googleusercontent.com/-Pxa7eqF4cyc/T3R4oasvPEI/AAAAAAAAAF0/-uYDH92h8LA/s1024/sample_image_09.jpg",
- "http://lh4.googleusercontent.com/-Li-rjhFEuaI/T3R4o-VUl4I/AAAAAAAAAF8/5E5XdMnP1oE/s1024/sample_image_10.jpg",
- "http://lh5.googleusercontent.com/-_HU4fImgFhA/T3R4pPVIwWI/AAAAAAAAAGA/0RfK_Vkgth4/s1024/sample_image_11.jpg",
- "http://lh6.googleusercontent.com/-0gnNrVjwa0Y/T3R4peGYJwI/AAAAAAAAAGU/uX_9wvRPM9I/s1024/sample_image_12.jpg",
- "http://lh3.googleusercontent.com/-HBxuzALS_Zs/T3R4qERykaI/AAAAAAAAAGQ/_qQ16FaZ1q0/s1024/sample_image_13.jpg",
- "http://lh4.googleusercontent.com/-cKojDrARNjQ/T3R4qfWSGPI/AAAAAAAAAGY/MR5dnbNaPyY/s1024/sample_image_14.jpg",
- "http://lh3.googleusercontent.com/-WujkdYfcyZ8/T3R4qrIMGUI/AAAAAAAAAGk/277LIdgvnjg/s1024/sample_image_15.jpg",
- "http://lh6.googleusercontent.com/-FMHR7Vy3PgI/T3R4rOXlEKI/AAAAAAAAAGs/VeXrDNDBkaw/s1024/sample_image_16.jpg",
- "http://lh4.googleusercontent.com/-mrR0AJyNTH0/T3R4rZs6CuI/AAAAAAAAAG0/UE1wQqCOqLA/s1024/sample_image_17.jpg",
- "http://lh6.googleusercontent.com/-z77w0eh3cow/T3R4rnLn05I/AAAAAAAAAG4/BaerfWoNucU/s1024/sample_image_18.jpg",
- "http://lh5.googleusercontent.com/-aWVwh1OU5Bk/T3R4sAWw0yI/AAAAAAAAAHE/4_KAvJttFwA/s1024/sample_image_19.jpg",
- "http://lh6.googleusercontent.com/-q-js52DMnWQ/T3R4tZhY2sI/AAAAAAAAAHM/A8kjp2Ivdqg/s1024/sample_image_20.jpg",
- "http://lh5.googleusercontent.com/-_jIzvvzXKn4/T3R4t7xpdVI/AAAAAAAAAHU/7QC6eZ10jgs/s1024/sample_image_21.jpg",
- "http://lh3.googleusercontent.com/-lnGi4IMLpwU/T3R4uCMa7vI/AAAAAAAAAHc/1zgzzz6qTpk/s1024/sample_image_22.jpg",
- "http://lh5.googleusercontent.com/-fFCzKjFPsPc/T3R4u0SZPFI/AAAAAAAAAHk/sbgjzrktOK0/s1024/sample_image_23.jpg",
- "http://lh4.googleusercontent.com/-8TqoW5gBE_Y/T3R4vBS3NPI/AAAAAAAAAHs/EZYvpNsaNXk/s1024/sample_image_24.jpg",
- "http://lh6.googleusercontent.com/-gc4eQ3ySdzs/T3R4vafoA7I/AAAAAAAAAH4/yKii5P6tqDE/s1024/sample_image_25.jpg",
- "http://lh5.googleusercontent.com/--NYOPCylU7Q/T3R4vjAiWkI/AAAAAAAAAH8/IPNx5q3ptRA/s1024/sample_image_26.jpg",
- "http://lh6.googleusercontent.com/-9IJM8so4vCI/T3R4vwJO2yI/AAAAAAAAAIE/ljlr-cwuqZM/s1024/sample_image_27.jpg",
- "http://lh4.googleusercontent.com/-KW6QwOHfhBs/T3R4w0RsQiI/AAAAAAAAAIM/uEFLVgHPFCk/s1024/sample_image_28.jpg",
- "http://lh4.googleusercontent.com/-z2557Ec1ctY/T3R4x3QA2hI/AAAAAAAAAIk/9-GzPL1lTWE/s1024/sample_image_29.jpg",
- "http://lh5.googleusercontent.com/-LaKXAn4Kr1c/T3R4yc5b4lI/AAAAAAAAAIY/fMgcOVQfmD0/s1024/sample_image_30.jpg",
- "http://lh4.googleusercontent.com/-F9LRToJoQdo/T3R4yrLtyQI/AAAAAAAAAIg/ri9uUCWuRmo/s1024/sample_image_31.jpg",
- "http://lh4.googleusercontent.com/-6X-xBwP-QpI/T3R4zGVboII/AAAAAAAAAIs/zYH4PjjngY0/s1024/sample_image_32.jpg",
- "http://lh5.googleusercontent.com/-VdLRjbW4LAs/T3R4zXu3gUI/AAAAAAAAAIw/9aFp9t7mCPg/s1024/sample_image_33.jpg",
- "http://lh6.googleusercontent.com/-gL6R17_fDJU/T3R4zpIXGjI/AAAAAAAAAI8/Q2Vjx-L9X20/s1024/sample_image_34.jpg",
- "http://lh3.googleusercontent.com/-1fGH4YJXEzo/T3R40Y1B7KI/AAAAAAAAAJE/MnTsa77g-nk/s1024/sample_image_35.jpg",
- "http://lh4.googleusercontent.com/-Ql0jHSrea-A/T3R403mUfFI/AAAAAAAAAJM/qzI4SkcH9tY/s1024/sample_image_36.jpg",
- "http://lh5.googleusercontent.com/-BL5FIBR_tzI/T3R41DA0AKI/AAAAAAAAAJk/GZfeeb-SLM0/s1024/sample_image_37.jpg",
- "http://lh4.googleusercontent.com/-wF2Vc9YDutw/T3R41fR2BCI/AAAAAAAAAJc/JdU1sHdMRAk/s1024/sample_image_38.jpg",
- "http://lh6.googleusercontent.com/-ZWHiPehwjTI/T3R41zuaKCI/AAAAAAAAAJg/hR3QJ1v3REg/s1024/sample_image_39.jpg",
+ "https://lh6.googleusercontent.com/-55osAWw3x0Q/URquUtcFr5I/AAAAAAAAAbs/rWlj1RUKrYI/s1024/A%252520Photographer.jpg",
+ "https://lh4.googleusercontent.com/--dq8niRp7W4/URquVgmXvgI/AAAAAAAAAbs/-gnuLQfNnBA/s1024/A%252520Song%252520of%252520Ice%252520and%252520Fire.jpg",
+ "https://lh5.googleusercontent.com/-7qZeDtRKFKc/URquWZT1gOI/AAAAAAAAAbs/hqWgteyNXsg/s1024/Another%252520Rockaway%252520Sunset.jpg",
+ "https://lh3.googleusercontent.com/--L0Km39l5J8/URquXHGcdNI/AAAAAAAAAbs/3ZrSJNrSomQ/s1024/Antelope%252520Butte.jpg",
+ "https://lh6.googleusercontent.com/-8HO-4vIFnlw/URquZnsFgtI/AAAAAAAAAbs/WT8jViTF7vw/s1024/Antelope%252520Hallway.jpg",
+ "https://lh4.googleusercontent.com/-WIuWgVcU3Qw/URqubRVcj4I/AAAAAAAAAbs/YvbwgGjwdIQ/s1024/Antelope%252520Walls.jpg",
+ "https://lh6.googleusercontent.com/-UBmLbPELvoQ/URqucCdv0kI/AAAAAAAAAbs/IdNhr2VQoQs/s1024/Apre%2525CC%252580s%252520la%252520Pluie.jpg",
+ "https://lh3.googleusercontent.com/-s-AFpvgSeew/URquc6dF-JI/AAAAAAAAAbs/Mt3xNGRUd68/s1024/Backlit%252520Cloud.jpg",
+ "https://lh5.googleusercontent.com/-bvmif9a9YOQ/URquea3heHI/AAAAAAAAAbs/rcr6wyeQtAo/s1024/Bee%252520and%252520Flower.jpg",
+ "https://lh5.googleusercontent.com/-n7mdm7I7FGs/URqueT_BT-I/AAAAAAAAAbs/9MYmXlmpSAo/s1024/Bonzai%252520Rock%252520Sunset.jpg",
+ "https://lh6.googleusercontent.com/-4CN4X4t0M1k/URqufPozWzI/AAAAAAAAAbs/8wK41lg1KPs/s1024/Caterpillar.jpg",
+ "https://lh3.googleusercontent.com/-rrFnVC8xQEg/URqufdrLBaI/AAAAAAAAAbs/s69WYy_fl1E/s1024/Chess.jpg",
+ "https://lh5.googleusercontent.com/-WVpRptWH8Yw/URqugh-QmDI/AAAAAAAAAbs/E-MgBgtlUWU/s1024/Chihuly.jpg",
+ "https://lh5.googleusercontent.com/-0BDXkYmckbo/URquhKFW84I/AAAAAAAAAbs/ogQtHCTk2JQ/s1024/Closed%252520Door.jpg",
+ "https://lh3.googleusercontent.com/-PyggXXZRykM/URquh-kVvoI/AAAAAAAAAbs/hFtDwhtrHHQ/s1024/Colorado%252520River%252520Sunset.jpg",
+ "https://lh3.googleusercontent.com/-ZAs4dNZtALc/URquikvOCWI/AAAAAAAAAbs/DXz4h3dll1Y/s1024/Colors%252520of%252520Autumn.jpg",
+ "https://lh4.googleusercontent.com/-GztnWEIiMz8/URqukVCU7bI/AAAAAAAAAbs/jo2Hjv6MZ6M/s1024/Countryside.jpg",
+ "https://lh4.googleusercontent.com/-bEg9EZ9QoiM/URquklz3FGI/AAAAAAAAAbs/UUuv8Ac2BaE/s1024/Death%252520Valley%252520-%252520Dunes.jpg",
+ "https://lh6.googleusercontent.com/-ijQJ8W68tEE/URqulGkvFEI/AAAAAAAAAbs/zPXvIwi_rFw/s1024/Delicate%252520Arch.jpg",
+ "https://lh5.googleusercontent.com/-Oh8mMy2ieng/URqullDwehI/AAAAAAAAAbs/TbdeEfsaIZY/s1024/Despair.jpg",
+ "https://lh5.googleusercontent.com/-gl0y4UiAOlk/URqumC_KjBI/AAAAAAAAAbs/PM1eT7dn4oo/s1024/Eagle%252520Fall%252520Sunrise.jpg",
+ "https://lh3.googleusercontent.com/-hYYHd2_vXPQ/URqumtJa9eI/AAAAAAAAAbs/wAalXVkbSh0/s1024/Electric%252520Storm.jpg",
+ "https://lh5.googleusercontent.com/-PyY_yiyjPTo/URqunUOhHFI/AAAAAAAAAbs/azZoULNuJXc/s1024/False%252520Kiva.jpg",
+ "https://lh6.googleusercontent.com/-PYvLVdvXywk/URqunwd8hfI/AAAAAAAAAbs/qiMwgkFvf6I/s1024/Fitzgerald%252520Streaks.jpg",
+ "https://lh4.googleusercontent.com/-KIR_UobIIqY/URquoCZ9SlI/AAAAAAAAAbs/Y4d4q8sXu4c/s1024/Foggy%252520Sunset.jpg",
+ "https://lh6.googleusercontent.com/-9lzOk_OWZH0/URquoo4xYoI/AAAAAAAAAbs/AwgzHtNVCwU/s1024/Frantic.jpg",
+ "https://lh3.googleusercontent.com/-0X3JNaKaz48/URqupH78wpI/AAAAAAAAAbs/lHXxu_zbH8s/s1024/Golden%252520Gate%252520Afternoon.jpg",
+ "https://lh6.googleusercontent.com/-95sb5ag7ABc/URqupl95RDI/AAAAAAAAAbs/g73R20iVTRA/s1024/Golden%252520Gate%252520Fog.jpg",
+ "https://lh3.googleusercontent.com/-JB9v6rtgHhk/URqup21F-zI/AAAAAAAAAbs/64Fb8qMZWXk/s1024/Golden%252520Grass.jpg",
+ "https://lh4.googleusercontent.com/-EIBGfnuLtII/URquqVHwaRI/AAAAAAAAAbs/FA4McV2u8VE/s1024/Grand%252520Teton.jpg",
+ "https://lh4.googleusercontent.com/-WoMxZvmN9nY/URquq1v2AoI/AAAAAAAAAbs/grj5uMhL6NA/s1024/Grass%252520Closeup.jpg",
+ "https://lh3.googleusercontent.com/-6hZiEHXx64Q/URqurxvNdqI/AAAAAAAAAbs/kWMXM3o5OVI/s1024/Green%252520Grass.jpg",
+ "https://lh5.googleusercontent.com/-6LVb9OXtQ60/URquteBFuKI/AAAAAAAAAbs/4F4kRgecwFs/s1024/Hanging%252520Leaf.jpg",
+ "https://lh4.googleusercontent.com/-zAvf__52ONk/URqutT_IuxI/AAAAAAAAAbs/D_bcuc0thoU/s1024/Highway%2525201.jpg",
+ "https://lh6.googleusercontent.com/-H4SrUg615rA/URquuL27fXI/AAAAAAAAAbs/4aEqJfiMsOU/s1024/Horseshoe%252520Bend%252520Sunset.jpg",
+ "https://lh4.googleusercontent.com/-JhFi4fb_Pqw/URquuX-QXbI/AAAAAAAAAbs/IXpYUxuweYM/s1024/Horseshoe%252520Bend.jpg",
+ "https://lh5.googleusercontent.com/-UGgssvFRJ7g/URquueyJzGI/AAAAAAAAAbs/yYIBlLT0toM/s1024/Into%252520the%252520Blue.jpg",
+ "https://lh3.googleusercontent.com/-CH7KoupI7uI/URquu0FF__I/AAAAAAAAAbs/R7GDmI7v_G0/s1024/Jelly%252520Fish%2525202.jpg",
+ "https://lh4.googleusercontent.com/-pwuuw6yhg8U/URquvPxR3FI/AAAAAAAAAbs/VNGk6f-tsGE/s1024/Jelly%252520Fish%2525203.jpg",
+ "https://lh5.googleusercontent.com/-GoUQVw1fnFw/URquv6xbC0I/AAAAAAAAAbs/zEUVTQQ43Zc/s1024/Kauai.jpg",
+ "https://lh6.googleusercontent.com/-8QdYYQEpYjw/URquwvdh88I/AAAAAAAAAbs/cktDy-ysfHo/s1024/Kyoto%252520Sunset.jpg",
+ "https://lh4.googleusercontent.com/-vPeekyDjOE0/URquwzJ28qI/AAAAAAAAAbs/qxcyXULsZrg/s1024/Lake%252520Tahoe%252520Colors.jpg",
+ "https://lh4.googleusercontent.com/-xBPxWpD4yxU/URquxWHk8AI/AAAAAAAAAbs/ARDPeDYPiMY/s1024/Lava%252520from%252520the%252520Sky.jpg",
+ "https://lh3.googleusercontent.com/-897VXrJB6RE/URquxxxd-5I/AAAAAAAAAbs/j-Cz4T4YvIw/s1024/Leica%25252050mm%252520Summilux.jpg",
+ "https://lh5.googleusercontent.com/-qSJ4D4iXzGo/URquyDWiJ1I/AAAAAAAAAbs/k2pBXeWehOA/s1024/Leica%25252050mm%252520Summilux.jpg",
+ "https://lh6.googleusercontent.com/-dwlPg83vzLg/URquylTVuFI/AAAAAAAAAbs/G6SyQ8b4YsI/s1024/Leica%252520M8%252520%252528Front%252529.jpg",
+ "https://lh3.googleusercontent.com/-R3_EYAyJvfk/URquzQBv8eI/AAAAAAAAAbs/b9xhpUM3pEI/s1024/Light%252520to%252520Sand.jpg",
+ "https://lh3.googleusercontent.com/-fHY5h67QPi0/URqu0Cp4J1I/AAAAAAAAAbs/0lG6m94Z6vM/s1024/Little%252520Bit%252520of%252520Paradise.jpg",
+ "https://lh5.googleusercontent.com/-TzF_LwrCnRM/URqu0RddPOI/AAAAAAAAAbs/gaj2dLiuX0s/s1024/Lone%252520Pine%252520Sunset.jpg",
+ "https://lh3.googleusercontent.com/-4HdpJ4_DXU4/URqu046dJ9I/AAAAAAAAAbs/eBOodtk2_uk/s1024/Lonely%252520Rock.jpg",
+ "https://lh6.googleusercontent.com/-erbF--z-W4s/URqu1ajSLkI/AAAAAAAAAbs/xjDCDO1INzM/s1024/Longue%252520Vue.jpg",
+ "https://lh6.googleusercontent.com/-0CXJRdJaqvc/URqu1opNZNI/AAAAAAAAAbs/PFB2oPUU7Lk/s1024/Look%252520Me%252520in%252520the%252520Eye.jpg",
+ "https://lh3.googleusercontent.com/-D_5lNxnDN6g/URqu2Tk7HVI/AAAAAAAAAbs/p0ddca9W__Y/s1024/Lost%252520in%252520a%252520Field.jpg",
+ "https://lh6.googleusercontent.com/-flsqwMrIk2Q/URqu24PcmjI/AAAAAAAAAbs/5ocIH85XofM/s1024/Marshall%252520Beach%252520Sunset.jpg",
+ "https://lh4.googleusercontent.com/-Y4lgryEVTmU/URqu28kG3gI/AAAAAAAAAbs/OjXpekqtbJ4/s1024/Mono%252520Lake%252520Blue.jpg",
+ "https://lh4.googleusercontent.com/-AaHAJPmcGYA/URqu3PIldHI/AAAAAAAAAbs/lcTqk1SIcRs/s1024/Monument%252520Valley%252520Overlook.jpg",
+ "https://lh4.googleusercontent.com/-vKxfdQ83dQA/URqu31Yq_BI/AAAAAAAAAbs/OUoGk_2AyfM/s1024/Moving%252520Rock.jpg",
+ "https://lh5.googleusercontent.com/-CG62QiPpWXg/URqu4ia4vRI/AAAAAAAAAbs/0YOdqLAlcAc/s1024/Napali%252520Coast.jpg",
+ "https://lh6.googleusercontent.com/-wdGrP5PMmJQ/URqu5PZvn7I/AAAAAAAAAbs/m0abEcdPXe4/s1024/One%252520Wheel.jpg",
+ "https://lh6.googleusercontent.com/-6WS5DoCGuOA/URqu5qx1UgI/AAAAAAAAAbs/giMw2ixPvrY/s1024/Open%252520Sky.jpg",
+ "https://lh6.googleusercontent.com/-u8EHKj8G8GQ/URqu55sM6yI/AAAAAAAAAbs/lIXX_GlTdmI/s1024/Orange%252520Sunset.jpg",
+ "https://lh6.googleusercontent.com/-74Z5qj4bTDE/URqu6LSrJrI/AAAAAAAAAbs/XzmVkw90szQ/s1024/Orchid.jpg",
+ "https://lh6.googleusercontent.com/-lEQE4h6TePE/URqu6t_lSkI/AAAAAAAAAbs/zvGYKOea_qY/s1024/Over%252520there.jpg",
+ "https://lh5.googleusercontent.com/-cauH-53JH2M/URqu66v_USI/AAAAAAAAAbs/EucwwqclfKQ/s1024/Plumes.jpg",
+ "https://lh3.googleusercontent.com/-eDLT2jHDoy4/URqu7axzkAI/AAAAAAAAAbs/iVZE-xJ7lZs/s1024/Rainbokeh.jpg",
+ "https://lh5.googleusercontent.com/-j1NLqEFIyco/URqu8L1CGcI/AAAAAAAAAbs/aqZkgX66zlI/s1024/Rainbow.jpg",
+ "https://lh5.googleusercontent.com/-DRnqmK0t4VU/URqu8XYN9yI/AAAAAAAAAbs/LgvF_592WLU/s1024/Rice%252520Fields.jpg",
+ "https://lh3.googleusercontent.com/-hwh1v3EOGcQ/URqu8qOaKwI/AAAAAAAAAbs/IljRJRnbJGw/s1024/Rockaway%252520Fire%252520Sky.jpg",
+ "https://lh5.googleusercontent.com/-wjV6FQk7tlk/URqu9jCQ8sI/AAAAAAAAAbs/RyYUpdo-c9o/s1024/Rockaway%252520Flow.jpg",
+ "https://lh6.googleusercontent.com/-6cAXNfo7D20/URqu-BdzgPI/AAAAAAAAAbs/OmsYllzJqwo/s1024/Rockaway%252520Sunset%252520Sky.jpg",
+ "https://lh3.googleusercontent.com/-sl8fpGPS-RE/URqu_BOkfgI/AAAAAAAAAbs/Dg2Fv-JxOeg/s1024/Russian%252520Ridge%252520Sunset.jpg",
+ "https://lh6.googleusercontent.com/-gVtY36mMBIg/URqu_q91lkI/AAAAAAAAAbs/3CiFMBcy5MA/s1024/Rust%252520Knot.jpg",
+ "https://lh6.googleusercontent.com/-GHeImuHqJBE/URqu_FKfVLI/AAAAAAAAAbs/axuEJeqam7Q/s1024/Sailing%252520Stones.jpg",
+ "https://lh3.googleusercontent.com/-hBbYZjTOwGc/URqu_ycpIrI/AAAAAAAAAbs/nAdJUXnGJYE/s1024/Seahorse.jpg",
+ "https://lh3.googleusercontent.com/-Iwi6-i6IexY/URqvAYZHsVI/AAAAAAAAAbs/5ETWl4qXsFE/s1024/Shinjuku%252520Street.jpg",
+ "https://lh6.googleusercontent.com/-amhnySTM_MY/URqvAlb5KoI/AAAAAAAAAbs/pFCFgzlKsn0/s1024/Sierra%252520Heavens.jpg",
+ "https://lh5.googleusercontent.com/-dJgjepFrYSo/URqvBVJZrAI/AAAAAAAAAbs/v-F5QWpYO6s/s1024/Sierra%252520Sunset.jpg",
+ "https://lh4.googleusercontent.com/-Z4zGiC5nWdc/URqvBdEwivI/AAAAAAAAAbs/ZRZR1VJ84QA/s1024/Sin%252520Lights.jpg",
+ "https://lh4.googleusercontent.com/-_0cYiWW8ccY/URqvBz3iM4I/AAAAAAAAAbs/9N_Wq8MhLTY/s1024/Starry%252520Lake.jpg",
+ "https://lh3.googleusercontent.com/-A9LMoRyuQUA/URqvCYx_JoI/AAAAAAAAAbs/s7sde1Bz9cI/s1024/Starry%252520Night.jpg",
+ "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg",
+ "https://lh5.googleusercontent.com/-dFB7Lad6RcA/URqvDUftwWI/AAAAAAAAAbs/BrhoUtXTN7o/s1024/Strip%252520Sunset.jpg",
+ "https://lh5.googleusercontent.com/-at6apgFiN20/URqvDyffUZI/AAAAAAAAAbs/clABCx171bE/s1024/Sunset%252520Hills.jpg",
+ "https://lh4.googleusercontent.com/-7-EHhtQthII/URqvEYTk4vI/AAAAAAAAAbs/QSJZoB3YjVg/s1024/Tenaya%252520Lake%2525202.jpg",
+ "https://lh6.googleusercontent.com/-8MrjV_a-Pok/URqvFC5repI/AAAAAAAAAbs/9inKTg9fbCE/s1024/Tenaya%252520Lake.jpg",
+ "https://lh5.googleusercontent.com/-B1HW-z4zwao/URqvFWYRwUI/AAAAAAAAAbs/8Peli53Bs8I/s1024/The%252520Cave%252520BW.jpg",
+ "https://lh3.googleusercontent.com/-PO4E-xZKAnQ/URqvGRqjYkI/AAAAAAAAAbs/42nyADFsXag/s1024/The%252520Fisherman.jpg",
+ "https://lh4.googleusercontent.com/-iLyZlzfdy7s/URqvG0YScdI/AAAAAAAAAbs/1J9eDKmkXtk/s1024/The%252520Night%252520is%252520Coming.jpg",
+ "https://lh6.googleusercontent.com/-G-k7YkkUco0/URqvHhah6fI/AAAAAAAAAbs/_taQQG7t0vo/s1024/The%252520Road.jpg",
+ "https://lh6.googleusercontent.com/-h-ALJt7kSus/URqvIThqYfI/AAAAAAAAAbs/ejiv35olWS8/s1024/Tokyo%252520Heights.jpg",
+ "https://lh5.googleusercontent.com/-Hy9k-TbS7xg/URqvIjQMOxI/AAAAAAAAAbs/RSpmmOATSkg/s1024/Tokyo%252520Highway.jpg",
+ "https://lh6.googleusercontent.com/-83oOvMb4OZs/URqvJL0T7lI/AAAAAAAAAbs/c5TECZ6RONM/s1024/Tokyo%252520Smog.jpg",
+ "https://lh3.googleusercontent.com/-FB-jfgREEfI/URqvJI3EXAI/AAAAAAAAAbs/XfyweiRF4v8/s1024/Tufa%252520at%252520Night.jpg",
+ "https://lh4.googleusercontent.com/-vngKD5Z1U8w/URqvJUCEgPI/AAAAAAAAAbs/ulxCMVcU6EU/s1024/Valley%252520Sunset.jpg",
+ "https://lh6.googleusercontent.com/-DOz5I2E2oMQ/URqvKMND1kI/AAAAAAAAAbs/Iqf0IsInleo/s1024/Windmill%252520Sunrise.jpg",
+ "https://lh5.googleusercontent.com/-biyiyWcJ9MU/URqvKculiAI/AAAAAAAAAbs/jyPsCplJOpE/s1024/Windmill.jpg",
+ "https://lh4.googleusercontent.com/-PDT167_xRdA/URqvK36mLcI/AAAAAAAAAbs/oi2ik9QseMI/s1024/Windmills.jpg",
+ "https://lh5.googleusercontent.com/-kI_QdYx7VlU/URqvLXCB6gI/AAAAAAAAAbs/N31vlZ6u89o/s1024/Yet%252520Another%252520Rockaway%252520Sunset.jpg",
+ "https://lh4.googleusercontent.com/-e9NHZ5k5MSs/URqvMIBZjtI/AAAAAAAAAbs/1fV810rDNfQ/s1024/Yosemite%252520Tree.jpg",
};
/**
* This are PicasaWeb thumbnail URLs and could potentially change. Ideally the PicasaWeb API
* should be used to fetch the URLs.
+ *
+ * Credit to Romain Guy for the photos:
+ * http://www.curious-creature.org/
+ * https://plus.google.com/109538161516040592207/about
+ * http://www.flickr.com/photos/romainguy
*/
public final static String[] imageThumbUrls = new String[] {
- "http://lh6.googleusercontent.com/-jZgveEqb6pg/T3R4kXScycI/AAAAAAAAAE0/xQ7CvpfXDzc/s160-c/sample_image_01.jpg",
- "http://lh4.googleusercontent.com/-K2FMuOozxU0/T3R4lRAiBTI/AAAAAAAAAE8/a3Eh9JvnnzI/s160-c/sample_image_02.jpg",
- "http://lh5.googleusercontent.com/-SCS5C646rxM/T3R4l7QB6xI/AAAAAAAAAFE/xLcuVv3CUyA/s160-c/sample_image_03.jpg",
- "http://lh6.googleusercontent.com/-f0NJR6-_Thg/T3R4mNex2wI/AAAAAAAAAFI/45oug4VE8MI/s160-c/sample_image_04.jpg",
- "http://lh3.googleusercontent.com/-n-xcJmiI0pg/T3R4mkSchHI/AAAAAAAAAFU/EoiNNb7kk3A/s160-c/sample_image_05.jpg",
- "http://lh3.googleusercontent.com/-X43vAudm7f4/T3R4nGSChJI/AAAAAAAAAFk/3bna6D-2EE8/s160-c/sample_image_06.jpg",
- "http://lh5.googleusercontent.com/-MpZneqIyjXU/T3R4nuGO1aI/AAAAAAAAAFg/r09OPjLx1ZY/s160-c/sample_image_07.jpg",
- "http://lh6.googleusercontent.com/-ql3YNfdClJo/T3XvW9apmFI/AAAAAAAAAL4/_6HFDzbahc4/s160-c/sample_image_08.jpg",
- "http://lh5.googleusercontent.com/-Pxa7eqF4cyc/T3R4oasvPEI/AAAAAAAAAF0/-uYDH92h8LA/s160-c/sample_image_09.jpg",
- "http://lh4.googleusercontent.com/-Li-rjhFEuaI/T3R4o-VUl4I/AAAAAAAAAF8/5E5XdMnP1oE/s160-c/sample_image_10.jpg",
- "http://lh5.googleusercontent.com/-_HU4fImgFhA/T3R4pPVIwWI/AAAAAAAAAGA/0RfK_Vkgth4/s160-c/sample_image_11.jpg",
- "http://lh6.googleusercontent.com/-0gnNrVjwa0Y/T3R4peGYJwI/AAAAAAAAAGU/uX_9wvRPM9I/s160-c/sample_image_12.jpg",
- "http://lh3.googleusercontent.com/-HBxuzALS_Zs/T3R4qERykaI/AAAAAAAAAGQ/_qQ16FaZ1q0/s160-c/sample_image_13.jpg",
- "http://lh4.googleusercontent.com/-cKojDrARNjQ/T3R4qfWSGPI/AAAAAAAAAGY/MR5dnbNaPyY/s160-c/sample_image_14.jpg",
- "http://lh3.googleusercontent.com/-WujkdYfcyZ8/T3R4qrIMGUI/AAAAAAAAAGk/277LIdgvnjg/s160-c/sample_image_15.jpg",
- "http://lh6.googleusercontent.com/-FMHR7Vy3PgI/T3R4rOXlEKI/AAAAAAAAAGs/VeXrDNDBkaw/s160-c/sample_image_16.jpg",
- "http://lh4.googleusercontent.com/-mrR0AJyNTH0/T3R4rZs6CuI/AAAAAAAAAG0/UE1wQqCOqLA/s160-c/sample_image_17.jpg",
- "http://lh6.googleusercontent.com/-z77w0eh3cow/T3R4rnLn05I/AAAAAAAAAG4/BaerfWoNucU/s160-c/sample_image_18.jpg",
- "http://lh5.googleusercontent.com/-aWVwh1OU5Bk/T3R4sAWw0yI/AAAAAAAAAHE/4_KAvJttFwA/s160-c/sample_image_19.jpg",
- "http://lh6.googleusercontent.com/-q-js52DMnWQ/T3R4tZhY2sI/AAAAAAAAAHM/A8kjp2Ivdqg/s160-c/sample_image_20.jpg",
- "http://lh5.googleusercontent.com/-_jIzvvzXKn4/T3R4t7xpdVI/AAAAAAAAAHU/7QC6eZ10jgs/s160-c/sample_image_21.jpg",
- "http://lh3.googleusercontent.com/-lnGi4IMLpwU/T3R4uCMa7vI/AAAAAAAAAHc/1zgzzz6qTpk/s160-c/sample_image_22.jpg",
- "http://lh5.googleusercontent.com/-fFCzKjFPsPc/T3R4u0SZPFI/AAAAAAAAAHk/sbgjzrktOK0/s160-c/sample_image_23.jpg",
- "http://lh4.googleusercontent.com/-8TqoW5gBE_Y/T3R4vBS3NPI/AAAAAAAAAHs/EZYvpNsaNXk/s160-c/sample_image_24.jpg",
- "http://lh6.googleusercontent.com/-gc4eQ3ySdzs/T3R4vafoA7I/AAAAAAAAAH4/yKii5P6tqDE/s160-c/sample_image_25.jpg",
- "http://lh5.googleusercontent.com/--NYOPCylU7Q/T3R4vjAiWkI/AAAAAAAAAH8/IPNx5q3ptRA/s160-c/sample_image_26.jpg",
- "http://lh6.googleusercontent.com/-9IJM8so4vCI/T3R4vwJO2yI/AAAAAAAAAIE/ljlr-cwuqZM/s160-c/sample_image_27.jpg",
- "http://lh4.googleusercontent.com/-KW6QwOHfhBs/T3R4w0RsQiI/AAAAAAAAAIM/uEFLVgHPFCk/s160-c/sample_image_28.jpg",
- "http://lh4.googleusercontent.com/-z2557Ec1ctY/T3R4x3QA2hI/AAAAAAAAAIk/9-GzPL1lTWE/s160-c/sample_image_29.jpg",
- "http://lh5.googleusercontent.com/-LaKXAn4Kr1c/T3R4yc5b4lI/AAAAAAAAAIY/fMgcOVQfmD0/s160-c/sample_image_30.jpg",
- "http://lh4.googleusercontent.com/-F9LRToJoQdo/T3R4yrLtyQI/AAAAAAAAAIg/ri9uUCWuRmo/s160-c/sample_image_31.jpg",
- "http://lh4.googleusercontent.com/-6X-xBwP-QpI/T3R4zGVboII/AAAAAAAAAIs/zYH4PjjngY0/s160-c/sample_image_32.jpg",
- "http://lh5.googleusercontent.com/-VdLRjbW4LAs/T3R4zXu3gUI/AAAAAAAAAIw/9aFp9t7mCPg/s160-c/sample_image_33.jpg",
- "http://lh6.googleusercontent.com/-gL6R17_fDJU/T3R4zpIXGjI/AAAAAAAAAI8/Q2Vjx-L9X20/s160-c/sample_image_34.jpg",
- "http://lh3.googleusercontent.com/-1fGH4YJXEzo/T3R40Y1B7KI/AAAAAAAAAJE/MnTsa77g-nk/s160-c/sample_image_35.jpg",
- "http://lh4.googleusercontent.com/-Ql0jHSrea-A/T3R403mUfFI/AAAAAAAAAJM/qzI4SkcH9tY/s160-c/sample_image_36.jpg",
- "http://lh5.googleusercontent.com/-BL5FIBR_tzI/T3R41DA0AKI/AAAAAAAAAJk/GZfeeb-SLM0/s160-c/sample_image_37.jpg",
- "http://lh4.googleusercontent.com/-wF2Vc9YDutw/T3R41fR2BCI/AAAAAAAAAJc/JdU1sHdMRAk/s160-c/sample_image_38.jpg",
- "http://lh6.googleusercontent.com/-ZWHiPehwjTI/T3R41zuaKCI/AAAAAAAAAJg/hR3QJ1v3REg/s160-c/sample_image_39.jpg",
+ "https://lh6.googleusercontent.com/-55osAWw3x0Q/URquUtcFr5I/AAAAAAAAAbs/rWlj1RUKrYI/s160-c/A%252520Photographer.jpg",
+ "https://lh4.googleusercontent.com/--dq8niRp7W4/URquVgmXvgI/AAAAAAAAAbs/-gnuLQfNnBA/s160-c/A%252520Song%252520of%252520Ice%252520and%252520Fire.jpg",
+ "https://lh5.googleusercontent.com/-7qZeDtRKFKc/URquWZT1gOI/AAAAAAAAAbs/hqWgteyNXsg/s160-c/Another%252520Rockaway%252520Sunset.jpg",
+ "https://lh3.googleusercontent.com/--L0Km39l5J8/URquXHGcdNI/AAAAAAAAAbs/3ZrSJNrSomQ/s160-c/Antelope%252520Butte.jpg",
+ "https://lh6.googleusercontent.com/-8HO-4vIFnlw/URquZnsFgtI/AAAAAAAAAbs/WT8jViTF7vw/s160-c/Antelope%252520Hallway.jpg",
+ "https://lh4.googleusercontent.com/-WIuWgVcU3Qw/URqubRVcj4I/AAAAAAAAAbs/YvbwgGjwdIQ/s160-c/Antelope%252520Walls.jpg",
+ "https://lh6.googleusercontent.com/-UBmLbPELvoQ/URqucCdv0kI/AAAAAAAAAbs/IdNhr2VQoQs/s160-c/Apre%2525CC%252580s%252520la%252520Pluie.jpg",
+ "https://lh3.googleusercontent.com/-s-AFpvgSeew/URquc6dF-JI/AAAAAAAAAbs/Mt3xNGRUd68/s160-c/Backlit%252520Cloud.jpg",
+ "https://lh5.googleusercontent.com/-bvmif9a9YOQ/URquea3heHI/AAAAAAAAAbs/rcr6wyeQtAo/s160-c/Bee%252520and%252520Flower.jpg",
+ "https://lh5.googleusercontent.com/-n7mdm7I7FGs/URqueT_BT-I/AAAAAAAAAbs/9MYmXlmpSAo/s160-c/Bonzai%252520Rock%252520Sunset.jpg",
+ "https://lh6.googleusercontent.com/-4CN4X4t0M1k/URqufPozWzI/AAAAAAAAAbs/8wK41lg1KPs/s160-c/Caterpillar.jpg",
+ "https://lh3.googleusercontent.com/-rrFnVC8xQEg/URqufdrLBaI/AAAAAAAAAbs/s69WYy_fl1E/s160-c/Chess.jpg",
+ "https://lh5.googleusercontent.com/-WVpRptWH8Yw/URqugh-QmDI/AAAAAAAAAbs/E-MgBgtlUWU/s160-c/Chihuly.jpg",
+ "https://lh5.googleusercontent.com/-0BDXkYmckbo/URquhKFW84I/AAAAAAAAAbs/ogQtHCTk2JQ/s160-c/Closed%252520Door.jpg",
+ "https://lh3.googleusercontent.com/-PyggXXZRykM/URquh-kVvoI/AAAAAAAAAbs/hFtDwhtrHHQ/s160-c/Colorado%252520River%252520Sunset.jpg",
+ "https://lh3.googleusercontent.com/-ZAs4dNZtALc/URquikvOCWI/AAAAAAAAAbs/DXz4h3dll1Y/s160-c/Colors%252520of%252520Autumn.jpg",
+ "https://lh4.googleusercontent.com/-GztnWEIiMz8/URqukVCU7bI/AAAAAAAAAbs/jo2Hjv6MZ6M/s160-c/Countryside.jpg",
+ "https://lh4.googleusercontent.com/-bEg9EZ9QoiM/URquklz3FGI/AAAAAAAAAbs/UUuv8Ac2BaE/s160-c/Death%252520Valley%252520-%252520Dunes.jpg",
+ "https://lh6.googleusercontent.com/-ijQJ8W68tEE/URqulGkvFEI/AAAAAAAAAbs/zPXvIwi_rFw/s160-c/Delicate%252520Arch.jpg",
+ "https://lh5.googleusercontent.com/-Oh8mMy2ieng/URqullDwehI/AAAAAAAAAbs/TbdeEfsaIZY/s160-c/Despair.jpg",
+ "https://lh5.googleusercontent.com/-gl0y4UiAOlk/URqumC_KjBI/AAAAAAAAAbs/PM1eT7dn4oo/s160-c/Eagle%252520Fall%252520Sunrise.jpg",
+ "https://lh3.googleusercontent.com/-hYYHd2_vXPQ/URqumtJa9eI/AAAAAAAAAbs/wAalXVkbSh0/s160-c/Electric%252520Storm.jpg",
+ "https://lh5.googleusercontent.com/-PyY_yiyjPTo/URqunUOhHFI/AAAAAAAAAbs/azZoULNuJXc/s160-c/False%252520Kiva.jpg",
+ "https://lh6.googleusercontent.com/-PYvLVdvXywk/URqunwd8hfI/AAAAAAAAAbs/qiMwgkFvf6I/s160-c/Fitzgerald%252520Streaks.jpg",
+ "https://lh4.googleusercontent.com/-KIR_UobIIqY/URquoCZ9SlI/AAAAAAAAAbs/Y4d4q8sXu4c/s160-c/Foggy%252520Sunset.jpg",
+ "https://lh6.googleusercontent.com/-9lzOk_OWZH0/URquoo4xYoI/AAAAAAAAAbs/AwgzHtNVCwU/s160-c/Frantic.jpg",
+ "https://lh3.googleusercontent.com/-0X3JNaKaz48/URqupH78wpI/AAAAAAAAAbs/lHXxu_zbH8s/s160-c/Golden%252520Gate%252520Afternoon.jpg",
+ "https://lh6.googleusercontent.com/-95sb5ag7ABc/URqupl95RDI/AAAAAAAAAbs/g73R20iVTRA/s160-c/Golden%252520Gate%252520Fog.jpg",
+ "https://lh3.googleusercontent.com/-JB9v6rtgHhk/URqup21F-zI/AAAAAAAAAbs/64Fb8qMZWXk/s160-c/Golden%252520Grass.jpg",
+ "https://lh4.googleusercontent.com/-EIBGfnuLtII/URquqVHwaRI/AAAAAAAAAbs/FA4McV2u8VE/s160-c/Grand%252520Teton.jpg",
+ "https://lh4.googleusercontent.com/-WoMxZvmN9nY/URquq1v2AoI/AAAAAAAAAbs/grj5uMhL6NA/s160-c/Grass%252520Closeup.jpg",
+ "https://lh3.googleusercontent.com/-6hZiEHXx64Q/URqurxvNdqI/AAAAAAAAAbs/kWMXM3o5OVI/s160-c/Green%252520Grass.jpg",
+ "https://lh5.googleusercontent.com/-6LVb9OXtQ60/URquteBFuKI/AAAAAAAAAbs/4F4kRgecwFs/s160-c/Hanging%252520Leaf.jpg",
+ "https://lh4.googleusercontent.com/-zAvf__52ONk/URqutT_IuxI/AAAAAAAAAbs/D_bcuc0thoU/s160-c/Highway%2525201.jpg",
+ "https://lh6.googleusercontent.com/-H4SrUg615rA/URquuL27fXI/AAAAAAAAAbs/4aEqJfiMsOU/s160-c/Horseshoe%252520Bend%252520Sunset.jpg",
+ "https://lh4.googleusercontent.com/-JhFi4fb_Pqw/URquuX-QXbI/AAAAAAAAAbs/IXpYUxuweYM/s160-c/Horseshoe%252520Bend.jpg",
+ "https://lh5.googleusercontent.com/-UGgssvFRJ7g/URquueyJzGI/AAAAAAAAAbs/yYIBlLT0toM/s160-c/Into%252520the%252520Blue.jpg",
+ "https://lh3.googleusercontent.com/-CH7KoupI7uI/URquu0FF__I/AAAAAAAAAbs/R7GDmI7v_G0/s160-c/Jelly%252520Fish%2525202.jpg",
+ "https://lh4.googleusercontent.com/-pwuuw6yhg8U/URquvPxR3FI/AAAAAAAAAbs/VNGk6f-tsGE/s160-c/Jelly%252520Fish%2525203.jpg",
+ "https://lh5.googleusercontent.com/-GoUQVw1fnFw/URquv6xbC0I/AAAAAAAAAbs/zEUVTQQ43Zc/s160-c/Kauai.jpg",
+ "https://lh6.googleusercontent.com/-8QdYYQEpYjw/URquwvdh88I/AAAAAAAAAbs/cktDy-ysfHo/s160-c/Kyoto%252520Sunset.jpg",
+ "https://lh4.googleusercontent.com/-vPeekyDjOE0/URquwzJ28qI/AAAAAAAAAbs/qxcyXULsZrg/s160-c/Lake%252520Tahoe%252520Colors.jpg",
+ "https://lh4.googleusercontent.com/-xBPxWpD4yxU/URquxWHk8AI/AAAAAAAAAbs/ARDPeDYPiMY/s160-c/Lava%252520from%252520the%252520Sky.jpg",
+ "https://lh3.googleusercontent.com/-897VXrJB6RE/URquxxxd-5I/AAAAAAAAAbs/j-Cz4T4YvIw/s160-c/Leica%25252050mm%252520Summilux.jpg",
+ "https://lh5.googleusercontent.com/-qSJ4D4iXzGo/URquyDWiJ1I/AAAAAAAAAbs/k2pBXeWehOA/s160-c/Leica%25252050mm%252520Summilux.jpg",
+ "https://lh6.googleusercontent.com/-dwlPg83vzLg/URquylTVuFI/AAAAAAAAAbs/G6SyQ8b4YsI/s160-c/Leica%252520M8%252520%252528Front%252529.jpg",
+ "https://lh3.googleusercontent.com/-R3_EYAyJvfk/URquzQBv8eI/AAAAAAAAAbs/b9xhpUM3pEI/s160-c/Light%252520to%252520Sand.jpg",
+ "https://lh3.googleusercontent.com/-fHY5h67QPi0/URqu0Cp4J1I/AAAAAAAAAbs/0lG6m94Z6vM/s160-c/Little%252520Bit%252520of%252520Paradise.jpg",
+ "https://lh5.googleusercontent.com/-TzF_LwrCnRM/URqu0RddPOI/AAAAAAAAAbs/gaj2dLiuX0s/s160-c/Lone%252520Pine%252520Sunset.jpg",
+ "https://lh3.googleusercontent.com/-4HdpJ4_DXU4/URqu046dJ9I/AAAAAAAAAbs/eBOodtk2_uk/s160-c/Lonely%252520Rock.jpg",
+ "https://lh6.googleusercontent.com/-erbF--z-W4s/URqu1ajSLkI/AAAAAAAAAbs/xjDCDO1INzM/s160-c/Longue%252520Vue.jpg",
+ "https://lh6.googleusercontent.com/-0CXJRdJaqvc/URqu1opNZNI/AAAAAAAAAbs/PFB2oPUU7Lk/s160-c/Look%252520Me%252520in%252520the%252520Eye.jpg",
+ "https://lh3.googleusercontent.com/-D_5lNxnDN6g/URqu2Tk7HVI/AAAAAAAAAbs/p0ddca9W__Y/s160-c/Lost%252520in%252520a%252520Field.jpg",
+ "https://lh6.googleusercontent.com/-flsqwMrIk2Q/URqu24PcmjI/AAAAAAAAAbs/5ocIH85XofM/s160-c/Marshall%252520Beach%252520Sunset.jpg",
+ "https://lh4.googleusercontent.com/-Y4lgryEVTmU/URqu28kG3gI/AAAAAAAAAbs/OjXpekqtbJ4/s160-c/Mono%252520Lake%252520Blue.jpg",
+ "https://lh4.googleusercontent.com/-AaHAJPmcGYA/URqu3PIldHI/AAAAAAAAAbs/lcTqk1SIcRs/s160-c/Monument%252520Valley%252520Overlook.jpg",
+ "https://lh4.googleusercontent.com/-vKxfdQ83dQA/URqu31Yq_BI/AAAAAAAAAbs/OUoGk_2AyfM/s160-c/Moving%252520Rock.jpg",
+ "https://lh5.googleusercontent.com/-CG62QiPpWXg/URqu4ia4vRI/AAAAAAAAAbs/0YOdqLAlcAc/s160-c/Napali%252520Coast.jpg",
+ "https://lh6.googleusercontent.com/-wdGrP5PMmJQ/URqu5PZvn7I/AAAAAAAAAbs/m0abEcdPXe4/s160-c/One%252520Wheel.jpg",
+ "https://lh6.googleusercontent.com/-6WS5DoCGuOA/URqu5qx1UgI/AAAAAAAAAbs/giMw2ixPvrY/s160-c/Open%252520Sky.jpg",
+ "https://lh6.googleusercontent.com/-u8EHKj8G8GQ/URqu55sM6yI/AAAAAAAAAbs/lIXX_GlTdmI/s160-c/Orange%252520Sunset.jpg",
+ "https://lh6.googleusercontent.com/-74Z5qj4bTDE/URqu6LSrJrI/AAAAAAAAAbs/XzmVkw90szQ/s160-c/Orchid.jpg",
+ "https://lh6.googleusercontent.com/-lEQE4h6TePE/URqu6t_lSkI/AAAAAAAAAbs/zvGYKOea_qY/s160-c/Over%252520there.jpg",
+ "https://lh5.googleusercontent.com/-cauH-53JH2M/URqu66v_USI/AAAAAAAAAbs/EucwwqclfKQ/s160-c/Plumes.jpg",
+ "https://lh3.googleusercontent.com/-eDLT2jHDoy4/URqu7axzkAI/AAAAAAAAAbs/iVZE-xJ7lZs/s160-c/Rainbokeh.jpg",
+ "https://lh5.googleusercontent.com/-j1NLqEFIyco/URqu8L1CGcI/AAAAAAAAAbs/aqZkgX66zlI/s160-c/Rainbow.jpg",
+ "https://lh5.googleusercontent.com/-DRnqmK0t4VU/URqu8XYN9yI/AAAAAAAAAbs/LgvF_592WLU/s160-c/Rice%252520Fields.jpg",
+ "https://lh3.googleusercontent.com/-hwh1v3EOGcQ/URqu8qOaKwI/AAAAAAAAAbs/IljRJRnbJGw/s160-c/Rockaway%252520Fire%252520Sky.jpg",
+ "https://lh5.googleusercontent.com/-wjV6FQk7tlk/URqu9jCQ8sI/AAAAAAAAAbs/RyYUpdo-c9o/s160-c/Rockaway%252520Flow.jpg",
+ "https://lh6.googleusercontent.com/-6cAXNfo7D20/URqu-BdzgPI/AAAAAAAAAbs/OmsYllzJqwo/s160-c/Rockaway%252520Sunset%252520Sky.jpg",
+ "https://lh3.googleusercontent.com/-sl8fpGPS-RE/URqu_BOkfgI/AAAAAAAAAbs/Dg2Fv-JxOeg/s160-c/Russian%252520Ridge%252520Sunset.jpg",
+ "https://lh6.googleusercontent.com/-gVtY36mMBIg/URqu_q91lkI/AAAAAAAAAbs/3CiFMBcy5MA/s160-c/Rust%252520Knot.jpg",
+ "https://lh6.googleusercontent.com/-GHeImuHqJBE/URqu_FKfVLI/AAAAAAAAAbs/axuEJeqam7Q/s160-c/Sailing%252520Stones.jpg",
+ "https://lh3.googleusercontent.com/-hBbYZjTOwGc/URqu_ycpIrI/AAAAAAAAAbs/nAdJUXnGJYE/s160-c/Seahorse.jpg",
+ "https://lh3.googleusercontent.com/-Iwi6-i6IexY/URqvAYZHsVI/AAAAAAAAAbs/5ETWl4qXsFE/s160-c/Shinjuku%252520Street.jpg",
+ "https://lh6.googleusercontent.com/-amhnySTM_MY/URqvAlb5KoI/AAAAAAAAAbs/pFCFgzlKsn0/s160-c/Sierra%252520Heavens.jpg",
+ "https://lh5.googleusercontent.com/-dJgjepFrYSo/URqvBVJZrAI/AAAAAAAAAbs/v-F5QWpYO6s/s160-c/Sierra%252520Sunset.jpg",
+ "https://lh4.googleusercontent.com/-Z4zGiC5nWdc/URqvBdEwivI/AAAAAAAAAbs/ZRZR1VJ84QA/s160-c/Sin%252520Lights.jpg",
+ "https://lh4.googleusercontent.com/-_0cYiWW8ccY/URqvBz3iM4I/AAAAAAAAAbs/9N_Wq8MhLTY/s160-c/Starry%252520Lake.jpg",
+ "https://lh3.googleusercontent.com/-A9LMoRyuQUA/URqvCYx_JoI/AAAAAAAAAbs/s7sde1Bz9cI/s160-c/Starry%252520Night.jpg",
+ "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s160-c/Stream.jpg",
+ "https://lh5.googleusercontent.com/-dFB7Lad6RcA/URqvDUftwWI/AAAAAAAAAbs/BrhoUtXTN7o/s160-c/Strip%252520Sunset.jpg",
+ "https://lh5.googleusercontent.com/-at6apgFiN20/URqvDyffUZI/AAAAAAAAAbs/clABCx171bE/s160-c/Sunset%252520Hills.jpg",
+ "https://lh4.googleusercontent.com/-7-EHhtQthII/URqvEYTk4vI/AAAAAAAAAbs/QSJZoB3YjVg/s160-c/Tenaya%252520Lake%2525202.jpg",
+ "https://lh6.googleusercontent.com/-8MrjV_a-Pok/URqvFC5repI/AAAAAAAAAbs/9inKTg9fbCE/s160-c/Tenaya%252520Lake.jpg",
+ "https://lh5.googleusercontent.com/-B1HW-z4zwao/URqvFWYRwUI/AAAAAAAAAbs/8Peli53Bs8I/s160-c/The%252520Cave%252520BW.jpg",
+ "https://lh3.googleusercontent.com/-PO4E-xZKAnQ/URqvGRqjYkI/AAAAAAAAAbs/42nyADFsXag/s160-c/The%252520Fisherman.jpg",
+ "https://lh4.googleusercontent.com/-iLyZlzfdy7s/URqvG0YScdI/AAAAAAAAAbs/1J9eDKmkXtk/s160-c/The%252520Night%252520is%252520Coming.jpg",
+ "https://lh6.googleusercontent.com/-G-k7YkkUco0/URqvHhah6fI/AAAAAAAAAbs/_taQQG7t0vo/s160-c/The%252520Road.jpg",
+ "https://lh6.googleusercontent.com/-h-ALJt7kSus/URqvIThqYfI/AAAAAAAAAbs/ejiv35olWS8/s160-c/Tokyo%252520Heights.jpg",
+ "https://lh5.googleusercontent.com/-Hy9k-TbS7xg/URqvIjQMOxI/AAAAAAAAAbs/RSpmmOATSkg/s160-c/Tokyo%252520Highway.jpg",
+ "https://lh6.googleusercontent.com/-83oOvMb4OZs/URqvJL0T7lI/AAAAAAAAAbs/c5TECZ6RONM/s160-c/Tokyo%252520Smog.jpg",
+ "https://lh3.googleusercontent.com/-FB-jfgREEfI/URqvJI3EXAI/AAAAAAAAAbs/XfyweiRF4v8/s160-c/Tufa%252520at%252520Night.jpg",
+ "https://lh4.googleusercontent.com/-vngKD5Z1U8w/URqvJUCEgPI/AAAAAAAAAbs/ulxCMVcU6EU/s160-c/Valley%252520Sunset.jpg",
+ "https://lh6.googleusercontent.com/-DOz5I2E2oMQ/URqvKMND1kI/AAAAAAAAAbs/Iqf0IsInleo/s160-c/Windmill%252520Sunrise.jpg",
+ "https://lh5.googleusercontent.com/-biyiyWcJ9MU/URqvKculiAI/AAAAAAAAAbs/jyPsCplJOpE/s160-c/Windmill.jpg",
+ "https://lh4.googleusercontent.com/-PDT167_xRdA/URqvK36mLcI/AAAAAAAAAbs/oi2ik9QseMI/s160-c/Windmills.jpg",
+ "https://lh5.googleusercontent.com/-kI_QdYx7VlU/URqvLXCB6gI/AAAAAAAAAbs/N31vlZ6u89o/s160-c/Yet%252520Another%252520Rockaway%252520Sunset.jpg",
+ "https://lh4.googleusercontent.com/-e9NHZ5k5MSs/URqvMIBZjtI/AAAAAAAAAbs/1fV810rDNfQ/s160-c/Yosemite%252520Tree.jpg",
};
}
diff --git a/samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageCache.java b/samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageCache.java
index f567e76a3..1459c123b 100644
--- a/samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageCache.java
+++ b/samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageCache.java
@@ -16,12 +16,14 @@
package com.example.android.bitmapfun.util;
+import com.example.android.bitmapfun.BuildConfig;
+
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
-import android.graphics.drawable.BitmapDrawable;
import android.graphics.BitmapFactory;
+import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.os.Environment;
import android.os.StatFs;
@@ -30,17 +32,24 @@ import android.support.v4.app.FragmentManager;
import android.support.v4.util.LruCache;
import android.util.Log;
-import com.example.android.bitmapfun.BuildConfig;
-
import java.io.File;
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.lang.ref.SoftReference;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
+import java.util.HashSet;
+import java.util.Iterator;
/**
- * This class holds our bitmap caches (memory and disk).
+ * This class handles disk and memory caching of bitmaps in conjunction with the
+ * {@link ImageWorker} class and its subclasses. Use
+ * {@link ImageCache#getInstance(FragmentManager, ImageCacheParams)} to get an instance of this
+ * class, although usually a cache should be added directly to an {@link ImageWorker} by calling
+ * {@link ImageWorker#addImageCache(FragmentManager, ImageCacheParams)}.
*/
public class ImageCache {
private static final String TAG = "ImageCache";
@@ -59,7 +68,6 @@ public class ImageCache {
// Constants to easily toggle various caches
private static final boolean DEFAULT_MEM_CACHE_ENABLED = true;
private static final boolean DEFAULT_DISK_CACHE_ENABLED = true;
- private static final boolean DEFAULT_CLEAR_DISK_CACHE_ON_START = false;
private static final boolean DEFAULT_INIT_DISK_CACHE_ON_CREATE = false;
private DiskLruCache mDiskLruCache;
@@ -68,34 +76,29 @@ public class ImageCache {
private final Object mDiskCacheLock = new Object();
private boolean mDiskCacheStarting = true;
+ private HashSet<SoftReference<Bitmap>> mReusableBitmaps;
+
/**
- * Creating a new ImageCache object using the specified parameters.
+ * Create a new ImageCache object using the specified parameters. This should not be
+ * called directly by other classes, instead use
+ * {@link ImageCache#getInstance(FragmentManager, ImageCacheParams)} to fetch an ImageCache
+ * instance.
*
* @param cacheParams The cache parameters to use to initialize the cache
*/
- public ImageCache(ImageCacheParams cacheParams) {
+ private ImageCache(ImageCacheParams cacheParams) {
init(cacheParams);
}
/**
- * Creating a new ImageCache object using the default parameters.
- *
- * @param context The context to use
- * @param uniqueName A unique name that will be appended to the cache directory
- */
- public ImageCache(Context context, String uniqueName) {
- init(new ImageCacheParams(context, uniqueName));
- }
-
- /**
- * Find and return an existing ImageCache stored in a {@link RetainFragment}, if not found a new
- * one is created using the supplied params and saved to a {@link RetainFragment}.
+ * Return an {@link ImageCache} instance. A {@link RetainFragment} is used to retain the
+ * ImageCache object across configuration changes such as a change in device orientation.
*
* @param fragmentManager The fragment manager to use when dealing with the retained fragment.
- * @param cacheParams The cache parameters to use if creating the ImageCache
+ * @param cacheParams The cache parameters to use if the ImageCache needs instantiation.
* @return An existing retained ImageCache object or a new one if one did not exist
*/
- public static ImageCache findOrCreateCache(
+ public static ImageCache getInstance(
FragmentManager fragmentManager, ImageCacheParams cacheParams) {
// Search for, or create an instance of the non-UI RetainFragment
@@ -126,6 +129,12 @@ public class ImageCache {
if (BuildConfig.DEBUG) {
Log.d(TAG, "Memory cache created (size = " + mCacheParams.memCacheSize + ")");
}
+
+ // If we're running on Honeycomb or newer, then
+ if (Utils.hasHoneycomb()) {
+ mReusableBitmaps = new HashSet<SoftReference<Bitmap>>();
+ }
+
mMemoryCache = new LruCache<String, BitmapDrawable>(mCacheParams.memCacheSize) {
/**
@@ -138,6 +147,14 @@ public class ImageCache {
// The removed entry is a recycling drawable, so notify it
// that it has been removed from the memory cache
((RecyclingBitmapDrawable) oldValue).setIsCached(false);
+ } else {
+ // The removed entry is a standard BitmapDrawable
+
+ if (Utils.hasHoneycomb()) {
+ // We're running on Honeycomb or later, so add the bitmap
+ // to a SoftRefrence set for possible use with inBitmap later
+ mReusableBitmaps.add(new SoftReference<Bitmap>(oldValue.getBitmap()));
+ }
}
}
@@ -277,6 +294,8 @@ public class ImageCache {
*/
public Bitmap getBitmapFromDiskCache(String data) {
final String key = hashKeyForDisk(data);
+ Bitmap bitmap = null;
+
synchronized (mDiskCacheLock) {
while (mDiskCacheStarting) {
try {
@@ -293,8 +312,12 @@ public class ImageCache {
}
inputStream = snapshot.getInputStream(DISK_CACHE_INDEX);
if (inputStream != null) {
- final Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
- return bitmap;
+ FileDescriptor fd = ((FileInputStream) inputStream).getFD();
+
+ // Decode bitmap, but we don't want to sample so give
+ // MAX_VALUE as the target dimensions
+ bitmap = ImageResizer.decodeSampledBitmapFromDescriptor(
+ fd, Integer.MAX_VALUE, Integer.MAX_VALUE, this);
}
}
} catch (final IOException e) {
@@ -307,11 +330,44 @@ public class ImageCache {
} catch (IOException e) {}
}
}
- return null;
+ return bitmap;
}
}
/**
+ * @param options - BitmapFactory.Options with out* options populated
+ * @return Bitmap that case be used for inBitmap
+ */
+ protected Bitmap getBitmapFromReusableSet(BitmapFactory.Options options) {
+ Bitmap bitmap = null;
+
+ if (mReusableBitmaps != null && !mReusableBitmaps.isEmpty()) {
+ final Iterator<SoftReference<Bitmap>> iterator = mReusableBitmaps.iterator();
+ Bitmap item;
+
+ while (iterator.hasNext()) {
+ item = iterator.next().get();
+
+ if (null != item && item.isMutable()) {
+ // Check to see it the item can be used for inBitmap
+ if (canUseForInBitmap(item, options)) {
+ bitmap = item;
+
+ // Remove from reusable set so it can't be used again
+ iterator.remove();
+ break;
+ }
+ } else {
+ // Remove from the set if the reference has been cleared.
+ iterator.remove();
+ }
+ }
+ }
+
+ return bitmap;
+ }
+
+ /**
* Clears both the memory and disk cache associated with this ImageCache object. Note that
* this includes disk access so this should not be executed on the main/UI thread.
*/
@@ -392,15 +448,19 @@ public class ImageCache {
public int compressQuality = DEFAULT_COMPRESS_QUALITY;
public boolean memoryCacheEnabled = DEFAULT_MEM_CACHE_ENABLED;
public boolean diskCacheEnabled = DEFAULT_DISK_CACHE_ENABLED;
- public boolean clearDiskCacheOnStart = DEFAULT_CLEAR_DISK_CACHE_ON_START;
public boolean initDiskCacheOnCreate = DEFAULT_INIT_DISK_CACHE_ON_CREATE;
- public ImageCacheParams(Context context, String uniqueName) {
- diskCacheDir = getDiskCacheDir(context, uniqueName);
- }
-
- public ImageCacheParams(File diskCacheDir) {
- this.diskCacheDir = diskCacheDir;
+ /**
+ * Create a set of image cache parameters that can be provided to
+ * {@link ImageCache#getInstance(FragmentManager, ImageCacheParams)} or
+ * {@link ImageWorker#addImageCache(FragmentManager, ImageCacheParams)}.
+ * @param context A context to use.
+ * @param diskCacheDirectoryName A unique subdirectory name that will be appended to the
+ * application cache directory. Usually "cache" or "images"
+ * is sufficient.
+ */
+ public ImageCacheParams(Context context, String diskCacheDirectoryName) {
+ diskCacheDir = getDiskCacheDir(context, diskCacheDirectoryName);
}
/**
@@ -426,6 +486,20 @@ public class ImageCache {
}
/**
+ * @param candidate - Bitmap to check
+ * @param targetOptions - Options that have the out* value populated
+ * @return true if <code>candidate</code> can be used for inBitmap re-use with
+ * <code>targetOptions</code>
+ */
+ private static boolean canUseForInBitmap(
+ Bitmap candidate, BitmapFactory.Options targetOptions) {
+ int width = targetOptions.outWidth / targetOptions.inSampleSize;
+ int height = targetOptions.outHeight / targetOptions.inSampleSize;
+
+ return candidate.getWidth() == width && candidate.getHeight() == height;
+ }
+
+ /**
* Get a usable cache directory (external if available, internal otherwise).
*
* @param context The context to use
@@ -542,7 +616,7 @@ public class ImageCache {
* @return The existing instance of the Fragment or the new instance if just
* created.
*/
- public static RetainFragment findOrCreateRetainFragment(FragmentManager fm) {
+ private static RetainFragment findOrCreateRetainFragment(FragmentManager fm) {
// Check to see if we have retained the worker fragment.
RetainFragment mRetainFragment = (RetainFragment) fm.findFragmentByTag(TAG);
diff --git a/samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageFetcher.java b/samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageFetcher.java
index 708484530..4c92d7417 100644
--- a/samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageFetcher.java
+++ b/samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageFetcher.java
@@ -241,7 +241,8 @@ public class ImageFetcher extends ImageResizer {
Bitmap bitmap = null;
if (fileDescriptor != null) {
- bitmap = decodeSampledBitmapFromDescriptor(fileDescriptor, mImageWidth, mImageHeight);
+ bitmap = decodeSampledBitmapFromDescriptor(fileDescriptor, mImageWidth,
+ mImageHeight, getImageCache());
}
if (fileInputStream != null) {
try {
diff --git a/samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageResizer.java b/samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageResizer.java
index 6a129c318..2a9d152d1 100644
--- a/samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageResizer.java
+++ b/samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageResizer.java
@@ -16,10 +16,12 @@
package com.example.android.bitmapfun.util;
+import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
+import android.os.Build;
import android.util.Log;
import com.example.android.bitmapfun.BuildConfig;
@@ -90,7 +92,8 @@ public class ImageResizer extends ImageWorker {
if (BuildConfig.DEBUG) {
Log.d(TAG, "processBitmap - " + resId);
}
- return decodeSampledBitmapFromResource(mResources, resId, mImageWidth, mImageHeight);
+ return decodeSampledBitmapFromResource(mResources, resId, mImageWidth,
+ mImageHeight, getImageCache());
}
@Override
@@ -105,11 +108,12 @@ public class ImageResizer extends ImageWorker {
* @param resId The resource id of the image data
* @param reqWidth The requested width of the resulting bitmap
* @param reqHeight The requested height of the resulting bitmap
+ * @param cache The ImageCache used to find candidate bitmaps for use with inBitmap
* @return A bitmap sampled down from the original with the same aspect ratio and dimensions
* that are equal to or greater than the requested width and height
*/
public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId,
- int reqWidth, int reqHeight) {
+ int reqWidth, int reqHeight, ImageCache cache) {
// First decode with inJustDecodeBounds=true to check dimensions
final BitmapFactory.Options options = new BitmapFactory.Options();
@@ -119,6 +123,11 @@ public class ImageResizer extends ImageWorker {
// Calculate inSampleSize
options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
+ // If we're running on Honeycomb or newer, try to use inBitmap
+ if (Utils.hasHoneycomb()) {
+ addInBitmapOptions(options, cache);
+ }
+
// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;
return BitmapFactory.decodeResource(res, resId, options);
@@ -130,11 +139,12 @@ public class ImageResizer extends ImageWorker {
* @param filename The full path of the file to decode
* @param reqWidth The requested width of the resulting bitmap
* @param reqHeight The requested height of the resulting bitmap
+ * @param cache The ImageCache used to find candidate bitmaps for use with inBitmap
* @return A bitmap sampled down from the original with the same aspect ratio and dimensions
* that are equal to or greater than the requested width and height
*/
public static Bitmap decodeSampledBitmapFromFile(String filename,
- int reqWidth, int reqHeight) {
+ int reqWidth, int reqHeight, ImageCache cache) {
// First decode with inJustDecodeBounds=true to check dimensions
final BitmapFactory.Options options = new BitmapFactory.Options();
@@ -144,6 +154,11 @@ public class ImageResizer extends ImageWorker {
// Calculate inSampleSize
options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
+ // If we're running on Honeycomb or newer, try to use inBitmap
+ if (Utils.hasHoneycomb()) {
+ addInBitmapOptions(options, cache);
+ }
+
// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;
return BitmapFactory.decodeFile(filename, options);
@@ -155,11 +170,12 @@ public class ImageResizer extends ImageWorker {
* @param fileDescriptor The file descriptor to read from
* @param reqWidth The requested width of the resulting bitmap
* @param reqHeight The requested height of the resulting bitmap
+ * @param cache The ImageCache used to find candidate bitmaps for use with inBitmap
* @return A bitmap sampled down from the original with the same aspect ratio and dimensions
* that are equal to or greater than the requested width and height
*/
public static Bitmap decodeSampledBitmapFromDescriptor(
- FileDescriptor fileDescriptor, int reqWidth, int reqHeight) {
+ FileDescriptor fileDescriptor, int reqWidth, int reqHeight, ImageCache cache) {
// First decode with inJustDecodeBounds=true to check dimensions
final BitmapFactory.Options options = new BitmapFactory.Options();
@@ -171,9 +187,34 @@ public class ImageResizer extends ImageWorker {
// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;
+
+ // If we're running on Honeycomb or newer, try to use inBitmap
+ if (Utils.hasHoneycomb()) {
+ addInBitmapOptions(options, cache);
+ }
+
return BitmapFactory.decodeFileDescriptor(fileDescriptor, null, options);
}
+ @TargetApi(Build.VERSION_CODES.HONEYCOMB)
+ private static void addInBitmapOptions(BitmapFactory.Options options, ImageCache cache) {
+ // inBitmap only works with mutable bitmaps so force the decoder to
+ // return mutable bitmaps.
+ options.inMutable = true;
+
+ if (cache != null) {
+ // Try and find a bitmap to use for inBitmap
+ Bitmap inBitmap = cache.getBitmapFromReusableSet(options);
+
+ if (inBitmap != null) {
+ if (BuildConfig.DEBUG) {
+ Log.d(TAG, "Found bitmap to use for inBitmap");
+ }
+ options.inBitmap = inBitmap;
+ }
+ }
+ }
+
/**
* Calculate an inSampleSize for use in a {@link BitmapFactory.Options} object when decoding
* bitmaps using the decode* methods from {@link BitmapFactory}. This implementation calculates
diff --git a/samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageWorker.java b/samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageWorker.java
index 84a0f5981..d26066011 100644
--- a/samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageWorker.java
+++ b/samples/training/bitmapfun/src/com/example/android/bitmapfun/util/ImageWorker.java
@@ -16,6 +16,8 @@
package com.example.android.bitmapfun.util;
+import com.example.android.bitmapfun.BuildConfig;
+
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
@@ -24,12 +26,11 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.TransitionDrawable;
+import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.util.Log;
import android.widget.ImageView;
-import com.example.android.bitmapfun.BuildConfig;
-
import java.lang.ref.WeakReference;
/**
@@ -62,11 +63,11 @@ public abstract class ImageWorker {
/**
* Load an image specified by the data parameter into an ImageView (override
- * {@link ImageWorker#processBitmap(Object)} to define the processing logic). A memory and disk
- * cache will be used if an {@link ImageCache} has been set using
- * {@link ImageWorker#setImageCache(ImageCache)}. If the image is found in the memory cache, it
- * is set immediately, otherwise an {@link AsyncTask} will be created to asynchronously load the
- * bitmap.
+ * {@link ImageWorker#processBitmap(Object)} to define the processing logic). A memory and
+ * disk cache will be used if an {@link ImageCache} has been added using
+ * {@link ImageWorker#addImageCache(FragmentManager, ImageCache.ImageCacheParams)}. If the
+ * image is found in the memory cache, it is set immediately, otherwise an {@link AsyncTask}
+ * will be created to asynchronously load the bitmap.
*
* @param data The URL of the image to download.
* @param imageView The ImageView to bind the downloaded image to.
@@ -117,28 +118,29 @@ public abstract class ImageWorker {
}
/**
- * Adds an {@link ImageCache} to this worker in the background (to prevent disk access on UI
- * thread).
+ * Adds an {@link ImageCache} to this {@link ImageWorker} to handle disk and memory bitmap
+ * caching.
* @param fragmentManager
- * @param cacheParams
+ * @param cacheParams The cache parameters to use for the image cache.
*/
public void addImageCache(FragmentManager fragmentManager,
ImageCache.ImageCacheParams cacheParams) {
mImageCacheParams = cacheParams;
- setImageCache(ImageCache.findOrCreateCache(fragmentManager, mImageCacheParams));
+ mImageCache = ImageCache.getInstance(fragmentManager, mImageCacheParams);
new CacheAsyncTask().execute(MESSAGE_INIT_DISK_CACHE);
}
/**
- * Sets the {@link ImageCache} object to use with this ImageWorker. Usually you will not need
- * to call this directly, instead use {@link ImageWorker#addImageCache} which will create and
- * add the {@link ImageCache} object in a background thread (to ensure no disk access on the
- * main/UI thread).
- *
- * @param imageCache
+ * Adds an {@link ImageCache} to this {@link ImageWorker} to handle disk and memory bitmap
+ * caching.
+ * @param activity
+ * @param diskCacheDirectoryName See
+ * {@link ImageCache.ImageCacheParams#ImageCacheParams(Context, String)}.
*/
- public void setImageCache(ImageCache imageCache) {
- mImageCache = imageCache;
+ public void addImageCache(FragmentActivity activity, String diskCacheDirectoryName) {
+ mImageCacheParams = new ImageCache.ImageCacheParams(activity, diskCacheDirectoryName);
+ mImageCache = ImageCache.getInstance(activity.getSupportFragmentManager(), mImageCacheParams);
+ new CacheAsyncTask().execute(MESSAGE_INIT_DISK_CACHE);
}
/**
@@ -165,6 +167,13 @@ public abstract class ImageWorker {
protected abstract Bitmap processBitmap(Object data);
/**
+ * @return The {@link ImageCache} object currently being used by this ImageWorker.
+ */
+ protected ImageCache getImageCache() {
+ return mImageCache;
+ }
+
+ /**
* Cancels any pending work attached to the provided ImageView.
* @param imageView
*/
diff --git a/scripts/app_engine_server/memcache_zipserve.py b/scripts/app_engine_server/memcache_zipserve.py
index 68aa0dd32..dfd7de9d0 100644
--- a/scripts/app_engine_server/memcache_zipserve.py
+++ b/scripts/app_engine_server/memcache_zipserve.py
@@ -110,7 +110,7 @@ class MemcachedZipHandler(webapp.RequestHandler):
REDIRECT_TYPE_TEMP = 'temporary' # Redirect 'type'string indicate a 302
# Redirect should be served
intlString = 'intl/'
- validLangs = ['en', 'de', 'es', 'fr','it','ja','ko','ru','zh-CN','zh-TW']
+ validLangs = ['en', 'de', 'es', 'fr','it','ja','ko','ru','zh-CN','zh-cn','zh-TW','zh-tw']
def TrueGet(self, reqUri):
"""The top-level entry point to serving requests.
diff --git a/scripts/app_engine_server/redirects.yaml b/scripts/app_engine_server/redirects.yaml
index b7c28f268..7cb63792e 100644
--- a/scripts/app_engine_server/redirects.yaml
+++ b/scripts/app_engine_server/redirects.yaml
@@ -58,6 +58,14 @@ redirects:
type: permanent
comment: Redirect sdk reference to new location
+- src: /about/versions/index.html
+ dst: /about/index.html
+ type: permanent
+
+- src: /about/versions/api-levels.html
+ dst: /guide/topics/manifest/uses-sdk-element.html#ApiLevels
+ type: permanent
+
# new one works
- src: /sdk/oem-usb.html
dst: /tools/extras/oem-usb.html
@@ -93,12 +101,27 @@ redirects:
type: permanent
comment: Redirect sdk reference to new location
-#new one works
+- src: /sdk/ndk/overview.html
+ dst: /tools/sdk/ndk/index.html
+ type: permanent
+
- src: /sdk/ndk/
dst: /tools/sdk/ndk/
type: permanent
comment: Redirect sdk reference to new location
+- src: /tools/sdk/win-usb.html
+ dst: /sdk/win-usb.html
+ type: permanent
+
+- src: /tools/sdk/index.html
+ dst: /sdk/index.html
+ type: permanent
+
+- src: /tools/sdk/installing.html
+ dst: /sdk/installing/bundle.html
+ type: permanent
+
#new one works
- src: /sdk/requirements.html
dst: /sdk/index.html
@@ -226,6 +249,26 @@ redirects:
dst: /tools/adk/index.html
type: permanent
+- src: /tools/workflow/publishing/versioning.html
+ dst: /tools/publishing/versioning.html
+ type: permanent
+
+- src: /tools/workflow/publishing/publishing.html
+ dst: /tools/publishing/publishing_overview.html
+ type: permanent
+
+- src: /tools/workflow/publishing_overview.html
+ dst: /tools/publishing/publishing_overview.html
+ type: permanent
+
+- src: /tools/workflow/publishing/publishing_overview.html
+ dst: /tools/publishing/publishing_overview.html
+ type: permanent
+
+- src: /tools/workflow/app-signing.html
+ dst: /tools/publishing/app-signing.html
+ type: permanent
+
- src: /tools/adk/aoa.html
dst: http://source.android.com/tech/accessories/aoap/aoa.html
type: permanent
@@ -253,7 +296,7 @@ redirects:
comment: Redirect to new location
# new one
-- src: /guide/basics/what-is-android.html
+- src: /guide/basics/.*
dst: /about/index.html
type: permanent
comment: Redirect to new location
@@ -263,6 +306,11 @@ redirects:
type: permanent
comment: Redirect to new location
+- src: /guide/topics/security/index.html
+ dst: /training/articles/security-tips.html
+ type: permanent
+ comment: Redirect to new location
+
# new one
- src: /guide/appendix/market-filters.html
dst: /google/play/filters.html
@@ -376,6 +424,23 @@ redirects:
dst: /training/articles/perf-jni.html
type: permanent
+# move ui docs to design
+
+- src: /guide/practices/ui_guidelines/index.html
+ dst: /design/index.html
+ type: permanent
+
+- src: /guide/practices/ui_guidelines/icon_design.*
+ dst: /design/style/iconography.html
+ type: permanent
+
+- src: /guide/practices/ui_guidelines/activity_task_design.html
+ dst: /design/patterns/app-structure.html
+ type: permanent
+
+- src: /guide/practices/ui_guidelines/menu_design.html
+ dst: /design/patterns/actionbar.html
+ type: permanent
# new one
@@ -496,6 +561,9 @@ redirects:
type: permanent
comment: Syncing with App Engine was removed because it's obsolete.
+- src: /training/basics/location/
+ dst: /training/location/
+ type: permanent
# -------------------- MISC ----------------------
@@ -524,9 +592,13 @@ redirects:
type: permanent
comment: Redirect to new location
+- src: /intl/zh-CN/...
+ dst: /intl/zh-cn/...
+ type: permanent
-
-
+- src: /intl/zh-TW/...
+ dst: /intl/zh-tw/...
+ type: permanent
# -------------------- EASTER EGG REDIRECTS ----------------------
@@ -583,10 +655,22 @@ redirects:
dst: http://www.youtube.com/user/androiddevelopers
type: permanent
-- src: /playbadge
+- src: /playbadge/?$
dst: http://developer.android.com/distribute/googleplay/promote/badges.html
type: permanent
-- src: /deviceart
+- src: /deviceart/?$
dst: http://developer.android.com/distribute/promote/device-art.html
type: permanent
+
+- src: /edu/signup/?$
+ dst: https://services.google.com/fb/forms/playedu
+ type: permanent
+
+- src: /edu/?$
+ dst: /distribute/googleplay/edu/index.html
+ type: permanent
+
+- src: /edu/signup
+ dst: https://services.google.com/fb/forms/playedu
+ type: permanent
diff --git a/scripts/symbol.py b/scripts/symbol.py
index e36304c4c..b0e94d825 100755
--- a/scripts/symbol.py
+++ b/scripts/symbol.py
@@ -46,7 +46,7 @@ def ToolPath(tool, toolchain_info=None):
if not toolchain_info:
toolchain_info = TOOLCHAIN_INFO
(label, target) = toolchain_info
- return os.path.join(ANDROID_BUILD_TOP, "prebuilt", Uname(), "toolchain", label, "bin",
+ return os.path.join(ANDROID_BUILD_TOP, "prebuilts", "gcc", Uname(), "arm", label, "bin",
target + "-" + tool)
def FindToolchain():
@@ -61,6 +61,7 @@ def FindToolchain():
## Known toolchains, newer ones in the front.
known_toolchains = [
+ ("arm-eabi-4.6", "arm-eabi"),
("arm-linux-androideabi-4.4.x", "arm-linux-androideabi"),
("arm-eabi-4.4.3", "arm-eabi"),
("arm-eabi-4.4.0", "arm-eabi"),
diff --git a/sdk/api-versions.xml b/sdk/api-versions.xml
index 70e658453..4ce952f86 100644
--- a/sdk/api-versions.xml
+++ b/sdk/api-versions.xml
@@ -24,6 +24,7 @@
<field name="BIND_APPWIDGET" since="3" />
<field name="BIND_DEVICE_ADMIN" since="8" />
<field name="BIND_INPUT_METHOD" since="3" />
+ <field name="BIND_NOTIFICATION_LISTENER_SERVICE" since="18" />
<field name="BIND_REMOTEVIEWS" since="11" />
<field name="BIND_TEXT_SERVICE" since="14" />
<field name="BIND_VPN_SERVICE" since="14" />
@@ -60,6 +61,7 @@
<field name="GET_ACCOUNTS" />
<field name="GET_PACKAGE_SIZE" />
<field name="GET_TASKS" />
+ <field name="GET_TOP_ACTIVITY_INFO" since="18" />
<field name="GLOBAL_SEARCH" since="4" />
<field name="HARDWARE_TEST" />
<field name="INJECT_EVENTS" />
@@ -68,6 +70,7 @@
<field name="INTERNAL_SYSTEM_WINDOW" />
<field name="INTERNET" />
<field name="KILL_BACKGROUND_PROCESSES" since="8" />
+ <field name="LOCATION_HARDWARE" since="18" />
<field name="MANAGE_ACCOUNTS" since="5" />
<field name="MANAGE_APP_TOKENS" />
<field name="MASTER_CLEAR" />
@@ -102,6 +105,7 @@
<field name="RECORD_AUDIO" />
<field name="REORDER_TASKS" />
<field name="RESTART_PACKAGES" />
+ <field name="SEND_RESPOND_VIA_MESSAGE" since="18" />
<field name="SEND_SMS" />
<field name="SET_ACTIVITY_WATCHER" />
<field name="SET_ALARM" since="9" />
@@ -146,6 +150,7 @@
<class name="android/Manifest$permission_group" since="1">
<extends name="java/lang/Object" />
<method name="&lt;init>()V" />
+ <field name="ACCESSIBILITY_FEATURES" since="18" />
<field name="ACCOUNTS" />
<field name="AFFECTS_BATTERY" since="17" />
<field name="APP_INFO" since="17" />
@@ -321,6 +326,9 @@
<field name="cacheColorHint" />
<field name="calendarViewShown" since="11" />
<field name="calendarViewStyle" since="11" />
+ <field name="canRequestEnhancedWebAccessibility" since="18" />
+ <field name="canRequestFilterKeyEvents" since="18" />
+ <field name="canRequestTouchExplorationMode" since="18" />
<field name="canRetrieveWindowContent" since="14" />
<field name="candidatesTextStyleSpans" since="3" />
<field name="capitalize" />
@@ -340,8 +348,10 @@
<field name="checkedTextViewStyle" since="17" />
<field name="childDivider" />
<field name="childIndicator" />
+ <field name="childIndicatorEnd" since="18" />
<field name="childIndicatorLeft" />
<field name="childIndicatorRight" />
+ <field name="childIndicatorStart" since="18" />
<field name="choiceMode" />
<field name="clearTaskOnLaunch" />
<field name="clickable" />
@@ -575,8 +585,10 @@
<field name="indeterminateDuration" />
<field name="indeterminateOnly" />
<field name="indeterminateProgressStyle" since="11" />
+ <field name="indicatorEnd" since="18" />
<field name="indicatorLeft" />
<field name="indicatorRight" />
+ <field name="indicatorStart" since="18" />
<field name="inflatedId" />
<field name="initOrder" />
<field name="initialKeyguardLayout" since="17" />
@@ -633,6 +645,7 @@
<field name="layout" />
<field name="layoutAnimation" />
<field name="layoutDirection" since="17" />
+ <field name="layoutMode" since="18" />
<field name="layout_above" />
<field name="layout_alignBaseline" />
<field name="layout_alignBottom" />
@@ -729,6 +742,8 @@
<field name="minResizeWidth" since="14" />
<field name="minSdkVersion" />
<field name="minWidth" />
+ <field name="mipMap" since="18" />
+ <field name="mirrorForRtl" since="18" />
<field name="mode" />
<field name="moreIcon" />
<field name="multiprocess" />
@@ -845,6 +860,8 @@
<field name="reqNavigation" since="3" />
<field name="reqTouchScreen" since="3" />
<field name="required" since="5" />
+ <field name="requiredAccountType" since="18" />
+ <field name="requiredForAllUsers" since="18" />
<field name="requiresFadingEdge" since="14" />
<field name="requiresSmallestWidthDp" since="13" />
<field name="resizeMode" since="12" />
@@ -852,6 +869,7 @@
<field name="resource" />
<field name="restoreAnyVersion" since="8" />
<field name="restoreNeedsApplication" since="5" />
+ <field name="restrictedAccountType" since="18" />
<field name="right" />
<field name="ringtonePreferenceStyle" />
<field name="ringtoneType" />
@@ -1173,6 +1191,7 @@
<field name="windowMinWidthMinor" since="11" />
<field name="windowNoDisplay" since="3" />
<field name="windowNoTitle" />
+ <field name="windowOverscan" since="18" />
<field name="windowShowAnimation" />
<field name="windowShowWallpaper" since="5" />
<field name="windowSoftInputMode" since="3" />
@@ -1710,9 +1729,11 @@
<field name="Theme_DeviceDefault_Light_Dialog_NoActionBar_MinWidth" since="14" />
<field name="Theme_DeviceDefault_Light_NoActionBar" since="14" />
<field name="Theme_DeviceDefault_Light_NoActionBar_Fullscreen" since="14" />
+ <field name="Theme_DeviceDefault_Light_NoActionBar_Overscan" since="18" />
<field name="Theme_DeviceDefault_Light_Panel" since="14" />
<field name="Theme_DeviceDefault_NoActionBar" since="14" />
<field name="Theme_DeviceDefault_NoActionBar_Fullscreen" since="14" />
+ <field name="Theme_DeviceDefault_NoActionBar_Overscan" since="18" />
<field name="Theme_DeviceDefault_Panel" since="14" />
<field name="Theme_DeviceDefault_Wallpaper" since="14" />
<field name="Theme_DeviceDefault_Wallpaper_NoTitleBar" since="14" />
@@ -1735,9 +1756,11 @@
<field name="Theme_Holo_Light_Dialog_NoActionBar_MinWidth" since="11" />
<field name="Theme_Holo_Light_NoActionBar" since="13" />
<field name="Theme_Holo_Light_NoActionBar_Fullscreen" since="13" />
+ <field name="Theme_Holo_Light_NoActionBar_Overscan" since="18" />
<field name="Theme_Holo_Light_Panel" since="11" />
<field name="Theme_Holo_NoActionBar" since="11" />
<field name="Theme_Holo_NoActionBar_Fullscreen" since="11" />
+ <field name="Theme_Holo_NoActionBar_Overscan" since="18" />
<field name="Theme_Holo_Panel" since="11" />
<field name="Theme_Holo_Wallpaper" since="11" />
<field name="Theme_Holo_Wallpaper_NoTitleBar" since="11" />
@@ -2053,6 +2076,7 @@
<method name="onAccessibilityEvent(Landroid/view/accessibility/AccessibilityEvent;)V" />
<method name="onGesture(I)Z" since="16" />
<method name="onInterrupt()V" />
+ <method name="onKeyEvent(Landroid/view/KeyEvent;)Z" since="18" />
<method name="onServiceConnected()V" />
<method name="performGlobalAction(I)Z" since="16" />
<method name="setServiceInfo(Landroid/accessibilityservice/AccessibilityServiceInfo;)V" />
@@ -2084,14 +2108,20 @@
<extends name="java/lang/Object" />
<implements name="android/os/Parcelable" />
<method name="&lt;init>()V" />
+ <method name="capabilityToString(I)Ljava/lang/String;" since="18" />
<method name="feedbackTypeToString(I)Ljava/lang/String;" since="14" />
<method name="flagToString(I)Ljava/lang/String;" since="14" />
<method name="getCanRetrieveWindowContent()Z" since="14" />
+ <method name="getCapabilities()I" since="18" />
<method name="getDescription()Ljava/lang/String;" since="14" />
<method name="getId()Ljava/lang/String;" since="14" />
<method name="getResolveInfo()Landroid/content/pm/ResolveInfo;" since="14" />
<method name="getSettingsActivityName()Ljava/lang/String;" since="14" />
<method name="loadDescription(Landroid/content/pm/PackageManager;)Ljava/lang/String;" since="16" />
+ <field name="CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY" since="18" />
+ <field name="CAPABILITY_CAN_REQUEST_FILTER_KEY_EVENTS" since="18" />
+ <field name="CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION" since="18" />
+ <field name="CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT" since="18" />
<field name="CREATOR" />
<field name="DEFAULT" />
<field name="FEEDBACK_ALL_MASK" since="14" />
@@ -2102,6 +2132,9 @@
<field name="FEEDBACK_SPOKEN" />
<field name="FEEDBACK_VISUAL" />
<field name="FLAG_INCLUDE_NOT_IMPORTANT_VIEWS" since="16" />
+ <field name="FLAG_REPORT_VIEW_IDS" since="18" />
+ <field name="FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY" since="18" />
+ <field name="FLAG_REQUEST_FILTER_KEY_EVENTS" since="18" />
<field name="FLAG_REQUEST_TOUCH_EXPLORATION_MODE" since="16" />
<field name="eventTypes" />
<field name="feedbackType" />
@@ -2113,8 +2146,10 @@
<extends name="java/lang/Object" />
<method name="&lt;init>(Landroid/content/Context;)V" />
<method name="addAccount(Landroid/accounts/AccountAuthenticatorResponse;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Landroid/os/Bundle;)Landroid/os/Bundle;" />
+ <method name="addAccountFromCredentials(Landroid/accounts/AccountAuthenticatorResponse;Landroid/accounts/Account;Landroid/os/Bundle;)Landroid/os/Bundle;" since="18" />
<method name="confirmCredentials(Landroid/accounts/AccountAuthenticatorResponse;Landroid/accounts/Account;Landroid/os/Bundle;)Landroid/os/Bundle;" />
<method name="editProperties(Landroid/accounts/AccountAuthenticatorResponse;Ljava/lang/String;)Landroid/os/Bundle;" />
+ <method name="getAccountCredentialsForCloning(Landroid/accounts/AccountAuthenticatorResponse;Landroid/accounts/Account;)Landroid/os/Bundle;" since="18" />
<method name="getAccountRemovalAllowed(Landroid/accounts/AccountAuthenticatorResponse;Landroid/accounts/Account;)Landroid/os/Bundle;" />
<method name="getAuthToken(Landroid/accounts/AccountAuthenticatorResponse;Landroid/accounts/Account;Ljava/lang/String;Landroid/os/Bundle;)Landroid/os/Bundle;" />
<method name="getAuthTokenLabel(Ljava/lang/String;)Ljava/lang/String;" />
@@ -2159,6 +2194,7 @@
<method name="getAccounts()[Landroid/accounts/Account;" />
<method name="getAccountsByType(Ljava/lang/String;)[Landroid/accounts/Account;" />
<method name="getAccountsByTypeAndFeatures(Ljava/lang/String;[Ljava/lang/String;Landroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;" />
+ <method name="getAccountsByTypeForPackage(Ljava/lang/String;Ljava/lang/String;)[Landroid/accounts/Account;" since="18" />
<method name="getAuthToken(Landroid/accounts/Account;Ljava/lang/String;Landroid/os/Bundle;Landroid/app/Activity;Landroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;" />
<method name="getAuthToken(Landroid/accounts/Account;Ljava/lang/String;Landroid/os/Bundle;ZLandroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;" since="14" />
<method name="getAuthToken(Landroid/accounts/Account;Ljava/lang/String;ZLandroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;" />
@@ -2180,6 +2216,7 @@
<field name="AUTHENTICATOR_ATTRIBUTES_NAME" />
<field name="AUTHENTICATOR_META_DATA_NAME" />
<field name="ERROR_CODE_BAD_ARGUMENTS" />
+ <field name="ERROR_CODE_BAD_AUTHENTICATION" since="18" />
<field name="ERROR_CODE_BAD_REQUEST" />
<field name="ERROR_CODE_CANCELED" />
<field name="ERROR_CODE_INVALID_RESPONSE" />
@@ -2265,6 +2302,15 @@
<method name="&lt;init>(Ljava/lang/String;Ljava/lang/Throwable;)V" />
<method name="&lt;init>(Ljava/lang/Throwable;)V" />
</class>
+ <class name="android/animation/Animatable" since="18">
+ <extends name="java/lang/Object" />
+ <method name="getDuration()J" />
+ <method name="getInterpolator()Landroid/animation/TimeInterpolator;" />
+ <method name="getStartDelay()J" />
+ <method name="setDuration(J)Landroid/animation/Animatable;" />
+ <method name="setInterpolator(Landroid/animation/TimeInterpolator;)V" />
+ <method name="setStartDelay(J)V" />
+ </class>
<class name="android/animation/Animator" since="11">
<extends name="java/lang/Object" />
<implements name="java/lang/Cloneable" />
@@ -2274,6 +2320,7 @@
<method name="clone()Landroid/animation/Animator;" />
<method name="end()V" />
<method name="getDuration()J" />
+ <method name="getInterpolator()Landroid/animation/TimeInterpolator;" since="18" />
<method name="getListeners()Ljava/util/ArrayList;" />
<method name="getStartDelay()J" />
<method name="isRunning()Z" />
@@ -2415,6 +2462,7 @@
<method name="ofObject(Ljava/lang/Object;Landroid/util/Property;Landroid/animation/TypeEvaluator;[Ljava/lang/Object;)Landroid/animation/ObjectAnimator;" since="14" />
<method name="ofObject(Ljava/lang/Object;Ljava/lang/String;Landroid/animation/TypeEvaluator;[Ljava/lang/Object;)Landroid/animation/ObjectAnimator;" />
<method name="ofPropertyValuesHolder(Ljava/lang/Object;[Landroid/animation/PropertyValuesHolder;)Landroid/animation/ObjectAnimator;" />
+ <method name="setAutoCancel(Z)V" since="18" />
<method name="setDuration(J)Landroid/animation/ObjectAnimator;" />
<method name="setProperty(Landroid/util/Property;)V" since="14" />
<method name="setPropertyName(Ljava/lang/String;)V" />
@@ -2441,6 +2489,12 @@
<method name="setProperty(Landroid/util/Property;)V" since="14" />
<method name="setPropertyName(Ljava/lang/String;)V" />
</class>
+ <class name="android/animation/RectEvaluator" since="18">
+ <extends name="java/lang/Object" />
+ <implements name="android/animation/TypeEvaluator" />
+ <method name="&lt;init>()V" />
+ <method name="evaluate(FLandroid/graphics/Rect;Landroid/graphics/Rect;)Landroid/graphics/Rect;" />
+ </class>
<class name="android/animation/TimeAnimator" since="16">
<extends name="android/animation/ValueAnimator" />
<method name="&lt;init>()V" />
@@ -2546,6 +2600,10 @@
<method name="setDisplayShowHomeEnabled(Z)V" />
<method name="setDisplayShowTitleEnabled(Z)V" />
<method name="setDisplayUseLogoEnabled(Z)V" />
+ <method name="setHomeActionContentDescription(I)V" since="18" />
+ <method name="setHomeActionContentDescription(Ljava/lang/CharSequence;)V" since="18" />
+ <method name="setHomeAsUpIndicator(I)V" since="18" />
+ <method name="setHomeAsUpIndicator(Landroid/graphics/drawable/Drawable;)V" since="18" />
<method name="setHomeButtonEnabled(Z)V" since="14" />
<method name="setIcon(I)V" since="14" />
<method name="setIcon(Landroid/graphics/drawable/Drawable;)V" since="14" />
@@ -2669,6 +2727,7 @@
<method name="isChild()Z" />
<method name="isDestroyed()Z" since="17" />
<method name="isFinishing()Z" />
+ <method name="isImmersive()Z" since="18" />
<method name="isTaskRoot()Z" />
<method name="managedQuery(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;" />
<method name="moveTaskToBack(Z)Z" />
@@ -2702,6 +2761,7 @@
<method name="onPrepareDialog(ILandroid/app/Dialog;Landroid/os/Bundle;)V" since="8" />
<method name="onPrepareNavigateUpTaskStack(Landroid/app/TaskStackBuilder;)V" since="16" />
<method name="onPrepareOptionsMenu(Landroid/view/Menu;)Z" />
+ <method name="onProvideAssistData(Landroid/os/Bundle;)V" since="18" />
<method name="onRestart()V" />
<method name="onRestoreInstanceState(Landroid/os/Bundle;)V" />
<method name="onResume()V" />
@@ -2731,6 +2791,7 @@
<method name="setFeatureDrawableResource(II)V" />
<method name="setFeatureDrawableUri(ILandroid/net/Uri;)V" />
<method name="setFinishOnTouchOutside(Z)V" since="11" />
+ <method name="setImmersive(Z)V" since="18" />
<method name="setIntent(Landroid/content/Intent;)V" />
<method name="setPersistent(Z)V" />
<method name="setProgress(I)V" />
@@ -3033,7 +3094,9 @@
<method name="onCreate()V" />
<method name="onTerminate()V" />
<method name="registerActivityLifecycleCallbacks(Landroid/app/Application$ActivityLifecycleCallbacks;)V" since="14" />
+ <method name="registerOnProvideAssistDataListener(Landroid/app/Application$OnProvideAssistDataListener;)V" since="18" />
<method name="unregisterActivityLifecycleCallbacks(Landroid/app/Application$ActivityLifecycleCallbacks;)V" since="14" />
+ <method name="unregisterOnProvideAssistDataListener(Landroid/app/Application$OnProvideAssistDataListener;)V" since="18" />
</class>
<class name="android/app/Application$ActivityLifecycleCallbacks" since="14">
<extends name="java/lang/Object" />
@@ -3045,6 +3108,10 @@
<method name="onActivityStarted(Landroid/app/Activity;)V" />
<method name="onActivityStopped(Landroid/app/Activity;)V" />
</class>
+ <class name="android/app/Application$OnProvideAssistDataListener" since="18">
+ <extends name="java/lang/Object" />
+ <method name="onProvideAssistData(Landroid/app/Activity;Landroid/os/Bundle;)V" />
+ </class>
<class name="android/app/ApplicationErrorReport" since="14">
<extends name="java/lang/Object" />
<implements name="android/os/Parcelable" />
@@ -3508,6 +3575,7 @@
<method name="getComponentName()Landroid/content/ComponentName;" />
<method name="getContext()Landroid/content/Context;" />
<method name="getTargetContext()Landroid/content/Context;" />
+ <method name="getUiAutomation()Landroid/app/UiAutomation;" since="18" />
<method name="invokeContextMenuAction(Landroid/app/Activity;II)Z" />
<method name="invokeMenuActionSync(Landroid/app/Activity;II)Z" />
<method name="isProfiling()Z" />
@@ -4056,6 +4124,35 @@
<extends name="java/lang/Object" />
<method name="onTimeSet(Landroid/widget/TimePicker;II)V" />
</class>
+ <class name="android/app/UiAutomation" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="executeAndWaitForEvent(Ljava/lang/Runnable;Landroid/app/UiAutomation$AccessibilityEventFilter;J)Landroid/view/accessibility/AccessibilityEvent;" />
+ <method name="getRootInActiveWindow()Landroid/view/accessibility/AccessibilityNodeInfo;" />
+ <method name="getServiceInfo()Landroid/accessibilityservice/AccessibilityServiceInfo;" />
+ <method name="injectInputEvent(Landroid/view/InputEvent;Z)Z" />
+ <method name="performGlobalAction(I)Z" />
+ <method name="setOnAccessibilityEventListener(Landroid/app/UiAutomation$OnAccessibilityEventListener;)V" />
+ <method name="setRotation(I)Z" />
+ <method name="setRunAsMonkey(Z)V" />
+ <method name="setServiceInfo(Landroid/accessibilityservice/AccessibilityServiceInfo;)V" />
+ <method name="takeScreenshot()Landroid/graphics/Bitmap;" />
+ <method name="waitForIdle(JJ)V" />
+ <field name="ROTATION_FREEZE_0" />
+ <field name="ROTATION_FREEZE_180" />
+ <field name="ROTATION_FREEZE_270" />
+ <field name="ROTATION_FREEZE_90" />
+ <field name="ROTATION_FREEZE_CURRENT" />
+ <field name="ROTATION_UNFREEZE" />
+ </class>
+ <class name="android/app/UiAutomation$AccessibilityEventFilter" since="18">
+ <extends name="java/lang/Object" />
+ <method name="accept(Landroid/view/accessibility/AccessibilityEvent;)Z" />
+ </class>
+ <class name="android/app/UiAutomation$OnAccessibilityEventListener" since="18">
+ <extends name="java/lang/Object" />
+ <method name="onAccessibilityEvent(Landroid/view/accessibility/AccessibilityEvent;)V" />
+ </class>
<class name="android/app/UiModeManager" since="8">
<extends name="java/lang/Object" />
<method name="&lt;init>()V" />
@@ -4195,6 +4292,7 @@
<method name="hasGrantedPolicy(Landroid/content/ComponentName;I)Z" since="11" />
<method name="isActivePasswordSufficient()Z" />
<method name="isAdminActive(Landroid/content/ComponentName;)Z" />
+ <method name="isDeviceOwnerApp(Ljava/lang/String;)Z" since="18" />
<method name="lockNow()V" />
<method name="removeActiveAdmin(Landroid/content/ComponentName;)V" />
<method name="resetPassword(Ljava/lang/String;I)Z" />
@@ -4458,6 +4556,9 @@
<method name="listenUsingRfcommWithServiceRecord(Ljava/lang/String;Ljava/util/UUID;)Landroid/bluetooth/BluetoothServerSocket;" />
<method name="setName(Ljava/lang/String;)Z" />
<method name="startDiscovery()Z" />
+ <method name="startLeScan(Landroid/bluetooth/BluetoothAdapter$LeScanCallback;)Z" since="18" />
+ <method name="startLeScan([Ljava/util/UUID;Landroid/bluetooth/BluetoothAdapter$LeScanCallback;)Z" since="18" />
+ <method name="stopLeScan(Landroid/bluetooth/BluetoothAdapter$LeScanCallback;)V" since="18" />
<field name="ACTION_CONNECTION_STATE_CHANGED" since="11" />
<field name="ACTION_DISCOVERY_FINISHED" />
<field name="ACTION_DISCOVERY_STARTED" />
@@ -4487,6 +4588,18 @@
<field name="STATE_TURNING_OFF" />
<field name="STATE_TURNING_ON" />
</class>
+ <class name="android/bluetooth/BluetoothAdapter$LeScanCallback" since="18">
+ <extends name="java/lang/Object" />
+ <method name="onLeScan(Landroid/bluetooth/BluetoothDevice;I[B)V" />
+ </class>
+ <class name="android/bluetooth/BluetoothAdapterCallback" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="onCallbackRegistration(I)V" />
+ <method name="onLeScan(Landroid/bluetooth/BluetoothDevice;I[B)V" />
+ <field name="CALLBACK_REGISTERED" />
+ <field name="CALLBACK_REGISTRATION_FAILURE" />
+ </class>
<class name="android/bluetooth/BluetoothAssignedNumbers" since="11">
<extends name="java/lang/Object" />
<method name="&lt;init>()V" />
@@ -4683,6 +4796,7 @@
<extends name="java/lang/Object" />
<implements name="android/os/Parcelable" />
<method name="&lt;init>()V" />
+ <method name="connectGatt(Landroid/content/Context;ZLandroid/bluetooth/BluetoothGattCallback;)Landroid/bluetooth/BluetoothGatt;" since="18" />
<method name="createInsecureRfcommSocketToServiceRecord(Ljava/util/UUID;)Landroid/bluetooth/BluetoothSocket;" since="10" />
<method name="createRfcommSocketToServiceRecord(Ljava/util/UUID;)Landroid/bluetooth/BluetoothSocket;" />
<method name="fetchUuidsWithSdp()Z" since="15" />
@@ -4690,6 +4804,7 @@
<method name="getBluetoothClass()Landroid/bluetooth/BluetoothClass;" />
<method name="getBondState()I" />
<method name="getName()Ljava/lang/String;" />
+ <method name="getType()I" since="18" />
<method name="getUuids()[Landroid/os/ParcelUuid;" since="15" />
<field name="ACTION_ACL_CONNECTED" />
<field name="ACTION_ACL_DISCONNECTED" />
@@ -4703,6 +4818,10 @@
<field name="BOND_BONDING" />
<field name="BOND_NONE" />
<field name="CREATOR" />
+ <field name="DEVICE_TYPE_CLASSIC" since="18" />
+ <field name="DEVICE_TYPE_DUAL" since="18" />
+ <field name="DEVICE_TYPE_LE" since="18" />
+ <field name="DEVICE_TYPE_UNKNOWN" since="18" />
<field name="ERROR" />
<field name="EXTRA_BOND_STATE" />
<field name="EXTRA_CLASS" />
@@ -4712,6 +4831,161 @@
<field name="EXTRA_RSSI" />
<field name="EXTRA_UUID" since="15" />
</class>
+ <class name="android/bluetooth/BluetoothGatt" since="18">
+ <extends name="java/lang/Object" />
+ <implements name="android/bluetooth/BluetoothProfile" />
+ <method name="&lt;init>()V" />
+ <method name="abortReliableWrite(Landroid/bluetooth/BluetoothDevice;)V" />
+ <method name="beginReliableWrite()Z" />
+ <method name="close()V" />
+ <method name="connect()Z" />
+ <method name="disconnect()V" />
+ <method name="discoverServices()Z" />
+ <method name="executeReliableWrite()Z" />
+ <method name="getDevice()Landroid/bluetooth/BluetoothDevice;" />
+ <method name="getService(Ljava/util/UUID;)Landroid/bluetooth/BluetoothGattService;" />
+ <method name="getServices()Ljava/util/List;" />
+ <method name="readCharacteristic(Landroid/bluetooth/BluetoothGattCharacteristic;)Z" />
+ <method name="readDescriptor(Landroid/bluetooth/BluetoothGattDescriptor;)Z" />
+ <method name="readRemoteRssi()Z" />
+ <method name="setCharacteristicNotification(Landroid/bluetooth/BluetoothGattCharacteristic;Z)Z" />
+ <method name="writeCharacteristic(Landroid/bluetooth/BluetoothGattCharacteristic;)Z" />
+ <method name="writeDescriptor(Landroid/bluetooth/BluetoothGattDescriptor;)Z" />
+ <field name="GATT_FAILURE" />
+ <field name="GATT_INSUFFICIENT_AUTHENTICATION" />
+ <field name="GATT_INSUFFICIENT_ENCRYPTION" />
+ <field name="GATT_INVALID_ATTRIBUTE_LENGTH" />
+ <field name="GATT_INVALID_OFFSET" />
+ <field name="GATT_READ_NOT_PERMITTED" />
+ <field name="GATT_REQUEST_NOT_SUPPORTED" />
+ <field name="GATT_SUCCESS" />
+ <field name="GATT_WRITE_NOT_PERMITTED" />
+ </class>
+ <class name="android/bluetooth/BluetoothGattCallback" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="onCharacteristicChanged(Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattCharacteristic;)V" />
+ <method name="onCharacteristicRead(Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattCharacteristic;I)V" />
+ <method name="onCharacteristicWrite(Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattCharacteristic;I)V" />
+ <method name="onConnectionStateChange(Landroid/bluetooth/BluetoothGatt;II)V" />
+ <method name="onDescriptorRead(Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattDescriptor;I)V" />
+ <method name="onDescriptorWrite(Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattDescriptor;I)V" />
+ <method name="onReadRemoteRssi(Landroid/bluetooth/BluetoothGatt;II)V" />
+ <method name="onReliableWriteCompleted(Landroid/bluetooth/BluetoothGatt;I)V" />
+ <method name="onServicesDiscovered(Landroid/bluetooth/BluetoothGatt;I)V" />
+ </class>
+ <class name="android/bluetooth/BluetoothGattCharacteristic" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>(Ljava/util/UUID;II)V" />
+ <method name="addDescriptor(Landroid/bluetooth/BluetoothGattDescriptor;)Z" />
+ <method name="getDescriptor(Ljava/util/UUID;)Landroid/bluetooth/BluetoothGattDescriptor;" />
+ <method name="getDescriptors()Ljava/util/List;" />
+ <method name="getFloatValue(II)Ljava/lang/Float;" />
+ <method name="getInstanceId()I" />
+ <method name="getIntValue(II)Ljava/lang/Integer;" />
+ <method name="getPermissions()I" />
+ <method name="getProperties()I" />
+ <method name="getService()Landroid/bluetooth/BluetoothGattService;" />
+ <method name="getStringValue(I)Ljava/lang/String;" />
+ <method name="getUuid()Ljava/util/UUID;" />
+ <method name="getValue()[B" />
+ <method name="getWriteType()I" />
+ <method name="setValue(III)Z" />
+ <method name="setValue(IIII)Z" />
+ <method name="setValue(Ljava/lang/String;)Z" />
+ <method name="setValue([B)Z" />
+ <method name="setWriteType(I)V" />
+ <field name="FORMAT_FLOAT" />
+ <field name="FORMAT_SFLOAT" />
+ <field name="FORMAT_SINT16" />
+ <field name="FORMAT_SINT32" />
+ <field name="FORMAT_SINT8" />
+ <field name="FORMAT_UINT16" />
+ <field name="FORMAT_UINT32" />
+ <field name="FORMAT_UINT8" />
+ <field name="PERMISSION_READ" />
+ <field name="PERMISSION_READ_ENCRYPTED" />
+ <field name="PERMISSION_READ_ENCRYPTED_MITM" />
+ <field name="PERMISSION_WRITE" />
+ <field name="PERMISSION_WRITE_ENCRYPTED" />
+ <field name="PERMISSION_WRITE_ENCRYPTED_MITM" />
+ <field name="PERMISSION_WRITE_SIGNED" />
+ <field name="PERMISSION_WRITE_SIGNED_MITM" />
+ <field name="PROPERTY_BROADCAST" />
+ <field name="PROPERTY_EXTENDED_PROPS" />
+ <field name="PROPERTY_INDICATE" />
+ <field name="PROPERTY_NOTIFY" />
+ <field name="PROPERTY_READ" />
+ <field name="PROPERTY_SIGNED_WRITE" />
+ <field name="PROPERTY_WRITE" />
+ <field name="PROPERTY_WRITE_NO_RESPONSE" />
+ <field name="WRITE_TYPE_DEFAULT" />
+ <field name="WRITE_TYPE_NO_RESPONSE" />
+ <field name="WRITE_TYPE_SIGNED" />
+ <field name="mDescriptors" />
+ </class>
+ <class name="android/bluetooth/BluetoothGattDescriptor" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>(Ljava/util/UUID;I)V" />
+ <method name="getCharacteristic()Landroid/bluetooth/BluetoothGattCharacteristic;" />
+ <method name="getPermissions()I" />
+ <method name="getUuid()Ljava/util/UUID;" />
+ <method name="getValue()[B" />
+ <method name="setValue([B)Z" />
+ <field name="DISABLE_NOTIFICATION_VALUE" />
+ <field name="ENABLE_INDICATION_VALUE" />
+ <field name="ENABLE_NOTIFICATION_VALUE" />
+ <field name="PERMISSION_READ" />
+ <field name="PERMISSION_READ_ENCRYPTED" />
+ <field name="PERMISSION_READ_ENCRYPTED_MITM" />
+ <field name="PERMISSION_WRITE" />
+ <field name="PERMISSION_WRITE_ENCRYPTED" />
+ <field name="PERMISSION_WRITE_ENCRYPTED_MITM" />
+ <field name="PERMISSION_WRITE_SIGNED" />
+ <field name="PERMISSION_WRITE_SIGNED_MITM" />
+ </class>
+ <class name="android/bluetooth/BluetoothGattServer" since="18">
+ <extends name="java/lang/Object" />
+ <implements name="android/bluetooth/BluetoothProfile" />
+ <method name="&lt;init>()V" />
+ <method name="addService(Landroid/bluetooth/BluetoothGattService;)Z" />
+ <method name="cancelConnection(Landroid/bluetooth/BluetoothDevice;)V" />
+ <method name="clearServices()V" />
+ <method name="close()V" />
+ <method name="connect(Landroid/bluetooth/BluetoothDevice;Z)Z" />
+ <method name="getService(Ljava/util/UUID;)Landroid/bluetooth/BluetoothGattService;" />
+ <method name="getServices()Ljava/util/List;" />
+ <method name="notifyCharacteristicChanged(Landroid/bluetooth/BluetoothDevice;Landroid/bluetooth/BluetoothGattCharacteristic;Z)Z" />
+ <method name="removeService(Landroid/bluetooth/BluetoothGattService;)Z" />
+ <method name="sendResponse(Landroid/bluetooth/BluetoothDevice;III[B)Z" />
+ </class>
+ <class name="android/bluetooth/BluetoothGattServerCallback" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="onCharacteristicReadRequest(Landroid/bluetooth/BluetoothDevice;IILandroid/bluetooth/BluetoothGattCharacteristic;)V" />
+ <method name="onCharacteristicWriteRequest(Landroid/bluetooth/BluetoothDevice;ILandroid/bluetooth/BluetoothGattCharacteristic;ZZI[B)V" />
+ <method name="onConnectionStateChange(Landroid/bluetooth/BluetoothDevice;II)V" />
+ <method name="onDescriptorReadRequest(Landroid/bluetooth/BluetoothDevice;IILandroid/bluetooth/BluetoothGattDescriptor;)V" />
+ <method name="onDescriptorWriteRequest(Landroid/bluetooth/BluetoothDevice;ILandroid/bluetooth/BluetoothGattDescriptor;ZZI[B)V" />
+ <method name="onExecuteWrite(Landroid/bluetooth/BluetoothDevice;IZ)V" />
+ <method name="onServiceAdded(ILandroid/bluetooth/BluetoothGattService;)V" />
+ </class>
+ <class name="android/bluetooth/BluetoothGattService" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>(Ljava/util/UUID;I)V" />
+ <method name="addCharacteristic(Landroid/bluetooth/BluetoothGattCharacteristic;)Z" />
+ <method name="addService(Landroid/bluetooth/BluetoothGattService;)Z" />
+ <method name="getCharacteristic(Ljava/util/UUID;)Landroid/bluetooth/BluetoothGattCharacteristic;" />
+ <method name="getCharacteristics()Ljava/util/List;" />
+ <method name="getIncludedServices()Ljava/util/List;" />
+ <method name="getInstanceId()I" />
+ <method name="getType()I" />
+ <method name="getUuid()Ljava/util/UUID;" />
+ <field name="SERVICE_TYPE_PRIMARY" />
+ <field name="SERVICE_TYPE_SECONDARY" />
+ <field name="mCharacteristics" />
+ <field name="mIncludedServices" />
+ </class>
<class name="android/bluetooth/BluetoothHeadset" since="11">
<extends name="java/lang/Object" />
<implements name="android/bluetooth/BluetoothProfile" />
@@ -4772,6 +5046,15 @@
<method name="onHealthAppConfigurationStatusChange(Landroid/bluetooth/BluetoothHealthAppConfiguration;I)V" />
<method name="onHealthChannelStateChange(Landroid/bluetooth/BluetoothHealthAppConfiguration;Landroid/bluetooth/BluetoothDevice;IILandroid/os/ParcelFileDescriptor;I)V" />
</class>
+ <class name="android/bluetooth/BluetoothManager" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="getAdapter()Landroid/bluetooth/BluetoothAdapter;" />
+ <method name="getConnectedDevices(I)Ljava/util/List;" />
+ <method name="getConnectionState(Landroid/bluetooth/BluetoothDevice;I)I" />
+ <method name="getDevicesMatchingConnectionStates(I[I)Ljava/util/List;" />
+ <method name="openGattServer(Landroid/content/Context;Landroid/bluetooth/BluetoothGattServerCallback;)Landroid/bluetooth/BluetoothGattServer;" />
+ </class>
<class name="android/bluetooth/BluetoothProfile" since="11">
<extends name="java/lang/Object" />
<method name="getConnectedDevices()Ljava/util/List;" />
@@ -4780,6 +5063,8 @@
<field name="A2DP" />
<field name="EXTRA_PREVIOUS_STATE" />
<field name="EXTRA_STATE" />
+ <field name="GATT" since="18" />
+ <field name="GATT_SERVER" since="18" />
<field name="HEADSET" />
<field name="HEALTH" since="14" />
<field name="STATE_CONNECTED" />
@@ -5017,6 +5302,7 @@
<method name="bulkInsert(Landroid/net/Uri;[Landroid/content/ContentValues;)I" />
<method name="call(Ljava/lang/String;Ljava/lang/String;Landroid/os/Bundle;)Landroid/os/Bundle;" since="11" />
<method name="delete(Landroid/net/Uri;Ljava/lang/String;[Ljava/lang/String;)I" />
+ <method name="dump(Ljava/io/FileDescriptor;Ljava/io/PrintWriter;[Ljava/lang/String;)V" since="18" />
<method name="getContext()Landroid/content/Context;" />
<method name="getPathPermissions()[Landroid/content/pm/PathPermission;" since="4" />
<method name="getReadPermission()Ljava/lang/String;" />
@@ -5332,6 +5618,7 @@
<field name="BIND_IMPORTANT" since="14" />
<field name="BIND_NOT_FOREGROUND" since="8" />
<field name="BIND_WAIVE_PRIORITY" since="14" />
+ <field name="BLUETOOTH_SERVICE" since="18" />
<field name="CLIPBOARD_SERVICE" />
<field name="CONNECTIVITY_SERVICE" />
<field name="CONTEXT_IGNORE_SECURITY" />
@@ -5611,6 +5898,7 @@
<field name="ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE" since="8" />
<field name="ACTION_FACTORY_TEST" />
<field name="ACTION_GET_CONTENT" />
+ <field name="ACTION_GET_RESTRICTION_ENTRIES" since="18" />
<field name="ACTION_GTALK_SERVICE_CONNECTED" />
<field name="ACTION_GTALK_SERVICE_DISCONNECTED" />
<field name="ACTION_HEADSET_PLUG" />
@@ -5719,7 +6007,10 @@
<field name="CATEGORY_UNIT_TEST" />
<field name="CREATOR" />
<field name="EXTRA_ALARM_COUNT" />
+ <field name="EXTRA_ALLOW_MULTIPLE" since="18" />
<field name="EXTRA_ALLOW_REPLACE" since="14" />
+ <field name="EXTRA_ASSIST_CONTEXT" since="18" />
+ <field name="EXTRA_ASSIST_PACKAGE" since="18" />
<field name="EXTRA_BCC" />
<field name="EXTRA_BUG_REPORT" since="14" />
<field name="EXTRA_CC" />
@@ -5748,6 +6039,9 @@
<field name="EXTRA_REFERRER" since="17" />
<field name="EXTRA_REMOTE_INTENT_TOKEN" since="5" />
<field name="EXTRA_REPLACING" since="3" />
+ <field name="EXTRA_RESTRICTIONS_BUNDLE" since="18" />
+ <field name="EXTRA_RESTRICTIONS_INTENT" since="18" />
+ <field name="EXTRA_RESTRICTIONS_LIST" since="18" />
<field name="EXTRA_RETURN_RESULT" since="14" />
<field name="EXTRA_SHORTCUT_ICON" />
<field name="EXTRA_SHORTCUT_ICON_RESOURCE" />
@@ -5917,6 +6211,7 @@
<method name="&lt;init>(Landroid/content/Context;)V" />
<method name="abandon()V" />
<method name="cancelLoad()Z" since="16" />
+ <method name="commitContentChanged()V" since="18" />
<method name="dataToString(Ljava/lang/Object;)Ljava/lang/String;" />
<method name="deliverCancellation()V" since="16" />
<method name="deliverResult(Ljava/lang/Object;)V" />
@@ -5937,6 +6232,7 @@
<method name="registerListener(ILandroid/content/Loader$OnLoadCompleteListener;)V" />
<method name="registerOnLoadCanceledListener(Landroid/content/Loader$OnLoadCanceledListener;)V" since="16" />
<method name="reset()V" />
+ <method name="rollbackContentChanged()V" since="18" />
<method name="startLoading()V" />
<method name="stopLoading()V" />
<method name="takeContentChanged()Z" />
@@ -5984,6 +6280,38 @@
<extends name="android/util/AndroidRuntimeException" />
<method name="&lt;init>(Ljava/lang/String;)V" />
</class>
+ <class name="android/content/RestrictionEntry" since="18">
+ <extends name="java/lang/Object" />
+ <implements name="android/os/Parcelable" />
+ <method name="&lt;init>(Landroid/os/Parcel;)V" />
+ <method name="&lt;init>(Ljava/lang/String;Ljava/lang/String;)V" />
+ <method name="&lt;init>(Ljava/lang/String;Z)V" />
+ <method name="&lt;init>(Ljava/lang/String;[Ljava/lang/String;)V" />
+ <method name="getAllSelectedStrings()[Ljava/lang/String;" />
+ <method name="getChoiceEntries()[Ljava/lang/String;" />
+ <method name="getChoiceValues()[Ljava/lang/String;" />
+ <method name="getDescription()Ljava/lang/String;" />
+ <method name="getKey()Ljava/lang/String;" />
+ <method name="getSelectedState()Z" />
+ <method name="getSelectedString()Ljava/lang/String;" />
+ <method name="getTitle()Ljava/lang/String;" />
+ <method name="getType()I" />
+ <method name="setAllSelectedStrings([Ljava/lang/String;)V" />
+ <method name="setChoiceEntries(Landroid/content/Context;I)V" />
+ <method name="setChoiceEntries([Ljava/lang/String;)V" />
+ <method name="setChoiceValues(Landroid/content/Context;I)V" />
+ <method name="setChoiceValues([Ljava/lang/String;)V" />
+ <method name="setDescription(Ljava/lang/String;)V" />
+ <method name="setSelectedState(Z)V" />
+ <method name="setSelectedString(Ljava/lang/String;)V" />
+ <method name="setTitle(Ljava/lang/String;)V" />
+ <method name="setType(I)V" />
+ <field name="CREATOR" />
+ <field name="TYPE_BOOLEAN" />
+ <field name="TYPE_CHOICE" />
+ <field name="TYPE_MULTI_SELECT" />
+ <field name="TYPE_NULL" />
+ </class>
<class name="android/content/SearchRecentSuggestionsProvider" since="1">
<extends name="android/content/ContentProvider" />
<method name="&lt;init>()V" />
@@ -6137,6 +6465,7 @@
<field name="FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS" since="5" />
<field name="FLAG_FINISH_ON_TASK_LAUNCH" />
<field name="FLAG_HARDWARE_ACCELERATED" since="11" />
+ <field name="FLAG_IMMERSIVE" since="18" />
<field name="FLAG_MULTIPROCESS" />
<field name="FLAG_NO_HISTORY" since="3" />
<field name="FLAG_SINGLE_USER" since="17" />
@@ -6147,7 +6476,9 @@
<field name="LAUNCH_SINGLE_TOP" />
<field name="SCREEN_ORIENTATION_BEHIND" />
<field name="SCREEN_ORIENTATION_FULL_SENSOR" since="9" />
+ <field name="SCREEN_ORIENTATION_FULL_USER" since="18" />
<field name="SCREEN_ORIENTATION_LANDSCAPE" />
+ <field name="SCREEN_ORIENTATION_LOCKED" since="18" />
<field name="SCREEN_ORIENTATION_NOSENSOR" />
<field name="SCREEN_ORIENTATION_PORTRAIT" />
<field name="SCREEN_ORIENTATION_REVERSE_LANDSCAPE" since="9" />
@@ -6157,6 +6488,8 @@
<field name="SCREEN_ORIENTATION_SENSOR_PORTRAIT" since="9" />
<field name="SCREEN_ORIENTATION_UNSPECIFIED" />
<field name="SCREEN_ORIENTATION_USER" />
+ <field name="SCREEN_ORIENTATION_USER_LANDSCAPE" since="18" />
+ <field name="SCREEN_ORIENTATION_USER_PORTRAIT" since="18" />
<field name="UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW" since="14" />
<field name="configChanges" />
<field name="flags" />
@@ -6405,6 +6738,7 @@
<method name="getPackageGids(Ljava/lang/String;)[I" />
<method name="getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;" />
<method name="getPackagesForUid(I)[Ljava/lang/String;" />
+ <method name="getPackagesHoldingPermissions([Ljava/lang/String;I)Ljava/util/List;" since="18" />
<method name="getPermissionGroupInfo(Ljava/lang/String;I)Landroid/content/pm/PermissionGroupInfo;" />
<method name="getPermissionInfo(Ljava/lang/String;I)Landroid/content/pm/PermissionInfo;" />
<method name="getPreferredActivities(Ljava/util/List;Ljava/util/List;Ljava/lang/String;)I" />
@@ -6441,13 +6775,16 @@
<method name="verifyPendingInstall(II)V" since="14" />
<field name="COMPONENT_ENABLED_STATE_DEFAULT" />
<field name="COMPONENT_ENABLED_STATE_DISABLED" />
+ <field name="COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED" since="18" />
<field name="COMPONENT_ENABLED_STATE_DISABLED_USER" since="14" />
<field name="COMPONENT_ENABLED_STATE_ENABLED" />
<field name="DONT_KILL_APP" />
<field name="EXTRA_VERIFICATION_ID" since="14" />
<field name="EXTRA_VERIFICATION_RESULT" since="17" />
+ <field name="FEATURE_APP_WIDGETS" since="18" />
<field name="FEATURE_AUDIO_LOW_LATENCY" since="9" />
<field name="FEATURE_BLUETOOTH" since="8" />
+ <field name="FEATURE_BLUETOOTH_LE" since="18" />
<field name="FEATURE_CAMERA" since="7" />
<field name="FEATURE_CAMERA_ANY" since="17" />
<field name="FEATURE_CAMERA_AUTOFOCUS" since="7" />
@@ -6456,6 +6793,8 @@
<field name="FEATURE_FAKETOUCH" since="11" />
<field name="FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT" since="13" />
<field name="FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND" since="13" />
+ <field name="FEATURE_HOME_SCREEN" since="18" />
+ <field name="FEATURE_INPUT_METHODS" since="18" />
<field name="FEATURE_LIVE_WALLPAPER" since="7" />
<field name="FEATURE_LOCATION" since="8" />
<field name="FEATURE_LOCATION_GPS" since="8" />
@@ -6488,6 +6827,7 @@
<field name="GET_ACTIVITIES" />
<field name="GET_CONFIGURATIONS" since="3" />
<field name="GET_DISABLED_COMPONENTS" />
+ <field name="GET_DISABLED_UNTIL_USED_COMPONENTS" since="18" />
<field name="GET_GIDS" />
<field name="GET_INSTRUMENTATION" />
<field name="GET_INTENT_FILTERS" />
@@ -6563,17 +6903,6 @@
<field name="externalObbSize" since="11" />
<field name="packageName" />
</class>
- <class name="android/content/pm/PackageUserState" since="17">
- <extends name="java/lang/Object" />
- <method name="&lt;init>()V" />
- <method name="&lt;init>(Landroid/content/pm/PackageUserState;)V" />
- <field name="disabledComponents" />
- <field name="enabled" />
- <field name="enabledComponents" />
- <field name="installed" />
- <field name="notLaunched" />
- <field name="stopped" />
- </class>
<class name="android/content/pm/PathPermission" since="4">
<extends name="android/os/PatternMatcher" />
<method name="&lt;init>(Landroid/os/Parcel;)V" />
@@ -9080,8 +9409,11 @@
<method name="getPaint()Landroid/graphics/Paint;" />
<method name="getTileModeX()Landroid/graphics/Shader$TileMode;" />
<method name="getTileModeY()Landroid/graphics/Shader$TileMode;" />
+ <method name="hasAntiAlias()Z" since="18" />
+ <method name="hasMipMap()Z" since="18" />
<method name="setAntiAlias(Z)V" />
<method name="setGravity(I)V" />
+ <method name="setMipMap(Z)V" since="18" />
<method name="setTargetDensity(I)V" since="4" />
<method name="setTargetDensity(Landroid/graphics/Canvas;)V" since="4" />
<method name="setTargetDensity(Landroid/util/DisplayMetrics;)V" since="4" />
@@ -9653,16 +9985,20 @@
<field name="TYPE_ACCELEROMETER" />
<field name="TYPE_ALL" />
<field name="TYPE_AMBIENT_TEMPERATURE" since="14" />
+ <field name="TYPE_GAME_ROTATION_VECTOR" since="18" />
<field name="TYPE_GRAVITY" since="9" />
<field name="TYPE_GYROSCOPE" />
+ <field name="TYPE_GYROSCOPE_UNCALIBRATED" since="18" />
<field name="TYPE_LIGHT" />
<field name="TYPE_LINEAR_ACCELERATION" since="9" />
<field name="TYPE_MAGNETIC_FIELD" />
+ <field name="TYPE_MAGNETIC_FIELD_UNCALIBRATED" since="18" />
<field name="TYPE_ORIENTATION" />
<field name="TYPE_PRESSURE" />
<field name="TYPE_PROXIMITY" />
<field name="TYPE_RELATIVE_HUMIDITY" since="14" />
<field name="TYPE_ROTATION_VECTOR" since="9" />
+ <field name="TYPE_SIGNIFICANT_MOTION" since="18" />
<field name="TYPE_TEMPERATURE" />
</class>
<class name="android/hardware/SensorEvent" since="3">
@@ -9686,6 +10022,7 @@
<class name="android/hardware/SensorManager" since="1">
<extends name="java/lang/Object" />
<method name="&lt;init>()V" />
+ <method name="cancelTriggerSensor(Landroid/hardware/TriggerEventListener;Landroid/hardware/Sensor;)Z" since="18" />
<method name="getAltitude(FF)F" since="9" />
<method name="getAngleChange([F[F[F)V" since="9" />
<method name="getDefaultSensor(I)Landroid/hardware/Sensor;" since="3" />
@@ -9701,6 +10038,7 @@
<method name="registerListener(Landroid/hardware/SensorListener;I)Z" />
<method name="registerListener(Landroid/hardware/SensorListener;II)Z" />
<method name="remapCoordinateSystem([FII[F)Z" since="3" />
+ <method name="requestTriggerSensor(Landroid/hardware/TriggerEventListener;Landroid/hardware/Sensor;)Z" since="18" />
<method name="unregisterListener(Landroid/hardware/SensorEventListener;)V" since="3" />
<method name="unregisterListener(Landroid/hardware/SensorEventListener;Landroid/hardware/Sensor;)V" since="3" />
<method name="unregisterListener(Landroid/hardware/SensorListener;)V" />
@@ -9763,6 +10101,18 @@
<field name="SENSOR_TRICORDER" />
<field name="STANDARD_GRAVITY" />
</class>
+ <class name="android/hardware/TriggerEvent" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <field name="sensor" />
+ <field name="timestamp" />
+ <field name="values" />
+ </class>
+ <class name="android/hardware/TriggerEventListener" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="onTrigger(Landroid/hardware/TriggerEvent;)V" />
+ </class>
<class name="android/hardware/display/DisplayManager" since="17">
<extends name="java/lang/Object" />
<method name="&lt;init>()V" />
@@ -9795,6 +10145,61 @@
<method name="onInputDeviceChanged(I)V" />
<method name="onInputDeviceRemoved(I)V" />
</class>
+ <class name="android/hardware/location/GeofenceHardware" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="addGeofence(IILandroid/hardware/location/GeofenceHardwareRequest;Landroid/hardware/location/GeofenceHardwareCallback;)Z" />
+ <method name="getMonitoringTypes()[I" />
+ <method name="getStatusOfMonitoringType(I)I" />
+ <method name="pauseGeofence(II)Z" />
+ <method name="registerForMonitorStateChangeCallback(ILandroid/hardware/location/GeofenceHardwareMonitorCallback;)Z" />
+ <method name="removeGeofence(II)Z" />
+ <method name="resumeGeofence(III)Z" />
+ <method name="unregisterForMonitorStateChangeCallback(ILandroid/hardware/location/GeofenceHardwareMonitorCallback;)Z" />
+ <field name="GEOFENCE_ENTERED" />
+ <field name="GEOFENCE_ERROR_ID_EXISTS" />
+ <field name="GEOFENCE_ERROR_ID_UNKNOWN" />
+ <field name="GEOFENCE_ERROR_INVALID_TRANSITION" />
+ <field name="GEOFENCE_ERROR_TOO_MANY_GEOFENCES" />
+ <field name="GEOFENCE_EXITED" />
+ <field name="GEOFENCE_FAILURE" />
+ <field name="GEOFENCE_SUCCESS" />
+ <field name="GEOFENCE_UNCERTAIN" />
+ <field name="MONITORING_TYPE_GPS_HARDWARE" />
+ <field name="MONITOR_CURRENTLY_AVAILABLE" />
+ <field name="MONITOR_CURRENTLY_UNAVAILABLE" />
+ <field name="MONITOR_UNSUPPORTED" />
+ </class>
+ <class name="android/hardware/location/GeofenceHardwareCallback" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="onGeofenceAdd(II)V" />
+ <method name="onGeofencePause(II)V" />
+ <method name="onGeofenceRemove(II)V" />
+ <method name="onGeofenceResume(II)V" />
+ <method name="onGeofenceTransition(IILandroid/location/Location;JI)V" />
+ </class>
+ <class name="android/hardware/location/GeofenceHardwareMonitorCallback" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="onMonitoringSystemChange(IZLandroid/location/Location;)V" />
+ </class>
+ <class name="android/hardware/location/GeofenceHardwareRequest" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="createCircularGeofence(DDD)Landroid/hardware/location/GeofenceHardwareRequest;" />
+ <method name="getLastTransition()I" />
+ <method name="getLatitude()D" />
+ <method name="getLongitude()D" />
+ <method name="getMonitorTransitions()I" />
+ <method name="getNotificationResponsiveness()I" />
+ <method name="getRadius()D" />
+ <method name="getUnknownTimer()I" />
+ <method name="setLastTransition(I)V" />
+ <method name="setMonitorTransitions(I)V" />
+ <method name="setNotificationResponsiveness(I)V" />
+ <method name="setUnknownTimer(I)V" />
+ </class>
<class name="android/hardware/usb/UsbAccessory" since="12">
<extends name="java/lang/Object" />
<implements name="android/os/Parcelable" />
@@ -9865,9 +10270,11 @@
<extends name="java/lang/Object" />
<method name="&lt;init>()V" />
<method name="bulkTransfer(Landroid/hardware/usb/UsbEndpoint;[BII)I" />
+ <method name="bulkTransfer(Landroid/hardware/usb/UsbEndpoint;[BIII)I" since="18" />
<method name="claimInterface(Landroid/hardware/usb/UsbInterface;Z)Z" />
<method name="close()V" />
<method name="controlTransfer(IIII[BII)I" />
+ <method name="controlTransfer(IIII[BIII)I" since="18" />
<method name="getFileDescriptor()I" />
<method name="getRawDescriptors()[B" since="13" />
<method name="getSerial()Ljava/lang/String;" />
@@ -10258,13 +10665,6 @@
<method name="getFromLocationName(Ljava/lang/String;IDDDD)Ljava/util/List;" />
<method name="isPresent()Z" since="9" />
</class>
- <class name="android/location/Geofence" since="17">
- <extends name="java/lang/Object" />
- <implements name="android/os/Parcelable" />
- <method name="&lt;init>()V" />
- <method name="createCircle(DDF)Landroid/location/Geofence;" />
- <field name="CREATOR" />
- </class>
<class name="android/location/GpsSatellite" since="3">
<extends name="java/lang/Object" />
<method name="&lt;init>()V" />
@@ -10320,6 +10720,7 @@
<method name="hasAltitude()Z" />
<method name="hasBearing()Z" />
<method name="hasSpeed()Z" />
+ <method name="isFromMockProvider()Z" since="18" />
<method name="removeAccuracy()V" />
<method name="removeAltitude()V" />
<method name="removeBearing()V" />
@@ -10412,30 +10813,6 @@
<field name="OUT_OF_SERVICE" />
<field name="TEMPORARILY_UNAVAILABLE" />
</class>
- <class name="android/location/LocationRequest" since="17">
- <extends name="java/lang/Object" />
- <implements name="android/os/Parcelable" />
- <method name="&lt;init>()V" />
- <method name="create()Landroid/location/LocationRequest;" />
- <method name="getExpireAt()J" />
- <method name="getFastestInterval()J" />
- <method name="getInterval()J" />
- <method name="getNumUpdates()I" />
- <method name="getQuality()I" />
- <method name="setExpireAt(J)Landroid/location/LocationRequest;" />
- <method name="setExpireIn(J)Landroid/location/LocationRequest;" />
- <method name="setFastestInterval(J)Landroid/location/LocationRequest;" />
- <method name="setInterval(J)Landroid/location/LocationRequest;" />
- <method name="setNumUpdates(I)Landroid/location/LocationRequest;" />
- <method name="setQuality(I)Landroid/location/LocationRequest;" />
- <field name="ACCURACY_BLOCK" />
- <field name="ACCURACY_CITY" />
- <field name="ACCURACY_FINE" />
- <field name="CREATOR" />
- <field name="POWER_HIGH" />
- <field name="POWER_LOW" />
- <field name="POWER_NONE" />
- </class>
<class name="android/media/AsyncPlayer" since="1">
<extends name="java/lang/Object" />
<method name="&lt;init>(Ljava/lang/String;)V" />
@@ -10513,6 +10890,7 @@
<method name="loadSoundEffects()V" />
<method name="playSoundEffect(I)V" />
<method name="playSoundEffect(IF)V" since="3" />
+ <method name="registerMediaButtonEventReceiver(Landroid/app/PendingIntent;)V" since="18" />
<method name="registerMediaButtonEventReceiver(Landroid/content/ComponentName;)V" since="8" />
<method name="registerRemoteControlClient(Landroid/media/RemoteControlClient;)V" since="14" />
<method name="requestAudioFocus(Landroid/media/AudioManager$OnAudioFocusChangeListener;II)I" since="8" />
@@ -10533,6 +10911,7 @@
<method name="startBluetoothSco()V" since="8" />
<method name="stopBluetoothSco()V" since="8" />
<method name="unloadSoundEffects()V" />
+ <method name="unregisterMediaButtonEventReceiver(Landroid/app/PendingIntent;)V" since="18" />
<method name="unregisterMediaButtonEventReceiver(Landroid/content/ComponentName;)V" since="8" />
<method name="unregisterRemoteControlClient(Landroid/media/RemoteControlClient;)V" since="14" />
<field name="ACTION_AUDIO_BECOMING_NOISY" since="3" />
@@ -10753,6 +11132,10 @@
<field name="QUALITY_LOW" />
<field name="QUALITY_MEDIUM" />
</class>
+ <class name="android/media/DeniedByServerException" since="18">
+ <extends name="android/media/MediaDrmException" />
+ <method name="&lt;init>(Ljava/lang/String;)V" />
+ </class>
<class name="android/media/ExifInterface" since="5">
<extends name="java/lang/Object" />
<method name="&lt;init>(Ljava/lang/String;)V" />
@@ -10861,10 +11244,13 @@
<method name="createByCodecName(Ljava/lang/String;)Landroid/media/MediaCodec;" />
<method name="createDecoderByType(Ljava/lang/String;)Landroid/media/MediaCodec;" />
<method name="createEncoderByType(Ljava/lang/String;)Landroid/media/MediaCodec;" />
+ <method name="createInputSurface()Landroid/view/Surface;" since="18" />
<method name="dequeueInputBuffer(J)I" />
<method name="dequeueOutputBuffer(Landroid/media/MediaCodec$BufferInfo;J)I" />
<method name="flush()V" />
+ <method name="getCodecInfo()Landroid/media/MediaCodecInfo;" since="18" />
<method name="getInputBuffers()[Ljava/nio/ByteBuffer;" />
+ <method name="getName()Ljava/lang/String;" since="18" />
<method name="getOutputBuffers()[Ljava/nio/ByteBuffer;" />
<method name="getOutputFormat()Landroid/media/MediaFormat;" />
<method name="queueInputBuffer(IIIJI)V" />
@@ -10872,6 +11258,7 @@
<method name="release()V" />
<method name="releaseOutputBuffer(IZ)V" />
<method name="setVideoScalingMode(I)V" />
+ <method name="signalEndOfInputStream()V" since="18" />
<method name="start()V" />
<method name="stop()V" />
<field name="BUFFER_FLAG_CODEC_CONFIG" />
@@ -10952,6 +11339,7 @@
<field name="COLOR_FormatRawBayer10bit" />
<field name="COLOR_FormatRawBayer8bit" />
<field name="COLOR_FormatRawBayer8bitcompressed" />
+ <field name="COLOR_FormatSurface" since="18" />
<field name="COLOR_FormatYCbYCr" />
<field name="COLOR_FormatYCrYCb" />
<field name="COLOR_FormatYUV411PackedPlanar" />
@@ -11047,6 +11435,11 @@
<field name="MPEG4ProfileSimpleFBA" />
<field name="MPEG4ProfileSimpleFace" />
<field name="MPEG4ProfileSimpleScalable" />
+ <field name="VP8Level_Version0" since="18" />
+ <field name="VP8Level_Version1" since="18" />
+ <field name="VP8Level_Version2" since="18" />
+ <field name="VP8Level_Version3" since="18" />
+ <field name="VP8ProfileMain" since="18" />
<field name="level" />
<field name="profile" />
</class>
@@ -11067,11 +11460,75 @@
<extends name="java/lang/Exception" />
<method name="&lt;init>(Ljava/lang/String;)V" />
</class>
+ <class name="android/media/MediaDrm" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>(Ljava/util/UUID;)V" />
+ <method name="closeSession([B)V" />
+ <method name="getCryptoSession([BLjava/lang/String;Ljava/lang/String;)Landroid/media/MediaDrm$CryptoSession;" />
+ <method name="getKeyRequest([B[BLjava/lang/String;ILjava/util/HashMap;)Landroid/media/MediaDrm$KeyRequest;" />
+ <method name="getPropertyByteArray(Ljava/lang/String;)[B" />
+ <method name="getPropertyString(Ljava/lang/String;)Ljava/lang/String;" />
+ <method name="getProvisionRequest()Landroid/media/MediaDrm$ProvisionRequest;" />
+ <method name="getSecureStops()Ljava/util/List;" />
+ <method name="isCryptoSchemeSupported(Ljava/util/UUID;)Z" />
+ <method name="openSession()[B" />
+ <method name="provideKeyResponse([B[B)[B" />
+ <method name="provideProvisionResponse([B)V" />
+ <method name="queryKeyStatus([B)Ljava/util/HashMap;" />
+ <method name="release()V" />
+ <method name="releaseSecureStops([B)V" />
+ <method name="removeKeys([B)V" />
+ <method name="restoreKeys([B[B)V" />
+ <method name="setOnEventListener(Landroid/media/MediaDrm$OnEventListener;)V" />
+ <method name="setPropertyByteArray(Ljava/lang/String;[B)V" />
+ <method name="setPropertyString(Ljava/lang/String;Ljava/lang/String;)V" />
+ <field name="EVENT_KEY_EXPIRED" />
+ <field name="EVENT_KEY_REQUIRED" />
+ <field name="EVENT_PROVISION_REQUIRED" />
+ <field name="EVENT_VENDOR_DEFINED" />
+ <field name="KEY_TYPE_OFFLINE" />
+ <field name="KEY_TYPE_RELEASE" />
+ <field name="KEY_TYPE_STREAMING" />
+ <field name="PROPERTY_ALGORITHMS" />
+ <field name="PROPERTY_DESCRIPTION" />
+ <field name="PROPERTY_DEVICE_UNIQUE_ID" />
+ <field name="PROPERTY_VENDOR" />
+ <field name="PROPERTY_VERSION" />
+ </class>
+ <class name="android/media/MediaDrm$CryptoSession" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>(Landroid/media/MediaDrm;)V" />
+ <method name="decrypt([B[B[B)[B" />
+ <method name="encrypt([B[B[B)[B" />
+ <method name="sign([B[B)[B" />
+ <method name="verify([B[B[B)Z" />
+ </class>
+ <class name="android/media/MediaDrm$KeyRequest" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="getData()[B" />
+ <method name="getDefaultUrl()Ljava/lang/String;" />
+ </class>
+ <class name="android/media/MediaDrm$OnEventListener" since="18">
+ <extends name="java/lang/Object" />
+ <method name="onEvent(Landroid/media/MediaDrm;[BII[B)V" />
+ </class>
+ <class name="android/media/MediaDrm$ProvisionRequest" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="getData()[B" />
+ <method name="getDefaultUrl()Ljava/lang/String;" />
+ </class>
+ <class name="android/media/MediaDrmException" since="18">
+ <extends name="java/lang/Exception" />
+ <method name="&lt;init>(Ljava/lang/String;)V" />
+ </class>
<class name="android/media/MediaExtractor" since="16">
<extends name="java/lang/Object" />
<method name="&lt;init>()V" />
<method name="advance()Z" />
<method name="getCachedDuration()J" />
+ <method name="getPsshInfo()Ljava/util/Map;" since="18" />
<method name="getSampleCryptoInfo(Landroid/media/MediaCodec$CryptoInfo;)Z" />
<method name="getSampleFlags()I" />
<method name="getSampleTime()J" />
@@ -11169,6 +11626,21 @@
<field name="OPTION_NEXT_SYNC" />
<field name="OPTION_PREVIOUS_SYNC" />
</class>
+ <class name="android/media/MediaMuxer" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>(Ljava/lang/String;I)V" />
+ <method name="addTrack(Landroid/media/MediaFormat;)I" />
+ <method name="release()V" />
+ <method name="setOrientationHint(I)V" />
+ <method name="start()V" />
+ <method name="stop()V" />
+ <method name="writeSampleData(ILjava/nio/ByteBuffer;Landroid/media/MediaCodec$BufferInfo;)V" />
+ </class>
+ <class name="android/media/MediaMuxer$OutputFormat" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <field name="MUXER_OUTPUT_MPEG_4" />
+ </class>
<class name="android/media/MediaPlayer" since="1">
<extends name="java/lang/Object" />
<method name="&lt;init>()V" />
@@ -11384,6 +11856,7 @@
<extends name="java/lang/Object" />
<method name="&lt;init>()V" />
<method name="addCallback(ILandroid/media/MediaRouter$Callback;)V" />
+ <method name="addCallback(ILandroid/media/MediaRouter$Callback;I)V" since="18" />
<method name="addUserRoute(Landroid/media/MediaRouter$UserRouteInfo;)V" />
<method name="clearUserRoutes()V" />
<method name="createRouteCategory(IZ)Landroid/media/MediaRouter$RouteCategory;" />
@@ -11391,12 +11864,15 @@
<method name="createUserRoute(Landroid/media/MediaRouter$RouteCategory;)Landroid/media/MediaRouter$UserRouteInfo;" />
<method name="getCategoryAt(I)Landroid/media/MediaRouter$RouteCategory;" />
<method name="getCategoryCount()I" />
+ <method name="getDefaultRoute()Landroid/media/MediaRouter$RouteInfo;" since="18" />
<method name="getRouteAt(I)Landroid/media/MediaRouter$RouteInfo;" />
<method name="getRouteCount()I" />
<method name="getSelectedRoute(I)Landroid/media/MediaRouter$RouteInfo;" />
<method name="removeCallback(Landroid/media/MediaRouter$Callback;)V" />
<method name="removeUserRoute(Landroid/media/MediaRouter$UserRouteInfo;)V" />
<method name="selectRoute(ILandroid/media/MediaRouter$RouteInfo;)V" />
+ <field name="CALLBACK_FLAG_PERFORM_ACTIVE_SCAN" since="18" />
+ <field name="CALLBACK_FLAG_UNFILTERED_EVENTS" since="18" />
<field name="ROUTE_TYPE_LIVE_AUDIO" />
<field name="ROUTE_TYPE_LIVE_VIDEO" since="17" />
<field name="ROUTE_TYPE_USER" />
@@ -11439,6 +11915,7 @@
<extends name="java/lang/Object" />
<method name="&lt;init>()V" />
<method name="getCategory()Landroid/media/MediaRouter$RouteCategory;" />
+ <method name="getDescription()Ljava/lang/CharSequence;" since="18" />
<method name="getGroup()Landroid/media/MediaRouter$RouteGroup;" />
<method name="getIconDrawable()Landroid/graphics/drawable/Drawable;" />
<method name="getName()Ljava/lang/CharSequence;" />
@@ -11452,6 +11929,7 @@
<method name="getVolume()I" />
<method name="getVolumeHandling()I" />
<method name="getVolumeMax()I" />
+ <method name="isConnecting()Z" since="18" />
<method name="isEnabled()Z" since="17" />
<method name="requestSetVolume(I)V" />
<method name="requestUpdateVolume(I)V" />
@@ -11469,6 +11947,7 @@
<extends name="android/media/MediaRouter$RouteInfo" />
<method name="&lt;init>()V" />
<method name="getRemoteControlClient()Landroid/media/RemoteControlClient;" />
+ <method name="setDescription(Ljava/lang/CharSequence;)V" since="18" />
<method name="setIconDrawable(Landroid/graphics/drawable/Drawable;)V" />
<method name="setIconResource(I)V" />
<method name="setName(I)V" />
@@ -11518,18 +11997,26 @@
<field name="SYNC_EVENT_NONE" />
<field name="SYNC_EVENT_PRESENTATION_COMPLETE" />
</class>
+ <class name="android/media/NotProvisionedException" since="18">
+ <extends name="android/media/MediaDrmException" />
+ <method name="&lt;init>(Ljava/lang/String;)V" />
+ </class>
<class name="android/media/RemoteControlClient" since="14">
<extends name="java/lang/Object" />
<method name="&lt;init>(Landroid/app/PendingIntent;)V" />
<method name="&lt;init>(Landroid/app/PendingIntent;Landroid/os/Looper;)V" />
<method name="editMetadata(Z)Landroid/media/RemoteControlClient$MetadataEditor;" />
+ <method name="setOnGetPlaybackPositionListener(Landroid/media/RemoteControlClient$OnGetPlaybackPositionListener;)V" since="18" />
+ <method name="setPlaybackPositionUpdateListener(Landroid/media/RemoteControlClient$OnPlaybackPositionUpdateListener;)V" since="18" />
<method name="setPlaybackState(I)V" />
+ <method name="setPlaybackState(IJF)V" since="18" />
<method name="setTransportControlFlags(I)V" />
<field name="FLAG_KEY_MEDIA_FAST_FORWARD" />
<field name="FLAG_KEY_MEDIA_NEXT" />
<field name="FLAG_KEY_MEDIA_PAUSE" />
<field name="FLAG_KEY_MEDIA_PLAY" />
<field name="FLAG_KEY_MEDIA_PLAY_PAUSE" />
+ <field name="FLAG_KEY_MEDIA_POSITION_UPDATE" since="18" />
<field name="FLAG_KEY_MEDIA_PREVIOUS" />
<field name="FLAG_KEY_MEDIA_REWIND" />
<field name="FLAG_KEY_MEDIA_STOP" />
@@ -11553,6 +12040,14 @@
<method name="putString(ILjava/lang/String;)Landroid/media/RemoteControlClient$MetadataEditor;" />
<field name="BITMAP_KEY_ARTWORK" />
</class>
+ <class name="android/media/RemoteControlClient$OnGetPlaybackPositionListener" since="18">
+ <extends name="java/lang/Object" />
+ <method name="onGetPlaybackPosition()J" />
+ </class>
+ <class name="android/media/RemoteControlClient$OnPlaybackPositionUpdateListener" since="18">
+ <extends name="java/lang/Object" />
+ <method name="onPlaybackPositionUpdate(J)V" />
+ </class>
<class name="android/media/Ringtone" since="1">
<extends name="java/lang/Object" />
<method name="&lt;init>()V" />
@@ -11751,6 +12246,10 @@
<field name="TONE_SUP_RADIO_NOTAVAIL" />
<field name="TONE_SUP_RINGTONE" />
</class>
+ <class name="android/media/UnsupportedSchemeException" since="18">
+ <extends name="android/media/MediaDrmException" />
+ <method name="&lt;init>(Ljava/lang/String;)V" />
+ </class>
<class name="android/media/audiofx/AcousticEchoCanceler" since="16">
<extends name="android/media/audiofx/AudioEffect" />
<method name="&lt;init>()V" />
@@ -11779,6 +12278,14 @@
<field name="CONTENT_TYPE_VOICE" />
<field name="EFFECT_AUXILIARY" />
<field name="EFFECT_INSERT" />
+ <field name="EFFECT_TYPE_AEC" since="18" />
+ <field name="EFFECT_TYPE_AGC" since="18" />
+ <field name="EFFECT_TYPE_BASS_BOOST" since="18" />
+ <field name="EFFECT_TYPE_ENV_REVERB" since="18" />
+ <field name="EFFECT_TYPE_EQUALIZER" since="18" />
+ <field name="EFFECT_TYPE_NS" since="18" />
+ <field name="EFFECT_TYPE_PRESET_REVERB" since="18" />
+ <field name="EFFECT_TYPE_VIRTUALIZER" since="18" />
<field name="ERROR" />
<field name="ERROR_BAD_VALUE" />
<field name="ERROR_DEAD_OBJECT" />
@@ -12999,6 +13506,7 @@
<field name="allowedKeyManagement" />
<field name="allowedPairwiseCiphers" />
<field name="allowedProtocols" />
+ <field name="enterpriseConfig" since="18" />
<field name="hiddenSSID" />
<field name="networkId" />
<field name="preSharedKey" />
@@ -13061,6 +13569,47 @@
<field name="ENABLED" />
<field name="strings" />
</class>
+ <class name="android/net/wifi/WifiEnterpriseConfig" since="18">
+ <extends name="java/lang/Object" />
+ <implements name="android/os/Parcelable" />
+ <method name="&lt;init>()V" />
+ <method name="&lt;init>(Landroid/net/wifi/WifiEnterpriseConfig;)V" />
+ <method name="getAnonymousIdentity()Ljava/lang/String;" />
+ <method name="getCaCertificate()Ljava/security/cert/X509Certificate;" />
+ <method name="getClientCertificate()Ljava/security/cert/X509Certificate;" />
+ <method name="getEapMethod()I" />
+ <method name="getIdentity()Ljava/lang/String;" />
+ <method name="getPassword()Ljava/lang/String;" />
+ <method name="getPhase2Method()I" />
+ <method name="getSubjectMatch()Ljava/lang/String;" />
+ <method name="setAnonymousIdentity(Ljava/lang/String;)V" />
+ <method name="setCaCertificate(Ljava/security/cert/X509Certificate;)V" />
+ <method name="setClientKeyEntry(Ljava/security/PrivateKey;Ljava/security/cert/X509Certificate;)V" />
+ <method name="setEapMethod(I)V" />
+ <method name="setIdentity(Ljava/lang/String;)V" />
+ <method name="setPassword(Ljava/lang/String;)V" />
+ <method name="setPhase2Method(I)V" />
+ <method name="setSubjectMatch(Ljava/lang/String;)V" />
+ <field name="CREATOR" />
+ </class>
+ <class name="android/net/wifi/WifiEnterpriseConfig$Eap" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <field name="NONE" />
+ <field name="PEAP" />
+ <field name="PWD" />
+ <field name="TLS" />
+ <field name="TTLS" />
+ </class>
+ <class name="android/net/wifi/WifiEnterpriseConfig$Phase2" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <field name="GTC" />
+ <field name="MSCHAP" />
+ <field name="MSCHAPV2" />
+ <field name="NONE" />
+ <field name="PAP" />
+ </class>
<class name="android/net/wifi/WifiInfo" since="1">
<extends name="java/lang/Object" />
<implements name="android/os/Parcelable" />
@@ -13094,6 +13643,7 @@
<method name="getDhcpInfo()Landroid/net/DhcpInfo;" />
<method name="getScanResults()Ljava/util/List;" />
<method name="getWifiState()I" />
+ <method name="isScanAlwaysAvailable()Z" since="18" />
<method name="isWifiEnabled()Z" />
<method name="pingSupplicant()Z" />
<method name="reassociate()Z" />
@@ -13104,6 +13654,7 @@
<method name="startScan()Z" />
<method name="updateNetwork(Landroid/net/wifi/WifiConfiguration;)I" />
<field name="ACTION_PICK_WIFI_NETWORK" />
+ <field name="ACTION_REQUEST_SCAN_ALWAYS_AVAILABLE" since="18" />
<field name="ERROR_AUTHENTICATING" />
<field name="EXTRA_BSSID" />
<field name="EXTRA_NETWORK_INFO" />
@@ -13198,6 +13749,7 @@
<implements name="android/os/Parcelable" />
<method name="&lt;init>()V" />
<method name="&lt;init>(Landroid/net/wifi/p2p/WifiP2pDeviceList;)V" />
+ <method name="get(Ljava/lang/String;)Landroid/net/wifi/p2p/WifiP2pDevice;" since="18" />
<method name="getDeviceList()Ljava/util/Collection;" />
<field name="CREATOR" />
</class>
@@ -13251,7 +13803,9 @@
<field name="ERROR" />
<field name="EXTRA_DISCOVERY_STATE" since="16" />
<field name="EXTRA_NETWORK_INFO" />
+ <field name="EXTRA_P2P_DEVICE_LIST" since="18" />
<field name="EXTRA_WIFI_P2P_DEVICE" />
+ <field name="EXTRA_WIFI_P2P_GROUP" since="18" />
<field name="EXTRA_WIFI_P2P_INFO" />
<field name="EXTRA_WIFI_STATE" />
<field name="NO_SERVICE_REQUESTS" since="16" />
@@ -13412,12 +13966,18 @@
<method name="setNdefPushMessage(Landroid/nfc/NdefMessage;Landroid/app/Activity;[Landroid/app/Activity;)V" since="14" />
<method name="setNdefPushMessageCallback(Landroid/nfc/NfcAdapter$CreateNdefMessageCallback;Landroid/app/Activity;[Landroid/app/Activity;)V" since="14" />
<method name="setOnNdefPushCompleteCallback(Landroid/nfc/NfcAdapter$OnNdefPushCompleteCallback;Landroid/app/Activity;[Landroid/app/Activity;)V" since="14" />
+ <field name="ACTION_ADAPTER_STATE_CHANGED" since="18" />
<field name="ACTION_NDEF_DISCOVERED" since="10" />
<field name="ACTION_TAG_DISCOVERED" />
<field name="ACTION_TECH_DISCOVERED" since="10" />
+ <field name="EXTRA_ADAPTER_STATE" since="18" />
<field name="EXTRA_ID" />
<field name="EXTRA_NDEF_MESSAGES" />
<field name="EXTRA_TAG" since="10" />
+ <field name="STATE_OFF" since="18" />
+ <field name="STATE_ON" since="18" />
+ <field name="STATE_TURNING_OFF" since="18" />
+ <field name="STATE_TURNING_ON" since="18" />
</class>
<class name="android/nfc/NfcAdapter$CreateBeamUrisCallback" since="16">
<extends name="java/lang/Object" />
@@ -13767,6 +14327,15 @@
<extends name="android/opengl/EGLObjectHandle" />
<method name="&lt;init>()V" />
</class>
+ <class name="android/opengl/EGLExt" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="eglPresentationTimeANDROID(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;J)Z" />
+ <field name="EGL_CONTEXT_FLAGS_KHR" />
+ <field name="EGL_CONTEXT_MAJOR_VERSION_KHR" />
+ <field name="EGL_CONTEXT_MINOR_VERSION_KHR" />
+ <field name="EGL_OPENGL_ES3_BIT_KHR" />
+ </class>
<class name="android/opengl/EGLObjectHandle" since="17">
<extends name="java/lang/Object" />
<method name="&lt;init>(I)V" />
@@ -15115,6 +15684,476 @@
<field name="GL_VIEWPORT" />
<field name="GL_ZERO" />
</class>
+ <class name="android/opengl/GLES30" since="18">
+ <extends name="android/opengl/GLES20" />
+ <method name="&lt;init>()V" />
+ <method name="glBeginQuery(II)V" />
+ <method name="glBeginTransformFeedback(I)V" />
+ <method name="glBindBufferBase(III)V" />
+ <method name="glBindBufferRange(IIIII)V" />
+ <method name="glBindSampler(II)V" />
+ <method name="glBindTransformFeedback(II)V" />
+ <method name="glBindVertexArray(I)V" />
+ <method name="glBlitFramebuffer(IIIIIIIIII)V" />
+ <method name="glClearBufferfi(IIFI)V" />
+ <method name="glClearBufferfv(IILjava/nio/FloatBuffer;)V" />
+ <method name="glClearBufferfv(II[FI)V" />
+ <method name="glClearBufferiv(IILjava/nio/IntBuffer;)V" />
+ <method name="glClearBufferiv(II[II)V" />
+ <method name="glClearBufferuiv(IILjava/nio/IntBuffer;)V" />
+ <method name="glClearBufferuiv(II[II)V" />
+ <method name="glClientWaitSync(JIJ)I" />
+ <method name="glCompressedTexImage3D(IIIIIIIII)V" />
+ <method name="glCompressedTexImage3D(IIIIIIIILjava/nio/Buffer;)V" />
+ <method name="glCompressedTexSubImage3D(IIIIIIIIIII)V" />
+ <method name="glCompressedTexSubImage3D(IIIIIIIIIILjava/nio/Buffer;)V" />
+ <method name="glCopyBufferSubData(IIIII)V" />
+ <method name="glCopyTexSubImage3D(IIIIIIIII)V" />
+ <method name="glDeleteQueries(ILjava/nio/IntBuffer;)V" />
+ <method name="glDeleteQueries(I[II)V" />
+ <method name="glDeleteSamplers(ILjava/nio/IntBuffer;)V" />
+ <method name="glDeleteSamplers(I[II)V" />
+ <method name="glDeleteSync(J)V" />
+ <method name="glDeleteTransformFeedbacks(ILjava/nio/IntBuffer;)V" />
+ <method name="glDeleteTransformFeedbacks(I[II)V" />
+ <method name="glDeleteVertexArrays(ILjava/nio/IntBuffer;)V" />
+ <method name="glDeleteVertexArrays(I[II)V" />
+ <method name="glDrawArraysInstanced(IIII)V" />
+ <method name="glDrawBuffers(ILjava/nio/IntBuffer;)V" />
+ <method name="glDrawBuffers(I[II)V" />
+ <method name="glDrawElementsInstanced(IIIII)V" />
+ <method name="glDrawElementsInstanced(IIILjava/nio/Buffer;I)V" />
+ <method name="glDrawRangeElements(IIIIII)V" />
+ <method name="glDrawRangeElements(IIIIILjava/nio/Buffer;)V" />
+ <method name="glEndQuery(I)V" />
+ <method name="glEndTransformFeedback()V" />
+ <method name="glFenceSync(II)J" />
+ <method name="glFlushMappedBufferRange(III)V" />
+ <method name="glFramebufferTextureLayer(IIIII)V" />
+ <method name="glGenQueries(ILjava/nio/IntBuffer;)V" />
+ <method name="glGenQueries(I[II)V" />
+ <method name="glGenSamplers(ILjava/nio/IntBuffer;)V" />
+ <method name="glGenSamplers(I[II)V" />
+ <method name="glGenTransformFeedbacks(ILjava/nio/IntBuffer;)V" />
+ <method name="glGenTransformFeedbacks(I[II)V" />
+ <method name="glGenVertexArrays(ILjava/nio/IntBuffer;)V" />
+ <method name="glGenVertexArrays(I[II)V" />
+ <method name="glGetActiveUniformBlockName(II)Ljava/lang/String;" />
+ <method name="glGetActiveUniformBlockName(III[II[BI)V" />
+ <method name="glGetActiveUniformBlockName(IILjava/nio/Buffer;Ljava/nio/Buffer;)V" />
+ <method name="glGetActiveUniformBlockiv(IIILjava/nio/IntBuffer;)V" />
+ <method name="glGetActiveUniformBlockiv(III[II)V" />
+ <method name="glGetActiveUniformsiv(IILjava/nio/IntBuffer;ILjava/nio/IntBuffer;)V" />
+ <method name="glGetActiveUniformsiv(II[III[II)V" />
+ <method name="glGetBufferParameteri64v(IILjava/nio/LongBuffer;)V" />
+ <method name="glGetBufferParameteri64v(II[JI)V" />
+ <method name="glGetBufferPointerv(II)Ljava/nio/Buffer;" />
+ <method name="glGetFragDataLocation(ILjava/lang/String;)I" />
+ <method name="glGetInteger64i_v(IILjava/nio/LongBuffer;)V" />
+ <method name="glGetInteger64i_v(II[JI)V" />
+ <method name="glGetInteger64v(ILjava/nio/LongBuffer;)V" />
+ <method name="glGetInteger64v(I[JI)V" />
+ <method name="glGetIntegeri_v(IILjava/nio/IntBuffer;)V" />
+ <method name="glGetIntegeri_v(II[II)V" />
+ <method name="glGetInternalformativ(IIIILjava/nio/IntBuffer;)V" />
+ <method name="glGetInternalformativ(IIII[II)V" />
+ <method name="glGetProgramBinary(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/Buffer;)V" />
+ <method name="glGetProgramBinary(II[II[IILjava/nio/Buffer;)V" />
+ <method name="glGetQueryObjectuiv(IILjava/nio/IntBuffer;)V" />
+ <method name="glGetQueryObjectuiv(II[II)V" />
+ <method name="glGetQueryiv(IILjava/nio/IntBuffer;)V" />
+ <method name="glGetQueryiv(II[II)V" />
+ <method name="glGetSamplerParameterfv(IILjava/nio/FloatBuffer;)V" />
+ <method name="glGetSamplerParameterfv(II[FI)V" />
+ <method name="glGetSamplerParameteriv(IILjava/nio/IntBuffer;)V" />
+ <method name="glGetSamplerParameteriv(II[II)V" />
+ <method name="glGetStringi(II)Ljava/lang/String;" />
+ <method name="glGetSynciv(JIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V" />
+ <method name="glGetSynciv(JII[II[II)V" />
+ <method name="glGetTransformFeedbackVarying(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V" />
+ <method name="glGetTransformFeedbackVarying(III[II[II[II[BI)V" />
+ <method name="glGetTransformFeedbackVarying(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;" />
+ <method name="glGetTransformFeedbackVarying(II[II[II)Ljava/lang/String;" />
+ <method name="glGetUniformBlockIndex(ILjava/lang/String;)I" />
+ <method name="glGetUniformIndices(I[Ljava/lang/String;Ljava/nio/IntBuffer;)V" />
+ <method name="glGetUniformIndices(I[Ljava/lang/String;[II)V" />
+ <method name="glGetUniformuiv(IILjava/nio/IntBuffer;)V" />
+ <method name="glGetUniformuiv(II[II)V" />
+ <method name="glGetVertexAttribIiv(IILjava/nio/IntBuffer;)V" />
+ <method name="glGetVertexAttribIiv(II[II)V" />
+ <method name="glGetVertexAttribIuiv(IILjava/nio/IntBuffer;)V" />
+ <method name="glGetVertexAttribIuiv(II[II)V" />
+ <method name="glInvalidateFramebuffer(IILjava/nio/IntBuffer;)V" />
+ <method name="glInvalidateFramebuffer(II[II)V" />
+ <method name="glInvalidateSubFramebuffer(IILjava/nio/IntBuffer;IIII)V" />
+ <method name="glInvalidateSubFramebuffer(II[IIIIII)V" />
+ <method name="glIsQuery(I)Z" />
+ <method name="glIsSampler(I)Z" />
+ <method name="glIsSync(J)Z" />
+ <method name="glIsTransformFeedback(I)Z" />
+ <method name="glIsVertexArray(I)Z" />
+ <method name="glMapBufferRange(IIII)Ljava/nio/Buffer;" />
+ <method name="glPauseTransformFeedback()V" />
+ <method name="glProgramBinary(IILjava/nio/Buffer;I)V" />
+ <method name="glProgramParameteri(III)V" />
+ <method name="glReadBuffer(I)V" />
+ <method name="glRenderbufferStorageMultisample(IIIII)V" />
+ <method name="glResumeTransformFeedback()V" />
+ <method name="glSamplerParameterf(IIF)V" />
+ <method name="glSamplerParameterfv(IILjava/nio/FloatBuffer;)V" />
+ <method name="glSamplerParameterfv(II[FI)V" />
+ <method name="glSamplerParameteri(III)V" />
+ <method name="glSamplerParameteriv(IILjava/nio/IntBuffer;)V" />
+ <method name="glSamplerParameteriv(II[II)V" />
+ <method name="glTexImage3D(IIIIIIIIII)V" />
+ <method name="glTexImage3D(IIIIIIIIILjava/nio/Buffer;)V" />
+ <method name="glTexStorage2D(IIIII)V" />
+ <method name="glTexStorage3D(IIIIII)V" />
+ <method name="glTexSubImage3D(IIIIIIIIIII)V" />
+ <method name="glTexSubImage3D(IIIIIIIIIILjava/nio/Buffer;)V" />
+ <method name="glTransformFeedbackVaryings(I[Ljava/lang/String;I)V" />
+ <method name="glUniform1ui(II)V" />
+ <method name="glUniform1uiv(IILjava/nio/IntBuffer;)V" />
+ <method name="glUniform1uiv(II[II)V" />
+ <method name="glUniform2ui(III)V" />
+ <method name="glUniform2uiv(IILjava/nio/IntBuffer;)V" />
+ <method name="glUniform2uiv(II[II)V" />
+ <method name="glUniform3ui(IIII)V" />
+ <method name="glUniform3uiv(IILjava/nio/IntBuffer;)V" />
+ <method name="glUniform3uiv(II[II)V" />
+ <method name="glUniform4ui(IIIII)V" />
+ <method name="glUniform4uiv(IILjava/nio/IntBuffer;)V" />
+ <method name="glUniform4uiv(II[II)V" />
+ <method name="glUniformBlockBinding(III)V" />
+ <method name="glUniformMatrix2x3fv(IIZLjava/nio/FloatBuffer;)V" />
+ <method name="glUniformMatrix2x3fv(IIZ[FI)V" />
+ <method name="glUniformMatrix2x4fv(IIZLjava/nio/FloatBuffer;)V" />
+ <method name="glUniformMatrix2x4fv(IIZ[FI)V" />
+ <method name="glUniformMatrix3x2fv(IIZLjava/nio/FloatBuffer;)V" />
+ <method name="glUniformMatrix3x2fv(IIZ[FI)V" />
+ <method name="glUniformMatrix3x4fv(IIZLjava/nio/FloatBuffer;)V" />
+ <method name="glUniformMatrix3x4fv(IIZ[FI)V" />
+ <method name="glUniformMatrix4x2fv(IIZLjava/nio/FloatBuffer;)V" />
+ <method name="glUniformMatrix4x2fv(IIZ[FI)V" />
+ <method name="glUniformMatrix4x3fv(IIZLjava/nio/FloatBuffer;)V" />
+ <method name="glUniformMatrix4x3fv(IIZ[FI)V" />
+ <method name="glUnmapBuffer(I)Z" />
+ <method name="glVertexAttribDivisor(II)V" />
+ <method name="glVertexAttribI4i(IIIII)V" />
+ <method name="glVertexAttribI4iv(ILjava/nio/IntBuffer;)V" />
+ <method name="glVertexAttribI4iv(I[II)V" />
+ <method name="glVertexAttribI4ui(IIIII)V" />
+ <method name="glVertexAttribI4uiv(ILjava/nio/IntBuffer;)V" />
+ <method name="glVertexAttribI4uiv(I[II)V" />
+ <method name="glVertexAttribIPointer(IIIII)V" />
+ <method name="glVertexAttribIPointer(IIIILjava/nio/Buffer;)V" />
+ <method name="glWaitSync(JIJ)V" />
+ <field name="GL_ACTIVE_UNIFORM_BLOCKS" />
+ <field name="GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH" />
+ <field name="GL_ALREADY_SIGNALED" />
+ <field name="GL_ANY_SAMPLES_PASSED" />
+ <field name="GL_ANY_SAMPLES_PASSED_CONSERVATIVE" />
+ <field name="GL_BLUE" />
+ <field name="GL_BUFFER_ACCESS_FLAGS" />
+ <field name="GL_BUFFER_MAPPED" />
+ <field name="GL_BUFFER_MAP_LENGTH" />
+ <field name="GL_BUFFER_MAP_OFFSET" />
+ <field name="GL_BUFFER_MAP_POINTER" />
+ <field name="GL_COLOR" />
+ <field name="GL_COLOR_ATTACHMENT1" />
+ <field name="GL_COLOR_ATTACHMENT10" />
+ <field name="GL_COLOR_ATTACHMENT11" />
+ <field name="GL_COLOR_ATTACHMENT12" />
+ <field name="GL_COLOR_ATTACHMENT13" />
+ <field name="GL_COLOR_ATTACHMENT14" />
+ <field name="GL_COLOR_ATTACHMENT15" />
+ <field name="GL_COLOR_ATTACHMENT2" />
+ <field name="GL_COLOR_ATTACHMENT3" />
+ <field name="GL_COLOR_ATTACHMENT4" />
+ <field name="GL_COLOR_ATTACHMENT5" />
+ <field name="GL_COLOR_ATTACHMENT6" />
+ <field name="GL_COLOR_ATTACHMENT7" />
+ <field name="GL_COLOR_ATTACHMENT8" />
+ <field name="GL_COLOR_ATTACHMENT9" />
+ <field name="GL_COMPARE_REF_TO_TEXTURE" />
+ <field name="GL_COMPRESSED_R11_EAC" />
+ <field name="GL_COMPRESSED_RG11_EAC" />
+ <field name="GL_COMPRESSED_RGB8_ETC2" />
+ <field name="GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2" />
+ <field name="GL_COMPRESSED_RGBA8_ETC2_EAC" />
+ <field name="GL_COMPRESSED_SIGNED_R11_EAC" />
+ <field name="GL_COMPRESSED_SIGNED_RG11_EAC" />
+ <field name="GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC" />
+ <field name="GL_COMPRESSED_SRGB8_ETC2" />
+ <field name="GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2" />
+ <field name="GL_CONDITION_SATISFIED" />
+ <field name="GL_COPY_READ_BUFFER" />
+ <field name="GL_COPY_READ_BUFFER_BINDING" />
+ <field name="GL_COPY_WRITE_BUFFER" />
+ <field name="GL_COPY_WRITE_BUFFER_BINDING" />
+ <field name="GL_CURRENT_QUERY" />
+ <field name="GL_DEPTH" />
+ <field name="GL_DEPTH24_STENCIL8" />
+ <field name="GL_DEPTH32F_STENCIL8" />
+ <field name="GL_DEPTH_COMPONENT24" />
+ <field name="GL_DEPTH_COMPONENT32F" />
+ <field name="GL_DEPTH_STENCIL" />
+ <field name="GL_DEPTH_STENCIL_ATTACHMENT" />
+ <field name="GL_DRAW_BUFFER0" />
+ <field name="GL_DRAW_BUFFER1" />
+ <field name="GL_DRAW_BUFFER10" />
+ <field name="GL_DRAW_BUFFER11" />
+ <field name="GL_DRAW_BUFFER12" />
+ <field name="GL_DRAW_BUFFER13" />
+ <field name="GL_DRAW_BUFFER14" />
+ <field name="GL_DRAW_BUFFER15" />
+ <field name="GL_DRAW_BUFFER2" />
+ <field name="GL_DRAW_BUFFER3" />
+ <field name="GL_DRAW_BUFFER4" />
+ <field name="GL_DRAW_BUFFER5" />
+ <field name="GL_DRAW_BUFFER6" />
+ <field name="GL_DRAW_BUFFER7" />
+ <field name="GL_DRAW_BUFFER8" />
+ <field name="GL_DRAW_BUFFER9" />
+ <field name="GL_DRAW_FRAMEBUFFER" />
+ <field name="GL_DRAW_FRAMEBUFFER_BINDING" />
+ <field name="GL_DYNAMIC_COPY" />
+ <field name="GL_DYNAMIC_READ" />
+ <field name="GL_FLOAT_32_UNSIGNED_INT_24_8_REV" />
+ <field name="GL_FLOAT_MAT2x3" />
+ <field name="GL_FLOAT_MAT2x4" />
+ <field name="GL_FLOAT_MAT3x2" />
+ <field name="GL_FLOAT_MAT3x4" />
+ <field name="GL_FLOAT_MAT4x2" />
+ <field name="GL_FLOAT_MAT4x3" />
+ <field name="GL_FRAGMENT_SHADER_DERIVATIVE_HINT" />
+ <field name="GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE" />
+ <field name="GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE" />
+ <field name="GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING" />
+ <field name="GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE" />
+ <field name="GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE" />
+ <field name="GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE" />
+ <field name="GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE" />
+ <field name="GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE" />
+ <field name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER" />
+ <field name="GL_FRAMEBUFFER_DEFAULT" />
+ <field name="GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE" />
+ <field name="GL_FRAMEBUFFER_UNDEFINED" />
+ <field name="GL_GREEN" />
+ <field name="GL_HALF_FLOAT" />
+ <field name="GL_INTERLEAVED_ATTRIBS" />
+ <field name="GL_INT_2_10_10_10_REV" />
+ <field name="GL_INT_SAMPLER_2D" />
+ <field name="GL_INT_SAMPLER_2D_ARRAY" />
+ <field name="GL_INT_SAMPLER_3D" />
+ <field name="GL_INT_SAMPLER_CUBE" />
+ <field name="GL_INVALID_INDEX" />
+ <field name="GL_MAJOR_VERSION" />
+ <field name="GL_MAP_FLUSH_EXPLICIT_BIT" />
+ <field name="GL_MAP_INVALIDATE_BUFFER_BIT" />
+ <field name="GL_MAP_INVALIDATE_RANGE_BIT" />
+ <field name="GL_MAP_READ_BIT" />
+ <field name="GL_MAP_UNSYNCHRONIZED_BIT" />
+ <field name="GL_MAP_WRITE_BIT" />
+ <field name="GL_MAX" />
+ <field name="GL_MAX_3D_TEXTURE_SIZE" />
+ <field name="GL_MAX_ARRAY_TEXTURE_LAYERS" />
+ <field name="GL_MAX_COLOR_ATTACHMENTS" />
+ <field name="GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS" />
+ <field name="GL_MAX_COMBINED_UNIFORM_BLOCKS" />
+ <field name="GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS" />
+ <field name="GL_MAX_DRAW_BUFFERS" />
+ <field name="GL_MAX_ELEMENTS_INDICES" />
+ <field name="GL_MAX_ELEMENTS_VERTICES" />
+ <field name="GL_MAX_ELEMENT_INDEX" />
+ <field name="GL_MAX_FRAGMENT_INPUT_COMPONENTS" />
+ <field name="GL_MAX_FRAGMENT_UNIFORM_BLOCKS" />
+ <field name="GL_MAX_FRAGMENT_UNIFORM_COMPONENTS" />
+ <field name="GL_MAX_PROGRAM_TEXEL_OFFSET" />
+ <field name="GL_MAX_SAMPLES" />
+ <field name="GL_MAX_SERVER_WAIT_TIMEOUT" />
+ <field name="GL_MAX_TEXTURE_LOD_BIAS" />
+ <field name="GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS" />
+ <field name="GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS" />
+ <field name="GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS" />
+ <field name="GL_MAX_UNIFORM_BLOCK_SIZE" />
+ <field name="GL_MAX_UNIFORM_BUFFER_BINDINGS" />
+ <field name="GL_MAX_VARYING_COMPONENTS" />
+ <field name="GL_MAX_VERTEX_OUTPUT_COMPONENTS" />
+ <field name="GL_MAX_VERTEX_UNIFORM_BLOCKS" />
+ <field name="GL_MAX_VERTEX_UNIFORM_COMPONENTS" />
+ <field name="GL_MIN" />
+ <field name="GL_MINOR_VERSION" />
+ <field name="GL_MIN_PROGRAM_TEXEL_OFFSET" />
+ <field name="GL_NUM_EXTENSIONS" />
+ <field name="GL_NUM_PROGRAM_BINARY_FORMATS" />
+ <field name="GL_NUM_SAMPLE_COUNTS" />
+ <field name="GL_OBJECT_TYPE" />
+ <field name="GL_PACK_ROW_LENGTH" />
+ <field name="GL_PACK_SKIP_PIXELS" />
+ <field name="GL_PACK_SKIP_ROWS" />
+ <field name="GL_PIXEL_PACK_BUFFER" />
+ <field name="GL_PIXEL_PACK_BUFFER_BINDING" />
+ <field name="GL_PIXEL_UNPACK_BUFFER" />
+ <field name="GL_PIXEL_UNPACK_BUFFER_BINDING" />
+ <field name="GL_PRIMITIVE_RESTART_FIXED_INDEX" />
+ <field name="GL_PROGRAM_BINARY_FORMATS" />
+ <field name="GL_PROGRAM_BINARY_LENGTH" />
+ <field name="GL_PROGRAM_BINARY_RETRIEVABLE_HINT" />
+ <field name="GL_QUERY_RESULT" />
+ <field name="GL_QUERY_RESULT_AVAILABLE" />
+ <field name="GL_R11F_G11F_B10F" />
+ <field name="GL_R16F" />
+ <field name="GL_R16I" />
+ <field name="GL_R16UI" />
+ <field name="GL_R32F" />
+ <field name="GL_R32I" />
+ <field name="GL_R32UI" />
+ <field name="GL_R8" />
+ <field name="GL_R8I" />
+ <field name="GL_R8UI" />
+ <field name="GL_R8_SNORM" />
+ <field name="GL_RASTERIZER_DISCARD" />
+ <field name="GL_READ_BUFFER" />
+ <field name="GL_READ_FRAMEBUFFER" />
+ <field name="GL_READ_FRAMEBUFFER_BINDING" />
+ <field name="GL_RED" />
+ <field name="GL_RED_INTEGER" />
+ <field name="GL_RENDERBUFFER_SAMPLES" />
+ <field name="GL_RG" />
+ <field name="GL_RG16F" />
+ <field name="GL_RG16I" />
+ <field name="GL_RG16UI" />
+ <field name="GL_RG32F" />
+ <field name="GL_RG32I" />
+ <field name="GL_RG32UI" />
+ <field name="GL_RG8" />
+ <field name="GL_RG8I" />
+ <field name="GL_RG8UI" />
+ <field name="GL_RG8_SNORM" />
+ <field name="GL_RGB10_A2" />
+ <field name="GL_RGB10_A2UI" />
+ <field name="GL_RGB16F" />
+ <field name="GL_RGB16I" />
+ <field name="GL_RGB16UI" />
+ <field name="GL_RGB32F" />
+ <field name="GL_RGB32I" />
+ <field name="GL_RGB32UI" />
+ <field name="GL_RGB8" />
+ <field name="GL_RGB8I" />
+ <field name="GL_RGB8UI" />
+ <field name="GL_RGB8_SNORM" />
+ <field name="GL_RGB9_E5" />
+ <field name="GL_RGBA16F" />
+ <field name="GL_RGBA16I" />
+ <field name="GL_RGBA16UI" />
+ <field name="GL_RGBA32F" />
+ <field name="GL_RGBA32I" />
+ <field name="GL_RGBA32UI" />
+ <field name="GL_RGBA8" />
+ <field name="GL_RGBA8I" />
+ <field name="GL_RGBA8UI" />
+ <field name="GL_RGBA8_SNORM" />
+ <field name="GL_RGBA_INTEGER" />
+ <field name="GL_RGB_INTEGER" />
+ <field name="GL_RG_INTEGER" />
+ <field name="GL_SAMPLER_2D_ARRAY" />
+ <field name="GL_SAMPLER_2D_ARRAY_SHADOW" />
+ <field name="GL_SAMPLER_2D_SHADOW" />
+ <field name="GL_SAMPLER_3D" />
+ <field name="GL_SAMPLER_BINDING" />
+ <field name="GL_SAMPLER_CUBE_SHADOW" />
+ <field name="GL_SEPARATE_ATTRIBS" />
+ <field name="GL_SIGNALED" />
+ <field name="GL_SIGNED_NORMALIZED" />
+ <field name="GL_SRGB" />
+ <field name="GL_SRGB8" />
+ <field name="GL_SRGB8_ALPHA8" />
+ <field name="GL_STATIC_COPY" />
+ <field name="GL_STATIC_READ" />
+ <field name="GL_STENCIL" />
+ <field name="GL_STREAM_COPY" />
+ <field name="GL_STREAM_READ" />
+ <field name="GL_SYNC_CONDITION" />
+ <field name="GL_SYNC_FENCE" />
+ <field name="GL_SYNC_FLAGS" />
+ <field name="GL_SYNC_FLUSH_COMMANDS_BIT" />
+ <field name="GL_SYNC_GPU_COMMANDS_COMPLETE" />
+ <field name="GL_SYNC_STATUS" />
+ <field name="GL_TEXTURE_2D_ARRAY" />
+ <field name="GL_TEXTURE_3D" />
+ <field name="GL_TEXTURE_BASE_LEVEL" />
+ <field name="GL_TEXTURE_BINDING_2D_ARRAY" />
+ <field name="GL_TEXTURE_BINDING_3D" />
+ <field name="GL_TEXTURE_COMPARE_FUNC" />
+ <field name="GL_TEXTURE_COMPARE_MODE" />
+ <field name="GL_TEXTURE_IMMUTABLE_FORMAT" />
+ <field name="GL_TEXTURE_IMMUTABLE_LEVELS" />
+ <field name="GL_TEXTURE_MAX_LEVEL" />
+ <field name="GL_TEXTURE_MAX_LOD" />
+ <field name="GL_TEXTURE_MIN_LOD" />
+ <field name="GL_TEXTURE_SWIZZLE_A" />
+ <field name="GL_TEXTURE_SWIZZLE_B" />
+ <field name="GL_TEXTURE_SWIZZLE_G" />
+ <field name="GL_TEXTURE_SWIZZLE_R" />
+ <field name="GL_TEXTURE_WRAP_R" />
+ <field name="GL_TIMEOUT_EXPIRED" />
+ <field name="GL_TIMEOUT_IGNORED" />
+ <field name="GL_TRANSFORM_FEEDBACK" />
+ <field name="GL_TRANSFORM_FEEDBACK_ACTIVE" />
+ <field name="GL_TRANSFORM_FEEDBACK_BINDING" />
+ <field name="GL_TRANSFORM_FEEDBACK_BUFFER" />
+ <field name="GL_TRANSFORM_FEEDBACK_BUFFER_BINDING" />
+ <field name="GL_TRANSFORM_FEEDBACK_BUFFER_MODE" />
+ <field name="GL_TRANSFORM_FEEDBACK_BUFFER_SIZE" />
+ <field name="GL_TRANSFORM_FEEDBACK_BUFFER_START" />
+ <field name="GL_TRANSFORM_FEEDBACK_PAUSED" />
+ <field name="GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN" />
+ <field name="GL_TRANSFORM_FEEDBACK_VARYINGS" />
+ <field name="GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH" />
+ <field name="GL_UNIFORM_ARRAY_STRIDE" />
+ <field name="GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS" />
+ <field name="GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES" />
+ <field name="GL_UNIFORM_BLOCK_BINDING" />
+ <field name="GL_UNIFORM_BLOCK_DATA_SIZE" />
+ <field name="GL_UNIFORM_BLOCK_INDEX" />
+ <field name="GL_UNIFORM_BLOCK_NAME_LENGTH" />
+ <field name="GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER" />
+ <field name="GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER" />
+ <field name="GL_UNIFORM_BUFFER" />
+ <field name="GL_UNIFORM_BUFFER_BINDING" />
+ <field name="GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT" />
+ <field name="GL_UNIFORM_BUFFER_SIZE" />
+ <field name="GL_UNIFORM_BUFFER_START" />
+ <field name="GL_UNIFORM_IS_ROW_MAJOR" />
+ <field name="GL_UNIFORM_MATRIX_STRIDE" />
+ <field name="GL_UNIFORM_NAME_LENGTH" />
+ <field name="GL_UNIFORM_OFFSET" />
+ <field name="GL_UNIFORM_SIZE" />
+ <field name="GL_UNIFORM_TYPE" />
+ <field name="GL_UNPACK_IMAGE_HEIGHT" />
+ <field name="GL_UNPACK_ROW_LENGTH" />
+ <field name="GL_UNPACK_SKIP_IMAGES" />
+ <field name="GL_UNPACK_SKIP_PIXELS" />
+ <field name="GL_UNPACK_SKIP_ROWS" />
+ <field name="GL_UNSIGNALED" />
+ <field name="GL_UNSIGNED_INT_10F_11F_11F_REV" />
+ <field name="GL_UNSIGNED_INT_24_8" />
+ <field name="GL_UNSIGNED_INT_2_10_10_10_REV" />
+ <field name="GL_UNSIGNED_INT_5_9_9_9_REV" />
+ <field name="GL_UNSIGNED_INT_SAMPLER_2D" />
+ <field name="GL_UNSIGNED_INT_SAMPLER_2D_ARRAY" />
+ <field name="GL_UNSIGNED_INT_SAMPLER_3D" />
+ <field name="GL_UNSIGNED_INT_SAMPLER_CUBE" />
+ <field name="GL_UNSIGNED_INT_VEC2" />
+ <field name="GL_UNSIGNED_INT_VEC3" />
+ <field name="GL_UNSIGNED_INT_VEC4" />
+ <field name="GL_UNSIGNED_NORMALIZED" />
+ <field name="GL_VERTEX_ARRAY_BINDING" />
+ <field name="GL_VERTEX_ATTRIB_ARRAY_DIVISOR" />
+ <field name="GL_VERTEX_ATTRIB_ARRAY_INTEGER" />
+ <field name="GL_WAIT_FAILED" />
+ </class>
<class name="android/opengl/GLException" since="1">
<extends name="java/lang/RuntimeException" />
<method name="&lt;init>(I)V" />
@@ -15357,6 +16396,7 @@
<field name="ICE_CREAM_SANDWICH_MR1" since="15" />
<field name="JELLY_BEAN" since="16" />
<field name="JELLY_BEAN_MR1" since="17" />
+ <field name="JELLY_BEAN_MR2" since="18" />
</class>
<class name="android/os/Bundle" since="1">
<extends name="java/lang/Object" />
@@ -15369,6 +16409,7 @@
<method name="clear()V" />
<method name="containsKey(Ljava/lang/String;)Z" />
<method name="get(Ljava/lang/String;)Ljava/lang/Object;" />
+ <method name="getBinder(Ljava/lang/String;)Landroid/os/IBinder;" since="18" />
<method name="getBoolean(Ljava/lang/String;)Z" />
<method name="getBoolean(Ljava/lang/String;Z)Z" />
<method name="getBooleanArray(Ljava/lang/String;)[Z" />
@@ -15413,6 +16454,7 @@
<method name="isEmpty()Z" />
<method name="keySet()Ljava/util/Set;" />
<method name="putAll(Landroid/os/Bundle;)V" />
+ <method name="putBinder(Ljava/lang/String;Landroid/os/IBinder;)V" since="18" />
<method name="putBoolean(Ljava/lang/String;Z)V" />
<method name="putBooleanArray(Ljava/lang/String;[Z)V" />
<method name="putBundle(Ljava/lang/String;Landroid/os/Bundle;)V" />
@@ -15716,6 +16758,7 @@
<method name="getThreadId()I" />
<method name="onLooperPrepared()V" />
<method name="quit()Z" since="5" />
+ <method name="quitSafely()Z" since="18" />
</class>
<class name="android/os/IBinder" since="1">
<extends name="java/lang/Object" />
@@ -15757,6 +16800,7 @@
<method name="prepare()V" />
<method name="prepareMainLooper()V" />
<method name="quit()V" />
+ <method name="quitSafely()V" since="18" />
<method name="setMessageLogging(Landroid/util/Printer;)V" />
</class>
<class name="android/os/MemoryFile" since="1">
@@ -16119,9 +17163,16 @@
<extends name="java/lang/Object" />
<method name="&lt;init>(Ljava/lang/String;)V" />
<method name="getAvailableBlocks()I" />
+ <method name="getAvailableBlocksLong()J" since="18" />
+ <method name="getAvailableBytes()J" since="18" />
<method name="getBlockCount()I" />
+ <method name="getBlockCountLong()J" since="18" />
<method name="getBlockSize()I" />
+ <method name="getBlockSizeLong()J" since="18" />
<method name="getFreeBlocks()I" />
+ <method name="getFreeBlocksLong()J" since="18" />
+ <method name="getFreeBytes()J" since="18" />
+ <method name="getTotalBytes()J" since="18" />
<method name="restat(Ljava/lang/String;)V" />
</class>
<class name="android/os/StrictMode" since="9">
@@ -16175,6 +17226,7 @@
<method name="build()Landroid/os/StrictMode$VmPolicy;" />
<method name="detectActivityLeaks()Landroid/os/StrictMode$VmPolicy$Builder;" since="11" />
<method name="detectAll()Landroid/os/StrictMode$VmPolicy$Builder;" />
+ <method name="detectFileUriExposure()Landroid/os/StrictMode$VmPolicy$Builder;" since="18" />
<method name="detectLeakedClosableObjects()Landroid/os/StrictMode$VmPolicy$Builder;" since="11" />
<method name="detectLeakedRegistrationObjects()Landroid/os/StrictMode$VmPolicy$Builder;" since="16" />
<method name="detectLeakedSqlLiteObjects()Landroid/os/StrictMode$VmPolicy$Builder;" />
@@ -16205,6 +17257,12 @@
<method name="release(Landroid/os/IBinder;)V" />
<method name="released()V" />
</class>
+ <class name="android/os/Trace" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="beginSection(Ljava/lang/String;)V" />
+ <method name="endSection()V" />
+ </class>
<class name="android/os/TransactionTooLargeException" since="15">
<extends name="android/os/RemoteException" />
<method name="&lt;init>()V" />
@@ -16220,13 +17278,29 @@
<class name="android/os/UserManager" since="17">
<extends name="java/lang/Object" />
<method name="&lt;init>()V" />
+ <method name="getApplicationRestrictions(Ljava/lang/String;)Landroid/os/Bundle;" since="18" />
<method name="getSerialNumberForUser(Landroid/os/UserHandle;)J" />
<method name="getUserCount()I" />
<method name="getUserForSerialNumber(J)Landroid/os/UserHandle;" />
<method name="getUserName()Ljava/lang/String;" />
+ <method name="getUserRestrictions()Landroid/os/Bundle;" since="18" />
+ <method name="getUserRestrictions(Landroid/os/UserHandle;)Landroid/os/Bundle;" since="18" />
<method name="isUserAGoat()Z" />
<method name="isUserRunning(Landroid/os/UserHandle;)Z" />
<method name="isUserRunningOrStopping(Landroid/os/UserHandle;)Z" />
+ <method name="setUserRestriction(Ljava/lang/String;Z)V" since="18" />
+ <method name="setUserRestrictions(Landroid/os/Bundle;)V" since="18" />
+ <method name="setUserRestrictions(Landroid/os/Bundle;Landroid/os/UserHandle;)V" since="18" />
+ <field name="DISALLOW_CONFIG_BLUETOOTH" since="18" />
+ <field name="DISALLOW_CONFIG_CREDENTIALS" since="18" />
+ <field name="DISALLOW_CONFIG_WIFI" since="18" />
+ <field name="DISALLOW_INSTALL_APPS" since="18" />
+ <field name="DISALLOW_INSTALL_UNKNOWN_SOURCES" since="18" />
+ <field name="DISALLOW_MODIFY_ACCOUNTS" since="18" />
+ <field name="DISALLOW_REMOVE_USER" since="18" />
+ <field name="DISALLOW_SHARE_LOCATION" since="18" />
+ <field name="DISALLOW_UNINSTALL_APPS" since="18" />
+ <field name="DISALLOW_USB_FILE_TRANSFER" since="18" />
</class>
<class name="android/os/Vibrator" since="1">
<extends name="java/lang/Object" />
@@ -17034,6 +18108,7 @@
<field name="CAN_PARTIALLY_UPDATE" />
<field name="DELETED" />
<field name="DIRTY" />
+ <field name="MUTATORS" since="18" />
<field name="_SYNC_ID" />
</class>
<class name="android/provider/CalendarContract$SyncState" since="14">
@@ -17458,6 +18533,15 @@
<field name="LABEL" />
<field name="TYPE" />
</class>
+ <class name="android/provider/ContactsContract$CommonDataKinds$Contactables" since="18">
+ <extends name="java/lang/Object" />
+ <implements name="android/provider/ContactsContract$CommonDataKinds$CommonColumns" />
+ <implements name="android/provider/ContactsContract$DataColumnsWithJoins" />
+ <method name="&lt;init>()V" />
+ <field name="CONTENT_FILTER_URI" />
+ <field name="CONTENT_URI" />
+ <field name="VISIBLE_CONTACTS_ONLY" />
+ </class>
<class name="android/provider/ContactsContract$CommonDataKinds$Email" since="5">
<extends name="java/lang/Object" />
<implements name="android/provider/ContactsContract$CommonDataKinds$CommonColumns" />
@@ -17808,6 +18892,7 @@
</class>
<class name="android/provider/ContactsContract$ContactsColumns" since="5">
<extends name="java/lang/Object" />
+ <field name="CONTACT_LAST_UPDATED_TIMESTAMP" since="18" />
<field name="DISPLAY_NAME" />
<field name="HAS_PHONE_NUMBER" />
<field name="IN_VISIBLE_GROUP" />
@@ -17825,6 +18910,7 @@
<method name="getContactLookupUri(Landroid/content/ContentResolver;Landroid/net/Uri;)Landroid/net/Uri;" />
<field name="CONTENT_TYPE" />
<field name="CONTENT_URI" />
+ <field name="VISIBLE_CONTACTS_ONLY" since="18" />
</class>
<class name="android/provider/ContactsContract$DataColumns" since="5">
<extends name="java/lang/Object" />
@@ -17862,6 +18948,7 @@
<implements name="android/provider/ContactsContract$ContactStatusColumns" />
<implements name="android/provider/ContactsContract$ContactsColumns" />
<implements name="android/provider/ContactsContract$DataColumns" />
+ <implements name="android/provider/ContactsContract$DataUsageStatColumns" since="18" />
<implements name="android/provider/ContactsContract$RawContactsColumns" />
<implements name="android/provider/ContactsContract$StatusColumns" />
</class>
@@ -17875,6 +18962,23 @@
<field name="USAGE_TYPE_LONG_TEXT" />
<field name="USAGE_TYPE_SHORT_TEXT" />
</class>
+ <class name="android/provider/ContactsContract$DataUsageStatColumns" since="18">
+ <extends name="java/lang/Object" />
+ <field name="LAST_TIME_USED" />
+ <field name="TIMES_USED" />
+ </class>
+ <class name="android/provider/ContactsContract$DeletedContacts" since="18">
+ <extends name="java/lang/Object" />
+ <implements name="android/provider/ContactsContract$DeletedContactsColumns" />
+ <method name="&lt;init>()V" />
+ <field name="CONTENT_URI" />
+ <field name="DAYS_KEPT_MILLISECONDS" />
+ </class>
+ <class name="android/provider/ContactsContract$DeletedContactsColumns" since="18">
+ <extends name="java/lang/Object" />
+ <field name="CONTACT_DELETED_TIMESTAMP" />
+ <field name="CONTACT_ID" />
+ </class>
<class name="android/provider/ContactsContract$Directory" since="11">
<extends name="java/lang/Object" />
<implements name="android/provider/BaseColumns" />
@@ -17962,6 +19066,7 @@
<extends name="java/lang/Object" />
<method name="&lt;init>()V" />
<field name="ATTACH_IMAGE" />
+ <field name="CONTACTS_DATABASE_CREATED" since="18" />
<field name="EXTRA_CREATE_DESCRIPTION" />
<field name="EXTRA_FORCE_CREATE" />
<field name="INVITE_CONTACT" since="14" />
@@ -18646,6 +19751,7 @@
<field name="ACTION_DATE_SETTINGS" />
<field name="ACTION_DEVICE_INFO_SETTINGS" since="8" />
<field name="ACTION_DISPLAY_SETTINGS" />
+ <field name="ACTION_DREAM_SETTINGS" since="18" />
<field name="ACTION_INPUT_METHOD_SETTINGS" since="3" />
<field name="ACTION_INPUT_METHOD_SUBTYPE_SETTINGS" since="11" />
<field name="ACTION_INTERNAL_STORAGE_SETTINGS" since="3" />
@@ -18669,6 +19775,7 @@
<field name="ACTION_WIFI_SETTINGS" />
<field name="ACTION_WIRELESS_SETTINGS" />
<field name="AUTHORITY" />
+ <field name="EXTRA_ACCOUNT_TYPES" since="18" />
<field name="EXTRA_AUTHORITIES" since="8" />
<field name="EXTRA_INPUT_METHOD_ID" since="11" />
</class>
@@ -19069,6 +20176,7 @@
<method name="copy2DRangeFrom(IIII[S)V" />
<method name="copy2DRangeFrom(IILandroid/graphics/Bitmap;)V" />
<method name="copyFrom(Landroid/graphics/Bitmap;)V" />
+ <method name="copyFrom(Landroid/renderscript/Allocation;)V" since="18" />
<method name="copyFrom([B)V" />
<method name="copyFrom([F)V" />
<method name="copyFrom([I)V" />
@@ -19117,6 +20225,7 @@
<field name="USAGE_IO_INPUT" since="16" />
<field name="USAGE_IO_OUTPUT" since="16" />
<field name="USAGE_SCRIPT" />
+ <field name="USAGE_SHARED" since="18" />
</class>
<class name="android/renderscript/Allocation$MipmapControl" since="11">
<extends name="java/lang/Enum" />
@@ -19297,6 +20406,7 @@
<field name="PIXEL_LA" />
<field name="PIXEL_RGB" />
<field name="PIXEL_RGBA" />
+ <field name="PIXEL_YUV" since="18" />
<field name="USER" />
</class>
<class name="android/renderscript/Element$DataType" since="11">
@@ -19336,6 +20446,7 @@
<class name="android/renderscript/FieldPacker" since="11">
<extends name="java/lang/Object" />
<method name="&lt;init>(I)V" />
+ <method name="&lt;init>([B)V" since="18" />
<method name="addBoolean(Z)V" />
<method name="addF32(F)V" />
<method name="addF32(Landroid/renderscript/Float2;)V" />
@@ -19386,6 +20497,35 @@
<method name="reset()V" />
<method name="reset(I)V" />
<method name="skip(I)V" />
+ <method name="subBoolean()Z" since="18" />
+ <method name="subByte2()Landroid/renderscript/Byte2;" since="18" />
+ <method name="subByte3()Landroid/renderscript/Byte3;" since="18" />
+ <method name="subByte4()Landroid/renderscript/Byte4;" since="18" />
+ <method name="subDouble2()Landroid/renderscript/Double2;" since="18" />
+ <method name="subDouble3()Landroid/renderscript/Double3;" since="18" />
+ <method name="subDouble4()Landroid/renderscript/Double4;" since="18" />
+ <method name="subF32()F" since="18" />
+ <method name="subF64()D" since="18" />
+ <method name="subFloat2()Landroid/renderscript/Float2;" since="18" />
+ <method name="subFloat3()Landroid/renderscript/Float3;" since="18" />
+ <method name="subFloat4()Landroid/renderscript/Float4;" since="18" />
+ <method name="subI16()S" since="18" />
+ <method name="subI32()I" since="18" />
+ <method name="subI64()J" since="18" />
+ <method name="subI8()B" since="18" />
+ <method name="subInt2()Landroid/renderscript/Int2;" since="18" />
+ <method name="subInt3()Landroid/renderscript/Int3;" since="18" />
+ <method name="subInt4()Landroid/renderscript/Int4;" since="18" />
+ <method name="subLong2()Landroid/renderscript/Long2;" since="18" />
+ <method name="subLong3()Landroid/renderscript/Long3;" since="18" />
+ <method name="subLong4()Landroid/renderscript/Long4;" since="18" />
+ <method name="subMatrix2f()Landroid/renderscript/Matrix2f;" since="18" />
+ <method name="subMatrix3f()Landroid/renderscript/Matrix3f;" since="18" />
+ <method name="subMatrix4f()Landroid/renderscript/Matrix4f;" since="18" />
+ <method name="subShort2()Landroid/renderscript/Short2;" since="18" />
+ <method name="subShort3()Landroid/renderscript/Short3;" since="18" />
+ <method name="subShort4()Landroid/renderscript/Short4;" since="18" />
+ <method name="subalign(I)V" since="18" />
</class>
<class name="android/renderscript/FileA3D" since="11">
<extends name="android/renderscript/BaseObj" />
@@ -19860,15 +21000,25 @@
<method name="&lt;init>()V" />
<method name="contextDump()V" />
<method name="create(Landroid/content/Context;)Landroid/renderscript/RenderScript;" />
+ <method name="create(Landroid/content/Context;Landroid/renderscript/RenderScript$ContextType;)Landroid/renderscript/RenderScript;" since="18" />
<method name="destroy()V" />
<method name="finish()V" />
<method name="getApplicationContext()Landroid/content/Context;" />
<method name="getErrorHandler()Landroid/renderscript/RenderScript$RSErrorHandler;" />
<method name="getMessageHandler()Landroid/renderscript/RenderScript$RSMessageHandler;" />
+ <method name="sendMessage(I[I)V" since="18" />
<method name="setErrorHandler(Landroid/renderscript/RenderScript$RSErrorHandler;)V" />
<method name="setMessageHandler(Landroid/renderscript/RenderScript$RSMessageHandler;)V" />
<method name="setPriority(Landroid/renderscript/RenderScript$Priority;)V" />
</class>
+ <class name="android/renderscript/RenderScript$ContextType" since="18">
+ <extends name="java/lang/Enum" />
+ <method name="valueOf(Ljava/lang/String;)Landroid/renderscript/RenderScript$ContextType;" />
+ <method name="values()[Landroid/renderscript/RenderScript$ContextType;" />
+ <field name="DEBUG" />
+ <field name="NORMAL" />
+ <field name="PROFILE" />
+ </class>
<class name="android/renderscript/RenderScript$Priority" since="11">
<extends name="java/lang/Enum" />
<method name="valueOf(Ljava/lang/String;)Landroid/renderscript/RenderScript$Priority;" />
@@ -19921,6 +21071,9 @@
<method name="CLAMP_LINEAR(Landroid/renderscript/RenderScript;)Landroid/renderscript/Sampler;" />
<method name="CLAMP_LINEAR_MIP_LINEAR(Landroid/renderscript/RenderScript;)Landroid/renderscript/Sampler;" />
<method name="CLAMP_NEAREST(Landroid/renderscript/RenderScript;)Landroid/renderscript/Sampler;" />
+ <method name="MIRRORED_REPEAT_LINEAR(Landroid/renderscript/RenderScript;)Landroid/renderscript/Sampler;" since="18" />
+ <method name="MIRRORED_REPEAT_LINEAR_MIP_LINEAR(Landroid/renderscript/RenderScript;)Landroid/renderscript/Sampler;" since="18" />
+ <method name="MIRRORED_REPEAT_NEAREST(Landroid/renderscript/RenderScript;)Landroid/renderscript/Sampler;" since="18" />
<method name="WRAP_LINEAR(Landroid/renderscript/RenderScript;)Landroid/renderscript/Sampler;" />
<method name="WRAP_LINEAR_MIP_LINEAR(Landroid/renderscript/RenderScript;)Landroid/renderscript/Sampler;" />
<method name="WRAP_NEAREST(Landroid/renderscript/RenderScript;)Landroid/renderscript/Sampler;" />
@@ -19948,6 +21101,7 @@
<field name="LINEAR" />
<field name="LINEAR_MIP_LINEAR" />
<field name="LINEAR_MIP_NEAREST" />
+ <field name="MIRRORED_REPEAT" since="18" />
<field name="NEAREST" />
<field name="WRAP" />
</class>
@@ -19958,6 +21112,13 @@
<method name="createFieldID(ILandroid/renderscript/Element;)Landroid/renderscript/Script$FieldID;" since="17" />
<method name="createKernelID(IILandroid/renderscript/Element;Landroid/renderscript/Element;)Landroid/renderscript/Script$KernelID;" since="17" />
<method name="forEach(ILandroid/renderscript/Allocation;Landroid/renderscript/Allocation;Landroid/renderscript/FieldPacker;)V" since="14" />
+ <method name="forEach(ILandroid/renderscript/Allocation;Landroid/renderscript/Allocation;Landroid/renderscript/FieldPacker;Landroid/renderscript/Script$LaunchOptions;)V" since="18" />
+ <method name="getVarB(I)Z" since="18" />
+ <method name="getVarD(I)D" since="18" />
+ <method name="getVarF(I)F" since="18" />
+ <method name="getVarI(I)I" since="18" />
+ <method name="getVarJ(I)J" since="18" />
+ <method name="getVarV(ILandroid/renderscript/FieldPacker;)V" since="18" />
<method name="invoke(I)V" />
<method name="invoke(ILandroid/renderscript/FieldPacker;)V" />
<method name="setTimeZone(Ljava/lang/String;)V" />
@@ -19994,6 +21155,19 @@
<extends name="android/renderscript/BaseObj" />
<method name="&lt;init>()V" />
</class>
+ <class name="android/renderscript/Script$LaunchOptions" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="getXEnd()I" />
+ <method name="getXStart()I" />
+ <method name="getYEnd()I" />
+ <method name="getYStart()I" />
+ <method name="getZEnd()I" />
+ <method name="getZStart()I" />
+ <method name="setX(II)Landroid/renderscript/Script$LaunchOptions;" />
+ <method name="setY(II)Landroid/renderscript/Script$LaunchOptions;" />
+ <method name="setZ(II)Landroid/renderscript/Script$LaunchOptions;" />
+ </class>
<class name="android/renderscript/ScriptC" since="11">
<extends name="android/renderscript/Script" />
<method name="&lt;init>(ILandroid/renderscript/RenderScript;)V" />
@@ -20018,6 +21192,14 @@
<extends name="android/renderscript/Script" />
<method name="&lt;init>()V" />
</class>
+ <class name="android/renderscript/ScriptIntrinsic3DLUT" since="18">
+ <extends name="android/renderscript/ScriptIntrinsic" />
+ <method name="&lt;init>()V" />
+ <method name="create(Landroid/renderscript/RenderScript;Landroid/renderscript/Element;)Landroid/renderscript/ScriptIntrinsic3DLUT;" />
+ <method name="forEach(Landroid/renderscript/Allocation;Landroid/renderscript/Allocation;)V" />
+ <method name="getKernelID()Landroid/renderscript/Script$KernelID;" />
+ <method name="setLUT(Landroid/renderscript/Allocation;)V" />
+ </class>
<class name="android/renderscript/ScriptIntrinsicBlend" since="17">
<extends name="android/renderscript/ScriptIntrinsic" />
<method name="&lt;init>()V" />
@@ -20146,6 +21328,7 @@
<method name="getElement()Landroid/renderscript/Element;" />
<method name="getX()I" />
<method name="getY()I" />
+ <method name="getYuv()I" since="18" />
<method name="getZ()I" />
<method name="hasFaces()Z" />
<method name="hasMipmaps()Z" />
@@ -20158,6 +21341,8 @@
<method name="setMipmaps(Z)Landroid/renderscript/Type$Builder;" />
<method name="setX(I)Landroid/renderscript/Type$Builder;" />
<method name="setY(I)Landroid/renderscript/Type$Builder;" />
+ <method name="setYuvFormat(I)Landroid/renderscript/Type$Builder;" since="18" />
+ <method name="setZ(I)Landroid/renderscript/Type$Builder;" since="18" />
</class>
<class name="android/renderscript/Type$CubemapFace" since="11">
<extends name="java/lang/Enum" />
@@ -20214,10 +21399,40 @@
<implements name="android/sax/EndTextElementListener" />
<implements name="android/sax/StartElementListener" />
</class>
- <class name="android/security/AndroidKeyPairGeneratorSpec" since="17">
+ <class name="android/security/AndroidKeyPairGeneratorSpec" since="18">
<extends name="java/lang/Object" />
<implements name="java/security/spec/AlgorithmParameterSpec" />
- <method name="&lt;init>(Landroid/content/Context;Ljava/lang/String;Ljavax/security/auth/x500/X500Principal;Ljava/math/BigInteger;Ljava/util/Date;Ljava/util/Date;)V" />
+ <method name="&lt;init>()V" />
+ <method name="getContext()Landroid/content/Context;" />
+ <method name="getEndDate()Ljava/util/Date;" />
+ <method name="getKeystoreAlias()Ljava/lang/String;" />
+ <method name="getSerialNumber()Ljava/math/BigInteger;" />
+ <method name="getStartDate()Ljava/util/Date;" />
+ <method name="getSubjectDN()Ljavax/security/auth/x500/X500Principal;" />
+ <method name="isEncryptionRequired()Z" />
+ </class>
+ <class name="android/security/AndroidKeyPairGeneratorSpec$Builder" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>(Landroid/content/Context;)V" />
+ <method name="build()Landroid/security/AndroidKeyPairGeneratorSpec;" />
+ <method name="setAlias(Ljava/lang/String;)Landroid/security/AndroidKeyPairGeneratorSpec$Builder;" />
+ <method name="setEncryptionRequired()Landroid/security/AndroidKeyPairGeneratorSpec$Builder;" />
+ <method name="setEndDate(Ljava/util/Date;)Landroid/security/AndroidKeyPairGeneratorSpec$Builder;" />
+ <method name="setSerialNumber(Ljava/math/BigInteger;)Landroid/security/AndroidKeyPairGeneratorSpec$Builder;" />
+ <method name="setStartDate(Ljava/util/Date;)Landroid/security/AndroidKeyPairGeneratorSpec$Builder;" />
+ <method name="setSubject(Ljavax/security/auth/x500/X500Principal;)Landroid/security/AndroidKeyPairGeneratorSpec$Builder;" />
+ </class>
+ <class name="android/security/AndroidKeyStoreParameter" since="18">
+ <extends name="java/lang/Object" />
+ <implements name="java/security/KeyStore$ProtectionParameter" />
+ <method name="&lt;init>()V" />
+ <method name="isEncryptionRequired()Z" />
+ </class>
+ <class name="android/security/AndroidKeyStoreParameter$Builder" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>(Landroid/content/Context;)V" />
+ <method name="build()Landroid/security/AndroidKeyStoreParameter;" />
+ <method name="setEncryptionRequired()Landroid/security/AndroidKeyStoreParameter$Builder;" />
</class>
<class name="android/security/KeyChain" since="14">
<extends name="java/lang/Object" />
@@ -20226,6 +21441,8 @@
<method name="createInstallIntent()Landroid/content/Intent;" />
<method name="getCertificateChain(Landroid/content/Context;Ljava/lang/String;)[Ljava/security/cert/X509Certificate;" />
<method name="getPrivateKey(Landroid/content/Context;Ljava/lang/String;)Ljava/security/PrivateKey;" />
+ <method name="isBoundKeyAlgorithm(Ljava/lang/String;)Z" since="18" />
+ <method name="isKeyAlgorithmSupported(Ljava/lang/String;)Z" since="18" />
<field name="ACTION_STORAGE_CHANGED" since="16" />
<field name="EXTRA_CERTIFICATE" />
<field name="EXTRA_NAME" />
@@ -20242,31 +21459,40 @@
<method name="&lt;init>(Ljava/lang/String;Ljava/lang/Throwable;)V" />
<method name="&lt;init>(Ljava/lang/Throwable;)V" />
</class>
- <class name="android/service/dreams/Dream" since="17">
- <extends name="android/app/Service" />
- <implements name="android/view/Window$Callback" />
+ <class name="android/security/KeyPairGeneratorSpec" since="18">
+ <extends name="java/lang/Object" />
+ <implements name="java/security/spec/AlgorithmParameterSpec" />
<method name="&lt;init>()V" />
- <method name="addContentView(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V" />
- <method name="findViewById(I)Landroid/view/View;" />
- <method name="finish()V" />
- <method name="getWindow()Landroid/view/Window;" />
- <method name="getWindowManager()Landroid/view/WindowManager;" />
- <method name="isFullscreen()Z" />
- <method name="isInteractive()Z" />
- <method name="isLowProfile()Z" />
- <method name="isScreenBright()Z" />
- <method name="onStart()V" />
- <method name="setContentView(I)V" />
- <method name="setContentView(Landroid/view/View;)V" />
- <method name="setContentView(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V" />
- <method name="setFullscreen(Z)V" />
- <method name="setInteractive(Z)V" />
- <method name="setLowProfile(Z)V" />
- <method name="setScreenBright(Z)V" />
- <field name="ACTION_DREAMING_STARTED" />
- <field name="ACTION_DREAMING_STOPPED" />
- <field name="CATEGORY_DREAM" />
- <field name="DREAM_META_DATA" />
+ <method name="getContext()Landroid/content/Context;" />
+ <method name="getEndDate()Ljava/util/Date;" />
+ <method name="getKeystoreAlias()Ljava/lang/String;" />
+ <method name="getSerialNumber()Ljava/math/BigInteger;" />
+ <method name="getStartDate()Ljava/util/Date;" />
+ <method name="getSubjectDN()Ljavax/security/auth/x500/X500Principal;" />
+ <method name="isEncryptionRequired()Z" />
+ </class>
+ <class name="android/security/KeyPairGeneratorSpec$Builder" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>(Landroid/content/Context;)V" />
+ <method name="build()Landroid/security/KeyPairGeneratorSpec;" />
+ <method name="setAlias(Ljava/lang/String;)Landroid/security/KeyPairGeneratorSpec$Builder;" />
+ <method name="setEncryptionRequired()Landroid/security/KeyPairGeneratorSpec$Builder;" />
+ <method name="setEndDate(Ljava/util/Date;)Landroid/security/KeyPairGeneratorSpec$Builder;" />
+ <method name="setSerialNumber(Ljava/math/BigInteger;)Landroid/security/KeyPairGeneratorSpec$Builder;" />
+ <method name="setStartDate(Ljava/util/Date;)Landroid/security/KeyPairGeneratorSpec$Builder;" />
+ <method name="setSubject(Ljavax/security/auth/x500/X500Principal;)Landroid/security/KeyPairGeneratorSpec$Builder;" />
+ </class>
+ <class name="android/security/KeyStoreParameter" since="18">
+ <extends name="java/lang/Object" />
+ <implements name="java/security/KeyStore$ProtectionParameter" />
+ <method name="&lt;init>()V" />
+ <method name="isEncryptionRequired()Z" />
+ </class>
+ <class name="android/security/KeyStoreParameter$Builder" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>(Landroid/content/Context;)V" />
+ <method name="build()Landroid/security/KeyStoreParameter;" />
+ <method name="setEncryptionRequired(Z)Landroid/security/KeyStoreParameter$Builder;" />
</class>
<class name="android/service/dreams/DreamService" since="17">
<extends name="android/app/Service" />
@@ -20291,6 +21517,32 @@
<field name="DREAM_META_DATA" />
<field name="SERVICE_INTERFACE" />
</class>
+ <class name="android/service/notification/NotificationListenerService" since="18">
+ <extends name="android/app/Service" />
+ <method name="&lt;init>()V" />
+ <method name="cancelAllNotifications()V" />
+ <method name="cancelNotification(Ljava/lang/String;Ljava/lang/String;I)V" />
+ <method name="getActiveNotifications()[Landroid/service/notification/StatusBarNotification;" />
+ <method name="onNotificationPosted(Landroid/service/notification/StatusBarNotification;)V" />
+ <method name="onNotificationRemoved(Landroid/service/notification/StatusBarNotification;)V" />
+ <field name="SERVICE_INTERFACE" />
+ </class>
+ <class name="android/service/notification/StatusBarNotification" since="18">
+ <extends name="java/lang/Object" />
+ <implements name="android/os/Parcelable" />
+ <method name="&lt;init>(Landroid/os/Parcel;)V" />
+ <method name="&lt;init>(Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;IIILandroid/app/Notification;Landroid/os/UserHandle;J)V" />
+ <method name="clone()Landroid/service/notification/StatusBarNotification;" />
+ <method name="getId()I" />
+ <method name="getNotification()Landroid/app/Notification;" />
+ <method name="getPackageName()Ljava/lang/String;" />
+ <method name="getPostTime()J" />
+ <method name="getTag()Ljava/lang/String;" />
+ <method name="getUserId()I" />
+ <method name="isClearable()Z" />
+ <method name="isOngoing()Z" />
+ <field name="CREATOR" />
+ </class>
<class name="android/service/textservice/SpellCheckerService" since="14">
<extends name="android/app/Service" />
<method name="&lt;init>()V" />
@@ -20471,9 +21723,11 @@
<method name="addSpeech(Ljava/lang/String;Ljava/lang/String;I)I" />
<method name="areDefaultsEnforced()Z" since="8" />
<method name="getDefaultEngine()Ljava/lang/String;" since="8" />
+ <method name="getDefaultLanguage()Ljava/util/Locale;" since="18" />
<method name="getEngines()Ljava/util/List;" since="14" />
<method name="getFeatures(Ljava/util/Locale;)Ljava/util/Set;" since="15" />
<method name="getLanguage()Ljava/util/Locale;" />
+ <method name="getMaxSpeechInputLength()I" since="18" />
<method name="isLanguageAvailable(Ljava/util/Locale;)I" />
<method name="isSpeaking()Z" />
<method name="playEarcon(Ljava/lang/String;ILjava/util/HashMap;)I" />
@@ -20503,6 +21757,7 @@
<extends name="java/lang/Object" />
<method name="&lt;init>(Landroid/speech/tts/TextToSpeech;)V" />
<field name="ACTION_CHECK_TTS_DATA" />
+ <field name="ACTION_GET_SAMPLE_TEXT" since="18" />
<field name="ACTION_INSTALL_TTS_DATA" />
<field name="ACTION_TTS_DATA_INSTALLED" />
<field name="CHECK_VOICE_DATA_BAD_DATA" />
@@ -20513,6 +21768,7 @@
<field name="DEFAULT_STREAM" />
<field name="EXTRA_AVAILABLE_VOICES" since="8" />
<field name="EXTRA_CHECK_VOICE_DATA_FOR" since="8" />
+ <field name="EXTRA_SAMPLE_TEXT" since="18" />
<field name="EXTRA_TTS_DATA_INSTALLED" />
<field name="EXTRA_UNAVAILABLE_VOICES" since="8" />
<field name="EXTRA_VOICE_DATA_FILES" />
@@ -20559,12 +21815,6 @@
<method name="onError(Ljava/lang/String;)V" />
<method name="onStart(Ljava/lang/String;)V" />
</class>
- <class name="android/telephony/CellIdentity" since="17">
- <extends name="java/lang/Object" />
- <implements name="android/os/Parcelable" />
- <method name="&lt;init>()V" />
- <field name="CREATOR" />
- </class>
<class name="android/telephony/CellIdentityCdma" since="17">
<extends name="java/lang/Object" />
<implements name="android/os/Parcelable" />
@@ -20598,6 +21848,17 @@
<method name="getTac()I" />
<field name="CREATOR" />
</class>
+ <class name="android/telephony/CellIdentityWcdma" since="18">
+ <extends name="java/lang/Object" />
+ <implements name="android/os/Parcelable" />
+ <method name="&lt;init>()V" />
+ <method name="getCid()I" />
+ <method name="getLac()I" />
+ <method name="getMcc()I" />
+ <method name="getMnc()I" />
+ <method name="getPsc()I" />
+ <field name="CREATOR" />
+ </class>
<class name="android/telephony/CellInfo" since="17">
<extends name="java/lang/Object" />
<implements name="android/os/Parcelable" />
@@ -20630,6 +21891,14 @@
<method name="getCellSignalStrength()Landroid/telephony/CellSignalStrengthLte;" />
<field name="CREATOR" />
</class>
+ <class name="android/telephony/CellInfoWcdma" since="18">
+ <extends name="android/telephony/CellInfo" />
+ <implements name="android/os/Parcelable" />
+ <method name="&lt;init>()V" />
+ <method name="getCellIdentity()Landroid/telephony/CellIdentityWcdma;" />
+ <method name="getCellSignalStrength()Landroid/telephony/CellSignalStrengthWcdma;" />
+ <field name="CREATOR" />
+ </class>
<class name="android/telephony/CellLocation" since="1">
<extends name="java/lang/Object" />
<method name="&lt;init>()V" />
@@ -20669,6 +21938,12 @@
<method name="getTimingAdvance()I" />
<field name="CREATOR" />
</class>
+ <class name="android/telephony/CellSignalStrengthWcdma" since="18">
+ <extends name="android/telephony/CellSignalStrength" />
+ <implements name="android/os/Parcelable" />
+ <method name="&lt;init>()V" />
+ <field name="CREATOR" />
+ </class>
<class name="android/telephony/NeighboringCellInfo" since="3">
<extends name="java/lang/Object" />
<implements name="android/os/Parcelable" />
@@ -20886,6 +22161,7 @@
<method name="getDataState()I" />
<method name="getDeviceId()Ljava/lang/String;" />
<method name="getDeviceSoftwareVersion()Ljava/lang/String;" />
+ <method name="getGroupIdLevel1()Ljava/lang/String;" since="18" />
<method name="getLine1Number()Ljava/lang/String;" />
<method name="getNeighboringCellInfo()Ljava/util/List;" since="3" />
<method name="getNetworkCountryIso()Ljava/lang/String;" />
@@ -20905,6 +22181,7 @@
<method name="isNetworkRoaming()Z" />
<method name="listen(Landroid/telephony/PhoneStateListener;I)V" />
<field name="ACTION_PHONE_STATE_CHANGED" since="3" />
+ <field name="ACTION_RESPOND_VIA_MESSAGE" since="18" />
<field name="CALL_STATE_IDLE" />
<field name="CALL_STATE_OFFHOOK" />
<field name="CALL_STATE_RINGING" />
@@ -21153,6 +22430,7 @@
<method name="&lt;init>()V" />
<method name="getAllTests()Ljunit/framework/TestSuite;" />
<method name="getAndroidTestRunner()Landroid/test/AndroidTestRunner;" />
+ <method name="getArguments()Landroid/os/Bundle;" since="18" />
<method name="getLoader()Ljava/lang/ClassLoader;" />
<field name="REPORT_KEY_NAME_CLASS" />
<field name="REPORT_KEY_NAME_TEST" />
@@ -21362,6 +22640,7 @@
<class name="android/test/mock/MockContentResolver" since="1">
<extends name="android/content/ContentResolver" />
<method name="&lt;init>()V" />
+ <method name="&lt;init>(Landroid/content/Context;)V" since="18" />
<method name="addProvider(Ljava/lang/String;Landroid/content/ContentProvider;)V" />
</class>
<class name="android/test/mock/MockContext" since="1">
@@ -21488,6 +22767,29 @@
<method name="get(Ljava/lang/CharSequence;IILandroid/view/View;)Ljava/lang/String;" />
<method name="getSize(Landroid/view/View;)I" since="3" />
</class>
+ <class name="android/text/BidiFormatter" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="getInstance()Landroid/text/BidiFormatter;" />
+ <method name="getInstance(Ljava/util/Locale;)Landroid/text/BidiFormatter;" />
+ <method name="getInstance(Z)Landroid/text/BidiFormatter;" />
+ <method name="getStereoReset()Z" />
+ <method name="isRtl(Ljava/lang/String;)Z" />
+ <method name="isRtlContext()Z" />
+ <method name="unicodeWrap(Ljava/lang/String;)Ljava/lang/String;" />
+ <method name="unicodeWrap(Ljava/lang/String;Landroid/text/TextDirectionHeuristic;)Ljava/lang/String;" />
+ <method name="unicodeWrap(Ljava/lang/String;Landroid/text/TextDirectionHeuristic;Z)Ljava/lang/String;" />
+ <method name="unicodeWrap(Ljava/lang/String;Z)Ljava/lang/String;" />
+ </class>
+ <class name="android/text/BidiFormatter$Builder" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="&lt;init>(Ljava/util/Locale;)V" />
+ <method name="&lt;init>(Z)V" />
+ <method name="build()Landroid/text/BidiFormatter;" />
+ <method name="setTextDirectionHeuristic(Landroid/text/TextDirectionHeuristic;)Landroid/text/BidiFormatter$Builder;" />
+ <method name="stereoReset(Z)Landroid/text/BidiFormatter$Builder;" />
+ </class>
<class name="android/text/BoringLayout" since="1">
<extends name="android/text/Layout" />
<implements name="android/text/TextUtils$EllipsizeCallback" />
@@ -21846,6 +23148,21 @@
<method name="&lt;init>(Ljava/lang/CharSequence;IILandroid/text/TextPaint;ILandroid/text/Layout$Alignment;FFZLandroid/text/TextUtils$TruncateAt;I)V" />
<method name="&lt;init>(Ljava/lang/CharSequence;Landroid/text/TextPaint;ILandroid/text/Layout$Alignment;FFZ)V" />
</class>
+ <class name="android/text/TextDirectionHeuristic" since="18">
+ <extends name="java/lang/Object" />
+ <method name="isRtl(Ljava/lang/CharSequence;II)Z" />
+ <method name="isRtl([CII)Z" />
+ </class>
+ <class name="android/text/TextDirectionHeuristics" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <field name="ANYRTL_LTR" />
+ <field name="FIRSTSTRONG_LTR" />
+ <field name="FIRSTSTRONG_RTL" />
+ <field name="LOCALE" />
+ <field name="LTR" />
+ <field name="RTL" />
+ </class>
<class name="android/text/TextPaint" since="1">
<extends name="android/graphics/Paint" />
<method name="&lt;init>()V" />
@@ -21936,12 +23253,53 @@
<method name="beforeTextChanged(Ljava/lang/CharSequence;III)V" />
<method name="onTextChanged(Ljava/lang/CharSequence;III)V" />
</class>
+ <class name="android/text/bidi/BidiFormatter" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="dirAttr(Ljava/lang/String;)Ljava/lang/String;" />
+ <method name="dirAttr(Ljava/lang/String;Landroid/text/TextDirectionHeuristic;)Ljava/lang/String;" />
+ <method name="dirAttr(Z)Ljava/lang/String;" />
+ <method name="dirAttrValue(Ljava/lang/String;)Ljava/lang/String;" />
+ <method name="dirAttrValue(Ljava/lang/String;Landroid/text/TextDirectionHeuristic;)Ljava/lang/String;" />
+ <method name="dirAttrValue(Z)Ljava/lang/String;" />
+ <method name="endEdge()Ljava/lang/String;" />
+ <method name="getInstance()Landroid/text/bidi/BidiFormatter;" />
+ <method name="getInstance(Ljava/util/Locale;)Landroid/text/bidi/BidiFormatter;" />
+ <method name="getInstance(Z)Landroid/text/bidi/BidiFormatter;" />
+ <method name="getStereoReset()Z" />
+ <method name="isRtl(Ljava/lang/String;)Z" />
+ <method name="isRtlContext()Z" />
+ <method name="mark()Ljava/lang/String;" />
+ <method name="markAfter(Ljava/lang/String;)Ljava/lang/String;" />
+ <method name="markAfter(Ljava/lang/String;Landroid/text/TextDirectionHeuristic;)Ljava/lang/String;" />
+ <method name="markBefore(Ljava/lang/String;)Ljava/lang/String;" />
+ <method name="markBefore(Ljava/lang/String;Landroid/text/TextDirectionHeuristic;)Ljava/lang/String;" />
+ <method name="spanWrap(Ljava/lang/String;)Ljava/lang/String;" />
+ <method name="spanWrap(Ljava/lang/String;Landroid/text/TextDirectionHeuristic;)Ljava/lang/String;" />
+ <method name="spanWrap(Ljava/lang/String;Landroid/text/TextDirectionHeuristic;Z)Ljava/lang/String;" />
+ <method name="spanWrap(Ljava/lang/String;Z)Ljava/lang/String;" />
+ <method name="startEdge()Ljava/lang/String;" />
+ <method name="unicodeWrap(Ljava/lang/String;)Ljava/lang/String;" />
+ <method name="unicodeWrap(Ljava/lang/String;Landroid/text/TextDirectionHeuristic;)Ljava/lang/String;" />
+ <method name="unicodeWrap(Ljava/lang/String;Landroid/text/TextDirectionHeuristic;Z)Ljava/lang/String;" />
+ <method name="unicodeWrap(Ljava/lang/String;Z)Ljava/lang/String;" />
+ </class>
+ <class name="android/text/bidi/BidiFormatter$Builder" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="&lt;init>(Ljava/util/Locale;)V" />
+ <method name="&lt;init>(Z)V" />
+ <method name="build()Landroid/text/bidi/BidiFormatter;" />
+ <method name="setTextDirectionHeuristic(Landroid/text/TextDirectionHeuristic;)Landroid/text/bidi/BidiFormatter$Builder;" />
+ <method name="stereoReset(Z)Landroid/text/bidi/BidiFormatter$Builder;" />
+ </class>
<class name="android/text/format/DateFormat" since="3">
<extends name="java/lang/Object" />
<method name="&lt;init>()V" />
<method name="format(Ljava/lang/CharSequence;J)Ljava/lang/CharSequence;" />
<method name="format(Ljava/lang/CharSequence;Ljava/util/Calendar;)Ljava/lang/CharSequence;" />
<method name="format(Ljava/lang/CharSequence;Ljava/util/Date;)Ljava/lang/CharSequence;" />
+ <method name="getBestDateTimePattern(Ljava/util/Locale;Ljava/lang/String;)Ljava/lang/String;" since="18" />
<method name="getDateFormat(Landroid/content/Context;)Ljava/text/DateFormat;" />
<method name="getDateFormatOrder(Landroid/content/Context;)[C" />
<method name="getLongDateFormat(Landroid/content/Context;)Ljava/text/DateFormat;" />
@@ -22380,6 +23738,11 @@
<extends name="java/lang/Object" />
<implements name="android/text/ParcelableSpan" />
<method name="&lt;init>()V" />
+ <method name="&lt;init>(Landroid/app/PendingIntent;)V" since="18" />
+ <method name="&lt;init>(Landroid/os/Parcel;)V" since="18" />
+ <field name="EXTRA_TEXT_CHANGED_TYPE" since="18" />
+ <field name="TEXT_DELETED" since="18" />
+ <field name="TEXT_MODIFIED" since="18" />
</class>
<class name="android/text/style/ForegroundColorSpan" since="1">
<extends name="android/text/style/CharacterStyle" />
@@ -22760,6 +24123,7 @@
<field name="DENSITY_TV" since="13" />
<field name="DENSITY_XHIGH" since="9" />
<field name="DENSITY_XXHIGH" since="16" />
+ <field name="DENSITY_XXXHIGH" since="18" />
<field name="density" />
<field name="densityDpi" since="4" />
<field name="heightPixels" />
@@ -22869,11 +24233,6 @@
<method name="value(Ljava/lang/String;)Landroid/util/JsonWriter;" />
<method name="value(Z)Landroid/util/JsonWriter;" />
</class>
- <class name="android/util/LocaleUtil" since="17">
- <extends name="java/lang/Object" />
- <method name="&lt;init>()V" />
- <method name="getLayoutDirectionFromLocale(Ljava/util/Locale;)I" />
- </class>
<class name="android/util/Log" since="1">
<extends name="java/lang/Object" />
<method name="&lt;init>()V" />
@@ -23019,7 +24378,7 @@
<method name="of(Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/String;)Landroid/util/Property;" />
<method name="set(Ljava/lang/Object;Ljava/lang/Object;)V" />
</class>
- <class name="android/util/PropertyValueModel" since="17">
+ <class name="android/util/PropertyValueModel" since="18">
<extends name="android/util/ValueModel" />
<method name="&lt;init>()V" />
<method name="getHost()Ljava/lang/Object;" />
@@ -23086,6 +24445,25 @@
<method name="size()I" />
<method name="valueAt(I)I" />
</class>
+ <class name="android/util/SparseLongArray" since="18">
+ <extends name="java/lang/Object" />
+ <implements name="java/lang/Cloneable" />
+ <method name="&lt;init>()V" />
+ <method name="&lt;init>(I)V" />
+ <method name="append(IJ)V" />
+ <method name="clear()V" />
+ <method name="clone()Landroid/util/SparseLongArray;" />
+ <method name="delete(I)V" />
+ <method name="get(I)J" />
+ <method name="get(IJ)J" />
+ <method name="indexOfKey(I)I" />
+ <method name="indexOfValue(J)I" />
+ <method name="keyAt(I)I" />
+ <method name="put(IJ)V" />
+ <method name="removeAt(I)V" />
+ <method name="size()I" />
+ <method name="valueAt(I)J" />
+ </class>
<class name="android/util/StateSet" since="1">
<extends name="java/lang/Object" />
<method name="&lt;init>()V" />
@@ -23182,7 +24560,7 @@
<field name="string" />
<field name="type" />
</class>
- <class name="android/util/ValueModel" since="17">
+ <class name="android/util/ValueModel" since="18">
<extends name="java/lang/Object" />
<method name="&lt;init>()V" />
<method name="get()Ljava/lang/Object;" />
@@ -23475,6 +24853,7 @@
<field name="SOURCE_CLASS_BUTTON" />
<field name="SOURCE_CLASS_JOYSTICK" since="12" />
<field name="SOURCE_CLASS_MASK" />
+ <field name="SOURCE_CLASS_NONE" since="18" />
<field name="SOURCE_CLASS_POINTER" />
<field name="SOURCE_CLASS_POSITION" />
<field name="SOURCE_CLASS_TRACKBALL" />
@@ -23486,6 +24865,7 @@
<field name="SOURCE_STYLUS" since="14" />
<field name="SOURCE_TOUCHPAD" />
<field name="SOURCE_TOUCHSCREEN" />
+ <field name="SOURCE_TOUCH_NAVIGATION" since="18" />
<field name="SOURCE_TRACKBALL" />
<field name="SOURCE_UNKNOWN" />
</class>
@@ -23498,7 +24878,9 @@
<method name="getMax()F" />
<method name="getMin()F" />
<method name="getRange()F" />
+ <method name="getResolution()F" since="18" />
<method name="getSource()I" since="12" />
+ <method name="isFromSource(I)Z" since="18" />
</class>
<class name="android/view/InputEvent" since="9">
<extends name="java/lang/Object" />
@@ -23508,6 +24890,7 @@
<method name="getDeviceId()I" />
<method name="getEventTime()J" since="16" />
<method name="getSource()I" />
+ <method name="isFromSource(I)Z" since="18" />
<field name="CREATOR" />
</class>
<class name="android/view/InputQueue" since="9">
@@ -23670,6 +25053,8 @@
<field name="KEYCODE_BACKSLASH" />
<field name="KEYCODE_BOOKMARK" since="11" />
<field name="KEYCODE_BREAK" since="11" />
+ <field name="KEYCODE_BRIGHTNESS_DOWN" since="18" />
+ <field name="KEYCODE_BRIGHTNESS_UP" since="18" />
<field name="KEYCODE_BUTTON_1" since="12" />
<field name="KEYCODE_BUTTON_10" since="12" />
<field name="KEYCODE_BUTTON_11" since="12" />
@@ -24538,6 +25923,7 @@
<method name="getBottomFadingEdgeStrength()F" />
<method name="getBottomPaddingOffset()I" since="2" />
<method name="getCameraDistance()F" since="16" />
+ <method name="getClipBounds()Landroid/graphics/Rect;" since="18" />
<method name="getContentDescription()Ljava/lang/CharSequence;" since="4" />
<method name="getContext()Landroid/content/Context;" />
<method name="getContextMenuInfo()Landroid/view/ContextMenu$ContextMenuInfo;" />
@@ -24590,6 +25976,7 @@
<method name="getNextFocusUpId()I" />
<method name="getOnFocusChangeListener()Landroid/view/View$OnFocusChangeListener;" />
<method name="getOverScrollMode()I" since="9" />
+ <method name="getOverlay()Landroid/view/ViewOverlay;" since="18" />
<method name="getPaddingBottom()I" />
<method name="getPaddingEnd()I" since="17" />
<method name="getPaddingLeft()I" />
@@ -24638,6 +26025,7 @@
<method name="getVisibility()I" />
<method name="getWidth()I" />
<method name="getWindowAttachCount()I" />
+ <method name="getWindowId()Landroid/view/WindowId;" since="18" />
<method name="getWindowSystemUiVisibility()I" since="16" />
<method name="getWindowToken()Landroid/os/IBinder;" />
<method name="getWindowVisibility()I" />
@@ -24671,6 +26059,7 @@
<method name="isHorizontalScrollBarEnabled()Z" />
<method name="isHovered()Z" since="14" />
<method name="isInEditMode()Z" since="3" />
+ <method name="isInLayout()Z" since="18" />
<method name="isInTouchMode()Z" />
<method name="isLayoutRequested()Z" />
<method name="isLongClickable()Z" />
@@ -24781,6 +26170,7 @@
<method name="setBottom(I)V" since="11" />
<method name="setCameraDistance(F)V" since="12" />
<method name="setClickable(Z)V" />
+ <method name="setClipBounds(Landroid/graphics/Rect;)V" since="18" />
<method name="setContentDescription(Ljava/lang/CharSequence;)V" since="4" />
<method name="setDrawingCacheBackgroundColor(I)V" />
<method name="setDrawingCacheEnabled(Z)V" />
@@ -25218,11 +26608,14 @@
<method name="getChildDrawingOrder(II)I" />
<method name="getChildMeasureSpec(III)I" />
<method name="getChildStaticTransformation(Landroid/view/View;Landroid/view/animation/Transformation;)Z" />
+ <method name="getClipChildren()Z" since="18" />
<method name="getDescendantFocusability()I" />
<method name="getFocusedChild()Landroid/view/View;" />
<method name="getLayoutAnimation()Landroid/view/animation/LayoutAnimationController;" />
<method name="getLayoutAnimationListener()Landroid/view/animation/Animation$AnimationListener;" />
+ <method name="getLayoutMode()I" since="18" />
<method name="getLayoutTransition()Landroid/animation/LayoutTransition;" since="11" />
+ <method name="getOverlay()Landroid/view/ViewGroupOverlay;" since="18" />
<method name="getPersistentDrawingCache()I" />
<method name="indexOfChild(Landroid/view/View;)I" />
<method name="isAlwaysDrawnWithCacheEnabled()Z" />
@@ -25261,6 +26654,7 @@
<method name="setDescendantFocusability(I)V" />
<method name="setLayoutAnimation(Landroid/view/animation/LayoutAnimationController;)V" />
<method name="setLayoutAnimationListener(Landroid/view/animation/Animation$AnimationListener;)V" />
+ <method name="setLayoutMode(I)V" since="18" />
<method name="setLayoutTransition(Landroid/animation/LayoutTransition;)V" since="11" />
<method name="setMotionEventSplittingEnabled(Z)V" since="11" />
<method name="setOnHierarchyChangeListener(Landroid/view/ViewGroup$OnHierarchyChangeListener;)V" />
@@ -25274,6 +26668,8 @@
<field name="FOCUS_AFTER_DESCENDANTS" />
<field name="FOCUS_BEFORE_DESCENDANTS" />
<field name="FOCUS_BLOCK_DESCENDANTS" />
+ <field name="LAYOUT_MODE_CLIP_BOUNDS" since="18" />
+ <field name="LAYOUT_MODE_OPTICAL_BOUNDS" since="18" />
<field name="PERSISTENT_ALL_CACHES" />
<field name="PERSISTENT_ANIMATION_CACHE" />
<field name="PERSISTENT_NO_CACHE" />
@@ -25317,12 +26713,25 @@
<method name="onChildViewAdded(Landroid/view/View;Landroid/view/View;)V" />
<method name="onChildViewRemoved(Landroid/view/View;Landroid/view/View;)V" />
</class>
+ <class name="android/view/ViewGroupOverlay" since="18">
+ <extends name="android/view/ViewOverlay" />
+ <method name="&lt;init>()V" />
+ <method name="add(Landroid/view/View;)V" />
+ <method name="remove(Landroid/view/View;)V" />
+ </class>
<class name="android/view/ViewManager" since="1">
<extends name="java/lang/Object" />
<method name="addView(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V" />
<method name="removeView(Landroid/view/View;)V" />
<method name="updateViewLayout(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V" />
</class>
+ <class name="android/view/ViewOverlay" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="add(Landroid/graphics/drawable/Drawable;)V" />
+ <method name="clear()V" />
+ <method name="remove(Landroid/graphics/drawable/Drawable;)V" />
+ </class>
<class name="android/view/ViewParent" since="1">
<extends name="java/lang/Object" />
<method name="bringChildToFront(Landroid/view/View;)V" />
@@ -25355,6 +26764,7 @@
<method name="alphaBy(F)Landroid/view/ViewPropertyAnimator;" />
<method name="cancel()V" since="14" />
<method name="getDuration()J" since="14" />
+ <method name="getInterpolator()Landroid/animation/TimeInterpolator;" since="18" />
<method name="getStartDelay()J" since="14" />
<method name="rotation(F)Landroid/view/ViewPropertyAnimator;" />
<method name="rotationBy(F)Landroid/view/ViewPropertyAnimator;" />
@@ -25411,6 +26821,8 @@
<method name="addOnPreDrawListener(Landroid/view/ViewTreeObserver$OnPreDrawListener;)V" />
<method name="addOnScrollChangedListener(Landroid/view/ViewTreeObserver$OnScrollChangedListener;)V" since="3" />
<method name="addOnTouchModeChangeListener(Landroid/view/ViewTreeObserver$OnTouchModeChangeListener;)V" />
+ <method name="addOnWindowAttachListener(Landroid/view/ViewTreeObserver$OnWindowAttachListener;)V" since="18" />
+ <method name="addOnWindowFocusChangeListener(Landroid/view/ViewTreeObserver$OnWindowFocusChangeListener;)V" since="18" />
<method name="dispatchOnDraw()V" since="16" />
<method name="dispatchOnGlobalLayout()V" />
<method name="dispatchOnPreDraw()Z" />
@@ -25422,6 +26834,8 @@
<method name="removeOnPreDrawListener(Landroid/view/ViewTreeObserver$OnPreDrawListener;)V" />
<method name="removeOnScrollChangedListener(Landroid/view/ViewTreeObserver$OnScrollChangedListener;)V" since="3" />
<method name="removeOnTouchModeChangeListener(Landroid/view/ViewTreeObserver$OnTouchModeChangeListener;)V" />
+ <method name="removeOnWindowAttachListener(Landroid/view/ViewTreeObserver$OnWindowAttachListener;)V" since="18" />
+ <method name="removeOnWindowFocusChangeListener(Landroid/view/ViewTreeObserver$OnWindowFocusChangeListener;)V" since="18" />
</class>
<class name="android/view/ViewTreeObserver$OnDrawListener" since="16">
<extends name="java/lang/Object" />
@@ -25447,6 +26861,15 @@
<extends name="java/lang/Object" />
<method name="onTouchModeChanged(Z)V" />
</class>
+ <class name="android/view/ViewTreeObserver$OnWindowAttachListener" since="18">
+ <extends name="java/lang/Object" />
+ <method name="onWindowAttached()V" />
+ <method name="onWindowDetached()V" />
+ </class>
+ <class name="android/view/ViewTreeObserver$OnWindowFocusChangeListener" since="18">
+ <extends name="java/lang/Object" />
+ <method name="onWindowFocusChanged(Z)V" />
+ </class>
<class name="android/view/Window" since="1">
<extends name="java/lang/Object" />
<method name="&lt;init>(Landroid/content/Context;)V" />
@@ -25573,6 +26996,21 @@
<method name="onWindowFocusChanged(Z)V" />
<method name="onWindowStartingActionMode(Landroid/view/ActionMode$Callback;)Landroid/view/ActionMode;" since="11" />
</class>
+ <class name="android/view/WindowId" since="18">
+ <extends name="java/lang/Object" />
+ <implements name="android/os/Parcelable" />
+ <method name="&lt;init>()V" />
+ <method name="isFocused()Z" />
+ <method name="registerFocusObserver(Landroid/view/WindowId$FocusObserver;)V" />
+ <method name="unregisterFocusObserver(Landroid/view/WindowId$FocusObserver;)V" />
+ <field name="CREATOR" />
+ </class>
+ <class name="android/view/WindowId$FocusObserver" since="18">
+ <extends name="java/lang/Object" />
+ <method name="&lt;init>()V" />
+ <method name="onFocusGained(Landroid/view/WindowId;)V" />
+ <method name="onFocusLost(Landroid/view/WindowId;)V" />
+ </class>
<class name="android/view/WindowManager" since="1">
<extends name="java/lang/Object" />
<implements name="android/view/ViewManager" />
@@ -25627,6 +27065,7 @@
<field name="FLAG_IGNORE_CHEEK_PRESSES" />
<field name="FLAG_KEEP_SCREEN_ON" />
<field name="FLAG_LAYOUT_INSET_DECOR" />
+ <field name="FLAG_LAYOUT_IN_OVERSCAN" since="18" />
<field name="FLAG_LAYOUT_IN_SCREEN" />
<field name="FLAG_LAYOUT_NO_LIMITS" />
<field name="FLAG_NOT_FOCUSABLE" />
@@ -25650,6 +27089,10 @@
<field name="MEMORY_TYPE_HARDWARE" />
<field name="MEMORY_TYPE_NORMAL" />
<field name="MEMORY_TYPE_PUSH_BUFFERS" />
+ <field name="ROTATION_ANIMATION_CHANGED" since="18" />
+ <field name="ROTATION_ANIMATION_CROSSFADE" since="18" />
+ <field name="ROTATION_ANIMATION_JUMPCUT" since="18" />
+ <field name="ROTATION_ANIMATION_ROTATE" since="18" />
<field name="SCREEN_BRIGHTNESS_CHANGED" since="3" />
<field name="SCREEN_ORIENTATION_CHANGED" since="3" />
<field name="SOFT_INPUT_ADJUST_NOTHING" since="11" />
@@ -25700,6 +27143,7 @@
<field name="horizontalWeight" />
<field name="memoryType" />
<field name="packageName" />
+ <field name="rotationAnimation" since="18" />
<field name="screenBrightness" since="3" />
<field name="screenOrientation" since="3" />
<field name="softInputMode" since="3" />
@@ -25820,6 +27264,7 @@
<method name="addChild(Landroid/view/View;)V" />
<method name="addChild(Landroid/view/View;I)V" since="16" />
<method name="findAccessibilityNodeInfosByText(Ljava/lang/String;)Ljava/util/List;" />
+ <method name="findAccessibilityNodeInfosByViewId(Ljava/lang/String;)Ljava/util/List;" since="18" />
<method name="findFocus(I)Landroid/view/accessibility/AccessibilityNodeInfo;" since="16" />
<method name="focusSearch(I)Landroid/view/accessibility/AccessibilityNodeInfo;" since="16" />
<method name="getActions()I" />
@@ -25835,11 +27280,15 @@
<method name="getPackageName()Ljava/lang/CharSequence;" />
<method name="getParent()Landroid/view/accessibility/AccessibilityNodeInfo;" />
<method name="getText()Ljava/lang/CharSequence;" />
+ <method name="getTextSelectionEnd()I" since="18" />
+ <method name="getTextSelectionStart()I" since="18" />
+ <method name="getViewIdResourceName()Ljava/lang/String;" since="18" />
<method name="getWindowId()I" />
<method name="isAccessibilityFocused()Z" since="16" />
<method name="isCheckable()Z" />
<method name="isChecked()Z" />
<method name="isClickable()Z" />
+ <method name="isEditable()Z" since="18" />
<method name="isEnabled()Z" />
<method name="isFocusable()Z" />
<method name="isFocused()Z" />
@@ -25855,6 +27304,7 @@
<method name="performAction(I)Z" />
<method name="performAction(ILandroid/os/Bundle;)Z" since="16" />
<method name="recycle()V" />
+ <method name="refresh()Z" since="18" />
<method name="setAccessibilityFocused(Z)V" since="16" />
<method name="setBoundsInParent(Landroid/graphics/Rect;)V" />
<method name="setBoundsInScreen(Landroid/graphics/Rect;)V" />
@@ -25863,6 +27313,7 @@
<method name="setClassName(Ljava/lang/CharSequence;)V" />
<method name="setClickable(Z)V" />
<method name="setContentDescription(Ljava/lang/CharSequence;)V" />
+ <method name="setEditable(Z)V" since="18" />
<method name="setEnabled(Z)V" />
<method name="setFocusable(Z)V" />
<method name="setFocused(Z)V" />
@@ -25881,23 +27332,32 @@
<method name="setSource(Landroid/view/View;)V" />
<method name="setSource(Landroid/view/View;I)V" since="16" />
<method name="setText(Ljava/lang/CharSequence;)V" />
+ <method name="setTextSelection(II)V" since="18" />
+ <method name="setViewIdResourceName(Ljava/lang/String;)V" since="18" />
<method name="setVisibleToUser(Z)V" since="16" />
<field name="ACTION_ACCESSIBILITY_FOCUS" since="16" />
+ <field name="ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN" since="18" />
<field name="ACTION_ARGUMENT_HTML_ELEMENT_STRING" since="16" />
<field name="ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT" since="16" />
+ <field name="ACTION_ARGUMENT_SELECTION_END_INT" since="18" />
+ <field name="ACTION_ARGUMENT_SELECTION_START_INT" since="18" />
<field name="ACTION_CLEAR_ACCESSIBILITY_FOCUS" since="16" />
<field name="ACTION_CLEAR_FOCUS" />
<field name="ACTION_CLEAR_SELECTION" />
<field name="ACTION_CLICK" since="16" />
+ <field name="ACTION_COPY" since="18" />
+ <field name="ACTION_CUT" since="18" />
<field name="ACTION_FOCUS" />
<field name="ACTION_LONG_CLICK" since="16" />
<field name="ACTION_NEXT_AT_MOVEMENT_GRANULARITY" since="16" />
<field name="ACTION_NEXT_HTML_ELEMENT" since="16" />
+ <field name="ACTION_PASTE" since="18" />
<field name="ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY" since="16" />
<field name="ACTION_PREVIOUS_HTML_ELEMENT" since="16" />
<field name="ACTION_SCROLL_BACKWARD" since="16" />
<field name="ACTION_SCROLL_FORWARD" since="16" />
<field name="ACTION_SELECT" />
+ <field name="ACTION_SET_SELECTION" since="18" />
<field name="CREATOR" />
<field name="FOCUS_ACCESSIBILITY" since="16" />
<field name="FOCUS_INPUT" since="16" />
@@ -27916,8 +29376,10 @@
<method name="setChildDivider(Landroid/graphics/drawable/Drawable;)V" />
<method name="setChildIndicator(Landroid/graphics/drawable/Drawable;)V" />
<method name="setChildIndicatorBounds(II)V" />
+ <method name="setChildIndicatorBoundsRelative(II)V" since="18" />
<method name="setGroupIndicator(Landroid/graphics/drawable/Drawable;)V" />
<method name="setIndicatorBounds(II)V" />
+ <method name="setIndicatorBoundsRelative(II)V" since="18" />
<method name="setOnChildClickListener(Landroid/widget/ExpandableListView$OnChildClickListener;)V" />
<method name="setOnGroupClickListener(Landroid/widget/ExpandableListView$OnGroupClickListener;)V" />
<method name="setOnGroupCollapseListener(Landroid/widget/ExpandableListView$OnGroupCollapseListener;)V" />
@@ -28393,6 +29855,7 @@
<method name="canPause()Z" since="5" />
<method name="canSeekBackward()Z" since="5" />
<method name="canSeekForward()Z" since="5" />
+ <method name="getAudioSessionId()I" since="18" />
<method name="getBufferPercentage()I" />
<method name="getCurrentPosition()I" />
<method name="getDuration()I" />
@@ -28592,7 +30055,9 @@
<method name="&lt;init>(Landroid/content/Context;Landroid/util/AttributeSet;)V" />
<method name="&lt;init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V" />
<method name="assignContactFromEmail(Ljava/lang/String;Z)V" />
+ <method name="assignContactFromEmail(Ljava/lang/String;ZLandroid/os/Bundle;)V" since="18" />
<method name="assignContactFromPhone(Ljava/lang/String;Z)V" />
+ <method name="assignContactFromPhone(Ljava/lang/String;ZLandroid/os/Bundle;)V" since="18" />
<method name="assignContactUri(Landroid/net/Uri;)V" />
<method name="setExcludeMimes([Ljava/lang/String;)V" />
<method name="setImageToDefault()V" since="11" />
@@ -29467,7 +30932,7 @@
<method name="getText1()Landroid/widget/TextView;" />
<method name="getText2()Landroid/widget/TextView;" />
</class>
- <class name="android/widget/ValueEditor" since="17">
+ <class name="android/widget/ValueEditor" since="18">
<extends name="java/lang/Object" />
<method name="getValueModel()Landroid/util/ValueModel;" />
<method name="setValueModel(Landroid/util/ValueModel;)V" />
diff --git a/sdk/build_tools_source.properties b/sdk/build_tools_source.properties
new file mode 100644
index 000000000..c7c8a0537
--- /dev/null
+++ b/sdk/build_tools_source.properties
@@ -0,0 +1,3 @@
+Pkg.UserSrc=false
+Pkg.Revision=18.0.0
+
diff --git a/sdk/plat_tools_source.properties b/sdk/plat_tools_source.properties
index a813d6f7e..c7c8a0537 100644
--- a/sdk/plat_tools_source.properties
+++ b/sdk/plat_tools_source.properties
@@ -1,2 +1,3 @@
Pkg.UserSrc=false
-Pkg.Revision=16.0.2
+Pkg.Revision=18.0.0
+
diff --git a/sdk/support_source.properties b/sdk/support_source.properties
index fb611ecf1..16170962f 100644
--- a/sdk/support_source.properties
+++ b/sdk/support_source.properties
@@ -1,5 +1,5 @@
Pkg.UserSrc=false
-Pkg.Revision=11
+Pkg.Revision=18
Extra.Vendor=android
Extra.VendorId=android
Extra.VendorDisplay=Android
diff --git a/testrunner/adb_interface.py b/testrunner/adb_interface.py
index 1f1e3c65d..fa394cd50 100755
--- a/testrunner/adb_interface.py
+++ b/testrunner/adb_interface.py
@@ -305,7 +305,7 @@ class AdbInterface:
command_string += " -e %s '%s'" % (key, value)
if raw_mode:
command_string += " -r"
- command_string += " -w %s" % instrumentation_path
+ command_string += " -w '%s'" % instrumentation_path
return command_string
def _CreateTraceDir(self):
diff --git a/testrunner/coverage_targets.xml b/testrunner/coverage_targets.xml
index 8966700a1..99ea93bff 100644
--- a/testrunner/coverage_targets.xml
+++ b/testrunner/coverage_targets.xml
@@ -69,6 +69,8 @@
type="APPS" />
<coverage_target name="DeskClock" build_path="packages/apps/DeskClock"
type="APPS" />
+ <coverage_target name="Dialer" build_path="packages/apps/Dialer"
+ type="APPS" />
<coverage_target name="Email" build_path="packages/apps/Email"
type="APPS" />
<coverage_target name="Exchange" build_path="packages/apps/Exchange"
diff --git a/testrunner/test_defs.xml b/testrunner/test_defs.xml
index 8494cb0cd..516dc7c1e 100644
--- a/testrunner/test_defs.xml
+++ b/testrunner/test_defs.xml
@@ -85,6 +85,11 @@ See test_defs.xsd for more information.
coverage_target="framework"
continuous="true" />
+<test name="frameworks-support"
+ build_path="frameworks/support/tests"
+ package="android.support.tests"
+ continuous="true" />
+
<test name="core"
build_path="frameworks/base/tests/CoreTests"
package="android.core"
@@ -182,6 +187,13 @@ See test_defs.xsd for more information.
runner=".MediaFrameworkUnitTestRunner"
coverage_target="framework" />
+<test-native name="camera-client-native"
+ build_path="frameworks/av/camera/tests/"
+ description="Camera client native tests." />
+
+<test-native name="camera-hal2-native"
+ build_path="hardware/libhardware/tests/camera2"
+ description="Camera hal2 native tests." />
<!-- end of media framework tests -->
<!-- targeted framework tests -->
@@ -278,6 +290,13 @@ See test_defs.xsd for more information.
coverage_target="framework"
suite="cts" />
+<test name="cts-dreams"
+ build_path="cts/tests/tests/dreams"
+ package="com.android.cts.dreams"
+ runner="android.test.InstrumentationCtsTestRunner"
+ coverage_target="framework"
+ suite="cts" />
+
<test name="cts-gesture"
build_path="cts/tests/tests/gesture"
package="com.android.cts.gesture"
@@ -442,6 +461,14 @@ See test_defs.xsd for more information.
runner="com.android.contacts.ContactsLaunchPerformance"
description="Launch performance for Contacts." />
+<test name="dialer"
+ build_path="packages/apps/Dialer"
+ package="com.android.dialer.tests"
+ runner="android.test.InstrumentationTestRunner"
+ coverage_target="Dialer"
+ description="Tests for the Dialer app."
+ continuous="true" />
+
<test name="downloadprovider"
build_path="packages/providers/DownloadProvider/tests"
package="com.android.providers.downloads.tests"
@@ -514,12 +541,6 @@ See test_defs.xsd for more information.
build_path="external/skia/tests"
description="Skia tests." />
-<!-- Android STL tests -->
-<test-native name="astl"
- build_path="external/astl/tests"
- description="Android STL."
- extra_build_args="ASTL_TESTS=1" />
-
<!-- Google Test -->
<test-native name="gtest"
build_path="external/gtest"
diff --git a/testrunner/test_defs/instrumentation_test.py b/testrunner/test_defs/instrumentation_test.py
index 092a77322..1bbedee71 100644
--- a/testrunner/test_defs/instrumentation_test.py
+++ b/testrunner/test_defs/instrumentation_test.py
@@ -252,26 +252,32 @@ class InstrumentationTestFactory(test_suite.AbstractTestFactory):
(android_manifest.AndroidManifest.FILENAME,
self.GetBuildPath()))
return tests
-
- for instr_name in manifest_parser.GetInstrumentationNames():
- pkg_name = manifest_parser.GetPackageName()
- if instr_name.find(".") < 0:
- instr_name = "." + instr_name
- logger.SilentLog('Found instrumentation %s/%s' % (pkg_name, instr_name))
- suite = InstrumentationTestSuite()
- suite.SetPackageName(pkg_name)
- suite.SetBuildPath(self.GetBuildPath())
- suite.SetRunnerName(instr_name)
- suite.SetName(pkg_name)
- suite.SetClassName(class_name_arg)
- suite.SetJavaPackageFilter(java_package_name)
- # this is a bit of a hack, assume if 'com.android.cts' is in
- # package name, this is a cts test
- # this logic can be removed altogether when cts tests no longer require
- # custom build steps
- if suite.GetPackageName().startswith('com.android.cts'):
- suite.SetSuite('cts')
- tests.append(suite)
+ elif len(instrs) > 1:
+ logger.Log("Found multiple instrumentation declarations in %s/%s. "
+ "Only using first declared." %
+ (self.GetBuildPath(),
+ android_manifest.AndroidManifest.FILENAME))
+ instr_name = manifest_parser.GetInstrumentationNames()[0]
+ # escape inner class names
+ instr_name = instr_name.replace('$', '\$')
+ pkg_name = manifest_parser.GetPackageName()
+ if instr_name.find(".") < 0:
+ instr_name = "." + instr_name
+ logger.SilentLog('Found instrumentation %s/%s' % (pkg_name, instr_name))
+ suite = InstrumentationTestSuite()
+ suite.SetPackageName(pkg_name)
+ suite.SetBuildPath(self.GetBuildPath())
+ suite.SetRunnerName(instr_name)
+ suite.SetName(pkg_name)
+ suite.SetClassName(class_name_arg)
+ suite.SetJavaPackageFilter(java_package_name)
+ # this is a bit of a hack, assume if 'com.android.cts' is in
+ # package name, this is a cts test
+ # this logic can be removed altogether when cts tests no longer require
+ # custom build steps
+ if suite.GetPackageName().startswith('com.android.cts'):
+ suite.SetSuite('cts')
+ tests.append(suite)
return tests
except:
diff --git a/tools/emulator/opengl/Android.mk b/tools/emulator/opengl/Android.mk
deleted file mode 100644
index 3a23395d0..000000000
--- a/tools/emulator/opengl/Android.mk
+++ /dev/null
@@ -1,66 +0,0 @@
-# This is the top-level build file for the Android HW OpenGL ES emulation
-# in Android.
-#
-# You must define BUILD_EMULATOR_OPENGL to 'true' in your environment to
-# build the following files.
-#
-# Also define BUILD_EMULATOR_OPENGL_DRIVER to 'true' to build the gralloc
-# stuff as well.
-#
-ifeq (true,$(BUILD_EMULATOR_OPENGL))
-
-# Top-level for all modules
-EMUGL_PATH := $(call my-dir)
-
-# Directory containing common headers used by several modules
-# This is always set to a module's LOCAL_C_INCLUDES
-# See the definition of emugl-begin-module in common.mk
-#
-EMUGL_COMMON_INCLUDES := $(EMUGL_PATH)/host/include/libOpenglRender
-
-# common cflags used by several modules
-# This is always set to a module's LOCAL_CFLAGS
-# See the definition of emugl-begin-module in common.mk
-#
-EMUGL_COMMON_CFLAGS := -DWITH_GLES2
-
-# Uncomment the following line if you want to enable debug traces
-# in the GLES emulation libraries.
-# EMUGL_COMMON_CFLAGS += -DEMUGL_DEBUG=1
-
-# Include common definitions used by all the modules included later
-# in this build file. This contains the definition of all useful
-# emugl-xxxx functions.
-#
-include $(EMUGL_PATH)/common.mk
-
-# IMPORTANT: ORDER IS CRUCIAL HERE
-#
-# For the import/export feature to work properly, you must include
-# modules below in correct order. That is, if module B depends on
-# module A, then it must be included after module A below.
-#
-# This ensures that anything exported by module A will be correctly
-# be imported by module B when it is declared.
-#
-# Note that the build system will complain if you try to import a
-# module that hasn't been declared yet anyway.
-#
-
-include $(EMUGL_PATH)/shared/OpenglOsUtils/Android.mk
-include $(EMUGL_PATH)/shared/OpenglCodecCommon/Android.mk
-
-# System static libraries
-include $(EMUGL_PATH)/system/GLESv1_enc/Android.mk
-include $(EMUGL_PATH)/system/GLESv2_enc/Android.mk
-include $(EMUGL_PATH)/system/renderControl_enc/Android.mk
-include $(EMUGL_PATH)/system/OpenglSystemCommon/Android.mk
-
-# System shared libraries
-include $(EMUGL_PATH)/system/GLESv1/Android.mk
-include $(EMUGL_PATH)/system/GLESv2/Android.mk
-
-include $(EMUGL_PATH)/system/gralloc/Android.mk
-include $(EMUGL_PATH)/system/egl/Android.mk
-
-endif # BUILD_EMULATOR_OPENGL == true
diff --git a/tools/emulator/opengl/README b/tools/emulator/opengl/README
deleted file mode 100644
index 91050ed1c..000000000
--- a/tools/emulator/opengl/README
+++ /dev/null
@@ -1,3 +0,0 @@
-This directory contains Android-side modules related to hardware OpenGL ES
-emulation. The host-side modules and documentation are in
-$ANDROID_BUILD_TOP/sdk/emulator/opengl.
diff --git a/tools/emulator/opengl/common.mk b/tools/emulator/opengl/common.mk
deleted file mode 100644
index 6dd503e9c..000000000
--- a/tools/emulator/opengl/common.mk
+++ /dev/null
@@ -1,240 +0,0 @@
-# This top-level build file is included by all modules that implement
-# the hardware OpenGL ES emulation for Android.
-#
-# We use it to ensure that all sub-Makefiles are included in the right
-# order for various variable definitions and usage to happen in the correct
-# order.
-#
-
-# The following macros are used to start a new GLES emulation module.
-#
-# This will define LOCAL_MODULE as $1, plus a few other variables
-# needed by the build system (e.g. LOCAL_MODULE_TAGS, LOCAL_MODULE_CLASS...)
-#
-# NOTE: You still need to define LOCAL_PATH before this
-#
-# Usage example:
-#
-# $(call emugl-begin-static-library,<name>)
-# LOCAL_SRC_FILES := ....
-# LOCAL_C_INCLUDES += ....
-# $(call emugl-end-module)
-#
-emugl-begin-static-library = $(call emugl-begin-module,$1,STATIC_LIBRARY)
-emugl-begin-shared-library = $(call emugl-begin-module,$1,SHARED_LIBRARY)
-
-# Internal list of all declared modules (used for sanity checking)
-_emugl_modules :=
-_emugl_HOST_modules :=
-
-# do not use directly, see functions above instead
-emugl-begin-module = \
- $(eval include $(CLEAR_VARS)) \
- $(eval LOCAL_MODULE := $1) \
- $(eval LOCAL_MODULE_CLASS := $(patsubst HOST_%,%,$(patsubst %EXECUTABLE,%EXECUTABLES,$(patsubst %LIBRARY,%LIBRARIES,$2)))) \
- $(eval LOCAL_IS_HOST_MODULE := $(if $3,true,))\
- $(eval LOCAL_C_INCLUDES := $(EMUGL_COMMON_INCLUDES)) \
- $(eval LOCAL_CFLAGS := $(EMUGL_COMMON_CFLAGS)) \
- $(eval LOCAL_PRELINK_MODULE := false)\
- $(eval _EMUGL_INCLUDE_TYPE := $(BUILD_$2)) \
- $(call _emugl-init-module,$1,$2,$3)
-
-# Used to end a module definition, see function definitions above
-emugl-end-module = \
- $(eval include $(_EMUGL_INCLUDE_TYPE))\
- $(eval _EMUGL_INCLUDE_TYPE :=) \
- $(eval _emugl_$(_emugl_HOST)modules += $(_emugl_MODULE))\
- $(if $(EMUGL_DEBUG),$(call emugl-dump-module))
-
-# Managing module exports and imports.
-#
-# A module can 'import' another module, by calling emugl-import. This will
-# make the current LOCAL_MODULE inherit various definitions exported from
-# the imported module.
-#
-# Module exports are defined by calling emugl-export. Here is an example:
-#
-# $(call emugl-begin-static-library,foo)
-# LOCAL_SRC_FILES := foo.c
-# $(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-# $(call emugl-export,SHARED_LIBRARIES,libcutils)
-# $(call emugl-end-module)
-#
-# $(call emugl-begin-shared-library,bar)
-# LOCAL_SRC_FILES := bar.cpp
-# $(call emugl-import,foo)
-# $(call emugl-end-module)
-#
-# Here, we define a static library named 'foo' which exports an include
-# path and a shared library requirement, and a shared library 'bar' which
-# imports it.
-#
-# What this means is that:
-#
-# - 'bar' will automatically inherit foo's LOCAL_PATH in its LOCAL_C_INCLUDES
-# - 'bar' will automatically inherit libcutils in its own LOCAL_SHARED_LIBRARIES
-#
-# Note that order of declaration matters. If 'foo' is defined after 'bar' in
-# the example above, nothing will work correctly because dependencies are
-# computed at import time.
-#
-#
-# IMPORTANT: Imports are transitive, i.e. when module A imports B,
-# it automatically imports anything imported by B too.
-
-# This is the list of recognized export types we support for now.
-EMUGL_EXPORT_TYPES := \
- CFLAGS \
- LDLIBS \
- LDFLAGS \
- C_INCLUDES \
- SHARED_LIBRARIES \
- STATIC_LIBRARIES \
- ADDITIONAL_DEPENDENCIES
-
-# Initialize a module in our database
-# $1: Module name
-# $2: Module type
-# $3: "HOST" for a host module, empty for a target one.
-_emugl-init-module = \
- $(eval _emugl_HOST := $(if $3,HOST_,))\
- $(eval _emugl_MODULE := $(_emugl_HOST)$1)\
- $(if $(filter $(_emugl_$(_emugl_HOST)modules),$(_emugl_MODULE)),\
- $(error There is already a $(if $3,host,) module named $1!)\
- )\
- $(eval _mod = $(_emugl_MODULE)) \
- $(eval _emugl.$(_mod).type := $(patsubst HOST_%,%,$2))\
- $(eval _emugl.$(_mod).imports :=) \
- $(eval _emugl,$(_mod).moved :=) \
- $(foreach _type,$(EMUGL_EXPORT_TYPES),\
- $(eval _emugl.$(_mod).export.$(_type) :=)\
- )
-
-# Called to indicate that a module exports a given local variable for its
-# users. This also adds this to LOCAL_$1
-# $1: Local variable type (e.g. CFLAGS, LDLIBS, etc...)
-# $2: Value(s) to append to the export
-emugl-export = \
- $(eval _emugl.$(_emugl_MODULE).export.$1 += $2)\
- $(eval LOCAL_$1 := $2 $(LOCAL_$1))
-
-emugl-export-outer = \
- $(eval _emugl.$(_emugl_MODULE).export.$1 += $2)
-
-# Called to indicate that a module imports the exports of another module
-# $1: list of modules to import
-#
-emugl-import = \
- $(foreach _imod,$1,\
- $(call _emugl-module-import,$(_emugl_HOST)$(_imod))\
- )
-
-_emugl-module-import = \
- $(eval _mod := $(_emugl_MODULE))\
- $(if $(filter-out $(_emugl_$(_emugl_HOST)modules),$1),\
- $(info Unknown imported emugles module: $1)\
- $(if $(_emugl_HOST),\
- $(eval _names := $(patsubst HOST_%,%,$(_emugl_HOST_modules))),\
- $(eval _names := $(_emugl_modules))\
- )\
- $(info Please one of the following names: $(_names))\
- $(error Aborting)\
- )\
- $(if $(filter-out $(_emugl.$(_mod).imports),$1),\
- $(eval _emugl.$(_mod).imports += $1)\
- $(foreach _sub,$(_emugl.$1.imports),\
- $(call _emugl-module-import,$(_sub))\
- )\
- $(foreach _type,$(EMUGL_EXPORT_TYPES),\
- $(eval LOCAL_$(_type) := $(_emugl.$1.export.$(_type)) $(LOCAL_$(_type)))\
- )\
- $(if $(filter EXECUTABLE SHARED_LIBRARY,$(_emugl.$(_emugl_MODULE).type)),\
- $(if $(filter STATIC_LIBRARY,$(_emugl.$1.type)),\
- $(eval LOCAL_STATIC_LIBRARIES := $(1:HOST_%=%) $(LOCAL_STATIC_LIBRARIES))\
- )\
- $(if $(filter SHARED_LIBRARY,$(_emugl.$1.type)),\
- $(if $(_emugl.$1.moved),,\
- $(eval LOCAL_SHARED_LIBRARIES := $(1:HOST_%=%) $(LOCAL_SHARED_LIBRARIES))\
- )\
- )\
- )\
- )
-
-_emugl-dump-list = \
- $(foreach _list_item,$(strip $1),$(info . $(_list_item)))
-
-emugl-dump-module = \
- $(info MODULE=$(_emugl_MODULE))\
- $(info . HOST=$(_emugl_HOST))\
- $(info . TYPE=$(_emugl.$(_emugl_MODULE).type))\
- $(info . IMPORTS=$(_emugl.$(_emugl_MODULE).imports))\
- $(foreach _type,$(EMUGL_EXPORT_TYPES),\
- $(if $(filter C_INCLUDES ADDITIONAL_DEPENDENCIES,$(_type)),\
- $(info . EXPORT.$(_type) :=)\
- $(call _emugl-dump-list,$(_emugl.$(_emugl_MODULE).export.$(_type)))\
- $(info . LOCAL_$(_type) :=)\
- $(call _emugl-dump-list,$(LOCAL_$(_type)))\
- ,\
- $(info . EXPORT.$(_type) := $(strip $(_emugl.$(_emugl_MODULE).export.$(_type))))\
- $(info . LOCAL_$(_type) := $(strip $(LOCAL_$(_type))))\
- )\
- )\
- $(info . LOCAL_SRC_FILES := $(LOCAL_SRC_FILES))\
-
-# This function can be called to generate the wrapper source files.
-# LOCAL_MODULE and LOCAL_MODULE_CLASS must be defined or the build will abort.
-# Source files will be stored in the local intermediates directory that will
-# be automatically added to your LOCAL_C_INCLUDES.
-# Usage:
-# $(call emugl-gen-wrapper,<input-dir>,<basename>)
-#
-emugl-gen-wrapper = \
- $(eval _emugl_out := $(call local-intermediates-dir)) \
- $(call emugl-gen-wrapper-generic,$(_emugl_out),$1,$2) \
- $(call emugl-export,C_INCLUDES,$(_emugl_out))
-
-# DO NOT CALL DIRECTLY, USE emugl-gen-wrapper instead.
-#
-# The following function can be called to generate GL library wrapper
-# Usage is:
-#
-# $(call emugl-gen-wrapper-generic,<dst-dir>,<src-dir>,<basename>)
-#
-# <dst-dir> is the destination directory where the generated sources are stored
-# <src-dir> is the source directory where to find <basename>.attrib, etc..
-# <basename> is the emugen basename (see host/tools/emugen/README)
-#
-emugl-gen-wrapper-generic = $(eval $(emugl-gen-wrapper-generic-ev))
-
-define emugl-gen-wrapper-generic-ev
-_emugl_wrap := $$1/$$3
-_emugl_src := $$2/$$3
-GEN := $$(_emugl_wrap)_wrapper_entry.cpp \
- $$(_emugl_wrap)_wrapper_context.cpp \
- $$(_emugl_wrap)_wrapper_context.h \
- $$(_emugl_wrap)_wrapper_proc.h
-
-$$(GEN): PRIVATE_PATH := $$(LOCAL_PATH)
-$$(GEN): PRIVATE_CUSTOM_TOOL := $$(EMUGL_EMUGEN) -W $$1 -i $$2 $$3
-$$(GEN): $$(EMUGL_EMUGEN) $$(_emugl_src).attrib $$(_emugl_src).in $$(_emugl_src).types
- $$(transform-generated-source)
-
-$$(call emugl-export,ADDITIONAL_DEPENDENCIES,$$(GEN))
-LOCAL_GENERATED_SOURCES += $$(GEN)
-LOCAL_C_INCLUDES += $$1
-
-#ifneq ($$(HOST_OS),windows)
-$$(call emugl-export,LDFLAGS,-ldl)
-#endif
-
-endef
-
-# Call this function when your shared library must be placed in a non-standard
-# library path (i.e. not under /system/lib
-# $1: library sub-path,relative to /system/lib
-# For example: $(call emugl-set-shared-library-subpath,egl)
-emugl-set-shared-library-subpath = \
- $(eval LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/$1)\
- $(eval LOCAL_UNSTRIPPED_PATH := $(TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)/$1)\
- $(eval _emugl.$(LOCAL_MODULE).moved := true)\
- $(call emugl-export-outer,ADDITIONAL_DEPENDENCIES,$(LOCAL_MODULE_PATH)/$(LOCAL_MODULE)$(TARGET_SHLIB_SUFFIX))
diff --git a/tools/emulator/opengl/host/include/libOpenglRender/IOStream.h b/tools/emulator/opengl/host/include/libOpenglRender/IOStream.h
deleted file mode 100644
index 445ec17da..000000000
--- a/tools/emulator/opengl/host/include/libOpenglRender/IOStream.h
+++ /dev/null
@@ -1,102 +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.
-*/
-#ifndef __IO_STREAM_H__
-#define __IO_STREAM_H__
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "ErrorLog.h"
-
-class IOStream {
-public:
-
- IOStream(size_t bufSize) {
- m_buf = NULL;
- m_bufsize = bufSize;
- m_free = 0;
- }
-
- virtual void *allocBuffer(size_t minSize) = 0;
- virtual int commitBuffer(size_t size) = 0;
- virtual const unsigned char *readFully( void *buf, size_t len) = 0;
- virtual const unsigned char *read( void *buf, size_t *inout_len) = 0;
- virtual int writeFully(const void* buf, size_t len) = 0;
-
- virtual ~IOStream() {
-
- // NOTE: m_buf is 'owned' by the child class thus we expect it to be released by it
- }
-
- unsigned char *alloc(size_t len) {
-
- if (m_buf && len > m_free) {
- if (flush() < 0) {
- ERR("Failed to flush in alloc\n");
- return NULL; // we failed to flush so something is wrong
- }
- }
-
- if (!m_buf || len > m_bufsize) {
- int allocLen = m_bufsize < len ? len : m_bufsize;
- m_buf = (unsigned char *)allocBuffer(allocLen);
- if (!m_buf) {
- ERR("Alloc (%u bytes) failed\n", allocLen);
- return NULL;
- }
- m_bufsize = m_free = allocLen;
- }
-
- unsigned char *ptr;
-
- ptr = m_buf + (m_bufsize - m_free);
- m_free -= len;
-
- return ptr;
- }
-
- int flush() {
-
- if (!m_buf || m_free == m_bufsize) return 0;
-
- int stat = commitBuffer(m_bufsize - m_free);
- m_buf = NULL;
- m_free = 0;
- return stat;
- }
-
- const unsigned char *readback(void *buf, size_t len) {
- flush();
- return readFully(buf, len);
- }
-
-
-private:
- unsigned char *m_buf;
- size_t m_bufsize;
- size_t m_free;
-};
-
-//
-// When a client opens a connection to the renderer, it should
-// send unsigned int value indicating the "clientFlags".
-// The following are the bitmask of the clientFlags.
-// currently only one bit is used which flags the server
-// it should exit.
-//
-#define IOSTREAM_CLIENT_EXIT_SERVER 1
-
-#endif
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/Android.mk b/tools/emulator/opengl/shared/OpenglCodecCommon/Android.mk
deleted file mode 100644
index df9b39a8a..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/Android.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# This build script corresponds to a library containing many definitions
-# common to both the guest and the host. They relate to
-#
-LOCAL_PATH := $(call my-dir)
-
-commonSources := \
- GLClientState.cpp \
- GLSharedGroup.cpp \
- glUtils.cpp \
- SocketStream.cpp \
- TcpStream.cpp \
- TimeUtils.cpp
-
-### CodecCommon guest ##############################################
-$(call emugl-begin-static-library,libOpenglCodecCommon)
-
-LOCAL_SRC_FILES := $(commonSources)
-
-LOCAL_CFLAGS += -DLOG_TAG=\"eglCodecCommon\"
-
-$(call emugl-export,SHARED_LIBRARIES,libcutils libutils)
-$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-$(call emugl-end-module)
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/ErrorLog.h b/tools/emulator/opengl/shared/OpenglCodecCommon/ErrorLog.h
deleted file mode 100644
index 6f41fd78f..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/ErrorLog.h
+++ /dev/null
@@ -1,37 +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.
-*/
-#ifndef _ERROR_LOG_H_
-#define _ERROR_LOG_H_
-
-#if (HAVE_ANDROID_OS == 1)
-# include <cutils/log.h>
-# define ERR(...) ALOGE(__VA_ARGS__)
-# ifdef EMUGL_DEBUG
-# define DBG(...) ALOGD(__VA_ARGS__)
-# else
-# define DBG(...) ((void)0)
-# endif
-#else
-# include <stdio.h>
-# define ERR(...) fprintf(stderr, __VA_ARGS__)
-# ifdef EMUGL_DEBUG
-# define DBG(...) fprintf(stderr, __VA_ARGS__)
-# else
-# define DBG(...) ((void)0)
-# endif
-#endif
-
-#endif
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/FixedBuffer.h b/tools/emulator/opengl/shared/OpenglCodecCommon/FixedBuffer.h
deleted file mode 100644
index 30b9a80ee..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/FixedBuffer.h
+++ /dev/null
@@ -1,53 +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.
-*/
-#ifndef _FIXED_BUFFER_H
-#define _FIXED_BUFFER_H
-
-class FixedBuffer {
-public:
- FixedBuffer(size_t initialSize = 0) {
- m_buffer = NULL;
- m_bufferLen = 0;
- alloc(m_bufferLen);
- }
-
- ~FixedBuffer() {
- delete [] m_buffer;
- m_bufferLen = 0;
- }
-
- void * alloc(size_t size) {
- if (m_bufferLen >= size)
- return (void *)(m_buffer);
-
- if (m_buffer != NULL)
- delete[] m_buffer;
-
- m_bufferLen = size;
- m_buffer = new unsigned char[m_bufferLen];
- if (m_buffer == NULL)
- m_bufferLen = 0;
-
- return m_buffer;
- }
- void *ptr() { return m_buffer; }
- size_t len() { return m_bufferLen; }
-private:
- unsigned char *m_buffer;
- size_t m_bufferLen;
-};
-
-#endif
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp b/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp
deleted file mode 100644
index 979549029..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp
+++ /dev/null
@@ -1,417 +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.
-*/
-#include "GLClientState.h"
-#include "ErrorLog.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "glUtils.h"
-#include <cutils/log.h>
-
-#ifndef MAX
-#define MAX(a, b) ((a) < (b) ? (b) : (a))
-#endif
-
-GLClientState::GLClientState(int nLocations)
-{
- if (nLocations < LAST_LOCATION) {
- nLocations = LAST_LOCATION;
- }
- m_nLocations = nLocations;
- m_states = new VertexAttribState[m_nLocations];
- for (int i = 0; i < m_nLocations; i++) {
- m_states[i].enabled = 0;
- m_states[i].enableDirty = false;
- }
- m_currentArrayVbo = 0;
- m_currentIndexVbo = 0;
- // init gl constans;
- m_states[VERTEX_LOCATION].glConst = GL_VERTEX_ARRAY;
- m_states[NORMAL_LOCATION].glConst = GL_NORMAL_ARRAY;
- m_states[COLOR_LOCATION].glConst = GL_COLOR_ARRAY;
- m_states[POINTSIZE_LOCATION].glConst = GL_POINT_SIZE_ARRAY_OES;
- m_states[TEXCOORD0_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
- m_states[TEXCOORD1_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
- m_states[TEXCOORD2_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
- m_states[TEXCOORD3_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
- m_states[TEXCOORD4_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
- m_states[TEXCOORD5_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
- m_states[TEXCOORD6_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
- m_states[TEXCOORD7_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
- m_states[MATRIXINDEX_LOCATION].glConst = GL_MATRIX_INDEX_ARRAY_OES;
- m_states[WEIGHT_LOCATION].glConst = GL_WEIGHT_ARRAY_OES;
- m_activeTexture = 0;
- m_currentProgram = 0;
-
- m_pixelStore.unpack_alignment = 4;
- m_pixelStore.pack_alignment = 4;
-
- memset(m_tex.unit, 0, sizeof(m_tex.unit));
- m_tex.activeUnit = &m_tex.unit[0];
- m_tex.textures = NULL;
- m_tex.numTextures = 0;
- m_tex.allocTextures = 0;
-}
-
-GLClientState::~GLClientState()
-{
- delete m_states;
-}
-
-void GLClientState::enable(int location, int state)
-{
- if (!validLocation(location)) {
- return;
- }
-
- m_states[location].enableDirty |= (state != m_states[location].enabled);
- m_states[location].enabled = state;
-}
-
-void GLClientState::setState(int location, int size, GLenum type, GLboolean normalized, GLsizei stride, const void *data)
-{
- if (!validLocation(location)) {
- return;
- }
- m_states[location].size = size;
- m_states[location].type = type;
- m_states[location].stride = stride;
- m_states[location].data = (void*)data;
- m_states[location].bufferObject = m_currentArrayVbo;
- m_states[location].elementSize = glSizeof(type) * size;
- m_states[location].normalized = normalized;
-}
-
-void GLClientState::setBufferObject(int location, GLuint id)
-{
- if (!validLocation(location)) {
- return;
- }
-
- m_states[location].bufferObject = id;
-}
-
-const GLClientState::VertexAttribState * GLClientState::getState(int location)
-{
- if (!validLocation(location)) {
- return NULL;
- }
- return & m_states[location];
-}
-
-const GLClientState::VertexAttribState * GLClientState::getStateAndEnableDirty(int location, bool *enableChanged)
-{
- if (!validLocation(location)) {
- return NULL;
- }
-
- if (enableChanged) {
- *enableChanged = m_states[location].enableDirty;
- }
-
- m_states[location].enableDirty = false;
- return & m_states[location];
-}
-
-int GLClientState::getLocation(GLenum loc)
-{
- int retval;
-
- switch(loc) {
- case GL_VERTEX_ARRAY:
- retval = int(VERTEX_LOCATION);
- break;
- case GL_NORMAL_ARRAY:
- retval = int(NORMAL_LOCATION);
- break;
- case GL_COLOR_ARRAY:
- retval = int(COLOR_LOCATION);
- break;
- case GL_POINT_SIZE_ARRAY_OES:
- retval = int(POINTSIZE_LOCATION);
- break;
- case GL_TEXTURE_COORD_ARRAY:
- retval = int (TEXCOORD0_LOCATION + m_activeTexture);
- break;
- case GL_MATRIX_INDEX_ARRAY_OES:
- retval = int (MATRIXINDEX_LOCATION);
- break;
- case GL_WEIGHT_ARRAY_OES:
- retval = int (WEIGHT_LOCATION);
- break;
- default:
- retval = loc;
- }
- return retval;
-}
-
-void GLClientState::getClientStatePointer(GLenum pname, GLvoid** params)
-{
- const GLClientState::VertexAttribState *state = NULL;
- switch (pname) {
- case GL_VERTEX_ARRAY_POINTER: {
- state = getState(GLClientState::VERTEX_LOCATION);
- break;
- }
- case GL_NORMAL_ARRAY_POINTER: {
- state = getState(GLClientState::NORMAL_LOCATION);
- break;
- }
- case GL_COLOR_ARRAY_POINTER: {
- state = getState(GLClientState::COLOR_LOCATION);
- break;
- }
- case GL_TEXTURE_COORD_ARRAY_POINTER: {
- state = getState(getActiveTexture() + GLClientState::TEXCOORD0_LOCATION);
- break;
- }
- case GL_POINT_SIZE_ARRAY_POINTER_OES: {
- state = getState(GLClientState::POINTSIZE_LOCATION);
- break;
- }
- case GL_MATRIX_INDEX_ARRAY_POINTER_OES: {
- state = getState(GLClientState::MATRIXINDEX_LOCATION);
- break;
- }
- case GL_WEIGHT_ARRAY_POINTER_OES: {
- state = getState(GLClientState::WEIGHT_LOCATION);
- break;
- }
- }
- if (state && params)
- *params = state->data;
-}
-
-int GLClientState::setPixelStore(GLenum param, GLint value)
-{
- int retval = 0;
- switch(param) {
- case GL_UNPACK_ALIGNMENT:
- if (value == 1 || value == 2 || value == 4 || value == 8) {
- m_pixelStore.unpack_alignment = value;
- } else {
- retval = GL_INVALID_VALUE;
- }
- break;
- case GL_PACK_ALIGNMENT:
- if (value == 1 || value == 2 || value == 4 || value == 8) {
- m_pixelStore.pack_alignment = value;
- } else {
- retval = GL_INVALID_VALUE;
- }
- break;
- default:
- retval = GL_INVALID_ENUM;
- }
- return retval;
-}
-
-
-
-
-size_t GLClientState::pixelDataSize(GLsizei width, GLsizei height, GLenum format, GLenum type, int pack) const
-{
- int pixelsize = glUtilsPixelBitSize(format, type) >> 3;
-
- int alignment = pack ? m_pixelStore.pack_alignment : m_pixelStore.unpack_alignment;
-
- if (pixelsize == 0 ) {
- ERR("unknown pixel size: width: %d height: %d format: %d type: %d pack: %d align: %d\n",
- width, height, format, type, pack, alignment);
- }
- size_t linesize = pixelsize * width;
- size_t aligned_linesize = int(linesize / alignment) * alignment;
- if (aligned_linesize < linesize) {
- aligned_linesize += alignment;
- }
- return aligned_linesize * height;
-}
-
-GLenum GLClientState::setActiveTextureUnit(GLenum texture)
-{
- GLuint unit = texture - GL_TEXTURE0;
- if (unit >= MAX_TEXTURE_UNITS) {
- return GL_INVALID_OPERATION;
- }
- m_tex.activeUnit = &m_tex.unit[unit];
- return GL_NO_ERROR;
-}
-
-GLenum GLClientState::getActiveTextureUnit() const
-{
- return GL_TEXTURE0 + (m_tex.activeUnit - &m_tex.unit[0]);
-}
-
-void GLClientState::enableTextureTarget(GLenum target)
-{
- switch (target) {
- case GL_TEXTURE_2D:
- m_tex.activeUnit->enables |= (1u << TEXTURE_2D);
- break;
- case GL_TEXTURE_EXTERNAL_OES:
- m_tex.activeUnit->enables |= (1u << TEXTURE_EXTERNAL);
- break;
- }
-}
-
-void GLClientState::disableTextureTarget(GLenum target)
-{
- switch (target) {
- case GL_TEXTURE_2D:
- m_tex.activeUnit->enables &= ~(1u << TEXTURE_2D);
- break;
- case GL_TEXTURE_EXTERNAL_OES:
- m_tex.activeUnit->enables &= ~(1u << TEXTURE_EXTERNAL);
- break;
- }
-}
-
-GLenum GLClientState::getPriorityEnabledTarget(GLenum allDisabled) const
-{
- unsigned int enables = m_tex.activeUnit->enables;
- if (enables & (1u << TEXTURE_EXTERNAL)) {
- return GL_TEXTURE_EXTERNAL_OES;
- } else if (enables & (1u << TEXTURE_2D)) {
- return GL_TEXTURE_2D;
- } else {
- return allDisabled;
- }
-}
-
-int GLClientState::compareTexId(const void* pid, const void* prec)
-{
- const GLuint* id = (const GLuint*)pid;
- const TextureRec* rec = (const TextureRec*)prec;
- return (GLint)(*id) - (GLint)rec->id;
-}
-
-GLenum GLClientState::bindTexture(GLenum target, GLuint texture,
- GLboolean* firstUse)
-{
- GLboolean first = GL_FALSE;
- TextureRec* texrec = NULL;
- if (texture != 0) {
- if (m_tex.textures) {
- texrec = (TextureRec*)bsearch(&texture, m_tex.textures,
- m_tex.numTextures, sizeof(TextureRec), compareTexId);
- }
- if (!texrec) {
- if (!(texrec = addTextureRec(texture, target))) {
- return GL_OUT_OF_MEMORY;
- }
- first = GL_TRUE;
- }
- if (target != texrec->target) {
- return GL_INVALID_OPERATION;
- }
- }
-
- switch (target) {
- case GL_TEXTURE_2D:
- m_tex.activeUnit->texture[TEXTURE_2D] = texture;
- break;
- case GL_TEXTURE_EXTERNAL_OES:
- m_tex.activeUnit->texture[TEXTURE_EXTERNAL] = texture;
- break;
- }
-
- if (firstUse) {
- *firstUse = first;
- }
-
- return GL_NO_ERROR;
-}
-
-GLClientState::TextureRec* GLClientState::addTextureRec(GLuint id,
- GLenum target)
-{
- if (m_tex.numTextures == m_tex.allocTextures) {
- const GLuint MAX_TEXTURES = 0xFFFFFFFFu;
-
- GLuint newAlloc;
- if (MAX_TEXTURES - m_tex.allocTextures >= m_tex.allocTextures) {
- newAlloc = MAX(4, 2 * m_tex.allocTextures);
- } else {
- if (m_tex.allocTextures == MAX_TEXTURES) {
- return NULL;
- }
- newAlloc = MAX_TEXTURES;
- }
-
- TextureRec* newTextures = (TextureRec*)realloc(m_tex.textures,
- newAlloc * sizeof(TextureRec));
- if (!newTextures) {
- return NULL;
- }
-
- m_tex.textures = newTextures;
- m_tex.allocTextures = newAlloc;
- }
-
- TextureRec* tex = m_tex.textures + m_tex.numTextures;
- TextureRec* prev = tex - 1;
- while (tex != m_tex.textures && id < prev->id) {
- *tex-- = *prev--;
- }
- tex->id = id;
- tex->target = target;
- m_tex.numTextures++;
-
- return tex;
-}
-
-GLuint GLClientState::getBoundTexture(GLenum target) const
-{
- switch (target) {
- case GL_TEXTURE_2D:
- return m_tex.activeUnit->texture[TEXTURE_2D];
- case GL_TEXTURE_EXTERNAL_OES:
- return m_tex.activeUnit->texture[TEXTURE_EXTERNAL];
- default:
- return 0;
- }
-}
-
-void GLClientState::deleteTextures(GLsizei n, const GLuint* textures)
-{
- // Updating the textures array could be made more efficient when deleting
- // several textures:
- // - compacting the array could be done in a single pass once the deleted
- // textures are marked, or
- // - could swap deleted textures to the end and re-sort.
- TextureRec* texrec;
- for (const GLuint* texture = textures; texture != textures + n; texture++) {
- texrec = (TextureRec*)bsearch(texture, m_tex.textures,
- m_tex.numTextures, sizeof(TextureRec), compareTexId);
- if (texrec) {
- const TextureRec* end = m_tex.textures + m_tex.numTextures;
- memmove(texrec, texrec + 1,
- (end - texrec - 1) * sizeof(TextureRec));
- m_tex.numTextures--;
-
- for (TextureUnit* unit = m_tex.unit;
- unit != m_tex.unit + MAX_TEXTURE_UNITS;
- unit++)
- {
- if (unit->texture[TEXTURE_2D] == *texture) {
- unit->texture[TEXTURE_2D] = 0;
- } else if (unit->texture[TEXTURE_EXTERNAL] == *texture) {
- unit->texture[TEXTURE_EXTERNAL] = 0;
- }
- }
- }
- }
-}
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h b/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h
deleted file mode 100644
index c86329b44..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h
+++ /dev/null
@@ -1,441 +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.
-*/
-#ifndef _GL_CLIENT_STATE_H_
-#define _GL_CLIENT_STATE_H_
-
-#define GL_API
-#ifndef ANDROID
-#define GL_APIENTRY
-#define GL_APIENTRYP
-#endif
-
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "ErrorLog.h"
-#include "codec_defs.h"
-
-class GLClientState {
-public:
- typedef enum {
- VERTEX_LOCATION = 0,
- NORMAL_LOCATION = 1,
- COLOR_LOCATION = 2,
- POINTSIZE_LOCATION = 3,
- TEXCOORD0_LOCATION = 4,
- TEXCOORD1_LOCATION = 5,
- TEXCOORD2_LOCATION = 6,
- TEXCOORD3_LOCATION = 7,
- TEXCOORD4_LOCATION = 8,
- TEXCOORD5_LOCATION = 9,
- TEXCOORD6_LOCATION = 10,
- TEXCOORD7_LOCATION = 11,
- MATRIXINDEX_LOCATION = 12,
- WEIGHT_LOCATION = 13,
- LAST_LOCATION = 14
- } StateLocation;
-
- typedef struct {
- GLint enabled;
- GLint size;
- GLenum type;
- GLsizei stride;
- void *data;
- GLuint bufferObject;
- GLenum glConst;
- unsigned int elementSize;
- bool enableDirty; // true if any enable state has changed since last draw
- bool normalized;
- } VertexAttribState;
-
- typedef struct {
- int unpack_alignment;
- int pack_alignment;
- } PixelStoreState;
-
- enum {
- MAX_TEXTURE_UNITS = 32,
- };
-
-public:
- GLClientState(int nLocations = CODEC_MAX_VERTEX_ATTRIBUTES);
- ~GLClientState();
- int nLocations() { return m_nLocations; }
- const PixelStoreState *pixelStoreState() { return &m_pixelStore; }
- int setPixelStore(GLenum param, GLint value);
- GLuint currentArrayVbo() { return m_currentArrayVbo; }
- GLuint currentIndexVbo() { return m_currentIndexVbo; }
- void enable(int location, int state);
- void setState(int location, int size, GLenum type, GLboolean normalized, GLsizei stride, const void *data);
- void setBufferObject(int location, GLuint id);
- const VertexAttribState *getState(int location);
- const VertexAttribState *getStateAndEnableDirty(int location, bool *enableChanged);
- int getLocation(GLenum loc);
- void setActiveTexture(int texUnit) {m_activeTexture = texUnit; };
- int getActiveTexture() const { return m_activeTexture; }
-
- int bindBuffer(GLenum target, GLuint id)
- {
- int err = 0;
- switch(target) {
- case GL_ARRAY_BUFFER:
- m_currentArrayVbo = id;
- break;
- case GL_ELEMENT_ARRAY_BUFFER:
- m_currentIndexVbo = id;
- break;
- default:
- err = -1;
- }
- return err;
- }
-
- int getBuffer(GLenum target)
- {
- int ret=0;
- switch (target) {
- case GL_ARRAY_BUFFER:
- ret = m_currentArrayVbo;
- break;
- case GL_ELEMENT_ARRAY_BUFFER:
- ret = m_currentIndexVbo;
- break;
- default:
- ret = -1;
- }
- return ret;
- }
- size_t pixelDataSize(GLsizei width, GLsizei height, GLenum format, GLenum type, int pack) const;
-
- void setCurrentProgram(GLint program) { m_currentProgram = program; }
- GLint currentProgram() const { return m_currentProgram; }
-
- /* OES_EGL_image_external
- *
- * These functions manipulate GL state which interacts with the
- * OES_EGL_image_external extension, to support client-side emulation on
- * top of host implementations that don't have it.
- *
- * Most of these calls should only be used with TEXTURE_2D or
- * TEXTURE_EXTERNAL_OES texture targets; TEXTURE_CUBE_MAP or other extension
- * targets should bypass this. An exception is bindTexture(), which should
- * see all glBindTexture() calls for any target.
- */
-
- // glActiveTexture(GL_TEXTURE0 + i)
- // Sets the active texture unit. Up to MAX_TEXTURE_UNITS are supported.
- GLenum setActiveTextureUnit(GLenum texture);
- GLenum getActiveTextureUnit() const;
-
- // glEnable(GL_TEXTURE_(2D|EXTERNAL_OES))
- void enableTextureTarget(GLenum target);
-
- // glDisable(GL_TEXTURE_(2D|EXTERNAL_OES))
- void disableTextureTarget(GLenum target);
-
- // Implements the target priority logic:
- // * Return GL_TEXTURE_EXTERNAL_OES if enabled, else
- // * Return GL_TEXTURE_2D if enabled, else
- // * Return the allDisabled value.
- // For some cases passing GL_TEXTURE_2D for allDisabled makes callee code
- // simpler; for other cases passing a recognizable enum like GL_ZERO or
- // GL_INVALID_ENUM is appropriate.
- GLenum getPriorityEnabledTarget(GLenum allDisabled) const;
-
- // glBindTexture(GL_TEXTURE_*, ...)
- // Set the target binding of the active texture unit to texture. Returns
- // GL_NO_ERROR on success or GL_INVALID_OPERATION if the texture has
- // previously been bound to a different target. If firstUse is not NULL,
- // it is set to indicate whether this is the first use of the texture.
- // For accurate error detection, bindTexture should be called for *all*
- // targets, not just 2D and EXTERNAL_OES.
- GLenum bindTexture(GLenum target, GLuint texture, GLboolean* firstUse);
-
- // Return the texture currently bound to GL_TEXTURE_(2D|EXTERNAL_OES).
- GLuint getBoundTexture(GLenum target) const;
-
- // glDeleteTextures(...)
- // Remove references to the to-be-deleted textures.
- void deleteTextures(GLsizei n, const GLuint* textures);
-
-private:
- PixelStoreState m_pixelStore;
- VertexAttribState *m_states;
- int m_nLocations;
- GLuint m_currentArrayVbo;
- GLuint m_currentIndexVbo;
- int m_activeTexture;
- GLint m_currentProgram;
-
- bool validLocation(int location) { return (location >= 0 && location < m_nLocations); }
-
- enum TextureTarget {
- TEXTURE_2D = 0,
- TEXTURE_EXTERNAL = 1,
- TEXTURE_TARGET_COUNT
- };
- struct TextureUnit {
- unsigned int enables;
- GLuint texture[TEXTURE_TARGET_COUNT];
- };
- struct TextureRec {
- GLuint id;
- GLenum target;
- };
- struct TextureState {
- TextureUnit unit[MAX_TEXTURE_UNITS];
- TextureUnit* activeUnit;
- TextureRec* textures;
- GLuint numTextures;
- GLuint allocTextures;
- };
- TextureState m_tex;
-
- static int compareTexId(const void* pid, const void* prec);
- TextureRec* addTextureRec(GLuint id, GLenum target);
-
-public:
- void getClientStatePointer(GLenum pname, GLvoid** params);
-
- template <class T>
- int getVertexAttribParameter(GLuint index, GLenum param, T *ptr)
- {
- bool handled = true;
- const VertexAttribState *vertexAttrib = getState(index);
- if (vertexAttrib == NULL) {
- ERR("getVeterxAttriParameter for non existant index %d\n", index);
- // set gl error;
- return handled;
- }
-
- switch(param) {
- case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
- *ptr = (T)(vertexAttrib->bufferObject);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
- *ptr = (T)(vertexAttrib->enabled);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_SIZE:
- *ptr = (T)(vertexAttrib->size);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
- *ptr = (T)(vertexAttrib->stride);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_TYPE:
- *ptr = (T)(vertexAttrib->type);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
- *ptr = (T)(vertexAttrib->normalized);
- break;
- case GL_CURRENT_VERTEX_ATTRIB:
- handled = false;
- break;
- default:
- handled = false;
- ERR("unknown vertex-attrib parameter param %d\n", param);
- }
- return handled;
- }
-
- template <class T>
- bool getClientStateParameter(GLenum param, T* ptr)
- {
- bool isClientStateParam = false;
- switch (param) {
- case GL_CLIENT_ACTIVE_TEXTURE: {
- GLint tex = getActiveTexture() + GL_TEXTURE0;
- *ptr = tex;
- isClientStateParam = true;
- break;
- }
- case GL_VERTEX_ARRAY_SIZE: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
- *ptr = state->size;
- isClientStateParam = true;
- break;
- }
- case GL_VERTEX_ARRAY_TYPE: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
- *ptr = state->type;
- isClientStateParam = true;
- break;
- }
- case GL_VERTEX_ARRAY_STRIDE: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
- *ptr = state->stride;
- isClientStateParam = true;
- break;
- }
- case GL_COLOR_ARRAY_SIZE: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
- *ptr = state->size;
- isClientStateParam = true;
- break;
- }
- case GL_COLOR_ARRAY_TYPE: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
- *ptr = state->type;
- isClientStateParam = true;
- break;
- }
- case GL_COLOR_ARRAY_STRIDE: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
- *ptr = state->stride;
- isClientStateParam = true;
- break;
- }
- case GL_NORMAL_ARRAY_TYPE: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::NORMAL_LOCATION);
- *ptr = state->type;
- isClientStateParam = true;
- break;
- }
- case GL_NORMAL_ARRAY_STRIDE: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::NORMAL_LOCATION);
- *ptr = state->stride;
- isClientStateParam = true;
- break;
- }
- case GL_TEXTURE_COORD_ARRAY_SIZE: {
- const GLClientState::VertexAttribState *state = getState(getActiveTexture() + GLClientState::TEXCOORD0_LOCATION);
- *ptr = state->size;
- isClientStateParam = true;
- break;
- }
- case GL_TEXTURE_COORD_ARRAY_TYPE: {
- const GLClientState::VertexAttribState *state = getState(getActiveTexture() + GLClientState::TEXCOORD0_LOCATION);
- *ptr = state->type;
- isClientStateParam = true;
- break;
- }
- case GL_TEXTURE_COORD_ARRAY_STRIDE: {
- const GLClientState::VertexAttribState *state = getState(getActiveTexture() + GLClientState::TEXCOORD0_LOCATION);
- *ptr = state->stride;
- isClientStateParam = true;
- break;
- }
- case GL_POINT_SIZE_ARRAY_TYPE_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::POINTSIZE_LOCATION);
- *ptr = state->type;
- isClientStateParam = true;
- break;
- }
- case GL_POINT_SIZE_ARRAY_STRIDE_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::POINTSIZE_LOCATION);
- *ptr = state->stride;
- isClientStateParam = true;
- break;
- }
- case GL_MATRIX_INDEX_ARRAY_SIZE_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
- *ptr = state->size;
- isClientStateParam = true;
- break;
- }
- case GL_MATRIX_INDEX_ARRAY_TYPE_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
- *ptr = state->type;
- isClientStateParam = true;
- break;
- }
- case GL_MATRIX_INDEX_ARRAY_STRIDE_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
- *ptr = state->stride;
- isClientStateParam = true;
- break;
- }
- case GL_WEIGHT_ARRAY_SIZE_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
- *ptr = state->size;
- isClientStateParam = true;
- break;
- }
- case GL_WEIGHT_ARRAY_TYPE_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
- *ptr = state->type;
- isClientStateParam = true;
- break;
- }
- case GL_WEIGHT_ARRAY_STRIDE_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
- *ptr = state->stride;
- isClientStateParam = true;
- break;
- }
- case GL_VERTEX_ARRAY_BUFFER_BINDING: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
- *ptr = state->bufferObject;
- isClientStateParam = true;
- break;
- }
- case GL_NORMAL_ARRAY_BUFFER_BINDING: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::NORMAL_LOCATION);
- *ptr = state->bufferObject;
- isClientStateParam = true;
- break;
- }
- case GL_COLOR_ARRAY_BUFFER_BINDING: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
- *ptr = state->bufferObject;
- isClientStateParam = true;
- break;
- }
- case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING: {
- const GLClientState::VertexAttribState *state = getState(getActiveTexture()+GLClientState::TEXCOORD0_LOCATION);
- *ptr = state->bufferObject;
- isClientStateParam = true;
- break;
- }
- case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::POINTSIZE_LOCATION);
- *ptr = state->bufferObject;
- isClientStateParam = true;
- break;
- }
- case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
- *ptr = state->bufferObject;
- isClientStateParam = true;
- break;
- }
- case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
- *ptr = state->bufferObject;
- isClientStateParam = true;
- break;
- }
- case GL_ARRAY_BUFFER_BINDING: {
- int buffer = getBuffer(GL_ARRAY_BUFFER);
- *ptr = buffer;
- isClientStateParam = true;
- break;
- }
- case GL_ELEMENT_ARRAY_BUFFER_BINDING: {
- int buffer = getBuffer(GL_ELEMENT_ARRAY_BUFFER);
- *ptr = buffer;
- isClientStateParam = true;
- break;
- }
- }
- return isClientStateParam;
- }
-
-};
-#endif
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/GLDecoderContextData.h b/tools/emulator/opengl/shared/OpenglCodecCommon/GLDecoderContextData.h
deleted file mode 100644
index 23785ae1b..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/GLDecoderContextData.h
+++ /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.
-*/
-#ifndef _GL_DECODER_CONTEXT_DATA_H_
-#define _GL_DECODER_CONTEXT_DATA_H_
-
-#include <assert.h>
-#include <string.h>
-#include "FixedBuffer.h"
-#include "codec_defs.h"
-
-class GLDecoderContextData {
-public:
- typedef enum {
- VERTEX_LOCATION = 0,
- NORMAL_LOCATION = 1,
- COLOR_LOCATION = 2,
- POINTSIZE_LOCATION = 3,
- TEXCOORD0_LOCATION = 4,
- TEXCOORD1_LOCATION = 5,
- TEXCOORD2_LOCATION = 6,
- TEXCOORD3_LOCATION = 7,
- TEXCOORD4_LOCATION = 8,
- TEXCOORD5_LOCATION = 9,
- TEXCOORD6_LOCATION = 10,
- TEXCOORD7_LOCATION = 11,
- MATRIXINDEX_LOCATION = 12,
- WEIGHT_LOCATION = 13,
- LAST_LOCATION = 14
- } PointerDataLocation;
-
- GLDecoderContextData(int nLocations = CODEC_MAX_VERTEX_ATTRIBUTES) :
- m_nLocations(nLocations)
- {
- m_pointerData = new FixedBuffer[m_nLocations];
- }
-
- ~GLDecoderContextData() {
- delete [] m_pointerData;
- }
-
- void storePointerData(unsigned int loc, void *data, size_t len) {
-
- assert(loc < m_nLocations);
- m_pointerData[loc].alloc(len);
- memcpy(m_pointerData[loc].ptr(), data, len);
- }
- void *pointerData(unsigned int loc) {
- assert(loc < m_nLocations);
- return m_pointerData[loc].ptr();
- }
-private:
- FixedBuffer *m_pointerData;
- int m_nLocations;
-};
-
-#endif
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/GLErrorLog.h b/tools/emulator/opengl/shared/OpenglCodecCommon/GLErrorLog.h
deleted file mode 100644
index 5654aea95..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/GLErrorLog.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-* Copyright 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.
-*/
-
-#ifndef __GL_ERROR_LOG_H__
-#define __GL_ERROR_LOG_H__
-
-#include "ErrorLog.h"
-
-#ifdef CHECK_GL_ERROR
-void dbg(){}
-#define GET_GL_ERROR(gl) \
- { \
- int err = gl.glGetError(); \
- if (err) { dbg(); ERR("Error: 0x%X in %s (%s:%d)\n", err, __FUNCTION__, __FILE__, __LINE__); } \
- }
-
-#else
-#define GET_GL_ERROR(gl)
-#endif
-
-#endif //__GL_ERROR_LOG_H__
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp b/tools/emulator/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp
deleted file mode 100644
index 8504f7f78..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp
+++ /dev/null
@@ -1,469 +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.
-*/
-
-#include "GLSharedGroup.h"
-
-/**** BufferData ****/
-
-BufferData::BufferData() : m_size(0) {};
-BufferData::BufferData(GLsizeiptr size, void * data) : m_size(size)
-{
- void * buffer = NULL;
- if (size>0) buffer = m_fixedBuffer.alloc(size);
- if (data) memcpy(buffer, data, size);
-}
-
-/**** ProgramData ****/
-ProgramData::ProgramData() : m_numIndexes(0),
- m_initialized(false),
- m_locShiftWAR(false)
-{
- m_Indexes = NULL;
-}
-
-void ProgramData::initProgramData(GLuint numIndexes)
-{
- m_initialized = true;
- m_numIndexes = numIndexes;
- delete[] m_Indexes;
- m_Indexes = new IndexInfo[numIndexes];
- m_locShiftWAR = false;
-}
-
-bool ProgramData::isInitialized()
-{
- return m_initialized;
-}
-
-ProgramData::~ProgramData()
-{
- delete[] m_Indexes;
- m_Indexes = NULL;
-}
-
-void ProgramData::setIndexInfo(GLuint index, GLint base, GLint size, GLenum type)
-{
- if (index>=m_numIndexes)
- return;
- m_Indexes[index].base = base;
- m_Indexes[index].size = size;
- m_Indexes[index].type = type;
- if (index > 0) {
- m_Indexes[index].appBase = m_Indexes[index-1].appBase +
- m_Indexes[index-1].size;
- }
- else {
- m_Indexes[index].appBase = 0;
- }
- m_Indexes[index].hostLocsPerElement = 1;
- m_Indexes[index].flags = 0;
- m_Indexes[index].samplerValue = 0;
-}
-
-void ProgramData::setIndexFlags(GLuint index, GLuint flags)
-{
- if (index >= m_numIndexes)
- return;
- m_Indexes[index].flags |= flags;
-}
-
-GLuint ProgramData::getIndexForLocation(GLint location)
-{
- GLuint index = m_numIndexes;
- GLint minDist = -1;
- for (GLuint i=0;i<m_numIndexes;++i)
- {
- GLint dist = location - m_Indexes[i].base;
- if (dist >= 0 &&
- (minDist < 0 || dist < minDist)) {
- index = i;
- minDist = dist;
- }
- }
- return index;
-}
-
-GLenum ProgramData::getTypeForLocation(GLint location)
-{
- GLuint index = getIndexForLocation(location);
- if (index<m_numIndexes) {
- return m_Indexes[index].type;
- }
- return 0;
-}
-
-void ProgramData::setupLocationShiftWAR()
-{
- m_locShiftWAR = false;
- for (GLuint i=0; i<m_numIndexes; i++) {
- if (0 != (m_Indexes[i].base & 0xffff)) {
- return;
- }
- }
- // if we have one uniform at location 0, we do not need the WAR.
- if (m_numIndexes > 1) {
- m_locShiftWAR = true;
- }
-}
-
-GLint ProgramData::locationWARHostToApp(GLint hostLoc, GLint arrIndex)
-{
- if (!m_locShiftWAR) return hostLoc;
-
- GLuint index = getIndexForLocation(hostLoc);
- if (index<m_numIndexes) {
- if (arrIndex > 0) {
- m_Indexes[index].hostLocsPerElement =
- (hostLoc - m_Indexes[index].base) / arrIndex;
- }
- return m_Indexes[index].appBase + arrIndex;
- }
- return -1;
-}
-
-GLint ProgramData::locationWARAppToHost(GLint appLoc)
-{
- if (!m_locShiftWAR) return appLoc;
-
- for(GLuint i=0; i<m_numIndexes; i++) {
- GLint elemIndex = appLoc - m_Indexes[i].appBase;
- if (elemIndex >= 0 && elemIndex < m_Indexes[i].size) {
- return m_Indexes[i].base +
- elemIndex * m_Indexes[i].hostLocsPerElement;
- }
- }
- return -1;
-}
-
-GLint ProgramData::getNextSamplerUniform(GLint index, GLint* val, GLenum* target)
-{
- for (GLint i = index + 1; i >= 0 && i < (GLint)m_numIndexes; i++) {
- if (m_Indexes[i].type == GL_SAMPLER_2D) {
- if (val) *val = m_Indexes[i].samplerValue;
- if (target) {
- if (m_Indexes[i].flags & INDEX_FLAG_SAMPLER_EXTERNAL) {
- *target = GL_TEXTURE_EXTERNAL_OES;
- } else {
- *target = GL_TEXTURE_2D;
- }
- }
- return i;
- }
- }
- return -1;
-}
-
-bool ProgramData::setSamplerUniform(GLint appLoc, GLint val, GLenum* target)
-{
- for (GLuint i = 0; i < m_numIndexes; i++) {
- GLint elemIndex = appLoc - m_Indexes[i].appBase;
- if (elemIndex >= 0 && elemIndex < m_Indexes[i].size) {
- if (m_Indexes[i].type == GL_TEXTURE_2D) {
- m_Indexes[i].samplerValue = val;
- if (target) {
- if (m_Indexes[i].flags & INDEX_FLAG_SAMPLER_EXTERNAL) {
- *target = GL_TEXTURE_EXTERNAL_OES;
- } else {
- *target = GL_TEXTURE_2D;
- }
- }
- return true;
- }
- }
- }
- return false;
-}
-
-bool ProgramData::attachShader(GLuint shader)
-{
- size_t n = m_shaders.size();
- for (size_t i = 0; i < n; i++) {
- if (m_shaders[i] == shader) {
- return false;
- }
- }
- // AKA m_shaders.push_back(), but that has an ambiguous call to insertAt()
- // due to the default parameters. This is the desired insertAt() overload.
- m_shaders.insertAt(shader, m_shaders.size(), 1);
- return true;
-}
-
-bool ProgramData::detachShader(GLuint shader)
-{
- size_t n = m_shaders.size();
- for (size_t i = 0; i < n; i++) {
- if (m_shaders[i] == shader) {
- m_shaders.removeAt(i);
- return true;
- }
- }
- return false;
-}
-
-/***** GLSharedGroup ****/
-
-GLSharedGroup::GLSharedGroup() :
- m_buffers(android::DefaultKeyedVector<GLuint, BufferData*>(NULL)),
- m_programs(android::DefaultKeyedVector<GLuint, ProgramData*>(NULL)),
- m_shaders(android::DefaultKeyedVector<GLuint, ShaderData*>(NULL))
-{
-}
-
-GLSharedGroup::~GLSharedGroup()
-{
- m_buffers.clear();
- m_programs.clear();
-}
-
-BufferData * GLSharedGroup::getBufferData(GLuint bufferId)
-{
- android::AutoMutex _lock(m_lock);
- return m_buffers.valueFor(bufferId);
-}
-
-void GLSharedGroup::addBufferData(GLuint bufferId, GLsizeiptr size, void * data)
-{
- android::AutoMutex _lock(m_lock);
- m_buffers.add(bufferId, new BufferData(size, data));
-}
-
-void GLSharedGroup::updateBufferData(GLuint bufferId, GLsizeiptr size, void * data)
-{
- android::AutoMutex _lock(m_lock);
- m_buffers.replaceValueFor(bufferId, new BufferData(size, data));
-}
-
-GLenum GLSharedGroup::subUpdateBufferData(GLuint bufferId, GLintptr offset, GLsizeiptr size, void * data)
-{
- android::AutoMutex _lock(m_lock);
- BufferData * buf = m_buffers.valueFor(bufferId);
- if ((!buf) || (buf->m_size < offset+size) || (offset < 0) || (size<0)) return GL_INVALID_VALUE;
-
- //it's safe to update now
- memcpy((char*)buf->m_fixedBuffer.ptr() + offset, data, size);
- return GL_NO_ERROR;
-}
-
-void GLSharedGroup::deleteBufferData(GLuint bufferId)
-{
- android::AutoMutex _lock(m_lock);
- m_buffers.removeItem(bufferId);
-}
-
-void GLSharedGroup::addProgramData(GLuint program)
-{
- android::AutoMutex _lock(m_lock);
- ProgramData *pData = m_programs.valueFor(program);
- if (pData)
- {
- m_programs.removeItem(program);
- delete pData;
- }
-
- m_programs.add(program,new ProgramData());
-}
-
-void GLSharedGroup::initProgramData(GLuint program, GLuint numIndexes)
-{
- android::AutoMutex _lock(m_lock);
- ProgramData *pData = m_programs.valueFor(program);
- if (pData)
- {
- pData->initProgramData(numIndexes);
- }
-}
-
-bool GLSharedGroup::isProgramInitialized(GLuint program)
-{
- android::AutoMutex _lock(m_lock);
- ProgramData* pData = m_programs.valueFor(program);
- if (pData)
- {
- return pData->isInitialized();
- }
- return false;
-}
-
-void GLSharedGroup::deleteProgramData(GLuint program)
-{
- android::AutoMutex _lock(m_lock);
- ProgramData *pData = m_programs.valueFor(program);
- if (pData)
- delete pData;
- m_programs.removeItem(program);
-}
-
-void GLSharedGroup::attachShader(GLuint program, GLuint shader)
-{
- android::AutoMutex _lock(m_lock);
- ProgramData* programData = m_programs.valueFor(program);
- ssize_t idx = m_shaders.indexOfKey(shader);
- if (programData && idx >= 0) {
- if (programData->attachShader(shader)) {
- refShaderDataLocked(idx);
- }
- }
-}
-
-void GLSharedGroup::detachShader(GLuint program, GLuint shader)
-{
- android::AutoMutex _lock(m_lock);
- ProgramData* programData = m_programs.valueFor(program);
- ssize_t idx = m_shaders.indexOfKey(shader);
- if (programData && idx >= 0) {
- if (programData->detachShader(shader)) {
- unrefShaderDataLocked(idx);
- }
- }
-}
-
-void GLSharedGroup::setProgramIndexInfo(GLuint program, GLuint index, GLint base, GLint size, GLenum type, const char* name)
-{
- android::AutoMutex _lock(m_lock);
- ProgramData* pData = m_programs.valueFor(program);
- if (pData)
- {
- pData->setIndexInfo(index,base,size,type);
-
- if (type == GL_SAMPLER_2D) {
- size_t n = pData->getNumShaders();
- for (size_t i = 0; i < n; i++) {
- GLuint shaderId = pData->getShader(i);
- ShaderData* shader = m_shaders.valueFor(shaderId);
- if (!shader) continue;
- ShaderData::StringList::iterator nameIter = shader->samplerExternalNames.begin();
- ShaderData::StringList::iterator nameEnd = shader->samplerExternalNames.end();
- while (nameIter != nameEnd) {
- if (*nameIter == name) {
- pData->setIndexFlags(index, ProgramData::INDEX_FLAG_SAMPLER_EXTERNAL);
- break;
- }
- ++nameIter;
- }
- }
- }
- }
-}
-
-GLenum GLSharedGroup::getProgramUniformType(GLuint program, GLint location)
-{
- android::AutoMutex _lock(m_lock);
- ProgramData* pData = m_programs.valueFor(program);
- GLenum type=0;
- if (pData)
- {
- type = pData->getTypeForLocation(location);
- }
- return type;
-}
-
-bool GLSharedGroup::isProgram(GLuint program)
-{
- android::AutoMutex _lock(m_lock);
- ProgramData* pData = m_programs.valueFor(program);
- return (pData!=NULL);
-}
-
-void GLSharedGroup::setupLocationShiftWAR(GLuint program)
-{
- android::AutoMutex _lock(m_lock);
- ProgramData* pData = m_programs.valueFor(program);
- if (pData) pData->setupLocationShiftWAR();
-}
-
-GLint GLSharedGroup::locationWARHostToApp(GLuint program, GLint hostLoc, GLint arrIndex)
-{
- android::AutoMutex _lock(m_lock);
- ProgramData* pData = m_programs.valueFor(program);
- if (pData) return pData->locationWARHostToApp(hostLoc, arrIndex);
- else return hostLoc;
-}
-
-GLint GLSharedGroup::locationWARAppToHost(GLuint program, GLint appLoc)
-{
- android::AutoMutex _lock(m_lock);
- ProgramData* pData = m_programs.valueFor(program);
- if (pData) return pData->locationWARAppToHost(appLoc);
- else return appLoc;
-}
-
-bool GLSharedGroup::needUniformLocationWAR(GLuint program)
-{
- android::AutoMutex _lock(m_lock);
- ProgramData* pData = m_programs.valueFor(program);
- if (pData) return pData->needUniformLocationWAR();
- return false;
-}
-
-GLint GLSharedGroup::getNextSamplerUniform(GLuint program, GLint index, GLint* val, GLenum* target) const
-{
- android::AutoMutex _lock(m_lock);
- ProgramData* pData = m_programs.valueFor(program);
- return pData ? pData->getNextSamplerUniform(index, val, target) : -1;
-}
-
-bool GLSharedGroup::setSamplerUniform(GLuint program, GLint appLoc, GLint val, GLenum* target)
-{
- android::AutoMutex _lock(m_lock);
- ProgramData* pData = m_programs.valueFor(program);
- return pData ? pData->setSamplerUniform(appLoc, val, target) : false;
-}
-
-bool GLSharedGroup::addShaderData(GLuint shader)
-{
- android::AutoMutex _lock(m_lock);
- ShaderData* data = new ShaderData;
- if (data) {
- if (m_shaders.add(shader, data) < 0) {
- delete data;
- data = NULL;
- }
- data->refcount = 1;
- }
- return data != NULL;
-}
-
-ShaderData* GLSharedGroup::getShaderData(GLuint shader)
-{
- android::AutoMutex _lock(m_lock);
- return m_shaders.valueFor(shader);
-}
-
-void GLSharedGroup::unrefShaderData(GLuint shader)
-{
- android::AutoMutex _lock(m_lock);
- ssize_t idx = m_shaders.indexOfKey(shader);
- if (idx >= 0) {
- unrefShaderDataLocked(idx);
- }
-}
-
-void GLSharedGroup::refShaderDataLocked(ssize_t shaderIdx)
-{
- assert(shaderIdx >= 0 && shaderIdx <= m_shaders.size());
- ShaderData* data = m_shaders.valueAt(shaderIdx);
- data->refcount++;
-}
-
-void GLSharedGroup::unrefShaderDataLocked(ssize_t shaderIdx)
-{
- assert(shaderIdx >= 0 && shaderIdx <= m_shaders.size());
- ShaderData* data = m_shaders.valueAt(shaderIdx);
- if (--data->refcount == 0) {
- delete data;
- m_shaders.removeItemsAt(shaderIdx);
- }
-}
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/GLSharedGroup.h b/tools/emulator/opengl/shared/OpenglCodecCommon/GLSharedGroup.h
deleted file mode 100644
index 61b8f0056..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/GLSharedGroup.h
+++ /dev/null
@@ -1,143 +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.
-*/
-#ifndef _GL_SHARED_GROUP_H_
-#define _GL_SHARED_GROUP_H_
-
-#define GL_API
-#ifndef ANDROID
-#define GL_APIENTRY
-#define GL_APIENTRYP
-#endif
-
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "ErrorLog.h"
-#include <utils/KeyedVector.h>
-#include <utils/List.h>
-#include <utils/String8.h>
-#include <utils/threads.h>
-#include "FixedBuffer.h"
-#include "SmartPtr.h"
-
-struct BufferData {
- BufferData();
- BufferData(GLsizeiptr size, void * data);
- GLsizeiptr m_size;
- FixedBuffer m_fixedBuffer;
-};
-
-class ProgramData {
-private:
- typedef struct _IndexInfo {
- GLint base;
- GLint size;
- GLenum type;
- GLint appBase;
- GLint hostLocsPerElement;
- GLuint flags;
- GLint samplerValue; // only set for sampler uniforms
- } IndexInfo;
-
- GLuint m_numIndexes;
- IndexInfo* m_Indexes;
- bool m_initialized;
- bool m_locShiftWAR;
-
- android::Vector<GLuint> m_shaders;
-
-public:
- enum {
- INDEX_FLAG_SAMPLER_EXTERNAL = 0x00000001,
- };
-
- ProgramData();
- void initProgramData(GLuint numIndexes);
- bool isInitialized();
- virtual ~ProgramData();
- void setIndexInfo(GLuint index, GLint base, GLint size, GLenum type);
- void setIndexFlags(GLuint index, GLuint flags);
- GLuint getIndexForLocation(GLint location);
- GLenum getTypeForLocation(GLint location);
-
- bool needUniformLocationWAR() const { return m_locShiftWAR; }
- void setupLocationShiftWAR();
- GLint locationWARHostToApp(GLint hostLoc, GLint arrIndex);
- GLint locationWARAppToHost(GLint appLoc);
-
- GLint getNextSamplerUniform(GLint index, GLint* val, GLenum* target);
- bool setSamplerUniform(GLint appLoc, GLint val, GLenum* target);
-
- bool attachShader(GLuint shader);
- bool detachShader(GLuint shader);
- size_t getNumShaders() const { return m_shaders.size(); }
- GLuint getShader(size_t i) const { return m_shaders[i]; }
-};
-
-struct ShaderData {
- typedef android::List<android::String8> StringList;
- StringList samplerExternalNames;
- int refcount;
-};
-
-class GLSharedGroup {
-private:
- android::DefaultKeyedVector<GLuint, BufferData*> m_buffers;
- android::DefaultKeyedVector<GLuint, ProgramData*> m_programs;
- android::DefaultKeyedVector<GLuint, ShaderData*> m_shaders;
- mutable android::Mutex m_lock;
-
- void refShaderDataLocked(ssize_t shaderIdx);
- void unrefShaderDataLocked(ssize_t shaderIdx);
-
-public:
- GLSharedGroup();
- ~GLSharedGroup();
- BufferData * getBufferData(GLuint bufferId);
- void addBufferData(GLuint bufferId, GLsizeiptr size, void * data);
- void updateBufferData(GLuint bufferId, GLsizeiptr size, void * data);
- GLenum subUpdateBufferData(GLuint bufferId, GLintptr offset, GLsizeiptr size, void * data);
- void deleteBufferData(GLuint);
-
- bool isProgram(GLuint program);
- bool isProgramInitialized(GLuint program);
- void addProgramData(GLuint program);
- void initProgramData(GLuint program, GLuint numIndexes);
- void attachShader(GLuint program, GLuint shader);
- void detachShader(GLuint program, GLuint shader);
- void deleteProgramData(GLuint program);
- void setProgramIndexInfo(GLuint program, GLuint index, GLint base, GLint size, GLenum type, const char* name);
- GLenum getProgramUniformType(GLuint program, GLint location);
- void setupLocationShiftWAR(GLuint program);
- GLint locationWARHostToApp(GLuint program, GLint hostLoc, GLint arrIndex);
- GLint locationWARAppToHost(GLuint program, GLint appLoc);
- bool needUniformLocationWAR(GLuint program);
- GLint getNextSamplerUniform(GLuint program, GLint index, GLint* val, GLenum* target) const;
- bool setSamplerUniform(GLuint program, GLint appLoc, GLint val, GLenum* target);
-
- bool addShaderData(GLuint shader);
- // caller must hold a reference to the shader as long as it holds the pointer
- ShaderData* getShaderData(GLuint shader);
- void unrefShaderData(GLuint shader);
-};
-
-typedef SmartPtr<GLSharedGroup> GLSharedGroupPtr;
-
-#endif //_GL_SHARED_GROUP_H_
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/Makefile b/tools/emulator/opengl/shared/OpenglCodecCommon/Makefile
deleted file mode 100644
index e8bf43162..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-
-ROOT=../..
-
-include $(ROOT)/make/commondefs
-
-CXXFILES = TcpStream.cpp GLClientState.cpp glUtils.cpp
-CXXINCS += -I$(ROOT)/libs/GLESv1 -I$(ROOT)/include
-
-LIBRARY_NAME = libcodecCommon.a
-
-include $(COMMONRULES)
-
-
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/SmartPtr.h b/tools/emulator/opengl/shared/OpenglCodecCommon/SmartPtr.h
deleted file mode 100644
index 4bdfbe410..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/SmartPtr.h
+++ /dev/null
@@ -1,167 +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.
-*/
-#ifndef __SMART_PTR_H
-#define __SMART_PTR_H
-
-#include <cutils/threads.h>
-#include <cutils/atomic.h>
-
-template <class T, bool threadSafe = false>
-class SmartPtr
-{
-public:
- explicit SmartPtr(T* ptr = (T*)NULL) {
- if (threadSafe) {
- m_lock = new mutex_t;
- mutex_init(m_lock);
- }
- else m_lock = NULL;
-
- m_ptr = ptr;
- if (ptr)
- m_pRefCount = new int32_t(1);
- else
- m_pRefCount = NULL;
- }
-
- SmartPtr<T,threadSafe>(const SmartPtr<T,false>& rhs) {
- if (threadSafe) {
- m_lock = new mutex_t;
- mutex_init(m_lock);
- }
- else m_lock = NULL;
-
- m_pRefCount = rhs.m_pRefCount;
- m_ptr = rhs.m_ptr;
- use();
- }
-
- SmartPtr<T,threadSafe>(SmartPtr<T,true>& rhs) {
- if (threadSafe) {
- m_lock = new mutex_t;
- mutex_init(m_lock);
- }
- else m_lock = NULL;
-
- if (rhs.m_lock) mutex_lock(rhs.m_lock);
- m_pRefCount = rhs.m_pRefCount;
- m_ptr = rhs.m_ptr;
- use();
- if (rhs.m_lock) mutex_unlock(rhs.m_lock);
- }
-
- ~SmartPtr() {
- if (m_lock) mutex_lock(m_lock);
- release();
- if (m_lock)
- {
- mutex_unlock(m_lock);
- mutex_destroy(m_lock);
- delete m_lock;
- }
- }
-
- T* Ptr() const {
- return m_ptr;
- }
-
- const T* constPtr() const
- {
- return m_ptr;
- }
-
- T* operator->() const {
- return m_ptr;
- }
-
- T& operator*() const {
- return *m_ptr;
- }
-
- operator void*() const {
- return (void *)m_ptr;
- }
-
- // This gives STL lists something to compare.
- bool operator <(const SmartPtr<T>& t1) const {
- return m_ptr < t1.m_ptr;
- }
-
- SmartPtr<T,threadSafe>& operator=(const SmartPtr<T,false>& rhs)
- {
- if (m_ptr == rhs.m_ptr)
- return *this;
-
- if (m_lock) mutex_lock(m_lock);
- release();
- m_pRefCount = rhs.m_pRefCount;
- m_ptr = rhs.m_ptr;
- use();
- if (m_lock) mutex_unlock(m_lock);
-
- return *this;
- }
-
- SmartPtr<T,threadSafe>& operator=(SmartPtr<T,true>& rhs)
- {
- if (m_ptr == rhs.m_ptr)
- return *this;
-
- if (m_lock) mutex_lock(m_lock);
- release();
- if (rhs.m_lock) mutex_lock(rhs.m_lock);
- m_pRefCount = rhs.m_pRefCount;
- m_ptr = rhs.m_ptr;
- use();
- if (rhs.m_lock) mutex_unlock(rhs.m_lock);
- if (m_lock) mutex_unlock(m_lock);
-
- return *this;
- }
-
-private:
- int32_t *m_pRefCount;
- mutex_t *m_lock;
- T* m_ptr;
-
- // Increment the reference count on this pointer by 1.
- int use() {
- if (!m_pRefCount) return 0;
- return android_atomic_inc(m_pRefCount) + 1;
- }
-
- // Decrement the reference count on the pointer by 1.
- // If the reference count goes to (or below) 0, the pointer is deleted.
- int release() {
- if (!m_pRefCount) return 0;
-
- int iVal = android_atomic_dec(m_pRefCount);
- if (iVal > 1)
- return iVal - 1;
-
- delete m_pRefCount;
- m_pRefCount = NULL;
-
- if (m_ptr) {
- delete m_ptr;
- m_ptr = NULL;
- }
- return 0;
- }
-
-};
-
-#endif // of __SMART_PTR_H
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.cpp b/tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.cpp
deleted file mode 100644
index f7a2314f9..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.cpp
+++ /dev/null
@@ -1,168 +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.
-*/
-#include "SocketStream.h"
-#include <cutils/sockets.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#ifndef _WIN32
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <sys/un.h>
-#else
-#include <ws2tcpip.h>
-#endif
-
-SocketStream::SocketStream(size_t bufSize) :
- IOStream(bufSize),
- m_sock(-1),
- m_bufsize(bufSize),
- m_buf(NULL)
-{
-}
-
-SocketStream::SocketStream(int sock, size_t bufSize) :
- IOStream(bufSize),
- m_sock(sock),
- m_bufsize(bufSize),
- m_buf(NULL)
-{
-}
-
-SocketStream::~SocketStream()
-{
- if (m_sock >= 0) {
-#ifdef _WIN32
- closesocket(m_sock);
-#else
- ::close(m_sock);
-#endif
- }
- if (m_buf != NULL) {
- free(m_buf);
- m_buf = NULL;
- }
-}
-
-
-void *SocketStream::allocBuffer(size_t minSize)
-{
- size_t allocSize = (m_bufsize < minSize ? minSize : m_bufsize);
- if (!m_buf) {
- m_buf = (unsigned char *)malloc(allocSize);
- }
- else if (m_bufsize < allocSize) {
- unsigned char *p = (unsigned char *)realloc(m_buf, allocSize);
- if (p != NULL) {
- m_buf = p;
- m_bufsize = allocSize;
- } else {
- ERR("%s: realloc (%zu) failed\n", __FUNCTION__, allocSize);
- free(m_buf);
- m_buf = NULL;
- m_bufsize = 0;
- }
- }
-
- return m_buf;
-};
-
-int SocketStream::commitBuffer(size_t size)
-{
- return writeFully(m_buf, size);
-}
-
-int SocketStream::writeFully(const void* buffer, size_t size)
-{
- if (!valid()) return -1;
-
- size_t res = size;
- int retval = 0;
-
- while (res > 0) {
- ssize_t stat = ::send(m_sock, (const char *)buffer + (size - res), res, 0);
- if (stat < 0) {
- if (errno != EINTR) {
- retval = stat;
- ERR("%s: failed: %s\n", __FUNCTION__, strerror(errno));
- break;
- }
- } else {
- res -= stat;
- }
- }
- return retval;
-}
-
-const unsigned char *SocketStream::readFully(void *buf, size_t len)
-{
- const unsigned char* ret = NULL;
- if (!valid()) return NULL;
- if (!buf) {
- return NULL; // do not allow NULL buf in that implementation
- }
- size_t res = len;
- while (res > 0) {
- ssize_t stat = ::recv(m_sock, (char *)(buf) + len - res, res, 0);
- if (stat > 0) {
- res -= stat;
- continue;
- }
- if (stat == 0 || errno != EINTR) { // client shutdown or error
- return NULL;
- }
- }
- return (const unsigned char *)buf;
-}
-
-const unsigned char *SocketStream::read( void *buf, size_t *inout_len)
-{
- if (!valid()) return NULL;
- if (!buf) {
- return NULL; // do not allow NULL buf in that implementation
- }
-
- int n;
- do {
- n = recv(buf, *inout_len);
- } while( n < 0 && errno == EINTR );
-
- if (n > 0) {
- *inout_len = n;
- return (const unsigned char *)buf;
- }
-
- return NULL;
-}
-
-int SocketStream::recv(void *buf, size_t len)
-{
- if (!valid()) return int(ERR_INVALID_SOCKET);
- int res = 0;
- while(true) {
- res = ::recv(m_sock, (char *)buf, len, 0);
- if (res < 0) {
- if (errno == EINTR) {
- continue;
- }
- }
- break;
- }
- return res;
-}
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.h b/tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.h
deleted file mode 100644
index 3a501b411..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.h
+++ /dev/null
@@ -1,50 +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.
-*/
-#ifndef __SOCKET_STREAM_H
-#define __SOCKET_STREAM_H
-
-#include <stdlib.h>
-#include "IOStream.h"
-
-class SocketStream : public IOStream {
-public:
- typedef enum { ERR_INVALID_SOCKET = -1000 } SocketStreamError;
-
- explicit SocketStream(size_t bufsize = 10000);
- virtual ~SocketStream();
-
- virtual int listen(unsigned short port) = 0;
- virtual SocketStream *accept() = 0;
- virtual int connect(unsigned short port) = 0;
-
- virtual void *allocBuffer(size_t minSize);
- virtual int commitBuffer(size_t size);
- virtual const unsigned char *readFully(void *buf, size_t len);
- virtual const unsigned char *read(void *buf, size_t *inout_len);
-
- bool valid() { return m_sock >= 0; }
- virtual int recv(void *buf, size_t len);
- virtual int writeFully(const void *buf, size_t len);
-
-protected:
- int m_sock;
- size_t m_bufsize;
- unsigned char *m_buf;
-
- SocketStream(int sock, size_t bufSize);
-};
-
-#endif /* __SOCKET_STREAM_H */
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/TcpStream.cpp b/tools/emulator/opengl/shared/OpenglCodecCommon/TcpStream.cpp
deleted file mode 100644
index 4da2cec3a..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/TcpStream.cpp
+++ /dev/null
@@ -1,91 +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.
-*/
-#include "TcpStream.h"
-#include <cutils/sockets.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#ifndef _WIN32
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#else
-#include <ws2tcpip.h>
-#endif
-
-TcpStream::TcpStream(size_t bufSize) :
- SocketStream(bufSize)
-{
-}
-
-TcpStream::TcpStream(int sock, size_t bufSize) :
- SocketStream(sock, bufSize)
-{
- // disable Nagle algorithm to improve bandwidth of small
- // packets which are quite common in our implementation.
-#ifdef _WIN32
- DWORD flag;
-#else
- int flag;
-#endif
- flag = 1;
- setsockopt( sock, IPPROTO_TCP, TCP_NODELAY, (const char*)&flag, sizeof(flag) );
-}
-
-int TcpStream::listen(unsigned short port)
-{
- m_sock = socket_loopback_server(port, SOCK_STREAM);
- if (!valid()) return int(ERR_INVALID_SOCKET);
-
- return 0;
-}
-
-SocketStream * TcpStream::accept()
-{
- int clientSock = -1;
-
- while (true) {
- struct sockaddr_in addr;
- socklen_t len = sizeof(addr);
- clientSock = ::accept(m_sock, (sockaddr *)&addr, &len);
-
- if (clientSock < 0 && errno == EINTR) {
- continue;
- }
- break;
- }
-
- TcpStream *clientStream = NULL;
-
- if (clientSock >= 0) {
- clientStream = new TcpStream(clientSock, m_bufsize);
- }
- return clientStream;
-}
-
-int TcpStream::connect(unsigned short port)
-{
- return connect("127.0.0.1",port);
-}
-
-int TcpStream::connect(const char* hostname, unsigned short port)
-{
- m_sock = socket_network_client(hostname, port, SOCK_STREAM);
- if (!valid()) return -1;
- return 0;
-}
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/TcpStream.h b/tools/emulator/opengl/shared/OpenglCodecCommon/TcpStream.h
deleted file mode 100644
index 811a87157..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/TcpStream.h
+++ /dev/null
@@ -1,32 +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.
-*/
-#ifndef __TCP_STREAM_H
-#define __TCP_STREAM_H
-
-#include "SocketStream.h"
-
-class TcpStream : public SocketStream {
-public:
- explicit TcpStream(size_t bufsize = 10000);
- virtual int listen(unsigned short port);
- virtual SocketStream *accept();
- virtual int connect(unsigned short port);
- int connect(const char* hostname, unsigned short port);
-private:
- TcpStream(int sock, size_t bufSize);
-};
-
-#endif
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/TimeUtils.cpp b/tools/emulator/opengl/shared/OpenglCodecCommon/TimeUtils.cpp
deleted file mode 100644
index 50aeb030e..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/TimeUtils.cpp
+++ /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.
-*/
-#include "TimeUtils.h"
-
-#ifdef _WIN32
-#include <windows.h>
-#include <time.h>
-#include <stdio.h>
-#elif defined(__linux__)
-#include <stdlib.h>
-#include <sys/time.h>
-#include <time.h>
-#include <unistd.h>
-#else
-#include <sys/time.h>
-#include <unistd.h>
-#endif
-
-long long GetCurrentTimeMS()
-{
-#ifdef _WIN32
- static LARGE_INTEGER freq;
- static bool bNotInit = true;
- if ( bNotInit ) {
- bNotInit = (QueryPerformanceFrequency( &freq ) == FALSE);
- }
- LARGE_INTEGER currVal;
- QueryPerformanceCounter( &currVal );
-
- return currVal.QuadPart / (freq.QuadPart / 1000);
-
-#elif defined(__linux__)
-
- struct timespec now;
- clock_gettime(CLOCK_MONOTONIC, &now);
- long long iDiff = (now.tv_sec * 1000LL) + now.tv_nsec/1000000LL;
- return iDiff;
-
-#else /* Others, e.g. OS X */
-
- struct timeval now;
- gettimeofday(&now, NULL);
- long long iDiff = (now.tv_sec * 1000LL) + now.tv_usec/1000LL;
- return iDiff;
-
-#endif
-}
-
-void TimeSleepMS(int p_mili)
-{
-#ifdef _WIN32
- Sleep(p_mili);
-#else
- usleep(p_mili * 1000);
-#endif
-}
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/TimeUtils.h b/tools/emulator/opengl/shared/OpenglCodecCommon/TimeUtils.h
deleted file mode 100644
index bc4fd1c31..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/TimeUtils.h
+++ /dev/null
@@ -1,22 +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.
-*/
-#ifndef _TIME_UTILS_H
-#define _TIME_UTILS_H
-
-long long GetCurrentTimeMS();
-void TimeSleepMS(int p_mili);
-
-#endif
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/UnixStream.cpp b/tools/emulator/opengl/shared/OpenglCodecCommon/UnixStream.cpp
deleted file mode 100644
index 8e463a370..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/UnixStream.cpp
+++ /dev/null
@@ -1,137 +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.
-*/
-#include "UnixStream.h"
-#include <cutils/sockets.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <sys/un.h>
-#include <sys/stat.h>
-
-/* Not all systems define PATH_MAX, those who don't generally don't
- * have a limit on the maximum path size, so use a value that is
- * large enough for our very limited needs.
- */
-#ifndef PATH_MAX
-#define PATH_MAX 128
-#endif
-
-UnixStream::UnixStream(size_t bufSize) :
- SocketStream(bufSize)
-{
-}
-
-UnixStream::UnixStream(int sock, size_t bufSize) :
- SocketStream(sock, bufSize)
-{
-}
-
-/* Initialize a sockaddr_un with the appropriate values corresponding
- * to a given 'virtual port'. Returns 0 on success, -1 on error.
- */
-static int
-make_unix_path(char *path, size_t pathlen, int port_number)
-{
- char tmp[PATH_MAX]; // temp directory
- int ret = 0;
-
- // First, create user-specific temp directory if needed
- const char* user = getenv("USER");
- if (user != NULL) {
- struct stat st;
- snprintf(tmp, sizeof(tmp), "/tmp/android-%s", user);
- do {
- ret = ::lstat(tmp, &st);
- } while (ret < 0 && errno == EINTR);
-
- if (ret < 0 && errno == ENOENT) {
- do {
- ret = ::mkdir(tmp, 0766);
- } while (ret < 0 && errno == EINTR);
- if (ret < 0) {
- ERR("Could not create temp directory: %s", tmp);
- user = NULL; // will fall-back to /tmp
- }
- }
- else if (ret < 0) {
- user = NULL; // will fallback to /tmp
- }
- }
-
- if (user == NULL) { // fallback to /tmp in case of error
- snprintf(tmp, sizeof(tmp), "/tmp");
- }
-
- // Now, initialize it properly
- snprintf(path, pathlen, "%s/qemu-gles-%d", tmp, port_number);
- return 0;
-}
-
-
-int UnixStream::listen(unsigned short port)
-{
- char path[PATH_MAX];
-
- if (make_unix_path(path, sizeof(path), port) < 0) {
- return -1;
- }
-
- m_sock = socket_local_server(path, ANDROID_SOCKET_NAMESPACE_FILESYSTEM, SOCK_STREAM);
- if (!valid()) return int(ERR_INVALID_SOCKET);
-
- return 0;
-}
-
-SocketStream * UnixStream::accept()
-{
- int clientSock = -1;
-
- while (true) {
- struct sockaddr_un addr;
- socklen_t len = sizeof(addr);
- clientSock = ::accept(m_sock, (sockaddr *)&addr, &len);
-
- if (clientSock < 0 && errno == EINTR) {
- continue;
- }
- break;
- }
-
- UnixStream *clientStream = NULL;
-
- if (clientSock >= 0) {
- clientStream = new UnixStream(clientSock, m_bufsize);
- }
- return clientStream;
-}
-
-int UnixStream::connect(unsigned short port)
-{
- char path[PATH_MAX];
-
- if (make_unix_path(path, sizeof(path), port) < 0)
- return -1;
-
- m_sock = socket_local_client(path, ANDROID_SOCKET_NAMESPACE_FILESYSTEM, SOCK_STREAM);
- if (!valid()) return -1;
-
- return 0;
-}
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/UnixStream.h b/tools/emulator/opengl/shared/OpenglCodecCommon/UnixStream.h
deleted file mode 100644
index c184b19fe..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/UnixStream.h
+++ /dev/null
@@ -1,31 +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.
-*/
-#ifndef __UNIX_STREAM_H
-#define __UNIX_STREAM_H
-
-#include "SocketStream.h"
-
-class UnixStream : public SocketStream {
-public:
- explicit UnixStream(size_t bufsize = 10000);
- virtual int listen(unsigned short port);
- virtual SocketStream *accept();
- virtual int connect(unsigned short port);
-private:
- UnixStream(int sock, size_t bufSize);
-};
-
-#endif
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/Win32PipeStream.cpp b/tools/emulator/opengl/shared/OpenglCodecCommon/Win32PipeStream.cpp
deleted file mode 100644
index e1a0b9b7d..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/Win32PipeStream.cpp
+++ /dev/null
@@ -1,239 +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.
-*/
-#include "Win32PipeStream.h"
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <windows.h>
-
-#ifndef _WIN32
-#error ONLY BUILD THIS SOURCE FILE FOR WINDOWS!
-#endif
-
-/* The official documentation states that the name of a given named
- * pipe cannot be more than 256 characters long.
- */
-#define NAMED_PIPE_MAX 256
-
-Win32PipeStream::Win32PipeStream(size_t bufSize) :
- SocketStream(bufSize),
- m_pipe(INVALID_HANDLE_VALUE)
-{
-}
-
-Win32PipeStream::Win32PipeStream(HANDLE pipe, size_t bufSize) :
- SocketStream(-1, bufSize),
- m_pipe(pipe)
-{
-}
-
-Win32PipeStream::~Win32PipeStream()
-{
- if (m_pipe != INVALID_HANDLE_VALUE) {
- CloseHandle(m_pipe);
- m_pipe = INVALID_HANDLE_VALUE;
- }
-}
-
-/* Initialize the pipe name corresponding to a given port
- */
-static void
-make_pipe_name(char *path, size_t pathlen, int port_number)
-{
- snprintf(path, pathlen, "\\\\.\\pipe\\qemu-gles-%d", port_number);
-}
-
-
-/* Technical note: Named pipes work differently from BSD Sockets.
- * One does not create/bind a pipe, and collect a new handle each
- * time a client connects with accept().
- *
- * Instead, the server creates a new pipe instance each time it wants
- * to get a new client connection, then calls ConnectNamedPipe() to
- * wait for a connection.
- *
- * So listen() is a no-op, and accept() really creates the pipe handle.
- *
- * Also, connect() must create a pipe handle with CreateFile() and
- * wait for a server instance with WaitNamedPipe()
- */
-int Win32PipeStream::listen(unsigned short port)
-{
- // just save the port number for accept()
- m_port = port;
- return 0;
-}
-
-SocketStream * Win32PipeStream::accept()
-{
- char path[NAMED_PIPE_MAX+1];
- SocketStream* clientStream;
- HANDLE pipe;
-
- make_pipe_name(path, sizeof(path), m_port);
-
- pipe = ::CreateNamedPipe(
- path, // pipe name
- PIPE_ACCESS_DUPLEX, // read-write access
- PIPE_TYPE_BYTE | // byte-oriented writes
- PIPE_READMODE_BYTE | // byte-oriented reads
- PIPE_WAIT, // blocking operations
- PIPE_UNLIMITED_INSTANCES, // no limit on clients
- 4096, // input buffer size
- 4096, // output buffer size
- 0, // client time-out
- NULL); // default security attributes
-
- if (pipe == INVALID_HANDLE_VALUE) {
- ERR("%s: CreateNamedPipe failed %d\n", __FUNCTION__, (int)GetLastError());
- return NULL;
- }
-
- // Stupid Win32 API design: If a client is already connected, then
- // ConnectNamedPipe will return 0, and GetLastError() will return
- // ERROR_PIPE_CONNECTED. This is not an error! It just means that the
- // function didn't have to wait.
- //
- if (::ConnectNamedPipe(pipe, NULL) == 0 && GetLastError() != ERROR_PIPE_CONNECTED) {
- ERR("%s: ConnectNamedPipe failed: %d\n", __FUNCTION__, (int)GetLastError());
- CloseHandle(pipe);
- return NULL;
- }
-
- clientStream = new Win32PipeStream(pipe, m_bufsize);
- return clientStream;
-}
-
-int Win32PipeStream::connect(unsigned short port)
-{
- char path[NAMED_PIPE_MAX+1];
- HANDLE pipe;
- int tries = 10;
-
- make_pipe_name(path, sizeof(path), port);
-
- /* We're going to loop in order to wait for the pipe server to
- * be setup properly.
- */
- for (; tries > 0; tries--) {
- pipe = ::CreateFile(
- path, // pipe name
- GENERIC_READ | GENERIC_WRITE, // read & write
- 0, // no sharing
- NULL, // default security attrs
- OPEN_EXISTING, // open existing pipe
- 0, // default attributes
- NULL); // no template file
-
- /* If we have a valid pipe handle, break from the loop */
- if (pipe != INVALID_HANDLE_VALUE) {
- break;
- }
-
- /* We can get here if the pipe is busy, i.e. if the server hasn't
- * create a new pipe instance to service our request. In which case
- * GetLastError() will return ERROR_PIPE_BUSY.
- *
- * If so, then use WaitNamedPipe() to wait for a decent time
- * to try again.
- */
- if (GetLastError() != ERROR_PIPE_BUSY) {
- /* Not ERROR_PIPE_BUSY */
- ERR("%s: CreateFile failed: %d\n", __FUNCTION__, (int)GetLastError());
- errno = EINVAL;
- return -1;
- }
-
- /* Wait for 5 seconds */
- if ( !WaitNamedPipe(path, 5000) ) {
- ERR("%s: WaitNamedPipe failed: %d\n", __FUNCTION__, (int)GetLastError());
- errno = EINVAL;
- return -1;
- }
- }
-
- m_pipe = pipe;
- return 0;
-}
-
-/* Special buffer methods, since we can't use socket functions here */
-
-int Win32PipeStream::commitBuffer(size_t size)
-{
- if (m_pipe == INVALID_HANDLE_VALUE)
- return -1;
-
- size_t res = size;
- int retval = 0;
-
- while (res > 0) {
- DWORD written;
- if (! ::WriteFile(m_pipe, (const char *)m_buf + (size - res), res, &written, NULL)) {
- retval = -1;
- ERR("%s: failed: %d\n", __FUNCTION__, (int)GetLastError());
- break;
- }
- res -= written;
- }
- return retval;
-}
-
-const unsigned char *Win32PipeStream::readFully(void *buf, size_t len)
-{
- const unsigned char* ret = NULL;
-
- if (m_pipe == INVALID_HANDLE_VALUE)
- return NULL;
-
- if (!buf) {
- return NULL; // do not allow NULL buf in that implementation
- }
-
- size_t res = len;
- while (res > 0) {
- DWORD readcount = 0;
- if (! ::ReadFile(m_pipe, (char *)buf + (len - res), res, &readcount, NULL) || readcount == 0) {
- errno = (int)GetLastError();
- return NULL;
- }
- res -= readcount;
- }
- return (const unsigned char *)buf;
-}
-
-const unsigned char *Win32PipeStream::read( void *buf, size_t *inout_len)
-{
- size_t len = *inout_len;
- DWORD readcount;
-
- if (m_pipe == INVALID_HANDLE_VALUE)
- return NULL;
-
- if (!buf) {
- return NULL; // do not allow NULL buf in that implementation
- }
-
- if (!::ReadFile(m_pipe, (char *)buf, len, &readcount, NULL)) {
- errno = (int)GetLastError();
- return NULL;
- }
-
- *inout_len = (size_t)readcount;
- return (const unsigned char *)buf;
-}
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/Win32PipeStream.h b/tools/emulator/opengl/shared/OpenglCodecCommon/Win32PipeStream.h
deleted file mode 100644
index 41145453d..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/Win32PipeStream.h
+++ /dev/null
@@ -1,41 +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.
-*/
-#ifndef __WIN32_PIPE_STREAM_H
-#define __WIN32_PIPE_STREAM_H
-
-#include "SocketStream.h"
-#include <windows.h>
-
-class Win32PipeStream : public SocketStream {
-public:
- explicit Win32PipeStream(size_t bufsize = 10000);
- virtual ~Win32PipeStream();
- virtual int listen(unsigned short port);
- virtual SocketStream *accept();
- virtual int connect(unsigned short port);
-
- virtual int commitBuffer(size_t size);
- virtual const unsigned char *readFully(void *buf, size_t len);
- virtual const unsigned char *read(void *buf, size_t *inout_len);
-
-private:
- Win32PipeStream(HANDLE pipe, size_t bufSize);
- HANDLE m_pipe;
- int m_port;
-};
-
-
-#endif
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/codec_defs.h b/tools/emulator/opengl/shared/OpenglCodecCommon/codec_defs.h
deleted file mode 100644
index f19f51414..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/codec_defs.h
+++ /dev/null
@@ -1,23 +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.
-*/
-#ifndef _CODEC_DEFS_H
-#define _CODEC_DEFS_H
-
-#define CODEC_SERVER_PORT 22468
-
-#define CODEC_MAX_VERTEX_ATTRIBUTES 64
-
-#endif
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.cpp b/tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.cpp
deleted file mode 100644
index 4b7fc892c..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.cpp
+++ /dev/null
@@ -1,471 +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.
-*/
-#include "glUtils.h"
-#include <string.h>
-#include "ErrorLog.h"
-#include <IOStream.h>
-
-size_t glSizeof(GLenum type)
-{
- size_t retval = 0;
- switch(type) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- retval = 1;
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- case GL_HALF_FLOAT_OES:
- retval = 2;
- break;
- case GL_INT:
- case GL_FLOAT:
- case GL_FIXED:
- case GL_BOOL:
- retval = 4;
- break;
-#ifdef GL_DOUBLE
- case GL_DOUBLE:
- retval = 8;
- break;
-#endif
- case GL_FLOAT_VEC2:
- case GL_INT_VEC2:
- case GL_BOOL_VEC2:
- retval = 8;
- break;
- case GL_INT_VEC3:
- case GL_BOOL_VEC3:
- case GL_FLOAT_VEC3:
- retval = 12;
- break;
- case GL_FLOAT_VEC4:
- case GL_BOOL_VEC4:
- case GL_INT_VEC4:
- case GL_FLOAT_MAT2:
- retval = 16;
- break;
- case GL_FLOAT_MAT3:
- retval = 36;
- break;
- case GL_FLOAT_MAT4:
- retval = 64;
- break;
- case GL_SAMPLER_2D:
- case GL_SAMPLER_CUBE:
- retval = 4;
- break;
- default:
- ERR("**** ERROR unknown type 0x%x (%s,%d)\n", type, __FUNCTION__,__LINE__);
- }
- return retval;
-
-}
-
-size_t glUtilsParamSize(GLenum param)
-{
- size_t s = 0;
-
- switch(param)
- {
- case GL_DEPTH_TEST:
- case GL_DEPTH_FUNC:
- case GL_DEPTH_BITS:
- case GL_MAX_CLIP_PLANES:
- case GL_GREEN_BITS:
- case GL_MAX_MODELVIEW_STACK_DEPTH:
- case GL_MAX_PROJECTION_STACK_DEPTH:
- case GL_MAX_TEXTURE_STACK_DEPTH:
- case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
- case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
- case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
- case GL_MAX_TEXTURE_SIZE:
- case GL_TEXTURE_GEN_MODE_OES:
- case GL_TEXTURE_ENV_MODE:
- case GL_FOG_MODE:
- case GL_FOG_DENSITY:
- case GL_FOG_START:
- case GL_FOG_END:
- case GL_SPOT_EXPONENT:
- case GL_CONSTANT_ATTENUATION:
- case GL_LINEAR_ATTENUATION:
- case GL_QUADRATIC_ATTENUATION:
- case GL_SHININESS:
- case GL_LIGHT_MODEL_TWO_SIDE:
- case GL_POINT_SIZE:
- case GL_POINT_SIZE_MIN:
- case GL_POINT_SIZE_MAX:
- case GL_POINT_FADE_THRESHOLD_SIZE:
- case GL_CULL_FACE_MODE:
- case GL_FRONT_FACE:
- case GL_SHADE_MODEL:
- case GL_DEPTH_WRITEMASK:
- case GL_DEPTH_CLEAR_VALUE:
- case GL_STENCIL_FAIL:
- case GL_STENCIL_PASS_DEPTH_FAIL:
- case GL_STENCIL_PASS_DEPTH_PASS:
- case GL_STENCIL_REF:
- case GL_STENCIL_WRITEMASK:
- case GL_MATRIX_MODE:
- case GL_MODELVIEW_STACK_DEPTH:
- case GL_PROJECTION_STACK_DEPTH:
- case GL_TEXTURE_STACK_DEPTH:
- case GL_ALPHA_TEST_FUNC:
- case GL_ALPHA_TEST_REF:
- case GL_ALPHA_TEST:
- case GL_BLEND_DST:
- case GL_BLEND_SRC:
- case GL_BLEND:
- case GL_LOGIC_OP_MODE:
- case GL_SCISSOR_TEST:
- case GL_MAX_TEXTURE_UNITS:
- case GL_ACTIVE_TEXTURE:
- case GL_ALPHA_BITS:
- case GL_ARRAY_BUFFER_BINDING:
- case GL_BLUE_BITS:
- case GL_CLIENT_ACTIVE_TEXTURE:
- case GL_CLIP_PLANE0:
- case GL_CLIP_PLANE1:
- case GL_CLIP_PLANE2:
- case GL_CLIP_PLANE3:
- case GL_CLIP_PLANE4:
- case GL_CLIP_PLANE5:
- case GL_COLOR_ARRAY:
- case GL_COLOR_ARRAY_BUFFER_BINDING:
- case GL_COLOR_ARRAY_SIZE:
- case GL_COLOR_ARRAY_STRIDE:
- case GL_COLOR_ARRAY_TYPE:
- case GL_COLOR_LOGIC_OP:
- case GL_COLOR_MATERIAL:
- case GL_PACK_ALIGNMENT:
- case GL_PERSPECTIVE_CORRECTION_HINT:
- case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
- case GL_POINT_SIZE_ARRAY_STRIDE_OES:
- case GL_POINT_SIZE_ARRAY_TYPE_OES:
- case GL_POINT_SMOOTH:
- case GL_POINT_SMOOTH_HINT:
- case GL_POINT_SPRITE_OES:
- case GL_COORD_REPLACE_OES:
- case GL_COMBINE_ALPHA:
- case GL_SRC0_RGB:
- case GL_SRC1_RGB:
- case GL_SRC2_RGB:
- case GL_OPERAND0_RGB:
- case GL_OPERAND1_RGB:
- case GL_OPERAND2_RGB:
- case GL_SRC0_ALPHA:
- case GL_SRC1_ALPHA:
- case GL_SRC2_ALPHA:
- case GL_OPERAND0_ALPHA:
- case GL_OPERAND1_ALPHA:
- case GL_OPERAND2_ALPHA:
- case GL_RGB_SCALE:
- case GL_ALPHA_SCALE:
- case GL_COMBINE_RGB:
- case GL_POLYGON_OFFSET_FACTOR:
- case GL_POLYGON_OFFSET_FILL:
- case GL_POLYGON_OFFSET_UNITS:
- case GL_RED_BITS:
- case GL_RESCALE_NORMAL:
- case GL_SAMPLE_ALPHA_TO_COVERAGE:
- case GL_SAMPLE_ALPHA_TO_ONE:
- case GL_SAMPLE_BUFFERS:
- case GL_SAMPLE_COVERAGE:
- case GL_SAMPLE_COVERAGE_INVERT:
- case GL_SAMPLE_COVERAGE_VALUE:
- case GL_SAMPLES:
- case GL_STENCIL_BITS:
- case GL_STENCIL_CLEAR_VALUE:
- case GL_STENCIL_FUNC:
- case GL_STENCIL_TEST:
- case GL_STENCIL_VALUE_MASK:
- case GL_STENCIL_BACK_FUNC:
- case GL_STENCIL_BACK_VALUE_MASK:
- case GL_STENCIL_BACK_REF:
- case GL_STENCIL_BACK_FAIL:
- case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
- case GL_STENCIL_BACK_PASS_DEPTH_PASS:
- case GL_STENCIL_BACK_WRITEMASK:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_BINDING_2D:
- case GL_TEXTURE_BINDING_CUBE_MAP:
- case GL_TEXTURE_BINDING_EXTERNAL_OES:
- case GL_TEXTURE_COORD_ARRAY:
- case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
- case GL_TEXTURE_COORD_ARRAY_SIZE:
- case GL_TEXTURE_COORD_ARRAY_STRIDE:
- case GL_TEXTURE_COORD_ARRAY_TYPE:
- case GL_UNPACK_ALIGNMENT:
- case GL_VERTEX_ARRAY:
- case GL_VERTEX_ARRAY_BUFFER_BINDING:
- case GL_VERTEX_ARRAY_SIZE:
- case GL_VERTEX_ARRAY_STRIDE:
- case GL_VERTEX_ARRAY_TYPE:
- case GL_SPOT_CUTOFF:
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- case GL_GENERATE_MIPMAP:
- case GL_GENERATE_MIPMAP_HINT:
- case GL_RENDERBUFFER_WIDTH_OES:
- case GL_RENDERBUFFER_HEIGHT_OES:
- case GL_RENDERBUFFER_INTERNAL_FORMAT_OES:
- case GL_RENDERBUFFER_RED_SIZE_OES:
- case GL_RENDERBUFFER_GREEN_SIZE_OES:
- case GL_RENDERBUFFER_BLUE_SIZE_OES:
- case GL_RENDERBUFFER_ALPHA_SIZE_OES:
- case GL_RENDERBUFFER_DEPTH_SIZE_OES:
- case GL_RENDERBUFFER_STENCIL_SIZE_OES:
- case GL_RENDERBUFFER_BINDING:
- case GL_FRAMEBUFFER_BINDING:
- case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES:
- case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES:
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES:
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES:
- case GL_FENCE_STATUS_NV:
- case GL_FENCE_CONDITION_NV:
- case GL_TEXTURE_WIDTH_QCOM:
- case GL_TEXTURE_HEIGHT_QCOM:
- case GL_TEXTURE_DEPTH_QCOM:
- case GL_TEXTURE_INTERNAL_FORMAT_QCOM:
- case GL_TEXTURE_FORMAT_QCOM:
- case GL_TEXTURE_TYPE_QCOM:
- case GL_TEXTURE_IMAGE_VALID_QCOM:
- case GL_TEXTURE_NUM_LEVELS_QCOM:
- case GL_TEXTURE_TARGET_QCOM:
- case GL_TEXTURE_OBJECT_VALID_QCOM:
- case GL_BLEND_EQUATION_RGB_OES:
- case GL_BLEND_EQUATION_ALPHA_OES:
- case GL_BLEND_DST_RGB_OES:
- case GL_BLEND_SRC_RGB_OES:
- case GL_BLEND_DST_ALPHA_OES:
- case GL_BLEND_SRC_ALPHA_OES:
- case GL_MAX_LIGHTS:
- case GL_SHADER_TYPE:
- case GL_DELETE_STATUS:
- case GL_COMPILE_STATUS:
- case GL_INFO_LOG_LENGTH:
- case GL_SHADER_SOURCE_LENGTH:
- case GL_CURRENT_PROGRAM:
- case GL_LINK_STATUS:
- case GL_VALIDATE_STATUS:
- case GL_ATTACHED_SHADERS:
- case GL_ACTIVE_UNIFORMS:
- case GL_ACTIVE_ATTRIBUTES:
- case GL_SUBPIXEL_BITS:
- case GL_MAX_CUBE_MAP_TEXTURE_SIZE:
- case GL_NUM_SHADER_BINARY_FORMATS:
- case GL_SHADER_COMPILER:
- case GL_MAX_VERTEX_ATTRIBS:
- case GL_MAX_VERTEX_UNIFORM_VECTORS:
- case GL_MAX_VARYING_VECTORS:
- case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
- case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
- case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
- case GL_MAX_RENDERBUFFER_SIZE:
- case GL_MAX_TEXTURE_IMAGE_UNITS:
- case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
- case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
- case GL_LINE_WIDTH:
- s = 1;
- break;
- case GL_ALIASED_LINE_WIDTH_RANGE:
- case GL_ALIASED_POINT_SIZE_RANGE:
- case GL_DEPTH_RANGE:
- case GL_MAX_VIEWPORT_DIMS:
- case GL_SMOOTH_POINT_SIZE_RANGE:
- case GL_SMOOTH_LINE_WIDTH_RANGE:
- s= 2;
- break;
- case GL_SPOT_DIRECTION:
- case GL_POINT_DISTANCE_ATTENUATION:
- case GL_CURRENT_NORMAL:
- s = 3;
- break;
- case GL_CURRENT_VERTEX_ATTRIB:
- case GL_CURRENT_TEXTURE_COORDS:
- case GL_CURRENT_COLOR:
- case GL_FOG_COLOR:
- case GL_AMBIENT:
- case GL_DIFFUSE:
- case GL_SPECULAR:
- case GL_EMISSION:
- case GL_POSITION:
- case GL_LIGHT_MODEL_AMBIENT:
- case GL_TEXTURE_ENV_COLOR:
- case GL_SCISSOR_BOX:
- case GL_VIEWPORT:
- case GL_TEXTURE_CROP_RECT_OES:
- case GL_COLOR_CLEAR_VALUE:
- case GL_COLOR_WRITEMASK:
- case GL_AMBIENT_AND_DIFFUSE:
- case GL_BLEND_COLOR:
- s = 4;
- break;
- case GL_MODELVIEW_MATRIX:
- case GL_PROJECTION_MATRIX:
- case GL_TEXTURE_MATRIX:
- s = 16;
- break;
- default:
- ERR("glUtilsParamSize: unknow param 0x%08x\n", param);
- s = 1; // assume 1
- }
- return s;
-}
-
-void glUtilsPackPointerData(unsigned char *dst, unsigned char *src,
- int size, GLenum type, unsigned int stride,
- unsigned int datalen)
-{
- unsigned int vsize = size * glSizeof(type);
- if (stride == 0) stride = vsize;
-
- if (stride == vsize) {
- memcpy(dst, src, datalen);
- } else {
- for (unsigned int i = 0; i < datalen; i += vsize) {
- memcpy(dst, src, vsize);
- dst += vsize;
- src += stride;
- }
- }
-}
-
-void glUtilsWritePackPointerData(void* _stream, unsigned char *src,
- int size, GLenum type, unsigned int stride,
- unsigned int datalen)
-{
- IOStream* stream = reinterpret_cast<IOStream*>(_stream);
-
- unsigned int vsize = size * glSizeof(type);
- if (stride == 0) stride = vsize;
-
- if (stride == vsize) {
- stream->writeFully(src, datalen);
- } else {
- for (unsigned int i = 0; i < datalen; i += vsize) {
- stream->writeFully(src, (size_t)vsize);
- src += stride;
- }
- }
-}
-
-int glUtilsPixelBitSize(GLenum format, GLenum type)
-{
- int components = 0;
- int componentsize = 0;
- int pixelsize = 0;
- switch(type) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- componentsize = 8;
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_RGB565_OES:
- case GL_RGB5_A1_OES:
- case GL_RGBA4_OES:
- pixelsize = 16;
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- case GL_FIXED:
- case GL_UNSIGNED_INT_24_8_OES:
- pixelsize = 32;
- break;
- default:
- ERR("glUtilsPixelBitSize: unknown pixel type - assuming pixel data 0\n");
- componentsize = 0;
- }
-
- if (pixelsize == 0) {
- switch(format) {
-#if 0
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
-#endif
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_STENCIL_OES:
- components = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- components = 2;
- break;
- case GL_RGB:
-#if 0
- case GL_BGR:
-#endif
- components = 3;
- break;
- case GL_RGBA:
- case GL_BGRA_EXT:
- components = 4;
- break;
- default:
- ERR("glUtilsPixelBitSize: unknown pixel format...\n");
- components = 0;
- }
- pixelsize = components * componentsize;
- }
-
- return pixelsize;
-}
-
-// pack a list of strings into one.
-void glUtilsPackStrings(char *ptr, char **strings, GLint *length, GLsizei count)
-{
- char *p = ptr;
- *p = '\0';
- for (int i = 0; i < count; i++) {
- int l=0;
- if (strings[i]!=NULL) {
- if (length == NULL || length[i] < 0) {
- l = strlen(strings[i]);
- strcat(p, strings[i]);
- } else {
- l = length[i];
- strncat(p, strings[i], l);
- }
- }
- p += l;
- }
-}
-
-// claculate the length of a list of strings
-int glUtilsCalcShaderSourceLen( char **strings, GLint *length, GLsizei count)
-{
- int len = 0;
- for (int i = 0; i < count; i++) {
- int l;
- if (length == NULL || length[i] < 0) {
- l = strings[i]!=NULL ? strlen(strings[i]) : 0;
- } else {
- l = length[i];
- }
- len += l;
- }
- return len;
-
-}
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.h b/tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.h
deleted file mode 100644
index f8857f165..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.h
+++ /dev/null
@@ -1,95 +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.
-*/
-#ifndef __GL_UTILS_H__
-#define __GL_UTILS_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef GL_API
- #undef GL_API
-#endif
-#define GL_API
-
-#ifdef GL_APIENTRY
- #undef GL_APIENTRY
-#endif
-
-#ifdef GL_APIENTRYP
- #undef GL_APIENTRYP
-#endif
-#define GL_APIENTRYP
-
-#ifndef ANDROID
-#define GL_APIENTRY
-#endif
-
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- size_t glSizeof(GLenum type);
- size_t glUtilsParamSize(GLenum param);
- void glUtilsPackPointerData(unsigned char *dst, unsigned char *str,
- int size, GLenum type, unsigned int stride,
- unsigned int datalen);
- void glUtilsWritePackPointerData(void* stream, unsigned char *src,
- int size, GLenum type, unsigned int stride,
- unsigned int datalen);
- int glUtilsPixelBitSize(GLenum format, GLenum type);
- void glUtilsPackStrings(char *ptr, char **strings, GLint *length, GLsizei count);
- int glUtilsCalcShaderSourceLen(char **strings, GLint *length, GLsizei count);
-#ifdef __cplusplus
-};
-#endif
-
-namespace GLUtils {
-
- template <class T> void minmax(T *indices, int count, int *min, int *max) {
- *min = -1;
- *max = -1;
- T *ptr = indices;
- for (int i = 0; i < count; i++) {
- if (*min == -1 || *ptr < *min) *min = *ptr;
- if (*max == -1 || *ptr > *max) *max = *ptr;
- ptr++;
- }
- }
-
- template <class T> void shiftIndices(T *indices, int count, int offset) {
- T *ptr = indices;
- for (int i = 0; i < count; i++) {
- *ptr += offset;
- ptr++;
- }
- }
-
-
- template <class T> void shiftIndices(T *src, T *dst, int count, int offset)
- {
- for (int i = 0; i < count; i++) {
- *dst = *src + offset;
- dst++;
- src++;
- }
- }
-}; // namespace GLUtils
-#endif
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/gl_base_types.h b/tools/emulator/opengl/shared/OpenglCodecCommon/gl_base_types.h
deleted file mode 100644
index d7bdef8bf..000000000
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/gl_base_types.h
+++ /dev/null
@@ -1,62 +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.
-*/
-#ifndef __GL_BASE_TYPES__H
-#define __GL_BASE_TYPES__H
-
-#include <KHR/khrplatform.h>
-
-#ifndef gl_APIENTRY
-#define gl_APIENTRY KHRONOS_APIENTRY
-#endif
-
-#ifndef gl2_APIENTRY
-#define gl2_APIENTRY KHRONOS_APIENTRY
-#endif
-
-typedef void GLvoid;
-typedef unsigned int GLenum;
-typedef unsigned char GLboolean;
-typedef unsigned int GLbitfield;
-typedef char GLchar;
-typedef khronos_int8_t GLbyte;
-typedef short GLshort;
-typedef int GLint;
-typedef int GLsizei;
-typedef khronos_uint8_t GLubyte;
-typedef unsigned short GLushort;
-typedef unsigned int GLuint;
-typedef khronos_float_t GLfloat;
-typedef khronos_float_t GLclampf;
-typedef khronos_int32_t GLfixed;
-typedef khronos_int32_t GLclampx;
-typedef khronos_intptr_t GLintptr;
-typedef khronos_ssize_t GLsizeiptr;
-typedef char *GLstr;
-/* JR XXX Treating this as an in handle - is this correct? */
-typedef void * GLeglImageOES;
-
-/* ErrorCode */
-#ifndef GL_INVALID_ENUM
-#define GL_NO_ERROR 0
-#define GL_INVALID_ENUM 0x0500
-#define GL_INVALID_VALUE 0x0501
-#define GL_INVALID_OPERATION 0x0502
-#define GL_STACK_OVERFLOW 0x0503
-#define GL_STACK_UNDERFLOW 0x0504
-#define GL_OUT_OF_MEMORY 0x0505
-#endif
-
-#endif
diff --git a/tools/emulator/opengl/shared/OpenglOsUtils/Android.mk b/tools/emulator/opengl/shared/OpenglOsUtils/Android.mk
deleted file mode 100644
index e7fd9e9f3..000000000
--- a/tools/emulator/opengl/shared/OpenglOsUtils/Android.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-# This build script corresponds to a small library containing
-# OS-specific support functions for:
-# - thread-local storage
-# - dynamic library loading
-# - child process creation and wait (probably not needed in guest)
-#
-LOCAL_PATH := $(call my-dir)
-
-### Guest library ##############################################
-$(call emugl-begin-static-library,libOpenglOsUtils)
-
- $(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
- $(call emugl-export,LDLIBS,-ldl)
-
- LOCAL_SRC_FILES := \
- osProcessUnix.cpp \
- osThreadUnix.cpp \
- osDynLibrary.cpp
-
-$(call emugl-end-module)
diff --git a/tools/emulator/opengl/shared/OpenglOsUtils/osDynLibrary.cpp b/tools/emulator/opengl/shared/OpenglOsUtils/osDynLibrary.cpp
deleted file mode 100644
index e8e6ab7b0..000000000
--- a/tools/emulator/opengl/shared/OpenglOsUtils/osDynLibrary.cpp
+++ /dev/null
@@ -1,79 +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.
-*/
-#include "osDynLibrary.h"
-
-#ifndef _WIN32
-#include <dlfcn.h>
-#endif
-#include <stdio.h>
-
-namespace osUtils {
-
-dynLibrary *dynLibrary::open(const char *p_libName)
-{
- dynLibrary *lib = new dynLibrary();
- if (!lib) {
- return NULL;
- }
-
-#ifdef _WIN32
- lib->m_lib = LoadLibrary(p_libName);
-#else // !WIN32
- lib->m_lib = dlopen(p_libName, RTLD_NOW);
-#endif
-
- if (lib->m_lib == NULL) {
- printf("Failed to load %s\n", p_libName);
-#ifndef _WIN32
- printf("error %s\n", dlerror()); //only on linux
-#endif
- delete lib;
- return NULL;
- }
-
- return lib;
-}
-
-dynLibrary::dynLibrary() :
- m_lib(NULL)
-{
-}
-
-dynLibrary::~dynLibrary()
-{
- if (NULL != m_lib) {
-#ifdef _WIN32
- FreeLibrary(m_lib);
-#else // !WIN32
- dlclose(m_lib);
-#endif
- }
-}
-
-dynFuncPtr dynLibrary::findSymbol(const char *p_symName)
-{
- if (NULL == m_lib) {
- return NULL;
- }
-
-#ifdef _WIN32
- return (dynFuncPtr) GetProcAddress(m_lib, p_symName);
-#else // !WIN32
- return (dynFuncPtr) dlsym(m_lib, p_symName);
-#endif
-}
-
-} // of namespace osUtils
diff --git a/tools/emulator/opengl/shared/OpenglOsUtils/osDynLibrary.h b/tools/emulator/opengl/shared/OpenglOsUtils/osDynLibrary.h
deleted file mode 100644
index c83fbf3a8..000000000
--- a/tools/emulator/opengl/shared/OpenglOsUtils/osDynLibrary.h
+++ /dev/null
@@ -1,71 +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.
-*/
-#ifndef _OSUTILS_DYN_LIBRARY_H
-#define _OSUTILS_DYN_LIBRARY_H
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
-namespace osUtils {
-
-typedef void (*dynFuncPtr)(void);
-
-class dynLibrary
-{
-public:
- static dynLibrary *open(const char *p_libName);
- ~dynLibrary();
-
- dynFuncPtr findSymbol(const char *p_symName);
-
-private:
- dynLibrary();
-
-private:
-#ifdef _WIN32
- HMODULE m_lib;
-#else
- void *m_lib;
-#endif
-};
-
-} // of namespace osUtils
-
-
-
-// Macro to compose emugl shared library name under various OS and bitness
-// eg.
-// on x86_64, EMUGL_LIBNAME("foo") --> "lib64foo.so"
-
-#ifdef _WIN32
-# define DLL_EXTENSION "" // _WIN32 LoadLibrary only accept name w/o .dll extension
-#elif defined(__APPLE__)
-# define DLL_EXTENSION ".dylib"
-#else
-# define DLL_EXTENSION ".so"
-#endif
-
-#if defined(__x86_64__)
-# define EMUGL_LIBNAME(name) "lib64" name DLL_EXTENSION
-#elif defined(__i386__)
-# define EMUGL_LIBNAME(name) "lib" name DLL_EXTENSION
-#else
-/* This header is included by target w/o using EMUGL_LIBNAME(). Don't #error, leave it undefined */
-#endif
-
-
-#endif
diff --git a/tools/emulator/opengl/shared/OpenglOsUtils/osProcess.h b/tools/emulator/opengl/shared/OpenglOsUtils/osProcess.h
deleted file mode 100644
index 82b31b33a..000000000
--- a/tools/emulator/opengl/shared/OpenglOsUtils/osProcess.h
+++ /dev/null
@@ -1,62 +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.
-*/
-#ifndef _OSUTILS_PROCESS_H
-#define _OSUTILS_PROCESS_H
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
-namespace osUtils {
-
-class childProcess
-{
-public:
- static childProcess *create(const char *p_cmdLine, const char *p_startdir);
- ~childProcess();
-
- int getPID()
- {
-#ifdef _WIN32
- return m_proc.dwProcessId;
-#else
- return(m_pid);
-#endif
- }
-
- int tryWait(bool& isAlive);
- bool wait(int *exitStatus);
-
-private:
- childProcess() {};
-
-private:
-#ifdef _WIN32
- PROCESS_INFORMATION m_proc;
-#else
- int m_pid;
-#endif
-};
-
-int ProcessGetPID();
-int ProcessGetTID();
-bool ProcessGetName(char *p_outName, int p_outNameLen);
-int KillProcess(int pid, bool wait);
-bool isProcessRunning(int pid);
-
-} // of namespace osUtils
-
-#endif
diff --git a/tools/emulator/opengl/shared/OpenglOsUtils/osProcessUnix.cpp b/tools/emulator/opengl/shared/OpenglOsUtils/osProcessUnix.cpp
deleted file mode 100644
index c97ff5820..000000000
--- a/tools/emulator/opengl/shared/OpenglOsUtils/osProcessUnix.cpp
+++ /dev/null
@@ -1,210 +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.
-*/
-#include "osProcess.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/wait.h>
-#include <sys/types.h>
-#include <poll.h>
-#include <pthread.h>
-#include <string.h>
-#include <pwd.h>
-#include <paths.h>
-#include <errno.h>
-#include <signal.h>
-#include <unistd.h>
-#include <assert.h>
-
-namespace osUtils {
-
-//
-// buildArgList converts a command line into null terminated argument list.
-// to be used with execv or execvp.
-// each argument is seperated by space or tab, to specify multiple words
-// at the same argument place it inside single-quoted or double-quoted string.
-//
-static char **buildArgList(const char *command)
-{
- char **argv = NULL;
- int argvSize = 0;
- int nArgs = 0;
- char *tmpcmd = strdup(command);
- char *t = tmpcmd;
- char *strStart = NULL;
- int i = 0;
-
- #define ADD_ARG \
- { \
- nArgs++; \
- if (!argv) { \
- argvSize = 12; \
- argv = (char **)malloc(argvSize * sizeof(char *)); \
- } \
- else if (nArgs > argvSize) { \
- argvSize += 12; \
- argv = (char **)realloc(argv, argvSize * sizeof(char *)); \
- } \
- argv[nArgs-1] = t; \
- t = NULL; \
- }
-
- while( tmpcmd[i] != '\0' ) {
- if (!strStart) {
- if (tmpcmd[i] == '"' || tmpcmd[i] == '\'') {
- strStart = &tmpcmd[i];
- }
- else if (tmpcmd[i] == ' ' || tmpcmd[i] == '\t') {
- tmpcmd[i] = '\0';
- if (t) ADD_ARG;
- }
- else if (!t) {
- t = &tmpcmd[i];
- }
- }
- else if (tmpcmd[i] == *strStart) {
- t = strStart;
- strStart = NULL;
- }
-
- i++;
- }
- if (t) {
- ADD_ARG;
- }
- if (nArgs > 0) {
- ADD_ARG; // for NULL terminating list
- }
-
- return argv;
-}
-
-static pid_t start_process(const char *command,const char *startDir)
-{
- pid_t pid;
-
- pid = fork();
-
- if (pid < 0) {
- return pid;
- }
- else if (pid == 0) {
- //
- // Close all opened file descriptors
- //
- for (int i=3; i<256; i++) {
- close(i);
- }
-
- if (startDir) {
- chdir(startDir);
- }
-
- char **argv = buildArgList(command);
- if (!argv) {
- return -1;
- }
- execvp(argv[0], argv);
-
- perror("execl");
- exit(-101);
- }
-
- return pid;
-}
-
-childProcess *
-childProcess::create(const char *p_cmdLine, const char *p_startdir)
-{
- childProcess *child = new childProcess();
- if (!child) {
- return NULL;
- }
-
- child->m_pid = start_process(p_cmdLine, p_startdir);
- if (child->m_pid < 0) {
- delete child;
- return NULL;
- }
-
- return child;
-}
-
-childProcess::~childProcess()
-{
-}
-
-bool
-childProcess::wait(int *exitStatus)
-{
- int ret=0;
- if (m_pid>0) {
- pid_t pid = waitpid(m_pid,&ret,0);
- if (pid != -1) {
- m_pid=-1;
- if (exitStatus) {
- *exitStatus = ret;
- }
- return true;
- }
- }
- return false;
-}
-
-int
-childProcess::tryWait(bool &isAlive)
-{
- int ret=0;
- isAlive = false;
- if (m_pid>0) {
- pid_t pid = waitpid(m_pid,&ret,WNOHANG);
- if (pid == 0) {
- isAlive = true;
- }
- }
-
- return ((char)WEXITSTATUS(ret));
-}
-
-int ProcessGetPID()
-{
- return getpid();
-}
-
-int KillProcess(int pid, bool wait)
-{
- if (pid<1) {
- return false;
- }
-
- if (0!=kill(pid,SIGTERM)) {
- return false;
- }
-
- if (wait) {
- if (waitpid(pid,NULL,0)<0) {
- return false;
- }
- }
-
- return true;
-}
-
-bool isProcessRunning(int pid)
-{
- return (kill(pid,0) == 0);
-}
-
-} // of namespace osUtils
diff --git a/tools/emulator/opengl/shared/OpenglOsUtils/osProcessWin.cpp b/tools/emulator/opengl/shared/OpenglOsUtils/osProcessWin.cpp
deleted file mode 100644
index 6ff0fdf51..000000000
--- a/tools/emulator/opengl/shared/OpenglOsUtils/osProcessWin.cpp
+++ /dev/null
@@ -1,171 +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.
-*/
-#include "osProcess.h"
-#include <windows.h>
-#include <string>
-#include <stdlib.h>
-#include <psapi.h>
-
-namespace osUtils {
-
-childProcess *
-childProcess::create(const char *p_cmdLine, const char *p_startdir)
-{
- childProcess *child = new childProcess();
- if (!child) {
- return NULL;
- }
-
- STARTUPINFOA si;
- ZeroMemory(&si, sizeof(si));
-
- ZeroMemory(&child->m_proc, sizeof(child->m_proc));
- BOOL ret = CreateProcessA(
- NULL ,
- (LPSTR)p_cmdLine,
- NULL,
- NULL,
- FALSE,
- CREATE_DEFAULT_ERROR_MODE,
- NULL,
- (p_startdir != NULL ? p_startdir : ".\\"),
- &si,
- &child->m_proc);
- if (ret == 0) {
- delete child;
- return NULL;
- }
-
- // close the thread handle we do not need it,
- // keep the process handle for wait/trywait operations, will
- // be closed on destruction
- CloseHandle(child->m_proc.hThread);
-
- return child;
-}
-
-childProcess::~childProcess()
-{
- if (m_proc.hProcess) {
- CloseHandle(m_proc.hProcess);
- }
-}
-
-bool
-childProcess::wait(int *exitStatus)
-{
-DWORD _exitStatus;
-
- if (WaitForSingleObject(m_proc.hProcess, INFINITE) == WAIT_FAILED) {
- return false;
- }
-
- if (!GetExitCodeProcess(m_proc.hProcess, &_exitStatus))
- {
- return false;
- }
-
- if (exitStatus) {
- *exitStatus = _exitStatus;
- }
-
- return true;
-}
-
-int
-childProcess::tryWait(bool& isAlive)
-{
- DWORD status = WaitForSingleObject(m_proc.hProcess, 0);
-
- if(status == WAIT_OBJECT_0)
- {
- // process has exited
- isAlive = false;
- GetExitCodeProcess(m_proc.hProcess, &status);
- }
- else if (status == WAIT_TIMEOUT)
- {
- isAlive = true;
- status = 0;
- }
-
- return status;
-
-}
-
-int ProcessGetPID()
-{
- return GetCurrentProcessId();
-}
-
-int ProcessGetTID()
-{
- return GetCurrentThreadId();
-}
-
-bool ProcessGetName(char *p_outName, int p_outNameLen)
-{
- return 0 != GetModuleFileNameEx( GetCurrentProcess(), NULL, p_outName, p_outNameLen);
-}
-
-int KillProcess(int pid, bool wait)
-{
- DWORD exitStatus = 1;
- HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
-
- if (NULL == hProc) {
- return 0;
- }
-
- //
- // Terminate the process
- //
- TerminateProcess(hProc, 0x55);
-
- if (wait) {
- //
- // Wait for it to be terminated
- //
- if(WaitForSingleObject(hProc, INFINITE) == WAIT_FAILED) {
- CloseHandle(hProc);
- return 0;
- }
-
- if (!GetExitCodeProcess(hProc, &exitStatus)) {
- CloseHandle(hProc);
- return 0;
- }
- }
-
- CloseHandle(hProc);
-
- return exitStatus;
-}
-
-bool isProcessRunning(int pid)
-{
- bool isRunning = false;
-
- HANDLE process = OpenProcess(SYNCHRONIZE, FALSE, pid);
- if (NULL != process) {
- DWORD ret = WaitForSingleObject(process, 0);
- CloseHandle(process);
- isRunning = (ret == WAIT_TIMEOUT);
- }
- return isRunning;
-}
-
-} // of namespace osUtils
diff --git a/tools/emulator/opengl/shared/OpenglOsUtils/osThread.h b/tools/emulator/opengl/shared/OpenglOsUtils/osThread.h
deleted file mode 100644
index 970396dc3..000000000
--- a/tools/emulator/opengl/shared/OpenglOsUtils/osThread.h
+++ /dev/null
@@ -1,60 +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.
-*/
-#ifndef _OSUTILS_THREAD_H
-#define _OSUTILS_THREAD_H
-
-#ifdef _WIN32
-#include <windows.h>
-#else // !WIN32
-#include <pthread.h>
-#endif
-
-namespace osUtils {
-
-class Thread
-{
-public:
- Thread();
- virtual ~Thread();
-
- virtual int Main() = 0;
-
- bool start();
- bool wait(int *exitStatus);
- bool trywait(int *exitStatus);
-
-private:
-#ifdef _WIN32
- static DWORD WINAPI thread_main(void *p_arg);
-#else // !WIN32
- static void* thread_main(void *p_arg);
-#endif
-
-private:
-#ifdef _WIN32
- HANDLE m_thread;
- DWORD m_threadId;
-#else // !WIN32
- pthread_t m_thread;
- int m_exitStatus;
- pthread_mutex_t m_lock;
-#endif
- bool m_isRunning;
-};
-
-} // of namespace osUtils
-
-#endif
diff --git a/tools/emulator/opengl/shared/OpenglOsUtils/osThreadUnix.cpp b/tools/emulator/opengl/shared/OpenglOsUtils/osThreadUnix.cpp
deleted file mode 100644
index d8879ebe3..000000000
--- a/tools/emulator/opengl/shared/OpenglOsUtils/osThreadUnix.cpp
+++ /dev/null
@@ -1,94 +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.
-*/
-#include "osThread.h"
-
-namespace osUtils {
-
-Thread::Thread() :
- m_thread((pthread_t)NULL),
- m_exitStatus(0),
- m_isRunning(false)
-{
- pthread_mutex_init(&m_lock, NULL);
-}
-
-Thread::~Thread()
-{
- pthread_mutex_destroy(&m_lock);
-}
-
-bool
-Thread::start()
-{
- pthread_mutex_lock(&m_lock);
- m_isRunning = true;
- int ret = pthread_create(&m_thread, NULL, Thread::thread_main, this);
- if(ret) {
- m_isRunning = false;
- }
- pthread_mutex_unlock(&m_lock);
- return m_isRunning;
-}
-
-bool
-Thread::wait(int *exitStatus)
-{
- if (!m_isRunning) {
- return false;
- }
-
- void *retval;
- if (pthread_join(m_thread,&retval)) {
- return false;
- }
-
- long long int ret=(long long int)retval;
- if (exitStatus) {
- *exitStatus = (int)ret;
- }
- return true;
-}
-
-bool
-Thread::trywait(int *exitStatus)
-{
- bool ret = false;
-
- pthread_mutex_lock(&m_lock);
- if (!m_isRunning) {
- *exitStatus = m_exitStatus;
- ret = true;
- }
- pthread_mutex_unlock(&m_lock);
- return ret;
-}
-
-void *
-Thread::thread_main(void *p_arg)
-{
- Thread *self = (Thread *)p_arg;
- int ret = self->Main();
-
- pthread_mutex_lock(&self->m_lock);
- self->m_isRunning = false;
- self->m_exitStatus = ret;
- pthread_mutex_unlock(&self->m_lock);
-
- return (void*)ret;
-}
-
-} // of namespace osUtils
-
diff --git a/tools/emulator/opengl/shared/OpenglOsUtils/osThreadWin.cpp b/tools/emulator/opengl/shared/OpenglOsUtils/osThreadWin.cpp
deleted file mode 100644
index 2d563f8b9..000000000
--- a/tools/emulator/opengl/shared/OpenglOsUtils/osThreadWin.cpp
+++ /dev/null
@@ -1,101 +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.
-*/
-#include "osThread.h"
-
-namespace osUtils {
-
-Thread::Thread() :
- m_thread(NULL),
- m_threadId(0),
- m_isRunning(false)
-{
-}
-
-Thread::~Thread()
-{
- if(m_thread) {
- CloseHandle(m_thread);
- }
-}
-
-bool
-Thread::start()
-{
- m_isRunning = true;
- m_thread = CreateThread(NULL, 0, &Thread::thread_main, this, 0, &m_threadId);
- if(!m_thread) {
- m_isRunning = false;
- }
- return m_isRunning;
-}
-
-bool
-Thread::wait(int *exitStatus)
-{
- if (!m_isRunning) {
- return false;
- }
-
- if(WaitForSingleObject(m_thread, INFINITE) == WAIT_FAILED) {
- return false;
- }
-
- DWORD retval;
- if (!GetExitCodeThread(m_thread,&retval)) {
- return false;
- }
-
- m_isRunning = 0;
-
- if (exitStatus) {
- *exitStatus = retval;
- }
- return true;
-}
-
-bool
-Thread::trywait(int *exitStatus)
-{
- if (!m_isRunning) {
- return false;
- }
-
- if(WaitForSingleObject(m_thread, 0) == WAIT_OBJECT_0) {
-
- DWORD retval;
- if (!GetExitCodeThread(m_thread,&retval)) {
- return true;
- }
-
- if (exitStatus) {
- *exitStatus = retval;
- }
- return true;
- }
-
- return false;
-}
-
-DWORD WINAPI
-Thread::thread_main(void *p_arg)
-{
- Thread *self = (Thread *)p_arg;
- int ret = self->Main();
- self->m_isRunning = false;
- return ret;
-}
-
-} // of namespace osUtils
diff --git a/tools/emulator/opengl/system/GLESv1/Android.mk b/tools/emulator/opengl/system/GLESv1/Android.mk
deleted file mode 100644
index 97356b710..000000000
--- a/tools/emulator/opengl/system/GLESv1/Android.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-### GLESv1 implementation ###########################################
-$(call emugl-begin-shared-library,libGLESv1_CM_emulation)
-$(call emugl-import,libOpenglSystemCommon libGLESv1_enc lib_renderControl_enc)
-
-LOCAL_CFLAGS += -DLOG_TAG=\"GLES_emulation\" -DGL_GLEXT_PROTOTYPES
-
-LOCAL_SRC_FILES := gl.cpp
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
-
-$(call emugl-end-module)
diff --git a/tools/emulator/opengl/system/GLESv1/gl.cpp b/tools/emulator/opengl/system/GLESv1/gl.cpp
deleted file mode 100644
index 8ecb504a8..000000000
--- a/tools/emulator/opengl/system/GLESv1/gl.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
-* Copyright 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.
-*/
-
-#include "EGLClientIface.h"
-#include "HostConnection.h"
-#include "GLEncoder.h"
-#include "GLES/gl.h"
-#include "GLES/glext.h"
-#include "ErrorLog.h"
-#include "gralloc_cb.h"
-#include "ThreadInfo.h"
-
-
-//XXX: fix this macro to get the context from fast tls path
-#define GET_CONTEXT GLEncoder * ctx = getEGLThreadInfo()->hostConn->glEncoder();
-
-#include "gl_entry.cpp"
-
-//The functions table
-#include "gl_ftable.h"
-
-static EGLClient_eglInterface * s_egl = NULL;
-static EGLClient_glesInterface * s_gl = NULL;
-
-#define DEFINE_AND_VALIDATE_HOST_CONNECTION(ret) \
- HostConnection *hostCon = HostConnection::get(); \
- if (!hostCon) { \
- ALOGE("egl: Failed to get host connection\n"); \
- return ret; \
- } \
- renderControl_encoder_context_t *rcEnc = hostCon->rcEncoder(); \
- if (!rcEnc) { \
- ALOGE("egl: Failed to get renderControl encoder context\n"); \
- return ret; \
- }
-
-//GL extensions
-void glEGLImageTargetTexture2DOES(void * self, GLenum target, GLeglImageOES image)
-{
- DBG("glEGLImageTargetTexture2DOES v1 target=%#x image=%p", target, image);
- //TODO: check error - we don't have a way to set gl error
- android_native_buffer_t* native_buffer = (android_native_buffer_t*)image;
-
- if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) {
- return;
- }
-
- if (native_buffer->common.version != sizeof(android_native_buffer_t)) {
- return;
- }
-
- GET_CONTEXT;
- DEFINE_AND_VALIDATE_HOST_CONNECTION();
-
- ctx->override2DTextureTarget(target);
- rcEnc->rcBindTexture(rcEnc,
- ((cb_handle_t *)(native_buffer->handle))->hostHandle);
- ctx->restore2DTextureTarget();
-
- return;
-}
-
-void glEGLImageTargetRenderbufferStorageOES(void *self, GLenum target, GLeglImageOES image)
-{
- DBG("glEGLImageTargetRenderbufferStorageOES v1 target=%#x image=%p",
- target, image);
- //TODO: check error - we don't have a way to set gl error
- android_native_buffer_t* native_buffer = (android_native_buffer_t*)image;
-
- if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) {
- return;
- }
-
- if (native_buffer->common.version != sizeof(android_native_buffer_t)) {
- return;
- }
-
- DEFINE_AND_VALIDATE_HOST_CONNECTION();
- rcEnc->rcBindRenderbuffer(rcEnc,
- ((cb_handle_t *)(native_buffer->handle))->hostHandle);
-
- return;
-}
-
-void * getProcAddress(const char * procname)
-{
- // search in GL function table
- for (int i=0; i<gl_num_funcs; i++) {
- if (!strcmp(gl_funcs_by_name[i].name, procname)) {
- return gl_funcs_by_name[i].proc;
- }
- }
- return NULL;
-}
-
-void finish()
-{
- glFinish();
-}
-
-const GLubyte *my_glGetString (void *self, GLenum name)
-{
- if (s_egl) {
- return (const GLubyte*)s_egl->getGLString(name);
- }
- return NULL;
-}
-
-void init()
-{
- GET_CONTEXT;
- ctx->set_glEGLImageTargetTexture2DOES(glEGLImageTargetTexture2DOES);
- ctx->set_glEGLImageTargetRenderbufferStorageOES(glEGLImageTargetRenderbufferStorageOES);
- ctx->set_glGetString(my_glGetString);
-}
-
-extern "C" {
-EGLClient_glesInterface * init_emul_gles(EGLClient_eglInterface *eglIface)
-{
- s_egl = eglIface;
-
- if (!s_gl) {
- s_gl = new EGLClient_glesInterface();
- s_gl->getProcAddress = getProcAddress;
- s_gl->finish = finish;
- s_gl->init = init;
- }
-
- return s_gl;
-}
-} //extern
-
-
diff --git a/tools/emulator/opengl/system/GLESv1_enc/Android.mk b/tools/emulator/opengl/system/GLESv1_enc/Android.mk
deleted file mode 100644
index fd12395c0..000000000
--- a/tools/emulator/opengl/system/GLESv1_enc/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-### GLESv1_enc Encoder ###########################################
-$(call emugl-begin-shared-library,libGLESv1_enc)
-
-LOCAL_CFLAGS += -DLOG_TAG=\"emuglGLESv1_enc\"
-
-LOCAL_SRC_FILES := \
- GLEncoder.cpp \
- GLEncoderUtils.cpp \
- gl_client_context.cpp \
- gl_enc.cpp \
- gl_entry.cpp
-
-$(call emugl-import,libOpenglCodecCommon)
-$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-$(call emugl-export,C_INCLUDES,$(intermediates))
-
-$(call emugl-end-module)
diff --git a/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp b/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp
deleted file mode 100644
index 4414f2461..000000000
--- a/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp
+++ /dev/null
@@ -1,989 +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.
-*/
-#include "GLEncoder.h"
-#include "glUtils.h"
-#include "FixedBuffer.h"
-#include <cutils/log.h>
-#include <assert.h>
-
-#ifndef MIN
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-#endif
-
-static GLubyte *gVendorString= (GLubyte *) "Android";
-static GLubyte *gRendererString= (GLubyte *) "Android HW-GLES 1.0";
-static GLubyte *gVersionString= (GLubyte *) "OpenGL ES-CM 1.0";
-static GLubyte *gExtensionsString= (GLubyte *) ""; // no extensions at this point;
-
-#define SET_ERROR_IF(condition,err) if((condition)) { \
- ALOGE("%s:%s:%d GL error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \
- ctx->setError(err); \
- return; \
- }
-
-
-#define RET_AND_SET_ERROR_IF(condition,err,ret) if((condition)) { \
- ALOGE("%s:%s:%d GL error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \
- ctx->setError(err); \
- return ret; \
- }
-
-GLenum GLEncoder::s_glGetError(void * self)
-{
- GLEncoder *ctx = (GLEncoder *)self;
- GLenum err = ctx->getError();
- if(err != GL_NO_ERROR) {
- ctx->setError(GL_NO_ERROR);
- return err;
- }
-
- return ctx->m_glGetError_enc(self);
-
-}
-
-GLint * GLEncoder::getCompressedTextureFormats()
-{
- if (m_compressedTextureFormats == NULL) {
- this->glGetIntegerv(this, GL_NUM_COMPRESSED_TEXTURE_FORMATS,
- &m_num_compressedTextureFormats);
- if (m_num_compressedTextureFormats > 0) {
- // get number of texture formats;
- m_compressedTextureFormats = new GLint[m_num_compressedTextureFormats];
- this->glGetCompressedTextureFormats(this, m_num_compressedTextureFormats, m_compressedTextureFormats);
- }
- }
- return m_compressedTextureFormats;
-}
-
-void GLEncoder::s_glGetIntegerv(void *self, GLenum param, GLint *ptr)
-{
- GLEncoder *ctx = (GLEncoder *)self;
- assert(ctx->m_state != NULL);
- GLClientState* state = ctx->m_state;
-
- switch (param) {
- case GL_COMPRESSED_TEXTURE_FORMATS: {
- GLint * compressedTextureFormats = ctx->getCompressedTextureFormats();
- if (ctx->m_num_compressedTextureFormats > 0 &&
- compressedTextureFormats != NULL) {
- memcpy(ptr, compressedTextureFormats,
- ctx->m_num_compressedTextureFormats * sizeof(GLint));
- }
- break;
- }
-
- case GL_MAX_TEXTURE_UNITS:
- ctx->m_glGetIntegerv_enc(self, param, ptr);
- *ptr = MIN(*ptr, GLClientState::MAX_TEXTURE_UNITS);
- break;
-
- case GL_TEXTURE_BINDING_2D:
- *ptr = state->getBoundTexture(GL_TEXTURE_2D);
- break;
-
- case GL_TEXTURE_BINDING_EXTERNAL_OES:
- *ptr = state->getBoundTexture(GL_TEXTURE_EXTERNAL_OES);
- break;
-
- default:
- if (!state->getClientStateParameter<GLint>(param,ptr)) {
- ctx->m_glGetIntegerv_enc(self, param, ptr);
- }
- break;
- }
-}
-
-void GLEncoder::s_glGetFloatv(void *self, GLenum param, GLfloat *ptr)
-{
- GLEncoder *ctx = (GLEncoder *)self;
- assert(ctx->m_state != NULL);
- GLClientState* state = ctx->m_state;
-
- switch (param) {
- case GL_COMPRESSED_TEXTURE_FORMATS: {
- GLint * compressedTextureFormats = ctx->getCompressedTextureFormats();
- if (ctx->m_num_compressedTextureFormats > 0 &&
- compressedTextureFormats != NULL) {
- for (int i = 0; i < ctx->m_num_compressedTextureFormats; i++) {
- ptr[i] = (GLfloat) compressedTextureFormats[i];
- }
- }
- break;
- }
-
- case GL_MAX_TEXTURE_UNITS:
- ctx->m_glGetFloatv_enc(self, param, ptr);
- *ptr = MIN(*ptr, (GLfloat)GLClientState::MAX_TEXTURE_UNITS);
- break;
-
- case GL_TEXTURE_BINDING_2D:
- *ptr = (GLfloat)state->getBoundTexture(GL_TEXTURE_2D);
- break;
-
- case GL_TEXTURE_BINDING_EXTERNAL_OES:
- *ptr = (GLfloat)state->getBoundTexture(GL_TEXTURE_EXTERNAL_OES);
- break;
-
- default:
- if (!state->getClientStateParameter<GLfloat>(param,ptr)) {
- ctx->m_glGetFloatv_enc(self, param, ptr);
- }
- break;
- }
-}
-
-void GLEncoder::s_glGetFixedv(void *self, GLenum param, GLfixed *ptr)
-{
- GLEncoder *ctx = (GLEncoder *)self;
- assert(ctx->m_state != NULL);
- GLClientState* state = ctx->m_state;
-
- switch (param) {
- case GL_COMPRESSED_TEXTURE_FORMATS: {
- GLint * compressedTextureFormats = ctx->getCompressedTextureFormats();
- if (ctx->m_num_compressedTextureFormats > 0 &&
- compressedTextureFormats != NULL) {
- for (int i = 0; i < ctx->m_num_compressedTextureFormats; i++) {
- ptr[i] = compressedTextureFormats[i] << 16;
- }
- }
- break;
- }
-
- case GL_MAX_TEXTURE_UNITS:
- ctx->m_glGetFixedv_enc(self, param, ptr);
- *ptr = MIN(*ptr, GLClientState::MAX_TEXTURE_UNITS << 16);
- break;
-
- case GL_TEXTURE_BINDING_2D:
- *ptr = state->getBoundTexture(GL_TEXTURE_2D) << 16;
- break;
-
- case GL_TEXTURE_BINDING_EXTERNAL_OES:
- *ptr = state->getBoundTexture(GL_TEXTURE_EXTERNAL_OES) << 16;
- break;
-
- default:
- if (!state->getClientStateParameter<GLfixed>(param,ptr)) {
- ctx->m_glGetFixedv_enc(self, param, ptr);
- }
- break;
- }
-}
-
-void GLEncoder::s_glGetBooleanv(void *self, GLenum param, GLboolean *ptr)
-{
- GLEncoder *ctx = (GLEncoder *)self;
- assert(ctx->m_state != NULL);
- GLClientState* state = ctx->m_state;
-
- switch (param) {
- case GL_COMPRESSED_TEXTURE_FORMATS: {
- GLint* compressedTextureFormats = ctx->getCompressedTextureFormats();
- if (ctx->m_num_compressedTextureFormats > 0 &&
- compressedTextureFormats != NULL) {
- for (int i = 0; i < ctx->m_num_compressedTextureFormats; i++) {
- ptr[i] = compressedTextureFormats[i] != 0 ? GL_TRUE : GL_FALSE;
- }
- }
- break;
- }
-
- case GL_TEXTURE_BINDING_2D:
- *ptr = state->getBoundTexture(GL_TEXTURE_2D) != 0 ? GL_TRUE : GL_FALSE;
- break;
-
- case GL_TEXTURE_BINDING_EXTERNAL_OES:
- *ptr = state->getBoundTexture(GL_TEXTURE_EXTERNAL_OES) != 0
- ? GL_TRUE : GL_FALSE;
- break;
-
- default:
- if (!state->getClientStateParameter<GLboolean>(param,ptr)) {
- ctx->m_glGetBooleanv_enc(self, param, ptr);
- }
- break;
- }
-}
-
-void GLEncoder::s_glGetPointerv(void * self, GLenum param, GLvoid **params)
-{
- GLEncoder * ctx = (GLEncoder *) self;
- assert(ctx->m_state != NULL);
- ctx->m_state->getClientStatePointer(param,params);
-}
-
-void GLEncoder::s_glFlush(void *self)
-{
- GLEncoder *ctx = (GLEncoder *)self;
- ctx->m_glFlush_enc(self);
- ctx->m_stream->flush();
-}
-
-const GLubyte *GLEncoder::s_glGetString(void *self, GLenum name)
-{
- GLubyte *retval = (GLubyte *) "";
- switch(name) {
- case GL_VENDOR:
- retval = gVendorString;
- break;
- case GL_RENDERER:
- retval = gRendererString;
- break;
- case GL_VERSION:
- retval = gVersionString;
- break;
- case GL_EXTENSIONS:
- retval = gExtensionsString;
- break;
- }
- return retval;
-}
-
-void GLEncoder::s_glPixelStorei(void *self, GLenum param, GLint value)
-{
- GLEncoder *ctx = (GLEncoder *)self;
- ctx->m_glPixelStorei_enc(ctx, param, value);
- ALOG_ASSERT(ctx->m_state, "GLEncoder::s_glPixelStorei");
- ctx->m_state->setPixelStore(param, value);
-}
-
-void GLEncoder::s_glVertexPointer(void *self, int size, GLenum type, GLsizei stride, const void *data)
-{
- GLEncoder *ctx = (GLEncoder *)self;
- assert(ctx->m_state != NULL);
- ctx->m_state->setState(GLClientState::VERTEX_LOCATION, size, type, false, stride, data);
-}
-
-void GLEncoder::s_glNormalPointer(void *self, GLenum type, GLsizei stride, const void *data)
-{
- GLEncoder *ctx = (GLEncoder *)self;
- assert(ctx->m_state != NULL);
- ctx->m_state->setState(GLClientState::NORMAL_LOCATION, 3, type, false, stride, data);
-}
-
-void GLEncoder::s_glColorPointer(void *self, int size, GLenum type, GLsizei stride, const void *data)
-{
- GLEncoder *ctx = (GLEncoder *)self;
- assert(ctx->m_state != NULL);
- ctx->m_state->setState(GLClientState::COLOR_LOCATION, size, type, false, stride, data);
-}
-
-void GLEncoder::s_glPointsizePointer(void *self, GLenum type, GLsizei stride, const void *data)
-{
- GLEncoder *ctx = (GLEncoder *)self;
- assert(ctx->m_state != NULL);
- ctx->m_state->setState(GLClientState::POINTSIZE_LOCATION, 1, type, false, stride, data);
-}
-
-void GLEncoder::s_glClientActiveTexture(void *self, GLenum texture)
-{
- GLEncoder *ctx = (GLEncoder *)self;
- assert(ctx->m_state != NULL);
- ctx->m_state->setActiveTexture(texture - GL_TEXTURE0);
-}
-
-void GLEncoder::s_glTexcoordPointer(void *self, int size, GLenum type, GLsizei stride, const void *data)
-{
- GLEncoder *ctx = (GLEncoder *)self;
- assert(ctx->m_state != NULL);
- int loc = ctx->m_state->getLocation(GL_TEXTURE_COORD_ARRAY);
- ctx->m_state->setState(loc, size, type, false, stride, data);
-}
-
-void GLEncoder::s_glMatrixIndexPointerOES(void *self, int size, GLenum type, GLsizei stride, const void * data)
-{
- GLEncoder *ctx = (GLEncoder *)self;
- assert(ctx->m_state != NULL);
- int loc = ctx->m_state->getLocation(GL_MATRIX_INDEX_ARRAY_OES);
- ctx->m_state->setState(loc, size, type, false, stride, data);
-}
-
-void GLEncoder::s_glWeightPointerOES(void * self, int size, GLenum type, GLsizei stride, const void * data)
-{
- GLEncoder *ctx = (GLEncoder *)self;
- assert(ctx->m_state != NULL);
- int loc = ctx->m_state->getLocation(GL_WEIGHT_ARRAY_OES);
- ctx->m_state->setState(loc, size, type, false, stride, data);
-}
-
-void GLEncoder::s_glEnableClientState(void *self, GLenum state)
-{
- GLEncoder *ctx = (GLEncoder *) self;
- assert(ctx->m_state != NULL);
- int loc = ctx->m_state->getLocation(state);
- ctx->m_state->enable(loc, 1);
-}
-
-void GLEncoder::s_glDisableClientState(void *self, GLenum state)
-{
- GLEncoder *ctx = (GLEncoder *) self;
- assert(ctx->m_state != NULL);
- int loc = ctx->m_state->getLocation(state);
- ctx->m_state->enable(loc, 0);
-}
-
-GLboolean GLEncoder::s_glIsEnabled(void *self, GLenum cap)
-{
- GLEncoder *ctx = (GLEncoder *) self;
- assert(ctx->m_state != NULL);
- int loc = ctx->m_state->getLocation(cap);
- const GLClientState::VertexAttribState *state = ctx->m_state->getState(loc);
-
- if (state!=NULL)
- return state->enabled;
-
- return ctx->m_glIsEnabled_enc(self,cap);
-}
-
-void GLEncoder::s_glBindBuffer(void *self, GLenum target, GLuint id)
-{
- GLEncoder *ctx = (GLEncoder *) self;
- assert(ctx->m_state != NULL);
- ctx->m_state->bindBuffer(target, id);
- // TODO set error state if needed;
- ctx->m_glBindBuffer_enc(self, target, id);
-}
-
-void GLEncoder::s_glBufferData(void * self, GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage)
-{
- GLEncoder *ctx = (GLEncoder *) self;
- GLuint bufferId = ctx->m_state->getBuffer(target);
- SET_ERROR_IF(bufferId==0, GL_INVALID_OPERATION);
- SET_ERROR_IF(size<0, GL_INVALID_VALUE);
-
- ctx->m_shared->updateBufferData(bufferId, size, (void*)data);
- ctx->m_glBufferData_enc(self, target, size, data, usage);
-}
-
-void GLEncoder::s_glBufferSubData(void * self, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data)
-{
- GLEncoder *ctx = (GLEncoder *) self;
- GLuint bufferId = ctx->m_state->getBuffer(target);
- SET_ERROR_IF(bufferId==0, GL_INVALID_OPERATION);
-
- GLenum res = ctx->m_shared->subUpdateBufferData(bufferId, offset, size, (void*)data);
- SET_ERROR_IF(res, res);
-
- ctx->m_glBufferSubData_enc(self, target, offset, size, data);
-}
-
-void GLEncoder::s_glDeleteBuffers(void * self, GLsizei n, const GLuint * buffers)
-{
- GLEncoder *ctx = (GLEncoder *) self;
- SET_ERROR_IF(n<0, GL_INVALID_VALUE);
- for (int i=0; i<n; i++) {
- ctx->m_shared->deleteBufferData(buffers[i]);
- ctx->m_glDeleteBuffers_enc(self,1,&buffers[i]);
- }
-}
-
-void GLEncoder::sendVertexData(unsigned int first, unsigned int count)
-{
- assert(m_state != NULL);
- for (int i = 0; i < GLClientState::LAST_LOCATION; i++) {
- bool enableDirty;
- const GLClientState::VertexAttribState *state = m_state->getStateAndEnableDirty(i, &enableDirty);
-
- // do not process if state not valid
- if (!state) continue;
-
- // do not send disable state if state was already disabled
- if (!enableDirty && !state->enabled) continue;
-
- if ( i >= GLClientState::TEXCOORD0_LOCATION &&
- i <= GLClientState::TEXCOORD7_LOCATION ) {
- m_glClientActiveTexture_enc(this, GL_TEXTURE0 + i - GLClientState::TEXCOORD0_LOCATION);
- }
-
- if (state->enabled) {
-
- if (enableDirty)
- m_glEnableClientState_enc(this, state->glConst);
-
- unsigned int datalen = state->elementSize * count;
- int stride = state->stride;
- if (stride == 0) stride = state->elementSize;
- int firstIndex = stride * first;
-
- if (state->bufferObject == 0) {
-
- switch(i) {
- case GLClientState::VERTEX_LOCATION:
- this->glVertexPointerData(this, state->size, state->type, state->stride,
- (unsigned char *)state->data + firstIndex, datalen);
- break;
- case GLClientState::NORMAL_LOCATION:
- this->glNormalPointerData(this, state->type, state->stride,
- (unsigned char *)state->data + firstIndex, datalen);
- break;
- case GLClientState::COLOR_LOCATION:
- this->glColorPointerData(this, state->size, state->type, state->stride,
- (unsigned char *)state->data + firstIndex, datalen);
- break;
- case GLClientState::TEXCOORD0_LOCATION:
- case GLClientState::TEXCOORD1_LOCATION:
- case GLClientState::TEXCOORD2_LOCATION:
- case GLClientState::TEXCOORD3_LOCATION:
- case GLClientState::TEXCOORD4_LOCATION:
- case GLClientState::TEXCOORD5_LOCATION:
- case GLClientState::TEXCOORD6_LOCATION:
- case GLClientState::TEXCOORD7_LOCATION:
- this->glTexCoordPointerData(this, i - GLClientState::TEXCOORD0_LOCATION, state->size, state->type, state->stride,
- (unsigned char *)state->data + firstIndex, datalen);
- break;
- case GLClientState::POINTSIZE_LOCATION:
- this->glPointSizePointerData(this, state->type, state->stride,
- (unsigned char *) state->data + firstIndex, datalen);
- break;
- case GLClientState::WEIGHT_LOCATION:
- this->glWeightPointerData(this, state->size, state->type, state->stride,
- (unsigned char * ) state->data + firstIndex, datalen);
- break;
- case GLClientState::MATRIXINDEX_LOCATION:
- this->glMatrixIndexPointerData(this, state->size, state->type, state->stride,
- (unsigned char *)state->data + firstIndex, datalen);
- break;
- }
- } else {
- this->m_glBindBuffer_enc(this, GL_ARRAY_BUFFER, state->bufferObject);
-
- switch(i) {
- case GLClientState::VERTEX_LOCATION:
- this->glVertexPointerOffset(this, state->size, state->type, state->stride,
- (GLuint)state->data + firstIndex);
- break;
- case GLClientState::NORMAL_LOCATION:
- this->glNormalPointerOffset(this, state->type, state->stride,
- (GLuint) state->data + firstIndex);
- break;
- case GLClientState::POINTSIZE_LOCATION:
- this->glPointSizePointerOffset(this, state->type, state->stride,
- (GLuint) state->data + firstIndex);
- break;
- case GLClientState::COLOR_LOCATION:
- this->glColorPointerOffset(this, state->size, state->type, state->stride,
- (GLuint) state->data + firstIndex);
- break;
- case GLClientState::TEXCOORD0_LOCATION:
- case GLClientState::TEXCOORD1_LOCATION:
- case GLClientState::TEXCOORD2_LOCATION:
- case GLClientState::TEXCOORD3_LOCATION:
- case GLClientState::TEXCOORD4_LOCATION:
- case GLClientState::TEXCOORD5_LOCATION:
- case GLClientState::TEXCOORD6_LOCATION:
- case GLClientState::TEXCOORD7_LOCATION:
- this->glTexCoordPointerOffset(this, state->size, state->type, state->stride,
- (GLuint) state->data + firstIndex);
- break;
- case GLClientState::WEIGHT_LOCATION:
- this->glWeightPointerOffset(this,state->size,state->type,state->stride,
- (GLuint)state->data+firstIndex);
- break;
- case GLClientState::MATRIXINDEX_LOCATION:
- this->glMatrixIndexPointerOffset(this,state->size,state->type,state->stride,
- (GLuint)state->data+firstIndex);
- break;
- }
- this->m_glBindBuffer_enc(this, GL_ARRAY_BUFFER, m_state->currentArrayVbo());
- }
- } else {
- this->m_glDisableClientState_enc(this, state->glConst);
- }
- }
-}
-
-void GLEncoder::s_glDrawArrays(void *self, GLenum mode, GLint first, GLsizei count)
-{
- GLEncoder *ctx = (GLEncoder *)self;
-
- ctx->sendVertexData(first, count);
- ctx->m_glDrawArrays_enc(ctx, mode, /*first*/ 0, count);
-}
-
-void GLEncoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, const void *indices)
-{
-
- GLEncoder *ctx = (GLEncoder *)self;
- assert(ctx->m_state != NULL);
- SET_ERROR_IF(count<0, GL_INVALID_VALUE);
-
- bool has_immediate_arrays = false;
- bool has_indirect_arrays = false;
-
- for (int i = 0; i < GLClientState::LAST_LOCATION; i++) {
- const GLClientState::VertexAttribState *state = ctx->m_state->getState(i);
- if (state->enabled) {
- if (state->bufferObject != 0) {
- has_indirect_arrays = true;
- } else {
- has_immediate_arrays = true;
- }
- }
- }
-
- if (!has_immediate_arrays && !has_indirect_arrays) {
- ALOGE("glDrawElements: no data bound to the command - ignoring\n");
- return;
- }
-
- bool adjustIndices = true;
- if (ctx->m_state->currentIndexVbo() != 0) {
- if (!has_immediate_arrays) {
- ctx->sendVertexData(0, count);
- ctx->m_glBindBuffer_enc(self, GL_ELEMENT_ARRAY_BUFFER, ctx->m_state->currentIndexVbo());
- ctx->glDrawElementsOffset(ctx, mode, count, type, (GLuint)indices);
- adjustIndices = false;
- } else {
- BufferData * buf = ctx->m_shared->getBufferData(ctx->m_state->currentIndexVbo());
- ctx->m_glBindBuffer_enc(self, GL_ELEMENT_ARRAY_BUFFER, 0);
- indices = (void*)((GLintptr)buf->m_fixedBuffer.ptr() + (GLintptr)indices);
- }
- }
- if (adjustIndices) {
- void *adjustedIndices = (void*)indices;
- int minIndex = 0, maxIndex = 0;
-
- switch(type) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- GLUtils::minmax<unsigned char>((unsigned char *)indices, count, &minIndex, &maxIndex);
- if (minIndex != 0) {
- adjustedIndices = ctx->m_fixedBuffer.alloc(glSizeof(type) * count);
- GLUtils::shiftIndices<unsigned char>((unsigned char *)indices,
- (unsigned char *)adjustedIndices,
- count, -minIndex);
- }
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- GLUtils::minmax<unsigned short>((unsigned short *)indices, count, &minIndex, &maxIndex);
- if (minIndex != 0) {
- adjustedIndices = ctx->m_fixedBuffer.alloc(glSizeof(type) * count);
- GLUtils::shiftIndices<unsigned short>((unsigned short *)indices,
- (unsigned short *)adjustedIndices,
- count, -minIndex);
- }
- break;
- default:
- ALOGE("unsupported index buffer type %d\n", type);
- }
- if (has_indirect_arrays || 1) {
- ctx->sendVertexData(minIndex, maxIndex - minIndex + 1);
- ctx->glDrawElementsData(ctx, mode, count, type, adjustedIndices,
- count * glSizeof(type));
- // XXX - OPTIMIZATION (see the other else branch) should be implemented
- if(!has_indirect_arrays) {
- //ALOGD("unoptimized drawelements !!!\n");
- }
- } else {
- // we are all direct arrays and immidate mode index array -
- // rebuild the arrays and the index array;
- ALOGE("glDrawElements: direct index & direct buffer data - will be implemented in later versions;\n");
- }
- }
-}
-
-void GLEncoder::s_glActiveTexture(void* self, GLenum texture)
-{
- GLEncoder* ctx = (GLEncoder*)self;
- GLClientState* state = ctx->m_state;
- GLenum err;
-
- if ((err = state->setActiveTextureUnit(texture)) != GL_NO_ERROR) {
- ALOGE("%s:%s:%d GL error %#x\n", __FILE__, __FUNCTION__, __LINE__, err);
- ctx->setError(err);
- return;
- }
-
- ctx->m_glActiveTexture_enc(ctx, texture);
-}
-
-void GLEncoder::s_glBindTexture(void* self, GLenum target, GLuint texture)
-{
- GLEncoder* ctx = (GLEncoder*)self;
- GLClientState* state = ctx->m_state;
- GLenum err;
-
- GLboolean firstUse;
- if ((err = state->bindTexture(target, texture, &firstUse)) != GL_NO_ERROR) {
- ALOGE("%s:%s:%d GL error %#x\n", __FILE__, __FUNCTION__, __LINE__, err);
- ctx->setError(err);
- return;
- }
-
- if (target != GL_TEXTURE_2D && target != GL_TEXTURE_EXTERNAL_OES) {
- ctx->m_glBindTexture_enc(ctx, target, texture);
- return;
- }
-
- GLenum priorityTarget = state->getPriorityEnabledTarget(GL_TEXTURE_2D);
-
- if (target == GL_TEXTURE_EXTERNAL_OES && firstUse) {
- // set TEXTURE_EXTERNAL_OES default states which differ from TEXTURE_2D
- ctx->m_glBindTexture_enc(ctx, GL_TEXTURE_2D, texture);
- ctx->m_glTexParameteri_enc(ctx, GL_TEXTURE_2D,
- GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- ctx->m_glTexParameteri_enc(ctx, GL_TEXTURE_2D,
- GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- ctx->m_glTexParameteri_enc(ctx, GL_TEXTURE_2D,
- GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- if (target != priorityTarget) {
- ctx->m_glBindTexture_enc(ctx, GL_TEXTURE_2D,
- state->getBoundTexture(GL_TEXTURE_2D));
- }
- }
-
- if (target == priorityTarget) {
- ctx->m_glBindTexture_enc(ctx, GL_TEXTURE_2D, texture);
- }
-}
-
-void GLEncoder::s_glDeleteTextures(void* self, GLsizei n, const GLuint* textures)
-{
- GLEncoder* ctx = (GLEncoder*)self;
- GLClientState* state = ctx->m_state;
-
- state->deleteTextures(n, textures);
- ctx->m_glDeleteTextures_enc(ctx, n, textures);
-}
-
-void GLEncoder::s_glDisable(void* self, GLenum cap)
-{
- GLEncoder* ctx = (GLEncoder*)self;
- GLClientState* state = ctx->m_state;
-
- if (cap == GL_TEXTURE_2D || cap == GL_TEXTURE_EXTERNAL_OES) {
- GLenum prevTarget = state->getPriorityEnabledTarget(GL_INVALID_ENUM);
- state->disableTextureTarget(cap);
- GLenum currTarget = state->getPriorityEnabledTarget(GL_INVALID_ENUM);
-
- if (prevTarget != currTarget) {
- if (currTarget == GL_INVALID_ENUM) {
- ctx->m_glDisable_enc(ctx, GL_TEXTURE_2D);
- currTarget = GL_TEXTURE_2D;
- }
- // maintain the invariant that when TEXTURE_EXTERNAL_OES is
- // disabled, the TEXTURE_2D binding is active, even if
- // TEXTURE_2D is also disabled.
- ctx->m_glBindTexture_enc(ctx, GL_TEXTURE_2D,
- state->getBoundTexture(currTarget));
- }
-
- } else {
- ctx->m_glDisable_enc(ctx, cap);
- }
-}
-
-void GLEncoder::s_glEnable(void* self, GLenum cap)
-{
- GLEncoder* ctx = (GLEncoder*)self;
- GLClientState* state = ctx->m_state;
-
- if (cap == GL_TEXTURE_2D || cap == GL_TEXTURE_EXTERNAL_OES) {
- GLenum prevTarget = state->getPriorityEnabledTarget(GL_INVALID_ENUM);
- state->enableTextureTarget(cap);
- GLenum currTarget = state->getPriorityEnabledTarget(GL_INVALID_ENUM);
-
- if (prevTarget != currTarget) {
- if (prevTarget == GL_INVALID_ENUM) {
- ctx->m_glEnable_enc(ctx, GL_TEXTURE_2D);
- }
- if (currTarget == GL_TEXTURE_EXTERNAL_OES) {
- ctx->m_glBindTexture_enc(ctx, GL_TEXTURE_2D,
- state->getBoundTexture(currTarget));
- }
- }
-
- } else {
- ctx->m_glEnable_enc(ctx, cap);
- }
-}
-
-void GLEncoder::s_glGetTexParameterfv(void* self,
- GLenum target, GLenum pname, GLfloat* params)
-{
- GLEncoder* ctx = (GLEncoder*)self;
- const GLClientState* state = ctx->m_state;
-
- if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) {
- ctx->override2DTextureTarget(target);
- ctx->m_glGetTexParameterfv_enc(ctx, GL_TEXTURE_2D, pname, params);
- ctx->restore2DTextureTarget();
- } else {
- ctx->m_glGetTexParameterfv_enc(ctx, target, pname, params);
- }
-}
-
-void GLEncoder::s_glGetTexParameteriv(void* self,
- GLenum target, GLenum pname, GLint* params)
-{
- GLEncoder* ctx = (GLEncoder*)self;
- const GLClientState* state = ctx->m_state;
-
- switch (pname) {
- case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
- *params = 1;
- break;
-
- default:
- if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) {
- ctx->override2DTextureTarget(target);
- ctx->m_glGetTexParameteriv_enc(ctx, GL_TEXTURE_2D, pname, params);
- ctx->restore2DTextureTarget();
- } else {
- ctx->m_glGetTexParameteriv_enc(ctx, target, pname, params);
- }
- break;
- }
-}
-
-void GLEncoder::s_glGetTexParameterxv(void* self,
- GLenum target, GLenum pname, GLfixed* params)
-{
- GLEncoder* ctx = (GLEncoder*)self;
- const GLClientState* state = ctx->m_state;
-
- if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) {
- ctx->override2DTextureTarget(target);
- ctx->m_glGetTexParameterxv_enc(ctx, GL_TEXTURE_2D, pname, params);
- ctx->restore2DTextureTarget();
- } else {
- ctx->m_glGetTexParameterxv_enc(ctx, target, pname, params);
- }
-}
-
-static bool isValidTextureExternalParam(GLenum pname, GLenum param)
-{
- switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- return param == GL_NEAREST || param == GL_LINEAR;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- return param == GL_CLAMP_TO_EDGE;
-
- case GL_GENERATE_MIPMAP:
- return param == GL_FALSE;
-
- default:
- return true;
- }
-}
-
-void GLEncoder::s_glTexParameterf(void* self,
- GLenum target, GLenum pname, GLfloat param)
-{
- GLEncoder* ctx = (GLEncoder*)self;
- const GLClientState* state = ctx->m_state;
-
- SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES &&
- !isValidTextureExternalParam(pname, (GLenum)param)),
- GL_INVALID_ENUM);
-
- if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) {
- ctx->override2DTextureTarget(target);
- ctx->m_glTexParameterf_enc(ctx, GL_TEXTURE_2D, pname, param);
- ctx->restore2DTextureTarget();
- } else {
- ctx->m_glTexParameterf_enc(ctx, target, pname, param);
- }
-}
-
-void GLEncoder::s_glTexParameterfv(void* self,
- GLenum target, GLenum pname, const GLfloat* params)
-{
- GLEncoder* ctx = (GLEncoder*)self;
- const GLClientState* state = ctx->m_state;
-
- SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES &&
- !isValidTextureExternalParam(pname, (GLenum)params[0])),
- GL_INVALID_ENUM);
-
- if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) {
- ctx->override2DTextureTarget(target);
- ctx->m_glTexParameterfv_enc(ctx, GL_TEXTURE_2D, pname, params);
- ctx->restore2DTextureTarget();
- } else {
- ctx->m_glTexParameterfv_enc(ctx, target, pname, params);
- }
-}
-
-void GLEncoder::s_glTexParameteri(void* self,
- GLenum target, GLenum pname, GLint param)
-{
- GLEncoder* ctx = (GLEncoder*)self;
- const GLClientState* state = ctx->m_state;
-
- SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES &&
- !isValidTextureExternalParam(pname, (GLenum)param)),
- GL_INVALID_ENUM);
-
- if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) {
- ctx->override2DTextureTarget(target);
- ctx->m_glTexParameteri_enc(ctx, GL_TEXTURE_2D, pname, param);
- ctx->restore2DTextureTarget();
- } else {
- ctx->m_glTexParameteri_enc(ctx, target, pname, param);
- }
-}
-
-void GLEncoder::s_glTexParameterx(void* self,
- GLenum target, GLenum pname, GLfixed param)
-{
- GLEncoder* ctx = (GLEncoder*)self;
- const GLClientState* state = ctx->m_state;
-
- SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES &&
- !isValidTextureExternalParam(pname, (GLenum)param)),
- GL_INVALID_ENUM);
-
- if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) {
- ctx->override2DTextureTarget(target);
- ctx->m_glTexParameterx_enc(ctx, GL_TEXTURE_2D, pname, param);
- ctx->restore2DTextureTarget();
- } else {
- ctx->m_glTexParameterx_enc(ctx, target, pname, param);
- }
-}
-
-void GLEncoder::s_glTexParameteriv(void* self,
- GLenum target, GLenum pname, const GLint* params)
-{
- GLEncoder* ctx = (GLEncoder*)self;
- const GLClientState* state = ctx->m_state;
-
- SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES &&
- !isValidTextureExternalParam(pname, (GLenum)params[0])),
- GL_INVALID_ENUM);
-
- if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) {
- ctx->override2DTextureTarget(target);
- ctx->m_glTexParameteriv_enc(ctx, GL_TEXTURE_2D, pname, params);
- ctx->restore2DTextureTarget();
- } else {
- ctx->m_glTexParameteriv_enc(ctx, target, pname, params);
- }
-}
-
-void GLEncoder::s_glTexParameterxv(void* self,
- GLenum target, GLenum pname, const GLfixed* params)
-{
- GLEncoder* ctx = (GLEncoder*)self;
- const GLClientState* state = ctx->m_state;
-
- SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES &&
- !isValidTextureExternalParam(pname, (GLenum)params[0])),
- GL_INVALID_ENUM);
-
- if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) {
- ctx->override2DTextureTarget(target);
- ctx->m_glTexParameterxv_enc(ctx, GL_TEXTURE_2D, pname, params);
- ctx->restore2DTextureTarget();
- } else {
- ctx->m_glTexParameterxv_enc(ctx, target, pname, params);
- }
-}
-
-void GLEncoder::override2DTextureTarget(GLenum target)
-{
- if ((target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) &&
- target != m_state->getPriorityEnabledTarget(GL_TEXTURE_2D)) {
- m_glBindTexture_enc(this, GL_TEXTURE_2D,
- m_state->getBoundTexture(target));
- }
-}
-
-void GLEncoder::restore2DTextureTarget()
-{
- GLenum priorityTarget = m_state->getPriorityEnabledTarget(GL_TEXTURE_2D);
- m_glBindTexture_enc(this, GL_TEXTURE_2D,
- m_state->getBoundTexture(priorityTarget));
-}
-
-GLEncoder::GLEncoder(IOStream *stream) : gl_encoder_context_t(stream)
-{
- m_initialized = false;
- m_state = NULL;
- m_error = GL_NO_ERROR;
- m_num_compressedTextureFormats = 0;
- m_compressedTextureFormats = NULL;
- // overrides;
- m_glFlush_enc = set_glFlush(s_glFlush);
- m_glPixelStorei_enc = set_glPixelStorei(s_glPixelStorei);
- m_glVertexPointer_enc = set_glVertexPointer(s_glVertexPointer);
- m_glNormalPointer_enc = set_glNormalPointer(s_glNormalPointer);
- m_glColorPointer_enc = set_glColorPointer(s_glColorPointer);
- m_glPointSizePointerOES_enc = set_glPointSizePointerOES(s_glPointsizePointer);
- m_glClientActiveTexture_enc = set_glClientActiveTexture(s_glClientActiveTexture);
- m_glTexCoordPointer_enc = set_glTexCoordPointer(s_glTexcoordPointer);
- m_glMatrixIndexPointerOES_enc = set_glMatrixIndexPointerOES(s_glMatrixIndexPointerOES);
- m_glWeightPointerOES_enc = set_glWeightPointerOES(s_glWeightPointerOES);
-
- m_glGetIntegerv_enc = set_glGetIntegerv(s_glGetIntegerv);
- m_glGetFloatv_enc = set_glGetFloatv(s_glGetFloatv);
- m_glGetBooleanv_enc = set_glGetBooleanv(s_glGetBooleanv);
- m_glGetFixedv_enc = set_glGetFixedv(s_glGetFixedv);
- m_glGetPointerv_enc = set_glGetPointerv(s_glGetPointerv);
-
- m_glBindBuffer_enc = set_glBindBuffer(s_glBindBuffer);
- m_glBufferData_enc = set_glBufferData(s_glBufferData);
- m_glBufferSubData_enc = set_glBufferSubData(s_glBufferSubData);
- m_glDeleteBuffers_enc = set_glDeleteBuffers(s_glDeleteBuffers);
-
- m_glEnableClientState_enc = set_glEnableClientState(s_glEnableClientState);
- m_glDisableClientState_enc = set_glDisableClientState(s_glDisableClientState);
- m_glIsEnabled_enc = set_glIsEnabled(s_glIsEnabled);
- m_glDrawArrays_enc = set_glDrawArrays(s_glDrawArrays);
- m_glDrawElements_enc = set_glDrawElements(s_glDrawElements);
- set_glGetString(s_glGetString);
- set_glFinish(s_glFinish);
- m_glGetError_enc = set_glGetError(s_glGetError);
-
- m_glActiveTexture_enc = set_glActiveTexture(s_glActiveTexture);
- m_glBindTexture_enc = set_glBindTexture(s_glBindTexture);
- m_glDeleteTextures_enc = set_glDeleteTextures(s_glDeleteTextures);
- m_glDisable_enc = set_glDisable(s_glDisable);
- m_glEnable_enc = set_glEnable(s_glEnable);
- m_glGetTexParameterfv_enc = set_glGetTexParameterfv(s_glGetTexParameterfv);
- m_glGetTexParameteriv_enc = set_glGetTexParameteriv(s_glGetTexParameteriv);
- m_glGetTexParameterxv_enc = set_glGetTexParameterxv(s_glGetTexParameterxv);
- m_glTexParameterf_enc = set_glTexParameterf(s_glTexParameterf);
- m_glTexParameterfv_enc = set_glTexParameterfv(s_glTexParameterfv);
- m_glTexParameteri_enc = set_glTexParameteri(s_glTexParameteri);
- m_glTexParameterx_enc = set_glTexParameterx(s_glTexParameterx);
- m_glTexParameteriv_enc = set_glTexParameteriv(s_glTexParameteriv);
- m_glTexParameterxv_enc = set_glTexParameterxv(s_glTexParameterxv);
-}
-
-GLEncoder::~GLEncoder()
-{
- delete [] m_compressedTextureFormats;
-}
-
-size_t GLEncoder::pixelDataSize(GLsizei width, GLsizei height, GLenum format, GLenum type, int pack)
-{
- assert(m_state != NULL);
- return m_state->pixelDataSize(width, height, format, type, pack);
-}
-
-void GLEncoder::s_glFinish(void *self)
-{
- GLEncoder *ctx = (GLEncoder *)self;
- ctx->glFinishRoundTrip(self);
-}
diff --git a/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.h b/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.h
deleted file mode 100644
index effc53fe7..000000000
--- a/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.h
+++ /dev/null
@@ -1,149 +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.
-*/
-#ifndef _GL_ENCODER_H_
-#define _GL_ENCODER_H_
-
-#include "gl_enc.h"
-#include "GLClientState.h"
-#include "GLSharedGroup.h"
-#include "FixedBuffer.h"
-
-class GLEncoder : public gl_encoder_context_t {
-
-public:
- GLEncoder(IOStream *stream);
- virtual ~GLEncoder();
- void setClientState(GLClientState *state) {
- m_state = state;
- }
- void setSharedGroup(GLSharedGroupPtr shared) { m_shared = shared; }
- void flush() { m_stream->flush(); }
- size_t pixelDataSize(GLsizei width, GLsizei height, GLenum format, GLenum type, int pack);
-
- void setInitialized(){ m_initialized = true; };
- bool isInitialized(){ return m_initialized; };
-
- virtual void setError(GLenum error){ m_error = error; };
- virtual GLenum getError() { return m_error; };
-
- void override2DTextureTarget(GLenum target);
- void restore2DTextureTarget();
-
-private:
-
- bool m_initialized;
- GLClientState *m_state;
- GLSharedGroupPtr m_shared;
- GLenum m_error;
- FixedBuffer m_fixedBuffer;
- GLint *m_compressedTextureFormats;
- GLint m_num_compressedTextureFormats;
-
- GLint *getCompressedTextureFormats();
- // original functions;
- glGetError_client_proc_t m_glGetError_enc;
- glGetIntegerv_client_proc_t m_glGetIntegerv_enc;
- glGetFloatv_client_proc_t m_glGetFloatv_enc;
- glGetFixedv_client_proc_t m_glGetFixedv_enc;
- glGetBooleanv_client_proc_t m_glGetBooleanv_enc;
- glGetPointerv_client_proc_t m_glGetPointerv_enc;
-
- glPixelStorei_client_proc_t m_glPixelStorei_enc;
- glVertexPointer_client_proc_t m_glVertexPointer_enc;
- glNormalPointer_client_proc_t m_glNormalPointer_enc;
- glColorPointer_client_proc_t m_glColorPointer_enc;
- glPointSizePointerOES_client_proc_t m_glPointSizePointerOES_enc;
- glTexCoordPointer_client_proc_t m_glTexCoordPointer_enc;
- glClientActiveTexture_client_proc_t m_glClientActiveTexture_enc;
- glMatrixIndexPointerOES_client_proc_t m_glMatrixIndexPointerOES_enc;
- glWeightPointerOES_client_proc_t m_glWeightPointerOES_enc;
-
- glBindBuffer_client_proc_t m_glBindBuffer_enc;
- glBufferData_client_proc_t m_glBufferData_enc;
- glBufferSubData_client_proc_t m_glBufferSubData_enc;
- glDeleteBuffers_client_proc_t m_glDeleteBuffers_enc;
-
- glEnableClientState_client_proc_t m_glEnableClientState_enc;
- glDisableClientState_client_proc_t m_glDisableClientState_enc;
- glIsEnabled_client_proc_t m_glIsEnabled_enc;
- glDrawArrays_client_proc_t m_glDrawArrays_enc;
- glDrawElements_client_proc_t m_glDrawElements_enc;
- glFlush_client_proc_t m_glFlush_enc;
-
- glActiveTexture_client_proc_t m_glActiveTexture_enc;
- glBindTexture_client_proc_t m_glBindTexture_enc;
- glDeleteTextures_client_proc_t m_glDeleteTextures_enc;
- glDisable_client_proc_t m_glDisable_enc;
- glEnable_client_proc_t m_glEnable_enc;
- glGetTexParameterfv_client_proc_t m_glGetTexParameterfv_enc;
- glGetTexParameteriv_client_proc_t m_glGetTexParameteriv_enc;
- glGetTexParameterxv_client_proc_t m_glGetTexParameterxv_enc;
- glTexParameterf_client_proc_t m_glTexParameterf_enc;
- glTexParameterfv_client_proc_t m_glTexParameterfv_enc;
- glTexParameteri_client_proc_t m_glTexParameteri_enc;
- glTexParameterx_client_proc_t m_glTexParameterx_enc;
- glTexParameteriv_client_proc_t m_glTexParameteriv_enc;
- glTexParameterxv_client_proc_t m_glTexParameterxv_enc;
-
- // statics
- static GLenum s_glGetError(void * self);
- static void s_glGetIntegerv(void *self, GLenum pname, GLint *ptr);
- static void s_glGetBooleanv(void *self, GLenum pname, GLboolean *ptr);
- static void s_glGetFloatv(void *self, GLenum pname, GLfloat *ptr);
- static void s_glGetFixedv(void *self, GLenum pname, GLfixed *ptr);
- static void s_glGetPointerv(void *self, GLenum pname, GLvoid **params);
-
- static void s_glFlush(void * self);
- static const GLubyte * s_glGetString(void *self, GLenum name);
- static void s_glVertexPointer(void *self, int size, GLenum type, GLsizei stride, const void *data);
- static void s_glNormalPointer(void *self, GLenum type, GLsizei stride, const void *data);
- static void s_glColorPointer(void *self, int size, GLenum type, GLsizei stride, const void *data);
- static void s_glPointsizePointer(void *self, GLenum type, GLsizei stride, const void *data);
- static void s_glClientActiveTexture(void *self, GLenum texture);
- static void s_glTexcoordPointer(void *self, int size, GLenum type, GLsizei stride, const void *data);
- static void s_glMatrixIndexPointerOES(void *self, int size, GLenum type, GLsizei stride, const void * data);
- static void s_glWeightPointerOES(void *self, int size, GLenum type, GLsizei stride, const void * data);
- static void s_glDisableClientState(void *self, GLenum state);
- static void s_glEnableClientState(void *self, GLenum state);
- static GLboolean s_glIsEnabled(void *self, GLenum cap);
- static void s_glBindBuffer(void *self, GLenum target, GLuint id);
- static void s_glBufferData(void *self, GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage);
- static void s_glBufferSubData(void *self, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data);
- static void s_glDeleteBuffers(void *self, GLsizei n, const GLuint * buffers);
-
- static void s_glDrawArrays(void *self, GLenum mode, GLint first, GLsizei count);
- static void s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, const void *indices);
- static void s_glPixelStorei(void *self, GLenum param, GLint value);
-
- static void s_glFinish(void *self);
- void sendVertexData(unsigned first, unsigned count);
-
- static void s_glActiveTexture(void* self, GLenum texture);
- static void s_glBindTexture(void* self, GLenum target, GLuint texture);
- static void s_glDeleteTextures(void* self, GLsizei n, const GLuint* textures);
- static void s_glDisable(void* self, GLenum cap);
- static void s_glEnable(void* self, GLenum cap);
- static void s_glGetTexParameterfv(void* self, GLenum target, GLenum pname, GLfloat* params);
- static void s_glGetTexParameteriv(void* self, GLenum target, GLenum pname, GLint* params);
- static void s_glGetTexParameterxv(void* self, GLenum target, GLenum pname, GLfixed* params);
- static void s_glTexParameterf(void* self, GLenum target, GLenum pname, GLfloat param);
- static void s_glTexParameterfv(void* self, GLenum target, GLenum pname, const GLfloat* params);
- static void s_glTexParameteri(void* self, GLenum target, GLenum pname, GLint param);
- static void s_glTexParameterx(void* self, GLenum target, GLenum pname, GLfixed param);
- static void s_glTexParameteriv(void* self, GLenum target, GLenum pname, const GLint* params);
- static void s_glTexParameterxv(void* self, GLenum target, GLenum pname, const GLfixed* params);
-};
-#endif
diff --git a/tools/emulator/opengl/system/GLESv1_enc/GLEncoderUtils.cpp b/tools/emulator/opengl/system/GLESv1_enc/GLEncoderUtils.cpp
deleted file mode 100644
index 7866d5398..000000000
--- a/tools/emulator/opengl/system/GLESv1_enc/GLEncoderUtils.cpp
+++ /dev/null
@@ -1,24 +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.
-*/
-#include <stdio.h>
-#include <stdlib.h>
-#include "GLEncoder.h"
-
-size_t pixelDataSize(void *self, GLsizei width, GLsizei height, GLenum format, GLenum type, int pack)
-{
- GLEncoder *ctx = (GLEncoder *)self;
- return ctx->pixelDataSize(width, height, format, type, pack);
-}
diff --git a/tools/emulator/opengl/system/GLESv1_enc/GLEncoderUtils.h b/tools/emulator/opengl/system/GLESv1_enc/GLEncoderUtils.h
deleted file mode 100644
index 1d0c847a4..000000000
--- a/tools/emulator/opengl/system/GLESv1_enc/GLEncoderUtils.h
+++ /dev/null
@@ -1,22 +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.
-*/
-#ifndef GL_ENCODER_UTILS_H
-#define GL_ENCLODER_UTILS_H
-
-extern "C" {
- size_t pixelDataSize(void *self, GLsizei width, GLsizei height, GLenum format, GLenum type, int pack);
-};
-#endif
diff --git a/tools/emulator/opengl/system/GLESv1_enc/gl_client_context.cpp b/tools/emulator/opengl/system/GLESv1_enc/gl_client_context.cpp
deleted file mode 100644
index a5fd04baa..000000000
--- a/tools/emulator/opengl/system/GLESv1_enc/gl_client_context.cpp
+++ /dev/null
@@ -1,308 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-
-
-#include <string.h>
-#include "gl_client_context.h"
-
-
-#include <stdio.h>
-
-int gl_client_context_t::initDispatchByName(void *(*getProc)(const char *, void *userData), void *userData)
-{
- void *ptr;
-
- ptr = getProc("glAlphaFunc", userData); set_glAlphaFunc((glAlphaFunc_client_proc_t)ptr);
- ptr = getProc("glClearColor", userData); set_glClearColor((glClearColor_client_proc_t)ptr);
- ptr = getProc("glClearDepthf", userData); set_glClearDepthf((glClearDepthf_client_proc_t)ptr);
- ptr = getProc("glClipPlanef", userData); set_glClipPlanef((glClipPlanef_client_proc_t)ptr);
- ptr = getProc("glColor4f", userData); set_glColor4f((glColor4f_client_proc_t)ptr);
- ptr = getProc("glDepthRangef", userData); set_glDepthRangef((glDepthRangef_client_proc_t)ptr);
- ptr = getProc("glFogf", userData); set_glFogf((glFogf_client_proc_t)ptr);
- ptr = getProc("glFogfv", userData); set_glFogfv((glFogfv_client_proc_t)ptr);
- ptr = getProc("glFrustumf", userData); set_glFrustumf((glFrustumf_client_proc_t)ptr);
- ptr = getProc("glGetClipPlanef", userData); set_glGetClipPlanef((glGetClipPlanef_client_proc_t)ptr);
- ptr = getProc("glGetFloatv", userData); set_glGetFloatv((glGetFloatv_client_proc_t)ptr);
- ptr = getProc("glGetLightfv", userData); set_glGetLightfv((glGetLightfv_client_proc_t)ptr);
- ptr = getProc("glGetMaterialfv", userData); set_glGetMaterialfv((glGetMaterialfv_client_proc_t)ptr);
- ptr = getProc("glGetTexEnvfv", userData); set_glGetTexEnvfv((glGetTexEnvfv_client_proc_t)ptr);
- ptr = getProc("glGetTexParameterfv", userData); set_glGetTexParameterfv((glGetTexParameterfv_client_proc_t)ptr);
- ptr = getProc("glLightModelf", userData); set_glLightModelf((glLightModelf_client_proc_t)ptr);
- ptr = getProc("glLightModelfv", userData); set_glLightModelfv((glLightModelfv_client_proc_t)ptr);
- ptr = getProc("glLightf", userData); set_glLightf((glLightf_client_proc_t)ptr);
- ptr = getProc("glLightfv", userData); set_glLightfv((glLightfv_client_proc_t)ptr);
- ptr = getProc("glLineWidth", userData); set_glLineWidth((glLineWidth_client_proc_t)ptr);
- ptr = getProc("glLoadMatrixf", userData); set_glLoadMatrixf((glLoadMatrixf_client_proc_t)ptr);
- ptr = getProc("glMaterialf", userData); set_glMaterialf((glMaterialf_client_proc_t)ptr);
- ptr = getProc("glMaterialfv", userData); set_glMaterialfv((glMaterialfv_client_proc_t)ptr);
- ptr = getProc("glMultMatrixf", userData); set_glMultMatrixf((glMultMatrixf_client_proc_t)ptr);
- ptr = getProc("glMultiTexCoord4f", userData); set_glMultiTexCoord4f((glMultiTexCoord4f_client_proc_t)ptr);
- ptr = getProc("glNormal3f", userData); set_glNormal3f((glNormal3f_client_proc_t)ptr);
- ptr = getProc("glOrthof", userData); set_glOrthof((glOrthof_client_proc_t)ptr);
- ptr = getProc("glPointParameterf", userData); set_glPointParameterf((glPointParameterf_client_proc_t)ptr);
- ptr = getProc("glPointParameterfv", userData); set_glPointParameterfv((glPointParameterfv_client_proc_t)ptr);
- ptr = getProc("glPointSize", userData); set_glPointSize((glPointSize_client_proc_t)ptr);
- ptr = getProc("glPolygonOffset", userData); set_glPolygonOffset((glPolygonOffset_client_proc_t)ptr);
- ptr = getProc("glRotatef", userData); set_glRotatef((glRotatef_client_proc_t)ptr);
- ptr = getProc("glScalef", userData); set_glScalef((glScalef_client_proc_t)ptr);
- ptr = getProc("glTexEnvf", userData); set_glTexEnvf((glTexEnvf_client_proc_t)ptr);
- ptr = getProc("glTexEnvfv", userData); set_glTexEnvfv((glTexEnvfv_client_proc_t)ptr);
- ptr = getProc("glTexParameterf", userData); set_glTexParameterf((glTexParameterf_client_proc_t)ptr);
- ptr = getProc("glTexParameterfv", userData); set_glTexParameterfv((glTexParameterfv_client_proc_t)ptr);
- ptr = getProc("glTranslatef", userData); set_glTranslatef((glTranslatef_client_proc_t)ptr);
- ptr = getProc("glActiveTexture", userData); set_glActiveTexture((glActiveTexture_client_proc_t)ptr);
- ptr = getProc("glAlphaFuncx", userData); set_glAlphaFuncx((glAlphaFuncx_client_proc_t)ptr);
- ptr = getProc("glBindBuffer", userData); set_glBindBuffer((glBindBuffer_client_proc_t)ptr);
- ptr = getProc("glBindTexture", userData); set_glBindTexture((glBindTexture_client_proc_t)ptr);
- ptr = getProc("glBlendFunc", userData); set_glBlendFunc((glBlendFunc_client_proc_t)ptr);
- ptr = getProc("glBufferData", userData); set_glBufferData((glBufferData_client_proc_t)ptr);
- ptr = getProc("glBufferSubData", userData); set_glBufferSubData((glBufferSubData_client_proc_t)ptr);
- ptr = getProc("glClear", userData); set_glClear((glClear_client_proc_t)ptr);
- ptr = getProc("glClearColorx", userData); set_glClearColorx((glClearColorx_client_proc_t)ptr);
- ptr = getProc("glClearDepthx", userData); set_glClearDepthx((glClearDepthx_client_proc_t)ptr);
- ptr = getProc("glClearStencil", userData); set_glClearStencil((glClearStencil_client_proc_t)ptr);
- ptr = getProc("glClientActiveTexture", userData); set_glClientActiveTexture((glClientActiveTexture_client_proc_t)ptr);
- ptr = getProc("glColor4ub", userData); set_glColor4ub((glColor4ub_client_proc_t)ptr);
- ptr = getProc("glColor4x", userData); set_glColor4x((glColor4x_client_proc_t)ptr);
- ptr = getProc("glColorMask", userData); set_glColorMask((glColorMask_client_proc_t)ptr);
- ptr = getProc("glColorPointer", userData); set_glColorPointer((glColorPointer_client_proc_t)ptr);
- ptr = getProc("glCompressedTexImage2D", userData); set_glCompressedTexImage2D((glCompressedTexImage2D_client_proc_t)ptr);
- ptr = getProc("glCompressedTexSubImage2D", userData); set_glCompressedTexSubImage2D((glCompressedTexSubImage2D_client_proc_t)ptr);
- ptr = getProc("glCopyTexImage2D", userData); set_glCopyTexImage2D((glCopyTexImage2D_client_proc_t)ptr);
- ptr = getProc("glCopyTexSubImage2D", userData); set_glCopyTexSubImage2D((glCopyTexSubImage2D_client_proc_t)ptr);
- ptr = getProc("glCullFace", userData); set_glCullFace((glCullFace_client_proc_t)ptr);
- ptr = getProc("glDeleteBuffers", userData); set_glDeleteBuffers((glDeleteBuffers_client_proc_t)ptr);
- ptr = getProc("glDeleteTextures", userData); set_glDeleteTextures((glDeleteTextures_client_proc_t)ptr);
- ptr = getProc("glDepthFunc", userData); set_glDepthFunc((glDepthFunc_client_proc_t)ptr);
- ptr = getProc("glDepthMask", userData); set_glDepthMask((glDepthMask_client_proc_t)ptr);
- ptr = getProc("glDepthRangex", userData); set_glDepthRangex((glDepthRangex_client_proc_t)ptr);
- ptr = getProc("glDisable", userData); set_glDisable((glDisable_client_proc_t)ptr);
- ptr = getProc("glDisableClientState", userData); set_glDisableClientState((glDisableClientState_client_proc_t)ptr);
- ptr = getProc("glDrawArrays", userData); set_glDrawArrays((glDrawArrays_client_proc_t)ptr);
- ptr = getProc("glDrawElements", userData); set_glDrawElements((glDrawElements_client_proc_t)ptr);
- ptr = getProc("glEnable", userData); set_glEnable((glEnable_client_proc_t)ptr);
- ptr = getProc("glEnableClientState", userData); set_glEnableClientState((glEnableClientState_client_proc_t)ptr);
- ptr = getProc("glFinish", userData); set_glFinish((glFinish_client_proc_t)ptr);
- ptr = getProc("glFlush", userData); set_glFlush((glFlush_client_proc_t)ptr);
- ptr = getProc("glFogx", userData); set_glFogx((glFogx_client_proc_t)ptr);
- ptr = getProc("glFogxv", userData); set_glFogxv((glFogxv_client_proc_t)ptr);
- ptr = getProc("glFrontFace", userData); set_glFrontFace((glFrontFace_client_proc_t)ptr);
- ptr = getProc("glFrustumx", userData); set_glFrustumx((glFrustumx_client_proc_t)ptr);
- ptr = getProc("glGetBooleanv", userData); set_glGetBooleanv((glGetBooleanv_client_proc_t)ptr);
- ptr = getProc("glGetBufferParameteriv", userData); set_glGetBufferParameteriv((glGetBufferParameteriv_client_proc_t)ptr);
- ptr = getProc("glClipPlanex", userData); set_glClipPlanex((glClipPlanex_client_proc_t)ptr);
- ptr = getProc("glGenBuffers", userData); set_glGenBuffers((glGenBuffers_client_proc_t)ptr);
- ptr = getProc("glGenTextures", userData); set_glGenTextures((glGenTextures_client_proc_t)ptr);
- ptr = getProc("glGetError", userData); set_glGetError((glGetError_client_proc_t)ptr);
- ptr = getProc("glGetFixedv", userData); set_glGetFixedv((glGetFixedv_client_proc_t)ptr);
- ptr = getProc("glGetIntegerv", userData); set_glGetIntegerv((glGetIntegerv_client_proc_t)ptr);
- ptr = getProc("glGetLightxv", userData); set_glGetLightxv((glGetLightxv_client_proc_t)ptr);
- ptr = getProc("glGetMaterialxv", userData); set_glGetMaterialxv((glGetMaterialxv_client_proc_t)ptr);
- ptr = getProc("glGetPointerv", userData); set_glGetPointerv((glGetPointerv_client_proc_t)ptr);
- ptr = getProc("glGetString", userData); set_glGetString((glGetString_client_proc_t)ptr);
- ptr = getProc("glGetTexEnviv", userData); set_glGetTexEnviv((glGetTexEnviv_client_proc_t)ptr);
- ptr = getProc("glGetTexEnvxv", userData); set_glGetTexEnvxv((glGetTexEnvxv_client_proc_t)ptr);
- ptr = getProc("glGetTexParameteriv", userData); set_glGetTexParameteriv((glGetTexParameteriv_client_proc_t)ptr);
- ptr = getProc("glGetTexParameterxv", userData); set_glGetTexParameterxv((glGetTexParameterxv_client_proc_t)ptr);
- ptr = getProc("glHint", userData); set_glHint((glHint_client_proc_t)ptr);
- ptr = getProc("glIsBuffer", userData); set_glIsBuffer((glIsBuffer_client_proc_t)ptr);
- ptr = getProc("glIsEnabled", userData); set_glIsEnabled((glIsEnabled_client_proc_t)ptr);
- ptr = getProc("glIsTexture", userData); set_glIsTexture((glIsTexture_client_proc_t)ptr);
- ptr = getProc("glLightModelx", userData); set_glLightModelx((glLightModelx_client_proc_t)ptr);
- ptr = getProc("glLightModelxv", userData); set_glLightModelxv((glLightModelxv_client_proc_t)ptr);
- ptr = getProc("glLightx", userData); set_glLightx((glLightx_client_proc_t)ptr);
- ptr = getProc("glLightxv", userData); set_glLightxv((glLightxv_client_proc_t)ptr);
- ptr = getProc("glLineWidthx", userData); set_glLineWidthx((glLineWidthx_client_proc_t)ptr);
- ptr = getProc("glLoadIdentity", userData); set_glLoadIdentity((glLoadIdentity_client_proc_t)ptr);
- ptr = getProc("glLoadMatrixx", userData); set_glLoadMatrixx((glLoadMatrixx_client_proc_t)ptr);
- ptr = getProc("glLogicOp", userData); set_glLogicOp((glLogicOp_client_proc_t)ptr);
- ptr = getProc("glMaterialx", userData); set_glMaterialx((glMaterialx_client_proc_t)ptr);
- ptr = getProc("glMaterialxv", userData); set_glMaterialxv((glMaterialxv_client_proc_t)ptr);
- ptr = getProc("glMatrixMode", userData); set_glMatrixMode((glMatrixMode_client_proc_t)ptr);
- ptr = getProc("glMultMatrixx", userData); set_glMultMatrixx((glMultMatrixx_client_proc_t)ptr);
- ptr = getProc("glMultiTexCoord4x", userData); set_glMultiTexCoord4x((glMultiTexCoord4x_client_proc_t)ptr);
- ptr = getProc("glNormal3x", userData); set_glNormal3x((glNormal3x_client_proc_t)ptr);
- ptr = getProc("glNormalPointer", userData); set_glNormalPointer((glNormalPointer_client_proc_t)ptr);
- ptr = getProc("glOrthox", userData); set_glOrthox((glOrthox_client_proc_t)ptr);
- ptr = getProc("glPixelStorei", userData); set_glPixelStorei((glPixelStorei_client_proc_t)ptr);
- ptr = getProc("glPointParameterx", userData); set_glPointParameterx((glPointParameterx_client_proc_t)ptr);
- ptr = getProc("glPointParameterxv", userData); set_glPointParameterxv((glPointParameterxv_client_proc_t)ptr);
- ptr = getProc("glPointSizex", userData); set_glPointSizex((glPointSizex_client_proc_t)ptr);
- ptr = getProc("glPolygonOffsetx", userData); set_glPolygonOffsetx((glPolygonOffsetx_client_proc_t)ptr);
- ptr = getProc("glPopMatrix", userData); set_glPopMatrix((glPopMatrix_client_proc_t)ptr);
- ptr = getProc("glPushMatrix", userData); set_glPushMatrix((glPushMatrix_client_proc_t)ptr);
- ptr = getProc("glReadPixels", userData); set_glReadPixels((glReadPixels_client_proc_t)ptr);
- ptr = getProc("glRotatex", userData); set_glRotatex((glRotatex_client_proc_t)ptr);
- ptr = getProc("glSampleCoverage", userData); set_glSampleCoverage((glSampleCoverage_client_proc_t)ptr);
- ptr = getProc("glSampleCoveragex", userData); set_glSampleCoveragex((glSampleCoveragex_client_proc_t)ptr);
- ptr = getProc("glScalex", userData); set_glScalex((glScalex_client_proc_t)ptr);
- ptr = getProc("glScissor", userData); set_glScissor((glScissor_client_proc_t)ptr);
- ptr = getProc("glShadeModel", userData); set_glShadeModel((glShadeModel_client_proc_t)ptr);
- ptr = getProc("glStencilFunc", userData); set_glStencilFunc((glStencilFunc_client_proc_t)ptr);
- ptr = getProc("glStencilMask", userData); set_glStencilMask((glStencilMask_client_proc_t)ptr);
- ptr = getProc("glStencilOp", userData); set_glStencilOp((glStencilOp_client_proc_t)ptr);
- ptr = getProc("glTexCoordPointer", userData); set_glTexCoordPointer((glTexCoordPointer_client_proc_t)ptr);
- ptr = getProc("glTexEnvi", userData); set_glTexEnvi((glTexEnvi_client_proc_t)ptr);
- ptr = getProc("glTexEnvx", userData); set_glTexEnvx((glTexEnvx_client_proc_t)ptr);
- ptr = getProc("glTexEnviv", userData); set_glTexEnviv((glTexEnviv_client_proc_t)ptr);
- ptr = getProc("glTexEnvxv", userData); set_glTexEnvxv((glTexEnvxv_client_proc_t)ptr);
- ptr = getProc("glTexImage2D", userData); set_glTexImage2D((glTexImage2D_client_proc_t)ptr);
- ptr = getProc("glTexParameteri", userData); set_glTexParameteri((glTexParameteri_client_proc_t)ptr);
- ptr = getProc("glTexParameterx", userData); set_glTexParameterx((glTexParameterx_client_proc_t)ptr);
- ptr = getProc("glTexParameteriv", userData); set_glTexParameteriv((glTexParameteriv_client_proc_t)ptr);
- ptr = getProc("glTexParameterxv", userData); set_glTexParameterxv((glTexParameterxv_client_proc_t)ptr);
- ptr = getProc("glTexSubImage2D", userData); set_glTexSubImage2D((glTexSubImage2D_client_proc_t)ptr);
- ptr = getProc("glTranslatex", userData); set_glTranslatex((glTranslatex_client_proc_t)ptr);
- ptr = getProc("glVertexPointer", userData); set_glVertexPointer((glVertexPointer_client_proc_t)ptr);
- ptr = getProc("glViewport", userData); set_glViewport((glViewport_client_proc_t)ptr);
- ptr = getProc("glPointSizePointerOES", userData); set_glPointSizePointerOES((glPointSizePointerOES_client_proc_t)ptr);
- ptr = getProc("glVertexPointerOffset", userData); set_glVertexPointerOffset((glVertexPointerOffset_client_proc_t)ptr);
- ptr = getProc("glColorPointerOffset", userData); set_glColorPointerOffset((glColorPointerOffset_client_proc_t)ptr);
- ptr = getProc("glNormalPointerOffset", userData); set_glNormalPointerOffset((glNormalPointerOffset_client_proc_t)ptr);
- ptr = getProc("glPointSizePointerOffset", userData); set_glPointSizePointerOffset((glPointSizePointerOffset_client_proc_t)ptr);
- ptr = getProc("glTexCoordPointerOffset", userData); set_glTexCoordPointerOffset((glTexCoordPointerOffset_client_proc_t)ptr);
- ptr = getProc("glWeightPointerOffset", userData); set_glWeightPointerOffset((glWeightPointerOffset_client_proc_t)ptr);
- ptr = getProc("glMatrixIndexPointerOffset", userData); set_glMatrixIndexPointerOffset((glMatrixIndexPointerOffset_client_proc_t)ptr);
- ptr = getProc("glVertexPointerData", userData); set_glVertexPointerData((glVertexPointerData_client_proc_t)ptr);
- ptr = getProc("glColorPointerData", userData); set_glColorPointerData((glColorPointerData_client_proc_t)ptr);
- ptr = getProc("glNormalPointerData", userData); set_glNormalPointerData((glNormalPointerData_client_proc_t)ptr);
- ptr = getProc("glTexCoordPointerData", userData); set_glTexCoordPointerData((glTexCoordPointerData_client_proc_t)ptr);
- ptr = getProc("glPointSizePointerData", userData); set_glPointSizePointerData((glPointSizePointerData_client_proc_t)ptr);
- ptr = getProc("glWeightPointerData", userData); set_glWeightPointerData((glWeightPointerData_client_proc_t)ptr);
- ptr = getProc("glMatrixIndexPointerData", userData); set_glMatrixIndexPointerData((glMatrixIndexPointerData_client_proc_t)ptr);
- ptr = getProc("glDrawElementsOffset", userData); set_glDrawElementsOffset((glDrawElementsOffset_client_proc_t)ptr);
- ptr = getProc("glDrawElementsData", userData); set_glDrawElementsData((glDrawElementsData_client_proc_t)ptr);
- ptr = getProc("glGetCompressedTextureFormats", userData); set_glGetCompressedTextureFormats((glGetCompressedTextureFormats_client_proc_t)ptr);
- ptr = getProc("glFinishRoundTrip", userData); set_glFinishRoundTrip((glFinishRoundTrip_client_proc_t)ptr);
- ptr = getProc("glBlendEquationSeparateOES", userData); set_glBlendEquationSeparateOES((glBlendEquationSeparateOES_client_proc_t)ptr);
- ptr = getProc("glBlendFuncSeparateOES", userData); set_glBlendFuncSeparateOES((glBlendFuncSeparateOES_client_proc_t)ptr);
- ptr = getProc("glBlendEquationOES", userData); set_glBlendEquationOES((glBlendEquationOES_client_proc_t)ptr);
- ptr = getProc("glDrawTexsOES", userData); set_glDrawTexsOES((glDrawTexsOES_client_proc_t)ptr);
- ptr = getProc("glDrawTexiOES", userData); set_glDrawTexiOES((glDrawTexiOES_client_proc_t)ptr);
- ptr = getProc("glDrawTexxOES", userData); set_glDrawTexxOES((glDrawTexxOES_client_proc_t)ptr);
- ptr = getProc("glDrawTexsvOES", userData); set_glDrawTexsvOES((glDrawTexsvOES_client_proc_t)ptr);
- ptr = getProc("glDrawTexivOES", userData); set_glDrawTexivOES((glDrawTexivOES_client_proc_t)ptr);
- ptr = getProc("glDrawTexxvOES", userData); set_glDrawTexxvOES((glDrawTexxvOES_client_proc_t)ptr);
- ptr = getProc("glDrawTexfOES", userData); set_glDrawTexfOES((glDrawTexfOES_client_proc_t)ptr);
- ptr = getProc("glDrawTexfvOES", userData); set_glDrawTexfvOES((glDrawTexfvOES_client_proc_t)ptr);
- ptr = getProc("glEGLImageTargetTexture2DOES", userData); set_glEGLImageTargetTexture2DOES((glEGLImageTargetTexture2DOES_client_proc_t)ptr);
- ptr = getProc("glEGLImageTargetRenderbufferStorageOES", userData); set_glEGLImageTargetRenderbufferStorageOES((glEGLImageTargetRenderbufferStorageOES_client_proc_t)ptr);
- ptr = getProc("glAlphaFuncxOES", userData); set_glAlphaFuncxOES((glAlphaFuncxOES_client_proc_t)ptr);
- ptr = getProc("glClearColorxOES", userData); set_glClearColorxOES((glClearColorxOES_client_proc_t)ptr);
- ptr = getProc("glClearDepthxOES", userData); set_glClearDepthxOES((glClearDepthxOES_client_proc_t)ptr);
- ptr = getProc("glClipPlanexOES", userData); set_glClipPlanexOES((glClipPlanexOES_client_proc_t)ptr);
- ptr = getProc("glClipPlanexIMG", userData); set_glClipPlanexIMG((glClipPlanexIMG_client_proc_t)ptr);
- ptr = getProc("glColor4xOES", userData); set_glColor4xOES((glColor4xOES_client_proc_t)ptr);
- ptr = getProc("glDepthRangexOES", userData); set_glDepthRangexOES((glDepthRangexOES_client_proc_t)ptr);
- ptr = getProc("glFogxOES", userData); set_glFogxOES((glFogxOES_client_proc_t)ptr);
- ptr = getProc("glFogxvOES", userData); set_glFogxvOES((glFogxvOES_client_proc_t)ptr);
- ptr = getProc("glFrustumxOES", userData); set_glFrustumxOES((glFrustumxOES_client_proc_t)ptr);
- ptr = getProc("glGetClipPlanexOES", userData); set_glGetClipPlanexOES((glGetClipPlanexOES_client_proc_t)ptr);
- ptr = getProc("glGetClipPlanex", userData); set_glGetClipPlanex((glGetClipPlanex_client_proc_t)ptr);
- ptr = getProc("glGetFixedvOES", userData); set_glGetFixedvOES((glGetFixedvOES_client_proc_t)ptr);
- ptr = getProc("glGetLightxvOES", userData); set_glGetLightxvOES((glGetLightxvOES_client_proc_t)ptr);
- ptr = getProc("glGetMaterialxvOES", userData); set_glGetMaterialxvOES((glGetMaterialxvOES_client_proc_t)ptr);
- ptr = getProc("glGetTexEnvxvOES", userData); set_glGetTexEnvxvOES((glGetTexEnvxvOES_client_proc_t)ptr);
- ptr = getProc("glGetTexParameterxvOES", userData); set_glGetTexParameterxvOES((glGetTexParameterxvOES_client_proc_t)ptr);
- ptr = getProc("glLightModelxOES", userData); set_glLightModelxOES((glLightModelxOES_client_proc_t)ptr);
- ptr = getProc("glLightModelxvOES", userData); set_glLightModelxvOES((glLightModelxvOES_client_proc_t)ptr);
- ptr = getProc("glLightxOES", userData); set_glLightxOES((glLightxOES_client_proc_t)ptr);
- ptr = getProc("glLightxvOES", userData); set_glLightxvOES((glLightxvOES_client_proc_t)ptr);
- ptr = getProc("glLineWidthxOES", userData); set_glLineWidthxOES((glLineWidthxOES_client_proc_t)ptr);
- ptr = getProc("glLoadMatrixxOES", userData); set_glLoadMatrixxOES((glLoadMatrixxOES_client_proc_t)ptr);
- ptr = getProc("glMaterialxOES", userData); set_glMaterialxOES((glMaterialxOES_client_proc_t)ptr);
- ptr = getProc("glMaterialxvOES", userData); set_glMaterialxvOES((glMaterialxvOES_client_proc_t)ptr);
- ptr = getProc("glMultMatrixxOES", userData); set_glMultMatrixxOES((glMultMatrixxOES_client_proc_t)ptr);
- ptr = getProc("glMultiTexCoord4xOES", userData); set_glMultiTexCoord4xOES((glMultiTexCoord4xOES_client_proc_t)ptr);
- ptr = getProc("glNormal3xOES", userData); set_glNormal3xOES((glNormal3xOES_client_proc_t)ptr);
- ptr = getProc("glOrthoxOES", userData); set_glOrthoxOES((glOrthoxOES_client_proc_t)ptr);
- ptr = getProc("glPointParameterxOES", userData); set_glPointParameterxOES((glPointParameterxOES_client_proc_t)ptr);
- ptr = getProc("glPointParameterxvOES", userData); set_glPointParameterxvOES((glPointParameterxvOES_client_proc_t)ptr);
- ptr = getProc("glPointSizexOES", userData); set_glPointSizexOES((glPointSizexOES_client_proc_t)ptr);
- ptr = getProc("glPolygonOffsetxOES", userData); set_glPolygonOffsetxOES((glPolygonOffsetxOES_client_proc_t)ptr);
- ptr = getProc("glRotatexOES", userData); set_glRotatexOES((glRotatexOES_client_proc_t)ptr);
- ptr = getProc("glSampleCoveragexOES", userData); set_glSampleCoveragexOES((glSampleCoveragexOES_client_proc_t)ptr);
- ptr = getProc("glScalexOES", userData); set_glScalexOES((glScalexOES_client_proc_t)ptr);
- ptr = getProc("glTexEnvxOES", userData); set_glTexEnvxOES((glTexEnvxOES_client_proc_t)ptr);
- ptr = getProc("glTexEnvxvOES", userData); set_glTexEnvxvOES((glTexEnvxvOES_client_proc_t)ptr);
- ptr = getProc("glTexParameterxOES", userData); set_glTexParameterxOES((glTexParameterxOES_client_proc_t)ptr);
- ptr = getProc("glTexParameterxvOES", userData); set_glTexParameterxvOES((glTexParameterxvOES_client_proc_t)ptr);
- ptr = getProc("glTranslatexOES", userData); set_glTranslatexOES((glTranslatexOES_client_proc_t)ptr);
- ptr = getProc("glIsRenderbufferOES", userData); set_glIsRenderbufferOES((glIsRenderbufferOES_client_proc_t)ptr);
- ptr = getProc("glBindRenderbufferOES", userData); set_glBindRenderbufferOES((glBindRenderbufferOES_client_proc_t)ptr);
- ptr = getProc("glDeleteRenderbuffersOES", userData); set_glDeleteRenderbuffersOES((glDeleteRenderbuffersOES_client_proc_t)ptr);
- ptr = getProc("glGenRenderbuffersOES", userData); set_glGenRenderbuffersOES((glGenRenderbuffersOES_client_proc_t)ptr);
- ptr = getProc("glRenderbufferStorageOES", userData); set_glRenderbufferStorageOES((glRenderbufferStorageOES_client_proc_t)ptr);
- ptr = getProc("glGetRenderbufferParameterivOES", userData); set_glGetRenderbufferParameterivOES((glGetRenderbufferParameterivOES_client_proc_t)ptr);
- ptr = getProc("glIsFramebufferOES", userData); set_glIsFramebufferOES((glIsFramebufferOES_client_proc_t)ptr);
- ptr = getProc("glBindFramebufferOES", userData); set_glBindFramebufferOES((glBindFramebufferOES_client_proc_t)ptr);
- ptr = getProc("glDeleteFramebuffersOES", userData); set_glDeleteFramebuffersOES((glDeleteFramebuffersOES_client_proc_t)ptr);
- ptr = getProc("glGenFramebuffersOES", userData); set_glGenFramebuffersOES((glGenFramebuffersOES_client_proc_t)ptr);
- ptr = getProc("glCheckFramebufferStatusOES", userData); set_glCheckFramebufferStatusOES((glCheckFramebufferStatusOES_client_proc_t)ptr);
- ptr = getProc("glFramebufferRenderbufferOES", userData); set_glFramebufferRenderbufferOES((glFramebufferRenderbufferOES_client_proc_t)ptr);
- ptr = getProc("glFramebufferTexture2DOES", userData); set_glFramebufferTexture2DOES((glFramebufferTexture2DOES_client_proc_t)ptr);
- ptr = getProc("glGetFramebufferAttachmentParameterivOES", userData); set_glGetFramebufferAttachmentParameterivOES((glGetFramebufferAttachmentParameterivOES_client_proc_t)ptr);
- ptr = getProc("glGenerateMipmapOES", userData); set_glGenerateMipmapOES((glGenerateMipmapOES_client_proc_t)ptr);
- ptr = getProc("glMapBufferOES", userData); set_glMapBufferOES((glMapBufferOES_client_proc_t)ptr);
- ptr = getProc("glUnmapBufferOES", userData); set_glUnmapBufferOES((glUnmapBufferOES_client_proc_t)ptr);
- ptr = getProc("glGetBufferPointervOES", userData); set_glGetBufferPointervOES((glGetBufferPointervOES_client_proc_t)ptr);
- ptr = getProc("glCurrentPaletteMatrixOES", userData); set_glCurrentPaletteMatrixOES((glCurrentPaletteMatrixOES_client_proc_t)ptr);
- ptr = getProc("glLoadPaletteFromModelViewMatrixOES", userData); set_glLoadPaletteFromModelViewMatrixOES((glLoadPaletteFromModelViewMatrixOES_client_proc_t)ptr);
- ptr = getProc("glMatrixIndexPointerOES", userData); set_glMatrixIndexPointerOES((glMatrixIndexPointerOES_client_proc_t)ptr);
- ptr = getProc("glWeightPointerOES", userData); set_glWeightPointerOES((glWeightPointerOES_client_proc_t)ptr);
- ptr = getProc("glQueryMatrixxOES", userData); set_glQueryMatrixxOES((glQueryMatrixxOES_client_proc_t)ptr);
- ptr = getProc("glDepthRangefOES", userData); set_glDepthRangefOES((glDepthRangefOES_client_proc_t)ptr);
- ptr = getProc("glFrustumfOES", userData); set_glFrustumfOES((glFrustumfOES_client_proc_t)ptr);
- ptr = getProc("glOrthofOES", userData); set_glOrthofOES((glOrthofOES_client_proc_t)ptr);
- ptr = getProc("glClipPlanefOES", userData); set_glClipPlanefOES((glClipPlanefOES_client_proc_t)ptr);
- ptr = getProc("glClipPlanefIMG", userData); set_glClipPlanefIMG((glClipPlanefIMG_client_proc_t)ptr);
- ptr = getProc("glGetClipPlanefOES", userData); set_glGetClipPlanefOES((glGetClipPlanefOES_client_proc_t)ptr);
- ptr = getProc("glClearDepthfOES", userData); set_glClearDepthfOES((glClearDepthfOES_client_proc_t)ptr);
- ptr = getProc("glTexGenfOES", userData); set_glTexGenfOES((glTexGenfOES_client_proc_t)ptr);
- ptr = getProc("glTexGenfvOES", userData); set_glTexGenfvOES((glTexGenfvOES_client_proc_t)ptr);
- ptr = getProc("glTexGeniOES", userData); set_glTexGeniOES((glTexGeniOES_client_proc_t)ptr);
- ptr = getProc("glTexGenivOES", userData); set_glTexGenivOES((glTexGenivOES_client_proc_t)ptr);
- ptr = getProc("glTexGenxOES", userData); set_glTexGenxOES((glTexGenxOES_client_proc_t)ptr);
- ptr = getProc("glTexGenxvOES", userData); set_glTexGenxvOES((glTexGenxvOES_client_proc_t)ptr);
- ptr = getProc("glGetTexGenfvOES", userData); set_glGetTexGenfvOES((glGetTexGenfvOES_client_proc_t)ptr);
- ptr = getProc("glGetTexGenivOES", userData); set_glGetTexGenivOES((glGetTexGenivOES_client_proc_t)ptr);
- ptr = getProc("glGetTexGenxvOES", userData); set_glGetTexGenxvOES((glGetTexGenxvOES_client_proc_t)ptr);
- ptr = getProc("glBindVertexArrayOES", userData); set_glBindVertexArrayOES((glBindVertexArrayOES_client_proc_t)ptr);
- ptr = getProc("glDeleteVertexArraysOES", userData); set_glDeleteVertexArraysOES((glDeleteVertexArraysOES_client_proc_t)ptr);
- ptr = getProc("glGenVertexArraysOES", userData); set_glGenVertexArraysOES((glGenVertexArraysOES_client_proc_t)ptr);
- ptr = getProc("glIsVertexArrayOES", userData); set_glIsVertexArrayOES((glIsVertexArrayOES_client_proc_t)ptr);
- ptr = getProc("glDiscardFramebufferEXT", userData); set_glDiscardFramebufferEXT((glDiscardFramebufferEXT_client_proc_t)ptr);
- ptr = getProc("glMultiDrawArraysEXT", userData); set_glMultiDrawArraysEXT((glMultiDrawArraysEXT_client_proc_t)ptr);
- ptr = getProc("glMultiDrawElementsEXT", userData); set_glMultiDrawElementsEXT((glMultiDrawElementsEXT_client_proc_t)ptr);
- ptr = getProc("glMultiDrawArraysSUN", userData); set_glMultiDrawArraysSUN((glMultiDrawArraysSUN_client_proc_t)ptr);
- ptr = getProc("glMultiDrawElementsSUN", userData); set_glMultiDrawElementsSUN((glMultiDrawElementsSUN_client_proc_t)ptr);
- ptr = getProc("glRenderbufferStorageMultisampleIMG", userData); set_glRenderbufferStorageMultisampleIMG((glRenderbufferStorageMultisampleIMG_client_proc_t)ptr);
- ptr = getProc("glFramebufferTexture2DMultisampleIMG", userData); set_glFramebufferTexture2DMultisampleIMG((glFramebufferTexture2DMultisampleIMG_client_proc_t)ptr);
- ptr = getProc("glDeleteFencesNV", userData); set_glDeleteFencesNV((glDeleteFencesNV_client_proc_t)ptr);
- ptr = getProc("glGenFencesNV", userData); set_glGenFencesNV((glGenFencesNV_client_proc_t)ptr);
- ptr = getProc("glIsFenceNV", userData); set_glIsFenceNV((glIsFenceNV_client_proc_t)ptr);
- ptr = getProc("glTestFenceNV", userData); set_glTestFenceNV((glTestFenceNV_client_proc_t)ptr);
- ptr = getProc("glGetFenceivNV", userData); set_glGetFenceivNV((glGetFenceivNV_client_proc_t)ptr);
- ptr = getProc("glFinishFenceNV", userData); set_glFinishFenceNV((glFinishFenceNV_client_proc_t)ptr);
- ptr = getProc("glSetFenceNV", userData); set_glSetFenceNV((glSetFenceNV_client_proc_t)ptr);
- ptr = getProc("glGetDriverControlsQCOM", userData); set_glGetDriverControlsQCOM((glGetDriverControlsQCOM_client_proc_t)ptr);
- ptr = getProc("glGetDriverControlStringQCOM", userData); set_glGetDriverControlStringQCOM((glGetDriverControlStringQCOM_client_proc_t)ptr);
- ptr = getProc("glEnableDriverControlQCOM", userData); set_glEnableDriverControlQCOM((glEnableDriverControlQCOM_client_proc_t)ptr);
- ptr = getProc("glDisableDriverControlQCOM", userData); set_glDisableDriverControlQCOM((glDisableDriverControlQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetTexturesQCOM", userData); set_glExtGetTexturesQCOM((glExtGetTexturesQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetBuffersQCOM", userData); set_glExtGetBuffersQCOM((glExtGetBuffersQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetRenderbuffersQCOM", userData); set_glExtGetRenderbuffersQCOM((glExtGetRenderbuffersQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetFramebuffersQCOM", userData); set_glExtGetFramebuffersQCOM((glExtGetFramebuffersQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetTexLevelParameterivQCOM", userData); set_glExtGetTexLevelParameterivQCOM((glExtGetTexLevelParameterivQCOM_client_proc_t)ptr);
- ptr = getProc("glExtTexObjectStateOverrideiQCOM", userData); set_glExtTexObjectStateOverrideiQCOM((glExtTexObjectStateOverrideiQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetTexSubImageQCOM", userData); set_glExtGetTexSubImageQCOM((glExtGetTexSubImageQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetBufferPointervQCOM", userData); set_glExtGetBufferPointervQCOM((glExtGetBufferPointervQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetShadersQCOM", userData); set_glExtGetShadersQCOM((glExtGetShadersQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetProgramsQCOM", userData); set_glExtGetProgramsQCOM((glExtGetProgramsQCOM_client_proc_t)ptr);
- ptr = getProc("glExtIsProgramBinaryQCOM", userData); set_glExtIsProgramBinaryQCOM((glExtIsProgramBinaryQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetProgramBinarySourceQCOM", userData); set_glExtGetProgramBinarySourceQCOM((glExtGetProgramBinarySourceQCOM_client_proc_t)ptr);
- ptr = getProc("glStartTilingQCOM", userData); set_glStartTilingQCOM((glStartTilingQCOM_client_proc_t)ptr);
- ptr = getProc("glEndTilingQCOM", userData); set_glEndTilingQCOM((glEndTilingQCOM_client_proc_t)ptr);
- return 0;
-}
-
diff --git a/tools/emulator/opengl/system/GLESv1_enc/gl_client_context.h b/tools/emulator/opengl/system/GLESv1_enc/gl_client_context.h
deleted file mode 100644
index c0b83ad13..000000000
--- a/tools/emulator/opengl/system/GLESv1_enc/gl_client_context.h
+++ /dev/null
@@ -1,603 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-#ifndef __gl_client_context_t_h
-#define __gl_client_context_t_h
-
-#include "gl_client_proc.h"
-
-
-struct gl_client_context_t {
-
- glAlphaFunc_client_proc_t glAlphaFunc;
- glClearColor_client_proc_t glClearColor;
- glClearDepthf_client_proc_t glClearDepthf;
- glClipPlanef_client_proc_t glClipPlanef;
- glColor4f_client_proc_t glColor4f;
- glDepthRangef_client_proc_t glDepthRangef;
- glFogf_client_proc_t glFogf;
- glFogfv_client_proc_t glFogfv;
- glFrustumf_client_proc_t glFrustumf;
- glGetClipPlanef_client_proc_t glGetClipPlanef;
- glGetFloatv_client_proc_t glGetFloatv;
- glGetLightfv_client_proc_t glGetLightfv;
- glGetMaterialfv_client_proc_t glGetMaterialfv;
- glGetTexEnvfv_client_proc_t glGetTexEnvfv;
- glGetTexParameterfv_client_proc_t glGetTexParameterfv;
- glLightModelf_client_proc_t glLightModelf;
- glLightModelfv_client_proc_t glLightModelfv;
- glLightf_client_proc_t glLightf;
- glLightfv_client_proc_t glLightfv;
- glLineWidth_client_proc_t glLineWidth;
- glLoadMatrixf_client_proc_t glLoadMatrixf;
- glMaterialf_client_proc_t glMaterialf;
- glMaterialfv_client_proc_t glMaterialfv;
- glMultMatrixf_client_proc_t glMultMatrixf;
- glMultiTexCoord4f_client_proc_t glMultiTexCoord4f;
- glNormal3f_client_proc_t glNormal3f;
- glOrthof_client_proc_t glOrthof;
- glPointParameterf_client_proc_t glPointParameterf;
- glPointParameterfv_client_proc_t glPointParameterfv;
- glPointSize_client_proc_t glPointSize;
- glPolygonOffset_client_proc_t glPolygonOffset;
- glRotatef_client_proc_t glRotatef;
- glScalef_client_proc_t glScalef;
- glTexEnvf_client_proc_t glTexEnvf;
- glTexEnvfv_client_proc_t glTexEnvfv;
- glTexParameterf_client_proc_t glTexParameterf;
- glTexParameterfv_client_proc_t glTexParameterfv;
- glTranslatef_client_proc_t glTranslatef;
- glActiveTexture_client_proc_t glActiveTexture;
- glAlphaFuncx_client_proc_t glAlphaFuncx;
- glBindBuffer_client_proc_t glBindBuffer;
- glBindTexture_client_proc_t glBindTexture;
- glBlendFunc_client_proc_t glBlendFunc;
- glBufferData_client_proc_t glBufferData;
- glBufferSubData_client_proc_t glBufferSubData;
- glClear_client_proc_t glClear;
- glClearColorx_client_proc_t glClearColorx;
- glClearDepthx_client_proc_t glClearDepthx;
- glClearStencil_client_proc_t glClearStencil;
- glClientActiveTexture_client_proc_t glClientActiveTexture;
- glColor4ub_client_proc_t glColor4ub;
- glColor4x_client_proc_t glColor4x;
- glColorMask_client_proc_t glColorMask;
- glColorPointer_client_proc_t glColorPointer;
- glCompressedTexImage2D_client_proc_t glCompressedTexImage2D;
- glCompressedTexSubImage2D_client_proc_t glCompressedTexSubImage2D;
- glCopyTexImage2D_client_proc_t glCopyTexImage2D;
- glCopyTexSubImage2D_client_proc_t glCopyTexSubImage2D;
- glCullFace_client_proc_t glCullFace;
- glDeleteBuffers_client_proc_t glDeleteBuffers;
- glDeleteTextures_client_proc_t glDeleteTextures;
- glDepthFunc_client_proc_t glDepthFunc;
- glDepthMask_client_proc_t glDepthMask;
- glDepthRangex_client_proc_t glDepthRangex;
- glDisable_client_proc_t glDisable;
- glDisableClientState_client_proc_t glDisableClientState;
- glDrawArrays_client_proc_t glDrawArrays;
- glDrawElements_client_proc_t glDrawElements;
- glEnable_client_proc_t glEnable;
- glEnableClientState_client_proc_t glEnableClientState;
- glFinish_client_proc_t glFinish;
- glFlush_client_proc_t glFlush;
- glFogx_client_proc_t glFogx;
- glFogxv_client_proc_t glFogxv;
- glFrontFace_client_proc_t glFrontFace;
- glFrustumx_client_proc_t glFrustumx;
- glGetBooleanv_client_proc_t glGetBooleanv;
- glGetBufferParameteriv_client_proc_t glGetBufferParameteriv;
- glClipPlanex_client_proc_t glClipPlanex;
- glGenBuffers_client_proc_t glGenBuffers;
- glGenTextures_client_proc_t glGenTextures;
- glGetError_client_proc_t glGetError;
- glGetFixedv_client_proc_t glGetFixedv;
- glGetIntegerv_client_proc_t glGetIntegerv;
- glGetLightxv_client_proc_t glGetLightxv;
- glGetMaterialxv_client_proc_t glGetMaterialxv;
- glGetPointerv_client_proc_t glGetPointerv;
- glGetString_client_proc_t glGetString;
- glGetTexEnviv_client_proc_t glGetTexEnviv;
- glGetTexEnvxv_client_proc_t glGetTexEnvxv;
- glGetTexParameteriv_client_proc_t glGetTexParameteriv;
- glGetTexParameterxv_client_proc_t glGetTexParameterxv;
- glHint_client_proc_t glHint;
- glIsBuffer_client_proc_t glIsBuffer;
- glIsEnabled_client_proc_t glIsEnabled;
- glIsTexture_client_proc_t glIsTexture;
- glLightModelx_client_proc_t glLightModelx;
- glLightModelxv_client_proc_t glLightModelxv;
- glLightx_client_proc_t glLightx;
- glLightxv_client_proc_t glLightxv;
- glLineWidthx_client_proc_t glLineWidthx;
- glLoadIdentity_client_proc_t glLoadIdentity;
- glLoadMatrixx_client_proc_t glLoadMatrixx;
- glLogicOp_client_proc_t glLogicOp;
- glMaterialx_client_proc_t glMaterialx;
- glMaterialxv_client_proc_t glMaterialxv;
- glMatrixMode_client_proc_t glMatrixMode;
- glMultMatrixx_client_proc_t glMultMatrixx;
- glMultiTexCoord4x_client_proc_t glMultiTexCoord4x;
- glNormal3x_client_proc_t glNormal3x;
- glNormalPointer_client_proc_t glNormalPointer;
- glOrthox_client_proc_t glOrthox;
- glPixelStorei_client_proc_t glPixelStorei;
- glPointParameterx_client_proc_t glPointParameterx;
- glPointParameterxv_client_proc_t glPointParameterxv;
- glPointSizex_client_proc_t glPointSizex;
- glPolygonOffsetx_client_proc_t glPolygonOffsetx;
- glPopMatrix_client_proc_t glPopMatrix;
- glPushMatrix_client_proc_t glPushMatrix;
- glReadPixels_client_proc_t glReadPixels;
- glRotatex_client_proc_t glRotatex;
- glSampleCoverage_client_proc_t glSampleCoverage;
- glSampleCoveragex_client_proc_t glSampleCoveragex;
- glScalex_client_proc_t glScalex;
- glScissor_client_proc_t glScissor;
- glShadeModel_client_proc_t glShadeModel;
- glStencilFunc_client_proc_t glStencilFunc;
- glStencilMask_client_proc_t glStencilMask;
- glStencilOp_client_proc_t glStencilOp;
- glTexCoordPointer_client_proc_t glTexCoordPointer;
- glTexEnvi_client_proc_t glTexEnvi;
- glTexEnvx_client_proc_t glTexEnvx;
- glTexEnviv_client_proc_t glTexEnviv;
- glTexEnvxv_client_proc_t glTexEnvxv;
- glTexImage2D_client_proc_t glTexImage2D;
- glTexParameteri_client_proc_t glTexParameteri;
- glTexParameterx_client_proc_t glTexParameterx;
- glTexParameteriv_client_proc_t glTexParameteriv;
- glTexParameterxv_client_proc_t glTexParameterxv;
- glTexSubImage2D_client_proc_t glTexSubImage2D;
- glTranslatex_client_proc_t glTranslatex;
- glVertexPointer_client_proc_t glVertexPointer;
- glViewport_client_proc_t glViewport;
- glPointSizePointerOES_client_proc_t glPointSizePointerOES;
- glVertexPointerOffset_client_proc_t glVertexPointerOffset;
- glColorPointerOffset_client_proc_t glColorPointerOffset;
- glNormalPointerOffset_client_proc_t glNormalPointerOffset;
- glPointSizePointerOffset_client_proc_t glPointSizePointerOffset;
- glTexCoordPointerOffset_client_proc_t glTexCoordPointerOffset;
- glWeightPointerOffset_client_proc_t glWeightPointerOffset;
- glMatrixIndexPointerOffset_client_proc_t glMatrixIndexPointerOffset;
- glVertexPointerData_client_proc_t glVertexPointerData;
- glColorPointerData_client_proc_t glColorPointerData;
- glNormalPointerData_client_proc_t glNormalPointerData;
- glTexCoordPointerData_client_proc_t glTexCoordPointerData;
- glPointSizePointerData_client_proc_t glPointSizePointerData;
- glWeightPointerData_client_proc_t glWeightPointerData;
- glMatrixIndexPointerData_client_proc_t glMatrixIndexPointerData;
- glDrawElementsOffset_client_proc_t glDrawElementsOffset;
- glDrawElementsData_client_proc_t glDrawElementsData;
- glGetCompressedTextureFormats_client_proc_t glGetCompressedTextureFormats;
- glFinishRoundTrip_client_proc_t glFinishRoundTrip;
- glBlendEquationSeparateOES_client_proc_t glBlendEquationSeparateOES;
- glBlendFuncSeparateOES_client_proc_t glBlendFuncSeparateOES;
- glBlendEquationOES_client_proc_t glBlendEquationOES;
- glDrawTexsOES_client_proc_t glDrawTexsOES;
- glDrawTexiOES_client_proc_t glDrawTexiOES;
- glDrawTexxOES_client_proc_t glDrawTexxOES;
- glDrawTexsvOES_client_proc_t glDrawTexsvOES;
- glDrawTexivOES_client_proc_t glDrawTexivOES;
- glDrawTexxvOES_client_proc_t glDrawTexxvOES;
- glDrawTexfOES_client_proc_t glDrawTexfOES;
- glDrawTexfvOES_client_proc_t glDrawTexfvOES;
- glEGLImageTargetTexture2DOES_client_proc_t glEGLImageTargetTexture2DOES;
- glEGLImageTargetRenderbufferStorageOES_client_proc_t glEGLImageTargetRenderbufferStorageOES;
- glAlphaFuncxOES_client_proc_t glAlphaFuncxOES;
- glClearColorxOES_client_proc_t glClearColorxOES;
- glClearDepthxOES_client_proc_t glClearDepthxOES;
- glClipPlanexOES_client_proc_t glClipPlanexOES;
- glClipPlanexIMG_client_proc_t glClipPlanexIMG;
- glColor4xOES_client_proc_t glColor4xOES;
- glDepthRangexOES_client_proc_t glDepthRangexOES;
- glFogxOES_client_proc_t glFogxOES;
- glFogxvOES_client_proc_t glFogxvOES;
- glFrustumxOES_client_proc_t glFrustumxOES;
- glGetClipPlanexOES_client_proc_t glGetClipPlanexOES;
- glGetClipPlanex_client_proc_t glGetClipPlanex;
- glGetFixedvOES_client_proc_t glGetFixedvOES;
- glGetLightxvOES_client_proc_t glGetLightxvOES;
- glGetMaterialxvOES_client_proc_t glGetMaterialxvOES;
- glGetTexEnvxvOES_client_proc_t glGetTexEnvxvOES;
- glGetTexParameterxvOES_client_proc_t glGetTexParameterxvOES;
- glLightModelxOES_client_proc_t glLightModelxOES;
- glLightModelxvOES_client_proc_t glLightModelxvOES;
- glLightxOES_client_proc_t glLightxOES;
- glLightxvOES_client_proc_t glLightxvOES;
- glLineWidthxOES_client_proc_t glLineWidthxOES;
- glLoadMatrixxOES_client_proc_t glLoadMatrixxOES;
- glMaterialxOES_client_proc_t glMaterialxOES;
- glMaterialxvOES_client_proc_t glMaterialxvOES;
- glMultMatrixxOES_client_proc_t glMultMatrixxOES;
- glMultiTexCoord4xOES_client_proc_t glMultiTexCoord4xOES;
- glNormal3xOES_client_proc_t glNormal3xOES;
- glOrthoxOES_client_proc_t glOrthoxOES;
- glPointParameterxOES_client_proc_t glPointParameterxOES;
- glPointParameterxvOES_client_proc_t glPointParameterxvOES;
- glPointSizexOES_client_proc_t glPointSizexOES;
- glPolygonOffsetxOES_client_proc_t glPolygonOffsetxOES;
- glRotatexOES_client_proc_t glRotatexOES;
- glSampleCoveragexOES_client_proc_t glSampleCoveragexOES;
- glScalexOES_client_proc_t glScalexOES;
- glTexEnvxOES_client_proc_t glTexEnvxOES;
- glTexEnvxvOES_client_proc_t glTexEnvxvOES;
- glTexParameterxOES_client_proc_t glTexParameterxOES;
- glTexParameterxvOES_client_proc_t glTexParameterxvOES;
- glTranslatexOES_client_proc_t glTranslatexOES;
- glIsRenderbufferOES_client_proc_t glIsRenderbufferOES;
- glBindRenderbufferOES_client_proc_t glBindRenderbufferOES;
- glDeleteRenderbuffersOES_client_proc_t glDeleteRenderbuffersOES;
- glGenRenderbuffersOES_client_proc_t glGenRenderbuffersOES;
- glRenderbufferStorageOES_client_proc_t glRenderbufferStorageOES;
- glGetRenderbufferParameterivOES_client_proc_t glGetRenderbufferParameterivOES;
- glIsFramebufferOES_client_proc_t glIsFramebufferOES;
- glBindFramebufferOES_client_proc_t glBindFramebufferOES;
- glDeleteFramebuffersOES_client_proc_t glDeleteFramebuffersOES;
- glGenFramebuffersOES_client_proc_t glGenFramebuffersOES;
- glCheckFramebufferStatusOES_client_proc_t glCheckFramebufferStatusOES;
- glFramebufferRenderbufferOES_client_proc_t glFramebufferRenderbufferOES;
- glFramebufferTexture2DOES_client_proc_t glFramebufferTexture2DOES;
- glGetFramebufferAttachmentParameterivOES_client_proc_t glGetFramebufferAttachmentParameterivOES;
- glGenerateMipmapOES_client_proc_t glGenerateMipmapOES;
- glMapBufferOES_client_proc_t glMapBufferOES;
- glUnmapBufferOES_client_proc_t glUnmapBufferOES;
- glGetBufferPointervOES_client_proc_t glGetBufferPointervOES;
- glCurrentPaletteMatrixOES_client_proc_t glCurrentPaletteMatrixOES;
- glLoadPaletteFromModelViewMatrixOES_client_proc_t glLoadPaletteFromModelViewMatrixOES;
- glMatrixIndexPointerOES_client_proc_t glMatrixIndexPointerOES;
- glWeightPointerOES_client_proc_t glWeightPointerOES;
- glQueryMatrixxOES_client_proc_t glQueryMatrixxOES;
- glDepthRangefOES_client_proc_t glDepthRangefOES;
- glFrustumfOES_client_proc_t glFrustumfOES;
- glOrthofOES_client_proc_t glOrthofOES;
- glClipPlanefOES_client_proc_t glClipPlanefOES;
- glClipPlanefIMG_client_proc_t glClipPlanefIMG;
- glGetClipPlanefOES_client_proc_t glGetClipPlanefOES;
- glClearDepthfOES_client_proc_t glClearDepthfOES;
- glTexGenfOES_client_proc_t glTexGenfOES;
- glTexGenfvOES_client_proc_t glTexGenfvOES;
- glTexGeniOES_client_proc_t glTexGeniOES;
- glTexGenivOES_client_proc_t glTexGenivOES;
- glTexGenxOES_client_proc_t glTexGenxOES;
- glTexGenxvOES_client_proc_t glTexGenxvOES;
- glGetTexGenfvOES_client_proc_t glGetTexGenfvOES;
- glGetTexGenivOES_client_proc_t glGetTexGenivOES;
- glGetTexGenxvOES_client_proc_t glGetTexGenxvOES;
- glBindVertexArrayOES_client_proc_t glBindVertexArrayOES;
- glDeleteVertexArraysOES_client_proc_t glDeleteVertexArraysOES;
- glGenVertexArraysOES_client_proc_t glGenVertexArraysOES;
- glIsVertexArrayOES_client_proc_t glIsVertexArrayOES;
- glDiscardFramebufferEXT_client_proc_t glDiscardFramebufferEXT;
- glMultiDrawArraysEXT_client_proc_t glMultiDrawArraysEXT;
- glMultiDrawElementsEXT_client_proc_t glMultiDrawElementsEXT;
- glMultiDrawArraysSUN_client_proc_t glMultiDrawArraysSUN;
- glMultiDrawElementsSUN_client_proc_t glMultiDrawElementsSUN;
- glRenderbufferStorageMultisampleIMG_client_proc_t glRenderbufferStorageMultisampleIMG;
- glFramebufferTexture2DMultisampleIMG_client_proc_t glFramebufferTexture2DMultisampleIMG;
- glDeleteFencesNV_client_proc_t glDeleteFencesNV;
- glGenFencesNV_client_proc_t glGenFencesNV;
- glIsFenceNV_client_proc_t glIsFenceNV;
- glTestFenceNV_client_proc_t glTestFenceNV;
- glGetFenceivNV_client_proc_t glGetFenceivNV;
- glFinishFenceNV_client_proc_t glFinishFenceNV;
- glSetFenceNV_client_proc_t glSetFenceNV;
- glGetDriverControlsQCOM_client_proc_t glGetDriverControlsQCOM;
- glGetDriverControlStringQCOM_client_proc_t glGetDriverControlStringQCOM;
- glEnableDriverControlQCOM_client_proc_t glEnableDriverControlQCOM;
- glDisableDriverControlQCOM_client_proc_t glDisableDriverControlQCOM;
- glExtGetTexturesQCOM_client_proc_t glExtGetTexturesQCOM;
- glExtGetBuffersQCOM_client_proc_t glExtGetBuffersQCOM;
- glExtGetRenderbuffersQCOM_client_proc_t glExtGetRenderbuffersQCOM;
- glExtGetFramebuffersQCOM_client_proc_t glExtGetFramebuffersQCOM;
- glExtGetTexLevelParameterivQCOM_client_proc_t glExtGetTexLevelParameterivQCOM;
- glExtTexObjectStateOverrideiQCOM_client_proc_t glExtTexObjectStateOverrideiQCOM;
- glExtGetTexSubImageQCOM_client_proc_t glExtGetTexSubImageQCOM;
- glExtGetBufferPointervQCOM_client_proc_t glExtGetBufferPointervQCOM;
- glExtGetShadersQCOM_client_proc_t glExtGetShadersQCOM;
- glExtGetProgramsQCOM_client_proc_t glExtGetProgramsQCOM;
- glExtIsProgramBinaryQCOM_client_proc_t glExtIsProgramBinaryQCOM;
- glExtGetProgramBinarySourceQCOM_client_proc_t glExtGetProgramBinarySourceQCOM;
- glStartTilingQCOM_client_proc_t glStartTilingQCOM;
- glEndTilingQCOM_client_proc_t glEndTilingQCOM;
- //Accessors
- virtual glAlphaFunc_client_proc_t set_glAlphaFunc(glAlphaFunc_client_proc_t f) { glAlphaFunc_client_proc_t retval = glAlphaFunc; glAlphaFunc = f; return retval;}
- virtual glClearColor_client_proc_t set_glClearColor(glClearColor_client_proc_t f) { glClearColor_client_proc_t retval = glClearColor; glClearColor = f; return retval;}
- virtual glClearDepthf_client_proc_t set_glClearDepthf(glClearDepthf_client_proc_t f) { glClearDepthf_client_proc_t retval = glClearDepthf; glClearDepthf = f; return retval;}
- virtual glClipPlanef_client_proc_t set_glClipPlanef(glClipPlanef_client_proc_t f) { glClipPlanef_client_proc_t retval = glClipPlanef; glClipPlanef = f; return retval;}
- virtual glColor4f_client_proc_t set_glColor4f(glColor4f_client_proc_t f) { glColor4f_client_proc_t retval = glColor4f; glColor4f = f; return retval;}
- virtual glDepthRangef_client_proc_t set_glDepthRangef(glDepthRangef_client_proc_t f) { glDepthRangef_client_proc_t retval = glDepthRangef; glDepthRangef = f; return retval;}
- virtual glFogf_client_proc_t set_glFogf(glFogf_client_proc_t f) { glFogf_client_proc_t retval = glFogf; glFogf = f; return retval;}
- virtual glFogfv_client_proc_t set_glFogfv(glFogfv_client_proc_t f) { glFogfv_client_proc_t retval = glFogfv; glFogfv = f; return retval;}
- virtual glFrustumf_client_proc_t set_glFrustumf(glFrustumf_client_proc_t f) { glFrustumf_client_proc_t retval = glFrustumf; glFrustumf = f; return retval;}
- virtual glGetClipPlanef_client_proc_t set_glGetClipPlanef(glGetClipPlanef_client_proc_t f) { glGetClipPlanef_client_proc_t retval = glGetClipPlanef; glGetClipPlanef = f; return retval;}
- virtual glGetFloatv_client_proc_t set_glGetFloatv(glGetFloatv_client_proc_t f) { glGetFloatv_client_proc_t retval = glGetFloatv; glGetFloatv = f; return retval;}
- virtual glGetLightfv_client_proc_t set_glGetLightfv(glGetLightfv_client_proc_t f) { glGetLightfv_client_proc_t retval = glGetLightfv; glGetLightfv = f; return retval;}
- virtual glGetMaterialfv_client_proc_t set_glGetMaterialfv(glGetMaterialfv_client_proc_t f) { glGetMaterialfv_client_proc_t retval = glGetMaterialfv; glGetMaterialfv = f; return retval;}
- virtual glGetTexEnvfv_client_proc_t set_glGetTexEnvfv(glGetTexEnvfv_client_proc_t f) { glGetTexEnvfv_client_proc_t retval = glGetTexEnvfv; glGetTexEnvfv = f; return retval;}
- virtual glGetTexParameterfv_client_proc_t set_glGetTexParameterfv(glGetTexParameterfv_client_proc_t f) { glGetTexParameterfv_client_proc_t retval = glGetTexParameterfv; glGetTexParameterfv = f; return retval;}
- virtual glLightModelf_client_proc_t set_glLightModelf(glLightModelf_client_proc_t f) { glLightModelf_client_proc_t retval = glLightModelf; glLightModelf = f; return retval;}
- virtual glLightModelfv_client_proc_t set_glLightModelfv(glLightModelfv_client_proc_t f) { glLightModelfv_client_proc_t retval = glLightModelfv; glLightModelfv = f; return retval;}
- virtual glLightf_client_proc_t set_glLightf(glLightf_client_proc_t f) { glLightf_client_proc_t retval = glLightf; glLightf = f; return retval;}
- virtual glLightfv_client_proc_t set_glLightfv(glLightfv_client_proc_t f) { glLightfv_client_proc_t retval = glLightfv; glLightfv = f; return retval;}
- virtual glLineWidth_client_proc_t set_glLineWidth(glLineWidth_client_proc_t f) { glLineWidth_client_proc_t retval = glLineWidth; glLineWidth = f; return retval;}
- virtual glLoadMatrixf_client_proc_t set_glLoadMatrixf(glLoadMatrixf_client_proc_t f) { glLoadMatrixf_client_proc_t retval = glLoadMatrixf; glLoadMatrixf = f; return retval;}
- virtual glMaterialf_client_proc_t set_glMaterialf(glMaterialf_client_proc_t f) { glMaterialf_client_proc_t retval = glMaterialf; glMaterialf = f; return retval;}
- virtual glMaterialfv_client_proc_t set_glMaterialfv(glMaterialfv_client_proc_t f) { glMaterialfv_client_proc_t retval = glMaterialfv; glMaterialfv = f; return retval;}
- virtual glMultMatrixf_client_proc_t set_glMultMatrixf(glMultMatrixf_client_proc_t f) { glMultMatrixf_client_proc_t retval = glMultMatrixf; glMultMatrixf = f; return retval;}
- virtual glMultiTexCoord4f_client_proc_t set_glMultiTexCoord4f(glMultiTexCoord4f_client_proc_t f) { glMultiTexCoord4f_client_proc_t retval = glMultiTexCoord4f; glMultiTexCoord4f = f; return retval;}
- virtual glNormal3f_client_proc_t set_glNormal3f(glNormal3f_client_proc_t f) { glNormal3f_client_proc_t retval = glNormal3f; glNormal3f = f; return retval;}
- virtual glOrthof_client_proc_t set_glOrthof(glOrthof_client_proc_t f) { glOrthof_client_proc_t retval = glOrthof; glOrthof = f; return retval;}
- virtual glPointParameterf_client_proc_t set_glPointParameterf(glPointParameterf_client_proc_t f) { glPointParameterf_client_proc_t retval = glPointParameterf; glPointParameterf = f; return retval;}
- virtual glPointParameterfv_client_proc_t set_glPointParameterfv(glPointParameterfv_client_proc_t f) { glPointParameterfv_client_proc_t retval = glPointParameterfv; glPointParameterfv = f; return retval;}
- virtual glPointSize_client_proc_t set_glPointSize(glPointSize_client_proc_t f) { glPointSize_client_proc_t retval = glPointSize; glPointSize = f; return retval;}
- virtual glPolygonOffset_client_proc_t set_glPolygonOffset(glPolygonOffset_client_proc_t f) { glPolygonOffset_client_proc_t retval = glPolygonOffset; glPolygonOffset = f; return retval;}
- virtual glRotatef_client_proc_t set_glRotatef(glRotatef_client_proc_t f) { glRotatef_client_proc_t retval = glRotatef; glRotatef = f; return retval;}
- virtual glScalef_client_proc_t set_glScalef(glScalef_client_proc_t f) { glScalef_client_proc_t retval = glScalef; glScalef = f; return retval;}
- virtual glTexEnvf_client_proc_t set_glTexEnvf(glTexEnvf_client_proc_t f) { glTexEnvf_client_proc_t retval = glTexEnvf; glTexEnvf = f; return retval;}
- virtual glTexEnvfv_client_proc_t set_glTexEnvfv(glTexEnvfv_client_proc_t f) { glTexEnvfv_client_proc_t retval = glTexEnvfv; glTexEnvfv = f; return retval;}
- virtual glTexParameterf_client_proc_t set_glTexParameterf(glTexParameterf_client_proc_t f) { glTexParameterf_client_proc_t retval = glTexParameterf; glTexParameterf = f; return retval;}
- virtual glTexParameterfv_client_proc_t set_glTexParameterfv(glTexParameterfv_client_proc_t f) { glTexParameterfv_client_proc_t retval = glTexParameterfv; glTexParameterfv = f; return retval;}
- virtual glTranslatef_client_proc_t set_glTranslatef(glTranslatef_client_proc_t f) { glTranslatef_client_proc_t retval = glTranslatef; glTranslatef = f; return retval;}
- virtual glActiveTexture_client_proc_t set_glActiveTexture(glActiveTexture_client_proc_t f) { glActiveTexture_client_proc_t retval = glActiveTexture; glActiveTexture = f; return retval;}
- virtual glAlphaFuncx_client_proc_t set_glAlphaFuncx(glAlphaFuncx_client_proc_t f) { glAlphaFuncx_client_proc_t retval = glAlphaFuncx; glAlphaFuncx = f; return retval;}
- virtual glBindBuffer_client_proc_t set_glBindBuffer(glBindBuffer_client_proc_t f) { glBindBuffer_client_proc_t retval = glBindBuffer; glBindBuffer = f; return retval;}
- virtual glBindTexture_client_proc_t set_glBindTexture(glBindTexture_client_proc_t f) { glBindTexture_client_proc_t retval = glBindTexture; glBindTexture = f; return retval;}
- virtual glBlendFunc_client_proc_t set_glBlendFunc(glBlendFunc_client_proc_t f) { glBlendFunc_client_proc_t retval = glBlendFunc; glBlendFunc = f; return retval;}
- virtual glBufferData_client_proc_t set_glBufferData(glBufferData_client_proc_t f) { glBufferData_client_proc_t retval = glBufferData; glBufferData = f; return retval;}
- virtual glBufferSubData_client_proc_t set_glBufferSubData(glBufferSubData_client_proc_t f) { glBufferSubData_client_proc_t retval = glBufferSubData; glBufferSubData = f; return retval;}
- virtual glClear_client_proc_t set_glClear(glClear_client_proc_t f) { glClear_client_proc_t retval = glClear; glClear = f; return retval;}
- virtual glClearColorx_client_proc_t set_glClearColorx(glClearColorx_client_proc_t f) { glClearColorx_client_proc_t retval = glClearColorx; glClearColorx = f; return retval;}
- virtual glClearDepthx_client_proc_t set_glClearDepthx(glClearDepthx_client_proc_t f) { glClearDepthx_client_proc_t retval = glClearDepthx; glClearDepthx = f; return retval;}
- virtual glClearStencil_client_proc_t set_glClearStencil(glClearStencil_client_proc_t f) { glClearStencil_client_proc_t retval = glClearStencil; glClearStencil = f; return retval;}
- virtual glClientActiveTexture_client_proc_t set_glClientActiveTexture(glClientActiveTexture_client_proc_t f) { glClientActiveTexture_client_proc_t retval = glClientActiveTexture; glClientActiveTexture = f; return retval;}
- virtual glColor4ub_client_proc_t set_glColor4ub(glColor4ub_client_proc_t f) { glColor4ub_client_proc_t retval = glColor4ub; glColor4ub = f; return retval;}
- virtual glColor4x_client_proc_t set_glColor4x(glColor4x_client_proc_t f) { glColor4x_client_proc_t retval = glColor4x; glColor4x = f; return retval;}
- virtual glColorMask_client_proc_t set_glColorMask(glColorMask_client_proc_t f) { glColorMask_client_proc_t retval = glColorMask; glColorMask = f; return retval;}
- virtual glColorPointer_client_proc_t set_glColorPointer(glColorPointer_client_proc_t f) { glColorPointer_client_proc_t retval = glColorPointer; glColorPointer = f; return retval;}
- virtual glCompressedTexImage2D_client_proc_t set_glCompressedTexImage2D(glCompressedTexImage2D_client_proc_t f) { glCompressedTexImage2D_client_proc_t retval = glCompressedTexImage2D; glCompressedTexImage2D = f; return retval;}
- virtual glCompressedTexSubImage2D_client_proc_t set_glCompressedTexSubImage2D(glCompressedTexSubImage2D_client_proc_t f) { glCompressedTexSubImage2D_client_proc_t retval = glCompressedTexSubImage2D; glCompressedTexSubImage2D = f; return retval;}
- virtual glCopyTexImage2D_client_proc_t set_glCopyTexImage2D(glCopyTexImage2D_client_proc_t f) { glCopyTexImage2D_client_proc_t retval = glCopyTexImage2D; glCopyTexImage2D = f; return retval;}
- virtual glCopyTexSubImage2D_client_proc_t set_glCopyTexSubImage2D(glCopyTexSubImage2D_client_proc_t f) { glCopyTexSubImage2D_client_proc_t retval = glCopyTexSubImage2D; glCopyTexSubImage2D = f; return retval;}
- virtual glCullFace_client_proc_t set_glCullFace(glCullFace_client_proc_t f) { glCullFace_client_proc_t retval = glCullFace; glCullFace = f; return retval;}
- virtual glDeleteBuffers_client_proc_t set_glDeleteBuffers(glDeleteBuffers_client_proc_t f) { glDeleteBuffers_client_proc_t retval = glDeleteBuffers; glDeleteBuffers = f; return retval;}
- virtual glDeleteTextures_client_proc_t set_glDeleteTextures(glDeleteTextures_client_proc_t f) { glDeleteTextures_client_proc_t retval = glDeleteTextures; glDeleteTextures = f; return retval;}
- virtual glDepthFunc_client_proc_t set_glDepthFunc(glDepthFunc_client_proc_t f) { glDepthFunc_client_proc_t retval = glDepthFunc; glDepthFunc = f; return retval;}
- virtual glDepthMask_client_proc_t set_glDepthMask(glDepthMask_client_proc_t f) { glDepthMask_client_proc_t retval = glDepthMask; glDepthMask = f; return retval;}
- virtual glDepthRangex_client_proc_t set_glDepthRangex(glDepthRangex_client_proc_t f) { glDepthRangex_client_proc_t retval = glDepthRangex; glDepthRangex = f; return retval;}
- virtual glDisable_client_proc_t set_glDisable(glDisable_client_proc_t f) { glDisable_client_proc_t retval = glDisable; glDisable = f; return retval;}
- virtual glDisableClientState_client_proc_t set_glDisableClientState(glDisableClientState_client_proc_t f) { glDisableClientState_client_proc_t retval = glDisableClientState; glDisableClientState = f; return retval;}
- virtual glDrawArrays_client_proc_t set_glDrawArrays(glDrawArrays_client_proc_t f) { glDrawArrays_client_proc_t retval = glDrawArrays; glDrawArrays = f; return retval;}
- virtual glDrawElements_client_proc_t set_glDrawElements(glDrawElements_client_proc_t f) { glDrawElements_client_proc_t retval = glDrawElements; glDrawElements = f; return retval;}
- virtual glEnable_client_proc_t set_glEnable(glEnable_client_proc_t f) { glEnable_client_proc_t retval = glEnable; glEnable = f; return retval;}
- virtual glEnableClientState_client_proc_t set_glEnableClientState(glEnableClientState_client_proc_t f) { glEnableClientState_client_proc_t retval = glEnableClientState; glEnableClientState = f; return retval;}
- virtual glFinish_client_proc_t set_glFinish(glFinish_client_proc_t f) { glFinish_client_proc_t retval = glFinish; glFinish = f; return retval;}
- virtual glFlush_client_proc_t set_glFlush(glFlush_client_proc_t f) { glFlush_client_proc_t retval = glFlush; glFlush = f; return retval;}
- virtual glFogx_client_proc_t set_glFogx(glFogx_client_proc_t f) { glFogx_client_proc_t retval = glFogx; glFogx = f; return retval;}
- virtual glFogxv_client_proc_t set_glFogxv(glFogxv_client_proc_t f) { glFogxv_client_proc_t retval = glFogxv; glFogxv = f; return retval;}
- virtual glFrontFace_client_proc_t set_glFrontFace(glFrontFace_client_proc_t f) { glFrontFace_client_proc_t retval = glFrontFace; glFrontFace = f; return retval;}
- virtual glFrustumx_client_proc_t set_glFrustumx(glFrustumx_client_proc_t f) { glFrustumx_client_proc_t retval = glFrustumx; glFrustumx = f; return retval;}
- virtual glGetBooleanv_client_proc_t set_glGetBooleanv(glGetBooleanv_client_proc_t f) { glGetBooleanv_client_proc_t retval = glGetBooleanv; glGetBooleanv = f; return retval;}
- virtual glGetBufferParameteriv_client_proc_t set_glGetBufferParameteriv(glGetBufferParameteriv_client_proc_t f) { glGetBufferParameteriv_client_proc_t retval = glGetBufferParameteriv; glGetBufferParameteriv = f; return retval;}
- virtual glClipPlanex_client_proc_t set_glClipPlanex(glClipPlanex_client_proc_t f) { glClipPlanex_client_proc_t retval = glClipPlanex; glClipPlanex = f; return retval;}
- virtual glGenBuffers_client_proc_t set_glGenBuffers(glGenBuffers_client_proc_t f) { glGenBuffers_client_proc_t retval = glGenBuffers; glGenBuffers = f; return retval;}
- virtual glGenTextures_client_proc_t set_glGenTextures(glGenTextures_client_proc_t f) { glGenTextures_client_proc_t retval = glGenTextures; glGenTextures = f; return retval;}
- virtual glGetError_client_proc_t set_glGetError(glGetError_client_proc_t f) { glGetError_client_proc_t retval = glGetError; glGetError = f; return retval;}
- virtual glGetFixedv_client_proc_t set_glGetFixedv(glGetFixedv_client_proc_t f) { glGetFixedv_client_proc_t retval = glGetFixedv; glGetFixedv = f; return retval;}
- virtual glGetIntegerv_client_proc_t set_glGetIntegerv(glGetIntegerv_client_proc_t f) { glGetIntegerv_client_proc_t retval = glGetIntegerv; glGetIntegerv = f; return retval;}
- virtual glGetLightxv_client_proc_t set_glGetLightxv(glGetLightxv_client_proc_t f) { glGetLightxv_client_proc_t retval = glGetLightxv; glGetLightxv = f; return retval;}
- virtual glGetMaterialxv_client_proc_t set_glGetMaterialxv(glGetMaterialxv_client_proc_t f) { glGetMaterialxv_client_proc_t retval = glGetMaterialxv; glGetMaterialxv = f; return retval;}
- virtual glGetPointerv_client_proc_t set_glGetPointerv(glGetPointerv_client_proc_t f) { glGetPointerv_client_proc_t retval = glGetPointerv; glGetPointerv = f; return retval;}
- virtual glGetString_client_proc_t set_glGetString(glGetString_client_proc_t f) { glGetString_client_proc_t retval = glGetString; glGetString = f; return retval;}
- virtual glGetTexEnviv_client_proc_t set_glGetTexEnviv(glGetTexEnviv_client_proc_t f) { glGetTexEnviv_client_proc_t retval = glGetTexEnviv; glGetTexEnviv = f; return retval;}
- virtual glGetTexEnvxv_client_proc_t set_glGetTexEnvxv(glGetTexEnvxv_client_proc_t f) { glGetTexEnvxv_client_proc_t retval = glGetTexEnvxv; glGetTexEnvxv = f; return retval;}
- virtual glGetTexParameteriv_client_proc_t set_glGetTexParameteriv(glGetTexParameteriv_client_proc_t f) { glGetTexParameteriv_client_proc_t retval = glGetTexParameteriv; glGetTexParameteriv = f; return retval;}
- virtual glGetTexParameterxv_client_proc_t set_glGetTexParameterxv(glGetTexParameterxv_client_proc_t f) { glGetTexParameterxv_client_proc_t retval = glGetTexParameterxv; glGetTexParameterxv = f; return retval;}
- virtual glHint_client_proc_t set_glHint(glHint_client_proc_t f) { glHint_client_proc_t retval = glHint; glHint = f; return retval;}
- virtual glIsBuffer_client_proc_t set_glIsBuffer(glIsBuffer_client_proc_t f) { glIsBuffer_client_proc_t retval = glIsBuffer; glIsBuffer = f; return retval;}
- virtual glIsEnabled_client_proc_t set_glIsEnabled(glIsEnabled_client_proc_t f) { glIsEnabled_client_proc_t retval = glIsEnabled; glIsEnabled = f; return retval;}
- virtual glIsTexture_client_proc_t set_glIsTexture(glIsTexture_client_proc_t f) { glIsTexture_client_proc_t retval = glIsTexture; glIsTexture = f; return retval;}
- virtual glLightModelx_client_proc_t set_glLightModelx(glLightModelx_client_proc_t f) { glLightModelx_client_proc_t retval = glLightModelx; glLightModelx = f; return retval;}
- virtual glLightModelxv_client_proc_t set_glLightModelxv(glLightModelxv_client_proc_t f) { glLightModelxv_client_proc_t retval = glLightModelxv; glLightModelxv = f; return retval;}
- virtual glLightx_client_proc_t set_glLightx(glLightx_client_proc_t f) { glLightx_client_proc_t retval = glLightx; glLightx = f; return retval;}
- virtual glLightxv_client_proc_t set_glLightxv(glLightxv_client_proc_t f) { glLightxv_client_proc_t retval = glLightxv; glLightxv = f; return retval;}
- virtual glLineWidthx_client_proc_t set_glLineWidthx(glLineWidthx_client_proc_t f) { glLineWidthx_client_proc_t retval = glLineWidthx; glLineWidthx = f; return retval;}
- virtual glLoadIdentity_client_proc_t set_glLoadIdentity(glLoadIdentity_client_proc_t f) { glLoadIdentity_client_proc_t retval = glLoadIdentity; glLoadIdentity = f; return retval;}
- virtual glLoadMatrixx_client_proc_t set_glLoadMatrixx(glLoadMatrixx_client_proc_t f) { glLoadMatrixx_client_proc_t retval = glLoadMatrixx; glLoadMatrixx = f; return retval;}
- virtual glLogicOp_client_proc_t set_glLogicOp(glLogicOp_client_proc_t f) { glLogicOp_client_proc_t retval = glLogicOp; glLogicOp = f; return retval;}
- virtual glMaterialx_client_proc_t set_glMaterialx(glMaterialx_client_proc_t f) { glMaterialx_client_proc_t retval = glMaterialx; glMaterialx = f; return retval;}
- virtual glMaterialxv_client_proc_t set_glMaterialxv(glMaterialxv_client_proc_t f) { glMaterialxv_client_proc_t retval = glMaterialxv; glMaterialxv = f; return retval;}
- virtual glMatrixMode_client_proc_t set_glMatrixMode(glMatrixMode_client_proc_t f) { glMatrixMode_client_proc_t retval = glMatrixMode; glMatrixMode = f; return retval;}
- virtual glMultMatrixx_client_proc_t set_glMultMatrixx(glMultMatrixx_client_proc_t f) { glMultMatrixx_client_proc_t retval = glMultMatrixx; glMultMatrixx = f; return retval;}
- virtual glMultiTexCoord4x_client_proc_t set_glMultiTexCoord4x(glMultiTexCoord4x_client_proc_t f) { glMultiTexCoord4x_client_proc_t retval = glMultiTexCoord4x; glMultiTexCoord4x = f; return retval;}
- virtual glNormal3x_client_proc_t set_glNormal3x(glNormal3x_client_proc_t f) { glNormal3x_client_proc_t retval = glNormal3x; glNormal3x = f; return retval;}
- virtual glNormalPointer_client_proc_t set_glNormalPointer(glNormalPointer_client_proc_t f) { glNormalPointer_client_proc_t retval = glNormalPointer; glNormalPointer = f; return retval;}
- virtual glOrthox_client_proc_t set_glOrthox(glOrthox_client_proc_t f) { glOrthox_client_proc_t retval = glOrthox; glOrthox = f; return retval;}
- virtual glPixelStorei_client_proc_t set_glPixelStorei(glPixelStorei_client_proc_t f) { glPixelStorei_client_proc_t retval = glPixelStorei; glPixelStorei = f; return retval;}
- virtual glPointParameterx_client_proc_t set_glPointParameterx(glPointParameterx_client_proc_t f) { glPointParameterx_client_proc_t retval = glPointParameterx; glPointParameterx = f; return retval;}
- virtual glPointParameterxv_client_proc_t set_glPointParameterxv(glPointParameterxv_client_proc_t f) { glPointParameterxv_client_proc_t retval = glPointParameterxv; glPointParameterxv = f; return retval;}
- virtual glPointSizex_client_proc_t set_glPointSizex(glPointSizex_client_proc_t f) { glPointSizex_client_proc_t retval = glPointSizex; glPointSizex = f; return retval;}
- virtual glPolygonOffsetx_client_proc_t set_glPolygonOffsetx(glPolygonOffsetx_client_proc_t f) { glPolygonOffsetx_client_proc_t retval = glPolygonOffsetx; glPolygonOffsetx = f; return retval;}
- virtual glPopMatrix_client_proc_t set_glPopMatrix(glPopMatrix_client_proc_t f) { glPopMatrix_client_proc_t retval = glPopMatrix; glPopMatrix = f; return retval;}
- virtual glPushMatrix_client_proc_t set_glPushMatrix(glPushMatrix_client_proc_t f) { glPushMatrix_client_proc_t retval = glPushMatrix; glPushMatrix = f; return retval;}
- virtual glReadPixels_client_proc_t set_glReadPixels(glReadPixels_client_proc_t f) { glReadPixels_client_proc_t retval = glReadPixels; glReadPixels = f; return retval;}
- virtual glRotatex_client_proc_t set_glRotatex(glRotatex_client_proc_t f) { glRotatex_client_proc_t retval = glRotatex; glRotatex = f; return retval;}
- virtual glSampleCoverage_client_proc_t set_glSampleCoverage(glSampleCoverage_client_proc_t f) { glSampleCoverage_client_proc_t retval = glSampleCoverage; glSampleCoverage = f; return retval;}
- virtual glSampleCoveragex_client_proc_t set_glSampleCoveragex(glSampleCoveragex_client_proc_t f) { glSampleCoveragex_client_proc_t retval = glSampleCoveragex; glSampleCoveragex = f; return retval;}
- virtual glScalex_client_proc_t set_glScalex(glScalex_client_proc_t f) { glScalex_client_proc_t retval = glScalex; glScalex = f; return retval;}
- virtual glScissor_client_proc_t set_glScissor(glScissor_client_proc_t f) { glScissor_client_proc_t retval = glScissor; glScissor = f; return retval;}
- virtual glShadeModel_client_proc_t set_glShadeModel(glShadeModel_client_proc_t f) { glShadeModel_client_proc_t retval = glShadeModel; glShadeModel = f; return retval;}
- virtual glStencilFunc_client_proc_t set_glStencilFunc(glStencilFunc_client_proc_t f) { glStencilFunc_client_proc_t retval = glStencilFunc; glStencilFunc = f; return retval;}
- virtual glStencilMask_client_proc_t set_glStencilMask(glStencilMask_client_proc_t f) { glStencilMask_client_proc_t retval = glStencilMask; glStencilMask = f; return retval;}
- virtual glStencilOp_client_proc_t set_glStencilOp(glStencilOp_client_proc_t f) { glStencilOp_client_proc_t retval = glStencilOp; glStencilOp = f; return retval;}
- virtual glTexCoordPointer_client_proc_t set_glTexCoordPointer(glTexCoordPointer_client_proc_t f) { glTexCoordPointer_client_proc_t retval = glTexCoordPointer; glTexCoordPointer = f; return retval;}
- virtual glTexEnvi_client_proc_t set_glTexEnvi(glTexEnvi_client_proc_t f) { glTexEnvi_client_proc_t retval = glTexEnvi; glTexEnvi = f; return retval;}
- virtual glTexEnvx_client_proc_t set_glTexEnvx(glTexEnvx_client_proc_t f) { glTexEnvx_client_proc_t retval = glTexEnvx; glTexEnvx = f; return retval;}
- virtual glTexEnviv_client_proc_t set_glTexEnviv(glTexEnviv_client_proc_t f) { glTexEnviv_client_proc_t retval = glTexEnviv; glTexEnviv = f; return retval;}
- virtual glTexEnvxv_client_proc_t set_glTexEnvxv(glTexEnvxv_client_proc_t f) { glTexEnvxv_client_proc_t retval = glTexEnvxv; glTexEnvxv = f; return retval;}
- virtual glTexImage2D_client_proc_t set_glTexImage2D(glTexImage2D_client_proc_t f) { glTexImage2D_client_proc_t retval = glTexImage2D; glTexImage2D = f; return retval;}
- virtual glTexParameteri_client_proc_t set_glTexParameteri(glTexParameteri_client_proc_t f) { glTexParameteri_client_proc_t retval = glTexParameteri; glTexParameteri = f; return retval;}
- virtual glTexParameterx_client_proc_t set_glTexParameterx(glTexParameterx_client_proc_t f) { glTexParameterx_client_proc_t retval = glTexParameterx; glTexParameterx = f; return retval;}
- virtual glTexParameteriv_client_proc_t set_glTexParameteriv(glTexParameteriv_client_proc_t f) { glTexParameteriv_client_proc_t retval = glTexParameteriv; glTexParameteriv = f; return retval;}
- virtual glTexParameterxv_client_proc_t set_glTexParameterxv(glTexParameterxv_client_proc_t f) { glTexParameterxv_client_proc_t retval = glTexParameterxv; glTexParameterxv = f; return retval;}
- virtual glTexSubImage2D_client_proc_t set_glTexSubImage2D(glTexSubImage2D_client_proc_t f) { glTexSubImage2D_client_proc_t retval = glTexSubImage2D; glTexSubImage2D = f; return retval;}
- virtual glTranslatex_client_proc_t set_glTranslatex(glTranslatex_client_proc_t f) { glTranslatex_client_proc_t retval = glTranslatex; glTranslatex = f; return retval;}
- virtual glVertexPointer_client_proc_t set_glVertexPointer(glVertexPointer_client_proc_t f) { glVertexPointer_client_proc_t retval = glVertexPointer; glVertexPointer = f; return retval;}
- virtual glViewport_client_proc_t set_glViewport(glViewport_client_proc_t f) { glViewport_client_proc_t retval = glViewport; glViewport = f; return retval;}
- virtual glPointSizePointerOES_client_proc_t set_glPointSizePointerOES(glPointSizePointerOES_client_proc_t f) { glPointSizePointerOES_client_proc_t retval = glPointSizePointerOES; glPointSizePointerOES = f; return retval;}
- virtual glVertexPointerOffset_client_proc_t set_glVertexPointerOffset(glVertexPointerOffset_client_proc_t f) { glVertexPointerOffset_client_proc_t retval = glVertexPointerOffset; glVertexPointerOffset = f; return retval;}
- virtual glColorPointerOffset_client_proc_t set_glColorPointerOffset(glColorPointerOffset_client_proc_t f) { glColorPointerOffset_client_proc_t retval = glColorPointerOffset; glColorPointerOffset = f; return retval;}
- virtual glNormalPointerOffset_client_proc_t set_glNormalPointerOffset(glNormalPointerOffset_client_proc_t f) { glNormalPointerOffset_client_proc_t retval = glNormalPointerOffset; glNormalPointerOffset = f; return retval;}
- virtual glPointSizePointerOffset_client_proc_t set_glPointSizePointerOffset(glPointSizePointerOffset_client_proc_t f) { glPointSizePointerOffset_client_proc_t retval = glPointSizePointerOffset; glPointSizePointerOffset = f; return retval;}
- virtual glTexCoordPointerOffset_client_proc_t set_glTexCoordPointerOffset(glTexCoordPointerOffset_client_proc_t f) { glTexCoordPointerOffset_client_proc_t retval = glTexCoordPointerOffset; glTexCoordPointerOffset = f; return retval;}
- virtual glWeightPointerOffset_client_proc_t set_glWeightPointerOffset(glWeightPointerOffset_client_proc_t f) { glWeightPointerOffset_client_proc_t retval = glWeightPointerOffset; glWeightPointerOffset = f; return retval;}
- virtual glMatrixIndexPointerOffset_client_proc_t set_glMatrixIndexPointerOffset(glMatrixIndexPointerOffset_client_proc_t f) { glMatrixIndexPointerOffset_client_proc_t retval = glMatrixIndexPointerOffset; glMatrixIndexPointerOffset = f; return retval;}
- virtual glVertexPointerData_client_proc_t set_glVertexPointerData(glVertexPointerData_client_proc_t f) { glVertexPointerData_client_proc_t retval = glVertexPointerData; glVertexPointerData = f; return retval;}
- virtual glColorPointerData_client_proc_t set_glColorPointerData(glColorPointerData_client_proc_t f) { glColorPointerData_client_proc_t retval = glColorPointerData; glColorPointerData = f; return retval;}
- virtual glNormalPointerData_client_proc_t set_glNormalPointerData(glNormalPointerData_client_proc_t f) { glNormalPointerData_client_proc_t retval = glNormalPointerData; glNormalPointerData = f; return retval;}
- virtual glTexCoordPointerData_client_proc_t set_glTexCoordPointerData(glTexCoordPointerData_client_proc_t f) { glTexCoordPointerData_client_proc_t retval = glTexCoordPointerData; glTexCoordPointerData = f; return retval;}
- virtual glPointSizePointerData_client_proc_t set_glPointSizePointerData(glPointSizePointerData_client_proc_t f) { glPointSizePointerData_client_proc_t retval = glPointSizePointerData; glPointSizePointerData = f; return retval;}
- virtual glWeightPointerData_client_proc_t set_glWeightPointerData(glWeightPointerData_client_proc_t f) { glWeightPointerData_client_proc_t retval = glWeightPointerData; glWeightPointerData = f; return retval;}
- virtual glMatrixIndexPointerData_client_proc_t set_glMatrixIndexPointerData(glMatrixIndexPointerData_client_proc_t f) { glMatrixIndexPointerData_client_proc_t retval = glMatrixIndexPointerData; glMatrixIndexPointerData = f; return retval;}
- virtual glDrawElementsOffset_client_proc_t set_glDrawElementsOffset(glDrawElementsOffset_client_proc_t f) { glDrawElementsOffset_client_proc_t retval = glDrawElementsOffset; glDrawElementsOffset = f; return retval;}
- virtual glDrawElementsData_client_proc_t set_glDrawElementsData(glDrawElementsData_client_proc_t f) { glDrawElementsData_client_proc_t retval = glDrawElementsData; glDrawElementsData = f; return retval;}
- virtual glGetCompressedTextureFormats_client_proc_t set_glGetCompressedTextureFormats(glGetCompressedTextureFormats_client_proc_t f) { glGetCompressedTextureFormats_client_proc_t retval = glGetCompressedTextureFormats; glGetCompressedTextureFormats = f; return retval;}
- virtual glFinishRoundTrip_client_proc_t set_glFinishRoundTrip(glFinishRoundTrip_client_proc_t f) { glFinishRoundTrip_client_proc_t retval = glFinishRoundTrip; glFinishRoundTrip = f; return retval;}
- virtual glBlendEquationSeparateOES_client_proc_t set_glBlendEquationSeparateOES(glBlendEquationSeparateOES_client_proc_t f) { glBlendEquationSeparateOES_client_proc_t retval = glBlendEquationSeparateOES; glBlendEquationSeparateOES = f; return retval;}
- virtual glBlendFuncSeparateOES_client_proc_t set_glBlendFuncSeparateOES(glBlendFuncSeparateOES_client_proc_t f) { glBlendFuncSeparateOES_client_proc_t retval = glBlendFuncSeparateOES; glBlendFuncSeparateOES = f; return retval;}
- virtual glBlendEquationOES_client_proc_t set_glBlendEquationOES(glBlendEquationOES_client_proc_t f) { glBlendEquationOES_client_proc_t retval = glBlendEquationOES; glBlendEquationOES = f; return retval;}
- virtual glDrawTexsOES_client_proc_t set_glDrawTexsOES(glDrawTexsOES_client_proc_t f) { glDrawTexsOES_client_proc_t retval = glDrawTexsOES; glDrawTexsOES = f; return retval;}
- virtual glDrawTexiOES_client_proc_t set_glDrawTexiOES(glDrawTexiOES_client_proc_t f) { glDrawTexiOES_client_proc_t retval = glDrawTexiOES; glDrawTexiOES = f; return retval;}
- virtual glDrawTexxOES_client_proc_t set_glDrawTexxOES(glDrawTexxOES_client_proc_t f) { glDrawTexxOES_client_proc_t retval = glDrawTexxOES; glDrawTexxOES = f; return retval;}
- virtual glDrawTexsvOES_client_proc_t set_glDrawTexsvOES(glDrawTexsvOES_client_proc_t f) { glDrawTexsvOES_client_proc_t retval = glDrawTexsvOES; glDrawTexsvOES = f; return retval;}
- virtual glDrawTexivOES_client_proc_t set_glDrawTexivOES(glDrawTexivOES_client_proc_t f) { glDrawTexivOES_client_proc_t retval = glDrawTexivOES; glDrawTexivOES = f; return retval;}
- virtual glDrawTexxvOES_client_proc_t set_glDrawTexxvOES(glDrawTexxvOES_client_proc_t f) { glDrawTexxvOES_client_proc_t retval = glDrawTexxvOES; glDrawTexxvOES = f; return retval;}
- virtual glDrawTexfOES_client_proc_t set_glDrawTexfOES(glDrawTexfOES_client_proc_t f) { glDrawTexfOES_client_proc_t retval = glDrawTexfOES; glDrawTexfOES = f; return retval;}
- virtual glDrawTexfvOES_client_proc_t set_glDrawTexfvOES(glDrawTexfvOES_client_proc_t f) { glDrawTexfvOES_client_proc_t retval = glDrawTexfvOES; glDrawTexfvOES = f; return retval;}
- virtual glEGLImageTargetTexture2DOES_client_proc_t set_glEGLImageTargetTexture2DOES(glEGLImageTargetTexture2DOES_client_proc_t f) { glEGLImageTargetTexture2DOES_client_proc_t retval = glEGLImageTargetTexture2DOES; glEGLImageTargetTexture2DOES = f; return retval;}
- virtual glEGLImageTargetRenderbufferStorageOES_client_proc_t set_glEGLImageTargetRenderbufferStorageOES(glEGLImageTargetRenderbufferStorageOES_client_proc_t f) { glEGLImageTargetRenderbufferStorageOES_client_proc_t retval = glEGLImageTargetRenderbufferStorageOES; glEGLImageTargetRenderbufferStorageOES = f; return retval;}
- virtual glAlphaFuncxOES_client_proc_t set_glAlphaFuncxOES(glAlphaFuncxOES_client_proc_t f) { glAlphaFuncxOES_client_proc_t retval = glAlphaFuncxOES; glAlphaFuncxOES = f; return retval;}
- virtual glClearColorxOES_client_proc_t set_glClearColorxOES(glClearColorxOES_client_proc_t f) { glClearColorxOES_client_proc_t retval = glClearColorxOES; glClearColorxOES = f; return retval;}
- virtual glClearDepthxOES_client_proc_t set_glClearDepthxOES(glClearDepthxOES_client_proc_t f) { glClearDepthxOES_client_proc_t retval = glClearDepthxOES; glClearDepthxOES = f; return retval;}
- virtual glClipPlanexOES_client_proc_t set_glClipPlanexOES(glClipPlanexOES_client_proc_t f) { glClipPlanexOES_client_proc_t retval = glClipPlanexOES; glClipPlanexOES = f; return retval;}
- virtual glClipPlanexIMG_client_proc_t set_glClipPlanexIMG(glClipPlanexIMG_client_proc_t f) { glClipPlanexIMG_client_proc_t retval = glClipPlanexIMG; glClipPlanexIMG = f; return retval;}
- virtual glColor4xOES_client_proc_t set_glColor4xOES(glColor4xOES_client_proc_t f) { glColor4xOES_client_proc_t retval = glColor4xOES; glColor4xOES = f; return retval;}
- virtual glDepthRangexOES_client_proc_t set_glDepthRangexOES(glDepthRangexOES_client_proc_t f) { glDepthRangexOES_client_proc_t retval = glDepthRangexOES; glDepthRangexOES = f; return retval;}
- virtual glFogxOES_client_proc_t set_glFogxOES(glFogxOES_client_proc_t f) { glFogxOES_client_proc_t retval = glFogxOES; glFogxOES = f; return retval;}
- virtual glFogxvOES_client_proc_t set_glFogxvOES(glFogxvOES_client_proc_t f) { glFogxvOES_client_proc_t retval = glFogxvOES; glFogxvOES = f; return retval;}
- virtual glFrustumxOES_client_proc_t set_glFrustumxOES(glFrustumxOES_client_proc_t f) { glFrustumxOES_client_proc_t retval = glFrustumxOES; glFrustumxOES = f; return retval;}
- virtual glGetClipPlanexOES_client_proc_t set_glGetClipPlanexOES(glGetClipPlanexOES_client_proc_t f) { glGetClipPlanexOES_client_proc_t retval = glGetClipPlanexOES; glGetClipPlanexOES = f; return retval;}
- virtual glGetClipPlanex_client_proc_t set_glGetClipPlanex(glGetClipPlanex_client_proc_t f) { glGetClipPlanex_client_proc_t retval = glGetClipPlanex; glGetClipPlanex = f; return retval;}
- virtual glGetFixedvOES_client_proc_t set_glGetFixedvOES(glGetFixedvOES_client_proc_t f) { glGetFixedvOES_client_proc_t retval = glGetFixedvOES; glGetFixedvOES = f; return retval;}
- virtual glGetLightxvOES_client_proc_t set_glGetLightxvOES(glGetLightxvOES_client_proc_t f) { glGetLightxvOES_client_proc_t retval = glGetLightxvOES; glGetLightxvOES = f; return retval;}
- virtual glGetMaterialxvOES_client_proc_t set_glGetMaterialxvOES(glGetMaterialxvOES_client_proc_t f) { glGetMaterialxvOES_client_proc_t retval = glGetMaterialxvOES; glGetMaterialxvOES = f; return retval;}
- virtual glGetTexEnvxvOES_client_proc_t set_glGetTexEnvxvOES(glGetTexEnvxvOES_client_proc_t f) { glGetTexEnvxvOES_client_proc_t retval = glGetTexEnvxvOES; glGetTexEnvxvOES = f; return retval;}
- virtual glGetTexParameterxvOES_client_proc_t set_glGetTexParameterxvOES(glGetTexParameterxvOES_client_proc_t f) { glGetTexParameterxvOES_client_proc_t retval = glGetTexParameterxvOES; glGetTexParameterxvOES = f; return retval;}
- virtual glLightModelxOES_client_proc_t set_glLightModelxOES(glLightModelxOES_client_proc_t f) { glLightModelxOES_client_proc_t retval = glLightModelxOES; glLightModelxOES = f; return retval;}
- virtual glLightModelxvOES_client_proc_t set_glLightModelxvOES(glLightModelxvOES_client_proc_t f) { glLightModelxvOES_client_proc_t retval = glLightModelxvOES; glLightModelxvOES = f; return retval;}
- virtual glLightxOES_client_proc_t set_glLightxOES(glLightxOES_client_proc_t f) { glLightxOES_client_proc_t retval = glLightxOES; glLightxOES = f; return retval;}
- virtual glLightxvOES_client_proc_t set_glLightxvOES(glLightxvOES_client_proc_t f) { glLightxvOES_client_proc_t retval = glLightxvOES; glLightxvOES = f; return retval;}
- virtual glLineWidthxOES_client_proc_t set_glLineWidthxOES(glLineWidthxOES_client_proc_t f) { glLineWidthxOES_client_proc_t retval = glLineWidthxOES; glLineWidthxOES = f; return retval;}
- virtual glLoadMatrixxOES_client_proc_t set_glLoadMatrixxOES(glLoadMatrixxOES_client_proc_t f) { glLoadMatrixxOES_client_proc_t retval = glLoadMatrixxOES; glLoadMatrixxOES = f; return retval;}
- virtual glMaterialxOES_client_proc_t set_glMaterialxOES(glMaterialxOES_client_proc_t f) { glMaterialxOES_client_proc_t retval = glMaterialxOES; glMaterialxOES = f; return retval;}
- virtual glMaterialxvOES_client_proc_t set_glMaterialxvOES(glMaterialxvOES_client_proc_t f) { glMaterialxvOES_client_proc_t retval = glMaterialxvOES; glMaterialxvOES = f; return retval;}
- virtual glMultMatrixxOES_client_proc_t set_glMultMatrixxOES(glMultMatrixxOES_client_proc_t f) { glMultMatrixxOES_client_proc_t retval = glMultMatrixxOES; glMultMatrixxOES = f; return retval;}
- virtual glMultiTexCoord4xOES_client_proc_t set_glMultiTexCoord4xOES(glMultiTexCoord4xOES_client_proc_t f) { glMultiTexCoord4xOES_client_proc_t retval = glMultiTexCoord4xOES; glMultiTexCoord4xOES = f; return retval;}
- virtual glNormal3xOES_client_proc_t set_glNormal3xOES(glNormal3xOES_client_proc_t f) { glNormal3xOES_client_proc_t retval = glNormal3xOES; glNormal3xOES = f; return retval;}
- virtual glOrthoxOES_client_proc_t set_glOrthoxOES(glOrthoxOES_client_proc_t f) { glOrthoxOES_client_proc_t retval = glOrthoxOES; glOrthoxOES = f; return retval;}
- virtual glPointParameterxOES_client_proc_t set_glPointParameterxOES(glPointParameterxOES_client_proc_t f) { glPointParameterxOES_client_proc_t retval = glPointParameterxOES; glPointParameterxOES = f; return retval;}
- virtual glPointParameterxvOES_client_proc_t set_glPointParameterxvOES(glPointParameterxvOES_client_proc_t f) { glPointParameterxvOES_client_proc_t retval = glPointParameterxvOES; glPointParameterxvOES = f; return retval;}
- virtual glPointSizexOES_client_proc_t set_glPointSizexOES(glPointSizexOES_client_proc_t f) { glPointSizexOES_client_proc_t retval = glPointSizexOES; glPointSizexOES = f; return retval;}
- virtual glPolygonOffsetxOES_client_proc_t set_glPolygonOffsetxOES(glPolygonOffsetxOES_client_proc_t f) { glPolygonOffsetxOES_client_proc_t retval = glPolygonOffsetxOES; glPolygonOffsetxOES = f; return retval;}
- virtual glRotatexOES_client_proc_t set_glRotatexOES(glRotatexOES_client_proc_t f) { glRotatexOES_client_proc_t retval = glRotatexOES; glRotatexOES = f; return retval;}
- virtual glSampleCoveragexOES_client_proc_t set_glSampleCoveragexOES(glSampleCoveragexOES_client_proc_t f) { glSampleCoveragexOES_client_proc_t retval = glSampleCoveragexOES; glSampleCoveragexOES = f; return retval;}
- virtual glScalexOES_client_proc_t set_glScalexOES(glScalexOES_client_proc_t f) { glScalexOES_client_proc_t retval = glScalexOES; glScalexOES = f; return retval;}
- virtual glTexEnvxOES_client_proc_t set_glTexEnvxOES(glTexEnvxOES_client_proc_t f) { glTexEnvxOES_client_proc_t retval = glTexEnvxOES; glTexEnvxOES = f; return retval;}
- virtual glTexEnvxvOES_client_proc_t set_glTexEnvxvOES(glTexEnvxvOES_client_proc_t f) { glTexEnvxvOES_client_proc_t retval = glTexEnvxvOES; glTexEnvxvOES = f; return retval;}
- virtual glTexParameterxOES_client_proc_t set_glTexParameterxOES(glTexParameterxOES_client_proc_t f) { glTexParameterxOES_client_proc_t retval = glTexParameterxOES; glTexParameterxOES = f; return retval;}
- virtual glTexParameterxvOES_client_proc_t set_glTexParameterxvOES(glTexParameterxvOES_client_proc_t f) { glTexParameterxvOES_client_proc_t retval = glTexParameterxvOES; glTexParameterxvOES = f; return retval;}
- virtual glTranslatexOES_client_proc_t set_glTranslatexOES(glTranslatexOES_client_proc_t f) { glTranslatexOES_client_proc_t retval = glTranslatexOES; glTranslatexOES = f; return retval;}
- virtual glIsRenderbufferOES_client_proc_t set_glIsRenderbufferOES(glIsRenderbufferOES_client_proc_t f) { glIsRenderbufferOES_client_proc_t retval = glIsRenderbufferOES; glIsRenderbufferOES = f; return retval;}
- virtual glBindRenderbufferOES_client_proc_t set_glBindRenderbufferOES(glBindRenderbufferOES_client_proc_t f) { glBindRenderbufferOES_client_proc_t retval = glBindRenderbufferOES; glBindRenderbufferOES = f; return retval;}
- virtual glDeleteRenderbuffersOES_client_proc_t set_glDeleteRenderbuffersOES(glDeleteRenderbuffersOES_client_proc_t f) { glDeleteRenderbuffersOES_client_proc_t retval = glDeleteRenderbuffersOES; glDeleteRenderbuffersOES = f; return retval;}
- virtual glGenRenderbuffersOES_client_proc_t set_glGenRenderbuffersOES(glGenRenderbuffersOES_client_proc_t f) { glGenRenderbuffersOES_client_proc_t retval = glGenRenderbuffersOES; glGenRenderbuffersOES = f; return retval;}
- virtual glRenderbufferStorageOES_client_proc_t set_glRenderbufferStorageOES(glRenderbufferStorageOES_client_proc_t f) { glRenderbufferStorageOES_client_proc_t retval = glRenderbufferStorageOES; glRenderbufferStorageOES = f; return retval;}
- virtual glGetRenderbufferParameterivOES_client_proc_t set_glGetRenderbufferParameterivOES(glGetRenderbufferParameterivOES_client_proc_t f) { glGetRenderbufferParameterivOES_client_proc_t retval = glGetRenderbufferParameterivOES; glGetRenderbufferParameterivOES = f; return retval;}
- virtual glIsFramebufferOES_client_proc_t set_glIsFramebufferOES(glIsFramebufferOES_client_proc_t f) { glIsFramebufferOES_client_proc_t retval = glIsFramebufferOES; glIsFramebufferOES = f; return retval;}
- virtual glBindFramebufferOES_client_proc_t set_glBindFramebufferOES(glBindFramebufferOES_client_proc_t f) { glBindFramebufferOES_client_proc_t retval = glBindFramebufferOES; glBindFramebufferOES = f; return retval;}
- virtual glDeleteFramebuffersOES_client_proc_t set_glDeleteFramebuffersOES(glDeleteFramebuffersOES_client_proc_t f) { glDeleteFramebuffersOES_client_proc_t retval = glDeleteFramebuffersOES; glDeleteFramebuffersOES = f; return retval;}
- virtual glGenFramebuffersOES_client_proc_t set_glGenFramebuffersOES(glGenFramebuffersOES_client_proc_t f) { glGenFramebuffersOES_client_proc_t retval = glGenFramebuffersOES; glGenFramebuffersOES = f; return retval;}
- virtual glCheckFramebufferStatusOES_client_proc_t set_glCheckFramebufferStatusOES(glCheckFramebufferStatusOES_client_proc_t f) { glCheckFramebufferStatusOES_client_proc_t retval = glCheckFramebufferStatusOES; glCheckFramebufferStatusOES = f; return retval;}
- virtual glFramebufferRenderbufferOES_client_proc_t set_glFramebufferRenderbufferOES(glFramebufferRenderbufferOES_client_proc_t f) { glFramebufferRenderbufferOES_client_proc_t retval = glFramebufferRenderbufferOES; glFramebufferRenderbufferOES = f; return retval;}
- virtual glFramebufferTexture2DOES_client_proc_t set_glFramebufferTexture2DOES(glFramebufferTexture2DOES_client_proc_t f) { glFramebufferTexture2DOES_client_proc_t retval = glFramebufferTexture2DOES; glFramebufferTexture2DOES = f; return retval;}
- virtual glGetFramebufferAttachmentParameterivOES_client_proc_t set_glGetFramebufferAttachmentParameterivOES(glGetFramebufferAttachmentParameterivOES_client_proc_t f) { glGetFramebufferAttachmentParameterivOES_client_proc_t retval = glGetFramebufferAttachmentParameterivOES; glGetFramebufferAttachmentParameterivOES = f; return retval;}
- virtual glGenerateMipmapOES_client_proc_t set_glGenerateMipmapOES(glGenerateMipmapOES_client_proc_t f) { glGenerateMipmapOES_client_proc_t retval = glGenerateMipmapOES; glGenerateMipmapOES = f; return retval;}
- virtual glMapBufferOES_client_proc_t set_glMapBufferOES(glMapBufferOES_client_proc_t f) { glMapBufferOES_client_proc_t retval = glMapBufferOES; glMapBufferOES = f; return retval;}
- virtual glUnmapBufferOES_client_proc_t set_glUnmapBufferOES(glUnmapBufferOES_client_proc_t f) { glUnmapBufferOES_client_proc_t retval = glUnmapBufferOES; glUnmapBufferOES = f; return retval;}
- virtual glGetBufferPointervOES_client_proc_t set_glGetBufferPointervOES(glGetBufferPointervOES_client_proc_t f) { glGetBufferPointervOES_client_proc_t retval = glGetBufferPointervOES; glGetBufferPointervOES = f; return retval;}
- virtual glCurrentPaletteMatrixOES_client_proc_t set_glCurrentPaletteMatrixOES(glCurrentPaletteMatrixOES_client_proc_t f) { glCurrentPaletteMatrixOES_client_proc_t retval = glCurrentPaletteMatrixOES; glCurrentPaletteMatrixOES = f; return retval;}
- virtual glLoadPaletteFromModelViewMatrixOES_client_proc_t set_glLoadPaletteFromModelViewMatrixOES(glLoadPaletteFromModelViewMatrixOES_client_proc_t f) { glLoadPaletteFromModelViewMatrixOES_client_proc_t retval = glLoadPaletteFromModelViewMatrixOES; glLoadPaletteFromModelViewMatrixOES = f; return retval;}
- virtual glMatrixIndexPointerOES_client_proc_t set_glMatrixIndexPointerOES(glMatrixIndexPointerOES_client_proc_t f) { glMatrixIndexPointerOES_client_proc_t retval = glMatrixIndexPointerOES; glMatrixIndexPointerOES = f; return retval;}
- virtual glWeightPointerOES_client_proc_t set_glWeightPointerOES(glWeightPointerOES_client_proc_t f) { glWeightPointerOES_client_proc_t retval = glWeightPointerOES; glWeightPointerOES = f; return retval;}
- virtual glQueryMatrixxOES_client_proc_t set_glQueryMatrixxOES(glQueryMatrixxOES_client_proc_t f) { glQueryMatrixxOES_client_proc_t retval = glQueryMatrixxOES; glQueryMatrixxOES = f; return retval;}
- virtual glDepthRangefOES_client_proc_t set_glDepthRangefOES(glDepthRangefOES_client_proc_t f) { glDepthRangefOES_client_proc_t retval = glDepthRangefOES; glDepthRangefOES = f; return retval;}
- virtual glFrustumfOES_client_proc_t set_glFrustumfOES(glFrustumfOES_client_proc_t f) { glFrustumfOES_client_proc_t retval = glFrustumfOES; glFrustumfOES = f; return retval;}
- virtual glOrthofOES_client_proc_t set_glOrthofOES(glOrthofOES_client_proc_t f) { glOrthofOES_client_proc_t retval = glOrthofOES; glOrthofOES = f; return retval;}
- virtual glClipPlanefOES_client_proc_t set_glClipPlanefOES(glClipPlanefOES_client_proc_t f) { glClipPlanefOES_client_proc_t retval = glClipPlanefOES; glClipPlanefOES = f; return retval;}
- virtual glClipPlanefIMG_client_proc_t set_glClipPlanefIMG(glClipPlanefIMG_client_proc_t f) { glClipPlanefIMG_client_proc_t retval = glClipPlanefIMG; glClipPlanefIMG = f; return retval;}
- virtual glGetClipPlanefOES_client_proc_t set_glGetClipPlanefOES(glGetClipPlanefOES_client_proc_t f) { glGetClipPlanefOES_client_proc_t retval = glGetClipPlanefOES; glGetClipPlanefOES = f; return retval;}
- virtual glClearDepthfOES_client_proc_t set_glClearDepthfOES(glClearDepthfOES_client_proc_t f) { glClearDepthfOES_client_proc_t retval = glClearDepthfOES; glClearDepthfOES = f; return retval;}
- virtual glTexGenfOES_client_proc_t set_glTexGenfOES(glTexGenfOES_client_proc_t f) { glTexGenfOES_client_proc_t retval = glTexGenfOES; glTexGenfOES = f; return retval;}
- virtual glTexGenfvOES_client_proc_t set_glTexGenfvOES(glTexGenfvOES_client_proc_t f) { glTexGenfvOES_client_proc_t retval = glTexGenfvOES; glTexGenfvOES = f; return retval;}
- virtual glTexGeniOES_client_proc_t set_glTexGeniOES(glTexGeniOES_client_proc_t f) { glTexGeniOES_client_proc_t retval = glTexGeniOES; glTexGeniOES = f; return retval;}
- virtual glTexGenivOES_client_proc_t set_glTexGenivOES(glTexGenivOES_client_proc_t f) { glTexGenivOES_client_proc_t retval = glTexGenivOES; glTexGenivOES = f; return retval;}
- virtual glTexGenxOES_client_proc_t set_glTexGenxOES(glTexGenxOES_client_proc_t f) { glTexGenxOES_client_proc_t retval = glTexGenxOES; glTexGenxOES = f; return retval;}
- virtual glTexGenxvOES_client_proc_t set_glTexGenxvOES(glTexGenxvOES_client_proc_t f) { glTexGenxvOES_client_proc_t retval = glTexGenxvOES; glTexGenxvOES = f; return retval;}
- virtual glGetTexGenfvOES_client_proc_t set_glGetTexGenfvOES(glGetTexGenfvOES_client_proc_t f) { glGetTexGenfvOES_client_proc_t retval = glGetTexGenfvOES; glGetTexGenfvOES = f; return retval;}
- virtual glGetTexGenivOES_client_proc_t set_glGetTexGenivOES(glGetTexGenivOES_client_proc_t f) { glGetTexGenivOES_client_proc_t retval = glGetTexGenivOES; glGetTexGenivOES = f; return retval;}
- virtual glGetTexGenxvOES_client_proc_t set_glGetTexGenxvOES(glGetTexGenxvOES_client_proc_t f) { glGetTexGenxvOES_client_proc_t retval = glGetTexGenxvOES; glGetTexGenxvOES = f; return retval;}
- virtual glBindVertexArrayOES_client_proc_t set_glBindVertexArrayOES(glBindVertexArrayOES_client_proc_t f) { glBindVertexArrayOES_client_proc_t retval = glBindVertexArrayOES; glBindVertexArrayOES = f; return retval;}
- virtual glDeleteVertexArraysOES_client_proc_t set_glDeleteVertexArraysOES(glDeleteVertexArraysOES_client_proc_t f) { glDeleteVertexArraysOES_client_proc_t retval = glDeleteVertexArraysOES; glDeleteVertexArraysOES = f; return retval;}
- virtual glGenVertexArraysOES_client_proc_t set_glGenVertexArraysOES(glGenVertexArraysOES_client_proc_t f) { glGenVertexArraysOES_client_proc_t retval = glGenVertexArraysOES; glGenVertexArraysOES = f; return retval;}
- virtual glIsVertexArrayOES_client_proc_t set_glIsVertexArrayOES(glIsVertexArrayOES_client_proc_t f) { glIsVertexArrayOES_client_proc_t retval = glIsVertexArrayOES; glIsVertexArrayOES = f; return retval;}
- virtual glDiscardFramebufferEXT_client_proc_t set_glDiscardFramebufferEXT(glDiscardFramebufferEXT_client_proc_t f) { glDiscardFramebufferEXT_client_proc_t retval = glDiscardFramebufferEXT; glDiscardFramebufferEXT = f; return retval;}
- virtual glMultiDrawArraysEXT_client_proc_t set_glMultiDrawArraysEXT(glMultiDrawArraysEXT_client_proc_t f) { glMultiDrawArraysEXT_client_proc_t retval = glMultiDrawArraysEXT; glMultiDrawArraysEXT = f; return retval;}
- virtual glMultiDrawElementsEXT_client_proc_t set_glMultiDrawElementsEXT(glMultiDrawElementsEXT_client_proc_t f) { glMultiDrawElementsEXT_client_proc_t retval = glMultiDrawElementsEXT; glMultiDrawElementsEXT = f; return retval;}
- virtual glMultiDrawArraysSUN_client_proc_t set_glMultiDrawArraysSUN(glMultiDrawArraysSUN_client_proc_t f) { glMultiDrawArraysSUN_client_proc_t retval = glMultiDrawArraysSUN; glMultiDrawArraysSUN = f; return retval;}
- virtual glMultiDrawElementsSUN_client_proc_t set_glMultiDrawElementsSUN(glMultiDrawElementsSUN_client_proc_t f) { glMultiDrawElementsSUN_client_proc_t retval = glMultiDrawElementsSUN; glMultiDrawElementsSUN = f; return retval;}
- virtual glRenderbufferStorageMultisampleIMG_client_proc_t set_glRenderbufferStorageMultisampleIMG(glRenderbufferStorageMultisampleIMG_client_proc_t f) { glRenderbufferStorageMultisampleIMG_client_proc_t retval = glRenderbufferStorageMultisampleIMG; glRenderbufferStorageMultisampleIMG = f; return retval;}
- virtual glFramebufferTexture2DMultisampleIMG_client_proc_t set_glFramebufferTexture2DMultisampleIMG(glFramebufferTexture2DMultisampleIMG_client_proc_t f) { glFramebufferTexture2DMultisampleIMG_client_proc_t retval = glFramebufferTexture2DMultisampleIMG; glFramebufferTexture2DMultisampleIMG = f; return retval;}
- virtual glDeleteFencesNV_client_proc_t set_glDeleteFencesNV(glDeleteFencesNV_client_proc_t f) { glDeleteFencesNV_client_proc_t retval = glDeleteFencesNV; glDeleteFencesNV = f; return retval;}
- virtual glGenFencesNV_client_proc_t set_glGenFencesNV(glGenFencesNV_client_proc_t f) { glGenFencesNV_client_proc_t retval = glGenFencesNV; glGenFencesNV = f; return retval;}
- virtual glIsFenceNV_client_proc_t set_glIsFenceNV(glIsFenceNV_client_proc_t f) { glIsFenceNV_client_proc_t retval = glIsFenceNV; glIsFenceNV = f; return retval;}
- virtual glTestFenceNV_client_proc_t set_glTestFenceNV(glTestFenceNV_client_proc_t f) { glTestFenceNV_client_proc_t retval = glTestFenceNV; glTestFenceNV = f; return retval;}
- virtual glGetFenceivNV_client_proc_t set_glGetFenceivNV(glGetFenceivNV_client_proc_t f) { glGetFenceivNV_client_proc_t retval = glGetFenceivNV; glGetFenceivNV = f; return retval;}
- virtual glFinishFenceNV_client_proc_t set_glFinishFenceNV(glFinishFenceNV_client_proc_t f) { glFinishFenceNV_client_proc_t retval = glFinishFenceNV; glFinishFenceNV = f; return retval;}
- virtual glSetFenceNV_client_proc_t set_glSetFenceNV(glSetFenceNV_client_proc_t f) { glSetFenceNV_client_proc_t retval = glSetFenceNV; glSetFenceNV = f; return retval;}
- virtual glGetDriverControlsQCOM_client_proc_t set_glGetDriverControlsQCOM(glGetDriverControlsQCOM_client_proc_t f) { glGetDriverControlsQCOM_client_proc_t retval = glGetDriverControlsQCOM; glGetDriverControlsQCOM = f; return retval;}
- virtual glGetDriverControlStringQCOM_client_proc_t set_glGetDriverControlStringQCOM(glGetDriverControlStringQCOM_client_proc_t f) { glGetDriverControlStringQCOM_client_proc_t retval = glGetDriverControlStringQCOM; glGetDriverControlStringQCOM = f; return retval;}
- virtual glEnableDriverControlQCOM_client_proc_t set_glEnableDriverControlQCOM(glEnableDriverControlQCOM_client_proc_t f) { glEnableDriverControlQCOM_client_proc_t retval = glEnableDriverControlQCOM; glEnableDriverControlQCOM = f; return retval;}
- virtual glDisableDriverControlQCOM_client_proc_t set_glDisableDriverControlQCOM(glDisableDriverControlQCOM_client_proc_t f) { glDisableDriverControlQCOM_client_proc_t retval = glDisableDriverControlQCOM; glDisableDriverControlQCOM = f; return retval;}
- virtual glExtGetTexturesQCOM_client_proc_t set_glExtGetTexturesQCOM(glExtGetTexturesQCOM_client_proc_t f) { glExtGetTexturesQCOM_client_proc_t retval = glExtGetTexturesQCOM; glExtGetTexturesQCOM = f; return retval;}
- virtual glExtGetBuffersQCOM_client_proc_t set_glExtGetBuffersQCOM(glExtGetBuffersQCOM_client_proc_t f) { glExtGetBuffersQCOM_client_proc_t retval = glExtGetBuffersQCOM; glExtGetBuffersQCOM = f; return retval;}
- virtual glExtGetRenderbuffersQCOM_client_proc_t set_glExtGetRenderbuffersQCOM(glExtGetRenderbuffersQCOM_client_proc_t f) { glExtGetRenderbuffersQCOM_client_proc_t retval = glExtGetRenderbuffersQCOM; glExtGetRenderbuffersQCOM = f; return retval;}
- virtual glExtGetFramebuffersQCOM_client_proc_t set_glExtGetFramebuffersQCOM(glExtGetFramebuffersQCOM_client_proc_t f) { glExtGetFramebuffersQCOM_client_proc_t retval = glExtGetFramebuffersQCOM; glExtGetFramebuffersQCOM = f; return retval;}
- virtual glExtGetTexLevelParameterivQCOM_client_proc_t set_glExtGetTexLevelParameterivQCOM(glExtGetTexLevelParameterivQCOM_client_proc_t f) { glExtGetTexLevelParameterivQCOM_client_proc_t retval = glExtGetTexLevelParameterivQCOM; glExtGetTexLevelParameterivQCOM = f; return retval;}
- virtual glExtTexObjectStateOverrideiQCOM_client_proc_t set_glExtTexObjectStateOverrideiQCOM(glExtTexObjectStateOverrideiQCOM_client_proc_t f) { glExtTexObjectStateOverrideiQCOM_client_proc_t retval = glExtTexObjectStateOverrideiQCOM; glExtTexObjectStateOverrideiQCOM = f; return retval;}
- virtual glExtGetTexSubImageQCOM_client_proc_t set_glExtGetTexSubImageQCOM(glExtGetTexSubImageQCOM_client_proc_t f) { glExtGetTexSubImageQCOM_client_proc_t retval = glExtGetTexSubImageQCOM; glExtGetTexSubImageQCOM = f; return retval;}
- virtual glExtGetBufferPointervQCOM_client_proc_t set_glExtGetBufferPointervQCOM(glExtGetBufferPointervQCOM_client_proc_t f) { glExtGetBufferPointervQCOM_client_proc_t retval = glExtGetBufferPointervQCOM; glExtGetBufferPointervQCOM = f; return retval;}
- virtual glExtGetShadersQCOM_client_proc_t set_glExtGetShadersQCOM(glExtGetShadersQCOM_client_proc_t f) { glExtGetShadersQCOM_client_proc_t retval = glExtGetShadersQCOM; glExtGetShadersQCOM = f; return retval;}
- virtual glExtGetProgramsQCOM_client_proc_t set_glExtGetProgramsQCOM(glExtGetProgramsQCOM_client_proc_t f) { glExtGetProgramsQCOM_client_proc_t retval = glExtGetProgramsQCOM; glExtGetProgramsQCOM = f; return retval;}
- virtual glExtIsProgramBinaryQCOM_client_proc_t set_glExtIsProgramBinaryQCOM(glExtIsProgramBinaryQCOM_client_proc_t f) { glExtIsProgramBinaryQCOM_client_proc_t retval = glExtIsProgramBinaryQCOM; glExtIsProgramBinaryQCOM = f; return retval;}
- virtual glExtGetProgramBinarySourceQCOM_client_proc_t set_glExtGetProgramBinarySourceQCOM(glExtGetProgramBinarySourceQCOM_client_proc_t f) { glExtGetProgramBinarySourceQCOM_client_proc_t retval = glExtGetProgramBinarySourceQCOM; glExtGetProgramBinarySourceQCOM = f; return retval;}
- virtual glStartTilingQCOM_client_proc_t set_glStartTilingQCOM(glStartTilingQCOM_client_proc_t f) { glStartTilingQCOM_client_proc_t retval = glStartTilingQCOM; glStartTilingQCOM = f; return retval;}
- virtual glEndTilingQCOM_client_proc_t set_glEndTilingQCOM(glEndTilingQCOM_client_proc_t f) { glEndTilingQCOM_client_proc_t retval = glEndTilingQCOM; glEndTilingQCOM = f; return retval;}
- virtual ~gl_client_context_t() {}
-
- typedef gl_client_context_t *CONTEXT_ACCESSOR_TYPE(void);
- static void setContextAccessor(CONTEXT_ACCESSOR_TYPE *f);
- int initDispatchByName( void *(*getProc)(const char *name, void *userData), void *userData);
- virtual void setError(unsigned int error){};
- virtual unsigned int getError(){ return 0; };
-};
-
-#endif
diff --git a/tools/emulator/opengl/system/GLESv1_enc/gl_client_proc.h b/tools/emulator/opengl/system/GLESv1_enc/gl_client_proc.h
deleted file mode 100644
index a18865774..000000000
--- a/tools/emulator/opengl/system/GLESv1_enc/gl_client_proc.h
+++ /dev/null
@@ -1,305 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-#ifndef __gl_client_proc_t_h
-#define __gl_client_proc_t_h
-
-
-
-#include "gl_types.h"
-#ifndef gl_APIENTRY
-#define gl_APIENTRY
-#endif
-typedef void (gl_APIENTRY *glAlphaFunc_client_proc_t) (void * ctx, GLenum, GLclampf);
-typedef void (gl_APIENTRY *glClearColor_client_proc_t) (void * ctx, GLclampf, GLclampf, GLclampf, GLclampf);
-typedef void (gl_APIENTRY *glClearDepthf_client_proc_t) (void * ctx, GLclampf);
-typedef void (gl_APIENTRY *glClipPlanef_client_proc_t) (void * ctx, GLenum, const GLfloat*);
-typedef void (gl_APIENTRY *glColor4f_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (gl_APIENTRY *glDepthRangef_client_proc_t) (void * ctx, GLclampf, GLclampf);
-typedef void (gl_APIENTRY *glFogf_client_proc_t) (void * ctx, GLenum, GLfloat);
-typedef void (gl_APIENTRY *glFogfv_client_proc_t) (void * ctx, GLenum, const GLfloat*);
-typedef void (gl_APIENTRY *glFrustumf_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (gl_APIENTRY *glGetClipPlanef_client_proc_t) (void * ctx, GLenum, GLfloat*);
-typedef void (gl_APIENTRY *glGetFloatv_client_proc_t) (void * ctx, GLenum, GLfloat*);
-typedef void (gl_APIENTRY *glGetLightfv_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat*);
-typedef void (gl_APIENTRY *glGetMaterialfv_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat*);
-typedef void (gl_APIENTRY *glGetTexEnvfv_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat*);
-typedef void (gl_APIENTRY *glGetTexParameterfv_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat*);
-typedef void (gl_APIENTRY *glLightModelf_client_proc_t) (void * ctx, GLenum, GLfloat);
-typedef void (gl_APIENTRY *glLightModelfv_client_proc_t) (void * ctx, GLenum, const GLfloat*);
-typedef void (gl_APIENTRY *glLightf_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat);
-typedef void (gl_APIENTRY *glLightfv_client_proc_t) (void * ctx, GLenum, GLenum, const GLfloat*);
-typedef void (gl_APIENTRY *glLineWidth_client_proc_t) (void * ctx, GLfloat);
-typedef void (gl_APIENTRY *glLoadMatrixf_client_proc_t) (void * ctx, const GLfloat*);
-typedef void (gl_APIENTRY *glMaterialf_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat);
-typedef void (gl_APIENTRY *glMaterialfv_client_proc_t) (void * ctx, GLenum, GLenum, const GLfloat*);
-typedef void (gl_APIENTRY *glMultMatrixf_client_proc_t) (void * ctx, const GLfloat*);
-typedef void (gl_APIENTRY *glMultiTexCoord4f_client_proc_t) (void * ctx, GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (gl_APIENTRY *glNormal3f_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat);
-typedef void (gl_APIENTRY *glOrthof_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (gl_APIENTRY *glPointParameterf_client_proc_t) (void * ctx, GLenum, GLfloat);
-typedef void (gl_APIENTRY *glPointParameterfv_client_proc_t) (void * ctx, GLenum, const GLfloat*);
-typedef void (gl_APIENTRY *glPointSize_client_proc_t) (void * ctx, GLfloat);
-typedef void (gl_APIENTRY *glPolygonOffset_client_proc_t) (void * ctx, GLfloat, GLfloat);
-typedef void (gl_APIENTRY *glRotatef_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (gl_APIENTRY *glScalef_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat);
-typedef void (gl_APIENTRY *glTexEnvf_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat);
-typedef void (gl_APIENTRY *glTexEnvfv_client_proc_t) (void * ctx, GLenum, GLenum, const GLfloat*);
-typedef void (gl_APIENTRY *glTexParameterf_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat);
-typedef void (gl_APIENTRY *glTexParameterfv_client_proc_t) (void * ctx, GLenum, GLenum, const GLfloat*);
-typedef void (gl_APIENTRY *glTranslatef_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat);
-typedef void (gl_APIENTRY *glActiveTexture_client_proc_t) (void * ctx, GLenum);
-typedef void (gl_APIENTRY *glAlphaFuncx_client_proc_t) (void * ctx, GLenum, GLclampx);
-typedef void (gl_APIENTRY *glBindBuffer_client_proc_t) (void * ctx, GLenum, GLuint);
-typedef void (gl_APIENTRY *glBindTexture_client_proc_t) (void * ctx, GLenum, GLuint);
-typedef void (gl_APIENTRY *glBlendFunc_client_proc_t) (void * ctx, GLenum, GLenum);
-typedef void (gl_APIENTRY *glBufferData_client_proc_t) (void * ctx, GLenum, GLsizeiptr, const GLvoid*, GLenum);
-typedef void (gl_APIENTRY *glBufferSubData_client_proc_t) (void * ctx, GLenum, GLintptr, GLsizeiptr, const GLvoid*);
-typedef void (gl_APIENTRY *glClear_client_proc_t) (void * ctx, GLbitfield);
-typedef void (gl_APIENTRY *glClearColorx_client_proc_t) (void * ctx, GLclampx, GLclampx, GLclampx, GLclampx);
-typedef void (gl_APIENTRY *glClearDepthx_client_proc_t) (void * ctx, GLclampx);
-typedef void (gl_APIENTRY *glClearStencil_client_proc_t) (void * ctx, GLint);
-typedef void (gl_APIENTRY *glClientActiveTexture_client_proc_t) (void * ctx, GLenum);
-typedef void (gl_APIENTRY *glColor4ub_client_proc_t) (void * ctx, GLubyte, GLubyte, GLubyte, GLubyte);
-typedef void (gl_APIENTRY *glColor4x_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (gl_APIENTRY *glColorMask_client_proc_t) (void * ctx, GLboolean, GLboolean, GLboolean, GLboolean);
-typedef void (gl_APIENTRY *glColorPointer_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, const GLvoid*);
-typedef void (gl_APIENTRY *glCompressedTexImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*);
-typedef void (gl_APIENTRY *glCompressedTexSubImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*);
-typedef void (gl_APIENTRY *glCopyTexImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
-typedef void (gl_APIENTRY *glCopyTexSubImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
-typedef void (gl_APIENTRY *glCullFace_client_proc_t) (void * ctx, GLenum);
-typedef void (gl_APIENTRY *glDeleteBuffers_client_proc_t) (void * ctx, GLsizei, const GLuint*);
-typedef void (gl_APIENTRY *glDeleteTextures_client_proc_t) (void * ctx, GLsizei, const GLuint*);
-typedef void (gl_APIENTRY *glDepthFunc_client_proc_t) (void * ctx, GLenum);
-typedef void (gl_APIENTRY *glDepthMask_client_proc_t) (void * ctx, GLboolean);
-typedef void (gl_APIENTRY *glDepthRangex_client_proc_t) (void * ctx, GLclampx, GLclampx);
-typedef void (gl_APIENTRY *glDisable_client_proc_t) (void * ctx, GLenum);
-typedef void (gl_APIENTRY *glDisableClientState_client_proc_t) (void * ctx, GLenum);
-typedef void (gl_APIENTRY *glDrawArrays_client_proc_t) (void * ctx, GLenum, GLint, GLsizei);
-typedef void (gl_APIENTRY *glDrawElements_client_proc_t) (void * ctx, GLenum, GLsizei, GLenum, const GLvoid*);
-typedef void (gl_APIENTRY *glEnable_client_proc_t) (void * ctx, GLenum);
-typedef void (gl_APIENTRY *glEnableClientState_client_proc_t) (void * ctx, GLenum);
-typedef void (gl_APIENTRY *glFinish_client_proc_t) (void * ctx);
-typedef void (gl_APIENTRY *glFlush_client_proc_t) (void * ctx);
-typedef void (gl_APIENTRY *glFogx_client_proc_t) (void * ctx, GLenum, GLfixed);
-typedef void (gl_APIENTRY *glFogxv_client_proc_t) (void * ctx, GLenum, const GLfixed*);
-typedef void (gl_APIENTRY *glFrontFace_client_proc_t) (void * ctx, GLenum);
-typedef void (gl_APIENTRY *glFrustumx_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (gl_APIENTRY *glGetBooleanv_client_proc_t) (void * ctx, GLenum, GLboolean*);
-typedef void (gl_APIENTRY *glGetBufferParameteriv_client_proc_t) (void * ctx, GLenum, GLenum, GLint*);
-typedef void (gl_APIENTRY *glClipPlanex_client_proc_t) (void * ctx, GLenum, const GLfixed*);
-typedef void (gl_APIENTRY *glGenBuffers_client_proc_t) (void * ctx, GLsizei, GLuint*);
-typedef void (gl_APIENTRY *glGenTextures_client_proc_t) (void * ctx, GLsizei, GLuint*);
-typedef GLenum (gl_APIENTRY *glGetError_client_proc_t) (void * ctx);
-typedef void (gl_APIENTRY *glGetFixedv_client_proc_t) (void * ctx, GLenum, GLfixed*);
-typedef void (gl_APIENTRY *glGetIntegerv_client_proc_t) (void * ctx, GLenum, GLint*);
-typedef void (gl_APIENTRY *glGetLightxv_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed*);
-typedef void (gl_APIENTRY *glGetMaterialxv_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed*);
-typedef void (gl_APIENTRY *glGetPointerv_client_proc_t) (void * ctx, GLenum, GLvoid**);
-typedef const GLubyte* (gl_APIENTRY *glGetString_client_proc_t) (void * ctx, GLenum);
-typedef void (gl_APIENTRY *glGetTexEnviv_client_proc_t) (void * ctx, GLenum, GLenum, GLint*);
-typedef void (gl_APIENTRY *glGetTexEnvxv_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed*);
-typedef void (gl_APIENTRY *glGetTexParameteriv_client_proc_t) (void * ctx, GLenum, GLenum, GLint*);
-typedef void (gl_APIENTRY *glGetTexParameterxv_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed*);
-typedef void (gl_APIENTRY *glHint_client_proc_t) (void * ctx, GLenum, GLenum);
-typedef GLboolean (gl_APIENTRY *glIsBuffer_client_proc_t) (void * ctx, GLuint);
-typedef GLboolean (gl_APIENTRY *glIsEnabled_client_proc_t) (void * ctx, GLenum);
-typedef GLboolean (gl_APIENTRY *glIsTexture_client_proc_t) (void * ctx, GLuint);
-typedef void (gl_APIENTRY *glLightModelx_client_proc_t) (void * ctx, GLenum, GLfixed);
-typedef void (gl_APIENTRY *glLightModelxv_client_proc_t) (void * ctx, GLenum, const GLfixed*);
-typedef void (gl_APIENTRY *glLightx_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed);
-typedef void (gl_APIENTRY *glLightxv_client_proc_t) (void * ctx, GLenum, GLenum, const GLfixed*);
-typedef void (gl_APIENTRY *glLineWidthx_client_proc_t) (void * ctx, GLfixed);
-typedef void (gl_APIENTRY *glLoadIdentity_client_proc_t) (void * ctx);
-typedef void (gl_APIENTRY *glLoadMatrixx_client_proc_t) (void * ctx, const GLfixed*);
-typedef void (gl_APIENTRY *glLogicOp_client_proc_t) (void * ctx, GLenum);
-typedef void (gl_APIENTRY *glMaterialx_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed);
-typedef void (gl_APIENTRY *glMaterialxv_client_proc_t) (void * ctx, GLenum, GLenum, const GLfixed*);
-typedef void (gl_APIENTRY *glMatrixMode_client_proc_t) (void * ctx, GLenum);
-typedef void (gl_APIENTRY *glMultMatrixx_client_proc_t) (void * ctx, const GLfixed*);
-typedef void (gl_APIENTRY *glMultiTexCoord4x_client_proc_t) (void * ctx, GLenum, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (gl_APIENTRY *glNormal3x_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed);
-typedef void (gl_APIENTRY *glNormalPointer_client_proc_t) (void * ctx, GLenum, GLsizei, const GLvoid*);
-typedef void (gl_APIENTRY *glOrthox_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (gl_APIENTRY *glPixelStorei_client_proc_t) (void * ctx, GLenum, GLint);
-typedef void (gl_APIENTRY *glPointParameterx_client_proc_t) (void * ctx, GLenum, GLfixed);
-typedef void (gl_APIENTRY *glPointParameterxv_client_proc_t) (void * ctx, GLenum, const GLfixed*);
-typedef void (gl_APIENTRY *glPointSizex_client_proc_t) (void * ctx, GLfixed);
-typedef void (gl_APIENTRY *glPolygonOffsetx_client_proc_t) (void * ctx, GLfixed, GLfixed);
-typedef void (gl_APIENTRY *glPopMatrix_client_proc_t) (void * ctx);
-typedef void (gl_APIENTRY *glPushMatrix_client_proc_t) (void * ctx);
-typedef void (gl_APIENTRY *glReadPixels_client_proc_t) (void * ctx, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*);
-typedef void (gl_APIENTRY *glRotatex_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (gl_APIENTRY *glSampleCoverage_client_proc_t) (void * ctx, GLclampf, GLboolean);
-typedef void (gl_APIENTRY *glSampleCoveragex_client_proc_t) (void * ctx, GLclampx, GLboolean);
-typedef void (gl_APIENTRY *glScalex_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed);
-typedef void (gl_APIENTRY *glScissor_client_proc_t) (void * ctx, GLint, GLint, GLsizei, GLsizei);
-typedef void (gl_APIENTRY *glShadeModel_client_proc_t) (void * ctx, GLenum);
-typedef void (gl_APIENTRY *glStencilFunc_client_proc_t) (void * ctx, GLenum, GLint, GLuint);
-typedef void (gl_APIENTRY *glStencilMask_client_proc_t) (void * ctx, GLuint);
-typedef void (gl_APIENTRY *glStencilOp_client_proc_t) (void * ctx, GLenum, GLenum, GLenum);
-typedef void (gl_APIENTRY *glTexCoordPointer_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, const GLvoid*);
-typedef void (gl_APIENTRY *glTexEnvi_client_proc_t) (void * ctx, GLenum, GLenum, GLint);
-typedef void (gl_APIENTRY *glTexEnvx_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed);
-typedef void (gl_APIENTRY *glTexEnviv_client_proc_t) (void * ctx, GLenum, GLenum, const GLint*);
-typedef void (gl_APIENTRY *glTexEnvxv_client_proc_t) (void * ctx, GLenum, GLenum, const GLfixed*);
-typedef void (gl_APIENTRY *glTexImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*);
-typedef void (gl_APIENTRY *glTexParameteri_client_proc_t) (void * ctx, GLenum, GLenum, GLint);
-typedef void (gl_APIENTRY *glTexParameterx_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed);
-typedef void (gl_APIENTRY *glTexParameteriv_client_proc_t) (void * ctx, GLenum, GLenum, const GLint*);
-typedef void (gl_APIENTRY *glTexParameterxv_client_proc_t) (void * ctx, GLenum, GLenum, const GLfixed*);
-typedef void (gl_APIENTRY *glTexSubImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*);
-typedef void (gl_APIENTRY *glTranslatex_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed);
-typedef void (gl_APIENTRY *glVertexPointer_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, const GLvoid*);
-typedef void (gl_APIENTRY *glViewport_client_proc_t) (void * ctx, GLint, GLint, GLsizei, GLsizei);
-typedef void (gl_APIENTRY *glPointSizePointerOES_client_proc_t) (void * ctx, GLenum, GLsizei, const GLvoid*);
-typedef void (gl_APIENTRY *glVertexPointerOffset_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, GLuint);
-typedef void (gl_APIENTRY *glColorPointerOffset_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, GLuint);
-typedef void (gl_APIENTRY *glNormalPointerOffset_client_proc_t) (void * ctx, GLenum, GLsizei, GLuint);
-typedef void (gl_APIENTRY *glPointSizePointerOffset_client_proc_t) (void * ctx, GLenum, GLsizei, GLuint);
-typedef void (gl_APIENTRY *glTexCoordPointerOffset_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, GLuint);
-typedef void (gl_APIENTRY *glWeightPointerOffset_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, GLuint);
-typedef void (gl_APIENTRY *glMatrixIndexPointerOffset_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, GLuint);
-typedef void (gl_APIENTRY *glVertexPointerData_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, void*, GLuint);
-typedef void (gl_APIENTRY *glColorPointerData_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, void*, GLuint);
-typedef void (gl_APIENTRY *glNormalPointerData_client_proc_t) (void * ctx, GLenum, GLsizei, void*, GLuint);
-typedef void (gl_APIENTRY *glTexCoordPointerData_client_proc_t) (void * ctx, GLint, GLint, GLenum, GLsizei, void*, GLuint);
-typedef void (gl_APIENTRY *glPointSizePointerData_client_proc_t) (void * ctx, GLenum, GLsizei, void*, GLuint);
-typedef void (gl_APIENTRY *glWeightPointerData_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, void*, GLuint);
-typedef void (gl_APIENTRY *glMatrixIndexPointerData_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, void*, GLuint);
-typedef void (gl_APIENTRY *glDrawElementsOffset_client_proc_t) (void * ctx, GLenum, GLsizei, GLenum, GLuint);
-typedef void (gl_APIENTRY *glDrawElementsData_client_proc_t) (void * ctx, GLenum, GLsizei, GLenum, void*, GLuint);
-typedef void (gl_APIENTRY *glGetCompressedTextureFormats_client_proc_t) (void * ctx, int, GLint*);
-typedef int (gl_APIENTRY *glFinishRoundTrip_client_proc_t) (void * ctx);
-typedef void (gl_APIENTRY *glBlendEquationSeparateOES_client_proc_t) (void * ctx, GLenum, GLenum);
-typedef void (gl_APIENTRY *glBlendFuncSeparateOES_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLenum);
-typedef void (gl_APIENTRY *glBlendEquationOES_client_proc_t) (void * ctx, GLenum);
-typedef void (gl_APIENTRY *glDrawTexsOES_client_proc_t) (void * ctx, GLshort, GLshort, GLshort, GLshort, GLshort);
-typedef void (gl_APIENTRY *glDrawTexiOES_client_proc_t) (void * ctx, GLint, GLint, GLint, GLint, GLint);
-typedef void (gl_APIENTRY *glDrawTexxOES_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (gl_APIENTRY *glDrawTexsvOES_client_proc_t) (void * ctx, const GLshort*);
-typedef void (gl_APIENTRY *glDrawTexivOES_client_proc_t) (void * ctx, const GLint*);
-typedef void (gl_APIENTRY *glDrawTexxvOES_client_proc_t) (void * ctx, const GLfixed*);
-typedef void (gl_APIENTRY *glDrawTexfOES_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (gl_APIENTRY *glDrawTexfvOES_client_proc_t) (void * ctx, const GLfloat*);
-typedef void (gl_APIENTRY *glEGLImageTargetTexture2DOES_client_proc_t) (void * ctx, GLenum, GLeglImageOES);
-typedef void (gl_APIENTRY *glEGLImageTargetRenderbufferStorageOES_client_proc_t) (void * ctx, GLenum, GLeglImageOES);
-typedef void (gl_APIENTRY *glAlphaFuncxOES_client_proc_t) (void * ctx, GLenum, GLclampx);
-typedef void (gl_APIENTRY *glClearColorxOES_client_proc_t) (void * ctx, GLclampx, GLclampx, GLclampx, GLclampx);
-typedef void (gl_APIENTRY *glClearDepthxOES_client_proc_t) (void * ctx, GLclampx);
-typedef void (gl_APIENTRY *glClipPlanexOES_client_proc_t) (void * ctx, GLenum, const GLfixed*);
-typedef void (gl_APIENTRY *glClipPlanexIMG_client_proc_t) (void * ctx, GLenum, const GLfixed*);
-typedef void (gl_APIENTRY *glColor4xOES_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (gl_APIENTRY *glDepthRangexOES_client_proc_t) (void * ctx, GLclampx, GLclampx);
-typedef void (gl_APIENTRY *glFogxOES_client_proc_t) (void * ctx, GLenum, GLfixed);
-typedef void (gl_APIENTRY *glFogxvOES_client_proc_t) (void * ctx, GLenum, const GLfixed*);
-typedef void (gl_APIENTRY *glFrustumxOES_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (gl_APIENTRY *glGetClipPlanexOES_client_proc_t) (void * ctx, GLenum, GLfixed*);
-typedef void (gl_APIENTRY *glGetClipPlanex_client_proc_t) (void * ctx, GLenum, GLfixed*);
-typedef void (gl_APIENTRY *glGetFixedvOES_client_proc_t) (void * ctx, GLenum, GLfixed*);
-typedef void (gl_APIENTRY *glGetLightxvOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed*);
-typedef void (gl_APIENTRY *glGetMaterialxvOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed*);
-typedef void (gl_APIENTRY *glGetTexEnvxvOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed*);
-typedef void (gl_APIENTRY *glGetTexParameterxvOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed*);
-typedef void (gl_APIENTRY *glLightModelxOES_client_proc_t) (void * ctx, GLenum, GLfixed);
-typedef void (gl_APIENTRY *glLightModelxvOES_client_proc_t) (void * ctx, GLenum, const GLfixed*);
-typedef void (gl_APIENTRY *glLightxOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed);
-typedef void (gl_APIENTRY *glLightxvOES_client_proc_t) (void * ctx, GLenum, GLenum, const GLfixed*);
-typedef void (gl_APIENTRY *glLineWidthxOES_client_proc_t) (void * ctx, GLfixed);
-typedef void (gl_APIENTRY *glLoadMatrixxOES_client_proc_t) (void * ctx, const GLfixed*);
-typedef void (gl_APIENTRY *glMaterialxOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed);
-typedef void (gl_APIENTRY *glMaterialxvOES_client_proc_t) (void * ctx, GLenum, GLenum, const GLfixed*);
-typedef void (gl_APIENTRY *glMultMatrixxOES_client_proc_t) (void * ctx, const GLfixed*);
-typedef void (gl_APIENTRY *glMultiTexCoord4xOES_client_proc_t) (void * ctx, GLenum, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (gl_APIENTRY *glNormal3xOES_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed);
-typedef void (gl_APIENTRY *glOrthoxOES_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (gl_APIENTRY *glPointParameterxOES_client_proc_t) (void * ctx, GLenum, GLfixed);
-typedef void (gl_APIENTRY *glPointParameterxvOES_client_proc_t) (void * ctx, GLenum, const GLfixed*);
-typedef void (gl_APIENTRY *glPointSizexOES_client_proc_t) (void * ctx, GLfixed);
-typedef void (gl_APIENTRY *glPolygonOffsetxOES_client_proc_t) (void * ctx, GLfixed, GLfixed);
-typedef void (gl_APIENTRY *glRotatexOES_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (gl_APIENTRY *glSampleCoveragexOES_client_proc_t) (void * ctx, GLclampx, GLboolean);
-typedef void (gl_APIENTRY *glScalexOES_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed);
-typedef void (gl_APIENTRY *glTexEnvxOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed);
-typedef void (gl_APIENTRY *glTexEnvxvOES_client_proc_t) (void * ctx, GLenum, GLenum, const GLfixed*);
-typedef void (gl_APIENTRY *glTexParameterxOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed);
-typedef void (gl_APIENTRY *glTexParameterxvOES_client_proc_t) (void * ctx, GLenum, GLenum, const GLfixed*);
-typedef void (gl_APIENTRY *glTranslatexOES_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed);
-typedef GLboolean (gl_APIENTRY *glIsRenderbufferOES_client_proc_t) (void * ctx, GLuint);
-typedef void (gl_APIENTRY *glBindRenderbufferOES_client_proc_t) (void * ctx, GLenum, GLuint);
-typedef void (gl_APIENTRY *glDeleteRenderbuffersOES_client_proc_t) (void * ctx, GLsizei, const GLuint*);
-typedef void (gl_APIENTRY *glGenRenderbuffersOES_client_proc_t) (void * ctx, GLsizei, GLuint*);
-typedef void (gl_APIENTRY *glRenderbufferStorageOES_client_proc_t) (void * ctx, GLenum, GLenum, GLsizei, GLsizei);
-typedef void (gl_APIENTRY *glGetRenderbufferParameterivOES_client_proc_t) (void * ctx, GLenum, GLenum, GLint*);
-typedef GLboolean (gl_APIENTRY *glIsFramebufferOES_client_proc_t) (void * ctx, GLuint);
-typedef void (gl_APIENTRY *glBindFramebufferOES_client_proc_t) (void * ctx, GLenum, GLuint);
-typedef void (gl_APIENTRY *glDeleteFramebuffersOES_client_proc_t) (void * ctx, GLsizei, const GLuint*);
-typedef void (gl_APIENTRY *glGenFramebuffersOES_client_proc_t) (void * ctx, GLsizei, GLuint*);
-typedef GLenum (gl_APIENTRY *glCheckFramebufferStatusOES_client_proc_t) (void * ctx, GLenum);
-typedef void (gl_APIENTRY *glFramebufferRenderbufferOES_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLuint);
-typedef void (gl_APIENTRY *glFramebufferTexture2DOES_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLuint, GLint);
-typedef void (gl_APIENTRY *glGetFramebufferAttachmentParameterivOES_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLint*);
-typedef void (gl_APIENTRY *glGenerateMipmapOES_client_proc_t) (void * ctx, GLenum);
-typedef void* (gl_APIENTRY *glMapBufferOES_client_proc_t) (void * ctx, GLenum, GLenum);
-typedef GLboolean (gl_APIENTRY *glUnmapBufferOES_client_proc_t) (void * ctx, GLenum);
-typedef void (gl_APIENTRY *glGetBufferPointervOES_client_proc_t) (void * ctx, GLenum, GLenum, GLvoid**);
-typedef void (gl_APIENTRY *glCurrentPaletteMatrixOES_client_proc_t) (void * ctx, GLuint);
-typedef void (gl_APIENTRY *glLoadPaletteFromModelViewMatrixOES_client_proc_t) (void * ctx);
-typedef void (gl_APIENTRY *glMatrixIndexPointerOES_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, const GLvoid*);
-typedef void (gl_APIENTRY *glWeightPointerOES_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, const GLvoid*);
-typedef GLbitfield (gl_APIENTRY *glQueryMatrixxOES_client_proc_t) (void * ctx, GLfixed*, GLint*);
-typedef void (gl_APIENTRY *glDepthRangefOES_client_proc_t) (void * ctx, GLclampf, GLclampf);
-typedef void (gl_APIENTRY *glFrustumfOES_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (gl_APIENTRY *glOrthofOES_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (gl_APIENTRY *glClipPlanefOES_client_proc_t) (void * ctx, GLenum, const GLfloat*);
-typedef void (gl_APIENTRY *glClipPlanefIMG_client_proc_t) (void * ctx, GLenum, const GLfloat*);
-typedef void (gl_APIENTRY *glGetClipPlanefOES_client_proc_t) (void * ctx, GLenum, GLfloat*);
-typedef void (gl_APIENTRY *glClearDepthfOES_client_proc_t) (void * ctx, GLclampf);
-typedef void (gl_APIENTRY *glTexGenfOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat);
-typedef void (gl_APIENTRY *glTexGenfvOES_client_proc_t) (void * ctx, GLenum, GLenum, const GLfloat*);
-typedef void (gl_APIENTRY *glTexGeniOES_client_proc_t) (void * ctx, GLenum, GLenum, GLint);
-typedef void (gl_APIENTRY *glTexGenivOES_client_proc_t) (void * ctx, GLenum, GLenum, const GLint*);
-typedef void (gl_APIENTRY *glTexGenxOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed);
-typedef void (gl_APIENTRY *glTexGenxvOES_client_proc_t) (void * ctx, GLenum, GLenum, const GLfixed*);
-typedef void (gl_APIENTRY *glGetTexGenfvOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat*);
-typedef void (gl_APIENTRY *glGetTexGenivOES_client_proc_t) (void * ctx, GLenum, GLenum, GLint*);
-typedef void (gl_APIENTRY *glGetTexGenxvOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed*);
-typedef void (gl_APIENTRY *glBindVertexArrayOES_client_proc_t) (void * ctx, GLuint);
-typedef void (gl_APIENTRY *glDeleteVertexArraysOES_client_proc_t) (void * ctx, GLsizei, const GLuint*);
-typedef void (gl_APIENTRY *glGenVertexArraysOES_client_proc_t) (void * ctx, GLsizei, GLuint*);
-typedef GLboolean (gl_APIENTRY *glIsVertexArrayOES_client_proc_t) (void * ctx, GLuint);
-typedef void (gl_APIENTRY *glDiscardFramebufferEXT_client_proc_t) (void * ctx, GLenum, GLsizei, const GLenum*);
-typedef void (gl_APIENTRY *glMultiDrawArraysEXT_client_proc_t) (void * ctx, GLenum, GLint*, GLsizei*, GLsizei);
-typedef void (gl_APIENTRY *glMultiDrawElementsEXT_client_proc_t) (void * ctx, GLenum, const GLsizei*, GLenum, const GLvoid**, GLsizei);
-typedef void (gl_APIENTRY *glMultiDrawArraysSUN_client_proc_t) (void * ctx, GLenum, GLint*, GLsizei*, GLsizei);
-typedef void (gl_APIENTRY *glMultiDrawElementsSUN_client_proc_t) (void * ctx, GLenum, const GLsizei*, GLenum, const GLvoid**, GLsizei);
-typedef void (gl_APIENTRY *glRenderbufferStorageMultisampleIMG_client_proc_t) (void * ctx, GLenum, GLsizei, GLenum, GLsizei, GLsizei);
-typedef void (gl_APIENTRY *glFramebufferTexture2DMultisampleIMG_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
-typedef void (gl_APIENTRY *glDeleteFencesNV_client_proc_t) (void * ctx, GLsizei, const GLuint*);
-typedef void (gl_APIENTRY *glGenFencesNV_client_proc_t) (void * ctx, GLsizei, GLuint*);
-typedef GLboolean (gl_APIENTRY *glIsFenceNV_client_proc_t) (void * ctx, GLuint);
-typedef GLboolean (gl_APIENTRY *glTestFenceNV_client_proc_t) (void * ctx, GLuint);
-typedef void (gl_APIENTRY *glGetFenceivNV_client_proc_t) (void * ctx, GLuint, GLenum, GLint*);
-typedef void (gl_APIENTRY *glFinishFenceNV_client_proc_t) (void * ctx, GLuint);
-typedef void (gl_APIENTRY *glSetFenceNV_client_proc_t) (void * ctx, GLuint, GLenum);
-typedef void (gl_APIENTRY *glGetDriverControlsQCOM_client_proc_t) (void * ctx, GLint*, GLsizei, GLuint*);
-typedef void (gl_APIENTRY *glGetDriverControlStringQCOM_client_proc_t) (void * ctx, GLuint, GLsizei, GLsizei*, GLchar*);
-typedef void (gl_APIENTRY *glEnableDriverControlQCOM_client_proc_t) (void * ctx, GLuint);
-typedef void (gl_APIENTRY *glDisableDriverControlQCOM_client_proc_t) (void * ctx, GLuint);
-typedef void (gl_APIENTRY *glExtGetTexturesQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
-typedef void (gl_APIENTRY *glExtGetBuffersQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
-typedef void (gl_APIENTRY *glExtGetRenderbuffersQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
-typedef void (gl_APIENTRY *glExtGetFramebuffersQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
-typedef void (gl_APIENTRY *glExtGetTexLevelParameterivQCOM_client_proc_t) (void * ctx, GLuint, GLenum, GLint, GLenum, GLint*);
-typedef void (gl_APIENTRY *glExtTexObjectStateOverrideiQCOM_client_proc_t) (void * ctx, GLenum, GLenum, GLint);
-typedef void (gl_APIENTRY *glExtGetTexSubImageQCOM_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLvoid*);
-typedef void (gl_APIENTRY *glExtGetBufferPointervQCOM_client_proc_t) (void * ctx, GLenum, GLvoid**);
-typedef void (gl_APIENTRY *glExtGetShadersQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
-typedef void (gl_APIENTRY *glExtGetProgramsQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
-typedef GLboolean (gl_APIENTRY *glExtIsProgramBinaryQCOM_client_proc_t) (void * ctx, GLuint);
-typedef void (gl_APIENTRY *glExtGetProgramBinarySourceQCOM_client_proc_t) (void * ctx, GLuint, GLenum, GLchar*, GLint*);
-typedef void (gl_APIENTRY *glStartTilingQCOM_client_proc_t) (void * ctx, GLuint, GLuint, GLuint, GLuint, GLbitfield);
-typedef void (gl_APIENTRY *glEndTilingQCOM_client_proc_t) (void * ctx, GLbitfield);
-
-
-#endif
diff --git a/tools/emulator/opengl/system/GLESv1_enc/gl_enc.cpp b/tools/emulator/opengl/system/GLESv1_enc/gl_enc.cpp
deleted file mode 100644
index 0a343df63..000000000
--- a/tools/emulator/opengl/system/GLESv1_enc/gl_enc.cpp
+++ /dev/null
@@ -1,5184 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-
-
-#include <string.h>
-#include "gl_opcodes.h"
-
-#include "gl_enc.h"
-
-
-#include <stdio.h>
-static void enc_unsupported()
-{
- ALOGE("Function is unsupported\n");
-}
-
-void glAlphaFunc_enc(void *self , GLenum func, GLclampf ref)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glAlphaFunc;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &func, 4); ptr += 4;
- memcpy(ptr, &ref, 4); ptr += 4;
-}
-
-void glClearColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClearColor;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &red, 4); ptr += 4;
- memcpy(ptr, &green, 4); ptr += 4;
- memcpy(ptr, &blue, 4); ptr += 4;
- memcpy(ptr, &alpha, 4); ptr += 4;
-}
-
-void glClearDepthf_enc(void *self , GLclampf depth)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClearDepthf;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &depth, 4); ptr += 4;
-}
-
-void glClipPlanef_enc(void *self , GLenum plane, const GLfloat* equation)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_equation = (4 * sizeof(float));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_equation + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClipPlanef;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &plane, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_equation; ptr += 4;
- memcpy(ptr, equation, __size_equation);ptr += __size_equation;
-}
-
-void glColor4f_enc(void *self , GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glColor4f;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &red, 4); ptr += 4;
- memcpy(ptr, &green, 4); ptr += 4;
- memcpy(ptr, &blue, 4); ptr += 4;
- memcpy(ptr, &alpha, 4); ptr += 4;
-}
-
-void glDepthRangef_enc(void *self , GLclampf zNear, GLclampf zFar)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDepthRangef;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &zNear, 4); ptr += 4;
- memcpy(ptr, &zFar, 4); ptr += 4;
-}
-
-void glFogf_enc(void *self , GLenum pname, GLfloat param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFogf;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glFogfv_enc(void *self , GLenum pname, const GLfloat* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFogfv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glFrustumf_enc(void *self , GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFrustumf;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &left, 4); ptr += 4;
- memcpy(ptr, &right, 4); ptr += 4;
- memcpy(ptr, &bottom, 4); ptr += 4;
- memcpy(ptr, &top, 4); ptr += 4;
- memcpy(ptr, &zNear, 4); ptr += 4;
- memcpy(ptr, &zFar, 4); ptr += 4;
-}
-
-void glGetClipPlanef_enc(void *self , GLenum pname, GLfloat* eqn)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_eqn = (4 * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_eqn + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetClipPlanef;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_eqn; ptr += 4;
- stream->readback(eqn, __size_eqn);
-}
-
-void glGetFloatv_enc(void *self , GLenum pname, GLfloat* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetFloatv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetLightfv_enc(void *self , GLenum light, GLenum pname, GLfloat* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetLightfv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &light, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetMaterialfv_enc(void *self , GLenum face, GLenum pname, GLfloat* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetMaterialfv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &face, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetTexEnvfv_enc(void *self , GLenum env, GLenum pname, GLfloat* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetTexEnvfv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &env, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetTexParameterfv_enc(void *self , GLenum target, GLenum pname, GLfloat* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glLightModelf_enc(void *self , GLenum pname, GLfloat param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLightModelf;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glLightModelfv_enc(void *self , GLenum pname, const GLfloat* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLightModelfv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glLightf_enc(void *self , GLenum light, GLenum pname, GLfloat param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLightf;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &light, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glLightfv_enc(void *self , GLenum light, GLenum pname, const GLfloat* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLightfv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &light, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glLineWidth_enc(void *self , GLfloat width)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLineWidth;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &width, 4); ptr += 4;
-}
-
-void glLoadMatrixf_enc(void *self , const GLfloat* m)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_m = (16 * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_m + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLoadMatrixf;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_m; ptr += 4;
- memcpy(ptr, m, __size_m);ptr += __size_m;
-}
-
-void glMaterialf_enc(void *self , GLenum face, GLenum pname, GLfloat param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glMaterialf;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &face, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glMaterialfv_enc(void *self , GLenum face, GLenum pname, const GLfloat* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glMaterialfv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &face, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glMultMatrixf_enc(void *self , const GLfloat* m)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_m = (16 * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_m + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glMultMatrixf;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_m; ptr += 4;
- memcpy(ptr, m, __size_m);ptr += __size_m;
-}
-
-void glMultiTexCoord4f_enc(void *self , GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glMultiTexCoord4f;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &s, 4); ptr += 4;
- memcpy(ptr, &t, 4); ptr += 4;
- memcpy(ptr, &r, 4); ptr += 4;
- memcpy(ptr, &q, 4); ptr += 4;
-}
-
-void glNormal3f_enc(void *self , GLfloat nx, GLfloat ny, GLfloat nz)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glNormal3f;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &nx, 4); ptr += 4;
- memcpy(ptr, &ny, 4); ptr += 4;
- memcpy(ptr, &nz, 4); ptr += 4;
-}
-
-void glOrthof_enc(void *self , GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glOrthof;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &left, 4); ptr += 4;
- memcpy(ptr, &right, 4); ptr += 4;
- memcpy(ptr, &bottom, 4); ptr += 4;
- memcpy(ptr, &top, 4); ptr += 4;
- memcpy(ptr, &zNear, 4); ptr += 4;
- memcpy(ptr, &zFar, 4); ptr += 4;
-}
-
-void glPointParameterf_enc(void *self , GLenum pname, GLfloat param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glPointParameterf;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glPointParameterfv_enc(void *self , GLenum pname, const GLfloat* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glPointParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glPointSize_enc(void *self , GLfloat size)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glPointSize;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &size, 4); ptr += 4;
-}
-
-void glPolygonOffset_enc(void *self , GLfloat factor, GLfloat units)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glPolygonOffset;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &factor, 4); ptr += 4;
- memcpy(ptr, &units, 4); ptr += 4;
-}
-
-void glRotatef_enc(void *self , GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glRotatef;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &angle, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &z, 4); ptr += 4;
-}
-
-void glScalef_enc(void *self , GLfloat x, GLfloat y, GLfloat z)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glScalef;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &z, 4); ptr += 4;
-}
-
-void glTexEnvf_enc(void *self , GLenum target, GLenum pname, GLfloat param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexEnvf;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glTexEnvfv_enc(void *self , GLenum target, GLenum pname, const GLfloat* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexEnvfv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glTexParameterf_enc(void *self , GLenum target, GLenum pname, GLfloat param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexParameterf;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glTexParameterfv_enc(void *self , GLenum target, GLenum pname, const GLfloat* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glTranslatef_enc(void *self , GLfloat x, GLfloat y, GLfloat z)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTranslatef;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &z, 4); ptr += 4;
-}
-
-void glActiveTexture_enc(void *self , GLenum texture)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glActiveTexture;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &texture, 4); ptr += 4;
-}
-
-void glAlphaFuncx_enc(void *self , GLenum func, GLclampx ref)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glAlphaFuncx;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &func, 4); ptr += 4;
- memcpy(ptr, &ref, 4); ptr += 4;
-}
-
-void glBindBuffer_enc(void *self , GLenum target, GLuint buffer)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBindBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &buffer, 4); ptr += 4;
-}
-
-void glBindTexture_enc(void *self , GLenum target, GLuint texture)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBindTexture;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &texture, 4); ptr += 4;
-}
-
-void glBlendFunc_enc(void *self , GLenum sfactor, GLenum dfactor)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBlendFunc;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &sfactor, 4); ptr += 4;
- memcpy(ptr, &dfactor, 4); ptr += 4;
-}
-
-void glBufferData_enc(void *self , GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = size;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_data + 4 + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBufferData;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &size, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_data; ptr += 4;
- memcpy(ptr, data, __size_data);ptr += __size_data;
- memcpy(ptr, &usage, 4); ptr += 4;
-}
-
-void glBufferSubData_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = size;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + __size_data + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBufferSubData;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &offset, 4); ptr += 4;
- memcpy(ptr, &size, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_data; ptr += 4;
- memcpy(ptr, data, __size_data);ptr += __size_data;
-}
-
-void glClear_enc(void *self , GLbitfield mask)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClear;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &mask, 4); ptr += 4;
-}
-
-void glClearColorx_enc(void *self , GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClearColorx;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &red, 4); ptr += 4;
- memcpy(ptr, &green, 4); ptr += 4;
- memcpy(ptr, &blue, 4); ptr += 4;
- memcpy(ptr, &alpha, 4); ptr += 4;
-}
-
-void glClearDepthx_enc(void *self , GLclampx depth)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClearDepthx;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &depth, 4); ptr += 4;
-}
-
-void glClearStencil_enc(void *self , GLint s)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClearStencil;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &s, 4); ptr += 4;
-}
-
-void glClientActiveTexture_enc(void *self , GLenum texture)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClientActiveTexture;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &texture, 4); ptr += 4;
-}
-
-void glColor4ub_enc(void *self , GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 1 + 1 + 1 + 1;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glColor4ub;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &red, 1); ptr += 1;
- memcpy(ptr, &green, 1); ptr += 1;
- memcpy(ptr, &blue, 1); ptr += 1;
- memcpy(ptr, &alpha, 1); ptr += 1;
-}
-
-void glColor4x_enc(void *self , GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glColor4x;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &red, 4); ptr += 4;
- memcpy(ptr, &green, 4); ptr += 4;
- memcpy(ptr, &blue, 4); ptr += 4;
- memcpy(ptr, &alpha, 4); ptr += 4;
-}
-
-void glColorMask_enc(void *self , GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 1 + 1 + 1 + 1;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glColorMask;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &red, 1); ptr += 1;
- memcpy(ptr, &green, 1); ptr += 1;
- memcpy(ptr, &blue, 1); ptr += 1;
- memcpy(ptr, &alpha, 1); ptr += 1;
-}
-
-void glCompressedTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glCompressedTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &internalformat, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &border, 4); ptr += 4;
- memcpy(ptr, &imageSize, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_data; ptr += 4;
- if (data != NULL) memcpy(ptr, data, __size_data);ptr += __size_data;
-}
-
-void glCompressedTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = imageSize;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glCompressedTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &xoffset, 4); ptr += 4;
- memcpy(ptr, &yoffset, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &format, 4); ptr += 4;
- memcpy(ptr, &imageSize, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_data; ptr += 4;
- memcpy(ptr, data, __size_data);ptr += __size_data;
-}
-
-void glCopyTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glCopyTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &internalformat, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &border, 4); ptr += 4;
-}
-
-void glCopyTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glCopyTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &xoffset, 4); ptr += 4;
- memcpy(ptr, &yoffset, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
-}
-
-void glCullFace_enc(void *self , GLenum mode)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glCullFace;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &mode, 4); ptr += 4;
-}
-
-void glDeleteBuffers_enc(void *self , GLsizei n, const GLuint* buffers)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_buffers = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_buffers + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDeleteBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_buffers; ptr += 4;
- memcpy(ptr, buffers, __size_buffers);ptr += __size_buffers;
-}
-
-void glDeleteTextures_enc(void *self , GLsizei n, const GLuint* textures)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_textures = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_textures + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDeleteTextures;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_textures; ptr += 4;
- memcpy(ptr, textures, __size_textures);ptr += __size_textures;
-}
-
-void glDepthFunc_enc(void *self , GLenum func)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDepthFunc;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &func, 4); ptr += 4;
-}
-
-void glDepthMask_enc(void *self , GLboolean flag)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 1;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDepthMask;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &flag, 1); ptr += 1;
-}
-
-void glDepthRangex_enc(void *self , GLclampx zNear, GLclampx zFar)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDepthRangex;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &zNear, 4); ptr += 4;
- memcpy(ptr, &zFar, 4); ptr += 4;
-}
-
-void glDisable_enc(void *self , GLenum cap)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDisable;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &cap, 4); ptr += 4;
-}
-
-void glDisableClientState_enc(void *self , GLenum array)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDisableClientState;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &array, 4); ptr += 4;
-}
-
-void glDrawArrays_enc(void *self , GLenum mode, GLint first, GLsizei count)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDrawArrays;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &mode, 4); ptr += 4;
- memcpy(ptr, &first, 4); ptr += 4;
- memcpy(ptr, &count, 4); ptr += 4;
-}
-
-void glEnable_enc(void *self , GLenum cap)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glEnable;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &cap, 4); ptr += 4;
-}
-
-void glEnableClientState_enc(void *self , GLenum array)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glEnableClientState;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &array, 4); ptr += 4;
-}
-
-void glFinish_enc(void *self )
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 0;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFinish;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
-}
-
-void glFlush_enc(void *self )
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 0;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFlush;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
-}
-
-void glFogx_enc(void *self , GLenum pname, GLfixed param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFogx;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glFogxv_enc(void *self , GLenum pname, const GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFogxv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glFrontFace_enc(void *self , GLenum mode)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFrontFace;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &mode, 4); ptr += 4;
-}
-
-void glFrustumx_enc(void *self , GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFrustumx;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &left, 4); ptr += 4;
- memcpy(ptr, &right, 4); ptr += 4;
- memcpy(ptr, &bottom, 4); ptr += 4;
- memcpy(ptr, &top, 4); ptr += 4;
- memcpy(ptr, &zNear, 4); ptr += 4;
- memcpy(ptr, &zFar, 4); ptr += 4;
-}
-
-void glGetBooleanv_enc(void *self , GLenum pname, GLboolean* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLboolean));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetBooleanv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetBufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetBufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glClipPlanex_enc(void *self , GLenum pname, const GLfixed* eqn)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_eqn = (4 * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_eqn + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClipPlanex;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_eqn; ptr += 4;
- memcpy(ptr, eqn, __size_eqn);ptr += __size_eqn;
-}
-
-void glGenBuffers_enc(void *self , GLsizei n, GLuint* buffers)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_buffers = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_buffers + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGenBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_buffers; ptr += 4;
- stream->readback(buffers, __size_buffers);
-}
-
-void glGenTextures_enc(void *self , GLsizei n, GLuint* textures)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_textures = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_textures + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGenTextures;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_textures; ptr += 4;
- stream->readback(textures, __size_textures);
-}
-
-GLenum glGetError_enc(void *self )
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 0;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetError;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
-
- GLenum retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-void glGetFixedv_enc(void *self , GLenum pname, GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetFixedv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetIntegerv_enc(void *self , GLenum pname, GLint* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetIntegerv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetLightxv_enc(void *self , GLenum light, GLenum pname, GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetLightxv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &light, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetMaterialxv_enc(void *self , GLenum face, GLenum pname, GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetMaterialxv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &face, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetTexEnviv_enc(void *self , GLenum env, GLenum pname, GLint* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetTexEnviv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &env, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetTexEnvxv_enc(void *self , GLenum env, GLenum pname, GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetTexEnvxv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &env, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetTexParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetTexParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetTexParameterxv_enc(void *self , GLenum target, GLenum pname, GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetTexParameterxv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glHint_enc(void *self , GLenum target, GLenum mode)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glHint;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &mode, 4); ptr += 4;
-}
-
-GLboolean glIsBuffer_enc(void *self , GLuint buffer)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glIsBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &buffer, 4); ptr += 4;
-
- GLboolean retval;
- stream->readback(&retval, 1);
- return retval;
-}
-
-GLboolean glIsEnabled_enc(void *self , GLenum cap)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glIsEnabled;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &cap, 4); ptr += 4;
-
- GLboolean retval;
- stream->readback(&retval, 1);
- return retval;
-}
-
-GLboolean glIsTexture_enc(void *self , GLuint texture)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glIsTexture;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &texture, 4); ptr += 4;
-
- GLboolean retval;
- stream->readback(&retval, 1);
- return retval;
-}
-
-void glLightModelx_enc(void *self , GLenum pname, GLfixed param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLightModelx;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glLightModelxv_enc(void *self , GLenum pname, const GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLightModelxv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glLightx_enc(void *self , GLenum light, GLenum pname, GLfixed param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLightx;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &light, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glLightxv_enc(void *self , GLenum light, GLenum pname, const GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLightxv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &light, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glLineWidthx_enc(void *self , GLfixed width)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLineWidthx;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &width, 4); ptr += 4;
-}
-
-void glLoadIdentity_enc(void *self )
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 0;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLoadIdentity;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
-}
-
-void glLoadMatrixx_enc(void *self , const GLfixed* m)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_m = (16 * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_m + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLoadMatrixx;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_m; ptr += 4;
- memcpy(ptr, m, __size_m);ptr += __size_m;
-}
-
-void glLogicOp_enc(void *self , GLenum opcode)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLogicOp;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &opcode, 4); ptr += 4;
-}
-
-void glMaterialx_enc(void *self , GLenum face, GLenum pname, GLfixed param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glMaterialx;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &face, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glMaterialxv_enc(void *self , GLenum face, GLenum pname, const GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glMaterialxv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &face, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glMatrixMode_enc(void *self , GLenum mode)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glMatrixMode;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &mode, 4); ptr += 4;
-}
-
-void glMultMatrixx_enc(void *self , const GLfixed* m)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_m = (16 * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_m + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glMultMatrixx;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_m; ptr += 4;
- memcpy(ptr, m, __size_m);ptr += __size_m;
-}
-
-void glMultiTexCoord4x_enc(void *self , GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glMultiTexCoord4x;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &s, 4); ptr += 4;
- memcpy(ptr, &t, 4); ptr += 4;
- memcpy(ptr, &r, 4); ptr += 4;
- memcpy(ptr, &q, 4); ptr += 4;
-}
-
-void glNormal3x_enc(void *self , GLfixed nx, GLfixed ny, GLfixed nz)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glNormal3x;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &nx, 4); ptr += 4;
- memcpy(ptr, &ny, 4); ptr += 4;
- memcpy(ptr, &nz, 4); ptr += 4;
-}
-
-void glOrthox_enc(void *self , GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glOrthox;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &left, 4); ptr += 4;
- memcpy(ptr, &right, 4); ptr += 4;
- memcpy(ptr, &bottom, 4); ptr += 4;
- memcpy(ptr, &top, 4); ptr += 4;
- memcpy(ptr, &zNear, 4); ptr += 4;
- memcpy(ptr, &zFar, 4); ptr += 4;
-}
-
-void glPixelStorei_enc(void *self , GLenum pname, GLint param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glPixelStorei;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glPointParameterx_enc(void *self , GLenum pname, GLfixed param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glPointParameterx;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glPointParameterxv_enc(void *self , GLenum pname, const GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glPointParameterxv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glPointSizex_enc(void *self , GLfixed size)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glPointSizex;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &size, 4); ptr += 4;
-}
-
-void glPolygonOffsetx_enc(void *self , GLfixed factor, GLfixed units)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glPolygonOffsetx;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &factor, 4); ptr += 4;
- memcpy(ptr, &units, 4); ptr += 4;
-}
-
-void glPopMatrix_enc(void *self )
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 0;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glPopMatrix;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
-}
-
-void glPushMatrix_enc(void *self )
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 0;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glPushMatrix;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
-}
-
-void glReadPixels_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_pixels = pixelDataSize(self, width, height, format, type, 1);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glReadPixels;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &format, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_pixels; ptr += 4;
- stream->readback(pixels, __size_pixels);
-}
-
-void glRotatex_enc(void *self , GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glRotatex;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &angle, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &z, 4); ptr += 4;
-}
-
-void glSampleCoverage_enc(void *self , GLclampf value, GLboolean invert)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 1;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glSampleCoverage;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &value, 4); ptr += 4;
- memcpy(ptr, &invert, 1); ptr += 1;
-}
-
-void glSampleCoveragex_enc(void *self , GLclampx value, GLboolean invert)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 1;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glSampleCoveragex;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &value, 4); ptr += 4;
- memcpy(ptr, &invert, 1); ptr += 1;
-}
-
-void glScalex_enc(void *self , GLfixed x, GLfixed y, GLfixed z)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glScalex;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &z, 4); ptr += 4;
-}
-
-void glScissor_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glScissor;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
-}
-
-void glShadeModel_enc(void *self , GLenum mode)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glShadeModel;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &mode, 4); ptr += 4;
-}
-
-void glStencilFunc_enc(void *self , GLenum func, GLint ref, GLuint mask)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glStencilFunc;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &func, 4); ptr += 4;
- memcpy(ptr, &ref, 4); ptr += 4;
- memcpy(ptr, &mask, 4); ptr += 4;
-}
-
-void glStencilMask_enc(void *self , GLuint mask)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glStencilMask;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &mask, 4); ptr += 4;
-}
-
-void glStencilOp_enc(void *self , GLenum fail, GLenum zfail, GLenum zpass)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glStencilOp;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &fail, 4); ptr += 4;
- memcpy(ptr, &zfail, 4); ptr += 4;
- memcpy(ptr, &zpass, 4); ptr += 4;
-}
-
-void glTexEnvi_enc(void *self , GLenum target, GLenum pname, GLint param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexEnvi;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glTexEnvx_enc(void *self , GLenum target, GLenum pname, GLfixed param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexEnvx;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glTexEnviv_enc(void *self , GLenum target, GLenum pname, const GLint* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexEnviv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glTexEnvxv_enc(void *self , GLenum target, GLenum pname, const GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexEnvxv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glTexImage2D_enc(void *self , GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_pixels = ((pixels != NULL) ? pixelDataSize(self, width, height, format, type, 0) : 0);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
- ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
- int tmp = OP_glTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &internalformat, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &border, 4); ptr += 4;
- memcpy(ptr, &format, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- stream->flush();
- stream->writeFully(&__size_pixels,4);
- if (pixels != NULL) stream->writeFully(pixels, __size_pixels);
-}
-
-void glTexParameteri_enc(void *self , GLenum target, GLenum pname, GLint param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glTexParameterx_enc(void *self , GLenum target, GLenum pname, GLfixed param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexParameterx;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glTexParameteriv_enc(void *self , GLenum target, GLenum pname, const GLint* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glTexParameterxv_enc(void *self , GLenum target, GLenum pname, const GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexParameterxv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_pixels = pixelDataSize(self, width, height, format, type, 0);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
- ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
- int tmp = OP_glTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &xoffset, 4); ptr += 4;
- memcpy(ptr, &yoffset, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &format, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- stream->flush();
- stream->writeFully(&__size_pixels,4);
- stream->writeFully(pixels, __size_pixels);
-}
-
-void glTranslatex_enc(void *self , GLfixed x, GLfixed y, GLfixed z)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTranslatex;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &z, 4); ptr += 4;
-}
-
-void glViewport_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glViewport;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
-}
-
-void glVertexPointerOffset_enc(void *self , GLint size, GLenum type, GLsizei stride, GLuint offset)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glVertexPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &size, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- memcpy(ptr, &stride, 4); ptr += 4;
- memcpy(ptr, &offset, 4); ptr += 4;
-}
-
-void glColorPointerOffset_enc(void *self , GLint size, GLenum type, GLsizei stride, GLuint offset)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glColorPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &size, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- memcpy(ptr, &stride, 4); ptr += 4;
- memcpy(ptr, &offset, 4); ptr += 4;
-}
-
-void glNormalPointerOffset_enc(void *self , GLenum type, GLsizei stride, GLuint offset)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glNormalPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &type, 4); ptr += 4;
- memcpy(ptr, &stride, 4); ptr += 4;
- memcpy(ptr, &offset, 4); ptr += 4;
-}
-
-void glPointSizePointerOffset_enc(void *self , GLenum type, GLsizei stride, GLuint offset)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glPointSizePointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &type, 4); ptr += 4;
- memcpy(ptr, &stride, 4); ptr += 4;
- memcpy(ptr, &offset, 4); ptr += 4;
-}
-
-void glTexCoordPointerOffset_enc(void *self , GLint size, GLenum type, GLsizei stride, GLuint offset)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexCoordPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &size, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- memcpy(ptr, &stride, 4); ptr += 4;
- memcpy(ptr, &offset, 4); ptr += 4;
-}
-
-void glWeightPointerOffset_enc(void *self , GLint size, GLenum type, GLsizei stride, GLuint offset)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glWeightPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &size, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- memcpy(ptr, &stride, 4); ptr += 4;
- memcpy(ptr, &offset, 4); ptr += 4;
-}
-
-void glMatrixIndexPointerOffset_enc(void *self , GLint size, GLenum type, GLsizei stride, GLuint offset)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glMatrixIndexPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &size, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- memcpy(ptr, &stride, 4); ptr += 4;
- memcpy(ptr, &offset, 4); ptr += 4;
-}
-
-void glVertexPointerData_enc(void *self , GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = datalen;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glVertexPointerData;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &size, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- memcpy(ptr, &stride, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_data; ptr += 4;
- glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data;
- memcpy(ptr, &datalen, 4); ptr += 4;
-}
-
-void glColorPointerData_enc(void *self , GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = datalen;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glColorPointerData;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &size, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- memcpy(ptr, &stride, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_data; ptr += 4;
- glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data;
- memcpy(ptr, &datalen, 4); ptr += 4;
-}
-
-void glNormalPointerData_enc(void *self , GLenum type, GLsizei stride, void* data, GLuint datalen)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = datalen;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_data + 4 + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glNormalPointerData;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &type, 4); ptr += 4;
- memcpy(ptr, &stride, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_data; ptr += 4;
- glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, 3, type, stride, datalen);ptr += __size_data;
- memcpy(ptr, &datalen, 4); ptr += 4;
-}
-
-void glTexCoordPointerData_enc(void *self , GLint unit, GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = datalen;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + __size_data + 4 + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexCoordPointerData;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &unit, 4); ptr += 4;
- memcpy(ptr, &size, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- memcpy(ptr, &stride, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_data; ptr += 4;
- glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data;
- memcpy(ptr, &datalen, 4); ptr += 4;
-}
-
-void glPointSizePointerData_enc(void *self , GLenum type, GLsizei stride, void* data, GLuint datalen)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = datalen;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_data + 4 + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glPointSizePointerData;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &type, 4); ptr += 4;
- memcpy(ptr, &stride, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_data; ptr += 4;
- glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, 1, type, stride, datalen);ptr += __size_data;
- memcpy(ptr, &datalen, 4); ptr += 4;
-}
-
-void glWeightPointerData_enc(void *self , GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = datalen;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glWeightPointerData;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &size, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- memcpy(ptr, &stride, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_data; ptr += 4;
- glUtilsPackPointerData((unsigned char *)ptr, (unsigned char*)data, size, type, stride, datalen);ptr += __size_data;
- memcpy(ptr, &datalen, 4); ptr += 4;
-}
-
-void glMatrixIndexPointerData_enc(void *self , GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = datalen;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glMatrixIndexPointerData;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &size, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- memcpy(ptr, &stride, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_data; ptr += 4;
- glUtilsPackPointerData((unsigned char *)ptr, (unsigned char*)data, size, type, stride, datalen);ptr += __size_data;
- memcpy(ptr, &datalen, 4); ptr += 4;
-}
-
-void glDrawElementsOffset_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDrawElementsOffset;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &mode, 4); ptr += 4;
- memcpy(ptr, &count, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- memcpy(ptr, &offset, 4); ptr += 4;
-}
-
-void glDrawElementsData_enc(void *self , GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = datalen;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDrawElementsData;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &mode, 4); ptr += 4;
- memcpy(ptr, &count, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_data; ptr += 4;
- memcpy(ptr, data, __size_data);ptr += __size_data;
- memcpy(ptr, &datalen, 4); ptr += 4;
-}
-
-void glGetCompressedTextureFormats_enc(void *self , int count, GLint* formats)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_formats = (count * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_formats + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetCompressedTextureFormats;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &count, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_formats; ptr += 4;
- stream->readback(formats, __size_formats);
-}
-
-int glFinishRoundTrip_enc(void *self )
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 0;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFinishRoundTrip;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
-
- int retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-void glBlendEquationSeparateOES_enc(void *self , GLenum modeRGB, GLenum modeAlpha)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBlendEquationSeparateOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &modeRGB, 4); ptr += 4;
- memcpy(ptr, &modeAlpha, 4); ptr += 4;
-}
-
-void glBlendFuncSeparateOES_enc(void *self , GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBlendFuncSeparateOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &srcRGB, 4); ptr += 4;
- memcpy(ptr, &dstRGB, 4); ptr += 4;
- memcpy(ptr, &srcAlpha, 4); ptr += 4;
- memcpy(ptr, &dstAlpha, 4); ptr += 4;
-}
-
-void glBlendEquationOES_enc(void *self , GLenum mode)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBlendEquationOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &mode, 4); ptr += 4;
-}
-
-void glDrawTexsOES_enc(void *self , GLshort x, GLshort y, GLshort z, GLshort width, GLshort height)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 2 + 2 + 2 + 2 + 2;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDrawTexsOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &x, 2); ptr += 2;
- memcpy(ptr, &y, 2); ptr += 2;
- memcpy(ptr, &z, 2); ptr += 2;
- memcpy(ptr, &width, 2); ptr += 2;
- memcpy(ptr, &height, 2); ptr += 2;
-}
-
-void glDrawTexiOES_enc(void *self , GLint x, GLint y, GLint z, GLint width, GLint height)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDrawTexiOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &z, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
-}
-
-void glDrawTexxOES_enc(void *self , GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDrawTexxOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &z, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
-}
-
-void glDrawTexsvOES_enc(void *self , const GLshort* coords)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_coords = (5 * sizeof(GLshort));
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_coords + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDrawTexsvOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_coords; ptr += 4;
- memcpy(ptr, coords, __size_coords);ptr += __size_coords;
-}
-
-void glDrawTexivOES_enc(void *self , const GLint* coords)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_coords = (5 * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_coords + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDrawTexivOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_coords; ptr += 4;
- memcpy(ptr, coords, __size_coords);ptr += __size_coords;
-}
-
-void glDrawTexxvOES_enc(void *self , const GLfixed* coords)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_coords = (5 * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_coords + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDrawTexxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_coords; ptr += 4;
- memcpy(ptr, coords, __size_coords);ptr += __size_coords;
-}
-
-void glDrawTexfOES_enc(void *self , GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDrawTexfOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &z, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
-}
-
-void glDrawTexfvOES_enc(void *self , const GLfloat* coords)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_coords = (5 * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_coords + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDrawTexfvOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_coords; ptr += 4;
- memcpy(ptr, coords, __size_coords);ptr += __size_coords;
-}
-
-void glEGLImageTargetTexture2DOES_enc(void *self , GLenum target, GLeglImageOES image)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glEGLImageTargetTexture2DOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &image, 4); ptr += 4;
-}
-
-void glEGLImageTargetRenderbufferStorageOES_enc(void *self , GLenum target, GLeglImageOES image)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glEGLImageTargetRenderbufferStorageOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &image, 4); ptr += 4;
-}
-
-void glAlphaFuncxOES_enc(void *self , GLenum func, GLclampx ref)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glAlphaFuncxOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &func, 4); ptr += 4;
- memcpy(ptr, &ref, 4); ptr += 4;
-}
-
-void glClearColorxOES_enc(void *self , GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClearColorxOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &red, 4); ptr += 4;
- memcpy(ptr, &green, 4); ptr += 4;
- memcpy(ptr, &blue, 4); ptr += 4;
- memcpy(ptr, &alpha, 4); ptr += 4;
-}
-
-void glClearDepthxOES_enc(void *self , GLclampx depth)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClearDepthxOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &depth, 4); ptr += 4;
-}
-
-void glClipPlanexOES_enc(void *self , GLenum plane, const GLfixed* equation)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_equation = (4 * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_equation + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClipPlanexOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &plane, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_equation; ptr += 4;
- memcpy(ptr, equation, __size_equation);ptr += __size_equation;
-}
-
-void glClipPlanexIMG_enc(void *self , GLenum plane, const GLfixed* equation)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_equation = (4 * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_equation + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClipPlanexIMG;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &plane, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_equation; ptr += 4;
- memcpy(ptr, equation, __size_equation);ptr += __size_equation;
-}
-
-void glColor4xOES_enc(void *self , GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glColor4xOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &red, 4); ptr += 4;
- memcpy(ptr, &green, 4); ptr += 4;
- memcpy(ptr, &blue, 4); ptr += 4;
- memcpy(ptr, &alpha, 4); ptr += 4;
-}
-
-void glDepthRangexOES_enc(void *self , GLclampx zNear, GLclampx zFar)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDepthRangexOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &zNear, 4); ptr += 4;
- memcpy(ptr, &zFar, 4); ptr += 4;
-}
-
-void glFogxOES_enc(void *self , GLenum pname, GLfixed param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFogxOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glFogxvOES_enc(void *self , GLenum pname, const GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFogxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glFrustumxOES_enc(void *self , GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFrustumxOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &left, 4); ptr += 4;
- memcpy(ptr, &right, 4); ptr += 4;
- memcpy(ptr, &bottom, 4); ptr += 4;
- memcpy(ptr, &top, 4); ptr += 4;
- memcpy(ptr, &zNear, 4); ptr += 4;
- memcpy(ptr, &zFar, 4); ptr += 4;
-}
-
-void glGetClipPlanexOES_enc(void *self , GLenum pname, GLfixed* eqn)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_eqn = (4 * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_eqn + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetClipPlanexOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_eqn; ptr += 4;
- stream->readback(eqn, __size_eqn);
-}
-
-void glGetClipPlanex_enc(void *self , GLenum pname, GLfixed* eqn)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_eqn = (4 * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_eqn + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetClipPlanex;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_eqn; ptr += 4;
- stream->readback(eqn, __size_eqn);
-}
-
-void glGetFixedvOES_enc(void *self , GLenum pname, GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetFixedvOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetLightxvOES_enc(void *self , GLenum light, GLenum pname, GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetLightxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &light, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetMaterialxvOES_enc(void *self , GLenum face, GLenum pname, GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetMaterialxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &face, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetTexEnvxvOES_enc(void *self , GLenum env, GLenum pname, GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetTexEnvxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &env, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetTexParameterxvOES_enc(void *self , GLenum target, GLenum pname, GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetTexParameterxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glLightModelxOES_enc(void *self , GLenum pname, GLfixed param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLightModelxOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glLightModelxvOES_enc(void *self , GLenum pname, const GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLightModelxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glLightxOES_enc(void *self , GLenum light, GLenum pname, GLfixed param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLightxOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &light, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glLightxvOES_enc(void *self , GLenum light, GLenum pname, const GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLightxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &light, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glLineWidthxOES_enc(void *self , GLfixed width)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLineWidthxOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &width, 4); ptr += 4;
-}
-
-void glLoadMatrixxOES_enc(void *self , const GLfixed* m)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_m = (16 * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_m + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLoadMatrixxOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_m; ptr += 4;
- memcpy(ptr, m, __size_m);ptr += __size_m;
-}
-
-void glMaterialxOES_enc(void *self , GLenum face, GLenum pname, GLfixed param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glMaterialxOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &face, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glMaterialxvOES_enc(void *self , GLenum face, GLenum pname, const GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glMaterialxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &face, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glMultMatrixxOES_enc(void *self , const GLfixed* m)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_m = (16 * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_m + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glMultMatrixxOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_m; ptr += 4;
- memcpy(ptr, m, __size_m);ptr += __size_m;
-}
-
-void glMultiTexCoord4xOES_enc(void *self , GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glMultiTexCoord4xOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &s, 4); ptr += 4;
- memcpy(ptr, &t, 4); ptr += 4;
- memcpy(ptr, &r, 4); ptr += 4;
- memcpy(ptr, &q, 4); ptr += 4;
-}
-
-void glNormal3xOES_enc(void *self , GLfixed nx, GLfixed ny, GLfixed nz)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glNormal3xOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &nx, 4); ptr += 4;
- memcpy(ptr, &ny, 4); ptr += 4;
- memcpy(ptr, &nz, 4); ptr += 4;
-}
-
-void glOrthoxOES_enc(void *self , GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glOrthoxOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &left, 4); ptr += 4;
- memcpy(ptr, &right, 4); ptr += 4;
- memcpy(ptr, &bottom, 4); ptr += 4;
- memcpy(ptr, &top, 4); ptr += 4;
- memcpy(ptr, &zNear, 4); ptr += 4;
- memcpy(ptr, &zFar, 4); ptr += 4;
-}
-
-void glPointParameterxOES_enc(void *self , GLenum pname, GLfixed param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glPointParameterxOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glPointParameterxvOES_enc(void *self , GLenum pname, const GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glPointParameterxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glPointSizexOES_enc(void *self , GLfixed size)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glPointSizexOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &size, 4); ptr += 4;
-}
-
-void glPolygonOffsetxOES_enc(void *self , GLfixed factor, GLfixed units)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glPolygonOffsetxOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &factor, 4); ptr += 4;
- memcpy(ptr, &units, 4); ptr += 4;
-}
-
-void glRotatexOES_enc(void *self , GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glRotatexOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &angle, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &z, 4); ptr += 4;
-}
-
-void glSampleCoveragexOES_enc(void *self , GLclampx value, GLboolean invert)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 1;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glSampleCoveragexOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &value, 4); ptr += 4;
- memcpy(ptr, &invert, 1); ptr += 1;
-}
-
-void glScalexOES_enc(void *self , GLfixed x, GLfixed y, GLfixed z)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glScalexOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &z, 4); ptr += 4;
-}
-
-void glTexEnvxOES_enc(void *self , GLenum target, GLenum pname, GLfixed param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexEnvxOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glTexEnvxvOES_enc(void *self , GLenum target, GLenum pname, const GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexEnvxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glTexParameterxOES_enc(void *self , GLenum target, GLenum pname, GLfixed param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexParameterxOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glTexParameterxvOES_enc(void *self , GLenum target, GLenum pname, const GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexParameterxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glTranslatexOES_enc(void *self , GLfixed x, GLfixed y, GLfixed z)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTranslatexOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &z, 4); ptr += 4;
-}
-
-GLboolean glIsRenderbufferOES_enc(void *self , GLuint renderbuffer)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glIsRenderbufferOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &renderbuffer, 4); ptr += 4;
-
- GLboolean retval;
- stream->readback(&retval, 1);
- return retval;
-}
-
-void glBindRenderbufferOES_enc(void *self , GLenum target, GLuint renderbuffer)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBindRenderbufferOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &renderbuffer, 4); ptr += 4;
-}
-
-void glDeleteRenderbuffersOES_enc(void *self , GLsizei n, const GLuint* renderbuffers)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_renderbuffers = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_renderbuffers + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDeleteRenderbuffersOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4;
- memcpy(ptr, renderbuffers, __size_renderbuffers);ptr += __size_renderbuffers;
-}
-
-void glGenRenderbuffersOES_enc(void *self , GLsizei n, GLuint* renderbuffers)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_renderbuffers = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_renderbuffers + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGenRenderbuffersOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4;
- stream->readback(renderbuffers, __size_renderbuffers);
-}
-
-void glRenderbufferStorageOES_enc(void *self , GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glRenderbufferStorageOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &internalformat, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
-}
-
-void glGetRenderbufferParameterivOES_enc(void *self , GLenum target, GLenum pname, GLint* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetRenderbufferParameterivOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-GLboolean glIsFramebufferOES_enc(void *self , GLuint framebuffer)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glIsFramebufferOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &framebuffer, 4); ptr += 4;
-
- GLboolean retval;
- stream->readback(&retval, 1);
- return retval;
-}
-
-void glBindFramebufferOES_enc(void *self , GLenum target, GLuint framebuffer)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBindFramebufferOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &framebuffer, 4); ptr += 4;
-}
-
-void glDeleteFramebuffersOES_enc(void *self , GLsizei n, const GLuint* framebuffers)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_framebuffers = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_framebuffers + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDeleteFramebuffersOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_framebuffers; ptr += 4;
- memcpy(ptr, framebuffers, __size_framebuffers);ptr += __size_framebuffers;
-}
-
-void glGenFramebuffersOES_enc(void *self , GLsizei n, GLuint* framebuffers)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_framebuffers = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_framebuffers + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGenFramebuffersOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_framebuffers; ptr += 4;
- stream->readback(framebuffers, __size_framebuffers);
-}
-
-GLenum glCheckFramebufferStatusOES_enc(void *self , GLenum target)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glCheckFramebufferStatusOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
-
- GLenum retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-void glFramebufferRenderbufferOES_enc(void *self , GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFramebufferRenderbufferOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &attachment, 4); ptr += 4;
- memcpy(ptr, &renderbuffertarget, 4); ptr += 4;
- memcpy(ptr, &renderbuffer, 4); ptr += 4;
-}
-
-void glFramebufferTexture2DOES_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFramebufferTexture2DOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &attachment, 4); ptr += 4;
- memcpy(ptr, &textarget, 4); ptr += 4;
- memcpy(ptr, &texture, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
-}
-
-void glGetFramebufferAttachmentParameterivOES_enc(void *self , GLenum target, GLenum attachment, GLenum pname, GLint* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetFramebufferAttachmentParameterivOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &attachment, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGenerateMipmapOES_enc(void *self , GLenum target)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGenerateMipmapOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
-}
-
-GLboolean glUnmapBufferOES_enc(void *self , GLenum target)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUnmapBufferOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
-
- GLboolean retval;
- stream->readback(&retval, 1);
- return retval;
-}
-
-void glCurrentPaletteMatrixOES_enc(void *self , GLuint matrixpaletteindex)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glCurrentPaletteMatrixOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &matrixpaletteindex, 4); ptr += 4;
-}
-
-void glLoadPaletteFromModelViewMatrixOES_enc(void *self )
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 0;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLoadPaletteFromModelViewMatrixOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
-}
-
-GLbitfield glQueryMatrixxOES_enc(void *self , GLfixed* mantissa, GLint* exponent)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_mantissa = (16 * sizeof(GLfixed));
- const unsigned int __size_exponent = (16 * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_mantissa + __size_exponent + 2*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glQueryMatrixxOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_mantissa; ptr += 4;
- *(unsigned int *)(ptr) = __size_exponent; ptr += 4;
- stream->readback(mantissa, __size_mantissa);
- stream->readback(exponent, __size_exponent);
-
- GLbitfield retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-void glDepthRangefOES_enc(void *self , GLclampf zNear, GLclampf zFar)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDepthRangefOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &zNear, 4); ptr += 4;
- memcpy(ptr, &zFar, 4); ptr += 4;
-}
-
-void glFrustumfOES_enc(void *self , GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFrustumfOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &left, 4); ptr += 4;
- memcpy(ptr, &right, 4); ptr += 4;
- memcpy(ptr, &bottom, 4); ptr += 4;
- memcpy(ptr, &top, 4); ptr += 4;
- memcpy(ptr, &zNear, 4); ptr += 4;
- memcpy(ptr, &zFar, 4); ptr += 4;
-}
-
-void glOrthofOES_enc(void *self , GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glOrthofOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &left, 4); ptr += 4;
- memcpy(ptr, &right, 4); ptr += 4;
- memcpy(ptr, &bottom, 4); ptr += 4;
- memcpy(ptr, &top, 4); ptr += 4;
- memcpy(ptr, &zNear, 4); ptr += 4;
- memcpy(ptr, &zFar, 4); ptr += 4;
-}
-
-void glClipPlanefOES_enc(void *self , GLenum plane, const GLfloat* equation)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_equation = (4 * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_equation + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClipPlanefOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &plane, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_equation; ptr += 4;
- memcpy(ptr, equation, __size_equation);ptr += __size_equation;
-}
-
-void glClipPlanefIMG_enc(void *self , GLenum plane, const GLfloat* equation)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_equation = (4 * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_equation + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClipPlanefIMG;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &plane, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_equation; ptr += 4;
- memcpy(ptr, equation, __size_equation);ptr += __size_equation;
-}
-
-void glGetClipPlanefOES_enc(void *self , GLenum pname, GLfloat* eqn)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_eqn = (4 * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_eqn + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetClipPlanefOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_eqn; ptr += 4;
- stream->readback(eqn, __size_eqn);
-}
-
-void glClearDepthfOES_enc(void *self , GLclampf depth)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClearDepthfOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &depth, 4); ptr += 4;
-}
-
-void glTexGenfOES_enc(void *self , GLenum coord, GLenum pname, GLfloat param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexGenfOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &coord, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glTexGenfvOES_enc(void *self , GLenum coord, GLenum pname, const GLfloat* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexGenfvOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &coord, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glTexGeniOES_enc(void *self , GLenum coord, GLenum pname, GLint param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexGeniOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &coord, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glTexGenivOES_enc(void *self , GLenum coord, GLenum pname, const GLint* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexGenivOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &coord, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glTexGenxOES_enc(void *self , GLenum coord, GLenum pname, GLfixed param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexGenxOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &coord, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glTexGenxvOES_enc(void *self , GLenum coord, GLenum pname, const GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexGenxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &coord, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glGetTexGenfvOES_enc(void *self , GLenum coord, GLenum pname, GLfloat* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetTexGenfvOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &coord, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glGetTexGenivOES_enc(void *self , GLenum coord, GLenum pname, GLint* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetTexGenivOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &coord, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glGetTexGenxvOES_enc(void *self , GLenum coord, GLenum pname, GLfixed* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetTexGenxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &coord, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glBindVertexArrayOES_enc(void *self , GLuint array)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBindVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &array, 4); ptr += 4;
-}
-
-void glDeleteVertexArraysOES_enc(void *self , GLsizei n, const GLuint* arrays)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_arrays = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_arrays + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDeleteVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_arrays; ptr += 4;
- memcpy(ptr, arrays, __size_arrays);ptr += __size_arrays;
-}
-
-void glGenVertexArraysOES_enc(void *self , GLsizei n, GLuint* arrays)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_arrays = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_arrays + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGenVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_arrays; ptr += 4;
- stream->readback(arrays, __size_arrays);
-}
-
-GLboolean glIsVertexArrayOES_enc(void *self , GLuint array)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glIsVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &array, 4); ptr += 4;
-
- GLboolean retval;
- stream->readback(&retval, 1);
- return retval;
-}
-
-void glDiscardFramebufferEXT_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_attachments = (numAttachments * sizeof(const GLenum));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_attachments + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDiscardFramebufferEXT;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &numAttachments, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_attachments; ptr += 4;
- memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments;
-}
-
-void glRenderbufferStorageMultisampleIMG_enc(void *self , GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glRenderbufferStorageMultisampleIMG;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &samples, 4); ptr += 4;
- memcpy(ptr, &internalformat, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
-}
-
-void glFramebufferTexture2DMultisampleIMG_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFramebufferTexture2DMultisampleIMG;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &attachment, 4); ptr += 4;
- memcpy(ptr, &textarget, 4); ptr += 4;
- memcpy(ptr, &texture, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &samples, 4); ptr += 4;
-}
-
-void glDeleteFencesNV_enc(void *self , GLsizei n, const GLuint* fences)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_fences = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_fences + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDeleteFencesNV;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_fences; ptr += 4;
- memcpy(ptr, fences, __size_fences);ptr += __size_fences;
-}
-
-void glGenFencesNV_enc(void *self , GLsizei n, GLuint* fences)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_fences = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_fences + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGenFencesNV;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_fences; ptr += 4;
- memcpy(ptr, fences, __size_fences);ptr += __size_fences;
-}
-
-GLboolean glIsFenceNV_enc(void *self , GLuint fence)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glIsFenceNV;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &fence, 4); ptr += 4;
-
- GLboolean retval;
- stream->readback(&retval, 1);
- return retval;
-}
-
-GLboolean glTestFenceNV_enc(void *self , GLuint fence)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTestFenceNV;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &fence, 4); ptr += 4;
-
- GLboolean retval;
- stream->readback(&retval, 1);
- return retval;
-}
-
-void glGetFenceivNV_enc(void *self , GLuint fence, GLenum pname, GLint* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetFenceivNV;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &fence, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glFinishFenceNV_enc(void *self , GLuint fence)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFinishFenceNV;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &fence, 4); ptr += 4;
-}
-
-void glSetFenceNV_enc(void *self , GLuint fence, GLenum condition)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glSetFenceNV;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &fence, 4); ptr += 4;
- memcpy(ptr, &condition, 4); ptr += 4;
-}
-
-void glGetDriverControlsQCOM_enc(void *self , GLint* num, GLsizei size, GLuint* driverControls)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_num = (1 * sizeof(GLint));
- const unsigned int __size_driverControls = (size * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_num + 4 + __size_driverControls + 2*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetDriverControlsQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_num; ptr += 4;
- memcpy(ptr, &size, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_driverControls; ptr += 4;
- stream->readback(num, __size_num);
- stream->readback(driverControls, __size_driverControls);
-}
-
-void glGetDriverControlStringQCOM_enc(void *self , GLuint driverControl, GLsizei bufSize, GLsizei* length, GLchar* driverControlString)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_length = (1 * sizeof(GLsizei));
- const unsigned int __size_driverControlString = (1 * sizeof(GLchar));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_length + __size_driverControlString + 2*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetDriverControlStringQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &driverControl, 4); ptr += 4;
- memcpy(ptr, &bufSize, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_length; ptr += 4;
- *(unsigned int *)(ptr) = __size_driverControlString; ptr += 4;
- stream->readback(length, __size_length);
- stream->readback(driverControlString, __size_driverControlString);
-}
-
-void glEnableDriverControlQCOM_enc(void *self , GLuint driverControl)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glEnableDriverControlQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &driverControl, 4); ptr += 4;
-}
-
-void glDisableDriverControlQCOM_enc(void *self , GLuint driverControl)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDisableDriverControlQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &driverControl, 4); ptr += 4;
-}
-
-void glExtGetTexturesQCOM_enc(void *self , GLuint* textures, GLint maxTextures, GLint* numTextures)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_textures = (maxTextures * sizeof(GLuint));
- const unsigned int __size_numTextures = (1 * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_textures + 4 + __size_numTextures + 2*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glExtGetTexturesQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_textures; ptr += 4;
- memcpy(ptr, &maxTextures, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_numTextures; ptr += 4;
- stream->readback(textures, __size_textures);
- stream->readback(numTextures, __size_numTextures);
-}
-
-void glExtGetBuffersQCOM_enc(void *self , GLuint* buffers, GLint maxBuffers, GLint* numBuffers)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_buffers = (maxBuffers * sizeof(GLuint));
- const unsigned int __size_numBuffers = (1 * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_buffers + 4 + __size_numBuffers + 2*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glExtGetBuffersQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_buffers; ptr += 4;
- memcpy(ptr, &maxBuffers, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_numBuffers; ptr += 4;
- stream->readback(buffers, __size_buffers);
- stream->readback(numBuffers, __size_numBuffers);
-}
-
-void glExtGetRenderbuffersQCOM_enc(void *self , GLuint* renderbuffers, GLint maxRenderbuffers, GLint* numRenderbuffers)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_renderbuffers = (maxRenderbuffers * sizeof(GLuint));
- const unsigned int __size_numRenderbuffers = (1 * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_renderbuffers + 4 + __size_numRenderbuffers + 2*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glExtGetRenderbuffersQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4;
- memcpy(ptr, &maxRenderbuffers, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_numRenderbuffers; ptr += 4;
- stream->readback(renderbuffers, __size_renderbuffers);
- stream->readback(numRenderbuffers, __size_numRenderbuffers);
-}
-
-void glExtGetFramebuffersQCOM_enc(void *self , GLuint* framebuffers, GLint maxFramebuffers, GLint* numFramebuffers)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_framebuffers = (maxFramebuffers * sizeof(GLuint));
- const unsigned int __size_numFramebuffers = (1 * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_framebuffers + 4 + __size_numFramebuffers + 2*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glExtGetFramebuffersQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_framebuffers; ptr += 4;
- memcpy(ptr, &maxFramebuffers, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_numFramebuffers; ptr += 4;
- stream->readback(framebuffers, __size_framebuffers);
- stream->readback(numFramebuffers, __size_numFramebuffers);
-}
-
-void glExtGetTexLevelParameterivQCOM_enc(void *self , GLuint texture, GLenum face, GLint level, GLenum pname, GLint* params)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glExtGetTexLevelParameterivQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &texture, 4); ptr += 4;
- memcpy(ptr, &face, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glExtTexObjectStateOverrideiQCOM_enc(void *self , GLenum target, GLenum pname, GLint param)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glExtTexObjectStateOverrideiQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glExtGetTexSubImageQCOM_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid* texels)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_texels = (depth * pixelDataSize(self, width, height, format, type, 0));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_texels + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glExtGetTexSubImageQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &xoffset, 4); ptr += 4;
- memcpy(ptr, &yoffset, 4); ptr += 4;
- memcpy(ptr, &zoffset, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &depth, 4); ptr += 4;
- memcpy(ptr, &format, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_texels; ptr += 4;
- stream->readback(texels, __size_texels);
-}
-
-void glExtGetShadersQCOM_enc(void *self , GLuint* shaders, GLint maxShaders, GLint* numShaders)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_shaders = (maxShaders * sizeof(GLuint));
- const unsigned int __size_numShaders = (1 * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_shaders + 4 + __size_numShaders + 2*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glExtGetShadersQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_shaders; ptr += 4;
- memcpy(ptr, &maxShaders, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_numShaders; ptr += 4;
- stream->readback(shaders, __size_shaders);
- stream->readback(numShaders, __size_numShaders);
-}
-
-void glExtGetProgramsQCOM_enc(void *self , GLuint* programs, GLint maxPrograms, GLint* numPrograms)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_programs = (maxPrograms * sizeof(GLuint));
- const unsigned int __size_numPrograms = (1 * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_programs + 4 + __size_numPrograms + 2*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glExtGetProgramsQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_programs; ptr += 4;
- memcpy(ptr, &maxPrograms, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_numPrograms; ptr += 4;
- stream->readback(programs, __size_programs);
- stream->readback(numPrograms, __size_numPrograms);
-}
-
-GLboolean glExtIsProgramBinaryQCOM_enc(void *self , GLuint program)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glExtIsProgramBinaryQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &program, 4); ptr += 4;
-
- GLboolean retval;
- stream->readback(&retval, 1);
- return retval;
-}
-
-void glStartTilingQCOM_enc(void *self , GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glStartTilingQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &preserveMask, 4); ptr += 4;
-}
-
-void glEndTilingQCOM_enc(void *self , GLbitfield preserveMask)
-{
-
- gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glEndTilingQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &preserveMask, 4); ptr += 4;
-}
-
-gl_encoder_context_t::gl_encoder_context_t(IOStream *stream)
-{
- m_stream = stream;
-
- set_glAlphaFunc(glAlphaFunc_enc);
- set_glClearColor(glClearColor_enc);
- set_glClearDepthf(glClearDepthf_enc);
- set_glClipPlanef(glClipPlanef_enc);
- set_glColor4f(glColor4f_enc);
- set_glDepthRangef(glDepthRangef_enc);
- set_glFogf(glFogf_enc);
- set_glFogfv(glFogfv_enc);
- set_glFrustumf(glFrustumf_enc);
- set_glGetClipPlanef(glGetClipPlanef_enc);
- set_glGetFloatv(glGetFloatv_enc);
- set_glGetLightfv(glGetLightfv_enc);
- set_glGetMaterialfv(glGetMaterialfv_enc);
- set_glGetTexEnvfv(glGetTexEnvfv_enc);
- set_glGetTexParameterfv(glGetTexParameterfv_enc);
- set_glLightModelf(glLightModelf_enc);
- set_glLightModelfv(glLightModelfv_enc);
- set_glLightf(glLightf_enc);
- set_glLightfv(glLightfv_enc);
- set_glLineWidth(glLineWidth_enc);
- set_glLoadMatrixf(glLoadMatrixf_enc);
- set_glMaterialf(glMaterialf_enc);
- set_glMaterialfv(glMaterialfv_enc);
- set_glMultMatrixf(glMultMatrixf_enc);
- set_glMultiTexCoord4f(glMultiTexCoord4f_enc);
- set_glNormal3f(glNormal3f_enc);
- set_glOrthof(glOrthof_enc);
- set_glPointParameterf(glPointParameterf_enc);
- set_glPointParameterfv(glPointParameterfv_enc);
- set_glPointSize(glPointSize_enc);
- set_glPolygonOffset(glPolygonOffset_enc);
- set_glRotatef(glRotatef_enc);
- set_glScalef(glScalef_enc);
- set_glTexEnvf(glTexEnvf_enc);
- set_glTexEnvfv(glTexEnvfv_enc);
- set_glTexParameterf(glTexParameterf_enc);
- set_glTexParameterfv(glTexParameterfv_enc);
- set_glTranslatef(glTranslatef_enc);
- set_glActiveTexture(glActiveTexture_enc);
- set_glAlphaFuncx(glAlphaFuncx_enc);
- set_glBindBuffer(glBindBuffer_enc);
- set_glBindTexture(glBindTexture_enc);
- set_glBlendFunc(glBlendFunc_enc);
- set_glBufferData(glBufferData_enc);
- set_glBufferSubData(glBufferSubData_enc);
- set_glClear(glClear_enc);
- set_glClearColorx(glClearColorx_enc);
- set_glClearDepthx(glClearDepthx_enc);
- set_glClearStencil(glClearStencil_enc);
- set_glClientActiveTexture(glClientActiveTexture_enc);
- set_glColor4ub(glColor4ub_enc);
- set_glColor4x(glColor4x_enc);
- set_glColorMask(glColorMask_enc);
- set_glColorPointer((glColorPointer_client_proc_t)(enc_unsupported));
- set_glCompressedTexImage2D(glCompressedTexImage2D_enc);
- set_glCompressedTexSubImage2D(glCompressedTexSubImage2D_enc);
- set_glCopyTexImage2D(glCopyTexImage2D_enc);
- set_glCopyTexSubImage2D(glCopyTexSubImage2D_enc);
- set_glCullFace(glCullFace_enc);
- set_glDeleteBuffers(glDeleteBuffers_enc);
- set_glDeleteTextures(glDeleteTextures_enc);
- set_glDepthFunc(glDepthFunc_enc);
- set_glDepthMask(glDepthMask_enc);
- set_glDepthRangex(glDepthRangex_enc);
- set_glDisable(glDisable_enc);
- set_glDisableClientState(glDisableClientState_enc);
- set_glDrawArrays(glDrawArrays_enc);
- set_glDrawElements((glDrawElements_client_proc_t)(enc_unsupported));
- set_glEnable(glEnable_enc);
- set_glEnableClientState(glEnableClientState_enc);
- set_glFinish(glFinish_enc);
- set_glFlush(glFlush_enc);
- set_glFogx(glFogx_enc);
- set_glFogxv(glFogxv_enc);
- set_glFrontFace(glFrontFace_enc);
- set_glFrustumx(glFrustumx_enc);
- set_glGetBooleanv(glGetBooleanv_enc);
- set_glGetBufferParameteriv(glGetBufferParameteriv_enc);
- set_glClipPlanex(glClipPlanex_enc);
- set_glGenBuffers(glGenBuffers_enc);
- set_glGenTextures(glGenTextures_enc);
- set_glGetError(glGetError_enc);
- set_glGetFixedv(glGetFixedv_enc);
- set_glGetIntegerv(glGetIntegerv_enc);
- set_glGetLightxv(glGetLightxv_enc);
- set_glGetMaterialxv(glGetMaterialxv_enc);
- set_glGetPointerv((glGetPointerv_client_proc_t)(enc_unsupported));
- set_glGetString((glGetString_client_proc_t)(enc_unsupported));
- set_glGetTexEnviv(glGetTexEnviv_enc);
- set_glGetTexEnvxv(glGetTexEnvxv_enc);
- set_glGetTexParameteriv(glGetTexParameteriv_enc);
- set_glGetTexParameterxv(glGetTexParameterxv_enc);
- set_glHint(glHint_enc);
- set_glIsBuffer(glIsBuffer_enc);
- set_glIsEnabled(glIsEnabled_enc);
- set_glIsTexture(glIsTexture_enc);
- set_glLightModelx(glLightModelx_enc);
- set_glLightModelxv(glLightModelxv_enc);
- set_glLightx(glLightx_enc);
- set_glLightxv(glLightxv_enc);
- set_glLineWidthx(glLineWidthx_enc);
- set_glLoadIdentity(glLoadIdentity_enc);
- set_glLoadMatrixx(glLoadMatrixx_enc);
- set_glLogicOp(glLogicOp_enc);
- set_glMaterialx(glMaterialx_enc);
- set_glMaterialxv(glMaterialxv_enc);
- set_glMatrixMode(glMatrixMode_enc);
- set_glMultMatrixx(glMultMatrixx_enc);
- set_glMultiTexCoord4x(glMultiTexCoord4x_enc);
- set_glNormal3x(glNormal3x_enc);
- set_glNormalPointer((glNormalPointer_client_proc_t)(enc_unsupported));
- set_glOrthox(glOrthox_enc);
- set_glPixelStorei(glPixelStorei_enc);
- set_glPointParameterx(glPointParameterx_enc);
- set_glPointParameterxv(glPointParameterxv_enc);
- set_glPointSizex(glPointSizex_enc);
- set_glPolygonOffsetx(glPolygonOffsetx_enc);
- set_glPopMatrix(glPopMatrix_enc);
- set_glPushMatrix(glPushMatrix_enc);
- set_glReadPixels(glReadPixels_enc);
- set_glRotatex(glRotatex_enc);
- set_glSampleCoverage(glSampleCoverage_enc);
- set_glSampleCoveragex(glSampleCoveragex_enc);
- set_glScalex(glScalex_enc);
- set_glScissor(glScissor_enc);
- set_glShadeModel(glShadeModel_enc);
- set_glStencilFunc(glStencilFunc_enc);
- set_glStencilMask(glStencilMask_enc);
- set_glStencilOp(glStencilOp_enc);
- set_glTexCoordPointer((glTexCoordPointer_client_proc_t)(enc_unsupported));
- set_glTexEnvi(glTexEnvi_enc);
- set_glTexEnvx(glTexEnvx_enc);
- set_glTexEnviv(glTexEnviv_enc);
- set_glTexEnvxv(glTexEnvxv_enc);
- set_glTexImage2D(glTexImage2D_enc);
- set_glTexParameteri(glTexParameteri_enc);
- set_glTexParameterx(glTexParameterx_enc);
- set_glTexParameteriv(glTexParameteriv_enc);
- set_glTexParameterxv(glTexParameterxv_enc);
- set_glTexSubImage2D(glTexSubImage2D_enc);
- set_glTranslatex(glTranslatex_enc);
- set_glVertexPointer((glVertexPointer_client_proc_t)(enc_unsupported));
- set_glViewport(glViewport_enc);
- set_glPointSizePointerOES((glPointSizePointerOES_client_proc_t)(enc_unsupported));
- set_glVertexPointerOffset(glVertexPointerOffset_enc);
- set_glColorPointerOffset(glColorPointerOffset_enc);
- set_glNormalPointerOffset(glNormalPointerOffset_enc);
- set_glPointSizePointerOffset(glPointSizePointerOffset_enc);
- set_glTexCoordPointerOffset(glTexCoordPointerOffset_enc);
- set_glWeightPointerOffset(glWeightPointerOffset_enc);
- set_glMatrixIndexPointerOffset(glMatrixIndexPointerOffset_enc);
- set_glVertexPointerData(glVertexPointerData_enc);
- set_glColorPointerData(glColorPointerData_enc);
- set_glNormalPointerData(glNormalPointerData_enc);
- set_glTexCoordPointerData(glTexCoordPointerData_enc);
- set_glPointSizePointerData(glPointSizePointerData_enc);
- set_glWeightPointerData(glWeightPointerData_enc);
- set_glMatrixIndexPointerData(glMatrixIndexPointerData_enc);
- set_glDrawElementsOffset(glDrawElementsOffset_enc);
- set_glDrawElementsData(glDrawElementsData_enc);
- set_glGetCompressedTextureFormats(glGetCompressedTextureFormats_enc);
- set_glFinishRoundTrip(glFinishRoundTrip_enc);
- set_glBlendEquationSeparateOES(glBlendEquationSeparateOES_enc);
- set_glBlendFuncSeparateOES(glBlendFuncSeparateOES_enc);
- set_glBlendEquationOES(glBlendEquationOES_enc);
- set_glDrawTexsOES(glDrawTexsOES_enc);
- set_glDrawTexiOES(glDrawTexiOES_enc);
- set_glDrawTexxOES(glDrawTexxOES_enc);
- set_glDrawTexsvOES(glDrawTexsvOES_enc);
- set_glDrawTexivOES(glDrawTexivOES_enc);
- set_glDrawTexxvOES(glDrawTexxvOES_enc);
- set_glDrawTexfOES(glDrawTexfOES_enc);
- set_glDrawTexfvOES(glDrawTexfvOES_enc);
- set_glEGLImageTargetTexture2DOES(glEGLImageTargetTexture2DOES_enc);
- set_glEGLImageTargetRenderbufferStorageOES(glEGLImageTargetRenderbufferStorageOES_enc);
- set_glAlphaFuncxOES(glAlphaFuncxOES_enc);
- set_glClearColorxOES(glClearColorxOES_enc);
- set_glClearDepthxOES(glClearDepthxOES_enc);
- set_glClipPlanexOES(glClipPlanexOES_enc);
- set_glClipPlanexIMG(glClipPlanexIMG_enc);
- set_glColor4xOES(glColor4xOES_enc);
- set_glDepthRangexOES(glDepthRangexOES_enc);
- set_glFogxOES(glFogxOES_enc);
- set_glFogxvOES(glFogxvOES_enc);
- set_glFrustumxOES(glFrustumxOES_enc);
- set_glGetClipPlanexOES(glGetClipPlanexOES_enc);
- set_glGetClipPlanex(glGetClipPlanex_enc);
- set_glGetFixedvOES(glGetFixedvOES_enc);
- set_glGetLightxvOES(glGetLightxvOES_enc);
- set_glGetMaterialxvOES(glGetMaterialxvOES_enc);
- set_glGetTexEnvxvOES(glGetTexEnvxvOES_enc);
- set_glGetTexParameterxvOES(glGetTexParameterxvOES_enc);
- set_glLightModelxOES(glLightModelxOES_enc);
- set_glLightModelxvOES(glLightModelxvOES_enc);
- set_glLightxOES(glLightxOES_enc);
- set_glLightxvOES(glLightxvOES_enc);
- set_glLineWidthxOES(glLineWidthxOES_enc);
- set_glLoadMatrixxOES(glLoadMatrixxOES_enc);
- set_glMaterialxOES(glMaterialxOES_enc);
- set_glMaterialxvOES(glMaterialxvOES_enc);
- set_glMultMatrixxOES(glMultMatrixxOES_enc);
- set_glMultiTexCoord4xOES(glMultiTexCoord4xOES_enc);
- set_glNormal3xOES(glNormal3xOES_enc);
- set_glOrthoxOES(glOrthoxOES_enc);
- set_glPointParameterxOES(glPointParameterxOES_enc);
- set_glPointParameterxvOES(glPointParameterxvOES_enc);
- set_glPointSizexOES(glPointSizexOES_enc);
- set_glPolygonOffsetxOES(glPolygonOffsetxOES_enc);
- set_glRotatexOES(glRotatexOES_enc);
- set_glSampleCoveragexOES(glSampleCoveragexOES_enc);
- set_glScalexOES(glScalexOES_enc);
- set_glTexEnvxOES(glTexEnvxOES_enc);
- set_glTexEnvxvOES(glTexEnvxvOES_enc);
- set_glTexParameterxOES(glTexParameterxOES_enc);
- set_glTexParameterxvOES(glTexParameterxvOES_enc);
- set_glTranslatexOES(glTranslatexOES_enc);
- set_glIsRenderbufferOES(glIsRenderbufferOES_enc);
- set_glBindRenderbufferOES(glBindRenderbufferOES_enc);
- set_glDeleteRenderbuffersOES(glDeleteRenderbuffersOES_enc);
- set_glGenRenderbuffersOES(glGenRenderbuffersOES_enc);
- set_glRenderbufferStorageOES(glRenderbufferStorageOES_enc);
- set_glGetRenderbufferParameterivOES(glGetRenderbufferParameterivOES_enc);
- set_glIsFramebufferOES(glIsFramebufferOES_enc);
- set_glBindFramebufferOES(glBindFramebufferOES_enc);
- set_glDeleteFramebuffersOES(glDeleteFramebuffersOES_enc);
- set_glGenFramebuffersOES(glGenFramebuffersOES_enc);
- set_glCheckFramebufferStatusOES(glCheckFramebufferStatusOES_enc);
- set_glFramebufferRenderbufferOES(glFramebufferRenderbufferOES_enc);
- set_glFramebufferTexture2DOES(glFramebufferTexture2DOES_enc);
- set_glGetFramebufferAttachmentParameterivOES(glGetFramebufferAttachmentParameterivOES_enc);
- set_glGenerateMipmapOES(glGenerateMipmapOES_enc);
- set_glMapBufferOES((glMapBufferOES_client_proc_t)(enc_unsupported));
- set_glUnmapBufferOES(glUnmapBufferOES_enc);
- set_glGetBufferPointervOES((glGetBufferPointervOES_client_proc_t)(enc_unsupported));
- set_glCurrentPaletteMatrixOES(glCurrentPaletteMatrixOES_enc);
- set_glLoadPaletteFromModelViewMatrixOES(glLoadPaletteFromModelViewMatrixOES_enc);
- set_glMatrixIndexPointerOES((glMatrixIndexPointerOES_client_proc_t)(enc_unsupported));
- set_glWeightPointerOES((glWeightPointerOES_client_proc_t)(enc_unsupported));
- set_glQueryMatrixxOES(glQueryMatrixxOES_enc);
- set_glDepthRangefOES(glDepthRangefOES_enc);
- set_glFrustumfOES(glFrustumfOES_enc);
- set_glOrthofOES(glOrthofOES_enc);
- set_glClipPlanefOES(glClipPlanefOES_enc);
- set_glClipPlanefIMG(glClipPlanefIMG_enc);
- set_glGetClipPlanefOES(glGetClipPlanefOES_enc);
- set_glClearDepthfOES(glClearDepthfOES_enc);
- set_glTexGenfOES(glTexGenfOES_enc);
- set_glTexGenfvOES(glTexGenfvOES_enc);
- set_glTexGeniOES(glTexGeniOES_enc);
- set_glTexGenivOES(glTexGenivOES_enc);
- set_glTexGenxOES(glTexGenxOES_enc);
- set_glTexGenxvOES(glTexGenxvOES_enc);
- set_glGetTexGenfvOES(glGetTexGenfvOES_enc);
- set_glGetTexGenivOES(glGetTexGenivOES_enc);
- set_glGetTexGenxvOES(glGetTexGenxvOES_enc);
- set_glBindVertexArrayOES(glBindVertexArrayOES_enc);
- set_glDeleteVertexArraysOES(glDeleteVertexArraysOES_enc);
- set_glGenVertexArraysOES(glGenVertexArraysOES_enc);
- set_glIsVertexArrayOES(glIsVertexArrayOES_enc);
- set_glDiscardFramebufferEXT(glDiscardFramebufferEXT_enc);
- set_glMultiDrawArraysEXT((glMultiDrawArraysEXT_client_proc_t)(enc_unsupported));
- set_glMultiDrawElementsEXT((glMultiDrawElementsEXT_client_proc_t)(enc_unsupported));
- set_glMultiDrawArraysSUN((glMultiDrawArraysSUN_client_proc_t)(enc_unsupported));
- set_glMultiDrawElementsSUN((glMultiDrawElementsSUN_client_proc_t)(enc_unsupported));
- set_glRenderbufferStorageMultisampleIMG(glRenderbufferStorageMultisampleIMG_enc);
- set_glFramebufferTexture2DMultisampleIMG(glFramebufferTexture2DMultisampleIMG_enc);
- set_glDeleteFencesNV(glDeleteFencesNV_enc);
- set_glGenFencesNV(glGenFencesNV_enc);
- set_glIsFenceNV(glIsFenceNV_enc);
- set_glTestFenceNV(glTestFenceNV_enc);
- set_glGetFenceivNV(glGetFenceivNV_enc);
- set_glFinishFenceNV(glFinishFenceNV_enc);
- set_glSetFenceNV(glSetFenceNV_enc);
- set_glGetDriverControlsQCOM(glGetDriverControlsQCOM_enc);
- set_glGetDriverControlStringQCOM(glGetDriverControlStringQCOM_enc);
- set_glEnableDriverControlQCOM(glEnableDriverControlQCOM_enc);
- set_glDisableDriverControlQCOM(glDisableDriverControlQCOM_enc);
- set_glExtGetTexturesQCOM(glExtGetTexturesQCOM_enc);
- set_glExtGetBuffersQCOM(glExtGetBuffersQCOM_enc);
- set_glExtGetRenderbuffersQCOM(glExtGetRenderbuffersQCOM_enc);
- set_glExtGetFramebuffersQCOM(glExtGetFramebuffersQCOM_enc);
- set_glExtGetTexLevelParameterivQCOM(glExtGetTexLevelParameterivQCOM_enc);
- set_glExtTexObjectStateOverrideiQCOM(glExtTexObjectStateOverrideiQCOM_enc);
- set_glExtGetTexSubImageQCOM(glExtGetTexSubImageQCOM_enc);
- set_glExtGetBufferPointervQCOM((glExtGetBufferPointervQCOM_client_proc_t)(enc_unsupported));
- set_glExtGetShadersQCOM(glExtGetShadersQCOM_enc);
- set_glExtGetProgramsQCOM(glExtGetProgramsQCOM_enc);
- set_glExtIsProgramBinaryQCOM(glExtIsProgramBinaryQCOM_enc);
- set_glExtGetProgramBinarySourceQCOM((glExtGetProgramBinarySourceQCOM_client_proc_t)(enc_unsupported));
- set_glStartTilingQCOM(glStartTilingQCOM_enc);
- set_glEndTilingQCOM(glEndTilingQCOM_enc);
-}
-
diff --git a/tools/emulator/opengl/system/GLESv1_enc/gl_enc.h b/tools/emulator/opengl/system/GLESv1_enc/gl_enc.h
deleted file mode 100644
index d8a23e479..000000000
--- a/tools/emulator/opengl/system/GLESv1_enc/gl_enc.h
+++ /dev/null
@@ -1,316 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-
-#ifndef GUARD_gl_encoder_context_t
-#define GUARD_gl_encoder_context_t
-
-#include "IOStream.h"
-#include "gl_client_context.h"
-
-
-#include "glUtils.h"
-#include "GLEncoderUtils.h"
-
-struct gl_encoder_context_t : public gl_client_context_t {
-
- IOStream *m_stream;
-
- gl_encoder_context_t(IOStream *stream);
-
-
-};
-
-extern "C" {
- void glAlphaFunc_enc(void *self , GLenum func, GLclampf ref);
- void glClearColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
- void glClearDepthf_enc(void *self , GLclampf depth);
- void glClipPlanef_enc(void *self , GLenum plane, const GLfloat* equation);
- void glColor4f_enc(void *self , GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glDepthRangef_enc(void *self , GLclampf zNear, GLclampf zFar);
- void glFogf_enc(void *self , GLenum pname, GLfloat param);
- void glFogfv_enc(void *self , GLenum pname, const GLfloat* params);
- void glFrustumf_enc(void *self , GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
- void glGetClipPlanef_enc(void *self , GLenum pname, GLfloat* eqn);
- void glGetFloatv_enc(void *self , GLenum pname, GLfloat* params);
- void glGetLightfv_enc(void *self , GLenum light, GLenum pname, GLfloat* params);
- void glGetMaterialfv_enc(void *self , GLenum face, GLenum pname, GLfloat* params);
- void glGetTexEnvfv_enc(void *self , GLenum env, GLenum pname, GLfloat* params);
- void glGetTexParameterfv_enc(void *self , GLenum target, GLenum pname, GLfloat* params);
- void glLightModelf_enc(void *self , GLenum pname, GLfloat param);
- void glLightModelfv_enc(void *self , GLenum pname, const GLfloat* params);
- void glLightf_enc(void *self , GLenum light, GLenum pname, GLfloat param);
- void glLightfv_enc(void *self , GLenum light, GLenum pname, const GLfloat* params);
- void glLineWidth_enc(void *self , GLfloat width);
- void glLoadMatrixf_enc(void *self , const GLfloat* m);
- void glMaterialf_enc(void *self , GLenum face, GLenum pname, GLfloat param);
- void glMaterialfv_enc(void *self , GLenum face, GLenum pname, const GLfloat* params);
- void glMultMatrixf_enc(void *self , const GLfloat* m);
- void glMultiTexCoord4f_enc(void *self , GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glNormal3f_enc(void *self , GLfloat nx, GLfloat ny, GLfloat nz);
- void glOrthof_enc(void *self , GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
- void glPointParameterf_enc(void *self , GLenum pname, GLfloat param);
- void glPointParameterfv_enc(void *self , GLenum pname, const GLfloat* params);
- void glPointSize_enc(void *self , GLfloat size);
- void glPolygonOffset_enc(void *self , GLfloat factor, GLfloat units);
- void glRotatef_enc(void *self , GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void glScalef_enc(void *self , GLfloat x, GLfloat y, GLfloat z);
- void glTexEnvf_enc(void *self , GLenum target, GLenum pname, GLfloat param);
- void glTexEnvfv_enc(void *self , GLenum target, GLenum pname, const GLfloat* params);
- void glTexParameterf_enc(void *self , GLenum target, GLenum pname, GLfloat param);
- void glTexParameterfv_enc(void *self , GLenum target, GLenum pname, const GLfloat* params);
- void glTranslatef_enc(void *self , GLfloat x, GLfloat y, GLfloat z);
- void glActiveTexture_enc(void *self , GLenum texture);
- void glAlphaFuncx_enc(void *self , GLenum func, GLclampx ref);
- void glBindBuffer_enc(void *self , GLenum target, GLuint buffer);
- void glBindTexture_enc(void *self , GLenum target, GLuint texture);
- void glBlendFunc_enc(void *self , GLenum sfactor, GLenum dfactor);
- void glBufferData_enc(void *self , GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
- void glBufferSubData_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
- void glClear_enc(void *self , GLbitfield mask);
- void glClearColorx_enc(void *self , GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
- void glClearDepthx_enc(void *self , GLclampx depth);
- void glClearStencil_enc(void *self , GLint s);
- void glClientActiveTexture_enc(void *self , GLenum texture);
- void glColor4ub_enc(void *self , GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void glColor4x_enc(void *self , GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
- void glColorMask_enc(void *self , GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glColorPointer_enc(void *self , GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
- void glCompressedTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
- void glCompressedTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
- void glCopyTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCullFace_enc(void *self , GLenum mode);
- void glDeleteBuffers_enc(void *self , GLsizei n, const GLuint* buffers);
- void glDeleteTextures_enc(void *self , GLsizei n, const GLuint* textures);
- void glDepthFunc_enc(void *self , GLenum func);
- void glDepthMask_enc(void *self , GLboolean flag);
- void glDepthRangex_enc(void *self , GLclampx zNear, GLclampx zFar);
- void glDisable_enc(void *self , GLenum cap);
- void glDisableClientState_enc(void *self , GLenum array);
- void glDrawArrays_enc(void *self , GLenum mode, GLint first, GLsizei count);
- void glDrawElements_enc(void *self , GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
- void glEnable_enc(void *self , GLenum cap);
- void glEnableClientState_enc(void *self , GLenum array);
- void glFinish_enc(void *self );
- void glFlush_enc(void *self );
- void glFogx_enc(void *self , GLenum pname, GLfixed param);
- void glFogxv_enc(void *self , GLenum pname, const GLfixed* params);
- void glFrontFace_enc(void *self , GLenum mode);
- void glFrustumx_enc(void *self , GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
- void glGetBooleanv_enc(void *self , GLenum pname, GLboolean* params);
- void glGetBufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params);
- void glClipPlanex_enc(void *self , GLenum pname, const GLfixed* eqn);
- void glGenBuffers_enc(void *self , GLsizei n, GLuint* buffers);
- void glGenTextures_enc(void *self , GLsizei n, GLuint* textures);
- GLenum glGetError_enc(void *self );
- void glGetFixedv_enc(void *self , GLenum pname, GLfixed* params);
- void glGetIntegerv_enc(void *self , GLenum pname, GLint* params);
- void glGetLightxv_enc(void *self , GLenum light, GLenum pname, GLfixed* params);
- void glGetMaterialxv_enc(void *self , GLenum face, GLenum pname, GLfixed* params);
- void glGetPointerv_enc(void *self , GLenum pname, GLvoid** params);
- const GLubyte* glGetString_enc(void *self , GLenum name);
- void glGetTexEnviv_enc(void *self , GLenum env, GLenum pname, GLint* params);
- void glGetTexEnvxv_enc(void *self , GLenum env, GLenum pname, GLfixed* params);
- void glGetTexParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params);
- void glGetTexParameterxv_enc(void *self , GLenum target, GLenum pname, GLfixed* params);
- void glHint_enc(void *self , GLenum target, GLenum mode);
- GLboolean glIsBuffer_enc(void *self , GLuint buffer);
- GLboolean glIsEnabled_enc(void *self , GLenum cap);
- GLboolean glIsTexture_enc(void *self , GLuint texture);
- void glLightModelx_enc(void *self , GLenum pname, GLfixed param);
- void glLightModelxv_enc(void *self , GLenum pname, const GLfixed* params);
- void glLightx_enc(void *self , GLenum light, GLenum pname, GLfixed param);
- void glLightxv_enc(void *self , GLenum light, GLenum pname, const GLfixed* params);
- void glLineWidthx_enc(void *self , GLfixed width);
- void glLoadIdentity_enc(void *self );
- void glLoadMatrixx_enc(void *self , const GLfixed* m);
- void glLogicOp_enc(void *self , GLenum opcode);
- void glMaterialx_enc(void *self , GLenum face, GLenum pname, GLfixed param);
- void glMaterialxv_enc(void *self , GLenum face, GLenum pname, const GLfixed* params);
- void glMatrixMode_enc(void *self , GLenum mode);
- void glMultMatrixx_enc(void *self , const GLfixed* m);
- void glMultiTexCoord4x_enc(void *self , GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
- void glNormal3x_enc(void *self , GLfixed nx, GLfixed ny, GLfixed nz);
- void glNormalPointer_enc(void *self , GLenum type, GLsizei stride, const GLvoid* pointer);
- void glOrthox_enc(void *self , GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
- void glPixelStorei_enc(void *self , GLenum pname, GLint param);
- void glPointParameterx_enc(void *self , GLenum pname, GLfixed param);
- void glPointParameterxv_enc(void *self , GLenum pname, const GLfixed* params);
- void glPointSizex_enc(void *self , GLfixed size);
- void glPolygonOffsetx_enc(void *self , GLfixed factor, GLfixed units);
- void glPopMatrix_enc(void *self );
- void glPushMatrix_enc(void *self );
- void glReadPixels_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
- void glRotatex_enc(void *self , GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
- void glSampleCoverage_enc(void *self , GLclampf value, GLboolean invert);
- void glSampleCoveragex_enc(void *self , GLclampx value, GLboolean invert);
- void glScalex_enc(void *self , GLfixed x, GLfixed y, GLfixed z);
- void glScissor_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height);
- void glShadeModel_enc(void *self , GLenum mode);
- void glStencilFunc_enc(void *self , GLenum func, GLint ref, GLuint mask);
- void glStencilMask_enc(void *self , GLuint mask);
- void glStencilOp_enc(void *self , GLenum fail, GLenum zfail, GLenum zpass);
- void glTexCoordPointer_enc(void *self , GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
- void glTexEnvi_enc(void *self , GLenum target, GLenum pname, GLint param);
- void glTexEnvx_enc(void *self , GLenum target, GLenum pname, GLfixed param);
- void glTexEnviv_enc(void *self , GLenum target, GLenum pname, const GLint* params);
- void glTexEnvxv_enc(void *self , GLenum target, GLenum pname, const GLfixed* params);
- void glTexImage2D_enc(void *self , GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
- void glTexParameteri_enc(void *self , GLenum target, GLenum pname, GLint param);
- void glTexParameterx_enc(void *self , GLenum target, GLenum pname, GLfixed param);
- void glTexParameteriv_enc(void *self , GLenum target, GLenum pname, const GLint* params);
- void glTexParameterxv_enc(void *self , GLenum target, GLenum pname, const GLfixed* params);
- void glTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
- void glTranslatex_enc(void *self , GLfixed x, GLfixed y, GLfixed z);
- void glVertexPointer_enc(void *self , GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
- void glViewport_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height);
- void glPointSizePointerOES_enc(void *self , GLenum type, GLsizei stride, const GLvoid* pointer);
- void glVertexPointerOffset_enc(void *self , GLint size, GLenum type, GLsizei stride, GLuint offset);
- void glColorPointerOffset_enc(void *self , GLint size, GLenum type, GLsizei stride, GLuint offset);
- void glNormalPointerOffset_enc(void *self , GLenum type, GLsizei stride, GLuint offset);
- void glPointSizePointerOffset_enc(void *self , GLenum type, GLsizei stride, GLuint offset);
- void glTexCoordPointerOffset_enc(void *self , GLint size, GLenum type, GLsizei stride, GLuint offset);
- void glWeightPointerOffset_enc(void *self , GLint size, GLenum type, GLsizei stride, GLuint offset);
- void glMatrixIndexPointerOffset_enc(void *self , GLint size, GLenum type, GLsizei stride, GLuint offset);
- void glVertexPointerData_enc(void *self , GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen);
- void glColorPointerData_enc(void *self , GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen);
- void glNormalPointerData_enc(void *self , GLenum type, GLsizei stride, void* data, GLuint datalen);
- void glTexCoordPointerData_enc(void *self , GLint unit, GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen);
- void glPointSizePointerData_enc(void *self , GLenum type, GLsizei stride, void* data, GLuint datalen);
- void glWeightPointerData_enc(void *self , GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen);
- void glMatrixIndexPointerData_enc(void *self , GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen);
- void glDrawElementsOffset_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset);
- void glDrawElementsData_enc(void *self , GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen);
- void glGetCompressedTextureFormats_enc(void *self , int count, GLint* formats);
- int glFinishRoundTrip_enc(void *self );
- void glBlendEquationSeparateOES_enc(void *self , GLenum modeRGB, GLenum modeAlpha);
- void glBlendFuncSeparateOES_enc(void *self , GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void glBlendEquationOES_enc(void *self , GLenum mode);
- void glDrawTexsOES_enc(void *self , GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
- void glDrawTexiOES_enc(void *self , GLint x, GLint y, GLint z, GLint width, GLint height);
- void glDrawTexxOES_enc(void *self , GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
- void glDrawTexsvOES_enc(void *self , const GLshort* coords);
- void glDrawTexivOES_enc(void *self , const GLint* coords);
- void glDrawTexxvOES_enc(void *self , const GLfixed* coords);
- void glDrawTexfOES_enc(void *self , GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
- void glDrawTexfvOES_enc(void *self , const GLfloat* coords);
- void glEGLImageTargetTexture2DOES_enc(void *self , GLenum target, GLeglImageOES image);
- void glEGLImageTargetRenderbufferStorageOES_enc(void *self , GLenum target, GLeglImageOES image);
- void glAlphaFuncxOES_enc(void *self , GLenum func, GLclampx ref);
- void glClearColorxOES_enc(void *self , GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
- void glClearDepthxOES_enc(void *self , GLclampx depth);
- void glClipPlanexOES_enc(void *self , GLenum plane, const GLfixed* equation);
- void glClipPlanexIMG_enc(void *self , GLenum plane, const GLfixed* equation);
- void glColor4xOES_enc(void *self , GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
- void glDepthRangexOES_enc(void *self , GLclampx zNear, GLclampx zFar);
- void glFogxOES_enc(void *self , GLenum pname, GLfixed param);
- void glFogxvOES_enc(void *self , GLenum pname, const GLfixed* params);
- void glFrustumxOES_enc(void *self , GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
- void glGetClipPlanexOES_enc(void *self , GLenum pname, GLfixed* eqn);
- void glGetClipPlanex_enc(void *self , GLenum pname, GLfixed* eqn);
- void glGetFixedvOES_enc(void *self , GLenum pname, GLfixed* params);
- void glGetLightxvOES_enc(void *self , GLenum light, GLenum pname, GLfixed* params);
- void glGetMaterialxvOES_enc(void *self , GLenum face, GLenum pname, GLfixed* params);
- void glGetTexEnvxvOES_enc(void *self , GLenum env, GLenum pname, GLfixed* params);
- void glGetTexParameterxvOES_enc(void *self , GLenum target, GLenum pname, GLfixed* params);
- void glLightModelxOES_enc(void *self , GLenum pname, GLfixed param);
- void glLightModelxvOES_enc(void *self , GLenum pname, const GLfixed* params);
- void glLightxOES_enc(void *self , GLenum light, GLenum pname, GLfixed param);
- void glLightxvOES_enc(void *self , GLenum light, GLenum pname, const GLfixed* params);
- void glLineWidthxOES_enc(void *self , GLfixed width);
- void glLoadMatrixxOES_enc(void *self , const GLfixed* m);
- void glMaterialxOES_enc(void *self , GLenum face, GLenum pname, GLfixed param);
- void glMaterialxvOES_enc(void *self , GLenum face, GLenum pname, const GLfixed* params);
- void glMultMatrixxOES_enc(void *self , const GLfixed* m);
- void glMultiTexCoord4xOES_enc(void *self , GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
- void glNormal3xOES_enc(void *self , GLfixed nx, GLfixed ny, GLfixed nz);
- void glOrthoxOES_enc(void *self , GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
- void glPointParameterxOES_enc(void *self , GLenum pname, GLfixed param);
- void glPointParameterxvOES_enc(void *self , GLenum pname, const GLfixed* params);
- void glPointSizexOES_enc(void *self , GLfixed size);
- void glPolygonOffsetxOES_enc(void *self , GLfixed factor, GLfixed units);
- void glRotatexOES_enc(void *self , GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
- void glSampleCoveragexOES_enc(void *self , GLclampx value, GLboolean invert);
- void glScalexOES_enc(void *self , GLfixed x, GLfixed y, GLfixed z);
- void glTexEnvxOES_enc(void *self , GLenum target, GLenum pname, GLfixed param);
- void glTexEnvxvOES_enc(void *self , GLenum target, GLenum pname, const GLfixed* params);
- void glTexParameterxOES_enc(void *self , GLenum target, GLenum pname, GLfixed param);
- void glTexParameterxvOES_enc(void *self , GLenum target, GLenum pname, const GLfixed* params);
- void glTranslatexOES_enc(void *self , GLfixed x, GLfixed y, GLfixed z);
- GLboolean glIsRenderbufferOES_enc(void *self , GLuint renderbuffer);
- void glBindRenderbufferOES_enc(void *self , GLenum target, GLuint renderbuffer);
- void glDeleteRenderbuffersOES_enc(void *self , GLsizei n, const GLuint* renderbuffers);
- void glGenRenderbuffersOES_enc(void *self , GLsizei n, GLuint* renderbuffers);
- void glRenderbufferStorageOES_enc(void *self , GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGetRenderbufferParameterivOES_enc(void *self , GLenum target, GLenum pname, GLint* params);
- GLboolean glIsFramebufferOES_enc(void *self , GLuint framebuffer);
- void glBindFramebufferOES_enc(void *self , GLenum target, GLuint framebuffer);
- void glDeleteFramebuffersOES_enc(void *self , GLsizei n, const GLuint* framebuffers);
- void glGenFramebuffersOES_enc(void *self , GLsizei n, GLuint* framebuffers);
- GLenum glCheckFramebufferStatusOES_enc(void *self , GLenum target);
- void glFramebufferRenderbufferOES_enc(void *self , GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture2DOES_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glGetFramebufferAttachmentParameterivOES_enc(void *self , GLenum target, GLenum attachment, GLenum pname, GLint* params);
- void glGenerateMipmapOES_enc(void *self , GLenum target);
- void* glMapBufferOES_enc(void *self , GLenum target, GLenum access);
- GLboolean glUnmapBufferOES_enc(void *self , GLenum target);
- void glGetBufferPointervOES_enc(void *self , GLenum target, GLenum pname, GLvoid** params);
- void glCurrentPaletteMatrixOES_enc(void *self , GLuint matrixpaletteindex);
- void glLoadPaletteFromModelViewMatrixOES_enc(void *self );
- void glMatrixIndexPointerOES_enc(void *self , GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
- void glWeightPointerOES_enc(void *self , GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
- GLbitfield glQueryMatrixxOES_enc(void *self , GLfixed* mantissa, GLint* exponent);
- void glDepthRangefOES_enc(void *self , GLclampf zNear, GLclampf zFar);
- void glFrustumfOES_enc(void *self , GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
- void glOrthofOES_enc(void *self , GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
- void glClipPlanefOES_enc(void *self , GLenum plane, const GLfloat* equation);
- void glClipPlanefIMG_enc(void *self , GLenum plane, const GLfloat* equation);
- void glGetClipPlanefOES_enc(void *self , GLenum pname, GLfloat* eqn);
- void glClearDepthfOES_enc(void *self , GLclampf depth);
- void glTexGenfOES_enc(void *self , GLenum coord, GLenum pname, GLfloat param);
- void glTexGenfvOES_enc(void *self , GLenum coord, GLenum pname, const GLfloat* params);
- void glTexGeniOES_enc(void *self , GLenum coord, GLenum pname, GLint param);
- void glTexGenivOES_enc(void *self , GLenum coord, GLenum pname, const GLint* params);
- void glTexGenxOES_enc(void *self , GLenum coord, GLenum pname, GLfixed param);
- void glTexGenxvOES_enc(void *self , GLenum coord, GLenum pname, const GLfixed* params);
- void glGetTexGenfvOES_enc(void *self , GLenum coord, GLenum pname, GLfloat* params);
- void glGetTexGenivOES_enc(void *self , GLenum coord, GLenum pname, GLint* params);
- void glGetTexGenxvOES_enc(void *self , GLenum coord, GLenum pname, GLfixed* params);
- void glBindVertexArrayOES_enc(void *self , GLuint array);
- void glDeleteVertexArraysOES_enc(void *self , GLsizei n, const GLuint* arrays);
- void glGenVertexArraysOES_enc(void *self , GLsizei n, GLuint* arrays);
- GLboolean glIsVertexArrayOES_enc(void *self , GLuint array);
- void glDiscardFramebufferEXT_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments);
- void glMultiDrawArraysEXT_enc(void *self , GLenum mode, GLint* first, GLsizei* count, GLsizei primcount);
- void glMultiDrawElementsEXT_enc(void *self , GLenum mode, const GLsizei* count, GLenum type, const GLvoid** indices, GLsizei primcount);
- void glMultiDrawArraysSUN_enc(void *self , GLenum mode, GLint* first, GLsizei* count, GLsizei primcount);
- void glMultiDrawElementsSUN_enc(void *self , GLenum mode, const GLsizei* count, GLenum type, const GLvoid** indices, GLsizei primcount);
- void glRenderbufferStorageMultisampleIMG_enc(void *self , GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glFramebufferTexture2DMultisampleIMG_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
- void glDeleteFencesNV_enc(void *self , GLsizei n, const GLuint* fences);
- void glGenFencesNV_enc(void *self , GLsizei n, GLuint* fences);
- GLboolean glIsFenceNV_enc(void *self , GLuint fence);
- GLboolean glTestFenceNV_enc(void *self , GLuint fence);
- void glGetFenceivNV_enc(void *self , GLuint fence, GLenum pname, GLint* params);
- void glFinishFenceNV_enc(void *self , GLuint fence);
- void glSetFenceNV_enc(void *self , GLuint fence, GLenum condition);
- void glGetDriverControlsQCOM_enc(void *self , GLint* num, GLsizei size, GLuint* driverControls);
- void glGetDriverControlStringQCOM_enc(void *self , GLuint driverControl, GLsizei bufSize, GLsizei* length, GLchar* driverControlString);
- void glEnableDriverControlQCOM_enc(void *self , GLuint driverControl);
- void glDisableDriverControlQCOM_enc(void *self , GLuint driverControl);
- void glExtGetTexturesQCOM_enc(void *self , GLuint* textures, GLint maxTextures, GLint* numTextures);
- void glExtGetBuffersQCOM_enc(void *self , GLuint* buffers, GLint maxBuffers, GLint* numBuffers);
- void glExtGetRenderbuffersQCOM_enc(void *self , GLuint* renderbuffers, GLint maxRenderbuffers, GLint* numRenderbuffers);
- void glExtGetFramebuffersQCOM_enc(void *self , GLuint* framebuffers, GLint maxFramebuffers, GLint* numFramebuffers);
- void glExtGetTexLevelParameterivQCOM_enc(void *self , GLuint texture, GLenum face, GLint level, GLenum pname, GLint* params);
- void glExtTexObjectStateOverrideiQCOM_enc(void *self , GLenum target, GLenum pname, GLint param);
- void glExtGetTexSubImageQCOM_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid* texels);
- void glExtGetBufferPointervQCOM_enc(void *self , GLenum target, GLvoid** params);
- void glExtGetShadersQCOM_enc(void *self , GLuint* shaders, GLint maxShaders, GLint* numShaders);
- void glExtGetProgramsQCOM_enc(void *self , GLuint* programs, GLint maxPrograms, GLint* numPrograms);
- GLboolean glExtIsProgramBinaryQCOM_enc(void *self , GLuint program);
- void glExtGetProgramBinarySourceQCOM_enc(void *self , GLuint program, GLenum shadertype, GLchar* source, GLint* length);
- void glStartTilingQCOM_enc(void *self , GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
- void glEndTilingQCOM_enc(void *self , GLbitfield preserveMask);
-};
-#endif \ No newline at end of file
diff --git a/tools/emulator/opengl/system/GLESv1_enc/gl_entry.cpp b/tools/emulator/opengl/system/GLESv1_enc/gl_entry.cpp
deleted file mode 100644
index b43df09d0..000000000
--- a/tools/emulator/opengl/system/GLESv1_enc/gl_entry.cpp
+++ /dev/null
@@ -1,2066 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-#include <stdio.h>
-#include <stdlib.h>
-#include "gl_client_context.h"
-
-#ifndef GL_TRUE
-extern "C" {
- void glAlphaFunc(GLenum func, GLclampf ref);
- void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
- void glClearDepthf(GLclampf depth);
- void glClipPlanef(GLenum plane, const GLfloat* equation);
- void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glDepthRangef(GLclampf zNear, GLclampf zFar);
- void glFogf(GLenum pname, GLfloat param);
- void glFogfv(GLenum pname, const GLfloat* params);
- void glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
- void glGetClipPlanef(GLenum pname, GLfloat* eqn);
- void glGetFloatv(GLenum pname, GLfloat* params);
- void glGetLightfv(GLenum light, GLenum pname, GLfloat* params);
- void glGetMaterialfv(GLenum face, GLenum pname, GLfloat* params);
- void glGetTexEnvfv(GLenum env, GLenum pname, GLfloat* params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params);
- void glLightModelf(GLenum pname, GLfloat param);
- void glLightModelfv(GLenum pname, const GLfloat* params);
- void glLightf(GLenum light, GLenum pname, GLfloat param);
- void glLightfv(GLenum light, GLenum pname, const GLfloat* params);
- void glLineWidth(GLfloat width);
- void glLoadMatrixf(const GLfloat* m);
- void glMaterialf(GLenum face, GLenum pname, GLfloat param);
- void glMaterialfv(GLenum face, GLenum pname, const GLfloat* params);
- void glMultMatrixf(const GLfloat* m);
- void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
- void glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glPointParameterfv(GLenum pname, const GLfloat* params);
- void glPointSize(GLfloat size);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void glScalef(GLfloat x, GLfloat y, GLfloat z);
- void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
- void glTexEnvfv(GLenum target, GLenum pname, const GLfloat* params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params);
- void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
- void glActiveTexture(GLenum texture);
- void glAlphaFuncx(GLenum func, GLclampx ref);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glBindTexture(GLenum target, GLuint texture);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
- void glClear(GLbitfield mask);
- void glClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
- void glClearDepthx(GLclampx depth);
- void glClearStencil(GLint s);
- void glClientActiveTexture(GLenum texture);
- void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void glColor4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCullFace(GLenum mode);
- void glDeleteBuffers(GLsizei n, const GLuint* buffers);
- void glDeleteTextures(GLsizei n, const GLuint* textures);
- void glDepthFunc(GLenum func);
- void glDepthMask(GLboolean flag);
- void glDepthRangex(GLclampx zNear, GLclampx zFar);
- void glDisable(GLenum cap);
- void glDisableClientState(GLenum array);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
- void glEnable(GLenum cap);
- void glEnableClientState(GLenum array);
- void glFinish();
- void glFlush();
- void glFogx(GLenum pname, GLfixed param);
- void glFogxv(GLenum pname, const GLfixed* params);
- void glFrontFace(GLenum mode);
- void glFrustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
- void glGetBooleanv(GLenum pname, GLboolean* params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params);
- void glClipPlanex(GLenum pname, const GLfixed* eqn);
- void glGenBuffers(GLsizei n, GLuint* buffers);
- void glGenTextures(GLsizei n, GLuint* textures);
- GLenum glGetError();
- void glGetFixedv(GLenum pname, GLfixed* params);
- void glGetIntegerv(GLenum pname, GLint* params);
- void glGetLightxv(GLenum light, GLenum pname, GLfixed* params);
- void glGetMaterialxv(GLenum face, GLenum pname, GLfixed* params);
- void glGetPointerv(GLenum pname, GLvoid** params);
- const GLubyte* glGetString(GLenum name);
- void glGetTexEnviv(GLenum env, GLenum pname, GLint* params);
- void glGetTexEnvxv(GLenum env, GLenum pname, GLfixed* params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint* params);
- void glGetTexParameterxv(GLenum target, GLenum pname, GLfixed* params);
- void glHint(GLenum target, GLenum mode);
- GLboolean glIsBuffer(GLuint buffer);
- GLboolean glIsEnabled(GLenum cap);
- GLboolean glIsTexture(GLuint texture);
- void glLightModelx(GLenum pname, GLfixed param);
- void glLightModelxv(GLenum pname, const GLfixed* params);
- void glLightx(GLenum light, GLenum pname, GLfixed param);
- void glLightxv(GLenum light, GLenum pname, const GLfixed* params);
- void glLineWidthx(GLfixed width);
- void glLoadIdentity();
- void glLoadMatrixx(const GLfixed* m);
- void glLogicOp(GLenum opcode);
- void glMaterialx(GLenum face, GLenum pname, GLfixed param);
- void glMaterialxv(GLenum face, GLenum pname, const GLfixed* params);
- void glMatrixMode(GLenum mode);
- void glMultMatrixx(const GLfixed* m);
- void glMultiTexCoord4x(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
- void glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz);
- void glNormalPointer(GLenum type, GLsizei stride, const GLvoid* pointer);
- void glOrthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
- void glPixelStorei(GLenum pname, GLint param);
- void glPointParameterx(GLenum pname, GLfixed param);
- void glPointParameterxv(GLenum pname, const GLfixed* params);
- void glPointSizex(GLfixed size);
- void glPolygonOffsetx(GLfixed factor, GLfixed units);
- void glPopMatrix();
- void glPushMatrix();
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
- void glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
- void glSampleCoverage(GLclampf value, GLboolean invert);
- void glSampleCoveragex(GLclampx value, GLboolean invert);
- void glScalex(GLfixed x, GLfixed y, GLfixed z);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glShadeModel(GLenum mode);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glStencilMask(GLuint mask);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
- void glTexEnvi(GLenum target, GLenum pname, GLint param);
- void glTexEnvx(GLenum target, GLenum pname, GLfixed param);
- void glTexEnviv(GLenum target, GLenum pname, const GLint* params);
- void glTexEnvxv(GLenum target, GLenum pname, const GLfixed* params);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterx(GLenum target, GLenum pname, GLfixed param);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint* params);
- void glTexParameterxv(GLenum target, GLenum pname, const GLfixed* params);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
- void glTranslatex(GLfixed x, GLfixed y, GLfixed z);
- void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid* pointer);
- void glVertexPointerOffset(GLint size, GLenum type, GLsizei stride, GLuint offset);
- void glColorPointerOffset(GLint size, GLenum type, GLsizei stride, GLuint offset);
- void glNormalPointerOffset(GLenum type, GLsizei stride, GLuint offset);
- void glPointSizePointerOffset(GLenum type, GLsizei stride, GLuint offset);
- void glTexCoordPointerOffset(GLint size, GLenum type, GLsizei stride, GLuint offset);
- void glWeightPointerOffset(GLint size, GLenum type, GLsizei stride, GLuint offset);
- void glMatrixIndexPointerOffset(GLint size, GLenum type, GLsizei stride, GLuint offset);
- void glVertexPointerData(GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen);
- void glColorPointerData(GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen);
- void glNormalPointerData(GLenum type, GLsizei stride, void* data, GLuint datalen);
- void glTexCoordPointerData(GLint unit, GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen);
- void glPointSizePointerData(GLenum type, GLsizei stride, void* data, GLuint datalen);
- void glWeightPointerData(GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen);
- void glMatrixIndexPointerData(GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen);
- void glDrawElementsOffset(GLenum mode, GLsizei count, GLenum type, GLuint offset);
- void glDrawElementsData(GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen);
- void glGetCompressedTextureFormats(int count, GLint* formats);
- int glFinishRoundTrip();
- void glBlendEquationSeparateOES(GLenum modeRGB, GLenum modeAlpha);
- void glBlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void glBlendEquationOES(GLenum mode);
- void glDrawTexsOES(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
- void glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height);
- void glDrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
- void glDrawTexsvOES(const GLshort* coords);
- void glDrawTexivOES(const GLint* coords);
- void glDrawTexxvOES(const GLfixed* coords);
- void glDrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
- void glDrawTexfvOES(const GLfloat* coords);
- void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image);
- void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image);
- void glAlphaFuncxOES(GLenum func, GLclampx ref);
- void glClearColorxOES(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
- void glClearDepthxOES(GLclampx depth);
- void glClipPlanexOES(GLenum plane, const GLfixed* equation);
- void glClipPlanexIMG(GLenum plane, const GLfixed* equation);
- void glColor4xOES(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
- void glDepthRangexOES(GLclampx zNear, GLclampx zFar);
- void glFogxOES(GLenum pname, GLfixed param);
- void glFogxvOES(GLenum pname, const GLfixed* params);
- void glFrustumxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
- void glGetClipPlanexOES(GLenum pname, GLfixed* eqn);
- void glGetClipPlanex(GLenum pname, GLfixed* eqn);
- void glGetFixedvOES(GLenum pname, GLfixed* params);
- void glGetLightxvOES(GLenum light, GLenum pname, GLfixed* params);
- void glGetMaterialxvOES(GLenum face, GLenum pname, GLfixed* params);
- void glGetTexEnvxvOES(GLenum env, GLenum pname, GLfixed* params);
- void glGetTexParameterxvOES(GLenum target, GLenum pname, GLfixed* params);
- void glLightModelxOES(GLenum pname, GLfixed param);
- void glLightModelxvOES(GLenum pname, const GLfixed* params);
- void glLightxOES(GLenum light, GLenum pname, GLfixed param);
- void glLightxvOES(GLenum light, GLenum pname, const GLfixed* params);
- void glLineWidthxOES(GLfixed width);
- void glLoadMatrixxOES(const GLfixed* m);
- void glMaterialxOES(GLenum face, GLenum pname, GLfixed param);
- void glMaterialxvOES(GLenum face, GLenum pname, const GLfixed* params);
- void glMultMatrixxOES(const GLfixed* m);
- void glMultiTexCoord4xOES(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
- void glNormal3xOES(GLfixed nx, GLfixed ny, GLfixed nz);
- void glOrthoxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
- void glPointParameterxOES(GLenum pname, GLfixed param);
- void glPointParameterxvOES(GLenum pname, const GLfixed* params);
- void glPointSizexOES(GLfixed size);
- void glPolygonOffsetxOES(GLfixed factor, GLfixed units);
- void glRotatexOES(GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
- void glSampleCoveragexOES(GLclampx value, GLboolean invert);
- void glScalexOES(GLfixed x, GLfixed y, GLfixed z);
- void glTexEnvxOES(GLenum target, GLenum pname, GLfixed param);
- void glTexEnvxvOES(GLenum target, GLenum pname, const GLfixed* params);
- void glTexParameterxOES(GLenum target, GLenum pname, GLfixed param);
- void glTexParameterxvOES(GLenum target, GLenum pname, const GLfixed* params);
- void glTranslatexOES(GLfixed x, GLfixed y, GLfixed z);
- GLboolean glIsRenderbufferOES(GLuint renderbuffer);
- void glBindRenderbufferOES(GLenum target, GLuint renderbuffer);
- void glDeleteRenderbuffersOES(GLsizei n, const GLuint* renderbuffers);
- void glGenRenderbuffersOES(GLsizei n, GLuint* renderbuffers);
- void glRenderbufferStorageOES(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint* params);
- GLboolean glIsFramebufferOES(GLuint framebuffer);
- void glBindFramebufferOES(GLenum target, GLuint framebuffer);
- void glDeleteFramebuffersOES(GLsizei n, const GLuint* framebuffers);
- void glGenFramebuffersOES(GLsizei n, GLuint* framebuffers);
- GLenum glCheckFramebufferStatusOES(GLenum target);
- void glFramebufferRenderbufferOES(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint* params);
- void glGenerateMipmapOES(GLenum target);
- void* glMapBufferOES(GLenum target, GLenum access);
- GLboolean glUnmapBufferOES(GLenum target);
- void glGetBufferPointervOES(GLenum target, GLenum pname, GLvoid** params);
- void glCurrentPaletteMatrixOES(GLuint matrixpaletteindex);
- void glLoadPaletteFromModelViewMatrixOES();
- void glMatrixIndexPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
- void glWeightPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
- GLbitfield glQueryMatrixxOES(GLfixed* mantissa, GLint* exponent);
- void glDepthRangefOES(GLclampf zNear, GLclampf zFar);
- void glFrustumfOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
- void glOrthofOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
- void glClipPlanefOES(GLenum plane, const GLfloat* equation);
- void glClipPlanefIMG(GLenum plane, const GLfloat* equation);
- void glGetClipPlanefOES(GLenum pname, GLfloat* eqn);
- void glClearDepthfOES(GLclampf depth);
- void glTexGenfOES(GLenum coord, GLenum pname, GLfloat param);
- void glTexGenfvOES(GLenum coord, GLenum pname, const GLfloat* params);
- void glTexGeniOES(GLenum coord, GLenum pname, GLint param);
- void glTexGenivOES(GLenum coord, GLenum pname, const GLint* params);
- void glTexGenxOES(GLenum coord, GLenum pname, GLfixed param);
- void glTexGenxvOES(GLenum coord, GLenum pname, const GLfixed* params);
- void glGetTexGenfvOES(GLenum coord, GLenum pname, GLfloat* params);
- void glGetTexGenivOES(GLenum coord, GLenum pname, GLint* params);
- void glGetTexGenxvOES(GLenum coord, GLenum pname, GLfixed* params);
- void glBindVertexArrayOES(GLuint array);
- void glDeleteVertexArraysOES(GLsizei n, const GLuint* arrays);
- void glGenVertexArraysOES(GLsizei n, GLuint* arrays);
- GLboolean glIsVertexArrayOES(GLuint array);
- void glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum* attachments);
- void glMultiDrawArraysEXT(GLenum mode, GLint* first, GLsizei* count, GLsizei primcount);
- void glMultiDrawElementsEXT(GLenum mode, const GLsizei* count, GLenum type, const GLvoid** indices, GLsizei primcount);
- void glMultiDrawArraysSUN(GLenum mode, GLint* first, GLsizei* count, GLsizei primcount);
- void glMultiDrawElementsSUN(GLenum mode, const GLsizei* count, GLenum type, const GLvoid** indices, GLsizei primcount);
- void glRenderbufferStorageMultisampleIMG(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glFramebufferTexture2DMultisampleIMG(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
- void glDeleteFencesNV(GLsizei n, const GLuint* fences);
- void glGenFencesNV(GLsizei n, GLuint* fences);
- GLboolean glIsFenceNV(GLuint fence);
- GLboolean glTestFenceNV(GLuint fence);
- void glGetFenceivNV(GLuint fence, GLenum pname, GLint* params);
- void glFinishFenceNV(GLuint fence);
- void glSetFenceNV(GLuint fence, GLenum condition);
- void glGetDriverControlsQCOM(GLint* num, GLsizei size, GLuint* driverControls);
- void glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei* length, GLchar* driverControlString);
- void glEnableDriverControlQCOM(GLuint driverControl);
- void glDisableDriverControlQCOM(GLuint driverControl);
- void glExtGetTexturesQCOM(GLuint* textures, GLint maxTextures, GLint* numTextures);
- void glExtGetBuffersQCOM(GLuint* buffers, GLint maxBuffers, GLint* numBuffers);
- void glExtGetRenderbuffersQCOM(GLuint* renderbuffers, GLint maxRenderbuffers, GLint* numRenderbuffers);
- void glExtGetFramebuffersQCOM(GLuint* framebuffers, GLint maxFramebuffers, GLint* numFramebuffers);
- void glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint* params);
- void glExtTexObjectStateOverrideiQCOM(GLenum target, GLenum pname, GLint param);
- void glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid* texels);
- void glExtGetBufferPointervQCOM(GLenum target, GLvoid** params);
- void glExtGetShadersQCOM(GLuint* shaders, GLint maxShaders, GLint* numShaders);
- void glExtGetProgramsQCOM(GLuint* programs, GLint maxPrograms, GLint* numPrograms);
- GLboolean glExtIsProgramBinaryQCOM(GLuint program);
- void glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar* source, GLint* length);
- void glStartTilingQCOM(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
- void glEndTilingQCOM(GLbitfield preserveMask);
-};
-
-#endif
-#ifndef GET_CONTEXT
-static gl_client_context_t::CONTEXT_ACCESSOR_TYPE *getCurrentContext = NULL;
-void gl_client_context_t::setContextAccessor(CONTEXT_ACCESSOR_TYPE *f) { getCurrentContext = f; }
-#define GET_CONTEXT gl_client_context_t * ctx = getCurrentContext()
-#endif
-
-void glAlphaFunc(GLenum func, GLclampf ref)
-{
- GET_CONTEXT;
- ctx->glAlphaFunc(ctx, func, ref);
-}
-
-void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
- GET_CONTEXT;
- ctx->glClearColor(ctx, red, green, blue, alpha);
-}
-
-void glClearDepthf(GLclampf depth)
-{
- GET_CONTEXT;
- ctx->glClearDepthf(ctx, depth);
-}
-
-void glClipPlanef(GLenum plane, const GLfloat* equation)
-{
- GET_CONTEXT;
- ctx->glClipPlanef(ctx, plane, equation);
-}
-
-void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- GET_CONTEXT;
- ctx->glColor4f(ctx, red, green, blue, alpha);
-}
-
-void glDepthRangef(GLclampf zNear, GLclampf zFar)
-{
- GET_CONTEXT;
- ctx->glDepthRangef(ctx, zNear, zFar);
-}
-
-void glFogf(GLenum pname, GLfloat param)
-{
- GET_CONTEXT;
- ctx->glFogf(ctx, pname, param);
-}
-
-void glFogfv(GLenum pname, const GLfloat* params)
-{
- GET_CONTEXT;
- ctx->glFogfv(ctx, pname, params);
-}
-
-void glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-{
- GET_CONTEXT;
- ctx->glFrustumf(ctx, left, right, bottom, top, zNear, zFar);
-}
-
-void glGetClipPlanef(GLenum pname, GLfloat* eqn)
-{
- GET_CONTEXT;
- ctx->glGetClipPlanef(ctx, pname, eqn);
-}
-
-void glGetFloatv(GLenum pname, GLfloat* params)
-{
- GET_CONTEXT;
- ctx->glGetFloatv(ctx, pname, params);
-}
-
-void glGetLightfv(GLenum light, GLenum pname, GLfloat* params)
-{
- GET_CONTEXT;
- ctx->glGetLightfv(ctx, light, pname, params);
-}
-
-void glGetMaterialfv(GLenum face, GLenum pname, GLfloat* params)
-{
- GET_CONTEXT;
- ctx->glGetMaterialfv(ctx, face, pname, params);
-}
-
-void glGetTexEnvfv(GLenum env, GLenum pname, GLfloat* params)
-{
- GET_CONTEXT;
- ctx->glGetTexEnvfv(ctx, env, pname, params);
-}
-
-void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
-{
- GET_CONTEXT;
- ctx->glGetTexParameterfv(ctx, target, pname, params);
-}
-
-void glLightModelf(GLenum pname, GLfloat param)
-{
- GET_CONTEXT;
- ctx->glLightModelf(ctx, pname, param);
-}
-
-void glLightModelfv(GLenum pname, const GLfloat* params)
-{
- GET_CONTEXT;
- ctx->glLightModelfv(ctx, pname, params);
-}
-
-void glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- GET_CONTEXT;
- ctx->glLightf(ctx, light, pname, param);
-}
-
-void glLightfv(GLenum light, GLenum pname, const GLfloat* params)
-{
- GET_CONTEXT;
- ctx->glLightfv(ctx, light, pname, params);
-}
-
-void glLineWidth(GLfloat width)
-{
- GET_CONTEXT;
- ctx->glLineWidth(ctx, width);
-}
-
-void glLoadMatrixf(const GLfloat* m)
-{
- GET_CONTEXT;
- ctx->glLoadMatrixf(ctx, m);
-}
-
-void glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- GET_CONTEXT;
- ctx->glMaterialf(ctx, face, pname, param);
-}
-
-void glMaterialfv(GLenum face, GLenum pname, const GLfloat* params)
-{
- GET_CONTEXT;
- ctx->glMaterialfv(ctx, face, pname, params);
-}
-
-void glMultMatrixf(const GLfloat* m)
-{
- GET_CONTEXT;
- ctx->glMultMatrixf(ctx, m);
-}
-
-void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- GET_CONTEXT;
- ctx->glMultiTexCoord4f(ctx, target, s, t, r, q);
-}
-
-void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- GET_CONTEXT;
- ctx->glNormal3f(ctx, nx, ny, nz);
-}
-
-void glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-{
- GET_CONTEXT;
- ctx->glOrthof(ctx, left, right, bottom, top, zNear, zFar);
-}
-
-void glPointParameterf(GLenum pname, GLfloat param)
-{
- GET_CONTEXT;
- ctx->glPointParameterf(ctx, pname, param);
-}
-
-void glPointParameterfv(GLenum pname, const GLfloat* params)
-{
- GET_CONTEXT;
- ctx->glPointParameterfv(ctx, pname, params);
-}
-
-void glPointSize(GLfloat size)
-{
- GET_CONTEXT;
- ctx->glPointSize(ctx, size);
-}
-
-void glPolygonOffset(GLfloat factor, GLfloat units)
-{
- GET_CONTEXT;
- ctx->glPolygonOffset(ctx, factor, units);
-}
-
-void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- GET_CONTEXT;
- ctx->glRotatef(ctx, angle, x, y, z);
-}
-
-void glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- GET_CONTEXT;
- ctx->glScalef(ctx, x, y, z);
-}
-
-void glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- GET_CONTEXT;
- ctx->glTexEnvf(ctx, target, pname, param);
-}
-
-void glTexEnvfv(GLenum target, GLenum pname, const GLfloat* params)
-{
- GET_CONTEXT;
- ctx->glTexEnvfv(ctx, target, pname, params);
-}
-
-void glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- GET_CONTEXT;
- ctx->glTexParameterf(ctx, target, pname, param);
-}
-
-void glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
-{
- GET_CONTEXT;
- ctx->glTexParameterfv(ctx, target, pname, params);
-}
-
-void glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- GET_CONTEXT;
- ctx->glTranslatef(ctx, x, y, z);
-}
-
-void glActiveTexture(GLenum texture)
-{
- GET_CONTEXT;
- ctx->glActiveTexture(ctx, texture);
-}
-
-void glAlphaFuncx(GLenum func, GLclampx ref)
-{
- GET_CONTEXT;
- ctx->glAlphaFuncx(ctx, func, ref);
-}
-
-void glBindBuffer(GLenum target, GLuint buffer)
-{
- GET_CONTEXT;
- ctx->glBindBuffer(ctx, target, buffer);
-}
-
-void glBindTexture(GLenum target, GLuint texture)
-{
- GET_CONTEXT;
- ctx->glBindTexture(ctx, target, texture);
-}
-
-void glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- GET_CONTEXT;
- ctx->glBlendFunc(ctx, sfactor, dfactor);
-}
-
-void glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
-{
- GET_CONTEXT;
- ctx->glBufferData(ctx, target, size, data, usage);
-}
-
-void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
-{
- GET_CONTEXT;
- ctx->glBufferSubData(ctx, target, offset, size, data);
-}
-
-void glClear(GLbitfield mask)
-{
- GET_CONTEXT;
- ctx->glClear(ctx, mask);
-}
-
-void glClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
-{
- GET_CONTEXT;
- ctx->glClearColorx(ctx, red, green, blue, alpha);
-}
-
-void glClearDepthx(GLclampx depth)
-{
- GET_CONTEXT;
- ctx->glClearDepthx(ctx, depth);
-}
-
-void glClearStencil(GLint s)
-{
- GET_CONTEXT;
- ctx->glClearStencil(ctx, s);
-}
-
-void glClientActiveTexture(GLenum texture)
-{
- GET_CONTEXT;
- ctx->glClientActiveTexture(ctx, texture);
-}
-
-void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- GET_CONTEXT;
- ctx->glColor4ub(ctx, red, green, blue, alpha);
-}
-
-void glColor4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
-{
- GET_CONTEXT;
- ctx->glColor4x(ctx, red, green, blue, alpha);
-}
-
-void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- GET_CONTEXT;
- ctx->glColorMask(ctx, red, green, blue, alpha);
-}
-
-void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
-{
- GET_CONTEXT;
- ctx->glColorPointer(ctx, size, type, stride, pointer);
-}
-
-void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data)
-{
- GET_CONTEXT;
- ctx->glCompressedTexImage2D(ctx, target, level, internalformat, width, height, border, imageSize, data);
-}
-
-void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data)
-{
- GET_CONTEXT;
- ctx->glCompressedTexSubImage2D(ctx, target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- GET_CONTEXT;
- ctx->glCopyTexImage2D(ctx, target, level, internalformat, x, y, width, height, border);
-}
-
-void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- GET_CONTEXT;
- ctx->glCopyTexSubImage2D(ctx, target, level, xoffset, yoffset, x, y, width, height);
-}
-
-void glCullFace(GLenum mode)
-{
- GET_CONTEXT;
- ctx->glCullFace(ctx, mode);
-}
-
-void glDeleteBuffers(GLsizei n, const GLuint* buffers)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glDeleteBuffers(ctx, n, buffers);
-}
-
-void glDeleteTextures(GLsizei n, const GLuint* textures)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glDeleteTextures(ctx, n, textures);
-}
-
-void glDepthFunc(GLenum func)
-{
- GET_CONTEXT;
- ctx->glDepthFunc(ctx, func);
-}
-
-void glDepthMask(GLboolean flag)
-{
- GET_CONTEXT;
- ctx->glDepthMask(ctx, flag);
-}
-
-void glDepthRangex(GLclampx zNear, GLclampx zFar)
-{
- GET_CONTEXT;
- ctx->glDepthRangex(ctx, zNear, zFar);
-}
-
-void glDisable(GLenum cap)
-{
- GET_CONTEXT;
- ctx->glDisable(ctx, cap);
-}
-
-void glDisableClientState(GLenum array)
-{
- GET_CONTEXT;
- ctx->glDisableClientState(ctx, array);
-}
-
-void glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- GET_CONTEXT;
- ctx->glDrawArrays(ctx, mode, first, count);
-}
-
-void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
-{
- GET_CONTEXT;
- ctx->glDrawElements(ctx, mode, count, type, indices);
-}
-
-void glEnable(GLenum cap)
-{
- GET_CONTEXT;
- ctx->glEnable(ctx, cap);
-}
-
-void glEnableClientState(GLenum array)
-{
- GET_CONTEXT;
- ctx->glEnableClientState(ctx, array);
-}
-
-void glFinish()
-{
- GET_CONTEXT;
- ctx->glFinish(ctx);
-}
-
-void glFlush()
-{
- GET_CONTEXT;
- ctx->glFlush(ctx);
-}
-
-void glFogx(GLenum pname, GLfixed param)
-{
- GET_CONTEXT;
- ctx->glFogx(ctx, pname, param);
-}
-
-void glFogxv(GLenum pname, const GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glFogxv(ctx, pname, params);
-}
-
-void glFrontFace(GLenum mode)
-{
- GET_CONTEXT;
- ctx->glFrontFace(ctx, mode);
-}
-
-void glFrustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-{
- GET_CONTEXT;
- ctx->glFrustumx(ctx, left, right, bottom, top, zNear, zFar);
-}
-
-void glGetBooleanv(GLenum pname, GLboolean* params)
-{
- GET_CONTEXT;
- ctx->glGetBooleanv(ctx, pname, params);
-}
-
-void glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
-{
- GET_CONTEXT;
- ctx->glGetBufferParameteriv(ctx, target, pname, params);
-}
-
-void glClipPlanex(GLenum pname, const GLfixed* eqn)
-{
- GET_CONTEXT;
- ctx->glClipPlanex(ctx, pname, eqn);
-}
-
-void glGenBuffers(GLsizei n, GLuint* buffers)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glGenBuffers(ctx, n, buffers);
-}
-
-void glGenTextures(GLsizei n, GLuint* textures)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glGenTextures(ctx, n, textures);
-}
-
-GLenum glGetError()
-{
- GET_CONTEXT;
- return ctx->glGetError(ctx);
-}
-
-void glGetFixedv(GLenum pname, GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glGetFixedv(ctx, pname, params);
-}
-
-void glGetIntegerv(GLenum pname, GLint* params)
-{
- GET_CONTEXT;
- ctx->glGetIntegerv(ctx, pname, params);
-}
-
-void glGetLightxv(GLenum light, GLenum pname, GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glGetLightxv(ctx, light, pname, params);
-}
-
-void glGetMaterialxv(GLenum face, GLenum pname, GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glGetMaterialxv(ctx, face, pname, params);
-}
-
-void glGetPointerv(GLenum pname, GLvoid** params)
-{
- GET_CONTEXT;
- ctx->glGetPointerv(ctx, pname, params);
-}
-
-const GLubyte* glGetString(GLenum name)
-{
- GET_CONTEXT;
- return ctx->glGetString(ctx, name);
-}
-
-void glGetTexEnviv(GLenum env, GLenum pname, GLint* params)
-{
- GET_CONTEXT;
- ctx->glGetTexEnviv(ctx, env, pname, params);
-}
-
-void glGetTexEnvxv(GLenum env, GLenum pname, GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glGetTexEnvxv(ctx, env, pname, params);
-}
-
-void glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
-{
- GET_CONTEXT;
- ctx->glGetTexParameteriv(ctx, target, pname, params);
-}
-
-void glGetTexParameterxv(GLenum target, GLenum pname, GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glGetTexParameterxv(ctx, target, pname, params);
-}
-
-void glHint(GLenum target, GLenum mode)
-{
- GET_CONTEXT;
- ctx->glHint(ctx, target, mode);
-}
-
-GLboolean glIsBuffer(GLuint buffer)
-{
- GET_CONTEXT;
- return ctx->glIsBuffer(ctx, buffer);
-}
-
-GLboolean glIsEnabled(GLenum cap)
-{
- GET_CONTEXT;
- return ctx->glIsEnabled(ctx, cap);
-}
-
-GLboolean glIsTexture(GLuint texture)
-{
- GET_CONTEXT;
- return ctx->glIsTexture(ctx, texture);
-}
-
-void glLightModelx(GLenum pname, GLfixed param)
-{
- GET_CONTEXT;
- ctx->glLightModelx(ctx, pname, param);
-}
-
-void glLightModelxv(GLenum pname, const GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glLightModelxv(ctx, pname, params);
-}
-
-void glLightx(GLenum light, GLenum pname, GLfixed param)
-{
- GET_CONTEXT;
- ctx->glLightx(ctx, light, pname, param);
-}
-
-void glLightxv(GLenum light, GLenum pname, const GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glLightxv(ctx, light, pname, params);
-}
-
-void glLineWidthx(GLfixed width)
-{
- GET_CONTEXT;
- ctx->glLineWidthx(ctx, width);
-}
-
-void glLoadIdentity()
-{
- GET_CONTEXT;
- ctx->glLoadIdentity(ctx);
-}
-
-void glLoadMatrixx(const GLfixed* m)
-{
- GET_CONTEXT;
- ctx->glLoadMatrixx(ctx, m);
-}
-
-void glLogicOp(GLenum opcode)
-{
- GET_CONTEXT;
- ctx->glLogicOp(ctx, opcode);
-}
-
-void glMaterialx(GLenum face, GLenum pname, GLfixed param)
-{
- GET_CONTEXT;
- ctx->glMaterialx(ctx, face, pname, param);
-}
-
-void glMaterialxv(GLenum face, GLenum pname, const GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glMaterialxv(ctx, face, pname, params);
-}
-
-void glMatrixMode(GLenum mode)
-{
- GET_CONTEXT;
- ctx->glMatrixMode(ctx, mode);
-}
-
-void glMultMatrixx(const GLfixed* m)
-{
- GET_CONTEXT;
- ctx->glMultMatrixx(ctx, m);
-}
-
-void glMultiTexCoord4x(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
-{
- GET_CONTEXT;
- ctx->glMultiTexCoord4x(ctx, target, s, t, r, q);
-}
-
-void glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz)
-{
- GET_CONTEXT;
- ctx->glNormal3x(ctx, nx, ny, nz);
-}
-
-void glNormalPointer(GLenum type, GLsizei stride, const GLvoid* pointer)
-{
- GET_CONTEXT;
- ctx->glNormalPointer(ctx, type, stride, pointer);
-}
-
-void glOrthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-{
- GET_CONTEXT;
- ctx->glOrthox(ctx, left, right, bottom, top, zNear, zFar);
-}
-
-void glPixelStorei(GLenum pname, GLint param)
-{
- GET_CONTEXT;
- ctx->glPixelStorei(ctx, pname, param);
-}
-
-void glPointParameterx(GLenum pname, GLfixed param)
-{
- GET_CONTEXT;
- ctx->glPointParameterx(ctx, pname, param);
-}
-
-void glPointParameterxv(GLenum pname, const GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glPointParameterxv(ctx, pname, params);
-}
-
-void glPointSizex(GLfixed size)
-{
- GET_CONTEXT;
- ctx->glPointSizex(ctx, size);
-}
-
-void glPolygonOffsetx(GLfixed factor, GLfixed units)
-{
- GET_CONTEXT;
- ctx->glPolygonOffsetx(ctx, factor, units);
-}
-
-void glPopMatrix()
-{
- GET_CONTEXT;
- ctx->glPopMatrix(ctx);
-}
-
-void glPushMatrix()
-{
- GET_CONTEXT;
- ctx->glPushMatrix(ctx);
-}
-
-void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
-{
- GET_CONTEXT;
- ctx->glReadPixels(ctx, x, y, width, height, format, type, pixels);
-}
-
-void glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
-{
- GET_CONTEXT;
- ctx->glRotatex(ctx, angle, x, y, z);
-}
-
-void glSampleCoverage(GLclampf value, GLboolean invert)
-{
- GET_CONTEXT;
- ctx->glSampleCoverage(ctx, value, invert);
-}
-
-void glSampleCoveragex(GLclampx value, GLboolean invert)
-{
- GET_CONTEXT;
- ctx->glSampleCoveragex(ctx, value, invert);
-}
-
-void glScalex(GLfixed x, GLfixed y, GLfixed z)
-{
- GET_CONTEXT;
- ctx->glScalex(ctx, x, y, z);
-}
-
-void glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- GET_CONTEXT;
- ctx->glScissor(ctx, x, y, width, height);
-}
-
-void glShadeModel(GLenum mode)
-{
- GET_CONTEXT;
- ctx->glShadeModel(ctx, mode);
-}
-
-void glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- GET_CONTEXT;
- ctx->glStencilFunc(ctx, func, ref, mask);
-}
-
-void glStencilMask(GLuint mask)
-{
- GET_CONTEXT;
- ctx->glStencilMask(ctx, mask);
-}
-
-void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- GET_CONTEXT;
- ctx->glStencilOp(ctx, fail, zfail, zpass);
-}
-
-void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
-{
- GET_CONTEXT;
- ctx->glTexCoordPointer(ctx, size, type, stride, pointer);
-}
-
-void glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- GET_CONTEXT;
- ctx->glTexEnvi(ctx, target, pname, param);
-}
-
-void glTexEnvx(GLenum target, GLenum pname, GLfixed param)
-{
- GET_CONTEXT;
- ctx->glTexEnvx(ctx, target, pname, param);
-}
-
-void glTexEnviv(GLenum target, GLenum pname, const GLint* params)
-{
- GET_CONTEXT;
- ctx->glTexEnviv(ctx, target, pname, params);
-}
-
-void glTexEnvxv(GLenum target, GLenum pname, const GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glTexEnvxv(ctx, target, pname, params);
-}
-
-void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
-{
- GET_CONTEXT;
- ctx->glTexImage2D(ctx, target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-void glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- GET_CONTEXT;
- ctx->glTexParameteri(ctx, target, pname, param);
-}
-
-void glTexParameterx(GLenum target, GLenum pname, GLfixed param)
-{
- GET_CONTEXT;
- ctx->glTexParameterx(ctx, target, pname, param);
-}
-
-void glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
-{
- GET_CONTEXT;
- ctx->glTexParameteriv(ctx, target, pname, params);
-}
-
-void glTexParameterxv(GLenum target, GLenum pname, const GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glTexParameterxv(ctx, target, pname, params);
-}
-
-void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
-{
- GET_CONTEXT;
- ctx->glTexSubImage2D(ctx, target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-void glTranslatex(GLfixed x, GLfixed y, GLfixed z)
-{
- GET_CONTEXT;
- ctx->glTranslatex(ctx, x, y, z);
-}
-
-void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
-{
- GET_CONTEXT;
- ctx->glVertexPointer(ctx, size, type, stride, pointer);
-}
-
-void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- GET_CONTEXT;
- ctx->glViewport(ctx, x, y, width, height);
-}
-
-void glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid* pointer)
-{
- GET_CONTEXT;
- ctx->glPointSizePointerOES(ctx, type, stride, pointer);
-}
-
-void glVertexPointerOffset(GLint size, GLenum type, GLsizei stride, GLuint offset)
-{
- GET_CONTEXT;
- ctx->glVertexPointerOffset(ctx, size, type, stride, offset);
-}
-
-void glColorPointerOffset(GLint size, GLenum type, GLsizei stride, GLuint offset)
-{
- GET_CONTEXT;
- ctx->glColorPointerOffset(ctx, size, type, stride, offset);
-}
-
-void glNormalPointerOffset(GLenum type, GLsizei stride, GLuint offset)
-{
- GET_CONTEXT;
- ctx->glNormalPointerOffset(ctx, type, stride, offset);
-}
-
-void glPointSizePointerOffset(GLenum type, GLsizei stride, GLuint offset)
-{
- GET_CONTEXT;
- ctx->glPointSizePointerOffset(ctx, type, stride, offset);
-}
-
-void glTexCoordPointerOffset(GLint size, GLenum type, GLsizei stride, GLuint offset)
-{
- GET_CONTEXT;
- ctx->glTexCoordPointerOffset(ctx, size, type, stride, offset);
-}
-
-void glWeightPointerOffset(GLint size, GLenum type, GLsizei stride, GLuint offset)
-{
- GET_CONTEXT;
- ctx->glWeightPointerOffset(ctx, size, type, stride, offset);
-}
-
-void glMatrixIndexPointerOffset(GLint size, GLenum type, GLsizei stride, GLuint offset)
-{
- GET_CONTEXT;
- ctx->glMatrixIndexPointerOffset(ctx, size, type, stride, offset);
-}
-
-void glVertexPointerData(GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
-{
- GET_CONTEXT;
- ctx->glVertexPointerData(ctx, size, type, stride, data, datalen);
-}
-
-void glColorPointerData(GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
-{
- GET_CONTEXT;
- ctx->glColorPointerData(ctx, size, type, stride, data, datalen);
-}
-
-void glNormalPointerData(GLenum type, GLsizei stride, void* data, GLuint datalen)
-{
- GET_CONTEXT;
- ctx->glNormalPointerData(ctx, type, stride, data, datalen);
-}
-
-void glTexCoordPointerData(GLint unit, GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
-{
- GET_CONTEXT;
- ctx->glTexCoordPointerData(ctx, unit, size, type, stride, data, datalen);
-}
-
-void glPointSizePointerData(GLenum type, GLsizei stride, void* data, GLuint datalen)
-{
- GET_CONTEXT;
- ctx->glPointSizePointerData(ctx, type, stride, data, datalen);
-}
-
-void glWeightPointerData(GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
-{
- GET_CONTEXT;
- ctx->glWeightPointerData(ctx, size, type, stride, data, datalen);
-}
-
-void glMatrixIndexPointerData(GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
-{
- GET_CONTEXT;
- ctx->glMatrixIndexPointerData(ctx, size, type, stride, data, datalen);
-}
-
-void glDrawElementsOffset(GLenum mode, GLsizei count, GLenum type, GLuint offset)
-{
- GET_CONTEXT;
- ctx->glDrawElementsOffset(ctx, mode, count, type, offset);
-}
-
-void glDrawElementsData(GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen)
-{
- GET_CONTEXT;
- ctx->glDrawElementsData(ctx, mode, count, type, data, datalen);
-}
-
-void glGetCompressedTextureFormats(int count, GLint* formats)
-{
- GET_CONTEXT;
- ctx->glGetCompressedTextureFormats(ctx, count, formats);
-}
-
-int glFinishRoundTrip()
-{
- GET_CONTEXT;
- return ctx->glFinishRoundTrip(ctx);
-}
-
-void glBlendEquationSeparateOES(GLenum modeRGB, GLenum modeAlpha)
-{
- GET_CONTEXT;
- ctx->glBlendEquationSeparateOES(ctx, modeRGB, modeAlpha);
-}
-
-void glBlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- GET_CONTEXT;
- ctx->glBlendFuncSeparateOES(ctx, srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-void glBlendEquationOES(GLenum mode)
-{
- GET_CONTEXT;
- ctx->glBlendEquationOES(ctx, mode);
-}
-
-void glDrawTexsOES(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height)
-{
- GET_CONTEXT;
- ctx->glDrawTexsOES(ctx, x, y, z, width, height);
-}
-
-void glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height)
-{
- GET_CONTEXT;
- ctx->glDrawTexiOES(ctx, x, y, z, width, height);
-}
-
-void glDrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height)
-{
- GET_CONTEXT;
- ctx->glDrawTexxOES(ctx, x, y, z, width, height);
-}
-
-void glDrawTexsvOES(const GLshort* coords)
-{
- GET_CONTEXT;
- ctx->glDrawTexsvOES(ctx, coords);
-}
-
-void glDrawTexivOES(const GLint* coords)
-{
- GET_CONTEXT;
- ctx->glDrawTexivOES(ctx, coords);
-}
-
-void glDrawTexxvOES(const GLfixed* coords)
-{
- GET_CONTEXT;
- ctx->glDrawTexxvOES(ctx, coords);
-}
-
-void glDrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height)
-{
- GET_CONTEXT;
- ctx->glDrawTexfOES(ctx, x, y, z, width, height);
-}
-
-void glDrawTexfvOES(const GLfloat* coords)
-{
- GET_CONTEXT;
- ctx->glDrawTexfvOES(ctx, coords);
-}
-
-void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
-{
- GET_CONTEXT;
- ctx->glEGLImageTargetTexture2DOES(ctx, target, image);
-}
-
-void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
-{
- GET_CONTEXT;
- ctx->glEGLImageTargetRenderbufferStorageOES(ctx, target, image);
-}
-
-void glAlphaFuncxOES(GLenum func, GLclampx ref)
-{
- GET_CONTEXT;
- ctx->glAlphaFuncxOES(ctx, func, ref);
-}
-
-void glClearColorxOES(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
-{
- GET_CONTEXT;
- ctx->glClearColorxOES(ctx, red, green, blue, alpha);
-}
-
-void glClearDepthxOES(GLclampx depth)
-{
- GET_CONTEXT;
- ctx->glClearDepthxOES(ctx, depth);
-}
-
-void glClipPlanexOES(GLenum plane, const GLfixed* equation)
-{
- GET_CONTEXT;
- ctx->glClipPlanexOES(ctx, plane, equation);
-}
-
-void glClipPlanexIMG(GLenum plane, const GLfixed* equation)
-{
- GET_CONTEXT;
- ctx->glClipPlanexIMG(ctx, plane, equation);
-}
-
-void glColor4xOES(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
-{
- GET_CONTEXT;
- ctx->glColor4xOES(ctx, red, green, blue, alpha);
-}
-
-void glDepthRangexOES(GLclampx zNear, GLclampx zFar)
-{
- GET_CONTEXT;
- ctx->glDepthRangexOES(ctx, zNear, zFar);
-}
-
-void glFogxOES(GLenum pname, GLfixed param)
-{
- GET_CONTEXT;
- ctx->glFogxOES(ctx, pname, param);
-}
-
-void glFogxvOES(GLenum pname, const GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glFogxvOES(ctx, pname, params);
-}
-
-void glFrustumxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-{
- GET_CONTEXT;
- ctx->glFrustumxOES(ctx, left, right, bottom, top, zNear, zFar);
-}
-
-void glGetClipPlanexOES(GLenum pname, GLfixed* eqn)
-{
- GET_CONTEXT;
- ctx->glGetClipPlanexOES(ctx, pname, eqn);
-}
-
-void glGetClipPlanex(GLenum pname, GLfixed* eqn)
-{
- GET_CONTEXT;
- ctx->glGetClipPlanex(ctx, pname, eqn);
-}
-
-void glGetFixedvOES(GLenum pname, GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glGetFixedvOES(ctx, pname, params);
-}
-
-void glGetLightxvOES(GLenum light, GLenum pname, GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glGetLightxvOES(ctx, light, pname, params);
-}
-
-void glGetMaterialxvOES(GLenum face, GLenum pname, GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glGetMaterialxvOES(ctx, face, pname, params);
-}
-
-void glGetTexEnvxvOES(GLenum env, GLenum pname, GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glGetTexEnvxvOES(ctx, env, pname, params);
-}
-
-void glGetTexParameterxvOES(GLenum target, GLenum pname, GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glGetTexParameterxvOES(ctx, target, pname, params);
-}
-
-void glLightModelxOES(GLenum pname, GLfixed param)
-{
- GET_CONTEXT;
- ctx->glLightModelxOES(ctx, pname, param);
-}
-
-void glLightModelxvOES(GLenum pname, const GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glLightModelxvOES(ctx, pname, params);
-}
-
-void glLightxOES(GLenum light, GLenum pname, GLfixed param)
-{
- GET_CONTEXT;
- ctx->glLightxOES(ctx, light, pname, param);
-}
-
-void glLightxvOES(GLenum light, GLenum pname, const GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glLightxvOES(ctx, light, pname, params);
-}
-
-void glLineWidthxOES(GLfixed width)
-{
- GET_CONTEXT;
- ctx->glLineWidthxOES(ctx, width);
-}
-
-void glLoadMatrixxOES(const GLfixed* m)
-{
- GET_CONTEXT;
- ctx->glLoadMatrixxOES(ctx, m);
-}
-
-void glMaterialxOES(GLenum face, GLenum pname, GLfixed param)
-{
- GET_CONTEXT;
- ctx->glMaterialxOES(ctx, face, pname, param);
-}
-
-void glMaterialxvOES(GLenum face, GLenum pname, const GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glMaterialxvOES(ctx, face, pname, params);
-}
-
-void glMultMatrixxOES(const GLfixed* m)
-{
- GET_CONTEXT;
- ctx->glMultMatrixxOES(ctx, m);
-}
-
-void glMultiTexCoord4xOES(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
-{
- GET_CONTEXT;
- ctx->glMultiTexCoord4xOES(ctx, target, s, t, r, q);
-}
-
-void glNormal3xOES(GLfixed nx, GLfixed ny, GLfixed nz)
-{
- GET_CONTEXT;
- ctx->glNormal3xOES(ctx, nx, ny, nz);
-}
-
-void glOrthoxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-{
- GET_CONTEXT;
- ctx->glOrthoxOES(ctx, left, right, bottom, top, zNear, zFar);
-}
-
-void glPointParameterxOES(GLenum pname, GLfixed param)
-{
- GET_CONTEXT;
- ctx->glPointParameterxOES(ctx, pname, param);
-}
-
-void glPointParameterxvOES(GLenum pname, const GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glPointParameterxvOES(ctx, pname, params);
-}
-
-void glPointSizexOES(GLfixed size)
-{
- GET_CONTEXT;
- ctx->glPointSizexOES(ctx, size);
-}
-
-void glPolygonOffsetxOES(GLfixed factor, GLfixed units)
-{
- GET_CONTEXT;
- ctx->glPolygonOffsetxOES(ctx, factor, units);
-}
-
-void glRotatexOES(GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
-{
- GET_CONTEXT;
- ctx->glRotatexOES(ctx, angle, x, y, z);
-}
-
-void glSampleCoveragexOES(GLclampx value, GLboolean invert)
-{
- GET_CONTEXT;
- ctx->glSampleCoveragexOES(ctx, value, invert);
-}
-
-void glScalexOES(GLfixed x, GLfixed y, GLfixed z)
-{
- GET_CONTEXT;
- ctx->glScalexOES(ctx, x, y, z);
-}
-
-void glTexEnvxOES(GLenum target, GLenum pname, GLfixed param)
-{
- GET_CONTEXT;
- ctx->glTexEnvxOES(ctx, target, pname, param);
-}
-
-void glTexEnvxvOES(GLenum target, GLenum pname, const GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glTexEnvxvOES(ctx, target, pname, params);
-}
-
-void glTexParameterxOES(GLenum target, GLenum pname, GLfixed param)
-{
- GET_CONTEXT;
- ctx->glTexParameterxOES(ctx, target, pname, param);
-}
-
-void glTexParameterxvOES(GLenum target, GLenum pname, const GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glTexParameterxvOES(ctx, target, pname, params);
-}
-
-void glTranslatexOES(GLfixed x, GLfixed y, GLfixed z)
-{
- GET_CONTEXT;
- ctx->glTranslatexOES(ctx, x, y, z);
-}
-
-GLboolean glIsRenderbufferOES(GLuint renderbuffer)
-{
- GET_CONTEXT;
- return ctx->glIsRenderbufferOES(ctx, renderbuffer);
-}
-
-void glBindRenderbufferOES(GLenum target, GLuint renderbuffer)
-{
- GET_CONTEXT;
- ctx->glBindRenderbufferOES(ctx, target, renderbuffer);
-}
-
-void glDeleteRenderbuffersOES(GLsizei n, const GLuint* renderbuffers)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glDeleteRenderbuffersOES(ctx, n, renderbuffers);
-}
-
-void glGenRenderbuffersOES(GLsizei n, GLuint* renderbuffers)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glGenRenderbuffersOES(ctx, n, renderbuffers);
-}
-
-void glRenderbufferStorageOES(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- GET_CONTEXT;
- ctx->glRenderbufferStorageOES(ctx, target, internalformat, width, height);
-}
-
-void glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint* params)
-{
- GET_CONTEXT;
- ctx->glGetRenderbufferParameterivOES(ctx, target, pname, params);
-}
-
-GLboolean glIsFramebufferOES(GLuint framebuffer)
-{
- GET_CONTEXT;
- return ctx->glIsFramebufferOES(ctx, framebuffer);
-}
-
-void glBindFramebufferOES(GLenum target, GLuint framebuffer)
-{
- GET_CONTEXT;
- ctx->glBindFramebufferOES(ctx, target, framebuffer);
-}
-
-void glDeleteFramebuffersOES(GLsizei n, const GLuint* framebuffers)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glDeleteFramebuffersOES(ctx, n, framebuffers);
-}
-
-void glGenFramebuffersOES(GLsizei n, GLuint* framebuffers)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glGenFramebuffersOES(ctx, n, framebuffers);
-}
-
-GLenum glCheckFramebufferStatusOES(GLenum target)
-{
- GET_CONTEXT;
- return ctx->glCheckFramebufferStatusOES(ctx, target);
-}
-
-void glFramebufferRenderbufferOES(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- GET_CONTEXT;
- ctx->glFramebufferRenderbufferOES(ctx, target, attachment, renderbuffertarget, renderbuffer);
-}
-
-void glFramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- GET_CONTEXT;
- ctx->glFramebufferTexture2DOES(ctx, target, attachment, textarget, texture, level);
-}
-
-void glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint* params)
-{
- GET_CONTEXT;
- ctx->glGetFramebufferAttachmentParameterivOES(ctx, target, attachment, pname, params);
-}
-
-void glGenerateMipmapOES(GLenum target)
-{
- GET_CONTEXT;
- ctx->glGenerateMipmapOES(ctx, target);
-}
-
-void* glMapBufferOES(GLenum target, GLenum access)
-{
- GET_CONTEXT;
- return ctx->glMapBufferOES(ctx, target, access);
-}
-
-GLboolean glUnmapBufferOES(GLenum target)
-{
- GET_CONTEXT;
- return ctx->glUnmapBufferOES(ctx, target);
-}
-
-void glGetBufferPointervOES(GLenum target, GLenum pname, GLvoid** params)
-{
- GET_CONTEXT;
- ctx->glGetBufferPointervOES(ctx, target, pname, params);
-}
-
-void glCurrentPaletteMatrixOES(GLuint matrixpaletteindex)
-{
- GET_CONTEXT;
- ctx->glCurrentPaletteMatrixOES(ctx, matrixpaletteindex);
-}
-
-void glLoadPaletteFromModelViewMatrixOES()
-{
- GET_CONTEXT;
- ctx->glLoadPaletteFromModelViewMatrixOES(ctx);
-}
-
-void glMatrixIndexPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
-{
- GET_CONTEXT;
- ctx->glMatrixIndexPointerOES(ctx, size, type, stride, pointer);
-}
-
-void glWeightPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
-{
- GET_CONTEXT;
- ctx->glWeightPointerOES(ctx, size, type, stride, pointer);
-}
-
-GLbitfield glQueryMatrixxOES(GLfixed* mantissa, GLint* exponent)
-{
- GET_CONTEXT;
- return ctx->glQueryMatrixxOES(ctx, mantissa, exponent);
-}
-
-void glDepthRangefOES(GLclampf zNear, GLclampf zFar)
-{
- GET_CONTEXT;
- ctx->glDepthRangefOES(ctx, zNear, zFar);
-}
-
-void glFrustumfOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-{
- GET_CONTEXT;
- ctx->glFrustumfOES(ctx, left, right, bottom, top, zNear, zFar);
-}
-
-void glOrthofOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-{
- GET_CONTEXT;
- ctx->glOrthofOES(ctx, left, right, bottom, top, zNear, zFar);
-}
-
-void glClipPlanefOES(GLenum plane, const GLfloat* equation)
-{
- GET_CONTEXT;
- ctx->glClipPlanefOES(ctx, plane, equation);
-}
-
-void glClipPlanefIMG(GLenum plane, const GLfloat* equation)
-{
- GET_CONTEXT;
- ctx->glClipPlanefIMG(ctx, plane, equation);
-}
-
-void glGetClipPlanefOES(GLenum pname, GLfloat* eqn)
-{
- GET_CONTEXT;
- ctx->glGetClipPlanefOES(ctx, pname, eqn);
-}
-
-void glClearDepthfOES(GLclampf depth)
-{
- GET_CONTEXT;
- ctx->glClearDepthfOES(ctx, depth);
-}
-
-void glTexGenfOES(GLenum coord, GLenum pname, GLfloat param)
-{
- GET_CONTEXT;
- ctx->glTexGenfOES(ctx, coord, pname, param);
-}
-
-void glTexGenfvOES(GLenum coord, GLenum pname, const GLfloat* params)
-{
- GET_CONTEXT;
- ctx->glTexGenfvOES(ctx, coord, pname, params);
-}
-
-void glTexGeniOES(GLenum coord, GLenum pname, GLint param)
-{
- GET_CONTEXT;
- ctx->glTexGeniOES(ctx, coord, pname, param);
-}
-
-void glTexGenivOES(GLenum coord, GLenum pname, const GLint* params)
-{
- GET_CONTEXT;
- ctx->glTexGenivOES(ctx, coord, pname, params);
-}
-
-void glTexGenxOES(GLenum coord, GLenum pname, GLfixed param)
-{
- GET_CONTEXT;
- ctx->glTexGenxOES(ctx, coord, pname, param);
-}
-
-void glTexGenxvOES(GLenum coord, GLenum pname, const GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glTexGenxvOES(ctx, coord, pname, params);
-}
-
-void glGetTexGenfvOES(GLenum coord, GLenum pname, GLfloat* params)
-{
- GET_CONTEXT;
- ctx->glGetTexGenfvOES(ctx, coord, pname, params);
-}
-
-void glGetTexGenivOES(GLenum coord, GLenum pname, GLint* params)
-{
- GET_CONTEXT;
- ctx->glGetTexGenivOES(ctx, coord, pname, params);
-}
-
-void glGetTexGenxvOES(GLenum coord, GLenum pname, GLfixed* params)
-{
- GET_CONTEXT;
- ctx->glGetTexGenxvOES(ctx, coord, pname, params);
-}
-
-void glBindVertexArrayOES(GLuint array)
-{
- GET_CONTEXT;
- ctx->glBindVertexArrayOES(ctx, array);
-}
-
-void glDeleteVertexArraysOES(GLsizei n, const GLuint* arrays)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glDeleteVertexArraysOES(ctx, n, arrays);
-}
-
-void glGenVertexArraysOES(GLsizei n, GLuint* arrays)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glGenVertexArraysOES(ctx, n, arrays);
-}
-
-GLboolean glIsVertexArrayOES(GLuint array)
-{
- GET_CONTEXT;
- return ctx->glIsVertexArrayOES(ctx, array);
-}
-
-void glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum* attachments)
-{
- GET_CONTEXT;
- ctx->glDiscardFramebufferEXT(ctx, target, numAttachments, attachments);
-}
-
-void glMultiDrawArraysEXT(GLenum mode, GLint* first, GLsizei* count, GLsizei primcount)
-{
- GET_CONTEXT;
- ctx->glMultiDrawArraysEXT(ctx, mode, first, count, primcount);
-}
-
-void glMultiDrawElementsEXT(GLenum mode, const GLsizei* count, GLenum type, const GLvoid** indices, GLsizei primcount)
-{
- GET_CONTEXT;
- ctx->glMultiDrawElementsEXT(ctx, mode, count, type, indices, primcount);
-}
-
-void glMultiDrawArraysSUN(GLenum mode, GLint* first, GLsizei* count, GLsizei primcount)
-{
- GET_CONTEXT;
- ctx->glMultiDrawArraysSUN(ctx, mode, first, count, primcount);
-}
-
-void glMultiDrawElementsSUN(GLenum mode, const GLsizei* count, GLenum type, const GLvoid** indices, GLsizei primcount)
-{
- GET_CONTEXT;
- ctx->glMultiDrawElementsSUN(ctx, mode, count, type, indices, primcount);
-}
-
-void glRenderbufferStorageMultisampleIMG(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- GET_CONTEXT;
- ctx->glRenderbufferStorageMultisampleIMG(ctx, target, samples, internalformat, width, height);
-}
-
-void glFramebufferTexture2DMultisampleIMG(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples)
-{
- GET_CONTEXT;
- ctx->glFramebufferTexture2DMultisampleIMG(ctx, target, attachment, textarget, texture, level, samples);
-}
-
-void glDeleteFencesNV(GLsizei n, const GLuint* fences)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glDeleteFencesNV(ctx, n, fences);
-}
-
-void glGenFencesNV(GLsizei n, GLuint* fences)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glGenFencesNV(ctx, n, fences);
-}
-
-GLboolean glIsFenceNV(GLuint fence)
-{
- GET_CONTEXT;
- return ctx->glIsFenceNV(ctx, fence);
-}
-
-GLboolean glTestFenceNV(GLuint fence)
-{
- GET_CONTEXT;
- return ctx->glTestFenceNV(ctx, fence);
-}
-
-void glGetFenceivNV(GLuint fence, GLenum pname, GLint* params)
-{
- GET_CONTEXT;
- ctx->glGetFenceivNV(ctx, fence, pname, params);
-}
-
-void glFinishFenceNV(GLuint fence)
-{
- GET_CONTEXT;
- ctx->glFinishFenceNV(ctx, fence);
-}
-
-void glSetFenceNV(GLuint fence, GLenum condition)
-{
- GET_CONTEXT;
- ctx->glSetFenceNV(ctx, fence, condition);
-}
-
-void glGetDriverControlsQCOM(GLint* num, GLsizei size, GLuint* driverControls)
-{
- GET_CONTEXT;
- ctx->glGetDriverControlsQCOM(ctx, num, size, driverControls);
-}
-
-void glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei* length, GLchar* driverControlString)
-{
- GET_CONTEXT;
- ctx->glGetDriverControlStringQCOM(ctx, driverControl, bufSize, length, driverControlString);
-}
-
-void glEnableDriverControlQCOM(GLuint driverControl)
-{
- GET_CONTEXT;
- ctx->glEnableDriverControlQCOM(ctx, driverControl);
-}
-
-void glDisableDriverControlQCOM(GLuint driverControl)
-{
- GET_CONTEXT;
- ctx->glDisableDriverControlQCOM(ctx, driverControl);
-}
-
-void glExtGetTexturesQCOM(GLuint* textures, GLint maxTextures, GLint* numTextures)
-{
- GET_CONTEXT;
- ctx->glExtGetTexturesQCOM(ctx, textures, maxTextures, numTextures);
-}
-
-void glExtGetBuffersQCOM(GLuint* buffers, GLint maxBuffers, GLint* numBuffers)
-{
- GET_CONTEXT;
- ctx->glExtGetBuffersQCOM(ctx, buffers, maxBuffers, numBuffers);
-}
-
-void glExtGetRenderbuffersQCOM(GLuint* renderbuffers, GLint maxRenderbuffers, GLint* numRenderbuffers)
-{
- GET_CONTEXT;
- ctx->glExtGetRenderbuffersQCOM(ctx, renderbuffers, maxRenderbuffers, numRenderbuffers);
-}
-
-void glExtGetFramebuffersQCOM(GLuint* framebuffers, GLint maxFramebuffers, GLint* numFramebuffers)
-{
- GET_CONTEXT;
- ctx->glExtGetFramebuffersQCOM(ctx, framebuffers, maxFramebuffers, numFramebuffers);
-}
-
-void glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint* params)
-{
- GET_CONTEXT;
- ctx->glExtGetTexLevelParameterivQCOM(ctx, texture, face, level, pname, params);
-}
-
-void glExtTexObjectStateOverrideiQCOM(GLenum target, GLenum pname, GLint param)
-{
- GET_CONTEXT;
- ctx->glExtTexObjectStateOverrideiQCOM(ctx, target, pname, param);
-}
-
-void glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid* texels)
-{
- GET_CONTEXT;
- ctx->glExtGetTexSubImageQCOM(ctx, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texels);
-}
-
-void glExtGetBufferPointervQCOM(GLenum target, GLvoid** params)
-{
- GET_CONTEXT;
- ctx->glExtGetBufferPointervQCOM(ctx, target, params);
-}
-
-void glExtGetShadersQCOM(GLuint* shaders, GLint maxShaders, GLint* numShaders)
-{
- GET_CONTEXT;
- ctx->glExtGetShadersQCOM(ctx, shaders, maxShaders, numShaders);
-}
-
-void glExtGetProgramsQCOM(GLuint* programs, GLint maxPrograms, GLint* numPrograms)
-{
- GET_CONTEXT;
- ctx->glExtGetProgramsQCOM(ctx, programs, maxPrograms, numPrograms);
-}
-
-GLboolean glExtIsProgramBinaryQCOM(GLuint program)
-{
- GET_CONTEXT;
- return ctx->glExtIsProgramBinaryQCOM(ctx, program);
-}
-
-void glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar* source, GLint* length)
-{
- GET_CONTEXT;
- ctx->glExtGetProgramBinarySourceQCOM(ctx, program, shadertype, source, length);
-}
-
-void glStartTilingQCOM(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask)
-{
- GET_CONTEXT;
- ctx->glStartTilingQCOM(ctx, x, y, width, height, preserveMask);
-}
-
-void glEndTilingQCOM(GLbitfield preserveMask)
-{
- GET_CONTEXT;
- ctx->glEndTilingQCOM(ctx, preserveMask);
-}
-
diff --git a/tools/emulator/opengl/system/GLESv1_enc/gl_ftable.h b/tools/emulator/opengl/system/GLESv1_enc/gl_ftable.h
deleted file mode 100644
index 7201e7fe7..000000000
--- a/tools/emulator/opengl/system/GLESv1_enc/gl_ftable.h
+++ /dev/null
@@ -1,288 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-#ifndef __gl_client_ftable_t_h
-#define __gl_client_ftable_t_h
-
-
-static struct _gl_funcs_by_name {
- const char *name;
- void *proc;
-} gl_funcs_by_name[] = {
- {"glAlphaFunc", (void*)glAlphaFunc},
- {"glClearColor", (void*)glClearColor},
- {"glClearDepthf", (void*)glClearDepthf},
- {"glClipPlanef", (void*)glClipPlanef},
- {"glColor4f", (void*)glColor4f},
- {"glDepthRangef", (void*)glDepthRangef},
- {"glFogf", (void*)glFogf},
- {"glFogfv", (void*)glFogfv},
- {"glFrustumf", (void*)glFrustumf},
- {"glGetClipPlanef", (void*)glGetClipPlanef},
- {"glGetFloatv", (void*)glGetFloatv},
- {"glGetLightfv", (void*)glGetLightfv},
- {"glGetMaterialfv", (void*)glGetMaterialfv},
- {"glGetTexEnvfv", (void*)glGetTexEnvfv},
- {"glGetTexParameterfv", (void*)glGetTexParameterfv},
- {"glLightModelf", (void*)glLightModelf},
- {"glLightModelfv", (void*)glLightModelfv},
- {"glLightf", (void*)glLightf},
- {"glLightfv", (void*)glLightfv},
- {"glLineWidth", (void*)glLineWidth},
- {"glLoadMatrixf", (void*)glLoadMatrixf},
- {"glMaterialf", (void*)glMaterialf},
- {"glMaterialfv", (void*)glMaterialfv},
- {"glMultMatrixf", (void*)glMultMatrixf},
- {"glMultiTexCoord4f", (void*)glMultiTexCoord4f},
- {"glNormal3f", (void*)glNormal3f},
- {"glOrthof", (void*)glOrthof},
- {"glPointParameterf", (void*)glPointParameterf},
- {"glPointParameterfv", (void*)glPointParameterfv},
- {"glPointSize", (void*)glPointSize},
- {"glPolygonOffset", (void*)glPolygonOffset},
- {"glRotatef", (void*)glRotatef},
- {"glScalef", (void*)glScalef},
- {"glTexEnvf", (void*)glTexEnvf},
- {"glTexEnvfv", (void*)glTexEnvfv},
- {"glTexParameterf", (void*)glTexParameterf},
- {"glTexParameterfv", (void*)glTexParameterfv},
- {"glTranslatef", (void*)glTranslatef},
- {"glActiveTexture", (void*)glActiveTexture},
- {"glAlphaFuncx", (void*)glAlphaFuncx},
- {"glBindBuffer", (void*)glBindBuffer},
- {"glBindTexture", (void*)glBindTexture},
- {"glBlendFunc", (void*)glBlendFunc},
- {"glBufferData", (void*)glBufferData},
- {"glBufferSubData", (void*)glBufferSubData},
- {"glClear", (void*)glClear},
- {"glClearColorx", (void*)glClearColorx},
- {"glClearDepthx", (void*)glClearDepthx},
- {"glClearStencil", (void*)glClearStencil},
- {"glClientActiveTexture", (void*)glClientActiveTexture},
- {"glColor4ub", (void*)glColor4ub},
- {"glColor4x", (void*)glColor4x},
- {"glColorMask", (void*)glColorMask},
- {"glColorPointer", (void*)glColorPointer},
- {"glCompressedTexImage2D", (void*)glCompressedTexImage2D},
- {"glCompressedTexSubImage2D", (void*)glCompressedTexSubImage2D},
- {"glCopyTexImage2D", (void*)glCopyTexImage2D},
- {"glCopyTexSubImage2D", (void*)glCopyTexSubImage2D},
- {"glCullFace", (void*)glCullFace},
- {"glDeleteBuffers", (void*)glDeleteBuffers},
- {"glDeleteTextures", (void*)glDeleteTextures},
- {"glDepthFunc", (void*)glDepthFunc},
- {"glDepthMask", (void*)glDepthMask},
- {"glDepthRangex", (void*)glDepthRangex},
- {"glDisable", (void*)glDisable},
- {"glDisableClientState", (void*)glDisableClientState},
- {"glDrawArrays", (void*)glDrawArrays},
- {"glDrawElements", (void*)glDrawElements},
- {"glEnable", (void*)glEnable},
- {"glEnableClientState", (void*)glEnableClientState},
- {"glFinish", (void*)glFinish},
- {"glFlush", (void*)glFlush},
- {"glFogx", (void*)glFogx},
- {"glFogxv", (void*)glFogxv},
- {"glFrontFace", (void*)glFrontFace},
- {"glFrustumx", (void*)glFrustumx},
- {"glGetBooleanv", (void*)glGetBooleanv},
- {"glGetBufferParameteriv", (void*)glGetBufferParameteriv},
- {"glClipPlanex", (void*)glClipPlanex},
- {"glGenBuffers", (void*)glGenBuffers},
- {"glGenTextures", (void*)glGenTextures},
- {"glGetError", (void*)glGetError},
- {"glGetFixedv", (void*)glGetFixedv},
- {"glGetIntegerv", (void*)glGetIntegerv},
- {"glGetLightxv", (void*)glGetLightxv},
- {"glGetMaterialxv", (void*)glGetMaterialxv},
- {"glGetPointerv", (void*)glGetPointerv},
- {"glGetString", (void*)glGetString},
- {"glGetTexEnviv", (void*)glGetTexEnviv},
- {"glGetTexEnvxv", (void*)glGetTexEnvxv},
- {"glGetTexParameteriv", (void*)glGetTexParameteriv},
- {"glGetTexParameterxv", (void*)glGetTexParameterxv},
- {"glHint", (void*)glHint},
- {"glIsBuffer", (void*)glIsBuffer},
- {"glIsEnabled", (void*)glIsEnabled},
- {"glIsTexture", (void*)glIsTexture},
- {"glLightModelx", (void*)glLightModelx},
- {"glLightModelxv", (void*)glLightModelxv},
- {"glLightx", (void*)glLightx},
- {"glLightxv", (void*)glLightxv},
- {"glLineWidthx", (void*)glLineWidthx},
- {"glLoadIdentity", (void*)glLoadIdentity},
- {"glLoadMatrixx", (void*)glLoadMatrixx},
- {"glLogicOp", (void*)glLogicOp},
- {"glMaterialx", (void*)glMaterialx},
- {"glMaterialxv", (void*)glMaterialxv},
- {"glMatrixMode", (void*)glMatrixMode},
- {"glMultMatrixx", (void*)glMultMatrixx},
- {"glMultiTexCoord4x", (void*)glMultiTexCoord4x},
- {"glNormal3x", (void*)glNormal3x},
- {"glNormalPointer", (void*)glNormalPointer},
- {"glOrthox", (void*)glOrthox},
- {"glPixelStorei", (void*)glPixelStorei},
- {"glPointParameterx", (void*)glPointParameterx},
- {"glPointParameterxv", (void*)glPointParameterxv},
- {"glPointSizex", (void*)glPointSizex},
- {"glPolygonOffsetx", (void*)glPolygonOffsetx},
- {"glPopMatrix", (void*)glPopMatrix},
- {"glPushMatrix", (void*)glPushMatrix},
- {"glReadPixels", (void*)glReadPixels},
- {"glRotatex", (void*)glRotatex},
- {"glSampleCoverage", (void*)glSampleCoverage},
- {"glSampleCoveragex", (void*)glSampleCoveragex},
- {"glScalex", (void*)glScalex},
- {"glScissor", (void*)glScissor},
- {"glShadeModel", (void*)glShadeModel},
- {"glStencilFunc", (void*)glStencilFunc},
- {"glStencilMask", (void*)glStencilMask},
- {"glStencilOp", (void*)glStencilOp},
- {"glTexCoordPointer", (void*)glTexCoordPointer},
- {"glTexEnvi", (void*)glTexEnvi},
- {"glTexEnvx", (void*)glTexEnvx},
- {"glTexEnviv", (void*)glTexEnviv},
- {"glTexEnvxv", (void*)glTexEnvxv},
- {"glTexImage2D", (void*)glTexImage2D},
- {"glTexParameteri", (void*)glTexParameteri},
- {"glTexParameterx", (void*)glTexParameterx},
- {"glTexParameteriv", (void*)glTexParameteriv},
- {"glTexParameterxv", (void*)glTexParameterxv},
- {"glTexSubImage2D", (void*)glTexSubImage2D},
- {"glTranslatex", (void*)glTranslatex},
- {"glVertexPointer", (void*)glVertexPointer},
- {"glViewport", (void*)glViewport},
- {"glPointSizePointerOES", (void*)glPointSizePointerOES},
- {"glBlendEquationSeparateOES", (void*)glBlendEquationSeparateOES},
- {"glBlendFuncSeparateOES", (void*)glBlendFuncSeparateOES},
- {"glBlendEquationOES", (void*)glBlendEquationOES},
- {"glDrawTexsOES", (void*)glDrawTexsOES},
- {"glDrawTexiOES", (void*)glDrawTexiOES},
- {"glDrawTexxOES", (void*)glDrawTexxOES},
- {"glDrawTexsvOES", (void*)glDrawTexsvOES},
- {"glDrawTexivOES", (void*)glDrawTexivOES},
- {"glDrawTexxvOES", (void*)glDrawTexxvOES},
- {"glDrawTexfOES", (void*)glDrawTexfOES},
- {"glDrawTexfvOES", (void*)glDrawTexfvOES},
- {"glEGLImageTargetTexture2DOES", (void*)glEGLImageTargetTexture2DOES},
- {"glEGLImageTargetRenderbufferStorageOES", (void*)glEGLImageTargetRenderbufferStorageOES},
- {"glAlphaFuncxOES", (void*)glAlphaFuncxOES},
- {"glClearColorxOES", (void*)glClearColorxOES},
- {"glClearDepthxOES", (void*)glClearDepthxOES},
- {"glClipPlanexOES", (void*)glClipPlanexOES},
- {"glClipPlanexIMG", (void*)glClipPlanexIMG},
- {"glColor4xOES", (void*)glColor4xOES},
- {"glDepthRangexOES", (void*)glDepthRangexOES},
- {"glFogxOES", (void*)glFogxOES},
- {"glFogxvOES", (void*)glFogxvOES},
- {"glFrustumxOES", (void*)glFrustumxOES},
- {"glGetClipPlanexOES", (void*)glGetClipPlanexOES},
- {"glGetClipPlanex", (void*)glGetClipPlanex},
- {"glGetFixedvOES", (void*)glGetFixedvOES},
- {"glGetLightxvOES", (void*)glGetLightxvOES},
- {"glGetMaterialxvOES", (void*)glGetMaterialxvOES},
- {"glGetTexEnvxvOES", (void*)glGetTexEnvxvOES},
- {"glGetTexParameterxvOES", (void*)glGetTexParameterxvOES},
- {"glLightModelxOES", (void*)glLightModelxOES},
- {"glLightModelxvOES", (void*)glLightModelxvOES},
- {"glLightxOES", (void*)glLightxOES},
- {"glLightxvOES", (void*)glLightxvOES},
- {"glLineWidthxOES", (void*)glLineWidthxOES},
- {"glLoadMatrixxOES", (void*)glLoadMatrixxOES},
- {"glMaterialxOES", (void*)glMaterialxOES},
- {"glMaterialxvOES", (void*)glMaterialxvOES},
- {"glMultMatrixxOES", (void*)glMultMatrixxOES},
- {"glMultiTexCoord4xOES", (void*)glMultiTexCoord4xOES},
- {"glNormal3xOES", (void*)glNormal3xOES},
- {"glOrthoxOES", (void*)glOrthoxOES},
- {"glPointParameterxOES", (void*)glPointParameterxOES},
- {"glPointParameterxvOES", (void*)glPointParameterxvOES},
- {"glPointSizexOES", (void*)glPointSizexOES},
- {"glPolygonOffsetxOES", (void*)glPolygonOffsetxOES},
- {"glRotatexOES", (void*)glRotatexOES},
- {"glSampleCoveragexOES", (void*)glSampleCoveragexOES},
- {"glScalexOES", (void*)glScalexOES},
- {"glTexEnvxOES", (void*)glTexEnvxOES},
- {"glTexEnvxvOES", (void*)glTexEnvxvOES},
- {"glTexParameterxOES", (void*)glTexParameterxOES},
- {"glTexParameterxvOES", (void*)glTexParameterxvOES},
- {"glTranslatexOES", (void*)glTranslatexOES},
- {"glIsRenderbufferOES", (void*)glIsRenderbufferOES},
- {"glBindRenderbufferOES", (void*)glBindRenderbufferOES},
- {"glDeleteRenderbuffersOES", (void*)glDeleteRenderbuffersOES},
- {"glGenRenderbuffersOES", (void*)glGenRenderbuffersOES},
- {"glRenderbufferStorageOES", (void*)glRenderbufferStorageOES},
- {"glGetRenderbufferParameterivOES", (void*)glGetRenderbufferParameterivOES},
- {"glIsFramebufferOES", (void*)glIsFramebufferOES},
- {"glBindFramebufferOES", (void*)glBindFramebufferOES},
- {"glDeleteFramebuffersOES", (void*)glDeleteFramebuffersOES},
- {"glGenFramebuffersOES", (void*)glGenFramebuffersOES},
- {"glCheckFramebufferStatusOES", (void*)glCheckFramebufferStatusOES},
- {"glFramebufferRenderbufferOES", (void*)glFramebufferRenderbufferOES},
- {"glFramebufferTexture2DOES", (void*)glFramebufferTexture2DOES},
- {"glGetFramebufferAttachmentParameterivOES", (void*)glGetFramebufferAttachmentParameterivOES},
- {"glGenerateMipmapOES", (void*)glGenerateMipmapOES},
- {"glMapBufferOES", (void*)glMapBufferOES},
- {"glUnmapBufferOES", (void*)glUnmapBufferOES},
- {"glGetBufferPointervOES", (void*)glGetBufferPointervOES},
- {"glCurrentPaletteMatrixOES", (void*)glCurrentPaletteMatrixOES},
- {"glLoadPaletteFromModelViewMatrixOES", (void*)glLoadPaletteFromModelViewMatrixOES},
- {"glMatrixIndexPointerOES", (void*)glMatrixIndexPointerOES},
- {"glWeightPointerOES", (void*)glWeightPointerOES},
- {"glQueryMatrixxOES", (void*)glQueryMatrixxOES},
- {"glDepthRangefOES", (void*)glDepthRangefOES},
- {"glFrustumfOES", (void*)glFrustumfOES},
- {"glOrthofOES", (void*)glOrthofOES},
- {"glClipPlanefOES", (void*)glClipPlanefOES},
- {"glClipPlanefIMG", (void*)glClipPlanefIMG},
- {"glGetClipPlanefOES", (void*)glGetClipPlanefOES},
- {"glClearDepthfOES", (void*)glClearDepthfOES},
- {"glTexGenfOES", (void*)glTexGenfOES},
- {"glTexGenfvOES", (void*)glTexGenfvOES},
- {"glTexGeniOES", (void*)glTexGeniOES},
- {"glTexGenivOES", (void*)glTexGenivOES},
- {"glTexGenxOES", (void*)glTexGenxOES},
- {"glTexGenxvOES", (void*)glTexGenxvOES},
- {"glGetTexGenfvOES", (void*)glGetTexGenfvOES},
- {"glGetTexGenivOES", (void*)glGetTexGenivOES},
- {"glGetTexGenxvOES", (void*)glGetTexGenxvOES},
- {"glBindVertexArrayOES", (void*)glBindVertexArrayOES},
- {"glDeleteVertexArraysOES", (void*)glDeleteVertexArraysOES},
- {"glGenVertexArraysOES", (void*)glGenVertexArraysOES},
- {"glIsVertexArrayOES", (void*)glIsVertexArrayOES},
- {"glDiscardFramebufferEXT", (void*)glDiscardFramebufferEXT},
- {"glMultiDrawArraysEXT", (void*)glMultiDrawArraysEXT},
- {"glMultiDrawElementsEXT", (void*)glMultiDrawElementsEXT},
- {"glMultiDrawArraysSUN", (void*)glMultiDrawArraysSUN},
- {"glMultiDrawElementsSUN", (void*)glMultiDrawElementsSUN},
- {"glRenderbufferStorageMultisampleIMG", (void*)glRenderbufferStorageMultisampleIMG},
- {"glFramebufferTexture2DMultisampleIMG", (void*)glFramebufferTexture2DMultisampleIMG},
- {"glDeleteFencesNV", (void*)glDeleteFencesNV},
- {"glGenFencesNV", (void*)glGenFencesNV},
- {"glIsFenceNV", (void*)glIsFenceNV},
- {"glTestFenceNV", (void*)glTestFenceNV},
- {"glGetFenceivNV", (void*)glGetFenceivNV},
- {"glFinishFenceNV", (void*)glFinishFenceNV},
- {"glSetFenceNV", (void*)glSetFenceNV},
- {"glGetDriverControlsQCOM", (void*)glGetDriverControlsQCOM},
- {"glGetDriverControlStringQCOM", (void*)glGetDriverControlStringQCOM},
- {"glEnableDriverControlQCOM", (void*)glEnableDriverControlQCOM},
- {"glDisableDriverControlQCOM", (void*)glDisableDriverControlQCOM},
- {"glExtGetTexturesQCOM", (void*)glExtGetTexturesQCOM},
- {"glExtGetBuffersQCOM", (void*)glExtGetBuffersQCOM},
- {"glExtGetRenderbuffersQCOM", (void*)glExtGetRenderbuffersQCOM},
- {"glExtGetFramebuffersQCOM", (void*)glExtGetFramebuffersQCOM},
- {"glExtGetTexLevelParameterivQCOM", (void*)glExtGetTexLevelParameterivQCOM},
- {"glExtTexObjectStateOverrideiQCOM", (void*)glExtTexObjectStateOverrideiQCOM},
- {"glExtGetTexSubImageQCOM", (void*)glExtGetTexSubImageQCOM},
- {"glExtGetBufferPointervQCOM", (void*)glExtGetBufferPointervQCOM},
- {"glExtGetShadersQCOM", (void*)glExtGetShadersQCOM},
- {"glExtGetProgramsQCOM", (void*)glExtGetProgramsQCOM},
- {"glExtIsProgramBinaryQCOM", (void*)glExtIsProgramBinaryQCOM},
- {"glExtGetProgramBinarySourceQCOM", (void*)glExtGetProgramBinarySourceQCOM},
- {"glStartTilingQCOM", (void*)glStartTilingQCOM},
- {"glEndTilingQCOM", (void*)glEndTilingQCOM},
-};
-static int gl_num_funcs = sizeof(gl_funcs_by_name) / sizeof(struct _gl_funcs_by_name);
-
-
-#endif
diff --git a/tools/emulator/opengl/system/GLESv1_enc/gl_opcodes.h b/tools/emulator/opengl/system/GLESv1_enc/gl_opcodes.h
deleted file mode 100644
index 319d0a1e2..000000000
--- a/tools/emulator/opengl/system/GLESv1_enc/gl_opcodes.h
+++ /dev/null
@@ -1,300 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-#ifndef __GUARD_gl_opcodes_h_
-#define __GUARD_gl_opcodes_h_
-
-#define OP_glAlphaFunc 1024
-#define OP_glClearColor 1025
-#define OP_glClearDepthf 1026
-#define OP_glClipPlanef 1027
-#define OP_glColor4f 1028
-#define OP_glDepthRangef 1029
-#define OP_glFogf 1030
-#define OP_glFogfv 1031
-#define OP_glFrustumf 1032
-#define OP_glGetClipPlanef 1033
-#define OP_glGetFloatv 1034
-#define OP_glGetLightfv 1035
-#define OP_glGetMaterialfv 1036
-#define OP_glGetTexEnvfv 1037
-#define OP_glGetTexParameterfv 1038
-#define OP_glLightModelf 1039
-#define OP_glLightModelfv 1040
-#define OP_glLightf 1041
-#define OP_glLightfv 1042
-#define OP_glLineWidth 1043
-#define OP_glLoadMatrixf 1044
-#define OP_glMaterialf 1045
-#define OP_glMaterialfv 1046
-#define OP_glMultMatrixf 1047
-#define OP_glMultiTexCoord4f 1048
-#define OP_glNormal3f 1049
-#define OP_glOrthof 1050
-#define OP_glPointParameterf 1051
-#define OP_glPointParameterfv 1052
-#define OP_glPointSize 1053
-#define OP_glPolygonOffset 1054
-#define OP_glRotatef 1055
-#define OP_glScalef 1056
-#define OP_glTexEnvf 1057
-#define OP_glTexEnvfv 1058
-#define OP_glTexParameterf 1059
-#define OP_glTexParameterfv 1060
-#define OP_glTranslatef 1061
-#define OP_glActiveTexture 1062
-#define OP_glAlphaFuncx 1063
-#define OP_glBindBuffer 1064
-#define OP_glBindTexture 1065
-#define OP_glBlendFunc 1066
-#define OP_glBufferData 1067
-#define OP_glBufferSubData 1068
-#define OP_glClear 1069
-#define OP_glClearColorx 1070
-#define OP_glClearDepthx 1071
-#define OP_glClearStencil 1072
-#define OP_glClientActiveTexture 1073
-#define OP_glColor4ub 1074
-#define OP_glColor4x 1075
-#define OP_glColorMask 1076
-#define OP_glColorPointer 1077
-#define OP_glCompressedTexImage2D 1078
-#define OP_glCompressedTexSubImage2D 1079
-#define OP_glCopyTexImage2D 1080
-#define OP_glCopyTexSubImage2D 1081
-#define OP_glCullFace 1082
-#define OP_glDeleteBuffers 1083
-#define OP_glDeleteTextures 1084
-#define OP_glDepthFunc 1085
-#define OP_glDepthMask 1086
-#define OP_glDepthRangex 1087
-#define OP_glDisable 1088
-#define OP_glDisableClientState 1089
-#define OP_glDrawArrays 1090
-#define OP_glDrawElements 1091
-#define OP_glEnable 1092
-#define OP_glEnableClientState 1093
-#define OP_glFinish 1094
-#define OP_glFlush 1095
-#define OP_glFogx 1096
-#define OP_glFogxv 1097
-#define OP_glFrontFace 1098
-#define OP_glFrustumx 1099
-#define OP_glGetBooleanv 1100
-#define OP_glGetBufferParameteriv 1101
-#define OP_glClipPlanex 1102
-#define OP_glGenBuffers 1103
-#define OP_glGenTextures 1104
-#define OP_glGetError 1105
-#define OP_glGetFixedv 1106
-#define OP_glGetIntegerv 1107
-#define OP_glGetLightxv 1108
-#define OP_glGetMaterialxv 1109
-#define OP_glGetPointerv 1110
-#define OP_glGetString 1111
-#define OP_glGetTexEnviv 1112
-#define OP_glGetTexEnvxv 1113
-#define OP_glGetTexParameteriv 1114
-#define OP_glGetTexParameterxv 1115
-#define OP_glHint 1116
-#define OP_glIsBuffer 1117
-#define OP_glIsEnabled 1118
-#define OP_glIsTexture 1119
-#define OP_glLightModelx 1120
-#define OP_glLightModelxv 1121
-#define OP_glLightx 1122
-#define OP_glLightxv 1123
-#define OP_glLineWidthx 1124
-#define OP_glLoadIdentity 1125
-#define OP_glLoadMatrixx 1126
-#define OP_glLogicOp 1127
-#define OP_glMaterialx 1128
-#define OP_glMaterialxv 1129
-#define OP_glMatrixMode 1130
-#define OP_glMultMatrixx 1131
-#define OP_glMultiTexCoord4x 1132
-#define OP_glNormal3x 1133
-#define OP_glNormalPointer 1134
-#define OP_glOrthox 1135
-#define OP_glPixelStorei 1136
-#define OP_glPointParameterx 1137
-#define OP_glPointParameterxv 1138
-#define OP_glPointSizex 1139
-#define OP_glPolygonOffsetx 1140
-#define OP_glPopMatrix 1141
-#define OP_glPushMatrix 1142
-#define OP_glReadPixels 1143
-#define OP_glRotatex 1144
-#define OP_glSampleCoverage 1145
-#define OP_glSampleCoveragex 1146
-#define OP_glScalex 1147
-#define OP_glScissor 1148
-#define OP_glShadeModel 1149
-#define OP_glStencilFunc 1150
-#define OP_glStencilMask 1151
-#define OP_glStencilOp 1152
-#define OP_glTexCoordPointer 1153
-#define OP_glTexEnvi 1154
-#define OP_glTexEnvx 1155
-#define OP_glTexEnviv 1156
-#define OP_glTexEnvxv 1157
-#define OP_glTexImage2D 1158
-#define OP_glTexParameteri 1159
-#define OP_glTexParameterx 1160
-#define OP_glTexParameteriv 1161
-#define OP_glTexParameterxv 1162
-#define OP_glTexSubImage2D 1163
-#define OP_glTranslatex 1164
-#define OP_glVertexPointer 1165
-#define OP_glViewport 1166
-#define OP_glPointSizePointerOES 1167
-#define OP_glVertexPointerOffset 1168
-#define OP_glColorPointerOffset 1169
-#define OP_glNormalPointerOffset 1170
-#define OP_glPointSizePointerOffset 1171
-#define OP_glTexCoordPointerOffset 1172
-#define OP_glWeightPointerOffset 1173
-#define OP_glMatrixIndexPointerOffset 1174
-#define OP_glVertexPointerData 1175
-#define OP_glColorPointerData 1176
-#define OP_glNormalPointerData 1177
-#define OP_glTexCoordPointerData 1178
-#define OP_glPointSizePointerData 1179
-#define OP_glWeightPointerData 1180
-#define OP_glMatrixIndexPointerData 1181
-#define OP_glDrawElementsOffset 1182
-#define OP_glDrawElementsData 1183
-#define OP_glGetCompressedTextureFormats 1184
-#define OP_glFinishRoundTrip 1185
-#define OP_glBlendEquationSeparateOES 1186
-#define OP_glBlendFuncSeparateOES 1187
-#define OP_glBlendEquationOES 1188
-#define OP_glDrawTexsOES 1189
-#define OP_glDrawTexiOES 1190
-#define OP_glDrawTexxOES 1191
-#define OP_glDrawTexsvOES 1192
-#define OP_glDrawTexivOES 1193
-#define OP_glDrawTexxvOES 1194
-#define OP_glDrawTexfOES 1195
-#define OP_glDrawTexfvOES 1196
-#define OP_glEGLImageTargetTexture2DOES 1197
-#define OP_glEGLImageTargetRenderbufferStorageOES 1198
-#define OP_glAlphaFuncxOES 1199
-#define OP_glClearColorxOES 1200
-#define OP_glClearDepthxOES 1201
-#define OP_glClipPlanexOES 1202
-#define OP_glClipPlanexIMG 1203
-#define OP_glColor4xOES 1204
-#define OP_glDepthRangexOES 1205
-#define OP_glFogxOES 1206
-#define OP_glFogxvOES 1207
-#define OP_glFrustumxOES 1208
-#define OP_glGetClipPlanexOES 1209
-#define OP_glGetClipPlanex 1210
-#define OP_glGetFixedvOES 1211
-#define OP_glGetLightxvOES 1212
-#define OP_glGetMaterialxvOES 1213
-#define OP_glGetTexEnvxvOES 1214
-#define OP_glGetTexParameterxvOES 1215
-#define OP_glLightModelxOES 1216
-#define OP_glLightModelxvOES 1217
-#define OP_glLightxOES 1218
-#define OP_glLightxvOES 1219
-#define OP_glLineWidthxOES 1220
-#define OP_glLoadMatrixxOES 1221
-#define OP_glMaterialxOES 1222
-#define OP_glMaterialxvOES 1223
-#define OP_glMultMatrixxOES 1224
-#define OP_glMultiTexCoord4xOES 1225
-#define OP_glNormal3xOES 1226
-#define OP_glOrthoxOES 1227
-#define OP_glPointParameterxOES 1228
-#define OP_glPointParameterxvOES 1229
-#define OP_glPointSizexOES 1230
-#define OP_glPolygonOffsetxOES 1231
-#define OP_glRotatexOES 1232
-#define OP_glSampleCoveragexOES 1233
-#define OP_glScalexOES 1234
-#define OP_glTexEnvxOES 1235
-#define OP_glTexEnvxvOES 1236
-#define OP_glTexParameterxOES 1237
-#define OP_glTexParameterxvOES 1238
-#define OP_glTranslatexOES 1239
-#define OP_glIsRenderbufferOES 1240
-#define OP_glBindRenderbufferOES 1241
-#define OP_glDeleteRenderbuffersOES 1242
-#define OP_glGenRenderbuffersOES 1243
-#define OP_glRenderbufferStorageOES 1244
-#define OP_glGetRenderbufferParameterivOES 1245
-#define OP_glIsFramebufferOES 1246
-#define OP_glBindFramebufferOES 1247
-#define OP_glDeleteFramebuffersOES 1248
-#define OP_glGenFramebuffersOES 1249
-#define OP_glCheckFramebufferStatusOES 1250
-#define OP_glFramebufferRenderbufferOES 1251
-#define OP_glFramebufferTexture2DOES 1252
-#define OP_glGetFramebufferAttachmentParameterivOES 1253
-#define OP_glGenerateMipmapOES 1254
-#define OP_glMapBufferOES 1255
-#define OP_glUnmapBufferOES 1256
-#define OP_glGetBufferPointervOES 1257
-#define OP_glCurrentPaletteMatrixOES 1258
-#define OP_glLoadPaletteFromModelViewMatrixOES 1259
-#define OP_glMatrixIndexPointerOES 1260
-#define OP_glWeightPointerOES 1261
-#define OP_glQueryMatrixxOES 1262
-#define OP_glDepthRangefOES 1263
-#define OP_glFrustumfOES 1264
-#define OP_glOrthofOES 1265
-#define OP_glClipPlanefOES 1266
-#define OP_glClipPlanefIMG 1267
-#define OP_glGetClipPlanefOES 1268
-#define OP_glClearDepthfOES 1269
-#define OP_glTexGenfOES 1270
-#define OP_glTexGenfvOES 1271
-#define OP_glTexGeniOES 1272
-#define OP_glTexGenivOES 1273
-#define OP_glTexGenxOES 1274
-#define OP_glTexGenxvOES 1275
-#define OP_glGetTexGenfvOES 1276
-#define OP_glGetTexGenivOES 1277
-#define OP_glGetTexGenxvOES 1278
-#define OP_glBindVertexArrayOES 1279
-#define OP_glDeleteVertexArraysOES 1280
-#define OP_glGenVertexArraysOES 1281
-#define OP_glIsVertexArrayOES 1282
-#define OP_glDiscardFramebufferEXT 1283
-#define OP_glMultiDrawArraysEXT 1284
-#define OP_glMultiDrawElementsEXT 1285
-#define OP_glMultiDrawArraysSUN 1286
-#define OP_glMultiDrawElementsSUN 1287
-#define OP_glRenderbufferStorageMultisampleIMG 1288
-#define OP_glFramebufferTexture2DMultisampleIMG 1289
-#define OP_glDeleteFencesNV 1290
-#define OP_glGenFencesNV 1291
-#define OP_glIsFenceNV 1292
-#define OP_glTestFenceNV 1293
-#define OP_glGetFenceivNV 1294
-#define OP_glFinishFenceNV 1295
-#define OP_glSetFenceNV 1296
-#define OP_glGetDriverControlsQCOM 1297
-#define OP_glGetDriverControlStringQCOM 1298
-#define OP_glEnableDriverControlQCOM 1299
-#define OP_glDisableDriverControlQCOM 1300
-#define OP_glExtGetTexturesQCOM 1301
-#define OP_glExtGetBuffersQCOM 1302
-#define OP_glExtGetRenderbuffersQCOM 1303
-#define OP_glExtGetFramebuffersQCOM 1304
-#define OP_glExtGetTexLevelParameterivQCOM 1305
-#define OP_glExtTexObjectStateOverrideiQCOM 1306
-#define OP_glExtGetTexSubImageQCOM 1307
-#define OP_glExtGetBufferPointervQCOM 1308
-#define OP_glExtGetShadersQCOM 1309
-#define OP_glExtGetProgramsQCOM 1310
-#define OP_glExtIsProgramBinaryQCOM 1311
-#define OP_glExtGetProgramBinarySourceQCOM 1312
-#define OP_glStartTilingQCOM 1313
-#define OP_glEndTilingQCOM 1314
-#define OP_last 1315
-
-
-#endif
diff --git a/tools/emulator/opengl/system/GLESv1_enc/gl_types.h b/tools/emulator/opengl/system/GLESv1_enc/gl_types.h
deleted file mode 100644
index 36fabfb95..000000000
--- a/tools/emulator/opengl/system/GLESv1_enc/gl_types.h
+++ /dev/null
@@ -1,20 +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.
-*/
-#ifndef __GL_TYPES__H
-#define __GL_TYPES__H
-
-#include "gl_base_types.h"
-#endif
diff --git a/tools/emulator/opengl/system/GLESv2/Android.mk b/tools/emulator/opengl/system/GLESv2/Android.mk
deleted file mode 100644
index c29952231..000000000
--- a/tools/emulator/opengl/system/GLESv2/Android.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-### GLESv2 implementation ###########################################
-$(call emugl-begin-shared-library,libGLESv2_emulation)
-$(call emugl-import,libOpenglSystemCommon libGLESv2_enc lib_renderControl_enc)
-
-LOCAL_CFLAGS += -DLOG_TAG=\"GLESv2_emulation\" -DGL_GLEXT_PROTOTYPES
-
-LOCAL_SRC_FILES := gl2.cpp
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
-
-$(call emugl-end-module)
diff --git a/tools/emulator/opengl/system/GLESv2/gl2.cpp b/tools/emulator/opengl/system/GLESv2/gl2.cpp
deleted file mode 100644
index b32dd74de..000000000
--- a/tools/emulator/opengl/system/GLESv2/gl2.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
-* Copyright 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.
-*/
-
-#include "EGLClientIface.h"
-#include "HostConnection.h"
-#include "GL2Encoder.h"
-#include "GLES/gl.h"
-#include "GLES/glext.h"
-#include "ErrorLog.h"
-#include "gralloc_cb.h"
-#include "ThreadInfo.h"
-
-//XXX: fix this macro to get the context from fast tls path
-#define GET_CONTEXT GL2Encoder * ctx = getEGLThreadInfo()->hostConn->gl2Encoder();
-
-#include "gl2_entry.cpp"
-
-//The functions table
-#include "gl2_ftable.h"
-
-
-static EGLClient_eglInterface * s_egl = NULL;
-static EGLClient_glesInterface * s_gl = NULL;
-
-#define DEFINE_AND_VALIDATE_HOST_CONNECTION(ret) \
- HostConnection *hostCon = HostConnection::get(); \
- if (!hostCon) { \
- ALOGE("egl: Failed to get host connection\n"); \
- return ret; \
- } \
- renderControl_encoder_context_t *rcEnc = hostCon->rcEncoder(); \
- if (!rcEnc) { \
- ALOGE("egl: Failed to get renderControl encoder context\n"); \
- return ret; \
- }
-
-//GL extensions
-void glEGLImageTargetTexture2DOES(void * self, GLenum target, GLeglImageOES image)
-{
- DBG("glEGLImageTargetTexture2DOES v2 target=%#x img=%p\n", target, image);
- //TODO: check error - we don't have a way to set gl error
- android_native_buffer_t* native_buffer = (android_native_buffer_t*)image;
-
- if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) {
- return;
- }
-
- if (native_buffer->common.version != sizeof(android_native_buffer_t)) {
- return;
- }
-
- GET_CONTEXT;
- DEFINE_AND_VALIDATE_HOST_CONNECTION();
-
- ctx->override2DTextureTarget(target);
- rcEnc->rcBindTexture(rcEnc, ((cb_handle_t *)(native_buffer->handle))->hostHandle);
- ctx->restore2DTextureTarget();
-
- return;
-}
-
-void glEGLImageTargetRenderbufferStorageOES(void *self, GLenum target, GLeglImageOES image)
-{
- DBG("glEGLImageTargetRenderbufferStorageOES v2 image=%p\n", image);
- //TODO: check error - we don't have a way to set gl error
- android_native_buffer_t* native_buffer = (android_native_buffer_t*)image;
-
- if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) {
- return;
- }
-
- if (native_buffer->common.version != sizeof(android_native_buffer_t)) {
- return;
- }
-
- DEFINE_AND_VALIDATE_HOST_CONNECTION();
- rcEnc->rcBindRenderbuffer(rcEnc, ((cb_handle_t *)(native_buffer->handle))->hostHandle);
-
- return;
-}
-
-void * getProcAddress(const char * procname)
-{
- // search in GL function table
- for (int i=0; i<gl2_num_funcs; i++) {
- if (!strcmp(gl2_funcs_by_name[i].name, procname)) {
- return gl2_funcs_by_name[i].proc;
- }
- }
- return NULL;
-}
-
-void finish()
-{
- glFinish();
-}
-
-const GLubyte *my_glGetString (void *self, GLenum name)
-{
- if (s_egl) {
- return (const GLubyte*)s_egl->getGLString(name);
- }
- return NULL;
-}
-
-void init()
-{
- GET_CONTEXT;
- ctx->set_glEGLImageTargetTexture2DOES(glEGLImageTargetTexture2DOES);
- ctx->set_glEGLImageTargetRenderbufferStorageOES(glEGLImageTargetRenderbufferStorageOES);
- ctx->set_glGetString(my_glGetString);
-}
-
-extern "C" {
-EGLClient_glesInterface * init_emul_gles(EGLClient_eglInterface *eglIface)
-{
- s_egl = eglIface;
-
- if (!s_gl) {
- s_gl = new EGLClient_glesInterface();
- s_gl->getProcAddress = getProcAddress;
- s_gl->finish = finish;
- s_gl->init = init;
- }
-
- return s_gl;
-}
-} //extern
-
-
diff --git a/tools/emulator/opengl/system/GLESv2_enc/Android.mk b/tools/emulator/opengl/system/GLESv2_enc/Android.mk
deleted file mode 100644
index e76a1756f..000000000
--- a/tools/emulator/opengl/system/GLESv2_enc/Android.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-### GLESv2_enc Encoder ###########################################
-$(call emugl-begin-shared-library,libGLESv2_enc)
-
-LOCAL_SRC_FILES := \
- GL2EncoderUtils.cpp \
- GL2Encoder.cpp \
- gl2_client_context.cpp \
- gl2_enc.cpp \
- gl2_entry.cpp
-
-LOCAL_CFLAGS += -DLOG_TAG=\"emuglGLESv2_enc\"
-
-$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-$(call emugl-import,libOpenglCodecCommon)
-
-$(call emugl-end-module)
-
-
diff --git a/tools/emulator/opengl/system/GLESv2_enc/GL2Encoder.cpp b/tools/emulator/opengl/system/GLESv2_enc/GL2Encoder.cpp
deleted file mode 100644
index d8fedf3bd..000000000
--- a/tools/emulator/opengl/system/GLESv2_enc/GL2Encoder.cpp
+++ /dev/null
@@ -1,1197 +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.
-*/
-
-#include "GL2Encoder.h"
-#include <assert.h>
-#include <ctype.h>
-
-#ifndef MIN
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-#endif
-
-static GLubyte *gVendorString= (GLubyte *) "Android";
-static GLubyte *gRendererString= (GLubyte *) "Android HW-GLES 2.0";
-static GLubyte *gVersionString= (GLubyte *) "OpenGL ES 2.0";
-static GLubyte *gExtensionsString= (GLubyte *) ""; // no extensions at this point;
-
-#define SET_ERROR_IF(condition,err) if((condition)) { \
- ALOGE("%s:%s:%d GL error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \
- ctx->setError(err); \
- return; \
- }
-
-
-#define RET_AND_SET_ERROR_IF(condition,err,ret) if((condition)) { \
- ALOGE("%s:%s:%d GL error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \
- ctx->setError(err); \
- return ret; \
- }
-
-
-GL2Encoder::GL2Encoder(IOStream *stream) : gl2_encoder_context_t(stream)
-{
- m_initialized = false;
- m_state = NULL;
- m_error = GL_NO_ERROR;
- m_num_compressedTextureFormats = 0;
- m_compressedTextureFormats = NULL;
- //overrides
- m_glFlush_enc = set_glFlush(s_glFlush);
- m_glPixelStorei_enc = set_glPixelStorei(s_glPixelStorei);
- m_glGetString_enc = set_glGetString(s_glGetString);
- m_glBindBuffer_enc = set_glBindBuffer(s_glBindBuffer);
- m_glBufferData_enc = set_glBufferData(s_glBufferData);
- m_glBufferSubData_enc = set_glBufferSubData(s_glBufferSubData);
- m_glDeleteBuffers_enc = set_glDeleteBuffers(s_glDeleteBuffers);
- m_glDrawArrays_enc = set_glDrawArrays(s_glDrawArrays);
- m_glDrawElements_enc = set_glDrawElements(s_glDrawElements);
- m_glGetIntegerv_enc = set_glGetIntegerv(s_glGetIntegerv);
- m_glGetFloatv_enc = set_glGetFloatv(s_glGetFloatv);
- m_glGetBooleanv_enc = set_glGetBooleanv(s_glGetBooleanv);
- m_glVertexAttribPointer_enc = set_glVertexAttribPointer(s_glVertexAtrribPointer);
- m_glEnableVertexAttribArray_enc = set_glEnableVertexAttribArray(s_glEnableVertexAttribArray);
- m_glDisableVertexAttribArray_enc = set_glDisableVertexAttribArray(s_glDisableVertexAttribArray);
- m_glGetVertexAttribiv_enc = set_glGetVertexAttribiv(s_glGetVertexAttribiv);
- m_glGetVertexAttribfv_enc = set_glGetVertexAttribfv(s_glGetVertexAttribfv);
- m_glGetVertexAttribPointerv = set_glGetVertexAttribPointerv(s_glGetVertexAttribPointerv);
- set_glShaderSource(s_glShaderSource);
- set_glFinish(s_glFinish);
- m_glGetError_enc = set_glGetError(s_glGetError);
- m_glLinkProgram_enc = set_glLinkProgram(s_glLinkProgram);
- m_glDeleteProgram_enc = set_glDeleteProgram(s_glDeleteProgram);
- m_glGetUniformiv_enc = set_glGetUniformiv(s_glGetUniformiv);
- m_glGetUniformfv_enc = set_glGetUniformfv(s_glGetUniformfv);
- m_glCreateProgram_enc = set_glCreateProgram(s_glCreateProgram);
- m_glCreateShader_enc = set_glCreateShader(s_glCreateShader);
- m_glDeleteShader_enc = set_glDeleteShader(s_glDeleteShader);
- m_glAttachShader_enc = set_glAttachShader(s_glAttachShader);
- m_glDetachShader_enc = set_glDetachShader(s_glDetachShader);
- m_glGetUniformLocation_enc = set_glGetUniformLocation(s_glGetUniformLocation);
- m_glUseProgram_enc = set_glUseProgram(s_glUseProgram);
-
- m_glUniform1f_enc = set_glUniform1f(s_glUniform1f);
- m_glUniform1fv_enc = set_glUniform1fv(s_glUniform1fv);
- m_glUniform1i_enc = set_glUniform1i(s_glUniform1i);
- m_glUniform1iv_enc = set_glUniform1iv(s_glUniform1iv);
- m_glUniform2f_enc = set_glUniform2f(s_glUniform2f);
- m_glUniform2fv_enc = set_glUniform2fv(s_glUniform2fv);
- m_glUniform2i_enc = set_glUniform2i(s_glUniform2i);
- m_glUniform2iv_enc = set_glUniform2iv(s_glUniform2iv);
- m_glUniform3f_enc = set_glUniform3f(s_glUniform3f);
- m_glUniform3fv_enc = set_glUniform3fv(s_glUniform3fv);
- m_glUniform3i_enc = set_glUniform3i(s_glUniform3i);
- m_glUniform3iv_enc = set_glUniform3iv(s_glUniform3iv);
- m_glUniform4f_enc = set_glUniform4f(s_glUniform4f);
- m_glUniform4fv_enc = set_glUniform4fv(s_glUniform4fv);
- m_glUniform4i_enc = set_glUniform4i(s_glUniform4i);
- m_glUniform4iv_enc = set_glUniform4iv(s_glUniform4iv);
- m_glUniformMatrix2fv_enc = set_glUniformMatrix2fv(s_glUniformMatrix2fv);
- m_glUniformMatrix3fv_enc = set_glUniformMatrix3fv(s_glUniformMatrix3fv);
- m_glUniformMatrix4fv_enc = set_glUniformMatrix4fv(s_glUniformMatrix4fv);
-
- m_glActiveTexture_enc = set_glActiveTexture(s_glActiveTexture);
- m_glBindTexture_enc = set_glBindTexture(s_glBindTexture);
- m_glDeleteTextures_enc = set_glDeleteTextures(s_glDeleteTextures);
- m_glGetTexParameterfv_enc = set_glGetTexParameterfv(s_glGetTexParameterfv);
- m_glGetTexParameteriv_enc = set_glGetTexParameteriv(s_glGetTexParameteriv);
- m_glTexParameterf_enc = set_glTexParameterf(s_glTexParameterf);
- m_glTexParameterfv_enc = set_glTexParameterfv(s_glTexParameterfv);
- m_glTexParameteri_enc = set_glTexParameteri(s_glTexParameteri);
- m_glTexParameteriv_enc = set_glTexParameteriv(s_glTexParameteriv);
-}
-
-GL2Encoder::~GL2Encoder()
-{
- delete m_compressedTextureFormats;
-}
-
-GLenum GL2Encoder::s_glGetError(void * self)
-{
- GL2Encoder *ctx = (GL2Encoder *)self;
- GLenum err = ctx->getError();
- if(err != GL_NO_ERROR) {
- ctx->setError(GL_NO_ERROR);
- return err;
- }
-
- return ctx->m_glGetError_enc(self);
-
-}
-
-void GL2Encoder::s_glFlush(void *self)
-{
- GL2Encoder *ctx = (GL2Encoder *) self;
- ctx->m_glFlush_enc(self);
- ctx->m_stream->flush();
-}
-
-const GLubyte *GL2Encoder::s_glGetString(void *self, GLenum name)
-{
- GLubyte *retval = (GLubyte *) "";
- switch(name) {
- case GL_VENDOR:
- retval = gVendorString;
- break;
- case GL_RENDERER:
- retval = gRendererString;
- break;
- case GL_VERSION:
- retval = gVersionString;
- break;
- case GL_EXTENSIONS:
- retval = gExtensionsString;
- break;
- }
- return retval;
-}
-
-void GL2Encoder::s_glPixelStorei(void *self, GLenum param, GLint value)
-{
- GL2Encoder *ctx = (GL2Encoder *)self;
- ctx->m_glPixelStorei_enc(ctx, param, value);
- assert(ctx->m_state != NULL);
- ctx->m_state->setPixelStore(param, value);
-}
-
-
-void GL2Encoder::s_glBindBuffer(void *self, GLenum target, GLuint id)
-{
- GL2Encoder *ctx = (GL2Encoder *) self;
- assert(ctx->m_state != NULL);
- ctx->m_state->bindBuffer(target, id);
- // TODO set error state if needed;
- ctx->m_glBindBuffer_enc(self, target, id);
-}
-
-void GL2Encoder::s_glBufferData(void * self, GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage)
-{
- GL2Encoder *ctx = (GL2Encoder *) self;
- GLuint bufferId = ctx->m_state->getBuffer(target);
- SET_ERROR_IF(bufferId==0, GL_INVALID_OPERATION);
- SET_ERROR_IF(size<0, GL_INVALID_VALUE);
-
- ctx->m_shared->updateBufferData(bufferId, size, (void*)data);
- ctx->m_glBufferData_enc(self, target, size, data, usage);
-}
-
-void GL2Encoder::s_glBufferSubData(void * self, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data)
-{
- GL2Encoder *ctx = (GL2Encoder *) self;
- GLuint bufferId = ctx->m_state->getBuffer(target);
- SET_ERROR_IF(bufferId==0, GL_INVALID_OPERATION);
-
- GLenum res = ctx->m_shared->subUpdateBufferData(bufferId, offset, size, (void*)data);
- SET_ERROR_IF(res, res);
-
- ctx->m_glBufferSubData_enc(self, target, offset, size, data);
-}
-
-void GL2Encoder::s_glDeleteBuffers(void * self, GLsizei n, const GLuint * buffers)
-{
- GL2Encoder *ctx = (GL2Encoder *) self;
- SET_ERROR_IF(n<0, GL_INVALID_VALUE);
- for (int i=0; i<n; i++) {
- ctx->m_shared->deleteBufferData(buffers[i]);
- ctx->m_glDeleteBuffers_enc(self,1,&buffers[i]);
- }
-}
-
-void GL2Encoder::s_glVertexAtrribPointer(void *self, GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * ptr)
-{
- GL2Encoder *ctx = (GL2Encoder *)self;
- assert(ctx->m_state != NULL);
- ctx->m_state->setState(indx, size, type, normalized, stride, ptr);
-}
-
-void GL2Encoder::s_glGetIntegerv(void *self, GLenum param, GLint *ptr)
-{
- GL2Encoder *ctx = (GL2Encoder *) self;
- assert(ctx->m_state != NULL);
- GLClientState* state = ctx->m_state;
-
- switch (param) {
- case GL_NUM_SHADER_BINARY_FORMATS:
- *ptr = 0;
- break;
- case GL_SHADER_BINARY_FORMATS:
- // do nothing
- break;
-
- case GL_COMPRESSED_TEXTURE_FORMATS: {
- GLint *compressedTextureFormats = ctx->getCompressedTextureFormats();
- if (ctx->m_num_compressedTextureFormats > 0 &&
- compressedTextureFormats != NULL) {
- memcpy(ptr, compressedTextureFormats,
- ctx->m_num_compressedTextureFormats * sizeof(GLint));
- }
- break;
- }
-
- case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
- case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
- case GL_MAX_TEXTURE_IMAGE_UNITS:
- ctx->m_glGetIntegerv_enc(self, param, ptr);
- *ptr = MIN(*ptr, GLClientState::MAX_TEXTURE_UNITS);
- break;
-
- case GL_TEXTURE_BINDING_2D:
- *ptr = state->getBoundTexture(GL_TEXTURE_2D);
- break;
- case GL_TEXTURE_BINDING_EXTERNAL_OES:
- *ptr = state->getBoundTexture(GL_TEXTURE_EXTERNAL_OES);
- break;
-
- default:
- if (!ctx->m_state->getClientStateParameter<GLint>(param, ptr)) {
- ctx->m_glGetIntegerv_enc(self, param, ptr);
- }
- break;
- }
-}
-
-
-void GL2Encoder::s_glGetFloatv(void *self, GLenum param, GLfloat *ptr)
-{
- GL2Encoder *ctx = (GL2Encoder *)self;
- assert(ctx->m_state != NULL);
- GLClientState* state = ctx->m_state;
-
- switch (param) {
- case GL_NUM_SHADER_BINARY_FORMATS:
- *ptr = 0;
- break;
- case GL_SHADER_BINARY_FORMATS:
- // do nothing
- break;
-
- case GL_COMPRESSED_TEXTURE_FORMATS: {
- GLint *compressedTextureFormats = ctx->getCompressedTextureFormats();
- if (ctx->m_num_compressedTextureFormats > 0 &&
- compressedTextureFormats != NULL) {
- for (int i = 0; i < ctx->m_num_compressedTextureFormats; i++) {
- ptr[i] = (GLfloat) compressedTextureFormats[i];
- }
- }
- break;
- }
-
- case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
- case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
- case GL_MAX_TEXTURE_IMAGE_UNITS:
- ctx->m_glGetFloatv_enc(self, param, ptr);
- *ptr = MIN(*ptr, (GLfloat)GLClientState::MAX_TEXTURE_UNITS);
- break;
-
- case GL_TEXTURE_BINDING_2D:
- *ptr = (GLfloat)state->getBoundTexture(GL_TEXTURE_2D);
- break;
- case GL_TEXTURE_BINDING_EXTERNAL_OES:
- *ptr = (GLfloat)state->getBoundTexture(GL_TEXTURE_EXTERNAL_OES);
- break;
-
- default:
- if (!ctx->m_state->getClientStateParameter<GLfloat>(param, ptr)) {
- ctx->m_glGetFloatv_enc(self, param, ptr);
- }
- break;
- }
-}
-
-
-void GL2Encoder::s_glGetBooleanv(void *self, GLenum param, GLboolean *ptr)
-{
- GL2Encoder *ctx = (GL2Encoder *)self;
- assert(ctx->m_state != NULL);
- GLClientState* state = ctx->m_state;
-
- switch (param) {
- case GL_NUM_SHADER_BINARY_FORMATS:
- *ptr = GL_FALSE;
- break;
- case GL_SHADER_BINARY_FORMATS:
- // do nothing
- break;
-
- case GL_COMPRESSED_TEXTURE_FORMATS: {
- GLint *compressedTextureFormats = ctx->getCompressedTextureFormats();
- if (ctx->m_num_compressedTextureFormats > 0 &&
- compressedTextureFormats != NULL) {
- for (int i = 0; i < ctx->m_num_compressedTextureFormats; i++) {
- ptr[i] = compressedTextureFormats[i] != 0 ? GL_TRUE : GL_FALSE;
- }
- }
- break;
- }
-
- case GL_TEXTURE_BINDING_2D:
- *ptr = state->getBoundTexture(GL_TEXTURE_2D) != 0 ? GL_TRUE : GL_FALSE;
- break;
- case GL_TEXTURE_BINDING_EXTERNAL_OES:
- *ptr = state->getBoundTexture(GL_TEXTURE_EXTERNAL_OES) != 0
- ? GL_TRUE : GL_FALSE;
- break;
-
- default:
- if (!ctx->m_state->getClientStateParameter<GLboolean>(param, ptr)) {
- ctx->m_glGetBooleanv_enc(self, param, ptr);
- }
- break;
- }
-}
-
-
-void GL2Encoder::s_glEnableVertexAttribArray(void *self, GLuint index)
-{
- GL2Encoder *ctx = (GL2Encoder *)self;
- assert(ctx->m_state);
- ctx->m_state->enable(index, 1);
-}
-
-void GL2Encoder::s_glDisableVertexAttribArray(void *self, GLuint index)
-{
- GL2Encoder *ctx = (GL2Encoder *)self;
- assert(ctx->m_state);
- ctx->m_state->enable(index, 0);
-}
-
-
-void GL2Encoder::s_glGetVertexAttribiv(void *self, GLuint index, GLenum pname, GLint *params)
-{
- GL2Encoder *ctx = (GL2Encoder *)self;
- assert(ctx->m_state);
-
- if (!ctx->m_state->getVertexAttribParameter<GLint>(index, pname, params)) {
- ctx->m_glGetVertexAttribiv_enc(self, index, pname, params);
- }
-}
-
-void GL2Encoder::s_glGetVertexAttribfv(void *self, GLuint index, GLenum pname, GLfloat *params)
-{
- GL2Encoder *ctx = (GL2Encoder *)self;
- assert(ctx->m_state);
-
- if (!ctx->m_state->getVertexAttribParameter<GLfloat>(index, pname, params)) {
- ctx->m_glGetVertexAttribfv_enc(self, index, pname, params);
- }
-}
-
-void GL2Encoder::s_glGetVertexAttribPointerv(void *self, GLuint index, GLenum pname, GLvoid **pointer)
-{
- GL2Encoder *ctx = (GL2Encoder *)self;
- if (ctx->m_state == NULL) return;
-
- const GLClientState::VertexAttribState *va_state = ctx->m_state->getState(index);
- if (va_state != NULL) {
- *pointer = va_state->data;
- }
-}
-
-
-void GL2Encoder::sendVertexAttributes(GLint first, GLsizei count)
-{
- assert(m_state);
-
- for (int i = 0; i < m_state->nLocations(); i++) {
- bool enableDirty;
- const GLClientState::VertexAttribState *state = m_state->getStateAndEnableDirty(i, &enableDirty);
-
- if (!state) {
- continue;
- }
-
- if (!enableDirty && !state->enabled) {
- continue;
- }
-
-
- if (state->enabled) {
- m_glEnableVertexAttribArray_enc(this, i);
-
- unsigned int datalen = state->elementSize * count;
- int stride = state->stride == 0 ? state->elementSize : state->stride;
- int firstIndex = stride * first;
-
- if (state->bufferObject == 0) {
- this->glVertexAttribPointerData(this, i, state->size, state->type, state->normalized, state->stride,
- (unsigned char *)state->data + firstIndex, datalen);
- } else {
- this->m_glBindBuffer_enc(this, GL_ARRAY_BUFFER, state->bufferObject);
- this->glVertexAttribPointerOffset(this, i, state->size, state->type, state->normalized, state->stride,
- (GLuint) state->data + firstIndex);
- this->m_glBindBuffer_enc(this, GL_ARRAY_BUFFER, m_state->currentArrayVbo());
- }
- } else {
- this->m_glDisableVertexAttribArray_enc(this, i);
- }
- }
-}
-
-void GL2Encoder::s_glDrawArrays(void *self, GLenum mode, GLint first, GLsizei count)
-{
- GL2Encoder *ctx = (GL2Encoder *)self;
- ctx->sendVertexAttributes(first, count);
- ctx->m_glDrawArrays_enc(ctx, mode, 0, count);
-}
-
-
-void GL2Encoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, const void *indices)
-{
-
- GL2Encoder *ctx = (GL2Encoder *)self;
- assert(ctx->m_state != NULL);
- SET_ERROR_IF(count<0, GL_INVALID_VALUE);
-
- bool has_immediate_arrays = false;
- bool has_indirect_arrays = false;
- int nLocations = ctx->m_state->nLocations();
-
- for (int i = 0; i < nLocations; i++) {
- const GLClientState::VertexAttribState *state = ctx->m_state->getState(i);
- if (state->enabled) {
- if (state->bufferObject != 0) {
- has_indirect_arrays = true;
- } else {
- has_immediate_arrays = true;
- }
- }
- }
-
- if (!has_immediate_arrays && !has_indirect_arrays) {
- ALOGE("glDrawElements: no data bound to the command - ignoring\n");
- return;
- }
-
- bool adjustIndices = true;
- if (ctx->m_state->currentIndexVbo() != 0) {
- if (!has_immediate_arrays) {
- ctx->sendVertexAttributes(0, count);
- ctx->m_glBindBuffer_enc(self, GL_ELEMENT_ARRAY_BUFFER, ctx->m_state->currentIndexVbo());
- ctx->glDrawElementsOffset(ctx, mode, count, type, (GLuint)indices);
- adjustIndices = false;
- } else {
- BufferData * buf = ctx->m_shared->getBufferData(ctx->m_state->currentIndexVbo());
- ctx->m_glBindBuffer_enc(self, GL_ELEMENT_ARRAY_BUFFER, 0);
- indices = (void*)((GLintptr)buf->m_fixedBuffer.ptr() + (GLintptr)indices);
- }
- }
- if (adjustIndices) {
- void *adjustedIndices = (void*)indices;
- int minIndex = 0, maxIndex = 0;
-
- switch(type) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- GLUtils::minmax<unsigned char>((unsigned char *)indices, count, &minIndex, &maxIndex);
- if (minIndex != 0) {
- adjustedIndices = ctx->m_fixedBuffer.alloc(glSizeof(type) * count);
- GLUtils::shiftIndices<unsigned char>((unsigned char *)indices,
- (unsigned char *)adjustedIndices,
- count, -minIndex);
- }
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- GLUtils::minmax<unsigned short>((unsigned short *)indices, count, &minIndex, &maxIndex);
- if (minIndex != 0) {
- adjustedIndices = ctx->m_fixedBuffer.alloc(glSizeof(type) * count);
- GLUtils::shiftIndices<unsigned short>((unsigned short *)indices,
- (unsigned short *)adjustedIndices,
- count, -minIndex);
- }
- break;
- default:
- ALOGE("unsupported index buffer type %d\n", type);
- }
- if (has_indirect_arrays || 1) {
- ctx->sendVertexAttributes(minIndex, maxIndex - minIndex + 1);
- ctx->glDrawElementsData(ctx, mode, count, type, adjustedIndices,
- count * glSizeof(type));
- // XXX - OPTIMIZATION (see the other else branch) should be implemented
- if(!has_indirect_arrays) {
- //ALOGD("unoptimized drawelements !!!\n");
- }
- } else {
- // we are all direct arrays and immidate mode index array -
- // rebuild the arrays and the index array;
- ALOGE("glDrawElements: direct index & direct buffer data - will be implemented in later versions;\n");
- }
- }
-}
-
-
-GLint * GL2Encoder::getCompressedTextureFormats()
-{
- if (m_compressedTextureFormats == NULL) {
- this->glGetIntegerv(this, GL_NUM_COMPRESSED_TEXTURE_FORMATS,
- &m_num_compressedTextureFormats);
- if (m_num_compressedTextureFormats > 0) {
- // get number of texture formats;
- m_compressedTextureFormats = new GLint[m_num_compressedTextureFormats];
- this->glGetCompressedTextureFormats(this, m_num_compressedTextureFormats, m_compressedTextureFormats);
- }
- }
- return m_compressedTextureFormats;
-}
-
-// Replace uses of samplerExternalOES with sampler2D, recording the names of
-// modified shaders in data. Also remove
-// #extension GL_OES_EGL_image_external : require
-// statements.
-//
-// This implementation assumes the input has already been pre-processed. If not,
-// a few cases will be mishandled:
-//
-// 1. "mySampler" will be incorrectly recorded as being a samplerExternalOES in
-// the following code:
-// #if 1
-// uniform sampler2D mySampler;
-// #else
-// uniform samplerExternalOES mySampler;
-// #endif
-//
-// 2. Comments that look like sampler declarations will be incorrectly modified
-// and recorded:
-// // samplerExternalOES hahaFooledYou
-//
-// 3. However, GLSL ES does not have a concatentation operator, so things like
-// this (valid in C) are invalid and not a problem:
-// #define SAMPLER(TYPE, NAME) uniform sampler#TYPE NAME
-// SAMPLER(ExternalOES, mySampler);
-//
-static bool replaceSamplerExternalWith2D(char* const str, ShaderData* const data)
-{
- static const char STR_HASH_EXTENSION[] = "#extension";
- static const char STR_GL_OES_EGL_IMAGE_EXTERNAL[] = "GL_OES_EGL_image_external";
- static const char STR_SAMPLER_EXTERNAL_OES[] = "samplerExternalOES";
- static const char STR_SAMPLER2D_SPACE[] = "sampler2D ";
-
- // -- overwrite all "#extension GL_OES_EGL_image_external : xxx" statements
- char* c = str;
- while ((c = strstr(c, STR_HASH_EXTENSION))) {
- char* start = c;
- c += sizeof(STR_HASH_EXTENSION)-1;
- while (isspace(*c) && *c != '\0') {
- c++;
- }
- if (strncmp(c, STR_GL_OES_EGL_IMAGE_EXTERNAL,
- sizeof(STR_GL_OES_EGL_IMAGE_EXTERNAL)-1) == 0)
- {
- // #extension statements are terminated by end of line
- c = start;
- while (*c != '\0' && *c != '\r' && *c != '\n') {
- *c++ = ' ';
- }
- }
- }
-
- // -- replace "samplerExternalOES" with "sampler2D" and record name
- c = str;
- while ((c = strstr(c, STR_SAMPLER_EXTERNAL_OES))) {
- // Make sure "samplerExternalOES" isn't a substring of a larger token
- if (c == str || !isspace(*(c-1))) {
- c++;
- continue;
- }
- char* sampler_start = c;
- c += sizeof(STR_SAMPLER_EXTERNAL_OES)-1;
- if (!isspace(*c) && *c != '\0') {
- continue;
- }
-
- // capture sampler name
- while (isspace(*c) && *c != '\0') {
- c++;
- }
- if (!isalpha(*c) && *c != '_') {
- // not an identifier
- return false;
- }
- char* name_start = c;
- do {
- c++;
- } while (isalnum(*c) || *c == '_');
- data->samplerExternalNames.push_back(
- android::String8(name_start, c - name_start));
-
- // memcpy instead of strcpy since we don't want the NUL terminator
- memcpy(sampler_start, STR_SAMPLER2D_SPACE, sizeof(STR_SAMPLER2D_SPACE)-1);
- }
-
- return true;
-}
-
-void GL2Encoder::s_glShaderSource(void *self, GLuint shader, GLsizei count, const GLchar **string, const GLint *length)
-{
- GL2Encoder* ctx = (GL2Encoder*)self;
- ShaderData* shaderData = ctx->m_shared->getShaderData(shader);
- SET_ERROR_IF(!shaderData, GL_INVALID_VALUE);
-
- int len = glUtilsCalcShaderSourceLen((char**)string, (GLint*)length, count);
- char *str = new char[len + 1];
- glUtilsPackStrings(str, (char**)string, (GLint*)length, count);
-
- // TODO: pre-process str before calling replaceSamplerExternalWith2D().
- // Perhaps we can borrow Mesa's pre-processor?
-
- if (!replaceSamplerExternalWith2D(str, shaderData)) {
- delete str;
- ctx->setError(GL_OUT_OF_MEMORY);
- return;
- }
-
- ctx->glShaderString(ctx, shader, str, len + 1);
- delete str;
-}
-
-void GL2Encoder::s_glFinish(void *self)
-{
- GL2Encoder *ctx = (GL2Encoder *)self;
- ctx->glFinishRoundTrip(self);
-}
-
-void GL2Encoder::s_glLinkProgram(void * self, GLuint program)
-{
- GL2Encoder *ctx = (GL2Encoder *)self;
- ctx->m_glLinkProgram_enc(self, program);
-
- GLint linkStatus = 0;
- ctx->glGetProgramiv(self,program,GL_LINK_STATUS,&linkStatus);
- if (!linkStatus)
- return;
-
- //get number of active uniforms in the program
- GLint numUniforms=0;
- ctx->glGetProgramiv(self, program, GL_ACTIVE_UNIFORMS, &numUniforms);
- ctx->m_shared->initProgramData(program,numUniforms);
-
- //get the length of the longest uniform name
- GLint maxLength=0;
- ctx->glGetProgramiv(self, program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxLength);
-
- GLint size;
- GLenum type;
- GLchar *name = new GLchar[maxLength+1];
- GLint location;
- //for each active uniform, get its size and starting location.
- for (GLint i=0 ; i<numUniforms ; ++i)
- {
- ctx->glGetActiveUniform(self, program, i, maxLength, NULL, &size, &type, name);
- location = ctx->m_glGetUniformLocation_enc(self, program, name);
- ctx->m_shared->setProgramIndexInfo(program, i, location, size, type, name);
- }
- ctx->m_shared->setupLocationShiftWAR(program);
-
- delete[] name;
-}
-
-void GL2Encoder::s_glDeleteProgram(void *self, GLuint program)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- ctx->m_glDeleteProgram_enc(self, program);
-
- ctx->m_shared->deleteProgramData(program);
-}
-
-void GL2Encoder::s_glGetUniformiv(void *self, GLuint program, GLint location, GLint* params)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- SET_ERROR_IF(!ctx->m_shared->isProgram(program), GL_INVALID_VALUE);
- SET_ERROR_IF(!ctx->m_shared->isProgramInitialized(program), GL_INVALID_OPERATION);
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
- SET_ERROR_IF(ctx->m_shared->getProgramUniformType(program,hostLoc)==0, GL_INVALID_OPERATION);
- ctx->m_glGetUniformiv_enc(self, program, hostLoc, params);
-}
-void GL2Encoder::s_glGetUniformfv(void *self, GLuint program, GLint location, GLfloat* params)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- SET_ERROR_IF(!ctx->m_shared->isProgram(program), GL_INVALID_VALUE);
- SET_ERROR_IF(!ctx->m_shared->isProgramInitialized(program), GL_INVALID_OPERATION);
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(program,location);
- SET_ERROR_IF(ctx->m_shared->getProgramUniformType(program,hostLoc)==0, GL_INVALID_OPERATION);
- ctx->m_glGetUniformfv_enc(self, program, hostLoc, params);
-}
-
-GLuint GL2Encoder::s_glCreateProgram(void * self)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLuint program = ctx->m_glCreateProgram_enc(self);
- if (program!=0)
- ctx->m_shared->addProgramData(program);
- return program;
-}
-
-GLuint GL2Encoder::s_glCreateShader(void *self, GLenum shaderType)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLuint shader = ctx->m_glCreateShader_enc(self, shaderType);
- if (shader != 0) {
- if (!ctx->m_shared->addShaderData(shader)) {
- ctx->m_glDeleteShader_enc(self, shader);
- return 0;
- }
- }
- return shader;
-}
-
-void GL2Encoder::s_glDeleteShader(void *self, GLenum shader)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- ctx->m_glDeleteShader_enc(self,shader);
- ctx->m_shared->unrefShaderData(shader);
-}
-
-void GL2Encoder::s_glAttachShader(void *self, GLuint program, GLuint shader)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- ctx->m_glAttachShader_enc(self, program, shader);
- ctx->m_shared->attachShader(program, shader);
-}
-
-void GL2Encoder::s_glDetachShader(void *self, GLuint program, GLuint shader)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- ctx->m_glDetachShader_enc(self, program, shader);
- ctx->m_shared->detachShader(program, shader);
-}
-
-int GL2Encoder::s_glGetUniformLocation(void *self, GLuint program, const GLchar *name)
-{
- if (!name) return -1;
-
- GL2Encoder *ctx = (GL2Encoder*)self;
-
- // if we need the uniform location WAR
- // parse array index from the end of the name string
- int arrIndex = 0;
- bool needLocationWAR = ctx->m_shared->needUniformLocationWAR(program);
- if (needLocationWAR) {
- int namelen = strlen(name);
- if (name[namelen-1] == ']') {
- char *brace = strrchr(name,'[');
- if (!brace || sscanf(brace+1,"%d",&arrIndex) != 1) {
- return -1;
- }
-
- }
- }
-
- int hostLoc = ctx->m_glGetUniformLocation_enc(self, program, name);
- if (hostLoc >= 0 && needLocationWAR) {
- return ctx->m_shared->locationWARHostToApp(program, hostLoc, arrIndex);
- }
- return hostLoc;
-}
-
-bool GL2Encoder::updateHostTexture2DBinding(GLenum texUnit, GLenum newTarget)
-{
- if (newTarget != GL_TEXTURE_2D && newTarget != GL_TEXTURE_EXTERNAL_OES)
- return false;
-
- m_state->setActiveTextureUnit(texUnit);
-
- GLenum oldTarget = m_state->getPriorityEnabledTarget(GL_TEXTURE_2D);
- if (newTarget != oldTarget) {
- if (newTarget == GL_TEXTURE_EXTERNAL_OES) {
- m_state->disableTextureTarget(GL_TEXTURE_2D);
- m_state->enableTextureTarget(GL_TEXTURE_EXTERNAL_OES);
- } else {
- m_state->disableTextureTarget(GL_TEXTURE_EXTERNAL_OES);
- m_state->enableTextureTarget(GL_TEXTURE_2D);
- }
- m_glActiveTexture_enc(this, texUnit);
- m_glBindTexture_enc(this, GL_TEXTURE_2D,
- m_state->getBoundTexture(newTarget));
- return true;
- }
-
- return false;
-}
-
-void GL2Encoder::s_glUseProgram(void *self, GLuint program)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLClientState* state = ctx->m_state;
- GLSharedGroupPtr shared = ctx->m_shared;
-
- ctx->m_glUseProgram_enc(self, program);
- ctx->m_state->setCurrentProgram(program);
-
- GLenum origActiveTexture = state->getActiveTextureUnit();
- GLenum hostActiveTexture = origActiveTexture;
- GLint samplerIdx = -1;
- GLint samplerVal;
- GLenum samplerTarget;
- while ((samplerIdx = shared->getNextSamplerUniform(program, samplerIdx, &samplerVal, &samplerTarget)) != -1) {
- if (samplerVal < 0 || samplerVal >= GLClientState::MAX_TEXTURE_UNITS)
- continue;
- if (ctx->updateHostTexture2DBinding(GL_TEXTURE0 + samplerVal,
- samplerTarget))
- {
- hostActiveTexture = GL_TEXTURE0 + samplerVal;
- }
- }
- state->setActiveTextureUnit(origActiveTexture);
- if (hostActiveTexture != origActiveTexture) {
- ctx->m_glActiveTexture_enc(self, origActiveTexture);
- }
-}
-
-void GL2Encoder::s_glUniform1f(void *self , GLint location, GLfloat x)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location);
- ctx->m_glUniform1f_enc(self, hostLoc, x);
-}
-
-void GL2Encoder::s_glUniform1fv(void *self , GLint location, GLsizei count, const GLfloat* v)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location);
- ctx->m_glUniform1fv_enc(self, hostLoc, count, v);
-}
-
-void GL2Encoder::s_glUniform1i(void *self , GLint location, GLint x)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLClientState* state = ctx->m_state;
- GLSharedGroupPtr shared = ctx->m_shared;
-
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location);
- ctx->m_glUniform1i_enc(self, hostLoc, x);
-
- GLenum target;
- if (shared->setSamplerUniform(state->currentProgram(), location, x, &target)) {
- GLenum origActiveTexture = state->getActiveTextureUnit();
- if (ctx->updateHostTexture2DBinding(GL_TEXTURE0 + x, target)) {
- ctx->m_glActiveTexture_enc(self, origActiveTexture);
- }
- state->setActiveTextureUnit(origActiveTexture);
- }
-}
-
-void GL2Encoder::s_glUniform1iv(void *self , GLint location, GLsizei count, const GLint* v)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location);
- ctx->m_glUniform1iv_enc(self, hostLoc, count, v);
-}
-
-void GL2Encoder::s_glUniform2f(void *self , GLint location, GLfloat x, GLfloat y)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location);
- ctx->m_glUniform2f_enc(self, hostLoc, x, y);
-}
-
-void GL2Encoder::s_glUniform2fv(void *self , GLint location, GLsizei count, const GLfloat* v)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location);
- ctx->m_glUniform2fv_enc(self, hostLoc, count, v);
-}
-
-void GL2Encoder::s_glUniform2i(void *self , GLint location, GLint x, GLint y)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location);
- ctx->m_glUniform2i_enc(self, hostLoc, x, y);
-}
-
-void GL2Encoder::s_glUniform2iv(void *self , GLint location, GLsizei count, const GLint* v)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location);
- ctx->m_glUniform2iv_enc(self, hostLoc, count, v);
-}
-
-void GL2Encoder::s_glUniform3f(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location);
- ctx->m_glUniform3f_enc(self, hostLoc, x, y, z);
-}
-
-void GL2Encoder::s_glUniform3fv(void *self , GLint location, GLsizei count, const GLfloat* v)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location);
- ctx->m_glUniform3fv_enc(self, hostLoc, count, v);
-}
-
-void GL2Encoder::s_glUniform3i(void *self , GLint location, GLint x, GLint y, GLint z)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location);
- ctx->m_glUniform3i_enc(self, hostLoc, x, y, z);
-}
-
-void GL2Encoder::s_glUniform3iv(void *self , GLint location, GLsizei count, const GLint* v)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location);
- ctx->m_glUniform3iv_enc(self, hostLoc, count, v);
-}
-
-void GL2Encoder::s_glUniform4f(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location);
- ctx->m_glUniform4f_enc(self, hostLoc, x, y, z, w);
-}
-
-void GL2Encoder::s_glUniform4fv(void *self , GLint location, GLsizei count, const GLfloat* v)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location);
- ctx->m_glUniform4fv_enc(self, hostLoc, count, v);
-}
-
-void GL2Encoder::s_glUniform4i(void *self , GLint location, GLint x, GLint y, GLint z, GLint w)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location);
- ctx->m_glUniform4i_enc(self, hostLoc, x, y, z, w);
-}
-
-void GL2Encoder::s_glUniform4iv(void *self , GLint location, GLsizei count, const GLint* v)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location);
- ctx->m_glUniform4iv_enc(self, hostLoc, count, v);
-}
-
-void GL2Encoder::s_glUniformMatrix2fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location);
- ctx->m_glUniformMatrix2fv_enc(self, hostLoc, count, transpose, value);
-}
-
-void GL2Encoder::s_glUniformMatrix3fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location);
- ctx->m_glUniformMatrix3fv_enc(self, hostLoc, count, transpose, value);
-}
-
-void GL2Encoder::s_glUniformMatrix4fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- GL2Encoder *ctx = (GL2Encoder*)self;
- GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location);
- ctx->m_glUniformMatrix4fv_enc(self, hostLoc, count, transpose, value);
-}
-
-void GL2Encoder::s_glActiveTexture(void* self, GLenum texture)
-{
- GL2Encoder* ctx = (GL2Encoder*)self;
- GLClientState* state = ctx->m_state;
- GLenum err;
-
- SET_ERROR_IF((err = state->setActiveTextureUnit(texture)) != GL_NO_ERROR, err);
-
- ctx->m_glActiveTexture_enc(ctx, texture);
-}
-
-void GL2Encoder::s_glBindTexture(void* self, GLenum target, GLuint texture)
-{
- GL2Encoder* ctx = (GL2Encoder*)self;
- GLClientState* state = ctx->m_state;
- GLenum err;
- GLboolean firstUse;
-
- SET_ERROR_IF((err = state->bindTexture(target, texture, &firstUse)) != GL_NO_ERROR, err);
-
- if (target != GL_TEXTURE_2D && target != GL_TEXTURE_EXTERNAL_OES) {
- ctx->m_glBindTexture_enc(ctx, target, texture);
- return;
- }
-
- GLenum priorityTarget = state->getPriorityEnabledTarget(GL_TEXTURE_2D);
-
- if (target == GL_TEXTURE_EXTERNAL_OES && firstUse) {
- ctx->m_glBindTexture_enc(ctx, GL_TEXTURE_2D, texture);
- ctx->m_glTexParameteri_enc(ctx, GL_TEXTURE_2D,
- GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- ctx->m_glTexParameteri_enc(ctx, GL_TEXTURE_2D,
- GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- ctx->m_glTexParameteri_enc(ctx, GL_TEXTURE_2D,
- GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- if (target != priorityTarget) {
- ctx->m_glBindTexture_enc(ctx, GL_TEXTURE_2D,
- state->getBoundTexture(GL_TEXTURE_2D));
- }
- }
-
- if (target == priorityTarget) {
- ctx->m_glBindTexture_enc(ctx, GL_TEXTURE_2D, texture);
- }
-}
-
-void GL2Encoder::s_glDeleteTextures(void* self, GLsizei n, const GLuint* textures)
-{
- GL2Encoder* ctx = (GL2Encoder*)self;
- GLClientState* state = ctx->m_state;
-
- state->deleteTextures(n, textures);
- ctx->m_glDeleteTextures_enc(ctx, n, textures);
-}
-
-void GL2Encoder::s_glGetTexParameterfv(void* self,
- GLenum target, GLenum pname, GLfloat* params)
-{
- GL2Encoder* ctx = (GL2Encoder*)self;
- const GLClientState* state = ctx->m_state;
-
- if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) {
- ctx->override2DTextureTarget(target);
- ctx->m_glGetTexParameterfv_enc(ctx, GL_TEXTURE_2D, pname, params);
- ctx->restore2DTextureTarget();
- } else {
- ctx->m_glGetTexParameterfv_enc(ctx, target, pname, params);
- }
-}
-
-void GL2Encoder::s_glGetTexParameteriv(void* self,
- GLenum target, GLenum pname, GLint* params)
-{
- GL2Encoder* ctx = (GL2Encoder*)self;
- const GLClientState* state = ctx->m_state;
-
- switch (pname) {
- case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
- *params = 1;
- break;
-
- default:
- if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) {
- ctx->override2DTextureTarget(target);
- ctx->m_glGetTexParameteriv_enc(ctx, GL_TEXTURE_2D, pname, params);
- ctx->restore2DTextureTarget();
- } else {
- ctx->m_glGetTexParameteriv_enc(ctx, target, pname, params);
- }
- break;
- }
-}
-
-static bool isValidTextureExternalParam(GLenum pname, GLenum param)
-{
- switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- return param == GL_NEAREST || param == GL_LINEAR;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- return param == GL_CLAMP_TO_EDGE;
-
- default:
- return true;
- }
-}
-
-void GL2Encoder::s_glTexParameterf(void* self,
- GLenum target, GLenum pname, GLfloat param)
-{
- GL2Encoder* ctx = (GL2Encoder*)self;
- const GLClientState* state = ctx->m_state;
-
- SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES &&
- !isValidTextureExternalParam(pname, (GLenum)param)),
- GL_INVALID_ENUM);
-
- if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) {
- ctx->override2DTextureTarget(target);
- ctx->m_glTexParameterf_enc(ctx, GL_TEXTURE_2D, pname, param);
- ctx->restore2DTextureTarget();
- } else {
- ctx->m_glTexParameterf_enc(ctx, target, pname, param);
- }
-}
-
-void GL2Encoder::s_glTexParameterfv(void* self,
- GLenum target, GLenum pname, const GLfloat* params)
-{
- GL2Encoder* ctx = (GL2Encoder*)self;
- const GLClientState* state = ctx->m_state;
-
- SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES &&
- !isValidTextureExternalParam(pname, (GLenum)params[0])),
- GL_INVALID_ENUM);
-
- if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) {
- ctx->override2DTextureTarget(target);
- ctx->m_glTexParameterfv_enc(ctx, GL_TEXTURE_2D, pname, params);
- ctx->restore2DTextureTarget();
- } else {
- ctx->m_glTexParameterfv_enc(ctx, target, pname, params);
- }
-}
-
-void GL2Encoder::s_glTexParameteri(void* self,
- GLenum target, GLenum pname, GLint param)
-{
- GL2Encoder* ctx = (GL2Encoder*)self;
- const GLClientState* state = ctx->m_state;
-
- SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES &&
- !isValidTextureExternalParam(pname, (GLenum)param)),
- GL_INVALID_ENUM);
-
- if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) {
- ctx->override2DTextureTarget(target);
- ctx->m_glTexParameteri_enc(ctx, GL_TEXTURE_2D, pname, param);
- ctx->restore2DTextureTarget();
- } else {
- ctx->m_glTexParameteri_enc(ctx, target, pname, param);
- }
-}
-
-void GL2Encoder::s_glTexParameteriv(void* self,
- GLenum target, GLenum pname, const GLint* params)
-{
- GL2Encoder* ctx = (GL2Encoder*)self;
- const GLClientState* state = ctx->m_state;
-
- SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES &&
- !isValidTextureExternalParam(pname, (GLenum)params[0])),
- GL_INVALID_ENUM);
-
- if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) {
- ctx->override2DTextureTarget(target);
- ctx->m_glTexParameteriv_enc(ctx, GL_TEXTURE_2D, pname, params);
- ctx->restore2DTextureTarget();
- } else {
- ctx->m_glTexParameteriv_enc(ctx, target, pname, params);
- }
-}
-
-void GL2Encoder::override2DTextureTarget(GLenum target)
-{
- if ((target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) &&
- target != m_state->getPriorityEnabledTarget(GL_TEXTURE_2D)) {
- m_glBindTexture_enc(this, GL_TEXTURE_2D,
- m_state->getBoundTexture(target));
- }
-}
-
-void GL2Encoder::restore2DTextureTarget()
-{
- GLenum priorityTarget = m_state->getPriorityEnabledTarget(GL_TEXTURE_2D);
- m_glBindTexture_enc(this, GL_TEXTURE_2D,
- m_state->getBoundTexture(priorityTarget));
-}
diff --git a/tools/emulator/opengl/system/GLESv2_enc/GL2Encoder.h b/tools/emulator/opengl/system/GLESv2_enc/GL2Encoder.h
deleted file mode 100644
index f9235d747..000000000
--- a/tools/emulator/opengl/system/GLESv2_enc/GL2Encoder.h
+++ /dev/null
@@ -1,216 +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.
-*/
-#ifndef _GL2_ENCODER_H_
-#define _GL2_ENCODER_H_
-
-#include "gl2_enc.h"
-#include "GLClientState.h"
-#include "GLSharedGroup.h"
-#include "FixedBuffer.h"
-
-
-class GL2Encoder : public gl2_encoder_context_t {
-public:
- GL2Encoder(IOStream *stream);
- virtual ~GL2Encoder();
- void setClientState(GLClientState *state) {
- m_state = state;
- }
- void setSharedGroup(GLSharedGroupPtr shared){ m_shared = shared; }
- const GLClientState *state() { return m_state; }
- const GLSharedGroupPtr shared() { return m_shared; }
- void flush() { m_stream->flush(); }
-
- void setInitialized(){ m_initialized = true; };
- bool isInitialized(){ return m_initialized; };
-
- virtual void setError(GLenum error){ m_error = error; };
- virtual GLenum getError() { return m_error; };
-
- void override2DTextureTarget(GLenum target);
- void restore2DTextureTarget();
-
-private:
-
- bool m_initialized;
- GLClientState *m_state;
- GLSharedGroupPtr m_shared;
- GLenum m_error;
-
- GLint *m_compressedTextureFormats;
- GLint m_num_compressedTextureFormats;
- GLint *getCompressedTextureFormats();
-
- FixedBuffer m_fixedBuffer;
-
- void sendVertexAttributes(GLint first, GLsizei count);
- bool updateHostTexture2DBinding(GLenum texUnit, GLenum newTarget);
-
- glGetError_client_proc_t m_glGetError_enc;
- static GLenum s_glGetError(void * self);
-
- glFlush_client_proc_t m_glFlush_enc;
- static void s_glFlush(void * self);
-
- glPixelStorei_client_proc_t m_glPixelStorei_enc;
- static void s_glPixelStorei(void *self, GLenum param, GLint value);
-
- glGetString_client_proc_t m_glGetString_enc;
- static const GLubyte * s_glGetString(void *self, GLenum name);
-
- glBindBuffer_client_proc_t m_glBindBuffer_enc;
- static void s_glBindBuffer(void *self, GLenum target, GLuint id);
-
-
- glBufferData_client_proc_t m_glBufferData_enc;
- static void s_glBufferData(void *self, GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage);
- glBufferSubData_client_proc_t m_glBufferSubData_enc;
- static void s_glBufferSubData(void *self, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data);
- glDeleteBuffers_client_proc_t m_glDeleteBuffers_enc;
- static void s_glDeleteBuffers(void *self, GLsizei n, const GLuint * buffers);
-
- glDrawArrays_client_proc_t m_glDrawArrays_enc;
- static void s_glDrawArrays(void *self, GLenum mode, GLint first, GLsizei count);
-
- glDrawElements_client_proc_t m_glDrawElements_enc;
- static void s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, const void *indices);
-
-
- glGetIntegerv_client_proc_t m_glGetIntegerv_enc;
- static void s_glGetIntegerv(void *self, GLenum pname, GLint *ptr);
-
- glGetFloatv_client_proc_t m_glGetFloatv_enc;
- static void s_glGetFloatv(void *self, GLenum pname, GLfloat *ptr);
-
- glGetBooleanv_client_proc_t m_glGetBooleanv_enc;
- static void s_glGetBooleanv(void *self, GLenum pname, GLboolean *ptr);
-
- glVertexAttribPointer_client_proc_t m_glVertexAttribPointer_enc;
- static void s_glVertexAtrribPointer(void *self, GLuint indx, GLint size, GLenum type,
- GLboolean normalized, GLsizei stride, const GLvoid * ptr);
-
- glEnableVertexAttribArray_client_proc_t m_glEnableVertexAttribArray_enc;
- static void s_glEnableVertexAttribArray(void *self, GLuint index);
-
- glDisableVertexAttribArray_client_proc_t m_glDisableVertexAttribArray_enc;
- static void s_glDisableVertexAttribArray(void *self, GLuint index);
-
- glGetVertexAttribiv_client_proc_t m_glGetVertexAttribiv_enc;
- static void s_glGetVertexAttribiv(void *self, GLuint index, GLenum pname, GLint *params);
-
- glGetVertexAttribfv_client_proc_t m_glGetVertexAttribfv_enc;
- static void s_glGetVertexAttribfv(void *self, GLuint index, GLenum pname, GLfloat *params);
-
- glGetVertexAttribPointerv_client_proc_t m_glGetVertexAttribPointerv;
- static void s_glGetVertexAttribPointerv(void *self, GLuint index, GLenum pname, GLvoid **pointer);
-
- static void s_glShaderSource(void *self, GLuint shader, GLsizei count, const GLchar **string, const GLint *length);
-
- static void s_glFinish(void *self);
-
- glLinkProgram_client_proc_t m_glLinkProgram_enc;
- static void s_glLinkProgram(void *self, GLuint program);
-
- glDeleteProgram_client_proc_t m_glDeleteProgram_enc;
- static void s_glDeleteProgram(void * self, GLuint program);
-
- glGetUniformiv_client_proc_t m_glGetUniformiv_enc;
- static void s_glGetUniformiv(void *self, GLuint program, GLint location , GLint *params);
-
- glGetUniformfv_client_proc_t m_glGetUniformfv_enc;
- static void s_glGetUniformfv(void *self, GLuint program, GLint location , GLfloat *params);
-
- glCreateProgram_client_proc_t m_glCreateProgram_enc;
- static GLuint s_glCreateProgram(void *self);
-
- glCreateShader_client_proc_t m_glCreateShader_enc;
- static GLuint s_glCreateShader(void *self, GLenum shaderType);
-
- glDeleteShader_client_proc_t m_glDeleteShader_enc;
- static void s_glDeleteShader(void *self, GLuint shader);
-
- glAttachShader_client_proc_t m_glAttachShader_enc;
- static void s_glAttachShader(void *self, GLuint program, GLuint shader);
-
- glDetachShader_client_proc_t m_glDetachShader_enc;
- static void s_glDetachShader(void *self, GLuint program, GLuint shader);
-
- glGetUniformLocation_client_proc_t m_glGetUniformLocation_enc;
- static int s_glGetUniformLocation(void *self, GLuint program, const GLchar *name);
- glUseProgram_client_proc_t m_glUseProgram_enc;
-
- glUniform1f_client_proc_t m_glUniform1f_enc;
- glUniform1fv_client_proc_t m_glUniform1fv_enc;
- glUniform1i_client_proc_t m_glUniform1i_enc;
- glUniform1iv_client_proc_t m_glUniform1iv_enc;
- glUniform2f_client_proc_t m_glUniform2f_enc;
- glUniform2fv_client_proc_t m_glUniform2fv_enc;
- glUniform2i_client_proc_t m_glUniform2i_enc;
- glUniform2iv_client_proc_t m_glUniform2iv_enc;
- glUniform3f_client_proc_t m_glUniform3f_enc;
- glUniform3fv_client_proc_t m_glUniform3fv_enc;
- glUniform3i_client_proc_t m_glUniform3i_enc;
- glUniform3iv_client_proc_t m_glUniform3iv_enc;
- glUniform4f_client_proc_t m_glUniform4f_enc;
- glUniform4fv_client_proc_t m_glUniform4fv_enc;
- glUniform4i_client_proc_t m_glUniform4i_enc;
- glUniform4iv_client_proc_t m_glUniform4iv_enc;
- glUniformMatrix2fv_client_proc_t m_glUniformMatrix2fv_enc;
- glUniformMatrix3fv_client_proc_t m_glUniformMatrix3fv_enc;
- glUniformMatrix4fv_client_proc_t m_glUniformMatrix4fv_enc;
-
- static void s_glUseProgram(void *self, GLuint program);
- static void s_glUniform1f(void *self , GLint location, GLfloat x);
- static void s_glUniform1fv(void *self , GLint location, GLsizei count, const GLfloat* v);
- static void s_glUniform1i(void *self , GLint location, GLint x);
- static void s_glUniform1iv(void *self , GLint location, GLsizei count, const GLint* v);
- static void s_glUniform2f(void *self , GLint location, GLfloat x, GLfloat y);
- static void s_glUniform2fv(void *self , GLint location, GLsizei count, const GLfloat* v);
- static void s_glUniform2i(void *self , GLint location, GLint x, GLint y);
- static void s_glUniform2iv(void *self , GLint location, GLsizei count, const GLint* v);
- static void s_glUniform3f(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z);
- static void s_glUniform3fv(void *self , GLint location, GLsizei count, const GLfloat* v);
- static void s_glUniform3i(void *self , GLint location, GLint x, GLint y, GLint z);
- static void s_glUniform3iv(void *self , GLint location, GLsizei count, const GLint* v);
- static void s_glUniform4f(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- static void s_glUniform4fv(void *self , GLint location, GLsizei count, const GLfloat* v);
- static void s_glUniform4i(void *self , GLint location, GLint x, GLint y, GLint z, GLint w);
- static void s_glUniform4iv(void *self , GLint location, GLsizei count, const GLint* v);
- static void s_glUniformMatrix2fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- static void s_glUniformMatrix3fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- static void s_glUniformMatrix4fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-
- glActiveTexture_client_proc_t m_glActiveTexture_enc;
- glBindTexture_client_proc_t m_glBindTexture_enc;
- glDeleteTextures_client_proc_t m_glDeleteTextures_enc;
- glGetTexParameterfv_client_proc_t m_glGetTexParameterfv_enc;
- glGetTexParameteriv_client_proc_t m_glGetTexParameteriv_enc;
- glTexParameterf_client_proc_t m_glTexParameterf_enc;
- glTexParameterfv_client_proc_t m_glTexParameterfv_enc;
- glTexParameteri_client_proc_t m_glTexParameteri_enc;
- glTexParameteriv_client_proc_t m_glTexParameteriv_enc;
-
- static void s_glActiveTexture(void* self, GLenum texture);
- static void s_glBindTexture(void* self, GLenum target, GLuint texture);
- static void s_glDeleteTextures(void* self, GLsizei n, const GLuint* textures);
- static void s_glGetTexParameterfv(void* self, GLenum target, GLenum pname, GLfloat* params);
- static void s_glGetTexParameteriv(void* self, GLenum target, GLenum pname, GLint* params);
- static void s_glTexParameterf(void* self, GLenum target, GLenum pname, GLfloat param);
- static void s_glTexParameterfv(void* self, GLenum target, GLenum pname, const GLfloat* params);
- static void s_glTexParameteri(void* self, GLenum target, GLenum pname, GLint param);
- static void s_glTexParameteriv(void* self, GLenum target, GLenum pname, const GLint* params);
-};
-#endif
diff --git a/tools/emulator/opengl/system/GLESv2_enc/GL2EncoderUtils.cpp b/tools/emulator/opengl/system/GLESv2_enc/GL2EncoderUtils.cpp
deleted file mode 100644
index 57d65c092..000000000
--- a/tools/emulator/opengl/system/GLESv2_enc/GL2EncoderUtils.cpp
+++ /dev/null
@@ -1,39 +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.
-*/
-#include <stdio.h>
-#include <stdlib.h>
-#include "GL2Encoder.h"
-#include <assert.h>
-
-size_t pixelDataSize(void *self, GLsizei width, GLsizei height, GLenum format, GLenum type, int pack)
-{
- GL2Encoder *ctx = (GL2Encoder *)self;
- assert (ctx->state() != NULL);
- return ctx->state()->pixelDataSize(width, height, format, type, pack);
-}
-
-size_t pixelDataSize3D(void *self, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, int pack)
-{
- size_t layerSize = pixelDataSize(self, width, height, format, type, pack);
- return layerSize * depth;
-}
-
-GLenum uniformType(void * self, GLuint program, GLint location)
-{
- GL2Encoder * ctx = (GL2Encoder *) self;
- assert (ctx->shared() != NULL);
- return ctx->shared()->getProgramUniformType(program, location);
-}
diff --git a/tools/emulator/opengl/system/GLESv2_enc/GL2EncoderUtils.h b/tools/emulator/opengl/system/GLESv2_enc/GL2EncoderUtils.h
deleted file mode 100644
index 8e91aeb14..000000000
--- a/tools/emulator/opengl/system/GLESv2_enc/GL2EncoderUtils.h
+++ /dev/null
@@ -1,24 +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.
-*/
-#ifndef GL2_ENCODER_UTILS_H
-#define GL2_ENCLODER_UTILS_H
-
-extern "C" {
- size_t pixelDataSize(void *self, GLsizei width, GLsizei height, GLenum format, GLenum type, int pack);
- size_t pixelDataSize3D(void *self, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, int pack);
- GLenum uniformType(void * self, GLuint program, GLint location);
-};
-#endif
diff --git a/tools/emulator/opengl/system/GLESv2_enc/gl2_client_context.cpp b/tools/emulator/opengl/system/GLESv2_enc/gl2_client_context.cpp
deleted file mode 100644
index e4e08b215..000000000
--- a/tools/emulator/opengl/system/GLESv2_enc/gl2_client_context.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-
-
-#include <string.h>
-#include "gl2_client_context.h"
-
-
-#include <stdio.h>
-
-int gl2_client_context_t::initDispatchByName(void *(*getProc)(const char *, void *userData), void *userData)
-{
- void *ptr;
-
- ptr = getProc("glActiveTexture", userData); set_glActiveTexture((glActiveTexture_client_proc_t)ptr);
- ptr = getProc("glAttachShader", userData); set_glAttachShader((glAttachShader_client_proc_t)ptr);
- ptr = getProc("glBindAttribLocation", userData); set_glBindAttribLocation((glBindAttribLocation_client_proc_t)ptr);
- ptr = getProc("glBindBuffer", userData); set_glBindBuffer((glBindBuffer_client_proc_t)ptr);
- ptr = getProc("glBindFramebuffer", userData); set_glBindFramebuffer((glBindFramebuffer_client_proc_t)ptr);
- ptr = getProc("glBindRenderbuffer", userData); set_glBindRenderbuffer((glBindRenderbuffer_client_proc_t)ptr);
- ptr = getProc("glBindTexture", userData); set_glBindTexture((glBindTexture_client_proc_t)ptr);
- ptr = getProc("glBlendColor", userData); set_glBlendColor((glBlendColor_client_proc_t)ptr);
- ptr = getProc("glBlendEquation", userData); set_glBlendEquation((glBlendEquation_client_proc_t)ptr);
- ptr = getProc("glBlendEquationSeparate", userData); set_glBlendEquationSeparate((glBlendEquationSeparate_client_proc_t)ptr);
- ptr = getProc("glBlendFunc", userData); set_glBlendFunc((glBlendFunc_client_proc_t)ptr);
- ptr = getProc("glBlendFuncSeparate", userData); set_glBlendFuncSeparate((glBlendFuncSeparate_client_proc_t)ptr);
- ptr = getProc("glBufferData", userData); set_glBufferData((glBufferData_client_proc_t)ptr);
- ptr = getProc("glBufferSubData", userData); set_glBufferSubData((glBufferSubData_client_proc_t)ptr);
- ptr = getProc("glCheckFramebufferStatus", userData); set_glCheckFramebufferStatus((glCheckFramebufferStatus_client_proc_t)ptr);
- ptr = getProc("glClear", userData); set_glClear((glClear_client_proc_t)ptr);
- ptr = getProc("glClearColor", userData); set_glClearColor((glClearColor_client_proc_t)ptr);
- ptr = getProc("glClearDepthf", userData); set_glClearDepthf((glClearDepthf_client_proc_t)ptr);
- ptr = getProc("glClearStencil", userData); set_glClearStencil((glClearStencil_client_proc_t)ptr);
- ptr = getProc("glColorMask", userData); set_glColorMask((glColorMask_client_proc_t)ptr);
- ptr = getProc("glCompileShader", userData); set_glCompileShader((glCompileShader_client_proc_t)ptr);
- ptr = getProc("glCompressedTexImage2D", userData); set_glCompressedTexImage2D((glCompressedTexImage2D_client_proc_t)ptr);
- ptr = getProc("glCompressedTexSubImage2D", userData); set_glCompressedTexSubImage2D((glCompressedTexSubImage2D_client_proc_t)ptr);
- ptr = getProc("glCopyTexImage2D", userData); set_glCopyTexImage2D((glCopyTexImage2D_client_proc_t)ptr);
- ptr = getProc("glCopyTexSubImage2D", userData); set_glCopyTexSubImage2D((glCopyTexSubImage2D_client_proc_t)ptr);
- ptr = getProc("glCreateProgram", userData); set_glCreateProgram((glCreateProgram_client_proc_t)ptr);
- ptr = getProc("glCreateShader", userData); set_glCreateShader((glCreateShader_client_proc_t)ptr);
- ptr = getProc("glCullFace", userData); set_glCullFace((glCullFace_client_proc_t)ptr);
- ptr = getProc("glDeleteBuffers", userData); set_glDeleteBuffers((glDeleteBuffers_client_proc_t)ptr);
- ptr = getProc("glDeleteFramebuffers", userData); set_glDeleteFramebuffers((glDeleteFramebuffers_client_proc_t)ptr);
- ptr = getProc("glDeleteProgram", userData); set_glDeleteProgram((glDeleteProgram_client_proc_t)ptr);
- ptr = getProc("glDeleteRenderbuffers", userData); set_glDeleteRenderbuffers((glDeleteRenderbuffers_client_proc_t)ptr);
- ptr = getProc("glDeleteShader", userData); set_glDeleteShader((glDeleteShader_client_proc_t)ptr);
- ptr = getProc("glDeleteTextures", userData); set_glDeleteTextures((glDeleteTextures_client_proc_t)ptr);
- ptr = getProc("glDepthFunc", userData); set_glDepthFunc((glDepthFunc_client_proc_t)ptr);
- ptr = getProc("glDepthMask", userData); set_glDepthMask((glDepthMask_client_proc_t)ptr);
- ptr = getProc("glDepthRangef", userData); set_glDepthRangef((glDepthRangef_client_proc_t)ptr);
- ptr = getProc("glDetachShader", userData); set_glDetachShader((glDetachShader_client_proc_t)ptr);
- ptr = getProc("glDisable", userData); set_glDisable((glDisable_client_proc_t)ptr);
- ptr = getProc("glDisableVertexAttribArray", userData); set_glDisableVertexAttribArray((glDisableVertexAttribArray_client_proc_t)ptr);
- ptr = getProc("glDrawArrays", userData); set_glDrawArrays((glDrawArrays_client_proc_t)ptr);
- ptr = getProc("glDrawElements", userData); set_glDrawElements((glDrawElements_client_proc_t)ptr);
- ptr = getProc("glEnable", userData); set_glEnable((glEnable_client_proc_t)ptr);
- ptr = getProc("glEnableVertexAttribArray", userData); set_glEnableVertexAttribArray((glEnableVertexAttribArray_client_proc_t)ptr);
- ptr = getProc("glFinish", userData); set_glFinish((glFinish_client_proc_t)ptr);
- ptr = getProc("glFlush", userData); set_glFlush((glFlush_client_proc_t)ptr);
- ptr = getProc("glFramebufferRenderbuffer", userData); set_glFramebufferRenderbuffer((glFramebufferRenderbuffer_client_proc_t)ptr);
- ptr = getProc("glFramebufferTexture2D", userData); set_glFramebufferTexture2D((glFramebufferTexture2D_client_proc_t)ptr);
- ptr = getProc("glFrontFace", userData); set_glFrontFace((glFrontFace_client_proc_t)ptr);
- ptr = getProc("glGenBuffers", userData); set_glGenBuffers((glGenBuffers_client_proc_t)ptr);
- ptr = getProc("glGenerateMipmap", userData); set_glGenerateMipmap((glGenerateMipmap_client_proc_t)ptr);
- ptr = getProc("glGenFramebuffers", userData); set_glGenFramebuffers((glGenFramebuffers_client_proc_t)ptr);
- ptr = getProc("glGenRenderbuffers", userData); set_glGenRenderbuffers((glGenRenderbuffers_client_proc_t)ptr);
- ptr = getProc("glGenTextures", userData); set_glGenTextures((glGenTextures_client_proc_t)ptr);
- ptr = getProc("glGetActiveAttrib", userData); set_glGetActiveAttrib((glGetActiveAttrib_client_proc_t)ptr);
- ptr = getProc("glGetActiveUniform", userData); set_glGetActiveUniform((glGetActiveUniform_client_proc_t)ptr);
- ptr = getProc("glGetAttachedShaders", userData); set_glGetAttachedShaders((glGetAttachedShaders_client_proc_t)ptr);
- ptr = getProc("glGetAttribLocation", userData); set_glGetAttribLocation((glGetAttribLocation_client_proc_t)ptr);
- ptr = getProc("glGetBooleanv", userData); set_glGetBooleanv((glGetBooleanv_client_proc_t)ptr);
- ptr = getProc("glGetBufferParameteriv", userData); set_glGetBufferParameteriv((glGetBufferParameteriv_client_proc_t)ptr);
- ptr = getProc("glGetError", userData); set_glGetError((glGetError_client_proc_t)ptr);
- ptr = getProc("glGetFloatv", userData); set_glGetFloatv((glGetFloatv_client_proc_t)ptr);
- ptr = getProc("glGetFramebufferAttachmentParameteriv", userData); set_glGetFramebufferAttachmentParameteriv((glGetFramebufferAttachmentParameteriv_client_proc_t)ptr);
- ptr = getProc("glGetIntegerv", userData); set_glGetIntegerv((glGetIntegerv_client_proc_t)ptr);
- ptr = getProc("glGetProgramiv", userData); set_glGetProgramiv((glGetProgramiv_client_proc_t)ptr);
- ptr = getProc("glGetProgramInfoLog", userData); set_glGetProgramInfoLog((glGetProgramInfoLog_client_proc_t)ptr);
- ptr = getProc("glGetRenderbufferParameteriv", userData); set_glGetRenderbufferParameteriv((glGetRenderbufferParameteriv_client_proc_t)ptr);
- ptr = getProc("glGetShaderiv", userData); set_glGetShaderiv((glGetShaderiv_client_proc_t)ptr);
- ptr = getProc("glGetShaderInfoLog", userData); set_glGetShaderInfoLog((glGetShaderInfoLog_client_proc_t)ptr);
- ptr = getProc("glGetShaderPrecisionFormat", userData); set_glGetShaderPrecisionFormat((glGetShaderPrecisionFormat_client_proc_t)ptr);
- ptr = getProc("glGetShaderSource", userData); set_glGetShaderSource((glGetShaderSource_client_proc_t)ptr);
- ptr = getProc("glGetString", userData); set_glGetString((glGetString_client_proc_t)ptr);
- ptr = getProc("glGetTexParameterfv", userData); set_glGetTexParameterfv((glGetTexParameterfv_client_proc_t)ptr);
- ptr = getProc("glGetTexParameteriv", userData); set_glGetTexParameteriv((glGetTexParameteriv_client_proc_t)ptr);
- ptr = getProc("glGetUniformfv", userData); set_glGetUniformfv((glGetUniformfv_client_proc_t)ptr);
- ptr = getProc("glGetUniformiv", userData); set_glGetUniformiv((glGetUniformiv_client_proc_t)ptr);
- ptr = getProc("glGetUniformLocation", userData); set_glGetUniformLocation((glGetUniformLocation_client_proc_t)ptr);
- ptr = getProc("glGetVertexAttribfv", userData); set_glGetVertexAttribfv((glGetVertexAttribfv_client_proc_t)ptr);
- ptr = getProc("glGetVertexAttribiv", userData); set_glGetVertexAttribiv((glGetVertexAttribiv_client_proc_t)ptr);
- ptr = getProc("glGetVertexAttribPointerv", userData); set_glGetVertexAttribPointerv((glGetVertexAttribPointerv_client_proc_t)ptr);
- ptr = getProc("glHint", userData); set_glHint((glHint_client_proc_t)ptr);
- ptr = getProc("glIsBuffer", userData); set_glIsBuffer((glIsBuffer_client_proc_t)ptr);
- ptr = getProc("glIsEnabled", userData); set_glIsEnabled((glIsEnabled_client_proc_t)ptr);
- ptr = getProc("glIsFramebuffer", userData); set_glIsFramebuffer((glIsFramebuffer_client_proc_t)ptr);
- ptr = getProc("glIsProgram", userData); set_glIsProgram((glIsProgram_client_proc_t)ptr);
- ptr = getProc("glIsRenderbuffer", userData); set_glIsRenderbuffer((glIsRenderbuffer_client_proc_t)ptr);
- ptr = getProc("glIsShader", userData); set_glIsShader((glIsShader_client_proc_t)ptr);
- ptr = getProc("glIsTexture", userData); set_glIsTexture((glIsTexture_client_proc_t)ptr);
- ptr = getProc("glLineWidth", userData); set_glLineWidth((glLineWidth_client_proc_t)ptr);
- ptr = getProc("glLinkProgram", userData); set_glLinkProgram((glLinkProgram_client_proc_t)ptr);
- ptr = getProc("glPixelStorei", userData); set_glPixelStorei((glPixelStorei_client_proc_t)ptr);
- ptr = getProc("glPolygonOffset", userData); set_glPolygonOffset((glPolygonOffset_client_proc_t)ptr);
- ptr = getProc("glReadPixels", userData); set_glReadPixels((glReadPixels_client_proc_t)ptr);
- ptr = getProc("glReleaseShaderCompiler", userData); set_glReleaseShaderCompiler((glReleaseShaderCompiler_client_proc_t)ptr);
- ptr = getProc("glRenderbufferStorage", userData); set_glRenderbufferStorage((glRenderbufferStorage_client_proc_t)ptr);
- ptr = getProc("glSampleCoverage", userData); set_glSampleCoverage((glSampleCoverage_client_proc_t)ptr);
- ptr = getProc("glScissor", userData); set_glScissor((glScissor_client_proc_t)ptr);
- ptr = getProc("glShaderBinary", userData); set_glShaderBinary((glShaderBinary_client_proc_t)ptr);
- ptr = getProc("glShaderSource", userData); set_glShaderSource((glShaderSource_client_proc_t)ptr);
- ptr = getProc("glStencilFunc", userData); set_glStencilFunc((glStencilFunc_client_proc_t)ptr);
- ptr = getProc("glStencilFuncSeparate", userData); set_glStencilFuncSeparate((glStencilFuncSeparate_client_proc_t)ptr);
- ptr = getProc("glStencilMask", userData); set_glStencilMask((glStencilMask_client_proc_t)ptr);
- ptr = getProc("glStencilMaskSeparate", userData); set_glStencilMaskSeparate((glStencilMaskSeparate_client_proc_t)ptr);
- ptr = getProc("glStencilOp", userData); set_glStencilOp((glStencilOp_client_proc_t)ptr);
- ptr = getProc("glStencilOpSeparate", userData); set_glStencilOpSeparate((glStencilOpSeparate_client_proc_t)ptr);
- ptr = getProc("glTexImage2D", userData); set_glTexImage2D((glTexImage2D_client_proc_t)ptr);
- ptr = getProc("glTexParameterf", userData); set_glTexParameterf((glTexParameterf_client_proc_t)ptr);
- ptr = getProc("glTexParameterfv", userData); set_glTexParameterfv((glTexParameterfv_client_proc_t)ptr);
- ptr = getProc("glTexParameteri", userData); set_glTexParameteri((glTexParameteri_client_proc_t)ptr);
- ptr = getProc("glTexParameteriv", userData); set_glTexParameteriv((glTexParameteriv_client_proc_t)ptr);
- ptr = getProc("glTexSubImage2D", userData); set_glTexSubImage2D((glTexSubImage2D_client_proc_t)ptr);
- ptr = getProc("glUniform1f", userData); set_glUniform1f((glUniform1f_client_proc_t)ptr);
- ptr = getProc("glUniform1fv", userData); set_glUniform1fv((glUniform1fv_client_proc_t)ptr);
- ptr = getProc("glUniform1i", userData); set_glUniform1i((glUniform1i_client_proc_t)ptr);
- ptr = getProc("glUniform1iv", userData); set_glUniform1iv((glUniform1iv_client_proc_t)ptr);
- ptr = getProc("glUniform2f", userData); set_glUniform2f((glUniform2f_client_proc_t)ptr);
- ptr = getProc("glUniform2fv", userData); set_glUniform2fv((glUniform2fv_client_proc_t)ptr);
- ptr = getProc("glUniform2i", userData); set_glUniform2i((glUniform2i_client_proc_t)ptr);
- ptr = getProc("glUniform2iv", userData); set_glUniform2iv((glUniform2iv_client_proc_t)ptr);
- ptr = getProc("glUniform3f", userData); set_glUniform3f((glUniform3f_client_proc_t)ptr);
- ptr = getProc("glUniform3fv", userData); set_glUniform3fv((glUniform3fv_client_proc_t)ptr);
- ptr = getProc("glUniform3i", userData); set_glUniform3i((glUniform3i_client_proc_t)ptr);
- ptr = getProc("glUniform3iv", userData); set_glUniform3iv((glUniform3iv_client_proc_t)ptr);
- ptr = getProc("glUniform4f", userData); set_glUniform4f((glUniform4f_client_proc_t)ptr);
- ptr = getProc("glUniform4fv", userData); set_glUniform4fv((glUniform4fv_client_proc_t)ptr);
- ptr = getProc("glUniform4i", userData); set_glUniform4i((glUniform4i_client_proc_t)ptr);
- ptr = getProc("glUniform4iv", userData); set_glUniform4iv((glUniform4iv_client_proc_t)ptr);
- ptr = getProc("glUniformMatrix2fv", userData); set_glUniformMatrix2fv((glUniformMatrix2fv_client_proc_t)ptr);
- ptr = getProc("glUniformMatrix3fv", userData); set_glUniformMatrix3fv((glUniformMatrix3fv_client_proc_t)ptr);
- ptr = getProc("glUniformMatrix4fv", userData); set_glUniformMatrix4fv((glUniformMatrix4fv_client_proc_t)ptr);
- ptr = getProc("glUseProgram", userData); set_glUseProgram((glUseProgram_client_proc_t)ptr);
- ptr = getProc("glValidateProgram", userData); set_glValidateProgram((glValidateProgram_client_proc_t)ptr);
- ptr = getProc("glVertexAttrib1f", userData); set_glVertexAttrib1f((glVertexAttrib1f_client_proc_t)ptr);
- ptr = getProc("glVertexAttrib1fv", userData); set_glVertexAttrib1fv((glVertexAttrib1fv_client_proc_t)ptr);
- ptr = getProc("glVertexAttrib2f", userData); set_glVertexAttrib2f((glVertexAttrib2f_client_proc_t)ptr);
- ptr = getProc("glVertexAttrib2fv", userData); set_glVertexAttrib2fv((glVertexAttrib2fv_client_proc_t)ptr);
- ptr = getProc("glVertexAttrib3f", userData); set_glVertexAttrib3f((glVertexAttrib3f_client_proc_t)ptr);
- ptr = getProc("glVertexAttrib3fv", userData); set_glVertexAttrib3fv((glVertexAttrib3fv_client_proc_t)ptr);
- ptr = getProc("glVertexAttrib4f", userData); set_glVertexAttrib4f((glVertexAttrib4f_client_proc_t)ptr);
- ptr = getProc("glVertexAttrib4fv", userData); set_glVertexAttrib4fv((glVertexAttrib4fv_client_proc_t)ptr);
- ptr = getProc("glVertexAttribPointer", userData); set_glVertexAttribPointer((glVertexAttribPointer_client_proc_t)ptr);
- ptr = getProc("glViewport", userData); set_glViewport((glViewport_client_proc_t)ptr);
- ptr = getProc("glEGLImageTargetTexture2DOES", userData); set_glEGLImageTargetTexture2DOES((glEGLImageTargetTexture2DOES_client_proc_t)ptr);
- ptr = getProc("glEGLImageTargetRenderbufferStorageOES", userData); set_glEGLImageTargetRenderbufferStorageOES((glEGLImageTargetRenderbufferStorageOES_client_proc_t)ptr);
- ptr = getProc("glGetProgramBinaryOES", userData); set_glGetProgramBinaryOES((glGetProgramBinaryOES_client_proc_t)ptr);
- ptr = getProc("glProgramBinaryOES", userData); set_glProgramBinaryOES((glProgramBinaryOES_client_proc_t)ptr);
- ptr = getProc("glMapBufferOES", userData); set_glMapBufferOES((glMapBufferOES_client_proc_t)ptr);
- ptr = getProc("glUnmapBufferOES", userData); set_glUnmapBufferOES((glUnmapBufferOES_client_proc_t)ptr);
- ptr = getProc("glTexImage3DOES", userData); set_glTexImage3DOES((glTexImage3DOES_client_proc_t)ptr);
- ptr = getProc("glTexSubImage3DOES", userData); set_glTexSubImage3DOES((glTexSubImage3DOES_client_proc_t)ptr);
- ptr = getProc("glCopyTexSubImage3DOES", userData); set_glCopyTexSubImage3DOES((glCopyTexSubImage3DOES_client_proc_t)ptr);
- ptr = getProc("glCompressedTexImage3DOES", userData); set_glCompressedTexImage3DOES((glCompressedTexImage3DOES_client_proc_t)ptr);
- ptr = getProc("glCompressedTexSubImage3DOES", userData); set_glCompressedTexSubImage3DOES((glCompressedTexSubImage3DOES_client_proc_t)ptr);
- ptr = getProc("glFramebufferTexture3DOES", userData); set_glFramebufferTexture3DOES((glFramebufferTexture3DOES_client_proc_t)ptr);
- ptr = getProc("glBindVertexArrayOES", userData); set_glBindVertexArrayOES((glBindVertexArrayOES_client_proc_t)ptr);
- ptr = getProc("glDeleteVertexArraysOES", userData); set_glDeleteVertexArraysOES((glDeleteVertexArraysOES_client_proc_t)ptr);
- ptr = getProc("glGenVertexArraysOES", userData); set_glGenVertexArraysOES((glGenVertexArraysOES_client_proc_t)ptr);
- ptr = getProc("glIsVertexArrayOES", userData); set_glIsVertexArrayOES((glIsVertexArrayOES_client_proc_t)ptr);
- ptr = getProc("glDiscardFramebufferEXT", userData); set_glDiscardFramebufferEXT((glDiscardFramebufferEXT_client_proc_t)ptr);
- ptr = getProc("glMultiDrawArraysEXT", userData); set_glMultiDrawArraysEXT((glMultiDrawArraysEXT_client_proc_t)ptr);
- ptr = getProc("glMultiDrawElementsEXT", userData); set_glMultiDrawElementsEXT((glMultiDrawElementsEXT_client_proc_t)ptr);
- ptr = getProc("glGetPerfMonitorGroupsAMD", userData); set_glGetPerfMonitorGroupsAMD((glGetPerfMonitorGroupsAMD_client_proc_t)ptr);
- ptr = getProc("glGetPerfMonitorCountersAMD", userData); set_glGetPerfMonitorCountersAMD((glGetPerfMonitorCountersAMD_client_proc_t)ptr);
- ptr = getProc("glGetPerfMonitorGroupStringAMD", userData); set_glGetPerfMonitorGroupStringAMD((glGetPerfMonitorGroupStringAMD_client_proc_t)ptr);
- ptr = getProc("glGetPerfMonitorCounterStringAMD", userData); set_glGetPerfMonitorCounterStringAMD((glGetPerfMonitorCounterStringAMD_client_proc_t)ptr);
- ptr = getProc("glGetPerfMonitorCounterInfoAMD", userData); set_glGetPerfMonitorCounterInfoAMD((glGetPerfMonitorCounterInfoAMD_client_proc_t)ptr);
- ptr = getProc("glGenPerfMonitorsAMD", userData); set_glGenPerfMonitorsAMD((glGenPerfMonitorsAMD_client_proc_t)ptr);
- ptr = getProc("glDeletePerfMonitorsAMD", userData); set_glDeletePerfMonitorsAMD((glDeletePerfMonitorsAMD_client_proc_t)ptr);
- ptr = getProc("glSelectPerfMonitorCountersAMD", userData); set_glSelectPerfMonitorCountersAMD((glSelectPerfMonitorCountersAMD_client_proc_t)ptr);
- ptr = getProc("glBeginPerfMonitorAMD", userData); set_glBeginPerfMonitorAMD((glBeginPerfMonitorAMD_client_proc_t)ptr);
- ptr = getProc("glEndPerfMonitorAMD", userData); set_glEndPerfMonitorAMD((glEndPerfMonitorAMD_client_proc_t)ptr);
- ptr = getProc("glGetPerfMonitorCounterDataAMD", userData); set_glGetPerfMonitorCounterDataAMD((glGetPerfMonitorCounterDataAMD_client_proc_t)ptr);
- ptr = getProc("glRenderbufferStorageMultisampleIMG", userData); set_glRenderbufferStorageMultisampleIMG((glRenderbufferStorageMultisampleIMG_client_proc_t)ptr);
- ptr = getProc("glFramebufferTexture2DMultisampleIMG", userData); set_glFramebufferTexture2DMultisampleIMG((glFramebufferTexture2DMultisampleIMG_client_proc_t)ptr);
- ptr = getProc("glDeleteFencesNV", userData); set_glDeleteFencesNV((glDeleteFencesNV_client_proc_t)ptr);
- ptr = getProc("glGenFencesNV", userData); set_glGenFencesNV((glGenFencesNV_client_proc_t)ptr);
- ptr = getProc("glIsFenceNV", userData); set_glIsFenceNV((glIsFenceNV_client_proc_t)ptr);
- ptr = getProc("glTestFenceNV", userData); set_glTestFenceNV((glTestFenceNV_client_proc_t)ptr);
- ptr = getProc("glGetFenceivNV", userData); set_glGetFenceivNV((glGetFenceivNV_client_proc_t)ptr);
- ptr = getProc("glFinishFenceNV", userData); set_glFinishFenceNV((glFinishFenceNV_client_proc_t)ptr);
- ptr = getProc("glSetFenceNV", userData); set_glSetFenceNV((glSetFenceNV_client_proc_t)ptr);
- ptr = getProc("glCoverageMaskNV", userData); set_glCoverageMaskNV((glCoverageMaskNV_client_proc_t)ptr);
- ptr = getProc("glCoverageOperationNV", userData); set_glCoverageOperationNV((glCoverageOperationNV_client_proc_t)ptr);
- ptr = getProc("glGetDriverControlsQCOM", userData); set_glGetDriverControlsQCOM((glGetDriverControlsQCOM_client_proc_t)ptr);
- ptr = getProc("glGetDriverControlStringQCOM", userData); set_glGetDriverControlStringQCOM((glGetDriverControlStringQCOM_client_proc_t)ptr);
- ptr = getProc("glEnableDriverControlQCOM", userData); set_glEnableDriverControlQCOM((glEnableDriverControlQCOM_client_proc_t)ptr);
- ptr = getProc("glDisableDriverControlQCOM", userData); set_glDisableDriverControlQCOM((glDisableDriverControlQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetTexturesQCOM", userData); set_glExtGetTexturesQCOM((glExtGetTexturesQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetBuffersQCOM", userData); set_glExtGetBuffersQCOM((glExtGetBuffersQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetRenderbuffersQCOM", userData); set_glExtGetRenderbuffersQCOM((glExtGetRenderbuffersQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetFramebuffersQCOM", userData); set_glExtGetFramebuffersQCOM((glExtGetFramebuffersQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetTexLevelParameterivQCOM", userData); set_glExtGetTexLevelParameterivQCOM((glExtGetTexLevelParameterivQCOM_client_proc_t)ptr);
- ptr = getProc("glExtTexObjectStateOverrideiQCOM", userData); set_glExtTexObjectStateOverrideiQCOM((glExtTexObjectStateOverrideiQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetTexSubImageQCOM", userData); set_glExtGetTexSubImageQCOM((glExtGetTexSubImageQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetBufferPointervQCOM", userData); set_glExtGetBufferPointervQCOM((glExtGetBufferPointervQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetShadersQCOM", userData); set_glExtGetShadersQCOM((glExtGetShadersQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetProgramsQCOM", userData); set_glExtGetProgramsQCOM((glExtGetProgramsQCOM_client_proc_t)ptr);
- ptr = getProc("glExtIsProgramBinaryQCOM", userData); set_glExtIsProgramBinaryQCOM((glExtIsProgramBinaryQCOM_client_proc_t)ptr);
- ptr = getProc("glExtGetProgramBinarySourceQCOM", userData); set_glExtGetProgramBinarySourceQCOM((glExtGetProgramBinarySourceQCOM_client_proc_t)ptr);
- ptr = getProc("glStartTilingQCOM", userData); set_glStartTilingQCOM((glStartTilingQCOM_client_proc_t)ptr);
- ptr = getProc("glEndTilingQCOM", userData); set_glEndTilingQCOM((glEndTilingQCOM_client_proc_t)ptr);
- ptr = getProc("glVertexAttribPointerData", userData); set_glVertexAttribPointerData((glVertexAttribPointerData_client_proc_t)ptr);
- ptr = getProc("glVertexAttribPointerOffset", userData); set_glVertexAttribPointerOffset((glVertexAttribPointerOffset_client_proc_t)ptr);
- ptr = getProc("glDrawElementsOffset", userData); set_glDrawElementsOffset((glDrawElementsOffset_client_proc_t)ptr);
- ptr = getProc("glDrawElementsData", userData); set_glDrawElementsData((glDrawElementsData_client_proc_t)ptr);
- ptr = getProc("glGetCompressedTextureFormats", userData); set_glGetCompressedTextureFormats((glGetCompressedTextureFormats_client_proc_t)ptr);
- ptr = getProc("glShaderString", userData); set_glShaderString((glShaderString_client_proc_t)ptr);
- ptr = getProc("glFinishRoundTrip", userData); set_glFinishRoundTrip((glFinishRoundTrip_client_proc_t)ptr);
- return 0;
-}
-
diff --git a/tools/emulator/opengl/system/GLESv2_enc/gl2_client_context.h b/tools/emulator/opengl/system/GLESv2_enc/gl2_client_context.h
deleted file mode 100644
index 7f0abcdef..000000000
--- a/tools/emulator/opengl/system/GLESv2_enc/gl2_client_context.h
+++ /dev/null
@@ -1,437 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-#ifndef __gl2_client_context_t_h
-#define __gl2_client_context_t_h
-
-#include "gl2_client_proc.h"
-
-
-struct gl2_client_context_t {
-
- glActiveTexture_client_proc_t glActiveTexture;
- glAttachShader_client_proc_t glAttachShader;
- glBindAttribLocation_client_proc_t glBindAttribLocation;
- glBindBuffer_client_proc_t glBindBuffer;
- glBindFramebuffer_client_proc_t glBindFramebuffer;
- glBindRenderbuffer_client_proc_t glBindRenderbuffer;
- glBindTexture_client_proc_t glBindTexture;
- glBlendColor_client_proc_t glBlendColor;
- glBlendEquation_client_proc_t glBlendEquation;
- glBlendEquationSeparate_client_proc_t glBlendEquationSeparate;
- glBlendFunc_client_proc_t glBlendFunc;
- glBlendFuncSeparate_client_proc_t glBlendFuncSeparate;
- glBufferData_client_proc_t glBufferData;
- glBufferSubData_client_proc_t glBufferSubData;
- glCheckFramebufferStatus_client_proc_t glCheckFramebufferStatus;
- glClear_client_proc_t glClear;
- glClearColor_client_proc_t glClearColor;
- glClearDepthf_client_proc_t glClearDepthf;
- glClearStencil_client_proc_t glClearStencil;
- glColorMask_client_proc_t glColorMask;
- glCompileShader_client_proc_t glCompileShader;
- glCompressedTexImage2D_client_proc_t glCompressedTexImage2D;
- glCompressedTexSubImage2D_client_proc_t glCompressedTexSubImage2D;
- glCopyTexImage2D_client_proc_t glCopyTexImage2D;
- glCopyTexSubImage2D_client_proc_t glCopyTexSubImage2D;
- glCreateProgram_client_proc_t glCreateProgram;
- glCreateShader_client_proc_t glCreateShader;
- glCullFace_client_proc_t glCullFace;
- glDeleteBuffers_client_proc_t glDeleteBuffers;
- glDeleteFramebuffers_client_proc_t glDeleteFramebuffers;
- glDeleteProgram_client_proc_t glDeleteProgram;
- glDeleteRenderbuffers_client_proc_t glDeleteRenderbuffers;
- glDeleteShader_client_proc_t glDeleteShader;
- glDeleteTextures_client_proc_t glDeleteTextures;
- glDepthFunc_client_proc_t glDepthFunc;
- glDepthMask_client_proc_t glDepthMask;
- glDepthRangef_client_proc_t glDepthRangef;
- glDetachShader_client_proc_t glDetachShader;
- glDisable_client_proc_t glDisable;
- glDisableVertexAttribArray_client_proc_t glDisableVertexAttribArray;
- glDrawArrays_client_proc_t glDrawArrays;
- glDrawElements_client_proc_t glDrawElements;
- glEnable_client_proc_t glEnable;
- glEnableVertexAttribArray_client_proc_t glEnableVertexAttribArray;
- glFinish_client_proc_t glFinish;
- glFlush_client_proc_t glFlush;
- glFramebufferRenderbuffer_client_proc_t glFramebufferRenderbuffer;
- glFramebufferTexture2D_client_proc_t glFramebufferTexture2D;
- glFrontFace_client_proc_t glFrontFace;
- glGenBuffers_client_proc_t glGenBuffers;
- glGenerateMipmap_client_proc_t glGenerateMipmap;
- glGenFramebuffers_client_proc_t glGenFramebuffers;
- glGenRenderbuffers_client_proc_t glGenRenderbuffers;
- glGenTextures_client_proc_t glGenTextures;
- glGetActiveAttrib_client_proc_t glGetActiveAttrib;
- glGetActiveUniform_client_proc_t glGetActiveUniform;
- glGetAttachedShaders_client_proc_t glGetAttachedShaders;
- glGetAttribLocation_client_proc_t glGetAttribLocation;
- glGetBooleanv_client_proc_t glGetBooleanv;
- glGetBufferParameteriv_client_proc_t glGetBufferParameteriv;
- glGetError_client_proc_t glGetError;
- glGetFloatv_client_proc_t glGetFloatv;
- glGetFramebufferAttachmentParameteriv_client_proc_t glGetFramebufferAttachmentParameteriv;
- glGetIntegerv_client_proc_t glGetIntegerv;
- glGetProgramiv_client_proc_t glGetProgramiv;
- glGetProgramInfoLog_client_proc_t glGetProgramInfoLog;
- glGetRenderbufferParameteriv_client_proc_t glGetRenderbufferParameteriv;
- glGetShaderiv_client_proc_t glGetShaderiv;
- glGetShaderInfoLog_client_proc_t glGetShaderInfoLog;
- glGetShaderPrecisionFormat_client_proc_t glGetShaderPrecisionFormat;
- glGetShaderSource_client_proc_t glGetShaderSource;
- glGetString_client_proc_t glGetString;
- glGetTexParameterfv_client_proc_t glGetTexParameterfv;
- glGetTexParameteriv_client_proc_t glGetTexParameteriv;
- glGetUniformfv_client_proc_t glGetUniformfv;
- glGetUniformiv_client_proc_t glGetUniformiv;
- glGetUniformLocation_client_proc_t glGetUniformLocation;
- glGetVertexAttribfv_client_proc_t glGetVertexAttribfv;
- glGetVertexAttribiv_client_proc_t glGetVertexAttribiv;
- glGetVertexAttribPointerv_client_proc_t glGetVertexAttribPointerv;
- glHint_client_proc_t glHint;
- glIsBuffer_client_proc_t glIsBuffer;
- glIsEnabled_client_proc_t glIsEnabled;
- glIsFramebuffer_client_proc_t glIsFramebuffer;
- glIsProgram_client_proc_t glIsProgram;
- glIsRenderbuffer_client_proc_t glIsRenderbuffer;
- glIsShader_client_proc_t glIsShader;
- glIsTexture_client_proc_t glIsTexture;
- glLineWidth_client_proc_t glLineWidth;
- glLinkProgram_client_proc_t glLinkProgram;
- glPixelStorei_client_proc_t glPixelStorei;
- glPolygonOffset_client_proc_t glPolygonOffset;
- glReadPixels_client_proc_t glReadPixels;
- glReleaseShaderCompiler_client_proc_t glReleaseShaderCompiler;
- glRenderbufferStorage_client_proc_t glRenderbufferStorage;
- glSampleCoverage_client_proc_t glSampleCoverage;
- glScissor_client_proc_t glScissor;
- glShaderBinary_client_proc_t glShaderBinary;
- glShaderSource_client_proc_t glShaderSource;
- glStencilFunc_client_proc_t glStencilFunc;
- glStencilFuncSeparate_client_proc_t glStencilFuncSeparate;
- glStencilMask_client_proc_t glStencilMask;
- glStencilMaskSeparate_client_proc_t glStencilMaskSeparate;
- glStencilOp_client_proc_t glStencilOp;
- glStencilOpSeparate_client_proc_t glStencilOpSeparate;
- glTexImage2D_client_proc_t glTexImage2D;
- glTexParameterf_client_proc_t glTexParameterf;
- glTexParameterfv_client_proc_t glTexParameterfv;
- glTexParameteri_client_proc_t glTexParameteri;
- glTexParameteriv_client_proc_t glTexParameteriv;
- glTexSubImage2D_client_proc_t glTexSubImage2D;
- glUniform1f_client_proc_t glUniform1f;
- glUniform1fv_client_proc_t glUniform1fv;
- glUniform1i_client_proc_t glUniform1i;
- glUniform1iv_client_proc_t glUniform1iv;
- glUniform2f_client_proc_t glUniform2f;
- glUniform2fv_client_proc_t glUniform2fv;
- glUniform2i_client_proc_t glUniform2i;
- glUniform2iv_client_proc_t glUniform2iv;
- glUniform3f_client_proc_t glUniform3f;
- glUniform3fv_client_proc_t glUniform3fv;
- glUniform3i_client_proc_t glUniform3i;
- glUniform3iv_client_proc_t glUniform3iv;
- glUniform4f_client_proc_t glUniform4f;
- glUniform4fv_client_proc_t glUniform4fv;
- glUniform4i_client_proc_t glUniform4i;
- glUniform4iv_client_proc_t glUniform4iv;
- glUniformMatrix2fv_client_proc_t glUniformMatrix2fv;
- glUniformMatrix3fv_client_proc_t glUniformMatrix3fv;
- glUniformMatrix4fv_client_proc_t glUniformMatrix4fv;
- glUseProgram_client_proc_t glUseProgram;
- glValidateProgram_client_proc_t glValidateProgram;
- glVertexAttrib1f_client_proc_t glVertexAttrib1f;
- glVertexAttrib1fv_client_proc_t glVertexAttrib1fv;
- glVertexAttrib2f_client_proc_t glVertexAttrib2f;
- glVertexAttrib2fv_client_proc_t glVertexAttrib2fv;
- glVertexAttrib3f_client_proc_t glVertexAttrib3f;
- glVertexAttrib3fv_client_proc_t glVertexAttrib3fv;
- glVertexAttrib4f_client_proc_t glVertexAttrib4f;
- glVertexAttrib4fv_client_proc_t glVertexAttrib4fv;
- glVertexAttribPointer_client_proc_t glVertexAttribPointer;
- glViewport_client_proc_t glViewport;
- glEGLImageTargetTexture2DOES_client_proc_t glEGLImageTargetTexture2DOES;
- glEGLImageTargetRenderbufferStorageOES_client_proc_t glEGLImageTargetRenderbufferStorageOES;
- glGetProgramBinaryOES_client_proc_t glGetProgramBinaryOES;
- glProgramBinaryOES_client_proc_t glProgramBinaryOES;
- glMapBufferOES_client_proc_t glMapBufferOES;
- glUnmapBufferOES_client_proc_t glUnmapBufferOES;
- glTexImage3DOES_client_proc_t glTexImage3DOES;
- glTexSubImage3DOES_client_proc_t glTexSubImage3DOES;
- glCopyTexSubImage3DOES_client_proc_t glCopyTexSubImage3DOES;
- glCompressedTexImage3DOES_client_proc_t glCompressedTexImage3DOES;
- glCompressedTexSubImage3DOES_client_proc_t glCompressedTexSubImage3DOES;
- glFramebufferTexture3DOES_client_proc_t glFramebufferTexture3DOES;
- glBindVertexArrayOES_client_proc_t glBindVertexArrayOES;
- glDeleteVertexArraysOES_client_proc_t glDeleteVertexArraysOES;
- glGenVertexArraysOES_client_proc_t glGenVertexArraysOES;
- glIsVertexArrayOES_client_proc_t glIsVertexArrayOES;
- glDiscardFramebufferEXT_client_proc_t glDiscardFramebufferEXT;
- glMultiDrawArraysEXT_client_proc_t glMultiDrawArraysEXT;
- glMultiDrawElementsEXT_client_proc_t glMultiDrawElementsEXT;
- glGetPerfMonitorGroupsAMD_client_proc_t glGetPerfMonitorGroupsAMD;
- glGetPerfMonitorCountersAMD_client_proc_t glGetPerfMonitorCountersAMD;
- glGetPerfMonitorGroupStringAMD_client_proc_t glGetPerfMonitorGroupStringAMD;
- glGetPerfMonitorCounterStringAMD_client_proc_t glGetPerfMonitorCounterStringAMD;
- glGetPerfMonitorCounterInfoAMD_client_proc_t glGetPerfMonitorCounterInfoAMD;
- glGenPerfMonitorsAMD_client_proc_t glGenPerfMonitorsAMD;
- glDeletePerfMonitorsAMD_client_proc_t glDeletePerfMonitorsAMD;
- glSelectPerfMonitorCountersAMD_client_proc_t glSelectPerfMonitorCountersAMD;
- glBeginPerfMonitorAMD_client_proc_t glBeginPerfMonitorAMD;
- glEndPerfMonitorAMD_client_proc_t glEndPerfMonitorAMD;
- glGetPerfMonitorCounterDataAMD_client_proc_t glGetPerfMonitorCounterDataAMD;
- glRenderbufferStorageMultisampleIMG_client_proc_t glRenderbufferStorageMultisampleIMG;
- glFramebufferTexture2DMultisampleIMG_client_proc_t glFramebufferTexture2DMultisampleIMG;
- glDeleteFencesNV_client_proc_t glDeleteFencesNV;
- glGenFencesNV_client_proc_t glGenFencesNV;
- glIsFenceNV_client_proc_t glIsFenceNV;
- glTestFenceNV_client_proc_t glTestFenceNV;
- glGetFenceivNV_client_proc_t glGetFenceivNV;
- glFinishFenceNV_client_proc_t glFinishFenceNV;
- glSetFenceNV_client_proc_t glSetFenceNV;
- glCoverageMaskNV_client_proc_t glCoverageMaskNV;
- glCoverageOperationNV_client_proc_t glCoverageOperationNV;
- glGetDriverControlsQCOM_client_proc_t glGetDriverControlsQCOM;
- glGetDriverControlStringQCOM_client_proc_t glGetDriverControlStringQCOM;
- glEnableDriverControlQCOM_client_proc_t glEnableDriverControlQCOM;
- glDisableDriverControlQCOM_client_proc_t glDisableDriverControlQCOM;
- glExtGetTexturesQCOM_client_proc_t glExtGetTexturesQCOM;
- glExtGetBuffersQCOM_client_proc_t glExtGetBuffersQCOM;
- glExtGetRenderbuffersQCOM_client_proc_t glExtGetRenderbuffersQCOM;
- glExtGetFramebuffersQCOM_client_proc_t glExtGetFramebuffersQCOM;
- glExtGetTexLevelParameterivQCOM_client_proc_t glExtGetTexLevelParameterivQCOM;
- glExtTexObjectStateOverrideiQCOM_client_proc_t glExtTexObjectStateOverrideiQCOM;
- glExtGetTexSubImageQCOM_client_proc_t glExtGetTexSubImageQCOM;
- glExtGetBufferPointervQCOM_client_proc_t glExtGetBufferPointervQCOM;
- glExtGetShadersQCOM_client_proc_t glExtGetShadersQCOM;
- glExtGetProgramsQCOM_client_proc_t glExtGetProgramsQCOM;
- glExtIsProgramBinaryQCOM_client_proc_t glExtIsProgramBinaryQCOM;
- glExtGetProgramBinarySourceQCOM_client_proc_t glExtGetProgramBinarySourceQCOM;
- glStartTilingQCOM_client_proc_t glStartTilingQCOM;
- glEndTilingQCOM_client_proc_t glEndTilingQCOM;
- glVertexAttribPointerData_client_proc_t glVertexAttribPointerData;
- glVertexAttribPointerOffset_client_proc_t glVertexAttribPointerOffset;
- glDrawElementsOffset_client_proc_t glDrawElementsOffset;
- glDrawElementsData_client_proc_t glDrawElementsData;
- glGetCompressedTextureFormats_client_proc_t glGetCompressedTextureFormats;
- glShaderString_client_proc_t glShaderString;
- glFinishRoundTrip_client_proc_t glFinishRoundTrip;
- //Accessors
- virtual glActiveTexture_client_proc_t set_glActiveTexture(glActiveTexture_client_proc_t f) { glActiveTexture_client_proc_t retval = glActiveTexture; glActiveTexture = f; return retval;}
- virtual glAttachShader_client_proc_t set_glAttachShader(glAttachShader_client_proc_t f) { glAttachShader_client_proc_t retval = glAttachShader; glAttachShader = f; return retval;}
- virtual glBindAttribLocation_client_proc_t set_glBindAttribLocation(glBindAttribLocation_client_proc_t f) { glBindAttribLocation_client_proc_t retval = glBindAttribLocation; glBindAttribLocation = f; return retval;}
- virtual glBindBuffer_client_proc_t set_glBindBuffer(glBindBuffer_client_proc_t f) { glBindBuffer_client_proc_t retval = glBindBuffer; glBindBuffer = f; return retval;}
- virtual glBindFramebuffer_client_proc_t set_glBindFramebuffer(glBindFramebuffer_client_proc_t f) { glBindFramebuffer_client_proc_t retval = glBindFramebuffer; glBindFramebuffer = f; return retval;}
- virtual glBindRenderbuffer_client_proc_t set_glBindRenderbuffer(glBindRenderbuffer_client_proc_t f) { glBindRenderbuffer_client_proc_t retval = glBindRenderbuffer; glBindRenderbuffer = f; return retval;}
- virtual glBindTexture_client_proc_t set_glBindTexture(glBindTexture_client_proc_t f) { glBindTexture_client_proc_t retval = glBindTexture; glBindTexture = f; return retval;}
- virtual glBlendColor_client_proc_t set_glBlendColor(glBlendColor_client_proc_t f) { glBlendColor_client_proc_t retval = glBlendColor; glBlendColor = f; return retval;}
- virtual glBlendEquation_client_proc_t set_glBlendEquation(glBlendEquation_client_proc_t f) { glBlendEquation_client_proc_t retval = glBlendEquation; glBlendEquation = f; return retval;}
- virtual glBlendEquationSeparate_client_proc_t set_glBlendEquationSeparate(glBlendEquationSeparate_client_proc_t f) { glBlendEquationSeparate_client_proc_t retval = glBlendEquationSeparate; glBlendEquationSeparate = f; return retval;}
- virtual glBlendFunc_client_proc_t set_glBlendFunc(glBlendFunc_client_proc_t f) { glBlendFunc_client_proc_t retval = glBlendFunc; glBlendFunc = f; return retval;}
- virtual glBlendFuncSeparate_client_proc_t set_glBlendFuncSeparate(glBlendFuncSeparate_client_proc_t f) { glBlendFuncSeparate_client_proc_t retval = glBlendFuncSeparate; glBlendFuncSeparate = f; return retval;}
- virtual glBufferData_client_proc_t set_glBufferData(glBufferData_client_proc_t f) { glBufferData_client_proc_t retval = glBufferData; glBufferData = f; return retval;}
- virtual glBufferSubData_client_proc_t set_glBufferSubData(glBufferSubData_client_proc_t f) { glBufferSubData_client_proc_t retval = glBufferSubData; glBufferSubData = f; return retval;}
- virtual glCheckFramebufferStatus_client_proc_t set_glCheckFramebufferStatus(glCheckFramebufferStatus_client_proc_t f) { glCheckFramebufferStatus_client_proc_t retval = glCheckFramebufferStatus; glCheckFramebufferStatus = f; return retval;}
- virtual glClear_client_proc_t set_glClear(glClear_client_proc_t f) { glClear_client_proc_t retval = glClear; glClear = f; return retval;}
- virtual glClearColor_client_proc_t set_glClearColor(glClearColor_client_proc_t f) { glClearColor_client_proc_t retval = glClearColor; glClearColor = f; return retval;}
- virtual glClearDepthf_client_proc_t set_glClearDepthf(glClearDepthf_client_proc_t f) { glClearDepthf_client_proc_t retval = glClearDepthf; glClearDepthf = f; return retval;}
- virtual glClearStencil_client_proc_t set_glClearStencil(glClearStencil_client_proc_t f) { glClearStencil_client_proc_t retval = glClearStencil; glClearStencil = f; return retval;}
- virtual glColorMask_client_proc_t set_glColorMask(glColorMask_client_proc_t f) { glColorMask_client_proc_t retval = glColorMask; glColorMask = f; return retval;}
- virtual glCompileShader_client_proc_t set_glCompileShader(glCompileShader_client_proc_t f) { glCompileShader_client_proc_t retval = glCompileShader; glCompileShader = f; return retval;}
- virtual glCompressedTexImage2D_client_proc_t set_glCompressedTexImage2D(glCompressedTexImage2D_client_proc_t f) { glCompressedTexImage2D_client_proc_t retval = glCompressedTexImage2D; glCompressedTexImage2D = f; return retval;}
- virtual glCompressedTexSubImage2D_client_proc_t set_glCompressedTexSubImage2D(glCompressedTexSubImage2D_client_proc_t f) { glCompressedTexSubImage2D_client_proc_t retval = glCompressedTexSubImage2D; glCompressedTexSubImage2D = f; return retval;}
- virtual glCopyTexImage2D_client_proc_t set_glCopyTexImage2D(glCopyTexImage2D_client_proc_t f) { glCopyTexImage2D_client_proc_t retval = glCopyTexImage2D; glCopyTexImage2D = f; return retval;}
- virtual glCopyTexSubImage2D_client_proc_t set_glCopyTexSubImage2D(glCopyTexSubImage2D_client_proc_t f) { glCopyTexSubImage2D_client_proc_t retval = glCopyTexSubImage2D; glCopyTexSubImage2D = f; return retval;}
- virtual glCreateProgram_client_proc_t set_glCreateProgram(glCreateProgram_client_proc_t f) { glCreateProgram_client_proc_t retval = glCreateProgram; glCreateProgram = f; return retval;}
- virtual glCreateShader_client_proc_t set_glCreateShader(glCreateShader_client_proc_t f) { glCreateShader_client_proc_t retval = glCreateShader; glCreateShader = f; return retval;}
- virtual glCullFace_client_proc_t set_glCullFace(glCullFace_client_proc_t f) { glCullFace_client_proc_t retval = glCullFace; glCullFace = f; return retval;}
- virtual glDeleteBuffers_client_proc_t set_glDeleteBuffers(glDeleteBuffers_client_proc_t f) { glDeleteBuffers_client_proc_t retval = glDeleteBuffers; glDeleteBuffers = f; return retval;}
- virtual glDeleteFramebuffers_client_proc_t set_glDeleteFramebuffers(glDeleteFramebuffers_client_proc_t f) { glDeleteFramebuffers_client_proc_t retval = glDeleteFramebuffers; glDeleteFramebuffers = f; return retval;}
- virtual glDeleteProgram_client_proc_t set_glDeleteProgram(glDeleteProgram_client_proc_t f) { glDeleteProgram_client_proc_t retval = glDeleteProgram; glDeleteProgram = f; return retval;}
- virtual glDeleteRenderbuffers_client_proc_t set_glDeleteRenderbuffers(glDeleteRenderbuffers_client_proc_t f) { glDeleteRenderbuffers_client_proc_t retval = glDeleteRenderbuffers; glDeleteRenderbuffers = f; return retval;}
- virtual glDeleteShader_client_proc_t set_glDeleteShader(glDeleteShader_client_proc_t f) { glDeleteShader_client_proc_t retval = glDeleteShader; glDeleteShader = f; return retval;}
- virtual glDeleteTextures_client_proc_t set_glDeleteTextures(glDeleteTextures_client_proc_t f) { glDeleteTextures_client_proc_t retval = glDeleteTextures; glDeleteTextures = f; return retval;}
- virtual glDepthFunc_client_proc_t set_glDepthFunc(glDepthFunc_client_proc_t f) { glDepthFunc_client_proc_t retval = glDepthFunc; glDepthFunc = f; return retval;}
- virtual glDepthMask_client_proc_t set_glDepthMask(glDepthMask_client_proc_t f) { glDepthMask_client_proc_t retval = glDepthMask; glDepthMask = f; return retval;}
- virtual glDepthRangef_client_proc_t set_glDepthRangef(glDepthRangef_client_proc_t f) { glDepthRangef_client_proc_t retval = glDepthRangef; glDepthRangef = f; return retval;}
- virtual glDetachShader_client_proc_t set_glDetachShader(glDetachShader_client_proc_t f) { glDetachShader_client_proc_t retval = glDetachShader; glDetachShader = f; return retval;}
- virtual glDisable_client_proc_t set_glDisable(glDisable_client_proc_t f) { glDisable_client_proc_t retval = glDisable; glDisable = f; return retval;}
- virtual glDisableVertexAttribArray_client_proc_t set_glDisableVertexAttribArray(glDisableVertexAttribArray_client_proc_t f) { glDisableVertexAttribArray_client_proc_t retval = glDisableVertexAttribArray; glDisableVertexAttribArray = f; return retval;}
- virtual glDrawArrays_client_proc_t set_glDrawArrays(glDrawArrays_client_proc_t f) { glDrawArrays_client_proc_t retval = glDrawArrays; glDrawArrays = f; return retval;}
- virtual glDrawElements_client_proc_t set_glDrawElements(glDrawElements_client_proc_t f) { glDrawElements_client_proc_t retval = glDrawElements; glDrawElements = f; return retval;}
- virtual glEnable_client_proc_t set_glEnable(glEnable_client_proc_t f) { glEnable_client_proc_t retval = glEnable; glEnable = f; return retval;}
- virtual glEnableVertexAttribArray_client_proc_t set_glEnableVertexAttribArray(glEnableVertexAttribArray_client_proc_t f) { glEnableVertexAttribArray_client_proc_t retval = glEnableVertexAttribArray; glEnableVertexAttribArray = f; return retval;}
- virtual glFinish_client_proc_t set_glFinish(glFinish_client_proc_t f) { glFinish_client_proc_t retval = glFinish; glFinish = f; return retval;}
- virtual glFlush_client_proc_t set_glFlush(glFlush_client_proc_t f) { glFlush_client_proc_t retval = glFlush; glFlush = f; return retval;}
- virtual glFramebufferRenderbuffer_client_proc_t set_glFramebufferRenderbuffer(glFramebufferRenderbuffer_client_proc_t f) { glFramebufferRenderbuffer_client_proc_t retval = glFramebufferRenderbuffer; glFramebufferRenderbuffer = f; return retval;}
- virtual glFramebufferTexture2D_client_proc_t set_glFramebufferTexture2D(glFramebufferTexture2D_client_proc_t f) { glFramebufferTexture2D_client_proc_t retval = glFramebufferTexture2D; glFramebufferTexture2D = f; return retval;}
- virtual glFrontFace_client_proc_t set_glFrontFace(glFrontFace_client_proc_t f) { glFrontFace_client_proc_t retval = glFrontFace; glFrontFace = f; return retval;}
- virtual glGenBuffers_client_proc_t set_glGenBuffers(glGenBuffers_client_proc_t f) { glGenBuffers_client_proc_t retval = glGenBuffers; glGenBuffers = f; return retval;}
- virtual glGenerateMipmap_client_proc_t set_glGenerateMipmap(glGenerateMipmap_client_proc_t f) { glGenerateMipmap_client_proc_t retval = glGenerateMipmap; glGenerateMipmap = f; return retval;}
- virtual glGenFramebuffers_client_proc_t set_glGenFramebuffers(glGenFramebuffers_client_proc_t f) { glGenFramebuffers_client_proc_t retval = glGenFramebuffers; glGenFramebuffers = f; return retval;}
- virtual glGenRenderbuffers_client_proc_t set_glGenRenderbuffers(glGenRenderbuffers_client_proc_t f) { glGenRenderbuffers_client_proc_t retval = glGenRenderbuffers; glGenRenderbuffers = f; return retval;}
- virtual glGenTextures_client_proc_t set_glGenTextures(glGenTextures_client_proc_t f) { glGenTextures_client_proc_t retval = glGenTextures; glGenTextures = f; return retval;}
- virtual glGetActiveAttrib_client_proc_t set_glGetActiveAttrib(glGetActiveAttrib_client_proc_t f) { glGetActiveAttrib_client_proc_t retval = glGetActiveAttrib; glGetActiveAttrib = f; return retval;}
- virtual glGetActiveUniform_client_proc_t set_glGetActiveUniform(glGetActiveUniform_client_proc_t f) { glGetActiveUniform_client_proc_t retval = glGetActiveUniform; glGetActiveUniform = f; return retval;}
- virtual glGetAttachedShaders_client_proc_t set_glGetAttachedShaders(glGetAttachedShaders_client_proc_t f) { glGetAttachedShaders_client_proc_t retval = glGetAttachedShaders; glGetAttachedShaders = f; return retval;}
- virtual glGetAttribLocation_client_proc_t set_glGetAttribLocation(glGetAttribLocation_client_proc_t f) { glGetAttribLocation_client_proc_t retval = glGetAttribLocation; glGetAttribLocation = f; return retval;}
- virtual glGetBooleanv_client_proc_t set_glGetBooleanv(glGetBooleanv_client_proc_t f) { glGetBooleanv_client_proc_t retval = glGetBooleanv; glGetBooleanv = f; return retval;}
- virtual glGetBufferParameteriv_client_proc_t set_glGetBufferParameteriv(glGetBufferParameteriv_client_proc_t f) { glGetBufferParameteriv_client_proc_t retval = glGetBufferParameteriv; glGetBufferParameteriv = f; return retval;}
- virtual glGetError_client_proc_t set_glGetError(glGetError_client_proc_t f) { glGetError_client_proc_t retval = glGetError; glGetError = f; return retval;}
- virtual glGetFloatv_client_proc_t set_glGetFloatv(glGetFloatv_client_proc_t f) { glGetFloatv_client_proc_t retval = glGetFloatv; glGetFloatv = f; return retval;}
- virtual glGetFramebufferAttachmentParameteriv_client_proc_t set_glGetFramebufferAttachmentParameteriv(glGetFramebufferAttachmentParameteriv_client_proc_t f) { glGetFramebufferAttachmentParameteriv_client_proc_t retval = glGetFramebufferAttachmentParameteriv; glGetFramebufferAttachmentParameteriv = f; return retval;}
- virtual glGetIntegerv_client_proc_t set_glGetIntegerv(glGetIntegerv_client_proc_t f) { glGetIntegerv_client_proc_t retval = glGetIntegerv; glGetIntegerv = f; return retval;}
- virtual glGetProgramiv_client_proc_t set_glGetProgramiv(glGetProgramiv_client_proc_t f) { glGetProgramiv_client_proc_t retval = glGetProgramiv; glGetProgramiv = f; return retval;}
- virtual glGetProgramInfoLog_client_proc_t set_glGetProgramInfoLog(glGetProgramInfoLog_client_proc_t f) { glGetProgramInfoLog_client_proc_t retval = glGetProgramInfoLog; glGetProgramInfoLog = f; return retval;}
- virtual glGetRenderbufferParameteriv_client_proc_t set_glGetRenderbufferParameteriv(glGetRenderbufferParameteriv_client_proc_t f) { glGetRenderbufferParameteriv_client_proc_t retval = glGetRenderbufferParameteriv; glGetRenderbufferParameteriv = f; return retval;}
- virtual glGetShaderiv_client_proc_t set_glGetShaderiv(glGetShaderiv_client_proc_t f) { glGetShaderiv_client_proc_t retval = glGetShaderiv; glGetShaderiv = f; return retval;}
- virtual glGetShaderInfoLog_client_proc_t set_glGetShaderInfoLog(glGetShaderInfoLog_client_proc_t f) { glGetShaderInfoLog_client_proc_t retval = glGetShaderInfoLog; glGetShaderInfoLog = f; return retval;}
- virtual glGetShaderPrecisionFormat_client_proc_t set_glGetShaderPrecisionFormat(glGetShaderPrecisionFormat_client_proc_t f) { glGetShaderPrecisionFormat_client_proc_t retval = glGetShaderPrecisionFormat; glGetShaderPrecisionFormat = f; return retval;}
- virtual glGetShaderSource_client_proc_t set_glGetShaderSource(glGetShaderSource_client_proc_t f) { glGetShaderSource_client_proc_t retval = glGetShaderSource; glGetShaderSource = f; return retval;}
- virtual glGetString_client_proc_t set_glGetString(glGetString_client_proc_t f) { glGetString_client_proc_t retval = glGetString; glGetString = f; return retval;}
- virtual glGetTexParameterfv_client_proc_t set_glGetTexParameterfv(glGetTexParameterfv_client_proc_t f) { glGetTexParameterfv_client_proc_t retval = glGetTexParameterfv; glGetTexParameterfv = f; return retval;}
- virtual glGetTexParameteriv_client_proc_t set_glGetTexParameteriv(glGetTexParameteriv_client_proc_t f) { glGetTexParameteriv_client_proc_t retval = glGetTexParameteriv; glGetTexParameteriv = f; return retval;}
- virtual glGetUniformfv_client_proc_t set_glGetUniformfv(glGetUniformfv_client_proc_t f) { glGetUniformfv_client_proc_t retval = glGetUniformfv; glGetUniformfv = f; return retval;}
- virtual glGetUniformiv_client_proc_t set_glGetUniformiv(glGetUniformiv_client_proc_t f) { glGetUniformiv_client_proc_t retval = glGetUniformiv; glGetUniformiv = f; return retval;}
- virtual glGetUniformLocation_client_proc_t set_glGetUniformLocation(glGetUniformLocation_client_proc_t f) { glGetUniformLocation_client_proc_t retval = glGetUniformLocation; glGetUniformLocation = f; return retval;}
- virtual glGetVertexAttribfv_client_proc_t set_glGetVertexAttribfv(glGetVertexAttribfv_client_proc_t f) { glGetVertexAttribfv_client_proc_t retval = glGetVertexAttribfv; glGetVertexAttribfv = f; return retval;}
- virtual glGetVertexAttribiv_client_proc_t set_glGetVertexAttribiv(glGetVertexAttribiv_client_proc_t f) { glGetVertexAttribiv_client_proc_t retval = glGetVertexAttribiv; glGetVertexAttribiv = f; return retval;}
- virtual glGetVertexAttribPointerv_client_proc_t set_glGetVertexAttribPointerv(glGetVertexAttribPointerv_client_proc_t f) { glGetVertexAttribPointerv_client_proc_t retval = glGetVertexAttribPointerv; glGetVertexAttribPointerv = f; return retval;}
- virtual glHint_client_proc_t set_glHint(glHint_client_proc_t f) { glHint_client_proc_t retval = glHint; glHint = f; return retval;}
- virtual glIsBuffer_client_proc_t set_glIsBuffer(glIsBuffer_client_proc_t f) { glIsBuffer_client_proc_t retval = glIsBuffer; glIsBuffer = f; return retval;}
- virtual glIsEnabled_client_proc_t set_glIsEnabled(glIsEnabled_client_proc_t f) { glIsEnabled_client_proc_t retval = glIsEnabled; glIsEnabled = f; return retval;}
- virtual glIsFramebuffer_client_proc_t set_glIsFramebuffer(glIsFramebuffer_client_proc_t f) { glIsFramebuffer_client_proc_t retval = glIsFramebuffer; glIsFramebuffer = f; return retval;}
- virtual glIsProgram_client_proc_t set_glIsProgram(glIsProgram_client_proc_t f) { glIsProgram_client_proc_t retval = glIsProgram; glIsProgram = f; return retval;}
- virtual glIsRenderbuffer_client_proc_t set_glIsRenderbuffer(glIsRenderbuffer_client_proc_t f) { glIsRenderbuffer_client_proc_t retval = glIsRenderbuffer; glIsRenderbuffer = f; return retval;}
- virtual glIsShader_client_proc_t set_glIsShader(glIsShader_client_proc_t f) { glIsShader_client_proc_t retval = glIsShader; glIsShader = f; return retval;}
- virtual glIsTexture_client_proc_t set_glIsTexture(glIsTexture_client_proc_t f) { glIsTexture_client_proc_t retval = glIsTexture; glIsTexture = f; return retval;}
- virtual glLineWidth_client_proc_t set_glLineWidth(glLineWidth_client_proc_t f) { glLineWidth_client_proc_t retval = glLineWidth; glLineWidth = f; return retval;}
- virtual glLinkProgram_client_proc_t set_glLinkProgram(glLinkProgram_client_proc_t f) { glLinkProgram_client_proc_t retval = glLinkProgram; glLinkProgram = f; return retval;}
- virtual glPixelStorei_client_proc_t set_glPixelStorei(glPixelStorei_client_proc_t f) { glPixelStorei_client_proc_t retval = glPixelStorei; glPixelStorei = f; return retval;}
- virtual glPolygonOffset_client_proc_t set_glPolygonOffset(glPolygonOffset_client_proc_t f) { glPolygonOffset_client_proc_t retval = glPolygonOffset; glPolygonOffset = f; return retval;}
- virtual glReadPixels_client_proc_t set_glReadPixels(glReadPixels_client_proc_t f) { glReadPixels_client_proc_t retval = glReadPixels; glReadPixels = f; return retval;}
- virtual glReleaseShaderCompiler_client_proc_t set_glReleaseShaderCompiler(glReleaseShaderCompiler_client_proc_t f) { glReleaseShaderCompiler_client_proc_t retval = glReleaseShaderCompiler; glReleaseShaderCompiler = f; return retval;}
- virtual glRenderbufferStorage_client_proc_t set_glRenderbufferStorage(glRenderbufferStorage_client_proc_t f) { glRenderbufferStorage_client_proc_t retval = glRenderbufferStorage; glRenderbufferStorage = f; return retval;}
- virtual glSampleCoverage_client_proc_t set_glSampleCoverage(glSampleCoverage_client_proc_t f) { glSampleCoverage_client_proc_t retval = glSampleCoverage; glSampleCoverage = f; return retval;}
- virtual glScissor_client_proc_t set_glScissor(glScissor_client_proc_t f) { glScissor_client_proc_t retval = glScissor; glScissor = f; return retval;}
- virtual glShaderBinary_client_proc_t set_glShaderBinary(glShaderBinary_client_proc_t f) { glShaderBinary_client_proc_t retval = glShaderBinary; glShaderBinary = f; return retval;}
- virtual glShaderSource_client_proc_t set_glShaderSource(glShaderSource_client_proc_t f) { glShaderSource_client_proc_t retval = glShaderSource; glShaderSource = f; return retval;}
- virtual glStencilFunc_client_proc_t set_glStencilFunc(glStencilFunc_client_proc_t f) { glStencilFunc_client_proc_t retval = glStencilFunc; glStencilFunc = f; return retval;}
- virtual glStencilFuncSeparate_client_proc_t set_glStencilFuncSeparate(glStencilFuncSeparate_client_proc_t f) { glStencilFuncSeparate_client_proc_t retval = glStencilFuncSeparate; glStencilFuncSeparate = f; return retval;}
- virtual glStencilMask_client_proc_t set_glStencilMask(glStencilMask_client_proc_t f) { glStencilMask_client_proc_t retval = glStencilMask; glStencilMask = f; return retval;}
- virtual glStencilMaskSeparate_client_proc_t set_glStencilMaskSeparate(glStencilMaskSeparate_client_proc_t f) { glStencilMaskSeparate_client_proc_t retval = glStencilMaskSeparate; glStencilMaskSeparate = f; return retval;}
- virtual glStencilOp_client_proc_t set_glStencilOp(glStencilOp_client_proc_t f) { glStencilOp_client_proc_t retval = glStencilOp; glStencilOp = f; return retval;}
- virtual glStencilOpSeparate_client_proc_t set_glStencilOpSeparate(glStencilOpSeparate_client_proc_t f) { glStencilOpSeparate_client_proc_t retval = glStencilOpSeparate; glStencilOpSeparate = f; return retval;}
- virtual glTexImage2D_client_proc_t set_glTexImage2D(glTexImage2D_client_proc_t f) { glTexImage2D_client_proc_t retval = glTexImage2D; glTexImage2D = f; return retval;}
- virtual glTexParameterf_client_proc_t set_glTexParameterf(glTexParameterf_client_proc_t f) { glTexParameterf_client_proc_t retval = glTexParameterf; glTexParameterf = f; return retval;}
- virtual glTexParameterfv_client_proc_t set_glTexParameterfv(glTexParameterfv_client_proc_t f) { glTexParameterfv_client_proc_t retval = glTexParameterfv; glTexParameterfv = f; return retval;}
- virtual glTexParameteri_client_proc_t set_glTexParameteri(glTexParameteri_client_proc_t f) { glTexParameteri_client_proc_t retval = glTexParameteri; glTexParameteri = f; return retval;}
- virtual glTexParameteriv_client_proc_t set_glTexParameteriv(glTexParameteriv_client_proc_t f) { glTexParameteriv_client_proc_t retval = glTexParameteriv; glTexParameteriv = f; return retval;}
- virtual glTexSubImage2D_client_proc_t set_glTexSubImage2D(glTexSubImage2D_client_proc_t f) { glTexSubImage2D_client_proc_t retval = glTexSubImage2D; glTexSubImage2D = f; return retval;}
- virtual glUniform1f_client_proc_t set_glUniform1f(glUniform1f_client_proc_t f) { glUniform1f_client_proc_t retval = glUniform1f; glUniform1f = f; return retval;}
- virtual glUniform1fv_client_proc_t set_glUniform1fv(glUniform1fv_client_proc_t f) { glUniform1fv_client_proc_t retval = glUniform1fv; glUniform1fv = f; return retval;}
- virtual glUniform1i_client_proc_t set_glUniform1i(glUniform1i_client_proc_t f) { glUniform1i_client_proc_t retval = glUniform1i; glUniform1i = f; return retval;}
- virtual glUniform1iv_client_proc_t set_glUniform1iv(glUniform1iv_client_proc_t f) { glUniform1iv_client_proc_t retval = glUniform1iv; glUniform1iv = f; return retval;}
- virtual glUniform2f_client_proc_t set_glUniform2f(glUniform2f_client_proc_t f) { glUniform2f_client_proc_t retval = glUniform2f; glUniform2f = f; return retval;}
- virtual glUniform2fv_client_proc_t set_glUniform2fv(glUniform2fv_client_proc_t f) { glUniform2fv_client_proc_t retval = glUniform2fv; glUniform2fv = f; return retval;}
- virtual glUniform2i_client_proc_t set_glUniform2i(glUniform2i_client_proc_t f) { glUniform2i_client_proc_t retval = glUniform2i; glUniform2i = f; return retval;}
- virtual glUniform2iv_client_proc_t set_glUniform2iv(glUniform2iv_client_proc_t f) { glUniform2iv_client_proc_t retval = glUniform2iv; glUniform2iv = f; return retval;}
- virtual glUniform3f_client_proc_t set_glUniform3f(glUniform3f_client_proc_t f) { glUniform3f_client_proc_t retval = glUniform3f; glUniform3f = f; return retval;}
- virtual glUniform3fv_client_proc_t set_glUniform3fv(glUniform3fv_client_proc_t f) { glUniform3fv_client_proc_t retval = glUniform3fv; glUniform3fv = f; return retval;}
- virtual glUniform3i_client_proc_t set_glUniform3i(glUniform3i_client_proc_t f) { glUniform3i_client_proc_t retval = glUniform3i; glUniform3i = f; return retval;}
- virtual glUniform3iv_client_proc_t set_glUniform3iv(glUniform3iv_client_proc_t f) { glUniform3iv_client_proc_t retval = glUniform3iv; glUniform3iv = f; return retval;}
- virtual glUniform4f_client_proc_t set_glUniform4f(glUniform4f_client_proc_t f) { glUniform4f_client_proc_t retval = glUniform4f; glUniform4f = f; return retval;}
- virtual glUniform4fv_client_proc_t set_glUniform4fv(glUniform4fv_client_proc_t f) { glUniform4fv_client_proc_t retval = glUniform4fv; glUniform4fv = f; return retval;}
- virtual glUniform4i_client_proc_t set_glUniform4i(glUniform4i_client_proc_t f) { glUniform4i_client_proc_t retval = glUniform4i; glUniform4i = f; return retval;}
- virtual glUniform4iv_client_proc_t set_glUniform4iv(glUniform4iv_client_proc_t f) { glUniform4iv_client_proc_t retval = glUniform4iv; glUniform4iv = f; return retval;}
- virtual glUniformMatrix2fv_client_proc_t set_glUniformMatrix2fv(glUniformMatrix2fv_client_proc_t f) { glUniformMatrix2fv_client_proc_t retval = glUniformMatrix2fv; glUniformMatrix2fv = f; return retval;}
- virtual glUniformMatrix3fv_client_proc_t set_glUniformMatrix3fv(glUniformMatrix3fv_client_proc_t f) { glUniformMatrix3fv_client_proc_t retval = glUniformMatrix3fv; glUniformMatrix3fv = f; return retval;}
- virtual glUniformMatrix4fv_client_proc_t set_glUniformMatrix4fv(glUniformMatrix4fv_client_proc_t f) { glUniformMatrix4fv_client_proc_t retval = glUniformMatrix4fv; glUniformMatrix4fv = f; return retval;}
- virtual glUseProgram_client_proc_t set_glUseProgram(glUseProgram_client_proc_t f) { glUseProgram_client_proc_t retval = glUseProgram; glUseProgram = f; return retval;}
- virtual glValidateProgram_client_proc_t set_glValidateProgram(glValidateProgram_client_proc_t f) { glValidateProgram_client_proc_t retval = glValidateProgram; glValidateProgram = f; return retval;}
- virtual glVertexAttrib1f_client_proc_t set_glVertexAttrib1f(glVertexAttrib1f_client_proc_t f) { glVertexAttrib1f_client_proc_t retval = glVertexAttrib1f; glVertexAttrib1f = f; return retval;}
- virtual glVertexAttrib1fv_client_proc_t set_glVertexAttrib1fv(glVertexAttrib1fv_client_proc_t f) { glVertexAttrib1fv_client_proc_t retval = glVertexAttrib1fv; glVertexAttrib1fv = f; return retval;}
- virtual glVertexAttrib2f_client_proc_t set_glVertexAttrib2f(glVertexAttrib2f_client_proc_t f) { glVertexAttrib2f_client_proc_t retval = glVertexAttrib2f; glVertexAttrib2f = f; return retval;}
- virtual glVertexAttrib2fv_client_proc_t set_glVertexAttrib2fv(glVertexAttrib2fv_client_proc_t f) { glVertexAttrib2fv_client_proc_t retval = glVertexAttrib2fv; glVertexAttrib2fv = f; return retval;}
- virtual glVertexAttrib3f_client_proc_t set_glVertexAttrib3f(glVertexAttrib3f_client_proc_t f) { glVertexAttrib3f_client_proc_t retval = glVertexAttrib3f; glVertexAttrib3f = f; return retval;}
- virtual glVertexAttrib3fv_client_proc_t set_glVertexAttrib3fv(glVertexAttrib3fv_client_proc_t f) { glVertexAttrib3fv_client_proc_t retval = glVertexAttrib3fv; glVertexAttrib3fv = f; return retval;}
- virtual glVertexAttrib4f_client_proc_t set_glVertexAttrib4f(glVertexAttrib4f_client_proc_t f) { glVertexAttrib4f_client_proc_t retval = glVertexAttrib4f; glVertexAttrib4f = f; return retval;}
- virtual glVertexAttrib4fv_client_proc_t set_glVertexAttrib4fv(glVertexAttrib4fv_client_proc_t f) { glVertexAttrib4fv_client_proc_t retval = glVertexAttrib4fv; glVertexAttrib4fv = f; return retval;}
- virtual glVertexAttribPointer_client_proc_t set_glVertexAttribPointer(glVertexAttribPointer_client_proc_t f) { glVertexAttribPointer_client_proc_t retval = glVertexAttribPointer; glVertexAttribPointer = f; return retval;}
- virtual glViewport_client_proc_t set_glViewport(glViewport_client_proc_t f) { glViewport_client_proc_t retval = glViewport; glViewport = f; return retval;}
- virtual glEGLImageTargetTexture2DOES_client_proc_t set_glEGLImageTargetTexture2DOES(glEGLImageTargetTexture2DOES_client_proc_t f) { glEGLImageTargetTexture2DOES_client_proc_t retval = glEGLImageTargetTexture2DOES; glEGLImageTargetTexture2DOES = f; return retval;}
- virtual glEGLImageTargetRenderbufferStorageOES_client_proc_t set_glEGLImageTargetRenderbufferStorageOES(glEGLImageTargetRenderbufferStorageOES_client_proc_t f) { glEGLImageTargetRenderbufferStorageOES_client_proc_t retval = glEGLImageTargetRenderbufferStorageOES; glEGLImageTargetRenderbufferStorageOES = f; return retval;}
- virtual glGetProgramBinaryOES_client_proc_t set_glGetProgramBinaryOES(glGetProgramBinaryOES_client_proc_t f) { glGetProgramBinaryOES_client_proc_t retval = glGetProgramBinaryOES; glGetProgramBinaryOES = f; return retval;}
- virtual glProgramBinaryOES_client_proc_t set_glProgramBinaryOES(glProgramBinaryOES_client_proc_t f) { glProgramBinaryOES_client_proc_t retval = glProgramBinaryOES; glProgramBinaryOES = f; return retval;}
- virtual glMapBufferOES_client_proc_t set_glMapBufferOES(glMapBufferOES_client_proc_t f) { glMapBufferOES_client_proc_t retval = glMapBufferOES; glMapBufferOES = f; return retval;}
- virtual glUnmapBufferOES_client_proc_t set_glUnmapBufferOES(glUnmapBufferOES_client_proc_t f) { glUnmapBufferOES_client_proc_t retval = glUnmapBufferOES; glUnmapBufferOES = f; return retval;}
- virtual glTexImage3DOES_client_proc_t set_glTexImage3DOES(glTexImage3DOES_client_proc_t f) { glTexImage3DOES_client_proc_t retval = glTexImage3DOES; glTexImage3DOES = f; return retval;}
- virtual glTexSubImage3DOES_client_proc_t set_glTexSubImage3DOES(glTexSubImage3DOES_client_proc_t f) { glTexSubImage3DOES_client_proc_t retval = glTexSubImage3DOES; glTexSubImage3DOES = f; return retval;}
- virtual glCopyTexSubImage3DOES_client_proc_t set_glCopyTexSubImage3DOES(glCopyTexSubImage3DOES_client_proc_t f) { glCopyTexSubImage3DOES_client_proc_t retval = glCopyTexSubImage3DOES; glCopyTexSubImage3DOES = f; return retval;}
- virtual glCompressedTexImage3DOES_client_proc_t set_glCompressedTexImage3DOES(glCompressedTexImage3DOES_client_proc_t f) { glCompressedTexImage3DOES_client_proc_t retval = glCompressedTexImage3DOES; glCompressedTexImage3DOES = f; return retval;}
- virtual glCompressedTexSubImage3DOES_client_proc_t set_glCompressedTexSubImage3DOES(glCompressedTexSubImage3DOES_client_proc_t f) { glCompressedTexSubImage3DOES_client_proc_t retval = glCompressedTexSubImage3DOES; glCompressedTexSubImage3DOES = f; return retval;}
- virtual glFramebufferTexture3DOES_client_proc_t set_glFramebufferTexture3DOES(glFramebufferTexture3DOES_client_proc_t f) { glFramebufferTexture3DOES_client_proc_t retval = glFramebufferTexture3DOES; glFramebufferTexture3DOES = f; return retval;}
- virtual glBindVertexArrayOES_client_proc_t set_glBindVertexArrayOES(glBindVertexArrayOES_client_proc_t f) { glBindVertexArrayOES_client_proc_t retval = glBindVertexArrayOES; glBindVertexArrayOES = f; return retval;}
- virtual glDeleteVertexArraysOES_client_proc_t set_glDeleteVertexArraysOES(glDeleteVertexArraysOES_client_proc_t f) { glDeleteVertexArraysOES_client_proc_t retval = glDeleteVertexArraysOES; glDeleteVertexArraysOES = f; return retval;}
- virtual glGenVertexArraysOES_client_proc_t set_glGenVertexArraysOES(glGenVertexArraysOES_client_proc_t f) { glGenVertexArraysOES_client_proc_t retval = glGenVertexArraysOES; glGenVertexArraysOES = f; return retval;}
- virtual glIsVertexArrayOES_client_proc_t set_glIsVertexArrayOES(glIsVertexArrayOES_client_proc_t f) { glIsVertexArrayOES_client_proc_t retval = glIsVertexArrayOES; glIsVertexArrayOES = f; return retval;}
- virtual glDiscardFramebufferEXT_client_proc_t set_glDiscardFramebufferEXT(glDiscardFramebufferEXT_client_proc_t f) { glDiscardFramebufferEXT_client_proc_t retval = glDiscardFramebufferEXT; glDiscardFramebufferEXT = f; return retval;}
- virtual glMultiDrawArraysEXT_client_proc_t set_glMultiDrawArraysEXT(glMultiDrawArraysEXT_client_proc_t f) { glMultiDrawArraysEXT_client_proc_t retval = glMultiDrawArraysEXT; glMultiDrawArraysEXT = f; return retval;}
- virtual glMultiDrawElementsEXT_client_proc_t set_glMultiDrawElementsEXT(glMultiDrawElementsEXT_client_proc_t f) { glMultiDrawElementsEXT_client_proc_t retval = glMultiDrawElementsEXT; glMultiDrawElementsEXT = f; return retval;}
- virtual glGetPerfMonitorGroupsAMD_client_proc_t set_glGetPerfMonitorGroupsAMD(glGetPerfMonitorGroupsAMD_client_proc_t f) { glGetPerfMonitorGroupsAMD_client_proc_t retval = glGetPerfMonitorGroupsAMD; glGetPerfMonitorGroupsAMD = f; return retval;}
- virtual glGetPerfMonitorCountersAMD_client_proc_t set_glGetPerfMonitorCountersAMD(glGetPerfMonitorCountersAMD_client_proc_t f) { glGetPerfMonitorCountersAMD_client_proc_t retval = glGetPerfMonitorCountersAMD; glGetPerfMonitorCountersAMD = f; return retval;}
- virtual glGetPerfMonitorGroupStringAMD_client_proc_t set_glGetPerfMonitorGroupStringAMD(glGetPerfMonitorGroupStringAMD_client_proc_t f) { glGetPerfMonitorGroupStringAMD_client_proc_t retval = glGetPerfMonitorGroupStringAMD; glGetPerfMonitorGroupStringAMD = f; return retval;}
- virtual glGetPerfMonitorCounterStringAMD_client_proc_t set_glGetPerfMonitorCounterStringAMD(glGetPerfMonitorCounterStringAMD_client_proc_t f) { glGetPerfMonitorCounterStringAMD_client_proc_t retval = glGetPerfMonitorCounterStringAMD; glGetPerfMonitorCounterStringAMD = f; return retval;}
- virtual glGetPerfMonitorCounterInfoAMD_client_proc_t set_glGetPerfMonitorCounterInfoAMD(glGetPerfMonitorCounterInfoAMD_client_proc_t f) { glGetPerfMonitorCounterInfoAMD_client_proc_t retval = glGetPerfMonitorCounterInfoAMD; glGetPerfMonitorCounterInfoAMD = f; return retval;}
- virtual glGenPerfMonitorsAMD_client_proc_t set_glGenPerfMonitorsAMD(glGenPerfMonitorsAMD_client_proc_t f) { glGenPerfMonitorsAMD_client_proc_t retval = glGenPerfMonitorsAMD; glGenPerfMonitorsAMD = f; return retval;}
- virtual glDeletePerfMonitorsAMD_client_proc_t set_glDeletePerfMonitorsAMD(glDeletePerfMonitorsAMD_client_proc_t f) { glDeletePerfMonitorsAMD_client_proc_t retval = glDeletePerfMonitorsAMD; glDeletePerfMonitorsAMD = f; return retval;}
- virtual glSelectPerfMonitorCountersAMD_client_proc_t set_glSelectPerfMonitorCountersAMD(glSelectPerfMonitorCountersAMD_client_proc_t f) { glSelectPerfMonitorCountersAMD_client_proc_t retval = glSelectPerfMonitorCountersAMD; glSelectPerfMonitorCountersAMD = f; return retval;}
- virtual glBeginPerfMonitorAMD_client_proc_t set_glBeginPerfMonitorAMD(glBeginPerfMonitorAMD_client_proc_t f) { glBeginPerfMonitorAMD_client_proc_t retval = glBeginPerfMonitorAMD; glBeginPerfMonitorAMD = f; return retval;}
- virtual glEndPerfMonitorAMD_client_proc_t set_glEndPerfMonitorAMD(glEndPerfMonitorAMD_client_proc_t f) { glEndPerfMonitorAMD_client_proc_t retval = glEndPerfMonitorAMD; glEndPerfMonitorAMD = f; return retval;}
- virtual glGetPerfMonitorCounterDataAMD_client_proc_t set_glGetPerfMonitorCounterDataAMD(glGetPerfMonitorCounterDataAMD_client_proc_t f) { glGetPerfMonitorCounterDataAMD_client_proc_t retval = glGetPerfMonitorCounterDataAMD; glGetPerfMonitorCounterDataAMD = f; return retval;}
- virtual glRenderbufferStorageMultisampleIMG_client_proc_t set_glRenderbufferStorageMultisampleIMG(glRenderbufferStorageMultisampleIMG_client_proc_t f) { glRenderbufferStorageMultisampleIMG_client_proc_t retval = glRenderbufferStorageMultisampleIMG; glRenderbufferStorageMultisampleIMG = f; return retval;}
- virtual glFramebufferTexture2DMultisampleIMG_client_proc_t set_glFramebufferTexture2DMultisampleIMG(glFramebufferTexture2DMultisampleIMG_client_proc_t f) { glFramebufferTexture2DMultisampleIMG_client_proc_t retval = glFramebufferTexture2DMultisampleIMG; glFramebufferTexture2DMultisampleIMG = f; return retval;}
- virtual glDeleteFencesNV_client_proc_t set_glDeleteFencesNV(glDeleteFencesNV_client_proc_t f) { glDeleteFencesNV_client_proc_t retval = glDeleteFencesNV; glDeleteFencesNV = f; return retval;}
- virtual glGenFencesNV_client_proc_t set_glGenFencesNV(glGenFencesNV_client_proc_t f) { glGenFencesNV_client_proc_t retval = glGenFencesNV; glGenFencesNV = f; return retval;}
- virtual glIsFenceNV_client_proc_t set_glIsFenceNV(glIsFenceNV_client_proc_t f) { glIsFenceNV_client_proc_t retval = glIsFenceNV; glIsFenceNV = f; return retval;}
- virtual glTestFenceNV_client_proc_t set_glTestFenceNV(glTestFenceNV_client_proc_t f) { glTestFenceNV_client_proc_t retval = glTestFenceNV; glTestFenceNV = f; return retval;}
- virtual glGetFenceivNV_client_proc_t set_glGetFenceivNV(glGetFenceivNV_client_proc_t f) { glGetFenceivNV_client_proc_t retval = glGetFenceivNV; glGetFenceivNV = f; return retval;}
- virtual glFinishFenceNV_client_proc_t set_glFinishFenceNV(glFinishFenceNV_client_proc_t f) { glFinishFenceNV_client_proc_t retval = glFinishFenceNV; glFinishFenceNV = f; return retval;}
- virtual glSetFenceNV_client_proc_t set_glSetFenceNV(glSetFenceNV_client_proc_t f) { glSetFenceNV_client_proc_t retval = glSetFenceNV; glSetFenceNV = f; return retval;}
- virtual glCoverageMaskNV_client_proc_t set_glCoverageMaskNV(glCoverageMaskNV_client_proc_t f) { glCoverageMaskNV_client_proc_t retval = glCoverageMaskNV; glCoverageMaskNV = f; return retval;}
- virtual glCoverageOperationNV_client_proc_t set_glCoverageOperationNV(glCoverageOperationNV_client_proc_t f) { glCoverageOperationNV_client_proc_t retval = glCoverageOperationNV; glCoverageOperationNV = f; return retval;}
- virtual glGetDriverControlsQCOM_client_proc_t set_glGetDriverControlsQCOM(glGetDriverControlsQCOM_client_proc_t f) { glGetDriverControlsQCOM_client_proc_t retval = glGetDriverControlsQCOM; glGetDriverControlsQCOM = f; return retval;}
- virtual glGetDriverControlStringQCOM_client_proc_t set_glGetDriverControlStringQCOM(glGetDriverControlStringQCOM_client_proc_t f) { glGetDriverControlStringQCOM_client_proc_t retval = glGetDriverControlStringQCOM; glGetDriverControlStringQCOM = f; return retval;}
- virtual glEnableDriverControlQCOM_client_proc_t set_glEnableDriverControlQCOM(glEnableDriverControlQCOM_client_proc_t f) { glEnableDriverControlQCOM_client_proc_t retval = glEnableDriverControlQCOM; glEnableDriverControlQCOM = f; return retval;}
- virtual glDisableDriverControlQCOM_client_proc_t set_glDisableDriverControlQCOM(glDisableDriverControlQCOM_client_proc_t f) { glDisableDriverControlQCOM_client_proc_t retval = glDisableDriverControlQCOM; glDisableDriverControlQCOM = f; return retval;}
- virtual glExtGetTexturesQCOM_client_proc_t set_glExtGetTexturesQCOM(glExtGetTexturesQCOM_client_proc_t f) { glExtGetTexturesQCOM_client_proc_t retval = glExtGetTexturesQCOM; glExtGetTexturesQCOM = f; return retval;}
- virtual glExtGetBuffersQCOM_client_proc_t set_glExtGetBuffersQCOM(glExtGetBuffersQCOM_client_proc_t f) { glExtGetBuffersQCOM_client_proc_t retval = glExtGetBuffersQCOM; glExtGetBuffersQCOM = f; return retval;}
- virtual glExtGetRenderbuffersQCOM_client_proc_t set_glExtGetRenderbuffersQCOM(glExtGetRenderbuffersQCOM_client_proc_t f) { glExtGetRenderbuffersQCOM_client_proc_t retval = glExtGetRenderbuffersQCOM; glExtGetRenderbuffersQCOM = f; return retval;}
- virtual glExtGetFramebuffersQCOM_client_proc_t set_glExtGetFramebuffersQCOM(glExtGetFramebuffersQCOM_client_proc_t f) { glExtGetFramebuffersQCOM_client_proc_t retval = glExtGetFramebuffersQCOM; glExtGetFramebuffersQCOM = f; return retval;}
- virtual glExtGetTexLevelParameterivQCOM_client_proc_t set_glExtGetTexLevelParameterivQCOM(glExtGetTexLevelParameterivQCOM_client_proc_t f) { glExtGetTexLevelParameterivQCOM_client_proc_t retval = glExtGetTexLevelParameterivQCOM; glExtGetTexLevelParameterivQCOM = f; return retval;}
- virtual glExtTexObjectStateOverrideiQCOM_client_proc_t set_glExtTexObjectStateOverrideiQCOM(glExtTexObjectStateOverrideiQCOM_client_proc_t f) { glExtTexObjectStateOverrideiQCOM_client_proc_t retval = glExtTexObjectStateOverrideiQCOM; glExtTexObjectStateOverrideiQCOM = f; return retval;}
- virtual glExtGetTexSubImageQCOM_client_proc_t set_glExtGetTexSubImageQCOM(glExtGetTexSubImageQCOM_client_proc_t f) { glExtGetTexSubImageQCOM_client_proc_t retval = glExtGetTexSubImageQCOM; glExtGetTexSubImageQCOM = f; return retval;}
- virtual glExtGetBufferPointervQCOM_client_proc_t set_glExtGetBufferPointervQCOM(glExtGetBufferPointervQCOM_client_proc_t f) { glExtGetBufferPointervQCOM_client_proc_t retval = glExtGetBufferPointervQCOM; glExtGetBufferPointervQCOM = f; return retval;}
- virtual glExtGetShadersQCOM_client_proc_t set_glExtGetShadersQCOM(glExtGetShadersQCOM_client_proc_t f) { glExtGetShadersQCOM_client_proc_t retval = glExtGetShadersQCOM; glExtGetShadersQCOM = f; return retval;}
- virtual glExtGetProgramsQCOM_client_proc_t set_glExtGetProgramsQCOM(glExtGetProgramsQCOM_client_proc_t f) { glExtGetProgramsQCOM_client_proc_t retval = glExtGetProgramsQCOM; glExtGetProgramsQCOM = f; return retval;}
- virtual glExtIsProgramBinaryQCOM_client_proc_t set_glExtIsProgramBinaryQCOM(glExtIsProgramBinaryQCOM_client_proc_t f) { glExtIsProgramBinaryQCOM_client_proc_t retval = glExtIsProgramBinaryQCOM; glExtIsProgramBinaryQCOM = f; return retval;}
- virtual glExtGetProgramBinarySourceQCOM_client_proc_t set_glExtGetProgramBinarySourceQCOM(glExtGetProgramBinarySourceQCOM_client_proc_t f) { glExtGetProgramBinarySourceQCOM_client_proc_t retval = glExtGetProgramBinarySourceQCOM; glExtGetProgramBinarySourceQCOM = f; return retval;}
- virtual glStartTilingQCOM_client_proc_t set_glStartTilingQCOM(glStartTilingQCOM_client_proc_t f) { glStartTilingQCOM_client_proc_t retval = glStartTilingQCOM; glStartTilingQCOM = f; return retval;}
- virtual glEndTilingQCOM_client_proc_t set_glEndTilingQCOM(glEndTilingQCOM_client_proc_t f) { glEndTilingQCOM_client_proc_t retval = glEndTilingQCOM; glEndTilingQCOM = f; return retval;}
- virtual glVertexAttribPointerData_client_proc_t set_glVertexAttribPointerData(glVertexAttribPointerData_client_proc_t f) { glVertexAttribPointerData_client_proc_t retval = glVertexAttribPointerData; glVertexAttribPointerData = f; return retval;}
- virtual glVertexAttribPointerOffset_client_proc_t set_glVertexAttribPointerOffset(glVertexAttribPointerOffset_client_proc_t f) { glVertexAttribPointerOffset_client_proc_t retval = glVertexAttribPointerOffset; glVertexAttribPointerOffset = f; return retval;}
- virtual glDrawElementsOffset_client_proc_t set_glDrawElementsOffset(glDrawElementsOffset_client_proc_t f) { glDrawElementsOffset_client_proc_t retval = glDrawElementsOffset; glDrawElementsOffset = f; return retval;}
- virtual glDrawElementsData_client_proc_t set_glDrawElementsData(glDrawElementsData_client_proc_t f) { glDrawElementsData_client_proc_t retval = glDrawElementsData; glDrawElementsData = f; return retval;}
- virtual glGetCompressedTextureFormats_client_proc_t set_glGetCompressedTextureFormats(glGetCompressedTextureFormats_client_proc_t f) { glGetCompressedTextureFormats_client_proc_t retval = glGetCompressedTextureFormats; glGetCompressedTextureFormats = f; return retval;}
- virtual glShaderString_client_proc_t set_glShaderString(glShaderString_client_proc_t f) { glShaderString_client_proc_t retval = glShaderString; glShaderString = f; return retval;}
- virtual glFinishRoundTrip_client_proc_t set_glFinishRoundTrip(glFinishRoundTrip_client_proc_t f) { glFinishRoundTrip_client_proc_t retval = glFinishRoundTrip; glFinishRoundTrip = f; return retval;}
- virtual ~gl2_client_context_t() {}
-
- typedef gl2_client_context_t *CONTEXT_ACCESSOR_TYPE(void);
- static void setContextAccessor(CONTEXT_ACCESSOR_TYPE *f);
- int initDispatchByName( void *(*getProc)(const char *name, void *userData), void *userData);
- virtual void setError(unsigned int error){};
- virtual unsigned int getError(){ return 0; };
-};
-
-#endif
diff --git a/tools/emulator/opengl/system/GLESv2_enc/gl2_client_proc.h b/tools/emulator/opengl/system/GLESv2_enc/gl2_client_proc.h
deleted file mode 100644
index b8ff005f3..000000000
--- a/tools/emulator/opengl/system/GLESv2_enc/gl2_client_proc.h
+++ /dev/null
@@ -1,222 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-#ifndef __gl2_client_proc_t_h
-#define __gl2_client_proc_t_h
-
-
-
-#include "gl2_types.h"
-#ifndef gl2_APIENTRY
-#define gl2_APIENTRY
-#endif
-typedef void (gl2_APIENTRY *glActiveTexture_client_proc_t) (void * ctx, GLenum);
-typedef void (gl2_APIENTRY *glAttachShader_client_proc_t) (void * ctx, GLuint, GLuint);
-typedef void (gl2_APIENTRY *glBindAttribLocation_client_proc_t) (void * ctx, GLuint, GLuint, const GLchar*);
-typedef void (gl2_APIENTRY *glBindBuffer_client_proc_t) (void * ctx, GLenum, GLuint);
-typedef void (gl2_APIENTRY *glBindFramebuffer_client_proc_t) (void * ctx, GLenum, GLuint);
-typedef void (gl2_APIENTRY *glBindRenderbuffer_client_proc_t) (void * ctx, GLenum, GLuint);
-typedef void (gl2_APIENTRY *glBindTexture_client_proc_t) (void * ctx, GLenum, GLuint);
-typedef void (gl2_APIENTRY *glBlendColor_client_proc_t) (void * ctx, GLclampf, GLclampf, GLclampf, GLclampf);
-typedef void (gl2_APIENTRY *glBlendEquation_client_proc_t) (void * ctx, GLenum);
-typedef void (gl2_APIENTRY *glBlendEquationSeparate_client_proc_t) (void * ctx, GLenum, GLenum);
-typedef void (gl2_APIENTRY *glBlendFunc_client_proc_t) (void * ctx, GLenum, GLenum);
-typedef void (gl2_APIENTRY *glBlendFuncSeparate_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLenum);
-typedef void (gl2_APIENTRY *glBufferData_client_proc_t) (void * ctx, GLenum, GLsizeiptr, const GLvoid*, GLenum);
-typedef void (gl2_APIENTRY *glBufferSubData_client_proc_t) (void * ctx, GLenum, GLintptr, GLsizeiptr, const GLvoid*);
-typedef GLenum (gl2_APIENTRY *glCheckFramebufferStatus_client_proc_t) (void * ctx, GLenum);
-typedef void (gl2_APIENTRY *glClear_client_proc_t) (void * ctx, GLbitfield);
-typedef void (gl2_APIENTRY *glClearColor_client_proc_t) (void * ctx, GLclampf, GLclampf, GLclampf, GLclampf);
-typedef void (gl2_APIENTRY *glClearDepthf_client_proc_t) (void * ctx, GLclampf);
-typedef void (gl2_APIENTRY *glClearStencil_client_proc_t) (void * ctx, GLint);
-typedef void (gl2_APIENTRY *glColorMask_client_proc_t) (void * ctx, GLboolean, GLboolean, GLboolean, GLboolean);
-typedef void (gl2_APIENTRY *glCompileShader_client_proc_t) (void * ctx, GLuint);
-typedef void (gl2_APIENTRY *glCompressedTexImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*);
-typedef void (gl2_APIENTRY *glCompressedTexSubImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*);
-typedef void (gl2_APIENTRY *glCopyTexImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
-typedef void (gl2_APIENTRY *glCopyTexSubImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
-typedef GLuint (gl2_APIENTRY *glCreateProgram_client_proc_t) (void * ctx);
-typedef GLuint (gl2_APIENTRY *glCreateShader_client_proc_t) (void * ctx, GLenum);
-typedef void (gl2_APIENTRY *glCullFace_client_proc_t) (void * ctx, GLenum);
-typedef void (gl2_APIENTRY *glDeleteBuffers_client_proc_t) (void * ctx, GLsizei, const GLuint*);
-typedef void (gl2_APIENTRY *glDeleteFramebuffers_client_proc_t) (void * ctx, GLsizei, const GLuint*);
-typedef void (gl2_APIENTRY *glDeleteProgram_client_proc_t) (void * ctx, GLuint);
-typedef void (gl2_APIENTRY *glDeleteRenderbuffers_client_proc_t) (void * ctx, GLsizei, const GLuint*);
-typedef void (gl2_APIENTRY *glDeleteShader_client_proc_t) (void * ctx, GLuint);
-typedef void (gl2_APIENTRY *glDeleteTextures_client_proc_t) (void * ctx, GLsizei, const GLuint*);
-typedef void (gl2_APIENTRY *glDepthFunc_client_proc_t) (void * ctx, GLenum);
-typedef void (gl2_APIENTRY *glDepthMask_client_proc_t) (void * ctx, GLboolean);
-typedef void (gl2_APIENTRY *glDepthRangef_client_proc_t) (void * ctx, GLclampf, GLclampf);
-typedef void (gl2_APIENTRY *glDetachShader_client_proc_t) (void * ctx, GLuint, GLuint);
-typedef void (gl2_APIENTRY *glDisable_client_proc_t) (void * ctx, GLenum);
-typedef void (gl2_APIENTRY *glDisableVertexAttribArray_client_proc_t) (void * ctx, GLuint);
-typedef void (gl2_APIENTRY *glDrawArrays_client_proc_t) (void * ctx, GLenum, GLint, GLsizei);
-typedef void (gl2_APIENTRY *glDrawElements_client_proc_t) (void * ctx, GLenum, GLsizei, GLenum, const GLvoid*);
-typedef void (gl2_APIENTRY *glEnable_client_proc_t) (void * ctx, GLenum);
-typedef void (gl2_APIENTRY *glEnableVertexAttribArray_client_proc_t) (void * ctx, GLuint);
-typedef void (gl2_APIENTRY *glFinish_client_proc_t) (void * ctx);
-typedef void (gl2_APIENTRY *glFlush_client_proc_t) (void * ctx);
-typedef void (gl2_APIENTRY *glFramebufferRenderbuffer_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLuint);
-typedef void (gl2_APIENTRY *glFramebufferTexture2D_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLuint, GLint);
-typedef void (gl2_APIENTRY *glFrontFace_client_proc_t) (void * ctx, GLenum);
-typedef void (gl2_APIENTRY *glGenBuffers_client_proc_t) (void * ctx, GLsizei, GLuint*);
-typedef void (gl2_APIENTRY *glGenerateMipmap_client_proc_t) (void * ctx, GLenum);
-typedef void (gl2_APIENTRY *glGenFramebuffers_client_proc_t) (void * ctx, GLsizei, GLuint*);
-typedef void (gl2_APIENTRY *glGenRenderbuffers_client_proc_t) (void * ctx, GLsizei, GLuint*);
-typedef void (gl2_APIENTRY *glGenTextures_client_proc_t) (void * ctx, GLsizei, GLuint*);
-typedef void (gl2_APIENTRY *glGetActiveAttrib_client_proc_t) (void * ctx, GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*);
-typedef void (gl2_APIENTRY *glGetActiveUniform_client_proc_t) (void * ctx, GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*);
-typedef void (gl2_APIENTRY *glGetAttachedShaders_client_proc_t) (void * ctx, GLuint, GLsizei, GLsizei*, GLuint*);
-typedef int (gl2_APIENTRY *glGetAttribLocation_client_proc_t) (void * ctx, GLuint, const GLchar*);
-typedef void (gl2_APIENTRY *glGetBooleanv_client_proc_t) (void * ctx, GLenum, GLboolean*);
-typedef void (gl2_APIENTRY *glGetBufferParameteriv_client_proc_t) (void * ctx, GLenum, GLenum, GLint*);
-typedef GLenum (gl2_APIENTRY *glGetError_client_proc_t) (void * ctx);
-typedef void (gl2_APIENTRY *glGetFloatv_client_proc_t) (void * ctx, GLenum, GLfloat*);
-typedef void (gl2_APIENTRY *glGetFramebufferAttachmentParameteriv_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLint*);
-typedef void (gl2_APIENTRY *glGetIntegerv_client_proc_t) (void * ctx, GLenum, GLint*);
-typedef void (gl2_APIENTRY *glGetProgramiv_client_proc_t) (void * ctx, GLuint, GLenum, GLint*);
-typedef void (gl2_APIENTRY *glGetProgramInfoLog_client_proc_t) (void * ctx, GLuint, GLsizei, GLsizei*, GLchar*);
-typedef void (gl2_APIENTRY *glGetRenderbufferParameteriv_client_proc_t) (void * ctx, GLenum, GLenum, GLint*);
-typedef void (gl2_APIENTRY *glGetShaderiv_client_proc_t) (void * ctx, GLuint, GLenum, GLint*);
-typedef void (gl2_APIENTRY *glGetShaderInfoLog_client_proc_t) (void * ctx, GLuint, GLsizei, GLsizei*, GLchar*);
-typedef void (gl2_APIENTRY *glGetShaderPrecisionFormat_client_proc_t) (void * ctx, GLenum, GLenum, GLint*, GLint*);
-typedef void (gl2_APIENTRY *glGetShaderSource_client_proc_t) (void * ctx, GLuint, GLsizei, GLsizei*, GLchar*);
-typedef const GLubyte* (gl2_APIENTRY *glGetString_client_proc_t) (void * ctx, GLenum);
-typedef void (gl2_APIENTRY *glGetTexParameterfv_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat*);
-typedef void (gl2_APIENTRY *glGetTexParameteriv_client_proc_t) (void * ctx, GLenum, GLenum, GLint*);
-typedef void (gl2_APIENTRY *glGetUniformfv_client_proc_t) (void * ctx, GLuint, GLint, GLfloat*);
-typedef void (gl2_APIENTRY *glGetUniformiv_client_proc_t) (void * ctx, GLuint, GLint, GLint*);
-typedef int (gl2_APIENTRY *glGetUniformLocation_client_proc_t) (void * ctx, GLuint, const GLchar*);
-typedef void (gl2_APIENTRY *glGetVertexAttribfv_client_proc_t) (void * ctx, GLuint, GLenum, GLfloat*);
-typedef void (gl2_APIENTRY *glGetVertexAttribiv_client_proc_t) (void * ctx, GLuint, GLenum, GLint*);
-typedef void (gl2_APIENTRY *glGetVertexAttribPointerv_client_proc_t) (void * ctx, GLuint, GLenum, GLvoid**);
-typedef void (gl2_APIENTRY *glHint_client_proc_t) (void * ctx, GLenum, GLenum);
-typedef GLboolean (gl2_APIENTRY *glIsBuffer_client_proc_t) (void * ctx, GLuint);
-typedef GLboolean (gl2_APIENTRY *glIsEnabled_client_proc_t) (void * ctx, GLenum);
-typedef GLboolean (gl2_APIENTRY *glIsFramebuffer_client_proc_t) (void * ctx, GLuint);
-typedef GLboolean (gl2_APIENTRY *glIsProgram_client_proc_t) (void * ctx, GLuint);
-typedef GLboolean (gl2_APIENTRY *glIsRenderbuffer_client_proc_t) (void * ctx, GLuint);
-typedef GLboolean (gl2_APIENTRY *glIsShader_client_proc_t) (void * ctx, GLuint);
-typedef GLboolean (gl2_APIENTRY *glIsTexture_client_proc_t) (void * ctx, GLuint);
-typedef void (gl2_APIENTRY *glLineWidth_client_proc_t) (void * ctx, GLfloat);
-typedef void (gl2_APIENTRY *glLinkProgram_client_proc_t) (void * ctx, GLuint);
-typedef void (gl2_APIENTRY *glPixelStorei_client_proc_t) (void * ctx, GLenum, GLint);
-typedef void (gl2_APIENTRY *glPolygonOffset_client_proc_t) (void * ctx, GLfloat, GLfloat);
-typedef void (gl2_APIENTRY *glReadPixels_client_proc_t) (void * ctx, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*);
-typedef void (gl2_APIENTRY *glReleaseShaderCompiler_client_proc_t) (void * ctx);
-typedef void (gl2_APIENTRY *glRenderbufferStorage_client_proc_t) (void * ctx, GLenum, GLenum, GLsizei, GLsizei);
-typedef void (gl2_APIENTRY *glSampleCoverage_client_proc_t) (void * ctx, GLclampf, GLboolean);
-typedef void (gl2_APIENTRY *glScissor_client_proc_t) (void * ctx, GLint, GLint, GLsizei, GLsizei);
-typedef void (gl2_APIENTRY *glShaderBinary_client_proc_t) (void * ctx, GLsizei, const GLuint*, GLenum, const GLvoid*, GLsizei);
-typedef void (gl2_APIENTRY *glShaderSource_client_proc_t) (void * ctx, GLuint, GLsizei, const GLchar**, const GLint*);
-typedef void (gl2_APIENTRY *glStencilFunc_client_proc_t) (void * ctx, GLenum, GLint, GLuint);
-typedef void (gl2_APIENTRY *glStencilFuncSeparate_client_proc_t) (void * ctx, GLenum, GLenum, GLint, GLuint);
-typedef void (gl2_APIENTRY *glStencilMask_client_proc_t) (void * ctx, GLuint);
-typedef void (gl2_APIENTRY *glStencilMaskSeparate_client_proc_t) (void * ctx, GLenum, GLuint);
-typedef void (gl2_APIENTRY *glStencilOp_client_proc_t) (void * ctx, GLenum, GLenum, GLenum);
-typedef void (gl2_APIENTRY *glStencilOpSeparate_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLenum);
-typedef void (gl2_APIENTRY *glTexImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*);
-typedef void (gl2_APIENTRY *glTexParameterf_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat);
-typedef void (gl2_APIENTRY *glTexParameterfv_client_proc_t) (void * ctx, GLenum, GLenum, const GLfloat*);
-typedef void (gl2_APIENTRY *glTexParameteri_client_proc_t) (void * ctx, GLenum, GLenum, GLint);
-typedef void (gl2_APIENTRY *glTexParameteriv_client_proc_t) (void * ctx, GLenum, GLenum, const GLint*);
-typedef void (gl2_APIENTRY *glTexSubImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*);
-typedef void (gl2_APIENTRY *glUniform1f_client_proc_t) (void * ctx, GLint, GLfloat);
-typedef void (gl2_APIENTRY *glUniform1fv_client_proc_t) (void * ctx, GLint, GLsizei, const GLfloat*);
-typedef void (gl2_APIENTRY *glUniform1i_client_proc_t) (void * ctx, GLint, GLint);
-typedef void (gl2_APIENTRY *glUniform1iv_client_proc_t) (void * ctx, GLint, GLsizei, const GLint*);
-typedef void (gl2_APIENTRY *glUniform2f_client_proc_t) (void * ctx, GLint, GLfloat, GLfloat);
-typedef void (gl2_APIENTRY *glUniform2fv_client_proc_t) (void * ctx, GLint, GLsizei, const GLfloat*);
-typedef void (gl2_APIENTRY *glUniform2i_client_proc_t) (void * ctx, GLint, GLint, GLint);
-typedef void (gl2_APIENTRY *glUniform2iv_client_proc_t) (void * ctx, GLint, GLsizei, const GLint*);
-typedef void (gl2_APIENTRY *glUniform3f_client_proc_t) (void * ctx, GLint, GLfloat, GLfloat, GLfloat);
-typedef void (gl2_APIENTRY *glUniform3fv_client_proc_t) (void * ctx, GLint, GLsizei, const GLfloat*);
-typedef void (gl2_APIENTRY *glUniform3i_client_proc_t) (void * ctx, GLint, GLint, GLint, GLint);
-typedef void (gl2_APIENTRY *glUniform3iv_client_proc_t) (void * ctx, GLint, GLsizei, const GLint*);
-typedef void (gl2_APIENTRY *glUniform4f_client_proc_t) (void * ctx, GLint, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (gl2_APIENTRY *glUniform4fv_client_proc_t) (void * ctx, GLint, GLsizei, const GLfloat*);
-typedef void (gl2_APIENTRY *glUniform4i_client_proc_t) (void * ctx, GLint, GLint, GLint, GLint, GLint);
-typedef void (gl2_APIENTRY *glUniform4iv_client_proc_t) (void * ctx, GLint, GLsizei, const GLint*);
-typedef void (gl2_APIENTRY *glUniformMatrix2fv_client_proc_t) (void * ctx, GLint, GLsizei, GLboolean, const GLfloat*);
-typedef void (gl2_APIENTRY *glUniformMatrix3fv_client_proc_t) (void * ctx, GLint, GLsizei, GLboolean, const GLfloat*);
-typedef void (gl2_APIENTRY *glUniformMatrix4fv_client_proc_t) (void * ctx, GLint, GLsizei, GLboolean, const GLfloat*);
-typedef void (gl2_APIENTRY *glUseProgram_client_proc_t) (void * ctx, GLuint);
-typedef void (gl2_APIENTRY *glValidateProgram_client_proc_t) (void * ctx, GLuint);
-typedef void (gl2_APIENTRY *glVertexAttrib1f_client_proc_t) (void * ctx, GLuint, GLfloat);
-typedef void (gl2_APIENTRY *glVertexAttrib1fv_client_proc_t) (void * ctx, GLuint, const GLfloat*);
-typedef void (gl2_APIENTRY *glVertexAttrib2f_client_proc_t) (void * ctx, GLuint, GLfloat, GLfloat);
-typedef void (gl2_APIENTRY *glVertexAttrib2fv_client_proc_t) (void * ctx, GLuint, const GLfloat*);
-typedef void (gl2_APIENTRY *glVertexAttrib3f_client_proc_t) (void * ctx, GLuint, GLfloat, GLfloat, GLfloat);
-typedef void (gl2_APIENTRY *glVertexAttrib3fv_client_proc_t) (void * ctx, GLuint, const GLfloat*);
-typedef void (gl2_APIENTRY *glVertexAttrib4f_client_proc_t) (void * ctx, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (gl2_APIENTRY *glVertexAttrib4fv_client_proc_t) (void * ctx, GLuint, const GLfloat*);
-typedef void (gl2_APIENTRY *glVertexAttribPointer_client_proc_t) (void * ctx, GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid*);
-typedef void (gl2_APIENTRY *glViewport_client_proc_t) (void * ctx, GLint, GLint, GLsizei, GLsizei);
-typedef void (gl2_APIENTRY *glEGLImageTargetTexture2DOES_client_proc_t) (void * ctx, GLenum, GLeglImageOES);
-typedef void (gl2_APIENTRY *glEGLImageTargetRenderbufferStorageOES_client_proc_t) (void * ctx, GLenum, GLeglImageOES);
-typedef void (gl2_APIENTRY *glGetProgramBinaryOES_client_proc_t) (void * ctx, GLuint, GLsizei, GLsizei*, GLenum*, GLvoid*);
-typedef void (gl2_APIENTRY *glProgramBinaryOES_client_proc_t) (void * ctx, GLuint, GLenum, const GLvoid*, GLint);
-typedef void* (gl2_APIENTRY *glMapBufferOES_client_proc_t) (void * ctx, GLenum, GLenum);
-typedef GLboolean (gl2_APIENTRY *glUnmapBufferOES_client_proc_t) (void * ctx, GLenum);
-typedef void (gl2_APIENTRY *glTexImage3DOES_client_proc_t) (void * ctx, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*);
-typedef void (gl2_APIENTRY *glTexSubImage3DOES_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*);
-typedef void (gl2_APIENTRY *glCopyTexSubImage3DOES_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
-typedef void (gl2_APIENTRY *glCompressedTexImage3DOES_client_proc_t) (void * ctx, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*);
-typedef void (gl2_APIENTRY *glCompressedTexSubImage3DOES_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*);
-typedef void (gl2_APIENTRY *glFramebufferTexture3DOES_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLuint, GLint, GLint);
-typedef void (gl2_APIENTRY *glBindVertexArrayOES_client_proc_t) (void * ctx, GLuint);
-typedef void (gl2_APIENTRY *glDeleteVertexArraysOES_client_proc_t) (void * ctx, GLsizei, const GLuint*);
-typedef void (gl2_APIENTRY *glGenVertexArraysOES_client_proc_t) (void * ctx, GLsizei, GLuint*);
-typedef GLboolean (gl2_APIENTRY *glIsVertexArrayOES_client_proc_t) (void * ctx, GLuint);
-typedef void (gl2_APIENTRY *glDiscardFramebufferEXT_client_proc_t) (void * ctx, GLenum, GLsizei, const GLenum*);
-typedef void (gl2_APIENTRY *glMultiDrawArraysEXT_client_proc_t) (void * ctx, GLenum, GLint*, GLsizei*, GLsizei);
-typedef void (gl2_APIENTRY *glMultiDrawElementsEXT_client_proc_t) (void * ctx, GLenum, const GLsizei*, GLenum, const GLvoid**, GLsizei);
-typedef void (gl2_APIENTRY *glGetPerfMonitorGroupsAMD_client_proc_t) (void * ctx, GLint*, GLsizei, GLuint*);
-typedef void (gl2_APIENTRY *glGetPerfMonitorCountersAMD_client_proc_t) (void * ctx, GLuint, GLint*, GLint*, GLsizei, GLuint*);
-typedef void (gl2_APIENTRY *glGetPerfMonitorGroupStringAMD_client_proc_t) (void * ctx, GLuint, GLsizei, GLsizei*, GLchar*);
-typedef void (gl2_APIENTRY *glGetPerfMonitorCounterStringAMD_client_proc_t) (void * ctx, GLuint, GLuint, GLsizei, GLsizei*, GLchar*);
-typedef void (gl2_APIENTRY *glGetPerfMonitorCounterInfoAMD_client_proc_t) (void * ctx, GLuint, GLuint, GLenum, GLvoid*);
-typedef void (gl2_APIENTRY *glGenPerfMonitorsAMD_client_proc_t) (void * ctx, GLsizei, GLuint*);
-typedef void (gl2_APIENTRY *glDeletePerfMonitorsAMD_client_proc_t) (void * ctx, GLsizei, GLuint*);
-typedef void (gl2_APIENTRY *glSelectPerfMonitorCountersAMD_client_proc_t) (void * ctx, GLuint, GLboolean, GLuint, GLint, GLuint*);
-typedef void (gl2_APIENTRY *glBeginPerfMonitorAMD_client_proc_t) (void * ctx, GLuint);
-typedef void (gl2_APIENTRY *glEndPerfMonitorAMD_client_proc_t) (void * ctx, GLuint);
-typedef void (gl2_APIENTRY *glGetPerfMonitorCounterDataAMD_client_proc_t) (void * ctx, GLuint, GLenum, GLsizei, GLuint*, GLint*);
-typedef void (gl2_APIENTRY *glRenderbufferStorageMultisampleIMG_client_proc_t) (void * ctx, GLenum, GLsizei, GLenum, GLsizei, GLsizei);
-typedef void (gl2_APIENTRY *glFramebufferTexture2DMultisampleIMG_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
-typedef void (gl2_APIENTRY *glDeleteFencesNV_client_proc_t) (void * ctx, GLsizei, const GLuint*);
-typedef void (gl2_APIENTRY *glGenFencesNV_client_proc_t) (void * ctx, GLsizei, GLuint*);
-typedef GLboolean (gl2_APIENTRY *glIsFenceNV_client_proc_t) (void * ctx, GLuint);
-typedef GLboolean (gl2_APIENTRY *glTestFenceNV_client_proc_t) (void * ctx, GLuint);
-typedef void (gl2_APIENTRY *glGetFenceivNV_client_proc_t) (void * ctx, GLuint, GLenum, GLint*);
-typedef void (gl2_APIENTRY *glFinishFenceNV_client_proc_t) (void * ctx, GLuint);
-typedef void (gl2_APIENTRY *glSetFenceNV_client_proc_t) (void * ctx, GLuint, GLenum);
-typedef void (gl2_APIENTRY *glCoverageMaskNV_client_proc_t) (void * ctx, GLboolean);
-typedef void (gl2_APIENTRY *glCoverageOperationNV_client_proc_t) (void * ctx, GLenum);
-typedef void (gl2_APIENTRY *glGetDriverControlsQCOM_client_proc_t) (void * ctx, GLint*, GLsizei, GLuint*);
-typedef void (gl2_APIENTRY *glGetDriverControlStringQCOM_client_proc_t) (void * ctx, GLuint, GLsizei, GLsizei*, GLchar*);
-typedef void (gl2_APIENTRY *glEnableDriverControlQCOM_client_proc_t) (void * ctx, GLuint);
-typedef void (gl2_APIENTRY *glDisableDriverControlQCOM_client_proc_t) (void * ctx, GLuint);
-typedef void (gl2_APIENTRY *glExtGetTexturesQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
-typedef void (gl2_APIENTRY *glExtGetBuffersQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
-typedef void (gl2_APIENTRY *glExtGetRenderbuffersQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
-typedef void (gl2_APIENTRY *glExtGetFramebuffersQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
-typedef void (gl2_APIENTRY *glExtGetTexLevelParameterivQCOM_client_proc_t) (void * ctx, GLuint, GLenum, GLint, GLenum, GLint*);
-typedef void (gl2_APIENTRY *glExtTexObjectStateOverrideiQCOM_client_proc_t) (void * ctx, GLenum, GLenum, GLint);
-typedef void (gl2_APIENTRY *glExtGetTexSubImageQCOM_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLvoid*);
-typedef void (gl2_APIENTRY *glExtGetBufferPointervQCOM_client_proc_t) (void * ctx, GLenum, GLvoidptr*);
-typedef void (gl2_APIENTRY *glExtGetShadersQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
-typedef void (gl2_APIENTRY *glExtGetProgramsQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
-typedef GLboolean (gl2_APIENTRY *glExtIsProgramBinaryQCOM_client_proc_t) (void * ctx, GLuint);
-typedef void (gl2_APIENTRY *glExtGetProgramBinarySourceQCOM_client_proc_t) (void * ctx, GLuint, GLenum, GLchar*, GLint*);
-typedef void (gl2_APIENTRY *glStartTilingQCOM_client_proc_t) (void * ctx, GLuint, GLuint, GLuint, GLuint, GLbitfield);
-typedef void (gl2_APIENTRY *glEndTilingQCOM_client_proc_t) (void * ctx, GLbitfield);
-typedef void (gl2_APIENTRY *glVertexAttribPointerData_client_proc_t) (void * ctx, GLuint, GLint, GLenum, GLboolean, GLsizei, void*, GLuint);
-typedef void (gl2_APIENTRY *glVertexAttribPointerOffset_client_proc_t) (void * ctx, GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint);
-typedef void (gl2_APIENTRY *glDrawElementsOffset_client_proc_t) (void * ctx, GLenum, GLsizei, GLenum, GLuint);
-typedef void (gl2_APIENTRY *glDrawElementsData_client_proc_t) (void * ctx, GLenum, GLsizei, GLenum, void*, GLuint);
-typedef void (gl2_APIENTRY *glGetCompressedTextureFormats_client_proc_t) (void * ctx, int, GLint*);
-typedef void (gl2_APIENTRY *glShaderString_client_proc_t) (void * ctx, GLuint, const GLchar*, GLsizei);
-typedef int (gl2_APIENTRY *glFinishRoundTrip_client_proc_t) (void * ctx);
-
-
-#endif
diff --git a/tools/emulator/opengl/system/GLESv2_enc/gl2_enc.cpp b/tools/emulator/opengl/system/GLESv2_enc/gl2_enc.cpp
deleted file mode 100644
index 46684e9f0..000000000
--- a/tools/emulator/opengl/system/GLESv2_enc/gl2_enc.cpp
+++ /dev/null
@@ -1,3130 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-
-
-#include <string.h>
-#include "gl2_opcodes.h"
-
-#include "gl2_enc.h"
-
-
-#include <stdio.h>
-static void enc_unsupported()
-{
- ALOGE("Function is unsupported\n");
-}
-
-void glActiveTexture_enc(void *self , GLenum texture)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glActiveTexture;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &texture, 4); ptr += 4;
-}
-
-void glAttachShader_enc(void *self , GLuint program, GLuint shader)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glAttachShader;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &program, 4); ptr += 4;
- memcpy(ptr, &shader, 4); ptr += 4;
-}
-
-void glBindAttribLocation_enc(void *self , GLuint program, GLuint index, const GLchar* name)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_name = (strlen(name) + 1);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_name + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBindAttribLocation;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &program, 4); ptr += 4;
- memcpy(ptr, &index, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_name; ptr += 4;
- memcpy(ptr, name, __size_name);ptr += __size_name;
-}
-
-void glBindBuffer_enc(void *self , GLenum target, GLuint buffer)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBindBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &buffer, 4); ptr += 4;
-}
-
-void glBindFramebuffer_enc(void *self , GLenum target, GLuint framebuffer)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBindFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &framebuffer, 4); ptr += 4;
-}
-
-void glBindRenderbuffer_enc(void *self , GLenum target, GLuint renderbuffer)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBindRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &renderbuffer, 4); ptr += 4;
-}
-
-void glBindTexture_enc(void *self , GLenum target, GLuint texture)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBindTexture;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &texture, 4); ptr += 4;
-}
-
-void glBlendColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBlendColor;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &red, 4); ptr += 4;
- memcpy(ptr, &green, 4); ptr += 4;
- memcpy(ptr, &blue, 4); ptr += 4;
- memcpy(ptr, &alpha, 4); ptr += 4;
-}
-
-void glBlendEquation_enc(void *self , GLenum mode)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBlendEquation;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &mode, 4); ptr += 4;
-}
-
-void glBlendEquationSeparate_enc(void *self , GLenum modeRGB, GLenum modeAlpha)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBlendEquationSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &modeRGB, 4); ptr += 4;
- memcpy(ptr, &modeAlpha, 4); ptr += 4;
-}
-
-void glBlendFunc_enc(void *self , GLenum sfactor, GLenum dfactor)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBlendFunc;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &sfactor, 4); ptr += 4;
- memcpy(ptr, &dfactor, 4); ptr += 4;
-}
-
-void glBlendFuncSeparate_enc(void *self , GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBlendFuncSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &srcRGB, 4); ptr += 4;
- memcpy(ptr, &dstRGB, 4); ptr += 4;
- memcpy(ptr, &srcAlpha, 4); ptr += 4;
- memcpy(ptr, &dstAlpha, 4); ptr += 4;
-}
-
-void glBufferData_enc(void *self , GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = ((data != NULL) ? size : 0);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_data + 4 + 1*4;
- ptr = stream->alloc(8 + 4 + 4);
- int tmp = OP_glBufferData;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &size, 4); ptr += 4;
- stream->flush();
- stream->writeFully(&__size_data,4);
- if (data != NULL) stream->writeFully(data, __size_data);
- ptr = stream->alloc(4);
- memcpy(ptr, &usage, 4); ptr += 4;
-}
-
-void glBufferSubData_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = size;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + __size_data + 1*4;
- ptr = stream->alloc(8 + 4 + 4 + 4);
- int tmp = OP_glBufferSubData;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &offset, 4); ptr += 4;
- memcpy(ptr, &size, 4); ptr += 4;
- stream->flush();
- stream->writeFully(&__size_data,4);
- stream->writeFully(data, __size_data);
-}
-
-GLenum glCheckFramebufferStatus_enc(void *self , GLenum target)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glCheckFramebufferStatus;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
-
- GLenum retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-void glClear_enc(void *self , GLbitfield mask)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClear;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &mask, 4); ptr += 4;
-}
-
-void glClearColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClearColor;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &red, 4); ptr += 4;
- memcpy(ptr, &green, 4); ptr += 4;
- memcpy(ptr, &blue, 4); ptr += 4;
- memcpy(ptr, &alpha, 4); ptr += 4;
-}
-
-void glClearDepthf_enc(void *self , GLclampf depth)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClearDepthf;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &depth, 4); ptr += 4;
-}
-
-void glClearStencil_enc(void *self , GLint s)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glClearStencil;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &s, 4); ptr += 4;
-}
-
-void glColorMask_enc(void *self , GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 1 + 1 + 1 + 1;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glColorMask;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &red, 1); ptr += 1;
- memcpy(ptr, &green, 1); ptr += 1;
- memcpy(ptr, &blue, 1); ptr += 1;
- memcpy(ptr, &alpha, 1); ptr += 1;
-}
-
-void glCompileShader_enc(void *self , GLuint shader)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glCompileShader;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &shader, 4); ptr += 4;
-}
-
-void glCompressedTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
- ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
- int tmp = OP_glCompressedTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &internalformat, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &border, 4); ptr += 4;
- memcpy(ptr, &imageSize, 4); ptr += 4;
- stream->flush();
- stream->writeFully(&__size_data,4);
- if (data != NULL) stream->writeFully(data, __size_data);
-}
-
-void glCompressedTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = imageSize;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
- ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
- int tmp = OP_glCompressedTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &xoffset, 4); ptr += 4;
- memcpy(ptr, &yoffset, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &format, 4); ptr += 4;
- memcpy(ptr, &imageSize, 4); ptr += 4;
- stream->flush();
- stream->writeFully(&__size_data,4);
- stream->writeFully(data, __size_data);
-}
-
-void glCopyTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glCopyTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &internalformat, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &border, 4); ptr += 4;
-}
-
-void glCopyTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glCopyTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &xoffset, 4); ptr += 4;
- memcpy(ptr, &yoffset, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
-}
-
-GLuint glCreateProgram_enc(void *self )
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 0;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glCreateProgram;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
-
- GLuint retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-GLuint glCreateShader_enc(void *self , GLenum type)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glCreateShader;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &type, 4); ptr += 4;
-
- GLuint retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-void glCullFace_enc(void *self , GLenum mode)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glCullFace;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &mode, 4); ptr += 4;
-}
-
-void glDeleteBuffers_enc(void *self , GLsizei n, const GLuint* buffers)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_buffers = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_buffers + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDeleteBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_buffers; ptr += 4;
- memcpy(ptr, buffers, __size_buffers);ptr += __size_buffers;
-}
-
-void glDeleteFramebuffers_enc(void *self , GLsizei n, const GLuint* framebuffers)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_framebuffers = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_framebuffers + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDeleteFramebuffers;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_framebuffers; ptr += 4;
- memcpy(ptr, framebuffers, __size_framebuffers);ptr += __size_framebuffers;
-}
-
-void glDeleteProgram_enc(void *self , GLuint program)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDeleteProgram;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &program, 4); ptr += 4;
-}
-
-void glDeleteRenderbuffers_enc(void *self , GLsizei n, const GLuint* renderbuffers)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_renderbuffers = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_renderbuffers + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDeleteRenderbuffers;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4;
- memcpy(ptr, renderbuffers, __size_renderbuffers);ptr += __size_renderbuffers;
-}
-
-void glDeleteShader_enc(void *self , GLuint shader)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDeleteShader;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &shader, 4); ptr += 4;
-}
-
-void glDeleteTextures_enc(void *self , GLsizei n, const GLuint* textures)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_textures = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_textures + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDeleteTextures;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_textures; ptr += 4;
- memcpy(ptr, textures, __size_textures);ptr += __size_textures;
-}
-
-void glDepthFunc_enc(void *self , GLenum func)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDepthFunc;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &func, 4); ptr += 4;
-}
-
-void glDepthMask_enc(void *self , GLboolean flag)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 1;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDepthMask;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &flag, 1); ptr += 1;
-}
-
-void glDepthRangef_enc(void *self , GLclampf zNear, GLclampf zFar)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDepthRangef;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &zNear, 4); ptr += 4;
- memcpy(ptr, &zFar, 4); ptr += 4;
-}
-
-void glDetachShader_enc(void *self , GLuint program, GLuint shader)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDetachShader;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &program, 4); ptr += 4;
- memcpy(ptr, &shader, 4); ptr += 4;
-}
-
-void glDisable_enc(void *self , GLenum cap)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDisable;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &cap, 4); ptr += 4;
-}
-
-void glDisableVertexAttribArray_enc(void *self , GLuint index)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDisableVertexAttribArray;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &index, 4); ptr += 4;
-}
-
-void glDrawArrays_enc(void *self , GLenum mode, GLint first, GLsizei count)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDrawArrays;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &mode, 4); ptr += 4;
- memcpy(ptr, &first, 4); ptr += 4;
- memcpy(ptr, &count, 4); ptr += 4;
-}
-
-void glEnable_enc(void *self , GLenum cap)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glEnable;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &cap, 4); ptr += 4;
-}
-
-void glEnableVertexAttribArray_enc(void *self , GLuint index)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glEnableVertexAttribArray;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &index, 4); ptr += 4;
-}
-
-void glFinish_enc(void *self )
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 0;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFinish;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
-}
-
-void glFlush_enc(void *self )
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 0;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFlush;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
-}
-
-void glFramebufferRenderbuffer_enc(void *self , GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFramebufferRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &attachment, 4); ptr += 4;
- memcpy(ptr, &renderbuffertarget, 4); ptr += 4;
- memcpy(ptr, &renderbuffer, 4); ptr += 4;
-}
-
-void glFramebufferTexture2D_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFramebufferTexture2D;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &attachment, 4); ptr += 4;
- memcpy(ptr, &textarget, 4); ptr += 4;
- memcpy(ptr, &texture, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
-}
-
-void glFrontFace_enc(void *self , GLenum mode)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFrontFace;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &mode, 4); ptr += 4;
-}
-
-void glGenBuffers_enc(void *self , GLsizei n, GLuint* buffers)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_buffers = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_buffers + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGenBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_buffers; ptr += 4;
- stream->readback(buffers, __size_buffers);
-}
-
-void glGenerateMipmap_enc(void *self , GLenum target)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGenerateMipmap;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
-}
-
-void glGenFramebuffers_enc(void *self , GLsizei n, GLuint* framebuffers)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_framebuffers = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_framebuffers + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGenFramebuffers;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_framebuffers; ptr += 4;
- stream->readback(framebuffers, __size_framebuffers);
-}
-
-void glGenRenderbuffers_enc(void *self , GLsizei n, GLuint* renderbuffers)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_renderbuffers = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_renderbuffers + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGenRenderbuffers;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4;
- stream->readback(renderbuffers, __size_renderbuffers);
-}
-
-void glGenTextures_enc(void *self , GLsizei n, GLuint* textures)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_textures = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_textures + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGenTextures;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_textures; ptr += 4;
- stream->readback(textures, __size_textures);
-}
-
-void glGetActiveAttrib_enc(void *self , GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
- const unsigned int __size_size = (sizeof(GLint));
- const unsigned int __size_type = (sizeof(GLenum));
- const unsigned int __size_name = ((name != NULL) ? bufsize : 0);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + __size_length + __size_size + __size_type + __size_name + 4*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetActiveAttrib;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &program, 4); ptr += 4;
- memcpy(ptr, &index, 4); ptr += 4;
- memcpy(ptr, &bufsize, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_length; ptr += 4;
- *(unsigned int *)(ptr) = __size_size; ptr += 4;
- *(unsigned int *)(ptr) = __size_type; ptr += 4;
- *(unsigned int *)(ptr) = __size_name; ptr += 4;
- if (length != NULL) stream->readback(length, __size_length);
- stream->readback(size, __size_size);
- stream->readback(type, __size_type);
- if (name != NULL) stream->readback(name, __size_name);
-}
-
-void glGetActiveUniform_enc(void *self , GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
- const unsigned int __size_size = (sizeof(GLint));
- const unsigned int __size_type = (sizeof(GLenum));
- const unsigned int __size_name = ((name != NULL) ? bufsize : 0);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + __size_length + __size_size + __size_type + __size_name + 4*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetActiveUniform;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &program, 4); ptr += 4;
- memcpy(ptr, &index, 4); ptr += 4;
- memcpy(ptr, &bufsize, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_length; ptr += 4;
- *(unsigned int *)(ptr) = __size_size; ptr += 4;
- *(unsigned int *)(ptr) = __size_type; ptr += 4;
- *(unsigned int *)(ptr) = __size_name; ptr += 4;
- if (length != NULL) stream->readback(length, __size_length);
- stream->readback(size, __size_size);
- stream->readback(type, __size_type);
- if (name != NULL) stream->readback(name, __size_name);
-}
-
-void glGetAttachedShaders_enc(void *self , GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_count = ((count != NULL) ? (sizeof(GLsizei)) : 0);
- const unsigned int __size_shaders = (maxcount*sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_count + __size_shaders + 2*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetAttachedShaders;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &program, 4); ptr += 4;
- memcpy(ptr, &maxcount, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_count; ptr += 4;
- *(unsigned int *)(ptr) = __size_shaders; ptr += 4;
- if (count != NULL) stream->readback(count, __size_count);
- stream->readback(shaders, __size_shaders);
-}
-
-int glGetAttribLocation_enc(void *self , GLuint program, const GLchar* name)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_name = (strlen(name) + 1);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_name + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetAttribLocation;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &program, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_name; ptr += 4;
- memcpy(ptr, name, __size_name);ptr += __size_name;
-
- int retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-void glGetBooleanv_enc(void *self , GLenum pname, GLboolean* params)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLboolean));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetBooleanv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetBufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetBufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-GLenum glGetError_enc(void *self )
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 0;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetError;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
-
- GLenum retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-void glGetFloatv_enc(void *self , GLenum pname, GLfloat* params)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetFloatv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetFramebufferAttachmentParameteriv_enc(void *self , GLenum target, GLenum attachment, GLenum pname, GLint* params)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetFramebufferAttachmentParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &attachment, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetIntegerv_enc(void *self , GLenum pname, GLint* params)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetIntegerv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetProgramiv_enc(void *self , GLuint program, GLenum pname, GLint* params)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = sizeof(GLint);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetProgramiv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &program, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetProgramInfoLog_enc(void *self , GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_length = sizeof(GLsizei);
- const unsigned int __size_infolog = bufsize;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_length + __size_infolog + 2*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetProgramInfoLog;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &program, 4); ptr += 4;
- memcpy(ptr, &bufsize, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_length; ptr += 4;
- *(unsigned int *)(ptr) = __size_infolog; ptr += 4;
- stream->readback(length, __size_length);
- stream->readback(infolog, __size_infolog);
-}
-
-void glGetRenderbufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = sizeof(GLint);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetRenderbufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetShaderiv_enc(void *self , GLuint shader, GLenum pname, GLint* params)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = sizeof(GLint);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetShaderiv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &shader, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetShaderInfoLog_enc(void *self , GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
- const unsigned int __size_infolog = bufsize;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_length + __size_infolog + 2*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetShaderInfoLog;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &shader, 4); ptr += 4;
- memcpy(ptr, &bufsize, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_length; ptr += 4;
- *(unsigned int *)(ptr) = __size_infolog; ptr += 4;
- if (length != NULL) stream->readback(length, __size_length);
- stream->readback(infolog, __size_infolog);
-}
-
-void glGetShaderPrecisionFormat_enc(void *self , GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_range = (2 * sizeof(GLint));
- const unsigned int __size_precision = (sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_range + __size_precision + 2*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetShaderPrecisionFormat;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &shadertype, 4); ptr += 4;
- memcpy(ptr, &precisiontype, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_range; ptr += 4;
- *(unsigned int *)(ptr) = __size_precision; ptr += 4;
- stream->readback(range, __size_range);
- stream->readback(precision, __size_precision);
-}
-
-void glGetShaderSource_enc(void *self , GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
- const unsigned int __size_source = bufsize;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_length + __size_source + 2*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetShaderSource;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &shader, 4); ptr += 4;
- memcpy(ptr, &bufsize, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_length; ptr += 4;
- *(unsigned int *)(ptr) = __size_source; ptr += 4;
- if (length != NULL) stream->readback(length, __size_length);
- stream->readback(source, __size_source);
-}
-
-void glGetTexParameterfv_enc(void *self , GLenum target, GLenum pname, GLfloat* params)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetTexParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetTexParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetUniformfv_enc(void *self , GLuint program, GLint location, GLfloat* params)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = glSizeof(uniformType(self, program, location));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetUniformfv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &program, 4); ptr += 4;
- memcpy(ptr, &location, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetUniformiv_enc(void *self , GLuint program, GLint location, GLint* params)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = glSizeof(uniformType(self, program, location));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetUniformiv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &program, 4); ptr += 4;
- memcpy(ptr, &location, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-int glGetUniformLocation_enc(void *self , GLuint program, const GLchar* name)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_name = (strlen(name) + 1);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_name + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetUniformLocation;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &program, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_name; ptr += 4;
- memcpy(ptr, name, __size_name);ptr += __size_name;
-
- int retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-void glGetVertexAttribfv_enc(void *self , GLuint index, GLenum pname, GLfloat* params)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetVertexAttribfv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &index, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glGetVertexAttribiv_enc(void *self , GLuint index, GLenum pname, GLint* params)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetVertexAttribiv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &index, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- stream->readback(params, __size_params);
-}
-
-void glHint_enc(void *self , GLenum target, GLenum mode)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glHint;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &mode, 4); ptr += 4;
-}
-
-GLboolean glIsBuffer_enc(void *self , GLuint buffer)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glIsBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &buffer, 4); ptr += 4;
-
- GLboolean retval;
- stream->readback(&retval, 1);
- return retval;
-}
-
-GLboolean glIsEnabled_enc(void *self , GLenum cap)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glIsEnabled;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &cap, 4); ptr += 4;
-
- GLboolean retval;
- stream->readback(&retval, 1);
- return retval;
-}
-
-GLboolean glIsFramebuffer_enc(void *self , GLuint framebuffer)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glIsFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &framebuffer, 4); ptr += 4;
-
- GLboolean retval;
- stream->readback(&retval, 1);
- return retval;
-}
-
-GLboolean glIsProgram_enc(void *self , GLuint program)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glIsProgram;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &program, 4); ptr += 4;
-
- GLboolean retval;
- stream->readback(&retval, 1);
- return retval;
-}
-
-GLboolean glIsRenderbuffer_enc(void *self , GLuint renderbuffer)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glIsRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &renderbuffer, 4); ptr += 4;
-
- GLboolean retval;
- stream->readback(&retval, 1);
- return retval;
-}
-
-GLboolean glIsShader_enc(void *self , GLuint shader)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glIsShader;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &shader, 4); ptr += 4;
-
- GLboolean retval;
- stream->readback(&retval, 1);
- return retval;
-}
-
-GLboolean glIsTexture_enc(void *self , GLuint texture)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glIsTexture;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &texture, 4); ptr += 4;
-
- GLboolean retval;
- stream->readback(&retval, 1);
- return retval;
-}
-
-void glLineWidth_enc(void *self , GLfloat width)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLineWidth;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &width, 4); ptr += 4;
-}
-
-void glLinkProgram_enc(void *self , GLuint program)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glLinkProgram;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &program, 4); ptr += 4;
-}
-
-void glPixelStorei_enc(void *self , GLenum pname, GLint param)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glPixelStorei;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glPolygonOffset_enc(void *self , GLfloat factor, GLfloat units)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glPolygonOffset;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &factor, 4); ptr += 4;
- memcpy(ptr, &units, 4); ptr += 4;
-}
-
-void glReadPixels_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_pixels = pixelDataSize(self, width, height, format, type, 1);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glReadPixels;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &format, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_pixels; ptr += 4;
- stream->readback(pixels, __size_pixels);
-}
-
-void glReleaseShaderCompiler_enc(void *self )
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 0;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glReleaseShaderCompiler;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
-}
-
-void glRenderbufferStorage_enc(void *self , GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glRenderbufferStorage;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &internalformat, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
-}
-
-void glSampleCoverage_enc(void *self , GLclampf value, GLboolean invert)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 1;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glSampleCoverage;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &value, 4); ptr += 4;
- memcpy(ptr, &invert, 1); ptr += 1;
-}
-
-void glScissor_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glScissor;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
-}
-
-void glStencilFunc_enc(void *self , GLenum func, GLint ref, GLuint mask)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glStencilFunc;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &func, 4); ptr += 4;
- memcpy(ptr, &ref, 4); ptr += 4;
- memcpy(ptr, &mask, 4); ptr += 4;
-}
-
-void glStencilFuncSeparate_enc(void *self , GLenum face, GLenum func, GLint ref, GLuint mask)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glStencilFuncSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &face, 4); ptr += 4;
- memcpy(ptr, &func, 4); ptr += 4;
- memcpy(ptr, &ref, 4); ptr += 4;
- memcpy(ptr, &mask, 4); ptr += 4;
-}
-
-void glStencilMask_enc(void *self , GLuint mask)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glStencilMask;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &mask, 4); ptr += 4;
-}
-
-void glStencilMaskSeparate_enc(void *self , GLenum face, GLuint mask)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glStencilMaskSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &face, 4); ptr += 4;
- memcpy(ptr, &mask, 4); ptr += 4;
-}
-
-void glStencilOp_enc(void *self , GLenum fail, GLenum zfail, GLenum zpass)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glStencilOp;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &fail, 4); ptr += 4;
- memcpy(ptr, &zfail, 4); ptr += 4;
- memcpy(ptr, &zpass, 4); ptr += 4;
-}
-
-void glStencilOpSeparate_enc(void *self , GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glStencilOpSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &face, 4); ptr += 4;
- memcpy(ptr, &fail, 4); ptr += 4;
- memcpy(ptr, &zfail, 4); ptr += 4;
- memcpy(ptr, &zpass, 4); ptr += 4;
-}
-
-void glTexImage2D_enc(void *self , GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_pixels = ((pixels != NULL) ? pixelDataSize(self, width, height, format, type, 0) : 0);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
- ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
- int tmp = OP_glTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &internalformat, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &border, 4); ptr += 4;
- memcpy(ptr, &format, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- stream->flush();
- stream->writeFully(&__size_pixels,4);
- if (pixels != NULL) stream->writeFully(pixels, __size_pixels);
-}
-
-void glTexParameterf_enc(void *self , GLenum target, GLenum pname, GLfloat param)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexParameterf;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glTexParameterfv_enc(void *self , GLenum target, GLenum pname, const GLfloat* params)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glTexParameteri_enc(void *self , GLenum target, GLenum pname, GLint param)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- memcpy(ptr, &param, 4); ptr += 4;
-}
-
-void glTexParameteriv_enc(void *self , GLenum target, GLenum pname, const GLint* params)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_params + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glTexParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &pname, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_params; ptr += 4;
- memcpy(ptr, params, __size_params);ptr += __size_params;
-}
-
-void glTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_pixels = pixelDataSize(self, width, height, format, type, 0);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
- ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
- int tmp = OP_glTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &xoffset, 4); ptr += 4;
- memcpy(ptr, &yoffset, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &format, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- stream->flush();
- stream->writeFully(&__size_pixels,4);
- stream->writeFully(pixels, __size_pixels);
-}
-
-void glUniform1f_enc(void *self , GLint location, GLfloat x)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUniform1f;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &location, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
-}
-
-void glUniform1fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_v = (count * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_v + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUniform1fv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &location, 4); ptr += 4;
- memcpy(ptr, &count, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_v; ptr += 4;
- memcpy(ptr, v, __size_v);ptr += __size_v;
-}
-
-void glUniform1i_enc(void *self , GLint location, GLint x)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUniform1i;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &location, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
-}
-
-void glUniform1iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_v = (count * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_v + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUniform1iv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &location, 4); ptr += 4;
- memcpy(ptr, &count, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_v; ptr += 4;
- memcpy(ptr, v, __size_v);ptr += __size_v;
-}
-
-void glUniform2f_enc(void *self , GLint location, GLfloat x, GLfloat y)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUniform2f;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &location, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
-}
-
-void glUniform2fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_v = (count * 2 * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_v + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUniform2fv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &location, 4); ptr += 4;
- memcpy(ptr, &count, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_v; ptr += 4;
- memcpy(ptr, v, __size_v);ptr += __size_v;
-}
-
-void glUniform2i_enc(void *self , GLint location, GLint x, GLint y)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUniform2i;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &location, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
-}
-
-void glUniform2iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_v = (count * 2 * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_v + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUniform2iv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &location, 4); ptr += 4;
- memcpy(ptr, &count, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_v; ptr += 4;
- memcpy(ptr, v, __size_v);ptr += __size_v;
-}
-
-void glUniform3f_enc(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUniform3f;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &location, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &z, 4); ptr += 4;
-}
-
-void glUniform3fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_v = (count * 3 * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_v + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUniform3fv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &location, 4); ptr += 4;
- memcpy(ptr, &count, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_v; ptr += 4;
- memcpy(ptr, v, __size_v);ptr += __size_v;
-}
-
-void glUniform3i_enc(void *self , GLint location, GLint x, GLint y, GLint z)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUniform3i;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &location, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &z, 4); ptr += 4;
-}
-
-void glUniform3iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_v = (3 * count * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_v + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUniform3iv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &location, 4); ptr += 4;
- memcpy(ptr, &count, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_v; ptr += 4;
- memcpy(ptr, v, __size_v);ptr += __size_v;
-}
-
-void glUniform4f_enc(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUniform4f;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &location, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &z, 4); ptr += 4;
- memcpy(ptr, &w, 4); ptr += 4;
-}
-
-void glUniform4fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_v = (4 * count * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_v + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUniform4fv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &location, 4); ptr += 4;
- memcpy(ptr, &count, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_v; ptr += 4;
- memcpy(ptr, v, __size_v);ptr += __size_v;
-}
-
-void glUniform4i_enc(void *self , GLint location, GLint x, GLint y, GLint z, GLint w)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUniform4i;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &location, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &z, 4); ptr += 4;
- memcpy(ptr, &w, 4); ptr += 4;
-}
-
-void glUniform4iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_v = (4 * count * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_v + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUniform4iv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &location, 4); ptr += 4;
- memcpy(ptr, &count, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_v; ptr += 4;
- memcpy(ptr, v, __size_v);ptr += __size_v;
-}
-
-void glUniformMatrix2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_value = (count * 4 * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 1 + __size_value + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUniformMatrix2fv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &location, 4); ptr += 4;
- memcpy(ptr, &count, 4); ptr += 4;
- memcpy(ptr, &transpose, 1); ptr += 1;
- *(unsigned int *)(ptr) = __size_value; ptr += 4;
- memcpy(ptr, value, __size_value);ptr += __size_value;
-}
-
-void glUniformMatrix3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_value = (count * 9 * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 1 + __size_value + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUniformMatrix3fv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &location, 4); ptr += 4;
- memcpy(ptr, &count, 4); ptr += 4;
- memcpy(ptr, &transpose, 1); ptr += 1;
- *(unsigned int *)(ptr) = __size_value; ptr += 4;
- memcpy(ptr, value, __size_value);ptr += __size_value;
-}
-
-void glUniformMatrix4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_value = (count * 16 * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 1 + __size_value + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUniformMatrix4fv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &location, 4); ptr += 4;
- memcpy(ptr, &count, 4); ptr += 4;
- memcpy(ptr, &transpose, 1); ptr += 1;
- *(unsigned int *)(ptr) = __size_value; ptr += 4;
- memcpy(ptr, value, __size_value);ptr += __size_value;
-}
-
-void glUseProgram_enc(void *self , GLuint program)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUseProgram;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &program, 4); ptr += 4;
-}
-
-void glValidateProgram_enc(void *self , GLuint program)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glValidateProgram;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &program, 4); ptr += 4;
-}
-
-void glVertexAttrib1f_enc(void *self , GLuint indx, GLfloat x)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glVertexAttrib1f;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &indx, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
-}
-
-void glVertexAttrib1fv_enc(void *self , GLuint indx, const GLfloat* values)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_values = (sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_values + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glVertexAttrib1fv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &indx, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_values; ptr += 4;
- memcpy(ptr, values, __size_values);ptr += __size_values;
-}
-
-void glVertexAttrib2f_enc(void *self , GLuint indx, GLfloat x, GLfloat y)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glVertexAttrib2f;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &indx, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
-}
-
-void glVertexAttrib2fv_enc(void *self , GLuint indx, const GLfloat* values)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_values = (2 * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_values + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glVertexAttrib2fv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &indx, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_values; ptr += 4;
- memcpy(ptr, values, __size_values);ptr += __size_values;
-}
-
-void glVertexAttrib3f_enc(void *self , GLuint indx, GLfloat x, GLfloat y, GLfloat z)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glVertexAttrib3f;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &indx, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &z, 4); ptr += 4;
-}
-
-void glVertexAttrib3fv_enc(void *self , GLuint indx, const GLfloat* values)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_values = (3 * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_values + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glVertexAttrib3fv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &indx, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_values; ptr += 4;
- memcpy(ptr, values, __size_values);ptr += __size_values;
-}
-
-void glVertexAttrib4f_enc(void *self , GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glVertexAttrib4f;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &indx, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &z, 4); ptr += 4;
- memcpy(ptr, &w, 4); ptr += 4;
-}
-
-void glVertexAttrib4fv_enc(void *self , GLuint indx, const GLfloat* values)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_values = (4 * sizeof(GLfloat));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_values + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glVertexAttrib4fv;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &indx, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_values; ptr += 4;
- memcpy(ptr, values, __size_values);ptr += __size_values;
-}
-
-void glViewport_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glViewport;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
-}
-
-void glEGLImageTargetTexture2DOES_enc(void *self , GLenum target, GLeglImageOES image)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glEGLImageTargetTexture2DOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &image, 4); ptr += 4;
-}
-
-void glEGLImageTargetRenderbufferStorageOES_enc(void *self , GLenum target, GLeglImageOES image)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glEGLImageTargetRenderbufferStorageOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &image, 4); ptr += 4;
-}
-
-GLboolean glUnmapBufferOES_enc(void *self , GLenum target)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glUnmapBufferOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
-
- GLboolean retval;
- stream->readback(&retval, 1);
- return retval;
-}
-
-void glTexImage3DOES_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_pixels = ((pixels != NULL) ? pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
- ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
- int tmp = OP_glTexImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &internalformat, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &depth, 4); ptr += 4;
- memcpy(ptr, &border, 4); ptr += 4;
- memcpy(ptr, &format, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- stream->flush();
- stream->writeFully(&__size_pixels,4);
- if (pixels != NULL) stream->writeFully(pixels, __size_pixels);
-}
-
-void glTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_pixels = pixelDataSize3D(self, width, height, depth, format, type, 0);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
- ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
- int tmp = OP_glTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &xoffset, 4); ptr += 4;
- memcpy(ptr, &yoffset, 4); ptr += 4;
- memcpy(ptr, &zoffset, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &depth, 4); ptr += 4;
- memcpy(ptr, &format, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- stream->flush();
- stream->writeFully(&__size_pixels,4);
- stream->writeFully(pixels, __size_pixels);
-}
-
-void glCopyTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glCopyTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &xoffset, 4); ptr += 4;
- memcpy(ptr, &yoffset, 4); ptr += 4;
- memcpy(ptr, &zoffset, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
-}
-
-void glCompressedTexImage3DOES_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = imageSize;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
- ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
- int tmp = OP_glCompressedTexImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &internalformat, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &depth, 4); ptr += 4;
- memcpy(ptr, &border, 4); ptr += 4;
- memcpy(ptr, &imageSize, 4); ptr += 4;
- stream->flush();
- stream->writeFully(&__size_data,4);
- stream->writeFully(data, __size_data);
-}
-
-void glCompressedTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = imageSize;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
- ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
- int tmp = OP_glCompressedTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &xoffset, 4); ptr += 4;
- memcpy(ptr, &yoffset, 4); ptr += 4;
- memcpy(ptr, &zoffset, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &depth, 4); ptr += 4;
- memcpy(ptr, &format, 4); ptr += 4;
- memcpy(ptr, &imageSize, 4); ptr += 4;
- stream->flush();
- stream->writeFully(&__size_data,4);
- stream->writeFully(data, __size_data);
-}
-
-void glFramebufferTexture3DOES_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFramebufferTexture3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &attachment, 4); ptr += 4;
- memcpy(ptr, &textarget, 4); ptr += 4;
- memcpy(ptr, &texture, 4); ptr += 4;
- memcpy(ptr, &level, 4); ptr += 4;
- memcpy(ptr, &zoffset, 4); ptr += 4;
-}
-
-void glBindVertexArrayOES_enc(void *self , GLuint array)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glBindVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &array, 4); ptr += 4;
-}
-
-void glDeleteVertexArraysOES_enc(void *self , GLsizei n, const GLuint* arrays)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_arrays = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_arrays + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDeleteVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_arrays; ptr += 4;
- memcpy(ptr, arrays, __size_arrays);ptr += __size_arrays;
-}
-
-void glGenVertexArraysOES_enc(void *self , GLsizei n, GLuint* arrays)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_arrays = (n * sizeof(GLuint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_arrays + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGenVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &n, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_arrays; ptr += 4;
- stream->readback(arrays, __size_arrays);
-}
-
-GLboolean glIsVertexArrayOES_enc(void *self , GLuint array)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glIsVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &array, 4); ptr += 4;
-
- GLboolean retval;
- stream->readback(&retval, 1);
- return retval;
-}
-
-void glDiscardFramebufferEXT_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_attachments = (numAttachments * sizeof(GLenum));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + __size_attachments + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDiscardFramebufferEXT;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &numAttachments, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_attachments; ptr += 4;
- memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments;
-}
-
-void glVertexAttribPointerData_enc(void *self , GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, void* data, GLuint datalen)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = datalen;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 1 + 4 + __size_data + 4 + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glVertexAttribPointerData;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &indx, 4); ptr += 4;
- memcpy(ptr, &size, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- memcpy(ptr, &normalized, 1); ptr += 1;
- memcpy(ptr, &stride, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_data; ptr += 4;
- glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data;
- memcpy(ptr, &datalen, 4); ptr += 4;
-}
-
-void glVertexAttribPointerOffset_enc(void *self , GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint offset)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 1 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glVertexAttribPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &indx, 4); ptr += 4;
- memcpy(ptr, &size, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- memcpy(ptr, &normalized, 1); ptr += 1;
- memcpy(ptr, &stride, 4); ptr += 4;
- memcpy(ptr, &offset, 4); ptr += 4;
-}
-
-void glDrawElementsOffset_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDrawElementsOffset;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &mode, 4); ptr += 4;
- memcpy(ptr, &count, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- memcpy(ptr, &offset, 4); ptr += 4;
-}
-
-void glDrawElementsData_enc(void *self , GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_data = datalen;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glDrawElementsData;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &mode, 4); ptr += 4;
- memcpy(ptr, &count, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_data; ptr += 4;
- memcpy(ptr, data, __size_data);ptr += __size_data;
- memcpy(ptr, &datalen, 4); ptr += 4;
-}
-
-void glGetCompressedTextureFormats_enc(void *self , int count, GLint* formats)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_formats = (count * sizeof(GLint));
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_formats + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glGetCompressedTextureFormats;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &count, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_formats; ptr += 4;
- stream->readback(formats, __size_formats);
-}
-
-void glShaderString_enc(void *self , GLuint shader, const GLchar* string, GLsizei len)
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_string = len;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_string + 4 + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glShaderString;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &shader, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_string; ptr += 4;
- memcpy(ptr, string, __size_string);ptr += __size_string;
- memcpy(ptr, &len, 4); ptr += 4;
-}
-
-int glFinishRoundTrip_enc(void *self )
-{
-
- gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 0;
- ptr = stream->alloc(packetSize);
- int tmp = OP_glFinishRoundTrip;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
-
- int retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-gl2_encoder_context_t::gl2_encoder_context_t(IOStream *stream)
-{
- m_stream = stream;
-
- set_glActiveTexture(glActiveTexture_enc);
- set_glAttachShader(glAttachShader_enc);
- set_glBindAttribLocation(glBindAttribLocation_enc);
- set_glBindBuffer(glBindBuffer_enc);
- set_glBindFramebuffer(glBindFramebuffer_enc);
- set_glBindRenderbuffer(glBindRenderbuffer_enc);
- set_glBindTexture(glBindTexture_enc);
- set_glBlendColor(glBlendColor_enc);
- set_glBlendEquation(glBlendEquation_enc);
- set_glBlendEquationSeparate(glBlendEquationSeparate_enc);
- set_glBlendFunc(glBlendFunc_enc);
- set_glBlendFuncSeparate(glBlendFuncSeparate_enc);
- set_glBufferData(glBufferData_enc);
- set_glBufferSubData(glBufferSubData_enc);
- set_glCheckFramebufferStatus(glCheckFramebufferStatus_enc);
- set_glClear(glClear_enc);
- set_glClearColor(glClearColor_enc);
- set_glClearDepthf(glClearDepthf_enc);
- set_glClearStencil(glClearStencil_enc);
- set_glColorMask(glColorMask_enc);
- set_glCompileShader(glCompileShader_enc);
- set_glCompressedTexImage2D(glCompressedTexImage2D_enc);
- set_glCompressedTexSubImage2D(glCompressedTexSubImage2D_enc);
- set_glCopyTexImage2D(glCopyTexImage2D_enc);
- set_glCopyTexSubImage2D(glCopyTexSubImage2D_enc);
- set_glCreateProgram(glCreateProgram_enc);
- set_glCreateShader(glCreateShader_enc);
- set_glCullFace(glCullFace_enc);
- set_glDeleteBuffers(glDeleteBuffers_enc);
- set_glDeleteFramebuffers(glDeleteFramebuffers_enc);
- set_glDeleteProgram(glDeleteProgram_enc);
- set_glDeleteRenderbuffers(glDeleteRenderbuffers_enc);
- set_glDeleteShader(glDeleteShader_enc);
- set_glDeleteTextures(glDeleteTextures_enc);
- set_glDepthFunc(glDepthFunc_enc);
- set_glDepthMask(glDepthMask_enc);
- set_glDepthRangef(glDepthRangef_enc);
- set_glDetachShader(glDetachShader_enc);
- set_glDisable(glDisable_enc);
- set_glDisableVertexAttribArray(glDisableVertexAttribArray_enc);
- set_glDrawArrays(glDrawArrays_enc);
- set_glDrawElements((glDrawElements_client_proc_t)(enc_unsupported));
- set_glEnable(glEnable_enc);
- set_glEnableVertexAttribArray(glEnableVertexAttribArray_enc);
- set_glFinish(glFinish_enc);
- set_glFlush(glFlush_enc);
- set_glFramebufferRenderbuffer(glFramebufferRenderbuffer_enc);
- set_glFramebufferTexture2D(glFramebufferTexture2D_enc);
- set_glFrontFace(glFrontFace_enc);
- set_glGenBuffers(glGenBuffers_enc);
- set_glGenerateMipmap(glGenerateMipmap_enc);
- set_glGenFramebuffers(glGenFramebuffers_enc);
- set_glGenRenderbuffers(glGenRenderbuffers_enc);
- set_glGenTextures(glGenTextures_enc);
- set_glGetActiveAttrib(glGetActiveAttrib_enc);
- set_glGetActiveUniform(glGetActiveUniform_enc);
- set_glGetAttachedShaders(glGetAttachedShaders_enc);
- set_glGetAttribLocation(glGetAttribLocation_enc);
- set_glGetBooleanv(glGetBooleanv_enc);
- set_glGetBufferParameteriv(glGetBufferParameteriv_enc);
- set_glGetError(glGetError_enc);
- set_glGetFloatv(glGetFloatv_enc);
- set_glGetFramebufferAttachmentParameteriv(glGetFramebufferAttachmentParameteriv_enc);
- set_glGetIntegerv(glGetIntegerv_enc);
- set_glGetProgramiv(glGetProgramiv_enc);
- set_glGetProgramInfoLog(glGetProgramInfoLog_enc);
- set_glGetRenderbufferParameteriv(glGetRenderbufferParameteriv_enc);
- set_glGetShaderiv(glGetShaderiv_enc);
- set_glGetShaderInfoLog(glGetShaderInfoLog_enc);
- set_glGetShaderPrecisionFormat(glGetShaderPrecisionFormat_enc);
- set_glGetShaderSource(glGetShaderSource_enc);
- set_glGetString((glGetString_client_proc_t)(enc_unsupported));
- set_glGetTexParameterfv(glGetTexParameterfv_enc);
- set_glGetTexParameteriv(glGetTexParameteriv_enc);
- set_glGetUniformfv(glGetUniformfv_enc);
- set_glGetUniformiv(glGetUniformiv_enc);
- set_glGetUniformLocation(glGetUniformLocation_enc);
- set_glGetVertexAttribfv(glGetVertexAttribfv_enc);
- set_glGetVertexAttribiv(glGetVertexAttribiv_enc);
- set_glGetVertexAttribPointerv((glGetVertexAttribPointerv_client_proc_t)(enc_unsupported));
- set_glHint(glHint_enc);
- set_glIsBuffer(glIsBuffer_enc);
- set_glIsEnabled(glIsEnabled_enc);
- set_glIsFramebuffer(glIsFramebuffer_enc);
- set_glIsProgram(glIsProgram_enc);
- set_glIsRenderbuffer(glIsRenderbuffer_enc);
- set_glIsShader(glIsShader_enc);
- set_glIsTexture(glIsTexture_enc);
- set_glLineWidth(glLineWidth_enc);
- set_glLinkProgram(glLinkProgram_enc);
- set_glPixelStorei(glPixelStorei_enc);
- set_glPolygonOffset(glPolygonOffset_enc);
- set_glReadPixels(glReadPixels_enc);
- set_glReleaseShaderCompiler(glReleaseShaderCompiler_enc);
- set_glRenderbufferStorage(glRenderbufferStorage_enc);
- set_glSampleCoverage(glSampleCoverage_enc);
- set_glScissor(glScissor_enc);
- set_glShaderBinary((glShaderBinary_client_proc_t)(enc_unsupported));
- set_glShaderSource((glShaderSource_client_proc_t)(enc_unsupported));
- set_glStencilFunc(glStencilFunc_enc);
- set_glStencilFuncSeparate(glStencilFuncSeparate_enc);
- set_glStencilMask(glStencilMask_enc);
- set_glStencilMaskSeparate(glStencilMaskSeparate_enc);
- set_glStencilOp(glStencilOp_enc);
- set_glStencilOpSeparate(glStencilOpSeparate_enc);
- set_glTexImage2D(glTexImage2D_enc);
- set_glTexParameterf(glTexParameterf_enc);
- set_glTexParameterfv(glTexParameterfv_enc);
- set_glTexParameteri(glTexParameteri_enc);
- set_glTexParameteriv(glTexParameteriv_enc);
- set_glTexSubImage2D(glTexSubImage2D_enc);
- set_glUniform1f(glUniform1f_enc);
- set_glUniform1fv(glUniform1fv_enc);
- set_glUniform1i(glUniform1i_enc);
- set_glUniform1iv(glUniform1iv_enc);
- set_glUniform2f(glUniform2f_enc);
- set_glUniform2fv(glUniform2fv_enc);
- set_glUniform2i(glUniform2i_enc);
- set_glUniform2iv(glUniform2iv_enc);
- set_glUniform3f(glUniform3f_enc);
- set_glUniform3fv(glUniform3fv_enc);
- set_glUniform3i(glUniform3i_enc);
- set_glUniform3iv(glUniform3iv_enc);
- set_glUniform4f(glUniform4f_enc);
- set_glUniform4fv(glUniform4fv_enc);
- set_glUniform4i(glUniform4i_enc);
- set_glUniform4iv(glUniform4iv_enc);
- set_glUniformMatrix2fv(glUniformMatrix2fv_enc);
- set_glUniformMatrix3fv(glUniformMatrix3fv_enc);
- set_glUniformMatrix4fv(glUniformMatrix4fv_enc);
- set_glUseProgram(glUseProgram_enc);
- set_glValidateProgram(glValidateProgram_enc);
- set_glVertexAttrib1f(glVertexAttrib1f_enc);
- set_glVertexAttrib1fv(glVertexAttrib1fv_enc);
- set_glVertexAttrib2f(glVertexAttrib2f_enc);
- set_glVertexAttrib2fv(glVertexAttrib2fv_enc);
- set_glVertexAttrib3f(glVertexAttrib3f_enc);
- set_glVertexAttrib3fv(glVertexAttrib3fv_enc);
- set_glVertexAttrib4f(glVertexAttrib4f_enc);
- set_glVertexAttrib4fv(glVertexAttrib4fv_enc);
- set_glVertexAttribPointer((glVertexAttribPointer_client_proc_t)(enc_unsupported));
- set_glViewport(glViewport_enc);
- set_glEGLImageTargetTexture2DOES(glEGLImageTargetTexture2DOES_enc);
- set_glEGLImageTargetRenderbufferStorageOES(glEGLImageTargetRenderbufferStorageOES_enc);
- set_glGetProgramBinaryOES((glGetProgramBinaryOES_client_proc_t)(enc_unsupported));
- set_glProgramBinaryOES((glProgramBinaryOES_client_proc_t)(enc_unsupported));
- set_glMapBufferOES((glMapBufferOES_client_proc_t)(enc_unsupported));
- set_glUnmapBufferOES(glUnmapBufferOES_enc);
- set_glTexImage3DOES(glTexImage3DOES_enc);
- set_glTexSubImage3DOES(glTexSubImage3DOES_enc);
- set_glCopyTexSubImage3DOES(glCopyTexSubImage3DOES_enc);
- set_glCompressedTexImage3DOES(glCompressedTexImage3DOES_enc);
- set_glCompressedTexSubImage3DOES(glCompressedTexSubImage3DOES_enc);
- set_glFramebufferTexture3DOES(glFramebufferTexture3DOES_enc);
- set_glBindVertexArrayOES(glBindVertexArrayOES_enc);
- set_glDeleteVertexArraysOES(glDeleteVertexArraysOES_enc);
- set_glGenVertexArraysOES(glGenVertexArraysOES_enc);
- set_glIsVertexArrayOES(glIsVertexArrayOES_enc);
- set_glDiscardFramebufferEXT(glDiscardFramebufferEXT_enc);
- set_glMultiDrawArraysEXT((glMultiDrawArraysEXT_client_proc_t)(enc_unsupported));
- set_glMultiDrawElementsEXT((glMultiDrawElementsEXT_client_proc_t)(enc_unsupported));
- set_glGetPerfMonitorGroupsAMD((glGetPerfMonitorGroupsAMD_client_proc_t)(enc_unsupported));
- set_glGetPerfMonitorCountersAMD((glGetPerfMonitorCountersAMD_client_proc_t)(enc_unsupported));
- set_glGetPerfMonitorGroupStringAMD((glGetPerfMonitorGroupStringAMD_client_proc_t)(enc_unsupported));
- set_glGetPerfMonitorCounterStringAMD((glGetPerfMonitorCounterStringAMD_client_proc_t)(enc_unsupported));
- set_glGetPerfMonitorCounterInfoAMD((glGetPerfMonitorCounterInfoAMD_client_proc_t)(enc_unsupported));
- set_glGenPerfMonitorsAMD((glGenPerfMonitorsAMD_client_proc_t)(enc_unsupported));
- set_glDeletePerfMonitorsAMD((glDeletePerfMonitorsAMD_client_proc_t)(enc_unsupported));
- set_glSelectPerfMonitorCountersAMD((glSelectPerfMonitorCountersAMD_client_proc_t)(enc_unsupported));
- set_glBeginPerfMonitorAMD((glBeginPerfMonitorAMD_client_proc_t)(enc_unsupported));
- set_glEndPerfMonitorAMD((glEndPerfMonitorAMD_client_proc_t)(enc_unsupported));
- set_glGetPerfMonitorCounterDataAMD((glGetPerfMonitorCounterDataAMD_client_proc_t)(enc_unsupported));
- set_glRenderbufferStorageMultisampleIMG((glRenderbufferStorageMultisampleIMG_client_proc_t)(enc_unsupported));
- set_glFramebufferTexture2DMultisampleIMG((glFramebufferTexture2DMultisampleIMG_client_proc_t)(enc_unsupported));
- set_glDeleteFencesNV((glDeleteFencesNV_client_proc_t)(enc_unsupported));
- set_glGenFencesNV((glGenFencesNV_client_proc_t)(enc_unsupported));
- set_glIsFenceNV((glIsFenceNV_client_proc_t)(enc_unsupported));
- set_glTestFenceNV((glTestFenceNV_client_proc_t)(enc_unsupported));
- set_glGetFenceivNV((glGetFenceivNV_client_proc_t)(enc_unsupported));
- set_glFinishFenceNV((glFinishFenceNV_client_proc_t)(enc_unsupported));
- set_glSetFenceNV((glSetFenceNV_client_proc_t)(enc_unsupported));
- set_glCoverageMaskNV((glCoverageMaskNV_client_proc_t)(enc_unsupported));
- set_glCoverageOperationNV((glCoverageOperationNV_client_proc_t)(enc_unsupported));
- set_glGetDriverControlsQCOM((glGetDriverControlsQCOM_client_proc_t)(enc_unsupported));
- set_glGetDriverControlStringQCOM((glGetDriverControlStringQCOM_client_proc_t)(enc_unsupported));
- set_glEnableDriverControlQCOM((glEnableDriverControlQCOM_client_proc_t)(enc_unsupported));
- set_glDisableDriverControlQCOM((glDisableDriverControlQCOM_client_proc_t)(enc_unsupported));
- set_glExtGetTexturesQCOM((glExtGetTexturesQCOM_client_proc_t)(enc_unsupported));
- set_glExtGetBuffersQCOM((glExtGetBuffersQCOM_client_proc_t)(enc_unsupported));
- set_glExtGetRenderbuffersQCOM((glExtGetRenderbuffersQCOM_client_proc_t)(enc_unsupported));
- set_glExtGetFramebuffersQCOM((glExtGetFramebuffersQCOM_client_proc_t)(enc_unsupported));
- set_glExtGetTexLevelParameterivQCOM((glExtGetTexLevelParameterivQCOM_client_proc_t)(enc_unsupported));
- set_glExtTexObjectStateOverrideiQCOM((glExtTexObjectStateOverrideiQCOM_client_proc_t)(enc_unsupported));
- set_glExtGetTexSubImageQCOM((glExtGetTexSubImageQCOM_client_proc_t)(enc_unsupported));
- set_glExtGetBufferPointervQCOM((glExtGetBufferPointervQCOM_client_proc_t)(enc_unsupported));
- set_glExtGetShadersQCOM((glExtGetShadersQCOM_client_proc_t)(enc_unsupported));
- set_glExtGetProgramsQCOM((glExtGetProgramsQCOM_client_proc_t)(enc_unsupported));
- set_glExtIsProgramBinaryQCOM((glExtIsProgramBinaryQCOM_client_proc_t)(enc_unsupported));
- set_glExtGetProgramBinarySourceQCOM((glExtGetProgramBinarySourceQCOM_client_proc_t)(enc_unsupported));
- set_glStartTilingQCOM((glStartTilingQCOM_client_proc_t)(enc_unsupported));
- set_glEndTilingQCOM((glEndTilingQCOM_client_proc_t)(enc_unsupported));
- set_glVertexAttribPointerData(glVertexAttribPointerData_enc);
- set_glVertexAttribPointerOffset(glVertexAttribPointerOffset_enc);
- set_glDrawElementsOffset(glDrawElementsOffset_enc);
- set_glDrawElementsData(glDrawElementsData_enc);
- set_glGetCompressedTextureFormats(glGetCompressedTextureFormats_enc);
- set_glShaderString(glShaderString_enc);
- set_glFinishRoundTrip(glFinishRoundTrip_enc);
-}
-
diff --git a/tools/emulator/opengl/system/GLESv2_enc/gl2_enc.h b/tools/emulator/opengl/system/GLESv2_enc/gl2_enc.h
deleted file mode 100644
index f422c1133..000000000
--- a/tools/emulator/opengl/system/GLESv2_enc/gl2_enc.h
+++ /dev/null
@@ -1,234 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-
-#ifndef GUARD_gl2_encoder_context_t
-#define GUARD_gl2_encoder_context_t
-
-#include "IOStream.h"
-#include "gl2_client_context.h"
-
-
-#include <string.h>
-#include "glUtils.h"
-#include "GL2EncoderUtils.h"
-
-struct gl2_encoder_context_t : public gl2_client_context_t {
-
- IOStream *m_stream;
-
- gl2_encoder_context_t(IOStream *stream);
-
-
-};
-
-extern "C" {
- void glActiveTexture_enc(void *self , GLenum texture);
- void glAttachShader_enc(void *self , GLuint program, GLuint shader);
- void glBindAttribLocation_enc(void *self , GLuint program, GLuint index, const GLchar* name);
- void glBindBuffer_enc(void *self , GLenum target, GLuint buffer);
- void glBindFramebuffer_enc(void *self , GLenum target, GLuint framebuffer);
- void glBindRenderbuffer_enc(void *self , GLenum target, GLuint renderbuffer);
- void glBindTexture_enc(void *self , GLenum target, GLuint texture);
- void glBlendColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
- void glBlendEquation_enc(void *self , GLenum mode);
- void glBlendEquationSeparate_enc(void *self , GLenum modeRGB, GLenum modeAlpha);
- void glBlendFunc_enc(void *self , GLenum sfactor, GLenum dfactor);
- void glBlendFuncSeparate_enc(void *self , GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void glBufferData_enc(void *self , GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
- void glBufferSubData_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
- GLenum glCheckFramebufferStatus_enc(void *self , GLenum target);
- void glClear_enc(void *self , GLbitfield mask);
- void glClearColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
- void glClearDepthf_enc(void *self , GLclampf depth);
- void glClearStencil_enc(void *self , GLint s);
- void glColorMask_enc(void *self , GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glCompileShader_enc(void *self , GLuint shader);
- void glCompressedTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
- void glCompressedTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
- void glCopyTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- GLuint glCreateProgram_enc(void *self );
- GLuint glCreateShader_enc(void *self , GLenum type);
- void glCullFace_enc(void *self , GLenum mode);
- void glDeleteBuffers_enc(void *self , GLsizei n, const GLuint* buffers);
- void glDeleteFramebuffers_enc(void *self , GLsizei n, const GLuint* framebuffers);
- void glDeleteProgram_enc(void *self , GLuint program);
- void glDeleteRenderbuffers_enc(void *self , GLsizei n, const GLuint* renderbuffers);
- void glDeleteShader_enc(void *self , GLuint shader);
- void glDeleteTextures_enc(void *self , GLsizei n, const GLuint* textures);
- void glDepthFunc_enc(void *self , GLenum func);
- void glDepthMask_enc(void *self , GLboolean flag);
- void glDepthRangef_enc(void *self , GLclampf zNear, GLclampf zFar);
- void glDetachShader_enc(void *self , GLuint program, GLuint shader);
- void glDisable_enc(void *self , GLenum cap);
- void glDisableVertexAttribArray_enc(void *self , GLuint index);
- void glDrawArrays_enc(void *self , GLenum mode, GLint first, GLsizei count);
- void glDrawElements_enc(void *self , GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
- void glEnable_enc(void *self , GLenum cap);
- void glEnableVertexAttribArray_enc(void *self , GLuint index);
- void glFinish_enc(void *self );
- void glFlush_enc(void *self );
- void glFramebufferRenderbuffer_enc(void *self , GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture2D_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFrontFace_enc(void *self , GLenum mode);
- void glGenBuffers_enc(void *self , GLsizei n, GLuint* buffers);
- void glGenerateMipmap_enc(void *self , GLenum target);
- void glGenFramebuffers_enc(void *self , GLsizei n, GLuint* framebuffers);
- void glGenRenderbuffers_enc(void *self , GLsizei n, GLuint* renderbuffers);
- void glGenTextures_enc(void *self , GLsizei n, GLuint* textures);
- void glGetActiveAttrib_enc(void *self , GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
- void glGetActiveUniform_enc(void *self , GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
- void glGetAttachedShaders_enc(void *self , GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
- int glGetAttribLocation_enc(void *self , GLuint program, const GLchar* name);
- void glGetBooleanv_enc(void *self , GLenum pname, GLboolean* params);
- void glGetBufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params);
- GLenum glGetError_enc(void *self );
- void glGetFloatv_enc(void *self , GLenum pname, GLfloat* params);
- void glGetFramebufferAttachmentParameteriv_enc(void *self , GLenum target, GLenum attachment, GLenum pname, GLint* params);
- void glGetIntegerv_enc(void *self , GLenum pname, GLint* params);
- void glGetProgramiv_enc(void *self , GLuint program, GLenum pname, GLint* params);
- void glGetProgramInfoLog_enc(void *self , GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
- void glGetRenderbufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params);
- void glGetShaderiv_enc(void *self , GLuint shader, GLenum pname, GLint* params);
- void glGetShaderInfoLog_enc(void *self , GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
- void glGetShaderPrecisionFormat_enc(void *self , GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
- void glGetShaderSource_enc(void *self , GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
- const GLubyte* glGetString_enc(void *self , GLenum name);
- void glGetTexParameterfv_enc(void *self , GLenum target, GLenum pname, GLfloat* params);
- void glGetTexParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params);
- void glGetUniformfv_enc(void *self , GLuint program, GLint location, GLfloat* params);
- void glGetUniformiv_enc(void *self , GLuint program, GLint location, GLint* params);
- int glGetUniformLocation_enc(void *self , GLuint program, const GLchar* name);
- void glGetVertexAttribfv_enc(void *self , GLuint index, GLenum pname, GLfloat* params);
- void glGetVertexAttribiv_enc(void *self , GLuint index, GLenum pname, GLint* params);
- void glGetVertexAttribPointerv_enc(void *self , GLuint index, GLenum pname, GLvoid** pointer);
- void glHint_enc(void *self , GLenum target, GLenum mode);
- GLboolean glIsBuffer_enc(void *self , GLuint buffer);
- GLboolean glIsEnabled_enc(void *self , GLenum cap);
- GLboolean glIsFramebuffer_enc(void *self , GLuint framebuffer);
- GLboolean glIsProgram_enc(void *self , GLuint program);
- GLboolean glIsRenderbuffer_enc(void *self , GLuint renderbuffer);
- GLboolean glIsShader_enc(void *self , GLuint shader);
- GLboolean glIsTexture_enc(void *self , GLuint texture);
- void glLineWidth_enc(void *self , GLfloat width);
- void glLinkProgram_enc(void *self , GLuint program);
- void glPixelStorei_enc(void *self , GLenum pname, GLint param);
- void glPolygonOffset_enc(void *self , GLfloat factor, GLfloat units);
- void glReadPixels_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
- void glReleaseShaderCompiler_enc(void *self );
- void glRenderbufferStorage_enc(void *self , GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glSampleCoverage_enc(void *self , GLclampf value, GLboolean invert);
- void glScissor_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height);
- void glShaderBinary_enc(void *self , GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
- void glShaderSource_enc(void *self , GLuint shader, GLsizei count, const GLchar** string, const GLint* length);
- void glStencilFunc_enc(void *self , GLenum func, GLint ref, GLuint mask);
- void glStencilFuncSeparate_enc(void *self , GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilMask_enc(void *self , GLuint mask);
- void glStencilMaskSeparate_enc(void *self , GLenum face, GLuint mask);
- void glStencilOp_enc(void *self , GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilOpSeparate_enc(void *self , GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
- void glTexImage2D_enc(void *self , GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
- void glTexParameterf_enc(void *self , GLenum target, GLenum pname, GLfloat param);
- void glTexParameterfv_enc(void *self , GLenum target, GLenum pname, const GLfloat* params);
- void glTexParameteri_enc(void *self , GLenum target, GLenum pname, GLint param);
- void glTexParameteriv_enc(void *self , GLenum target, GLenum pname, const GLint* params);
- void glTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
- void glUniform1f_enc(void *self , GLint location, GLfloat x);
- void glUniform1fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v);
- void glUniform1i_enc(void *self , GLint location, GLint x);
- void glUniform1iv_enc(void *self , GLint location, GLsizei count, const GLint* v);
- void glUniform2f_enc(void *self , GLint location, GLfloat x, GLfloat y);
- void glUniform2fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v);
- void glUniform2i_enc(void *self , GLint location, GLint x, GLint y);
- void glUniform2iv_enc(void *self , GLint location, GLsizei count, const GLint* v);
- void glUniform3f_enc(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z);
- void glUniform3fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v);
- void glUniform3i_enc(void *self , GLint location, GLint x, GLint y, GLint z);
- void glUniform3iv_enc(void *self , GLint location, GLsizei count, const GLint* v);
- void glUniform4f_enc(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glUniform4fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v);
- void glUniform4i_enc(void *self , GLint location, GLint x, GLint y, GLint z, GLint w);
- void glUniform4iv_enc(void *self , GLint location, GLsizei count, const GLint* v);
- void glUniformMatrix2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- void glUniformMatrix3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- void glUniformMatrix4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- void glUseProgram_enc(void *self , GLuint program);
- void glValidateProgram_enc(void *self , GLuint program);
- void glVertexAttrib1f_enc(void *self , GLuint indx, GLfloat x);
- void glVertexAttrib1fv_enc(void *self , GLuint indx, const GLfloat* values);
- void glVertexAttrib2f_enc(void *self , GLuint indx, GLfloat x, GLfloat y);
- void glVertexAttrib2fv_enc(void *self , GLuint indx, const GLfloat* values);
- void glVertexAttrib3f_enc(void *self , GLuint indx, GLfloat x, GLfloat y, GLfloat z);
- void glVertexAttrib3fv_enc(void *self , GLuint indx, const GLfloat* values);
- void glVertexAttrib4f_enc(void *self , GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertexAttrib4fv_enc(void *self , GLuint indx, const GLfloat* values);
- void glVertexAttribPointer_enc(void *self , GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
- void glViewport_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height);
- void glEGLImageTargetTexture2DOES_enc(void *self , GLenum target, GLeglImageOES image);
- void glEGLImageTargetRenderbufferStorageOES_enc(void *self , GLenum target, GLeglImageOES image);
- void glGetProgramBinaryOES_enc(void *self , GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary);
- void glProgramBinaryOES_enc(void *self , GLuint program, GLenum binaryFormat, const GLvoid* binary, GLint length);
- void* glMapBufferOES_enc(void *self , GLenum target, GLenum access);
- GLboolean glUnmapBufferOES_enc(void *self , GLenum target);
- void glTexImage3DOES_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
- void glTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
- void glCopyTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCompressedTexImage3DOES_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
- void glCompressedTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
- void glFramebufferTexture3DOES_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glBindVertexArrayOES_enc(void *self , GLuint array);
- void glDeleteVertexArraysOES_enc(void *self , GLsizei n, const GLuint* arrays);
- void glGenVertexArraysOES_enc(void *self , GLsizei n, GLuint* arrays);
- GLboolean glIsVertexArrayOES_enc(void *self , GLuint array);
- void glDiscardFramebufferEXT_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments);
- void glMultiDrawArraysEXT_enc(void *self , GLenum mode, GLint* first, GLsizei* count, GLsizei primcount);
- void glMultiDrawElementsEXT_enc(void *self , GLenum mode, const GLsizei* count, GLenum type, const GLvoid** indices, GLsizei primcount);
- void glGetPerfMonitorGroupsAMD_enc(void *self , GLint* numGroups, GLsizei groupsSize, GLuint* groups);
- void glGetPerfMonitorCountersAMD_enc(void *self , GLuint group, GLint* numCounters, GLint* maxActiveCounters, GLsizei counterSize, GLuint* counters);
- void glGetPerfMonitorGroupStringAMD_enc(void *self , GLuint group, GLsizei bufSize, GLsizei* length, GLchar* groupString);
- void glGetPerfMonitorCounterStringAMD_enc(void *self , GLuint group, GLuint counter, GLsizei bufSize, GLsizei* length, GLchar* counterString);
- void glGetPerfMonitorCounterInfoAMD_enc(void *self , GLuint group, GLuint counter, GLenum pname, GLvoid* data);
- void glGenPerfMonitorsAMD_enc(void *self , GLsizei n, GLuint* monitors);
- void glDeletePerfMonitorsAMD_enc(void *self , GLsizei n, GLuint* monitors);
- void glSelectPerfMonitorCountersAMD_enc(void *self , GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint* countersList);
- void glBeginPerfMonitorAMD_enc(void *self , GLuint monitor);
- void glEndPerfMonitorAMD_enc(void *self , GLuint monitor);
- void glGetPerfMonitorCounterDataAMD_enc(void *self , GLuint monitor, GLenum pname, GLsizei dataSize, GLuint* data, GLint* bytesWritten);
- void glRenderbufferStorageMultisampleIMG_enc(void *self , GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glFramebufferTexture2DMultisampleIMG_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
- void glDeleteFencesNV_enc(void *self , GLsizei n, const GLuint* fences);
- void glGenFencesNV_enc(void *self , GLsizei n, GLuint* fences);
- GLboolean glIsFenceNV_enc(void *self , GLuint fence);
- GLboolean glTestFenceNV_enc(void *self , GLuint fence);
- void glGetFenceivNV_enc(void *self , GLuint fence, GLenum pname, GLint* params);
- void glFinishFenceNV_enc(void *self , GLuint fence);
- void glSetFenceNV_enc(void *self , GLuint fence, GLenum condition);
- void glCoverageMaskNV_enc(void *self , GLboolean mask);
- void glCoverageOperationNV_enc(void *self , GLenum operation);
- void glGetDriverControlsQCOM_enc(void *self , GLint* num, GLsizei size, GLuint* driverControls);
- void glGetDriverControlStringQCOM_enc(void *self , GLuint driverControl, GLsizei bufSize, GLsizei* length, GLchar* driverControlString);
- void glEnableDriverControlQCOM_enc(void *self , GLuint driverControl);
- void glDisableDriverControlQCOM_enc(void *self , GLuint driverControl);
- void glExtGetTexturesQCOM_enc(void *self , GLuint* textures, GLint maxTextures, GLint* numTextures);
- void glExtGetBuffersQCOM_enc(void *self , GLuint* buffers, GLint maxBuffers, GLint* numBuffers);
- void glExtGetRenderbuffersQCOM_enc(void *self , GLuint* renderbuffers, GLint maxRenderbuffers, GLint* numRenderbuffers);
- void glExtGetFramebuffersQCOM_enc(void *self , GLuint* framebuffers, GLint maxFramebuffers, GLint* numFramebuffers);
- void glExtGetTexLevelParameterivQCOM_enc(void *self , GLuint texture, GLenum face, GLint level, GLenum pname, GLint* params);
- void glExtTexObjectStateOverrideiQCOM_enc(void *self , GLenum target, GLenum pname, GLint param);
- void glExtGetTexSubImageQCOM_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid* texels);
- void glExtGetBufferPointervQCOM_enc(void *self , GLenum target, GLvoidptr* params);
- void glExtGetShadersQCOM_enc(void *self , GLuint* shaders, GLint maxShaders, GLint* numShaders);
- void glExtGetProgramsQCOM_enc(void *self , GLuint* programs, GLint maxPrograms, GLint* numPrograms);
- GLboolean glExtIsProgramBinaryQCOM_enc(void *self , GLuint program);
- void glExtGetProgramBinarySourceQCOM_enc(void *self , GLuint program, GLenum shadertype, GLchar* source, GLint* length);
- void glStartTilingQCOM_enc(void *self , GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
- void glEndTilingQCOM_enc(void *self , GLbitfield preserveMask);
- void glVertexAttribPointerData_enc(void *self , GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, void* data, GLuint datalen);
- void glVertexAttribPointerOffset_enc(void *self , GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint offset);
- void glDrawElementsOffset_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset);
- void glDrawElementsData_enc(void *self , GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen);
- void glGetCompressedTextureFormats_enc(void *self , int count, GLint* formats);
- void glShaderString_enc(void *self , GLuint shader, const GLchar* string, GLsizei len);
- int glFinishRoundTrip_enc(void *self );
-};
-#endif \ No newline at end of file
diff --git a/tools/emulator/opengl/system/GLESv2_enc/gl2_entry.cpp b/tools/emulator/opengl/system/GLESv2_enc/gl2_entry.cpp
deleted file mode 100644
index f98fe750d..000000000
--- a/tools/emulator/opengl/system/GLESv2_enc/gl2_entry.cpp
+++ /dev/null
@@ -1,1483 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-#include <stdio.h>
-#include <stdlib.h>
-#include "gl2_client_context.h"
-
-#ifndef GL_TRUE
-extern "C" {
- void glActiveTexture(GLenum texture);
- void glAttachShader(GLuint program, GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar* name);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- void glBindTexture(GLenum target, GLuint texture);
- void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
- void glBlendEquation(GLenum mode);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glClear(GLbitfield mask);
- void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
- void glClearDepthf(GLclampf depth);
- void glClearStencil(GLint s);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glCompileShader(GLuint shader);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- GLuint glCreateProgram();
- GLuint glCreateShader(GLenum type);
- void glCullFace(GLenum mode);
- void glDeleteBuffers(GLsizei n, const GLuint* buffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers);
- void glDeleteProgram(GLuint program);
- void glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers);
- void glDeleteShader(GLuint shader);
- void glDeleteTextures(GLsizei n, const GLuint* textures);
- void glDepthFunc(GLenum func);
- void glDepthMask(GLboolean flag);
- void glDepthRangef(GLclampf zNear, GLclampf zFar);
- void glDetachShader(GLuint program, GLuint shader);
- void glDisable(GLenum cap);
- void glDisableVertexAttribArray(GLuint index);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
- void glEnable(GLenum cap);
- void glEnableVertexAttribArray(GLuint index);
- void glFinish();
- void glFlush();
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFrontFace(GLenum mode);
- void glGenBuffers(GLsizei n, GLuint* buffers);
- void glGenerateMipmap(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint* framebuffers);
- void glGenRenderbuffers(GLsizei n, GLuint* renderbuffers);
- void glGenTextures(GLsizei n, GLuint* textures);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
- void glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
- int glGetAttribLocation(GLuint program, const GLchar* name);
- void glGetBooleanv(GLenum pname, GLboolean* params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params);
- GLenum glGetError();
- void glGetFloatv(GLenum pname, GLfloat* params);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params);
- void glGetIntegerv(GLenum pname, GLint* params);
- void glGetProgramiv(GLuint program, GLenum pname, GLint* params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint* params);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
- void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
- void glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
- const GLubyte* glGetString(GLenum name);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint* params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat* params);
- void glGetUniformiv(GLuint program, GLint location, GLint* params);
- int glGetUniformLocation(GLuint program, const GLchar* name);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer);
- void glHint(GLenum target, GLenum mode);
- GLboolean glIsBuffer(GLuint buffer);
- GLboolean glIsEnabled(GLenum cap);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- GLboolean glIsProgram(GLuint program);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsTexture(GLuint texture);
- void glLineWidth(GLfloat width);
- void glLinkProgram(GLuint program);
- void glPixelStorei(GLenum pname, GLint param);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
- void glReleaseShaderCompiler();
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glSampleCoverage(GLclampf value, GLboolean invert);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilMask(GLuint mask);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint* params);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
- void glUniform1f(GLint location, GLfloat x);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat* v);
- void glUniform1i(GLint location, GLint x);
- void glUniform1iv(GLint location, GLsizei count, const GLint* v);
- void glUniform2f(GLint location, GLfloat x, GLfloat y);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat* v);
- void glUniform2i(GLint location, GLint x, GLint y);
- void glUniform2iv(GLint location, GLsizei count, const GLint* v);
- void glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat* v);
- void glUniform3i(GLint location, GLint x, GLint y, GLint z);
- void glUniform3iv(GLint location, GLsizei count, const GLint* v);
- void glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat* v);
- void glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w);
- void glUniform4iv(GLint location, GLsizei count, const GLint* v);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- void glUseProgram(GLuint program);
- void glValidateProgram(GLuint program);
- void glVertexAttrib1f(GLuint indx, GLfloat x);
- void glVertexAttrib1fv(GLuint indx, const GLfloat* values);
- void glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
- void glVertexAttrib2fv(GLuint indx, const GLfloat* values);
- void glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
- void glVertexAttrib3fv(GLuint indx, const GLfloat* values);
- void glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertexAttrib4fv(GLuint indx, const GLfloat* values);
- void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image);
- void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image);
- void glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary);
- void glProgramBinaryOES(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLint length);
- void* glMapBufferOES(GLenum target, GLenum access);
- GLboolean glUnmapBufferOES(GLenum target);
- void glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
- void glTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
- void glCopyTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCompressedTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
- void glCompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
- void glFramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glBindVertexArrayOES(GLuint array);
- void glDeleteVertexArraysOES(GLsizei n, const GLuint* arrays);
- void glGenVertexArraysOES(GLsizei n, GLuint* arrays);
- GLboolean glIsVertexArrayOES(GLuint array);
- void glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum* attachments);
- void glMultiDrawArraysEXT(GLenum mode, GLint* first, GLsizei* count, GLsizei primcount);
- void glMultiDrawElementsEXT(GLenum mode, const GLsizei* count, GLenum type, const GLvoid** indices, GLsizei primcount);
- void glGetPerfMonitorGroupsAMD(GLint* numGroups, GLsizei groupsSize, GLuint* groups);
- void glGetPerfMonitorCountersAMD(GLuint group, GLint* numCounters, GLint* maxActiveCounters, GLsizei counterSize, GLuint* counters);
- void glGetPerfMonitorGroupStringAMD(GLuint group, GLsizei bufSize, GLsizei* length, GLchar* groupString);
- void glGetPerfMonitorCounterStringAMD(GLuint group, GLuint counter, GLsizei bufSize, GLsizei* length, GLchar* counterString);
- void glGetPerfMonitorCounterInfoAMD(GLuint group, GLuint counter, GLenum pname, GLvoid* data);
- void glGenPerfMonitorsAMD(GLsizei n, GLuint* monitors);
- void glDeletePerfMonitorsAMD(GLsizei n, GLuint* monitors);
- void glSelectPerfMonitorCountersAMD(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint* countersList);
- void glBeginPerfMonitorAMD(GLuint monitor);
- void glEndPerfMonitorAMD(GLuint monitor);
- void glGetPerfMonitorCounterDataAMD(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint* data, GLint* bytesWritten);
- void glRenderbufferStorageMultisampleIMG(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glFramebufferTexture2DMultisampleIMG(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
- void glDeleteFencesNV(GLsizei n, const GLuint* fences);
- void glGenFencesNV(GLsizei n, GLuint* fences);
- GLboolean glIsFenceNV(GLuint fence);
- GLboolean glTestFenceNV(GLuint fence);
- void glGetFenceivNV(GLuint fence, GLenum pname, GLint* params);
- void glFinishFenceNV(GLuint fence);
- void glSetFenceNV(GLuint fence, GLenum condition);
- void glCoverageMaskNV(GLboolean mask);
- void glCoverageOperationNV(GLenum operation);
- void glGetDriverControlsQCOM(GLint* num, GLsizei size, GLuint* driverControls);
- void glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei* length, GLchar* driverControlString);
- void glEnableDriverControlQCOM(GLuint driverControl);
- void glDisableDriverControlQCOM(GLuint driverControl);
- void glExtGetTexturesQCOM(GLuint* textures, GLint maxTextures, GLint* numTextures);
- void glExtGetBuffersQCOM(GLuint* buffers, GLint maxBuffers, GLint* numBuffers);
- void glExtGetRenderbuffersQCOM(GLuint* renderbuffers, GLint maxRenderbuffers, GLint* numRenderbuffers);
- void glExtGetFramebuffersQCOM(GLuint* framebuffers, GLint maxFramebuffers, GLint* numFramebuffers);
- void glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint* params);
- void glExtTexObjectStateOverrideiQCOM(GLenum target, GLenum pname, GLint param);
- void glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid* texels);
- void glExtGetBufferPointervQCOM(GLenum target, GLvoidptr* params);
- void glExtGetShadersQCOM(GLuint* shaders, GLint maxShaders, GLint* numShaders);
- void glExtGetProgramsQCOM(GLuint* programs, GLint maxPrograms, GLint* numPrograms);
- GLboolean glExtIsProgramBinaryQCOM(GLuint program);
- void glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar* source, GLint* length);
- void glStartTilingQCOM(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
- void glEndTilingQCOM(GLbitfield preserveMask);
- void glVertexAttribPointerData(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, void* data, GLuint datalen);
- void glVertexAttribPointerOffset(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint offset);
- void glDrawElementsOffset(GLenum mode, GLsizei count, GLenum type, GLuint offset);
- void glDrawElementsData(GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen);
- void glGetCompressedTextureFormats(int count, GLint* formats);
- void glShaderString(GLuint shader, const GLchar* string, GLsizei len);
- int glFinishRoundTrip();
-};
-
-#endif
-#ifndef GET_CONTEXT
-static gl2_client_context_t::CONTEXT_ACCESSOR_TYPE *getCurrentContext = NULL;
-void gl2_client_context_t::setContextAccessor(CONTEXT_ACCESSOR_TYPE *f) { getCurrentContext = f; }
-#define GET_CONTEXT gl2_client_context_t * ctx = getCurrentContext()
-#endif
-
-void glActiveTexture(GLenum texture)
-{
- GET_CONTEXT;
- ctx->glActiveTexture(ctx, texture);
-}
-
-void glAttachShader(GLuint program, GLuint shader)
-{
- GET_CONTEXT;
- ctx->glAttachShader(ctx, program, shader);
-}
-
-void glBindAttribLocation(GLuint program, GLuint index, const GLchar* name)
-{
- GET_CONTEXT;
- ctx->glBindAttribLocation(ctx, program, index, name);
-}
-
-void glBindBuffer(GLenum target, GLuint buffer)
-{
- GET_CONTEXT;
- ctx->glBindBuffer(ctx, target, buffer);
-}
-
-void glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- GET_CONTEXT;
- ctx->glBindFramebuffer(ctx, target, framebuffer);
-}
-
-void glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- GET_CONTEXT;
- ctx->glBindRenderbuffer(ctx, target, renderbuffer);
-}
-
-void glBindTexture(GLenum target, GLuint texture)
-{
- GET_CONTEXT;
- ctx->glBindTexture(ctx, target, texture);
-}
-
-void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
- GET_CONTEXT;
- ctx->glBlendColor(ctx, red, green, blue, alpha);
-}
-
-void glBlendEquation(GLenum mode)
-{
- GET_CONTEXT;
- ctx->glBlendEquation(ctx, mode);
-}
-
-void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- GET_CONTEXT;
- ctx->glBlendEquationSeparate(ctx, modeRGB, modeAlpha);
-}
-
-void glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- GET_CONTEXT;
- ctx->glBlendFunc(ctx, sfactor, dfactor);
-}
-
-void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- GET_CONTEXT;
- ctx->glBlendFuncSeparate(ctx, srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-void glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
-{
- GET_CONTEXT;
- ctx->glBufferData(ctx, target, size, data, usage);
-}
-
-void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
-{
- GET_CONTEXT;
- ctx->glBufferSubData(ctx, target, offset, size, data);
-}
-
-GLenum glCheckFramebufferStatus(GLenum target)
-{
- GET_CONTEXT;
- return ctx->glCheckFramebufferStatus(ctx, target);
-}
-
-void glClear(GLbitfield mask)
-{
- GET_CONTEXT;
- ctx->glClear(ctx, mask);
-}
-
-void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
- GET_CONTEXT;
- ctx->glClearColor(ctx, red, green, blue, alpha);
-}
-
-void glClearDepthf(GLclampf depth)
-{
- GET_CONTEXT;
- ctx->glClearDepthf(ctx, depth);
-}
-
-void glClearStencil(GLint s)
-{
- GET_CONTEXT;
- ctx->glClearStencil(ctx, s);
-}
-
-void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- GET_CONTEXT;
- ctx->glColorMask(ctx, red, green, blue, alpha);
-}
-
-void glCompileShader(GLuint shader)
-{
- GET_CONTEXT;
- ctx->glCompileShader(ctx, shader);
-}
-
-void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data)
-{
- GET_CONTEXT;
- ctx->glCompressedTexImage2D(ctx, target, level, internalformat, width, height, border, imageSize, data);
-}
-
-void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data)
-{
- GET_CONTEXT;
- ctx->glCompressedTexSubImage2D(ctx, target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- GET_CONTEXT;
- ctx->glCopyTexImage2D(ctx, target, level, internalformat, x, y, width, height, border);
-}
-
-void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- GET_CONTEXT;
- ctx->glCopyTexSubImage2D(ctx, target, level, xoffset, yoffset, x, y, width, height);
-}
-
-GLuint glCreateProgram()
-{
- GET_CONTEXT;
- return ctx->glCreateProgram(ctx);
-}
-
-GLuint glCreateShader(GLenum type)
-{
- GET_CONTEXT;
- return ctx->glCreateShader(ctx, type);
-}
-
-void glCullFace(GLenum mode)
-{
- GET_CONTEXT;
- ctx->glCullFace(ctx, mode);
-}
-
-void glDeleteBuffers(GLsizei n, const GLuint* buffers)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glDeleteBuffers(ctx, n, buffers);
-}
-
-void glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glDeleteFramebuffers(ctx, n, framebuffers);
-}
-
-void glDeleteProgram(GLuint program)
-{
- GET_CONTEXT;
- ctx->glDeleteProgram(ctx, program);
-}
-
-void glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glDeleteRenderbuffers(ctx, n, renderbuffers);
-}
-
-void glDeleteShader(GLuint shader)
-{
- GET_CONTEXT;
- ctx->glDeleteShader(ctx, shader);
-}
-
-void glDeleteTextures(GLsizei n, const GLuint* textures)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glDeleteTextures(ctx, n, textures);
-}
-
-void glDepthFunc(GLenum func)
-{
- GET_CONTEXT;
- ctx->glDepthFunc(ctx, func);
-}
-
-void glDepthMask(GLboolean flag)
-{
- GET_CONTEXT;
- ctx->glDepthMask(ctx, flag);
-}
-
-void glDepthRangef(GLclampf zNear, GLclampf zFar)
-{
- GET_CONTEXT;
- ctx->glDepthRangef(ctx, zNear, zFar);
-}
-
-void glDetachShader(GLuint program, GLuint shader)
-{
- GET_CONTEXT;
- ctx->glDetachShader(ctx, program, shader);
-}
-
-void glDisable(GLenum cap)
-{
- GET_CONTEXT;
- ctx->glDisable(ctx, cap);
-}
-
-void glDisableVertexAttribArray(GLuint index)
-{
- GET_CONTEXT;
- ctx->glDisableVertexAttribArray(ctx, index);
-}
-
-void glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- GET_CONTEXT;
- ctx->glDrawArrays(ctx, mode, first, count);
-}
-
-void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
-{
- GET_CONTEXT;
- ctx->glDrawElements(ctx, mode, count, type, indices);
-}
-
-void glEnable(GLenum cap)
-{
- GET_CONTEXT;
- ctx->glEnable(ctx, cap);
-}
-
-void glEnableVertexAttribArray(GLuint index)
-{
- GET_CONTEXT;
- ctx->glEnableVertexAttribArray(ctx, index);
-}
-
-void glFinish()
-{
- GET_CONTEXT;
- ctx->glFinish(ctx);
-}
-
-void glFlush()
-{
- GET_CONTEXT;
- ctx->glFlush(ctx);
-}
-
-void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- GET_CONTEXT;
- ctx->glFramebufferRenderbuffer(ctx, target, attachment, renderbuffertarget, renderbuffer);
-}
-
-void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- GET_CONTEXT;
- ctx->glFramebufferTexture2D(ctx, target, attachment, textarget, texture, level);
-}
-
-void glFrontFace(GLenum mode)
-{
- GET_CONTEXT;
- ctx->glFrontFace(ctx, mode);
-}
-
-void glGenBuffers(GLsizei n, GLuint* buffers)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glGenBuffers(ctx, n, buffers);
-}
-
-void glGenerateMipmap(GLenum target)
-{
- GET_CONTEXT;
- ctx->glGenerateMipmap(ctx, target);
-}
-
-void glGenFramebuffers(GLsizei n, GLuint* framebuffers)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glGenFramebuffers(ctx, n, framebuffers);
-}
-
-void glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glGenRenderbuffers(ctx, n, renderbuffers);
-}
-
-void glGenTextures(GLsizei n, GLuint* textures)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glGenTextures(ctx, n, textures);
-}
-
-void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
-{
- GET_CONTEXT;
- ctx->glGetActiveAttrib(ctx, program, index, bufsize, length, size, type, name);
-}
-
-void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
-{
- GET_CONTEXT;
- ctx->glGetActiveUniform(ctx, program, index, bufsize, length, size, type, name);
-}
-
-void glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
-{
- GET_CONTEXT;
- ctx->glGetAttachedShaders(ctx, program, maxcount, count, shaders);
-}
-
-int glGetAttribLocation(GLuint program, const GLchar* name)
-{
- GET_CONTEXT;
- return ctx->glGetAttribLocation(ctx, program, name);
-}
-
-void glGetBooleanv(GLenum pname, GLboolean* params)
-{
- GET_CONTEXT;
- ctx->glGetBooleanv(ctx, pname, params);
-}
-
-void glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
-{
- GET_CONTEXT;
- ctx->glGetBufferParameteriv(ctx, target, pname, params);
-}
-
-GLenum glGetError()
-{
- GET_CONTEXT;
- return ctx->glGetError(ctx);
-}
-
-void glGetFloatv(GLenum pname, GLfloat* params)
-{
- GET_CONTEXT;
- ctx->glGetFloatv(ctx, pname, params);
-}
-
-void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
-{
- GET_CONTEXT;
- ctx->glGetFramebufferAttachmentParameteriv(ctx, target, attachment, pname, params);
-}
-
-void glGetIntegerv(GLenum pname, GLint* params)
-{
- GET_CONTEXT;
- ctx->glGetIntegerv(ctx, pname, params);
-}
-
-void glGetProgramiv(GLuint program, GLenum pname, GLint* params)
-{
- GET_CONTEXT;
- ctx->glGetProgramiv(ctx, program, pname, params);
-}
-
-void glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
-{
- GET_CONTEXT;
- ctx->glGetProgramInfoLog(ctx, program, bufsize, length, infolog);
-}
-
-void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
-{
- GET_CONTEXT;
- ctx->glGetRenderbufferParameteriv(ctx, target, pname, params);
-}
-
-void glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
-{
- GET_CONTEXT;
- ctx->glGetShaderiv(ctx, shader, pname, params);
-}
-
-void glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
-{
- GET_CONTEXT;
- ctx->glGetShaderInfoLog(ctx, shader, bufsize, length, infolog);
-}
-
-void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
-{
- GET_CONTEXT;
- ctx->glGetShaderPrecisionFormat(ctx, shadertype, precisiontype, range, precision);
-}
-
-void glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
-{
- GET_CONTEXT;
- ctx->glGetShaderSource(ctx, shader, bufsize, length, source);
-}
-
-const GLubyte* glGetString(GLenum name)
-{
- GET_CONTEXT;
- return ctx->glGetString(ctx, name);
-}
-
-void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
-{
- GET_CONTEXT;
- ctx->glGetTexParameterfv(ctx, target, pname, params);
-}
-
-void glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
-{
- GET_CONTEXT;
- ctx->glGetTexParameteriv(ctx, target, pname, params);
-}
-
-void glGetUniformfv(GLuint program, GLint location, GLfloat* params)
-{
- GET_CONTEXT;
- ctx->glGetUniformfv(ctx, program, location, params);
-}
-
-void glGetUniformiv(GLuint program, GLint location, GLint* params)
-{
- GET_CONTEXT;
- ctx->glGetUniformiv(ctx, program, location, params);
-}
-
-int glGetUniformLocation(GLuint program, const GLchar* name)
-{
- GET_CONTEXT;
- return ctx->glGetUniformLocation(ctx, program, name);
-}
-
-void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
-{
- GET_CONTEXT;
- ctx->glGetVertexAttribfv(ctx, index, pname, params);
-}
-
-void glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
-{
- GET_CONTEXT;
- ctx->glGetVertexAttribiv(ctx, index, pname, params);
-}
-
-void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer)
-{
- GET_CONTEXT;
- ctx->glGetVertexAttribPointerv(ctx, index, pname, pointer);
-}
-
-void glHint(GLenum target, GLenum mode)
-{
- GET_CONTEXT;
- ctx->glHint(ctx, target, mode);
-}
-
-GLboolean glIsBuffer(GLuint buffer)
-{
- GET_CONTEXT;
- return ctx->glIsBuffer(ctx, buffer);
-}
-
-GLboolean glIsEnabled(GLenum cap)
-{
- GET_CONTEXT;
- return ctx->glIsEnabled(ctx, cap);
-}
-
-GLboolean glIsFramebuffer(GLuint framebuffer)
-{
- GET_CONTEXT;
- return ctx->glIsFramebuffer(ctx, framebuffer);
-}
-
-GLboolean glIsProgram(GLuint program)
-{
- GET_CONTEXT;
- return ctx->glIsProgram(ctx, program);
-}
-
-GLboolean glIsRenderbuffer(GLuint renderbuffer)
-{
- GET_CONTEXT;
- return ctx->glIsRenderbuffer(ctx, renderbuffer);
-}
-
-GLboolean glIsShader(GLuint shader)
-{
- GET_CONTEXT;
- return ctx->glIsShader(ctx, shader);
-}
-
-GLboolean glIsTexture(GLuint texture)
-{
- GET_CONTEXT;
- return ctx->glIsTexture(ctx, texture);
-}
-
-void glLineWidth(GLfloat width)
-{
- GET_CONTEXT;
- ctx->glLineWidth(ctx, width);
-}
-
-void glLinkProgram(GLuint program)
-{
- GET_CONTEXT;
- ctx->glLinkProgram(ctx, program);
-}
-
-void glPixelStorei(GLenum pname, GLint param)
-{
- GET_CONTEXT;
- ctx->glPixelStorei(ctx, pname, param);
-}
-
-void glPolygonOffset(GLfloat factor, GLfloat units)
-{
- GET_CONTEXT;
- ctx->glPolygonOffset(ctx, factor, units);
-}
-
-void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
-{
- GET_CONTEXT;
- ctx->glReadPixels(ctx, x, y, width, height, format, type, pixels);
-}
-
-void glReleaseShaderCompiler()
-{
- GET_CONTEXT;
- ctx->glReleaseShaderCompiler(ctx);
-}
-
-void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- GET_CONTEXT;
- ctx->glRenderbufferStorage(ctx, target, internalformat, width, height);
-}
-
-void glSampleCoverage(GLclampf value, GLboolean invert)
-{
- GET_CONTEXT;
- ctx->glSampleCoverage(ctx, value, invert);
-}
-
-void glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- GET_CONTEXT;
- ctx->glScissor(ctx, x, y, width, height);
-}
-
-void glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length)
-{
- GET_CONTEXT;
- ctx->glShaderBinary(ctx, n, shaders, binaryformat, binary, length);
-}
-
-void glShaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length)
-{
- GET_CONTEXT;
- ctx->glShaderSource(ctx, shader, count, string, length);
-}
-
-void glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- GET_CONTEXT;
- ctx->glStencilFunc(ctx, func, ref, mask);
-}
-
-void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- GET_CONTEXT;
- ctx->glStencilFuncSeparate(ctx, face, func, ref, mask);
-}
-
-void glStencilMask(GLuint mask)
-{
- GET_CONTEXT;
- ctx->glStencilMask(ctx, mask);
-}
-
-void glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- GET_CONTEXT;
- ctx->glStencilMaskSeparate(ctx, face, mask);
-}
-
-void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- GET_CONTEXT;
- ctx->glStencilOp(ctx, fail, zfail, zpass);
-}
-
-void glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
-{
- GET_CONTEXT;
- ctx->glStencilOpSeparate(ctx, face, fail, zfail, zpass);
-}
-
-void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
-{
- GET_CONTEXT;
- ctx->glTexImage2D(ctx, target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-void glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- GET_CONTEXT;
- ctx->glTexParameterf(ctx, target, pname, param);
-}
-
-void glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
-{
- GET_CONTEXT;
- ctx->glTexParameterfv(ctx, target, pname, params);
-}
-
-void glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- GET_CONTEXT;
- ctx->glTexParameteri(ctx, target, pname, param);
-}
-
-void glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
-{
- GET_CONTEXT;
- ctx->glTexParameteriv(ctx, target, pname, params);
-}
-
-void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
-{
- GET_CONTEXT;
- ctx->glTexSubImage2D(ctx, target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-void glUniform1f(GLint location, GLfloat x)
-{
- GET_CONTEXT;
- ctx->glUniform1f(ctx, location, x);
-}
-
-void glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
-{
- GET_CONTEXT;
- ctx->glUniform1fv(ctx, location, count, v);
-}
-
-void glUniform1i(GLint location, GLint x)
-{
- GET_CONTEXT;
- ctx->glUniform1i(ctx, location, x);
-}
-
-void glUniform1iv(GLint location, GLsizei count, const GLint* v)
-{
- GET_CONTEXT;
- ctx->glUniform1iv(ctx, location, count, v);
-}
-
-void glUniform2f(GLint location, GLfloat x, GLfloat y)
-{
- GET_CONTEXT;
- ctx->glUniform2f(ctx, location, x, y);
-}
-
-void glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
-{
- GET_CONTEXT;
- ctx->glUniform2fv(ctx, location, count, v);
-}
-
-void glUniform2i(GLint location, GLint x, GLint y)
-{
- GET_CONTEXT;
- ctx->glUniform2i(ctx, location, x, y);
-}
-
-void glUniform2iv(GLint location, GLsizei count, const GLint* v)
-{
- GET_CONTEXT;
- ctx->glUniform2iv(ctx, location, count, v);
-}
-
-void glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
-{
- GET_CONTEXT;
- ctx->glUniform3f(ctx, location, x, y, z);
-}
-
-void glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
-{
- GET_CONTEXT;
- ctx->glUniform3fv(ctx, location, count, v);
-}
-
-void glUniform3i(GLint location, GLint x, GLint y, GLint z)
-{
- GET_CONTEXT;
- ctx->glUniform3i(ctx, location, x, y, z);
-}
-
-void glUniform3iv(GLint location, GLsizei count, const GLint* v)
-{
- GET_CONTEXT;
- ctx->glUniform3iv(ctx, location, count, v);
-}
-
-void glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GET_CONTEXT;
- ctx->glUniform4f(ctx, location, x, y, z, w);
-}
-
-void glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
-{
- GET_CONTEXT;
- ctx->glUniform4fv(ctx, location, count, v);
-}
-
-void glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
-{
- GET_CONTEXT;
- ctx->glUniform4i(ctx, location, x, y, z, w);
-}
-
-void glUniform4iv(GLint location, GLsizei count, const GLint* v)
-{
- GET_CONTEXT;
- ctx->glUniform4iv(ctx, location, count, v);
-}
-
-void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- GET_CONTEXT;
- ctx->glUniformMatrix2fv(ctx, location, count, transpose, value);
-}
-
-void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- GET_CONTEXT;
- ctx->glUniformMatrix3fv(ctx, location, count, transpose, value);
-}
-
-void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- GET_CONTEXT;
- ctx->glUniformMatrix4fv(ctx, location, count, transpose, value);
-}
-
-void glUseProgram(GLuint program)
-{
- GET_CONTEXT;
- ctx->glUseProgram(ctx, program);
-}
-
-void glValidateProgram(GLuint program)
-{
- GET_CONTEXT;
- ctx->glValidateProgram(ctx, program);
-}
-
-void glVertexAttrib1f(GLuint indx, GLfloat x)
-{
- GET_CONTEXT;
- ctx->glVertexAttrib1f(ctx, indx, x);
-}
-
-void glVertexAttrib1fv(GLuint indx, const GLfloat* values)
-{
- GET_CONTEXT;
- ctx->glVertexAttrib1fv(ctx, indx, values);
-}
-
-void glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
-{
- GET_CONTEXT;
- ctx->glVertexAttrib2f(ctx, indx, x, y);
-}
-
-void glVertexAttrib2fv(GLuint indx, const GLfloat* values)
-{
- GET_CONTEXT;
- ctx->glVertexAttrib2fv(ctx, indx, values);
-}
-
-void glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
-{
- GET_CONTEXT;
- ctx->glVertexAttrib3f(ctx, indx, x, y, z);
-}
-
-void glVertexAttrib3fv(GLuint indx, const GLfloat* values)
-{
- GET_CONTEXT;
- ctx->glVertexAttrib3fv(ctx, indx, values);
-}
-
-void glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GET_CONTEXT;
- ctx->glVertexAttrib4f(ctx, indx, x, y, z, w);
-}
-
-void glVertexAttrib4fv(GLuint indx, const GLfloat* values)
-{
- GET_CONTEXT;
- ctx->glVertexAttrib4fv(ctx, indx, values);
-}
-
-void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr)
-{
- GET_CONTEXT;
- ctx->glVertexAttribPointer(ctx, indx, size, type, normalized, stride, ptr);
-}
-
-void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- GET_CONTEXT;
- ctx->glViewport(ctx, x, y, width, height);
-}
-
-void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
-{
- GET_CONTEXT;
- ctx->glEGLImageTargetTexture2DOES(ctx, target, image);
-}
-
-void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
-{
- GET_CONTEXT;
- ctx->glEGLImageTargetRenderbufferStorageOES(ctx, target, image);
-}
-
-void glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary)
-{
- GET_CONTEXT;
- ctx->glGetProgramBinaryOES(ctx, program, bufSize, length, binaryFormat, binary);
-}
-
-void glProgramBinaryOES(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLint length)
-{
- GET_CONTEXT;
- ctx->glProgramBinaryOES(ctx, program, binaryFormat, binary, length);
-}
-
-void* glMapBufferOES(GLenum target, GLenum access)
-{
- GET_CONTEXT;
- return ctx->glMapBufferOES(ctx, target, access);
-}
-
-GLboolean glUnmapBufferOES(GLenum target)
-{
- GET_CONTEXT;
- return ctx->glUnmapBufferOES(ctx, target);
-}
-
-void glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
-{
- GET_CONTEXT;
- ctx->glTexImage3DOES(ctx, target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-void glTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels)
-{
- GET_CONTEXT;
- ctx->glTexSubImage3DOES(ctx, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-void glCopyTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- GET_CONTEXT;
- ctx->glCopyTexSubImage3DOES(ctx, target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-void glCompressedTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
-{
- GET_CONTEXT;
- ctx->glCompressedTexImage3DOES(ctx, target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-void glCompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data)
-{
- GET_CONTEXT;
- ctx->glCompressedTexSubImage3DOES(ctx, target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-void glFramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- GET_CONTEXT;
- ctx->glFramebufferTexture3DOES(ctx, target, attachment, textarget, texture, level, zoffset);
-}
-
-void glBindVertexArrayOES(GLuint array)
-{
- GET_CONTEXT;
- ctx->glBindVertexArrayOES(ctx, array);
-}
-
-void glDeleteVertexArraysOES(GLsizei n, const GLuint* arrays)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glDeleteVertexArraysOES(ctx, n, arrays);
-}
-
-void glGenVertexArraysOES(GLsizei n, GLuint* arrays)
-{
- GET_CONTEXT;
- if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
- ctx->glGenVertexArraysOES(ctx, n, arrays);
-}
-
-GLboolean glIsVertexArrayOES(GLuint array)
-{
- GET_CONTEXT;
- return ctx->glIsVertexArrayOES(ctx, array);
-}
-
-void glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum* attachments)
-{
- GET_CONTEXT;
- ctx->glDiscardFramebufferEXT(ctx, target, numAttachments, attachments);
-}
-
-void glMultiDrawArraysEXT(GLenum mode, GLint* first, GLsizei* count, GLsizei primcount)
-{
- GET_CONTEXT;
- ctx->glMultiDrawArraysEXT(ctx, mode, first, count, primcount);
-}
-
-void glMultiDrawElementsEXT(GLenum mode, const GLsizei* count, GLenum type, const GLvoid** indices, GLsizei primcount)
-{
- GET_CONTEXT;
- ctx->glMultiDrawElementsEXT(ctx, mode, count, type, indices, primcount);
-}
-
-void glGetPerfMonitorGroupsAMD(GLint* numGroups, GLsizei groupsSize, GLuint* groups)
-{
- GET_CONTEXT;
- ctx->glGetPerfMonitorGroupsAMD(ctx, numGroups, groupsSize, groups);
-}
-
-void glGetPerfMonitorCountersAMD(GLuint group, GLint* numCounters, GLint* maxActiveCounters, GLsizei counterSize, GLuint* counters)
-{
- GET_CONTEXT;
- ctx->glGetPerfMonitorCountersAMD(ctx, group, numCounters, maxActiveCounters, counterSize, counters);
-}
-
-void glGetPerfMonitorGroupStringAMD(GLuint group, GLsizei bufSize, GLsizei* length, GLchar* groupString)
-{
- GET_CONTEXT;
- ctx->glGetPerfMonitorGroupStringAMD(ctx, group, bufSize, length, groupString);
-}
-
-void glGetPerfMonitorCounterStringAMD(GLuint group, GLuint counter, GLsizei bufSize, GLsizei* length, GLchar* counterString)
-{
- GET_CONTEXT;
- ctx->glGetPerfMonitorCounterStringAMD(ctx, group, counter, bufSize, length, counterString);
-}
-
-void glGetPerfMonitorCounterInfoAMD(GLuint group, GLuint counter, GLenum pname, GLvoid* data)
-{
- GET_CONTEXT;
- ctx->glGetPerfMonitorCounterInfoAMD(ctx, group, counter, pname, data);
-}
-
-void glGenPerfMonitorsAMD(GLsizei n, GLuint* monitors)
-{
- GET_CONTEXT;
- ctx->glGenPerfMonitorsAMD(ctx, n, monitors);
-}
-
-void glDeletePerfMonitorsAMD(GLsizei n, GLuint* monitors)
-{
- GET_CONTEXT;
- ctx->glDeletePerfMonitorsAMD(ctx, n, monitors);
-}
-
-void glSelectPerfMonitorCountersAMD(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint* countersList)
-{
- GET_CONTEXT;
- ctx->glSelectPerfMonitorCountersAMD(ctx, monitor, enable, group, numCounters, countersList);
-}
-
-void glBeginPerfMonitorAMD(GLuint monitor)
-{
- GET_CONTEXT;
- ctx->glBeginPerfMonitorAMD(ctx, monitor);
-}
-
-void glEndPerfMonitorAMD(GLuint monitor)
-{
- GET_CONTEXT;
- ctx->glEndPerfMonitorAMD(ctx, monitor);
-}
-
-void glGetPerfMonitorCounterDataAMD(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint* data, GLint* bytesWritten)
-{
- GET_CONTEXT;
- ctx->glGetPerfMonitorCounterDataAMD(ctx, monitor, pname, dataSize, data, bytesWritten);
-}
-
-void glRenderbufferStorageMultisampleIMG(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- GET_CONTEXT;
- ctx->glRenderbufferStorageMultisampleIMG(ctx, target, samples, internalformat, width, height);
-}
-
-void glFramebufferTexture2DMultisampleIMG(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples)
-{
- GET_CONTEXT;
- ctx->glFramebufferTexture2DMultisampleIMG(ctx, target, attachment, textarget, texture, level, samples);
-}
-
-void glDeleteFencesNV(GLsizei n, const GLuint* fences)
-{
- GET_CONTEXT;
- ctx->glDeleteFencesNV(ctx, n, fences);
-}
-
-void glGenFencesNV(GLsizei n, GLuint* fences)
-{
- GET_CONTEXT;
- ctx->glGenFencesNV(ctx, n, fences);
-}
-
-GLboolean glIsFenceNV(GLuint fence)
-{
- GET_CONTEXT;
- return ctx->glIsFenceNV(ctx, fence);
-}
-
-GLboolean glTestFenceNV(GLuint fence)
-{
- GET_CONTEXT;
- return ctx->glTestFenceNV(ctx, fence);
-}
-
-void glGetFenceivNV(GLuint fence, GLenum pname, GLint* params)
-{
- GET_CONTEXT;
- ctx->glGetFenceivNV(ctx, fence, pname, params);
-}
-
-void glFinishFenceNV(GLuint fence)
-{
- GET_CONTEXT;
- ctx->glFinishFenceNV(ctx, fence);
-}
-
-void glSetFenceNV(GLuint fence, GLenum condition)
-{
- GET_CONTEXT;
- ctx->glSetFenceNV(ctx, fence, condition);
-}
-
-void glCoverageMaskNV(GLboolean mask)
-{
- GET_CONTEXT;
- ctx->glCoverageMaskNV(ctx, mask);
-}
-
-void glCoverageOperationNV(GLenum operation)
-{
- GET_CONTEXT;
- ctx->glCoverageOperationNV(ctx, operation);
-}
-
-void glGetDriverControlsQCOM(GLint* num, GLsizei size, GLuint* driverControls)
-{
- GET_CONTEXT;
- ctx->glGetDriverControlsQCOM(ctx, num, size, driverControls);
-}
-
-void glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei* length, GLchar* driverControlString)
-{
- GET_CONTEXT;
- ctx->glGetDriverControlStringQCOM(ctx, driverControl, bufSize, length, driverControlString);
-}
-
-void glEnableDriverControlQCOM(GLuint driverControl)
-{
- GET_CONTEXT;
- ctx->glEnableDriverControlQCOM(ctx, driverControl);
-}
-
-void glDisableDriverControlQCOM(GLuint driverControl)
-{
- GET_CONTEXT;
- ctx->glDisableDriverControlQCOM(ctx, driverControl);
-}
-
-void glExtGetTexturesQCOM(GLuint* textures, GLint maxTextures, GLint* numTextures)
-{
- GET_CONTEXT;
- ctx->glExtGetTexturesQCOM(ctx, textures, maxTextures, numTextures);
-}
-
-void glExtGetBuffersQCOM(GLuint* buffers, GLint maxBuffers, GLint* numBuffers)
-{
- GET_CONTEXT;
- ctx->glExtGetBuffersQCOM(ctx, buffers, maxBuffers, numBuffers);
-}
-
-void glExtGetRenderbuffersQCOM(GLuint* renderbuffers, GLint maxRenderbuffers, GLint* numRenderbuffers)
-{
- GET_CONTEXT;
- ctx->glExtGetRenderbuffersQCOM(ctx, renderbuffers, maxRenderbuffers, numRenderbuffers);
-}
-
-void glExtGetFramebuffersQCOM(GLuint* framebuffers, GLint maxFramebuffers, GLint* numFramebuffers)
-{
- GET_CONTEXT;
- ctx->glExtGetFramebuffersQCOM(ctx, framebuffers, maxFramebuffers, numFramebuffers);
-}
-
-void glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint* params)
-{
- GET_CONTEXT;
- ctx->glExtGetTexLevelParameterivQCOM(ctx, texture, face, level, pname, params);
-}
-
-void glExtTexObjectStateOverrideiQCOM(GLenum target, GLenum pname, GLint param)
-{
- GET_CONTEXT;
- ctx->glExtTexObjectStateOverrideiQCOM(ctx, target, pname, param);
-}
-
-void glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid* texels)
-{
- GET_CONTEXT;
- ctx->glExtGetTexSubImageQCOM(ctx, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texels);
-}
-
-void glExtGetBufferPointervQCOM(GLenum target, GLvoidptr* params)
-{
- GET_CONTEXT;
- ctx->glExtGetBufferPointervQCOM(ctx, target, params);
-}
-
-void glExtGetShadersQCOM(GLuint* shaders, GLint maxShaders, GLint* numShaders)
-{
- GET_CONTEXT;
- ctx->glExtGetShadersQCOM(ctx, shaders, maxShaders, numShaders);
-}
-
-void glExtGetProgramsQCOM(GLuint* programs, GLint maxPrograms, GLint* numPrograms)
-{
- GET_CONTEXT;
- ctx->glExtGetProgramsQCOM(ctx, programs, maxPrograms, numPrograms);
-}
-
-GLboolean glExtIsProgramBinaryQCOM(GLuint program)
-{
- GET_CONTEXT;
- return ctx->glExtIsProgramBinaryQCOM(ctx, program);
-}
-
-void glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar* source, GLint* length)
-{
- GET_CONTEXT;
- ctx->glExtGetProgramBinarySourceQCOM(ctx, program, shadertype, source, length);
-}
-
-void glStartTilingQCOM(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask)
-{
- GET_CONTEXT;
- ctx->glStartTilingQCOM(ctx, x, y, width, height, preserveMask);
-}
-
-void glEndTilingQCOM(GLbitfield preserveMask)
-{
- GET_CONTEXT;
- ctx->glEndTilingQCOM(ctx, preserveMask);
-}
-
-void glVertexAttribPointerData(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, void* data, GLuint datalen)
-{
- GET_CONTEXT;
- ctx->glVertexAttribPointerData(ctx, indx, size, type, normalized, stride, data, datalen);
-}
-
-void glVertexAttribPointerOffset(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint offset)
-{
- GET_CONTEXT;
- ctx->glVertexAttribPointerOffset(ctx, indx, size, type, normalized, stride, offset);
-}
-
-void glDrawElementsOffset(GLenum mode, GLsizei count, GLenum type, GLuint offset)
-{
- GET_CONTEXT;
- ctx->glDrawElementsOffset(ctx, mode, count, type, offset);
-}
-
-void glDrawElementsData(GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen)
-{
- GET_CONTEXT;
- ctx->glDrawElementsData(ctx, mode, count, type, data, datalen);
-}
-
-void glGetCompressedTextureFormats(int count, GLint* formats)
-{
- GET_CONTEXT;
- ctx->glGetCompressedTextureFormats(ctx, count, formats);
-}
-
-void glShaderString(GLuint shader, const GLchar* string, GLsizei len)
-{
- GET_CONTEXT;
- ctx->glShaderString(ctx, shader, string, len);
-}
-
-int glFinishRoundTrip()
-{
- GET_CONTEXT;
- return ctx->glFinishRoundTrip(ctx);
-}
-
diff --git a/tools/emulator/opengl/system/GLESv2_enc/gl2_ftable.h b/tools/emulator/opengl/system/GLESv2_enc/gl2_ftable.h
deleted file mode 100644
index 4cbda78cb..000000000
--- a/tools/emulator/opengl/system/GLESv2_enc/gl2_ftable.h
+++ /dev/null
@@ -1,216 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-#ifndef __gl2_client_ftable_t_h
-#define __gl2_client_ftable_t_h
-
-
-static struct _gl2_funcs_by_name {
- const char *name;
- void *proc;
-} gl2_funcs_by_name[] = {
- {"glActiveTexture", (void*)glActiveTexture},
- {"glAttachShader", (void*)glAttachShader},
- {"glBindAttribLocation", (void*)glBindAttribLocation},
- {"glBindBuffer", (void*)glBindBuffer},
- {"glBindFramebuffer", (void*)glBindFramebuffer},
- {"glBindRenderbuffer", (void*)glBindRenderbuffer},
- {"glBindTexture", (void*)glBindTexture},
- {"glBlendColor", (void*)glBlendColor},
- {"glBlendEquation", (void*)glBlendEquation},
- {"glBlendEquationSeparate", (void*)glBlendEquationSeparate},
- {"glBlendFunc", (void*)glBlendFunc},
- {"glBlendFuncSeparate", (void*)glBlendFuncSeparate},
- {"glBufferData", (void*)glBufferData},
- {"glBufferSubData", (void*)glBufferSubData},
- {"glCheckFramebufferStatus", (void*)glCheckFramebufferStatus},
- {"glClear", (void*)glClear},
- {"glClearColor", (void*)glClearColor},
- {"glClearDepthf", (void*)glClearDepthf},
- {"glClearStencil", (void*)glClearStencil},
- {"glColorMask", (void*)glColorMask},
- {"glCompileShader", (void*)glCompileShader},
- {"glCompressedTexImage2D", (void*)glCompressedTexImage2D},
- {"glCompressedTexSubImage2D", (void*)glCompressedTexSubImage2D},
- {"glCopyTexImage2D", (void*)glCopyTexImage2D},
- {"glCopyTexSubImage2D", (void*)glCopyTexSubImage2D},
- {"glCreateProgram", (void*)glCreateProgram},
- {"glCreateShader", (void*)glCreateShader},
- {"glCullFace", (void*)glCullFace},
- {"glDeleteBuffers", (void*)glDeleteBuffers},
- {"glDeleteFramebuffers", (void*)glDeleteFramebuffers},
- {"glDeleteProgram", (void*)glDeleteProgram},
- {"glDeleteRenderbuffers", (void*)glDeleteRenderbuffers},
- {"glDeleteShader", (void*)glDeleteShader},
- {"glDeleteTextures", (void*)glDeleteTextures},
- {"glDepthFunc", (void*)glDepthFunc},
- {"glDepthMask", (void*)glDepthMask},
- {"glDepthRangef", (void*)glDepthRangef},
- {"glDetachShader", (void*)glDetachShader},
- {"glDisable", (void*)glDisable},
- {"glDisableVertexAttribArray", (void*)glDisableVertexAttribArray},
- {"glDrawArrays", (void*)glDrawArrays},
- {"glDrawElements", (void*)glDrawElements},
- {"glEnable", (void*)glEnable},
- {"glEnableVertexAttribArray", (void*)glEnableVertexAttribArray},
- {"glFinish", (void*)glFinish},
- {"glFlush", (void*)glFlush},
- {"glFramebufferRenderbuffer", (void*)glFramebufferRenderbuffer},
- {"glFramebufferTexture2D", (void*)glFramebufferTexture2D},
- {"glFrontFace", (void*)glFrontFace},
- {"glGenBuffers", (void*)glGenBuffers},
- {"glGenerateMipmap", (void*)glGenerateMipmap},
- {"glGenFramebuffers", (void*)glGenFramebuffers},
- {"glGenRenderbuffers", (void*)glGenRenderbuffers},
- {"glGenTextures", (void*)glGenTextures},
- {"glGetActiveAttrib", (void*)glGetActiveAttrib},
- {"glGetActiveUniform", (void*)glGetActiveUniform},
- {"glGetAttachedShaders", (void*)glGetAttachedShaders},
- {"glGetAttribLocation", (void*)glGetAttribLocation},
- {"glGetBooleanv", (void*)glGetBooleanv},
- {"glGetBufferParameteriv", (void*)glGetBufferParameteriv},
- {"glGetError", (void*)glGetError},
- {"glGetFloatv", (void*)glGetFloatv},
- {"glGetFramebufferAttachmentParameteriv", (void*)glGetFramebufferAttachmentParameteriv},
- {"glGetIntegerv", (void*)glGetIntegerv},
- {"glGetProgramiv", (void*)glGetProgramiv},
- {"glGetProgramInfoLog", (void*)glGetProgramInfoLog},
- {"glGetRenderbufferParameteriv", (void*)glGetRenderbufferParameteriv},
- {"glGetShaderiv", (void*)glGetShaderiv},
- {"glGetShaderInfoLog", (void*)glGetShaderInfoLog},
- {"glGetShaderPrecisionFormat", (void*)glGetShaderPrecisionFormat},
- {"glGetShaderSource", (void*)glGetShaderSource},
- {"glGetString", (void*)glGetString},
- {"glGetTexParameterfv", (void*)glGetTexParameterfv},
- {"glGetTexParameteriv", (void*)glGetTexParameteriv},
- {"glGetUniformfv", (void*)glGetUniformfv},
- {"glGetUniformiv", (void*)glGetUniformiv},
- {"glGetUniformLocation", (void*)glGetUniformLocation},
- {"glGetVertexAttribfv", (void*)glGetVertexAttribfv},
- {"glGetVertexAttribiv", (void*)glGetVertexAttribiv},
- {"glGetVertexAttribPointerv", (void*)glGetVertexAttribPointerv},
- {"glHint", (void*)glHint},
- {"glIsBuffer", (void*)glIsBuffer},
- {"glIsEnabled", (void*)glIsEnabled},
- {"glIsFramebuffer", (void*)glIsFramebuffer},
- {"glIsProgram", (void*)glIsProgram},
- {"glIsRenderbuffer", (void*)glIsRenderbuffer},
- {"glIsShader", (void*)glIsShader},
- {"glIsTexture", (void*)glIsTexture},
- {"glLineWidth", (void*)glLineWidth},
- {"glLinkProgram", (void*)glLinkProgram},
- {"glPixelStorei", (void*)glPixelStorei},
- {"glPolygonOffset", (void*)glPolygonOffset},
- {"glReadPixels", (void*)glReadPixels},
- {"glReleaseShaderCompiler", (void*)glReleaseShaderCompiler},
- {"glRenderbufferStorage", (void*)glRenderbufferStorage},
- {"glSampleCoverage", (void*)glSampleCoverage},
- {"glScissor", (void*)glScissor},
- {"glShaderBinary", (void*)glShaderBinary},
- {"glShaderSource", (void*)glShaderSource},
- {"glStencilFunc", (void*)glStencilFunc},
- {"glStencilFuncSeparate", (void*)glStencilFuncSeparate},
- {"glStencilMask", (void*)glStencilMask},
- {"glStencilMaskSeparate", (void*)glStencilMaskSeparate},
- {"glStencilOp", (void*)glStencilOp},
- {"glStencilOpSeparate", (void*)glStencilOpSeparate},
- {"glTexImage2D", (void*)glTexImage2D},
- {"glTexParameterf", (void*)glTexParameterf},
- {"glTexParameterfv", (void*)glTexParameterfv},
- {"glTexParameteri", (void*)glTexParameteri},
- {"glTexParameteriv", (void*)glTexParameteriv},
- {"glTexSubImage2D", (void*)glTexSubImage2D},
- {"glUniform1f", (void*)glUniform1f},
- {"glUniform1fv", (void*)glUniform1fv},
- {"glUniform1i", (void*)glUniform1i},
- {"glUniform1iv", (void*)glUniform1iv},
- {"glUniform2f", (void*)glUniform2f},
- {"glUniform2fv", (void*)glUniform2fv},
- {"glUniform2i", (void*)glUniform2i},
- {"glUniform2iv", (void*)glUniform2iv},
- {"glUniform3f", (void*)glUniform3f},
- {"glUniform3fv", (void*)glUniform3fv},
- {"glUniform3i", (void*)glUniform3i},
- {"glUniform3iv", (void*)glUniform3iv},
- {"glUniform4f", (void*)glUniform4f},
- {"glUniform4fv", (void*)glUniform4fv},
- {"glUniform4i", (void*)glUniform4i},
- {"glUniform4iv", (void*)glUniform4iv},
- {"glUniformMatrix2fv", (void*)glUniformMatrix2fv},
- {"glUniformMatrix3fv", (void*)glUniformMatrix3fv},
- {"glUniformMatrix4fv", (void*)glUniformMatrix4fv},
- {"glUseProgram", (void*)glUseProgram},
- {"glValidateProgram", (void*)glValidateProgram},
- {"glVertexAttrib1f", (void*)glVertexAttrib1f},
- {"glVertexAttrib1fv", (void*)glVertexAttrib1fv},
- {"glVertexAttrib2f", (void*)glVertexAttrib2f},
- {"glVertexAttrib2fv", (void*)glVertexAttrib2fv},
- {"glVertexAttrib3f", (void*)glVertexAttrib3f},
- {"glVertexAttrib3fv", (void*)glVertexAttrib3fv},
- {"glVertexAttrib4f", (void*)glVertexAttrib4f},
- {"glVertexAttrib4fv", (void*)glVertexAttrib4fv},
- {"glVertexAttribPointer", (void*)glVertexAttribPointer},
- {"glViewport", (void*)glViewport},
- {"glEGLImageTargetTexture2DOES", (void*)glEGLImageTargetTexture2DOES},
- {"glEGLImageTargetRenderbufferStorageOES", (void*)glEGLImageTargetRenderbufferStorageOES},
- {"glGetProgramBinaryOES", (void*)glGetProgramBinaryOES},
- {"glProgramBinaryOES", (void*)glProgramBinaryOES},
- {"glMapBufferOES", (void*)glMapBufferOES},
- {"glUnmapBufferOES", (void*)glUnmapBufferOES},
- {"glTexImage3DOES", (void*)glTexImage3DOES},
- {"glTexSubImage3DOES", (void*)glTexSubImage3DOES},
- {"glCopyTexSubImage3DOES", (void*)glCopyTexSubImage3DOES},
- {"glCompressedTexImage3DOES", (void*)glCompressedTexImage3DOES},
- {"glCompressedTexSubImage3DOES", (void*)glCompressedTexSubImage3DOES},
- {"glFramebufferTexture3DOES", (void*)glFramebufferTexture3DOES},
- {"glBindVertexArrayOES", (void*)glBindVertexArrayOES},
- {"glDeleteVertexArraysOES", (void*)glDeleteVertexArraysOES},
- {"glGenVertexArraysOES", (void*)glGenVertexArraysOES},
- {"glIsVertexArrayOES", (void*)glIsVertexArrayOES},
- {"glDiscardFramebufferEXT", (void*)glDiscardFramebufferEXT},
- {"glMultiDrawArraysEXT", (void*)glMultiDrawArraysEXT},
- {"glMultiDrawElementsEXT", (void*)glMultiDrawElementsEXT},
- {"glGetPerfMonitorGroupsAMD", (void*)glGetPerfMonitorGroupsAMD},
- {"glGetPerfMonitorCountersAMD", (void*)glGetPerfMonitorCountersAMD},
- {"glGetPerfMonitorGroupStringAMD", (void*)glGetPerfMonitorGroupStringAMD},
- {"glGetPerfMonitorCounterStringAMD", (void*)glGetPerfMonitorCounterStringAMD},
- {"glGetPerfMonitorCounterInfoAMD", (void*)glGetPerfMonitorCounterInfoAMD},
- {"glGenPerfMonitorsAMD", (void*)glGenPerfMonitorsAMD},
- {"glDeletePerfMonitorsAMD", (void*)glDeletePerfMonitorsAMD},
- {"glSelectPerfMonitorCountersAMD", (void*)glSelectPerfMonitorCountersAMD},
- {"glBeginPerfMonitorAMD", (void*)glBeginPerfMonitorAMD},
- {"glEndPerfMonitorAMD", (void*)glEndPerfMonitorAMD},
- {"glGetPerfMonitorCounterDataAMD", (void*)glGetPerfMonitorCounterDataAMD},
- {"glRenderbufferStorageMultisampleIMG", (void*)glRenderbufferStorageMultisampleIMG},
- {"glFramebufferTexture2DMultisampleIMG", (void*)glFramebufferTexture2DMultisampleIMG},
- {"glDeleteFencesNV", (void*)glDeleteFencesNV},
- {"glGenFencesNV", (void*)glGenFencesNV},
- {"glIsFenceNV", (void*)glIsFenceNV},
- {"glTestFenceNV", (void*)glTestFenceNV},
- {"glGetFenceivNV", (void*)glGetFenceivNV},
- {"glFinishFenceNV", (void*)glFinishFenceNV},
- {"glSetFenceNV", (void*)glSetFenceNV},
- {"glCoverageMaskNV", (void*)glCoverageMaskNV},
- {"glCoverageOperationNV", (void*)glCoverageOperationNV},
- {"glGetDriverControlsQCOM", (void*)glGetDriverControlsQCOM},
- {"glGetDriverControlStringQCOM", (void*)glGetDriverControlStringQCOM},
- {"glEnableDriverControlQCOM", (void*)glEnableDriverControlQCOM},
- {"glDisableDriverControlQCOM", (void*)glDisableDriverControlQCOM},
- {"glExtGetTexturesQCOM", (void*)glExtGetTexturesQCOM},
- {"glExtGetBuffersQCOM", (void*)glExtGetBuffersQCOM},
- {"glExtGetRenderbuffersQCOM", (void*)glExtGetRenderbuffersQCOM},
- {"glExtGetFramebuffersQCOM", (void*)glExtGetFramebuffersQCOM},
- {"glExtGetTexLevelParameterivQCOM", (void*)glExtGetTexLevelParameterivQCOM},
- {"glExtTexObjectStateOverrideiQCOM", (void*)glExtTexObjectStateOverrideiQCOM},
- {"glExtGetTexSubImageQCOM", (void*)glExtGetTexSubImageQCOM},
- {"glExtGetBufferPointervQCOM", (void*)glExtGetBufferPointervQCOM},
- {"glExtGetShadersQCOM", (void*)glExtGetShadersQCOM},
- {"glExtGetProgramsQCOM", (void*)glExtGetProgramsQCOM},
- {"glExtIsProgramBinaryQCOM", (void*)glExtIsProgramBinaryQCOM},
- {"glExtGetProgramBinarySourceQCOM", (void*)glExtGetProgramBinarySourceQCOM},
- {"glStartTilingQCOM", (void*)glStartTilingQCOM},
- {"glEndTilingQCOM", (void*)glEndTilingQCOM},
-};
-static int gl2_num_funcs = sizeof(gl2_funcs_by_name) / sizeof(struct _gl2_funcs_by_name);
-
-
-#endif
diff --git a/tools/emulator/opengl/system/GLESv2_enc/gl2_opcodes.h b/tools/emulator/opengl/system/GLESv2_enc/gl2_opcodes.h
deleted file mode 100644
index 5e7857f71..000000000
--- a/tools/emulator/opengl/system/GLESv2_enc/gl2_opcodes.h
+++ /dev/null
@@ -1,217 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-#ifndef __GUARD_gl2_opcodes_h_
-#define __GUARD_gl2_opcodes_h_
-
-#define OP_glActiveTexture 2048
-#define OP_glAttachShader 2049
-#define OP_glBindAttribLocation 2050
-#define OP_glBindBuffer 2051
-#define OP_glBindFramebuffer 2052
-#define OP_glBindRenderbuffer 2053
-#define OP_glBindTexture 2054
-#define OP_glBlendColor 2055
-#define OP_glBlendEquation 2056
-#define OP_glBlendEquationSeparate 2057
-#define OP_glBlendFunc 2058
-#define OP_glBlendFuncSeparate 2059
-#define OP_glBufferData 2060
-#define OP_glBufferSubData 2061
-#define OP_glCheckFramebufferStatus 2062
-#define OP_glClear 2063
-#define OP_glClearColor 2064
-#define OP_glClearDepthf 2065
-#define OP_glClearStencil 2066
-#define OP_glColorMask 2067
-#define OP_glCompileShader 2068
-#define OP_glCompressedTexImage2D 2069
-#define OP_glCompressedTexSubImage2D 2070
-#define OP_glCopyTexImage2D 2071
-#define OP_glCopyTexSubImage2D 2072
-#define OP_glCreateProgram 2073
-#define OP_glCreateShader 2074
-#define OP_glCullFace 2075
-#define OP_glDeleteBuffers 2076
-#define OP_glDeleteFramebuffers 2077
-#define OP_glDeleteProgram 2078
-#define OP_glDeleteRenderbuffers 2079
-#define OP_glDeleteShader 2080
-#define OP_glDeleteTextures 2081
-#define OP_glDepthFunc 2082
-#define OP_glDepthMask 2083
-#define OP_glDepthRangef 2084
-#define OP_glDetachShader 2085
-#define OP_glDisable 2086
-#define OP_glDisableVertexAttribArray 2087
-#define OP_glDrawArrays 2088
-#define OP_glDrawElements 2089
-#define OP_glEnable 2090
-#define OP_glEnableVertexAttribArray 2091
-#define OP_glFinish 2092
-#define OP_glFlush 2093
-#define OP_glFramebufferRenderbuffer 2094
-#define OP_glFramebufferTexture2D 2095
-#define OP_glFrontFace 2096
-#define OP_glGenBuffers 2097
-#define OP_glGenerateMipmap 2098
-#define OP_glGenFramebuffers 2099
-#define OP_glGenRenderbuffers 2100
-#define OP_glGenTextures 2101
-#define OP_glGetActiveAttrib 2102
-#define OP_glGetActiveUniform 2103
-#define OP_glGetAttachedShaders 2104
-#define OP_glGetAttribLocation 2105
-#define OP_glGetBooleanv 2106
-#define OP_glGetBufferParameteriv 2107
-#define OP_glGetError 2108
-#define OP_glGetFloatv 2109
-#define OP_glGetFramebufferAttachmentParameteriv 2110
-#define OP_glGetIntegerv 2111
-#define OP_glGetProgramiv 2112
-#define OP_glGetProgramInfoLog 2113
-#define OP_glGetRenderbufferParameteriv 2114
-#define OP_glGetShaderiv 2115
-#define OP_glGetShaderInfoLog 2116
-#define OP_glGetShaderPrecisionFormat 2117
-#define OP_glGetShaderSource 2118
-#define OP_glGetString 2119
-#define OP_glGetTexParameterfv 2120
-#define OP_glGetTexParameteriv 2121
-#define OP_glGetUniformfv 2122
-#define OP_glGetUniformiv 2123
-#define OP_glGetUniformLocation 2124
-#define OP_glGetVertexAttribfv 2125
-#define OP_glGetVertexAttribiv 2126
-#define OP_glGetVertexAttribPointerv 2127
-#define OP_glHint 2128
-#define OP_glIsBuffer 2129
-#define OP_glIsEnabled 2130
-#define OP_glIsFramebuffer 2131
-#define OP_glIsProgram 2132
-#define OP_glIsRenderbuffer 2133
-#define OP_glIsShader 2134
-#define OP_glIsTexture 2135
-#define OP_glLineWidth 2136
-#define OP_glLinkProgram 2137
-#define OP_glPixelStorei 2138
-#define OP_glPolygonOffset 2139
-#define OP_glReadPixels 2140
-#define OP_glReleaseShaderCompiler 2141
-#define OP_glRenderbufferStorage 2142
-#define OP_glSampleCoverage 2143
-#define OP_glScissor 2144
-#define OP_glShaderBinary 2145
-#define OP_glShaderSource 2146
-#define OP_glStencilFunc 2147
-#define OP_glStencilFuncSeparate 2148
-#define OP_glStencilMask 2149
-#define OP_glStencilMaskSeparate 2150
-#define OP_glStencilOp 2151
-#define OP_glStencilOpSeparate 2152
-#define OP_glTexImage2D 2153
-#define OP_glTexParameterf 2154
-#define OP_glTexParameterfv 2155
-#define OP_glTexParameteri 2156
-#define OP_glTexParameteriv 2157
-#define OP_glTexSubImage2D 2158
-#define OP_glUniform1f 2159
-#define OP_glUniform1fv 2160
-#define OP_glUniform1i 2161
-#define OP_glUniform1iv 2162
-#define OP_glUniform2f 2163
-#define OP_glUniform2fv 2164
-#define OP_glUniform2i 2165
-#define OP_glUniform2iv 2166
-#define OP_glUniform3f 2167
-#define OP_glUniform3fv 2168
-#define OP_glUniform3i 2169
-#define OP_glUniform3iv 2170
-#define OP_glUniform4f 2171
-#define OP_glUniform4fv 2172
-#define OP_glUniform4i 2173
-#define OP_glUniform4iv 2174
-#define OP_glUniformMatrix2fv 2175
-#define OP_glUniformMatrix3fv 2176
-#define OP_glUniformMatrix4fv 2177
-#define OP_glUseProgram 2178
-#define OP_glValidateProgram 2179
-#define OP_glVertexAttrib1f 2180
-#define OP_glVertexAttrib1fv 2181
-#define OP_glVertexAttrib2f 2182
-#define OP_glVertexAttrib2fv 2183
-#define OP_glVertexAttrib3f 2184
-#define OP_glVertexAttrib3fv 2185
-#define OP_glVertexAttrib4f 2186
-#define OP_glVertexAttrib4fv 2187
-#define OP_glVertexAttribPointer 2188
-#define OP_glViewport 2189
-#define OP_glEGLImageTargetTexture2DOES 2190
-#define OP_glEGLImageTargetRenderbufferStorageOES 2191
-#define OP_glGetProgramBinaryOES 2192
-#define OP_glProgramBinaryOES 2193
-#define OP_glMapBufferOES 2194
-#define OP_glUnmapBufferOES 2195
-#define OP_glTexImage3DOES 2196
-#define OP_glTexSubImage3DOES 2197
-#define OP_glCopyTexSubImage3DOES 2198
-#define OP_glCompressedTexImage3DOES 2199
-#define OP_glCompressedTexSubImage3DOES 2200
-#define OP_glFramebufferTexture3DOES 2201
-#define OP_glBindVertexArrayOES 2202
-#define OP_glDeleteVertexArraysOES 2203
-#define OP_glGenVertexArraysOES 2204
-#define OP_glIsVertexArrayOES 2205
-#define OP_glDiscardFramebufferEXT 2206
-#define OP_glMultiDrawArraysEXT 2207
-#define OP_glMultiDrawElementsEXT 2208
-#define OP_glGetPerfMonitorGroupsAMD 2209
-#define OP_glGetPerfMonitorCountersAMD 2210
-#define OP_glGetPerfMonitorGroupStringAMD 2211
-#define OP_glGetPerfMonitorCounterStringAMD 2212
-#define OP_glGetPerfMonitorCounterInfoAMD 2213
-#define OP_glGenPerfMonitorsAMD 2214
-#define OP_glDeletePerfMonitorsAMD 2215
-#define OP_glSelectPerfMonitorCountersAMD 2216
-#define OP_glBeginPerfMonitorAMD 2217
-#define OP_glEndPerfMonitorAMD 2218
-#define OP_glGetPerfMonitorCounterDataAMD 2219
-#define OP_glRenderbufferStorageMultisampleIMG 2220
-#define OP_glFramebufferTexture2DMultisampleIMG 2221
-#define OP_glDeleteFencesNV 2222
-#define OP_glGenFencesNV 2223
-#define OP_glIsFenceNV 2224
-#define OP_glTestFenceNV 2225
-#define OP_glGetFenceivNV 2226
-#define OP_glFinishFenceNV 2227
-#define OP_glSetFenceNV 2228
-#define OP_glCoverageMaskNV 2229
-#define OP_glCoverageOperationNV 2230
-#define OP_glGetDriverControlsQCOM 2231
-#define OP_glGetDriverControlStringQCOM 2232
-#define OP_glEnableDriverControlQCOM 2233
-#define OP_glDisableDriverControlQCOM 2234
-#define OP_glExtGetTexturesQCOM 2235
-#define OP_glExtGetBuffersQCOM 2236
-#define OP_glExtGetRenderbuffersQCOM 2237
-#define OP_glExtGetFramebuffersQCOM 2238
-#define OP_glExtGetTexLevelParameterivQCOM 2239
-#define OP_glExtTexObjectStateOverrideiQCOM 2240
-#define OP_glExtGetTexSubImageQCOM 2241
-#define OP_glExtGetBufferPointervQCOM 2242
-#define OP_glExtGetShadersQCOM 2243
-#define OP_glExtGetProgramsQCOM 2244
-#define OP_glExtIsProgramBinaryQCOM 2245
-#define OP_glExtGetProgramBinarySourceQCOM 2246
-#define OP_glStartTilingQCOM 2247
-#define OP_glEndTilingQCOM 2248
-#define OP_glVertexAttribPointerData 2249
-#define OP_glVertexAttribPointerOffset 2250
-#define OP_glDrawElementsOffset 2251
-#define OP_glDrawElementsData 2252
-#define OP_glGetCompressedTextureFormats 2253
-#define OP_glShaderString 2254
-#define OP_glFinishRoundTrip 2255
-#define OP_last 2256
-
-
-#endif
diff --git a/tools/emulator/opengl/system/GLESv2_enc/gl2_types.h b/tools/emulator/opengl/system/GLESv2_enc/gl2_types.h
deleted file mode 100644
index bfff61de4..000000000
--- a/tools/emulator/opengl/system/GLESv2_enc/gl2_types.h
+++ /dev/null
@@ -1,21 +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.
-*/
-#ifndef _GL_2_TYPES_H_
-#define _GL_2_TYPES_H_
-#include "gl_base_types.h"
-
-typedef void *GLvoidptr;
-#endif
diff --git a/tools/emulator/opengl/system/OpenglSystemCommon/Android.mk b/tools/emulator/opengl/system/OpenglSystemCommon/Android.mk
deleted file mode 100644
index 61987489c..000000000
--- a/tools/emulator/opengl/system/OpenglSystemCommon/Android.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-$(call emugl-begin-shared-library,libOpenglSystemCommon)
-$(call emugl-import,libGLESv1_enc libGLESv2_enc lib_renderControl_enc)
-
-LOCAL_SRC_FILES := \
- HostConnection.cpp \
- QemuPipeStream.cpp \
- ThreadInfo.cpp
-
-$(call emugl-export,C_INCLUDES,$(LOCAL_PATH) bionic/libc/private)
-
-$(call emugl-end-module)
diff --git a/tools/emulator/opengl/system/OpenglSystemCommon/EGLClientIface.h b/tools/emulator/opengl/system/OpenglSystemCommon/EGLClientIface.h
deleted file mode 100644
index 3c8cb5535..000000000
--- a/tools/emulator/opengl/system/OpenglSystemCommon/EGLClientIface.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-* Copyright 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.
-*/
-
-#ifndef _SYSTEM_COMMON_EGL_CLIENT_IFACE_H
-#define _SYSTEM_COMMON_EGL_CLIENT_IFACE_H
-
-struct EGLThreadInfo; // defined in ThreadInfo.h
-
-typedef struct {
- EGLThreadInfo* (*getThreadInfo)();
- const char* (*getGLString)(int glEnum);
-} EGLClient_eglInterface;
-
-typedef struct {
- void* (*getProcAddress)(const char *funcName);
- void (*init)();
- void (*finish)();
-} EGLClient_glesInterface;
-
-//
-// Any GLES/GLES2 client API library should define a function named "init_emul_gles"
-// with the following prototype,
-// It will be called by EGL after loading the GLES library for initialization
-// and exchanging interface function pointers.
-//
-typedef EGLClient_glesInterface *(*init_emul_gles_t)(EGLClient_eglInterface *eglIface);
-
-#endif
diff --git a/tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp b/tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp
deleted file mode 100644
index 940f5aeab..000000000
--- a/tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp
+++ /dev/null
@@ -1,153 +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.
-*/
-#include "HostConnection.h"
-#include "TcpStream.h"
-#include "QemuPipeStream.h"
-#include "ThreadInfo.h"
-#include <cutils/log.h>
-#include "GLEncoder.h"
-#include "GL2Encoder.h"
-
-#define STREAM_BUFFER_SIZE 4*1024*1024
-#define STREAM_PORT_NUM 22468
-
-/* Set to 1 to use a QEMU pipe, or 0 for a TCP connection */
-#define USE_QEMU_PIPE 1
-
-HostConnection::HostConnection() :
- m_stream(NULL),
- m_glEnc(NULL),
- m_gl2Enc(NULL),
- m_rcEnc(NULL)
-{
-}
-
-HostConnection::~HostConnection()
-{
- delete m_stream;
- delete m_glEnc;
- delete m_gl2Enc;
- delete m_rcEnc;
-}
-
-HostConnection *HostConnection::get()
-{
- /* TODO: Make this configurable with a system property */
- const int useQemuPipe = USE_QEMU_PIPE;
-
- // Get thread info
- EGLThreadInfo *tinfo = getEGLThreadInfo();
- if (!tinfo) {
- return NULL;
- }
-
- if (tinfo->hostConn == NULL) {
- HostConnection *con = new HostConnection();
- if (NULL == con) {
- return NULL;
- }
-
- if (useQemuPipe) {
- QemuPipeStream *stream = new QemuPipeStream(STREAM_BUFFER_SIZE);
- if (!stream) {
- ALOGE("Failed to create QemuPipeStream for host connection!!!\n");
- delete con;
- return NULL;
- }
- if (stream->connect() < 0) {
- ALOGE("Failed to connect to host (QemuPipeStream)!!!\n");
- delete stream;
- delete con;
- return NULL;
- }
- con->m_stream = stream;
- }
- else /* !useQemuPipe */
- {
- TcpStream *stream = new TcpStream(STREAM_BUFFER_SIZE);
- if (!stream) {
- ALOGE("Failed to create TcpStream for host connection!!!\n");
- delete con;
- return NULL;
- }
-
- if (stream->connect("10.0.2.2", STREAM_PORT_NUM) < 0) {
- ALOGE("Failed to connect to host (TcpStream)!!!\n");
- delete stream;
- delete con;
- return NULL;
- }
- con->m_stream = stream;
- }
-
- // send zero 'clientFlags' to the host.
- unsigned int *pClientFlags =
- (unsigned int *)con->m_stream->allocBuffer(sizeof(unsigned int));
- *pClientFlags = 0;
- con->m_stream->commitBuffer(sizeof(unsigned int));
-
- ALOGD("HostConnection::get() New Host Connection established %p, tid %d\n", con, gettid());
- tinfo->hostConn = con;
- }
-
- return tinfo->hostConn;
-}
-
-GLEncoder *HostConnection::glEncoder()
-{
- if (!m_glEnc) {
- m_glEnc = new GLEncoder(m_stream);
- DBG("HostConnection::glEncoder new encoder %p, tid %d", m_glEnc, gettid());
- m_glEnc->setContextAccessor(s_getGLContext);
- }
- return m_glEnc;
-}
-
-GL2Encoder *HostConnection::gl2Encoder()
-{
- if (!m_gl2Enc) {
- m_gl2Enc = new GL2Encoder(m_stream);
- DBG("HostConnection::gl2Encoder new encoder %p, tid %d", m_gl2Enc, gettid());
- m_gl2Enc->setContextAccessor(s_getGL2Context);
- }
- return m_gl2Enc;
-}
-
-renderControl_encoder_context_t *HostConnection::rcEncoder()
-{
- if (!m_rcEnc) {
- m_rcEnc = new renderControl_encoder_context_t(m_stream);
- }
- return m_rcEnc;
-}
-
-gl_client_context_t *HostConnection::s_getGLContext()
-{
- EGLThreadInfo *ti = getEGLThreadInfo();
- if (ti->hostConn) {
- return ti->hostConn->m_glEnc;
- }
- return NULL;
-}
-
-gl2_client_context_t *HostConnection::s_getGL2Context()
-{
- EGLThreadInfo *ti = getEGLThreadInfo();
- if (ti->hostConn) {
- return ti->hostConn->m_gl2Enc;
- }
- return NULL;
-}
diff --git a/tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.h b/tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.h
deleted file mode 100644
index e7a5ac448..000000000
--- a/tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.h
+++ /dev/null
@@ -1,55 +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.
-*/
-#ifndef __COMMON_HOST_CONNECTION_H
-#define __COMMON_HOST_CONNECTION_H
-
-#include "IOStream.h"
-#include "renderControl_enc.h"
-
-class GLEncoder;
-class gl_client_context_t;
-class GL2Encoder;
-class gl2_client_context_t;
-
-class HostConnection
-{
-public:
- static HostConnection *get();
- ~HostConnection();
-
- GLEncoder *glEncoder();
- GL2Encoder *gl2Encoder();
- renderControl_encoder_context_t *rcEncoder();
-
- void flush() {
- if (m_stream) {
- m_stream->flush();
- }
- }
-
-private:
- HostConnection();
- static gl_client_context_t *s_getGLContext();
- static gl2_client_context_t *s_getGL2Context();
-
-private:
- IOStream *m_stream;
- GLEncoder *m_glEnc;
- GL2Encoder *m_gl2Enc;
- renderControl_encoder_context_t *m_rcEnc;
-};
-
-#endif
diff --git a/tools/emulator/opengl/system/OpenglSystemCommon/QemuPipeStream.cpp b/tools/emulator/opengl/system/OpenglSystemCommon/QemuPipeStream.cpp
deleted file mode 100644
index 50c3d8bb1..000000000
--- a/tools/emulator/opengl/system/OpenglSystemCommon/QemuPipeStream.cpp
+++ /dev/null
@@ -1,190 +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.
-*/
-#include "QemuPipeStream.h"
-#include <hardware/qemu_pipe.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-QemuPipeStream::QemuPipeStream(size_t bufSize) :
- IOStream(bufSize),
- m_sock(-1),
- m_bufsize(bufSize),
- m_buf(NULL)
-{
-}
-
-QemuPipeStream::QemuPipeStream(int sock, size_t bufSize) :
- IOStream(bufSize),
- m_sock(sock),
- m_bufsize(bufSize),
- m_buf(NULL)
-{
-}
-
-QemuPipeStream::~QemuPipeStream()
-{
- if (m_sock >= 0) {
- ::close(m_sock);
- }
- if (m_buf != NULL) {
- free(m_buf);
- }
-}
-
-
-int QemuPipeStream::connect(void)
-{
- m_sock = qemu_pipe_open("opengles");
- if (!valid()) return -1;
- return 0;
-}
-
-void *QemuPipeStream::allocBuffer(size_t minSize)
-{
- size_t allocSize = (m_bufsize < minSize ? minSize : m_bufsize);
- if (!m_buf) {
- m_buf = (unsigned char *)malloc(allocSize);
- }
- else if (m_bufsize < allocSize) {
- unsigned char *p = (unsigned char *)realloc(m_buf, allocSize);
- if (p != NULL) {
- m_buf = p;
- m_bufsize = allocSize;
- } else {
- ERR("realloc (%d) failed\n", allocSize);
- free(m_buf);
- m_buf = NULL;
- m_bufsize = 0;
- }
- }
-
- return m_buf;
-};
-
-int QemuPipeStream::commitBuffer(size_t size)
-{
- return writeFully(m_buf, size);
-}
-
-int QemuPipeStream::writeFully(const void *buf, size_t len)
-{
- //DBG(">> QemuPipeStream::writeFully %d\n", len);
- if (!valid()) return -1;
-
- size_t res = len;
- int retval = 0;
-
- while (res > 0) {
- ssize_t stat = ::write(m_sock, (const char *)(buf) + (len - res), res);
- if (stat > 0) {
- res -= stat;
- continue;
- }
- if (stat == 0) { /* EOF */
- ERR("QemuPipeStream::writeFully failed: premature EOF\n");
- retval = -1;
- break;
- }
- if (errno == EINTR) {
- continue;
- }
- retval = stat;
- ERR("QemuPipeStream::writeFully failed: %s\n", strerror(errno));
- break;
- }
- //DBG("<< QemuPipeStream::writeFully %d\n", len );
- return retval;
-}
-
-const unsigned char *QemuPipeStream::readFully(void *buf, size_t len)
-{
- //DBG(">> QemuPipeStream::readFully %d\n", len);
- if (!valid()) return NULL;
- if (!buf) {
- if (len>0) ERR("QemuPipeStream::readFully failed, buf=NULL, len %d", len);
- return NULL; // do not allow NULL buf in that implementation
- }
- size_t res = len;
- while (res > 0) {
- ssize_t stat = ::read(m_sock, (char *)(buf) + len - res, len);
- if (stat == 0) {
- // client shutdown;
- return NULL;
- } else if (stat < 0) {
- if (errno == EINTR) {
- continue;
- } else {
- ERR("QemuPipeStream::readFully failed (buf %p): %s\n",
- buf, strerror(errno));
- return NULL;
- }
- } else {
- res -= stat;
- }
- }
- //DBG("<< QemuPipeStream::readFully %d\n", len);
- return (const unsigned char *)buf;
-}
-
-const unsigned char *QemuPipeStream::read( void *buf, size_t *inout_len)
-{
- //DBG(">> QemuPipeStream::read %d\n", *inout_len);
- if (!valid()) return NULL;
- if (!buf) {
- ERR("QemuPipeStream::read failed, buf=NULL");
- return NULL; // do not allow NULL buf in that implementation
- }
-
- int n = recv(buf, *inout_len);
-
- if (n > 0) {
- *inout_len = n;
- return (const unsigned char *)buf;
- }
-
- //DBG("<< QemuPipeStream::read %d\n", *inout_len);
- return NULL;
-}
-
-int QemuPipeStream::recv(void *buf, size_t len)
-{
- if (!valid()) return int(ERR_INVALID_SOCKET);
- char* p = (char *)buf;
- int ret = 0;
- while(len > 0) {
- int res = ::read(m_sock, p, len);
- if (res > 0) {
- p += res;
- ret += res;
- len -= res;
- continue;
- }
- if (res == 0) { /* EOF */
- break;
- }
- if (errno == EINTR)
- continue;
-
- /* A real error */
- if (ret == 0)
- ret = -1;
- break;
- }
- return ret;
-}
diff --git a/tools/emulator/opengl/system/OpenglSystemCommon/QemuPipeStream.h b/tools/emulator/opengl/system/OpenglSystemCommon/QemuPipeStream.h
deleted file mode 100644
index 57ee399b4..000000000
--- a/tools/emulator/opengl/system/OpenglSystemCommon/QemuPipeStream.h
+++ /dev/null
@@ -1,51 +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.
-*/
-#ifndef __QEMU_PIPE_STREAM_H
-#define __QEMU_PIPE_STREAM_H
-
-/* This file implements an IOStream that uses a QEMU fast-pipe
- * to communicate with the emulator's 'opengles' service. See
- * <hardware/qemu_pipe.h> for more details.
- */
-#include <stdlib.h>
-#include "IOStream.h"
-
-class QemuPipeStream : public IOStream {
-public:
- typedef enum { ERR_INVALID_SOCKET = -1000 } QemuPipeStreamError;
-
- explicit QemuPipeStream(size_t bufsize = 10000);
- ~QemuPipeStream();
- int connect(void);
-
- virtual void *allocBuffer(size_t minSize);
- virtual int commitBuffer(size_t size);
- virtual const unsigned char *readFully( void *buf, size_t len);
- virtual const unsigned char *read( void *buf, size_t *inout_len);
-
- bool valid() { return m_sock >= 0; }
- int recv(void *buf, size_t len);
-
- virtual int writeFully(const void *buf, size_t len);
-
-private:
- int m_sock;
- size_t m_bufsize;
- unsigned char *m_buf;
- QemuPipeStream(int sock, size_t bufSize);
-};
-
-#endif
diff --git a/tools/emulator/opengl/system/OpenglSystemCommon/ThreadInfo.cpp b/tools/emulator/opengl/system/OpenglSystemCommon/ThreadInfo.cpp
deleted file mode 100644
index 75da8f29f..000000000
--- a/tools/emulator/opengl/system/OpenglSystemCommon/ThreadInfo.cpp
+++ /dev/null
@@ -1,39 +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.
-*/
-#include "ThreadInfo.h"
-#include "cutils/threads.h"
-
-thread_store_t s_tls = THREAD_STORE_INITIALIZER;
-
-static void tlsDestruct(void *ptr)
-{
- if (ptr) {
- EGLThreadInfo *ti = (EGLThreadInfo *)ptr;
- delete ti->hostConn;
- delete ti;
- }
-}
-
-EGLThreadInfo *slow_getEGLThreadInfo()
-{
- EGLThreadInfo *ti = (EGLThreadInfo *)thread_store_get(&s_tls);
- if (ti) return ti;
-
- ti = new EGLThreadInfo();
- thread_store_set(&s_tls, ti, tlsDestruct);
-
- return ti;
-}
diff --git a/tools/emulator/opengl/system/OpenglSystemCommon/ThreadInfo.h b/tools/emulator/opengl/system/OpenglSystemCommon/ThreadInfo.h
deleted file mode 100644
index 032873340..000000000
--- a/tools/emulator/opengl/system/OpenglSystemCommon/ThreadInfo.h
+++ /dev/null
@@ -1,59 +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.
-*/
-#ifndef _THREAD_INFO_H
-#define _THREAD_INFO_H
-
-#include "HostConnection.h"
-#include <pthread.h>
-#ifdef HAVE_ANDROID_OS
-#include <bionic_tls.h>
-#endif
-
-struct EGLContext_t;
-
-struct EGLThreadInfo
-{
- EGLThreadInfo() : currentContext(NULL), hostConn(NULL), eglError(EGL_SUCCESS) {}
-
- EGLContext_t *currentContext;
- HostConnection *hostConn;
- int eglError;
-};
-
-
-EGLThreadInfo *slow_getEGLThreadInfo();
-
-#ifdef HAVE_ANDROID_OS
- // We have a dedicated TLS slot in bionic
- inline EGLThreadInfo* getEGLThreadInfo() {
- EGLThreadInfo *tInfo =
- (EGLThreadInfo *)(((unsigned *)__get_tls())[TLS_SLOT_OPENGL]);
- if (!tInfo) {
- tInfo = slow_getEGLThreadInfo();
- ((uint32_t *)__get_tls())[TLS_SLOT_OPENGL] = (uint32_t)tInfo;
- }
- return tInfo;
- }
-#else
- inline EGLThreadInfo* getEGLThreadInfo() {
- return slow_getEGLThreadInfo();
- }
-#endif
-
-
-
-
-#endif // of _THREAD_INFO_H
diff --git a/tools/emulator/opengl/system/OpenglSystemCommon/gralloc_cb.h b/tools/emulator/opengl/system/OpenglSystemCommon/gralloc_cb.h
deleted file mode 100644
index a20740119..000000000
--- a/tools/emulator/opengl/system/OpenglSystemCommon/gralloc_cb.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
-* Copyright 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.
-*/
-
-#ifndef __GRALLOC_CB_H__
-#define __GRALLOC_CB_H__
-
-#include <hardware/hardware.h>
-#include <hardware/gralloc.h>
-#include <cutils/native_handle.h>
-
-#define BUFFER_HANDLE_MAGIC ((int)0xabfabfab)
-#define CB_HANDLE_NUM_INTS(nfds) (int)((sizeof(cb_handle_t) - (nfds)*sizeof(int)) / sizeof(int))
-
-//
-// Our buffer handle structure
-//
-struct cb_handle_t : public native_handle {
-
- cb_handle_t(int p_fd, int p_ashmemSize, int p_usage,
- int p_width, int p_height, int p_format,
- int p_glFormat, int p_glType) :
- fd(p_fd),
- magic(BUFFER_HANDLE_MAGIC),
- usage(p_usage),
- width(p_width),
- height(p_height),
- format(p_format),
- glFormat(p_glFormat),
- glType(p_glType),
- ashmemSize(p_ashmemSize),
- ashmemBase(0),
- ashmemBasePid(0),
- mappedPid(0),
- lockedLeft(0),
- lockedTop(0),
- lockedWidth(0),
- lockedHeight(0),
- hostHandle(0)
- {
- version = sizeof(native_handle);
- numFds = 0;
- numInts = CB_HANDLE_NUM_INTS(numFds);
- }
-
- ~cb_handle_t() {
- magic = 0;
- }
-
- void setFd(int p_fd) {
- if (p_fd >= 0) {
- numFds = 1;
- }
- else {
- numFds = 0;
- }
- fd = p_fd;
- numInts = CB_HANDLE_NUM_INTS(numFds);
- }
-
- static bool validate(cb_handle_t * hnd) {
- return (hnd &&
- hnd->version == sizeof(native_handle) &&
- hnd->magic == BUFFER_HANDLE_MAGIC &&
- hnd->numInts == CB_HANDLE_NUM_INTS(hnd->numFds));
- }
-
- bool canBePosted() {
- return (0 != (usage & GRALLOC_USAGE_HW_FB));
- }
-
- // file-descriptors
- int fd; // ashmem fd (-1 of ashmem region did not allocated, i.e. no SW access needed)
-
- // ints
- int magic; // magic number in order to validate a pointer to be a cb_handle_t
- int usage; // usage bits the buffer was created with
- int width; // buffer width
- int height; // buffer height
- int format; // real internal pixel format format
- int glFormat; // OpenGL format enum used for host h/w color buffer
- int glType; // OpenGL type enum used when uploading to host
- int ashmemSize; // ashmem region size for the buffer (0 unless is HW_FB buffer or
- // s/w access is needed)
- int ashmemBase; // CPU address of the mapped ashmem region
- int ashmemBasePid; // process id which mapped the ashmem region
- int mappedPid; // process id which succeeded gralloc_register call
- int lockedLeft; // region of buffer locked for s/w write
- int lockedTop;
- int lockedWidth;
- int lockedHeight;
- uint32_t hostHandle;
-};
-
-
-#endif //__GRALLOC_CB_H__
diff --git a/tools/emulator/opengl/system/egl/Android.mk b/tools/emulator/opengl/system/egl/Android.mk
deleted file mode 100644
index 75766c0e3..000000000
--- a/tools/emulator/opengl/system/egl/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-ifneq (false,$(BUILD_EMULATOR_OPENGL_DRIVER))
-
-LOCAL_PATH := $(call my-dir)
-
-$(call emugl-begin-shared-library,libEGL_emulation)
-$(call emugl-import,libOpenglSystemCommon)
-$(call emugl-set-shared-library-subpath,egl)
-
-LOCAL_CFLAGS += -DLOG_TAG=\"EGL_emulation\" -DEGL_EGLEXT_PROTOTYPES -DWITH_GLES2
-
-LOCAL_SRC_FILES := \
- eglDisplay.cpp \
- egl.cpp \
- ClientAPIExts.cpp
-
-LOCAL_SHARED_LIBRARIES += libdl
-
-# Used to access the Bionic private OpenGL TLS slot
-LOCAL_C_INCLUDES += bionic/libc/private
-
-$(call emugl-end-module)
-
-#### egl.cfg ####
-
-# Ensure that this file is only copied to emulator-specific builds.
-# Other builds are device-specific and will provide their own
-# version of this file to point to the appropriate HW EGL libraries.
-#
-ifneq (,$(filter full full_x86 full_mips sdk sdk_x86 sdk_mips google_sdk google_sdk_x86 google_sdk_mips cm_goldfish,$(TARGET_PRODUCT)))
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := egl.cfg
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-
-LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/egl
-LOCAL_MODULE_CLASS := ETC
-
-include $(BUILD_PREBUILT)
-endif # TARGET_PRODUCT in 'full full_x86 full_mips sdk sdk_x86 sdk_mips google_sdk google_sdk_x86 google_sdk_mips')
-
-endif # BUILD_EMULATOR_OPENGL_DRIVER != false
diff --git a/tools/emulator/opengl/system/egl/ClientAPIExts.cpp b/tools/emulator/opengl/system/egl/ClientAPIExts.cpp
deleted file mode 100644
index 5e81afebe..000000000
--- a/tools/emulator/opengl/system/egl/ClientAPIExts.cpp
+++ /dev/null
@@ -1,157 +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.
-*/
-#include "ClientAPIExts.h"
-#include "ThreadInfo.h"
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-#include "eglContext.h"
-
-namespace ClientAPIExts
-{
-
-//
-// define function pointer type for each extention function
-// typename has the form __egl_{funcname}_t
-//
-#define FUNC_TYPE(fname) __egl_ ## fname ## _t
-#define API_ENTRY(fname,params,args) \
- typedef void (GL_APIENTRY *FUNC_TYPE(fname)) params;
-
-#define API_ENTRY_RET(rtype,fname,params,args) \
- typedef rtype (GL_APIENTRY *FUNC_TYPE(fname)) params;
-
-#include "ClientAPIExts.in"
-#undef API_ENTRY
-#undef API_ENTRY_RET
-
-/////
-// Define static table to store the function value for each
-// client API. functions pointers will get initialized through
-// ClientAPIExts::initClientFuncs function after each client API has been
-// loaded.
-/////
-#define API_ENTRY(fname,params,args) \
- FUNC_TYPE(fname) fname;
-
-#define API_ENTRY_RET(rtype,fname,params,args) \
- API_ENTRY(fname,params,args)
-
-static struct _ext_table
-{
-#include "ClientAPIExts.in"
-} s_client_extensions[2];
-
-#undef API_ENTRY
-#undef API_ENTRY_RET
-
-//
-// This function initialized each entry in the s_client_extensions
-// struct at the givven index using the givven client interface
-//
-void initClientFuncs(const EGLClient_glesInterface *iface, int idx)
-{
-#define API_ENTRY(fname,params,args) \
- s_client_extensions[idx].fname = \
- (FUNC_TYPE(fname))iface->getProcAddress(#fname);
-
-#define API_ENTRY_RET(rtype,fname,params,args) \
- API_ENTRY(fname,params,args)
-
- //
- // reset all func pointers to NULL
- //
- memset(&s_client_extensions[idx], 0, sizeof(struct _ext_table));
-
- //
- // And now query the GLES library for each proc address
- //
-#include "ClientAPIExts.in"
-#undef API_ENTRY
-#undef API_ENTRY_RET
-}
-
-//
-// Define implementation for each extension function which checks
-// the current context version and calls to the correct client API
-// function.
-//
-#define API_ENTRY(fname,params,args) \
- static void _egl_ ## fname params \
- { \
- EGLThreadInfo* thread = getEGLThreadInfo(); \
- if (!thread->currentContext) { \
- return; \
- } \
- int idx = (int)thread->currentContext->version - 1; \
- if (!s_client_extensions[idx].fname) { \
- return; \
- } \
- (*s_client_extensions[idx].fname) args; \
- }
-
-#define API_ENTRY_RET(rtype,fname,params,args) \
- static rtype _egl_ ## fname params \
- { \
- EGLThreadInfo* thread = getEGLThreadInfo(); \
- if (!thread->currentContext) { \
- return (rtype)0; \
- } \
- int idx = (int)thread->currentContext->version - 1; \
- if (!s_client_extensions[idx].fname) { \
- return (rtype)0; \
- } \
- return (*s_client_extensions[idx].fname) args; \
- }
-
-#include "ClientAPIExts.in"
-#undef API_ENTRY
-#undef API_ENTRY_RET
-
-//
-// Define a table to map function names to the local _egl_ version of
-// the extension function, to be used in eglGetProcAddress.
-//
-#define API_ENTRY(fname,params,args) \
- { #fname, (void*)_egl_ ## fname},
-#define API_ENTRY_RET(rtype,fname,params,args) \
- API_ENTRY(fname,params,args)
-
-static const struct _client_ext_funcs {
- const char *fname;
- void* proc;
-} s_client_ext_funcs[] = {
-#include "ClientAPIExts.in"
-};
-static const int numExtFuncs = sizeof(s_client_ext_funcs) /
- sizeof(s_client_ext_funcs[0]);
-
-#undef API_ENTRY
-#undef API_ENTRY_RET
-
-//
-// returns the __egl_ version of the givven extension function name.
-//
-void* getProcAddress(const char *fname)
-{
- for (int i=0; i<numExtFuncs; i++) {
- if (!strcmp(fname, s_client_ext_funcs[i].fname)) {
- return s_client_ext_funcs[i].proc;
- }
- }
- return NULL;
-}
-
-} // of namespace ClientAPIExts
diff --git a/tools/emulator/opengl/system/egl/ClientAPIExts.h b/tools/emulator/opengl/system/egl/ClientAPIExts.h
deleted file mode 100644
index eee9172cd..000000000
--- a/tools/emulator/opengl/system/egl/ClientAPIExts.h
+++ /dev/null
@@ -1,29 +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.
-*/
-#ifndef _CLIENT_APIS_EXTS_H
-#define _CLIENT_APIS_EXTS_H
-
-#include "EGLClientIface.h"
-
-namespace ClientAPIExts
-{
-
-void initClientFuncs(const EGLClient_glesInterface *iface, int idx);
-void* getProcAddress(const char *fname);
-
-} // of namespace ClientAPIExts
-
-#endif
diff --git a/tools/emulator/opengl/system/egl/ClientAPIExts.in b/tools/emulator/opengl/system/egl/ClientAPIExts.in
deleted file mode 100644
index 585070196..000000000
--- a/tools/emulator/opengl/system/egl/ClientAPIExts.in
+++ /dev/null
@@ -1,201 +0,0 @@
-//
-// Each extension function should have one of the following
-// macro definitions:
-// API_ENTRY(funcname, paramlist, arglist)
-// -or- (if the function has a return value)
-// API_ENTRY_RET(return_type,funcname, paramlist, arglist)
-//
-API_ENTRY(glEGLImageTargetTexture2DOES,
- (GLenum target, GLeglImageOES image),
- (target, image))
-
-API_ENTRY(glEGLImageTargetRenderbufferStorageOES,
- (GLenum target, GLeglImageOES image),
- (target, image))
-
-API_ENTRY(glBlendEquationSeparateOES,
- (GLenum modeRGB, GLenum modeAlpha),
- (modeRGB, modeAlpha))
-
-API_ENTRY(glBlendFuncSeparateOES,
- (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha),
- (srcRGB, dstRGB, srcAlpha, dstAlpha))
-
-API_ENTRY(glBlendEquationOES,
- (GLenum mode),
- (mode))
-
-API_ENTRY(glCurrentPaletteMatrixOES,
- (GLuint matrixpaletteindex),
- (matrixpaletteindex))
-
-API_ENTRY(glLoadPaletteFromModelViewMatrixOES,
- (void),
- ())
-
-API_ENTRY(glMatrixIndexPointerOES,
- (GLint size, GLenum type, GLsizei stride, const GLvoid * pointer),
- (size, type, stride, pointer))
-
-API_ENTRY(glWeightPointerOES,
- (GLint size, GLenum type, GLsizei stride, const GLvoid * pointer),
- (size, type, stride, pointer))
-
-API_ENTRY(glDepthRangefOES,
- (GLclampf zNear, GLclampf zFar),
- (zNear, zFar))
-
-API_ENTRY(glFrustumfOES,
- (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar),
- (left, right, bottom, top, zNear, zFar))
-
-API_ENTRY(glOrthofOES,
- (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar),
- (left, right, bottom, top, zNear, zFar))
-
-API_ENTRY(glClipPlanefOES,
- (GLenum plane, const GLfloat *equation),
- (plane, equation))
-
-API_ENTRY(glGetClipPlanefOES,
- (GLenum pname, GLfloat * eqn),
- (pname, eqn))
-
-API_ENTRY(glClearDepthfOES,
- (GLclampf depth),
- (depth))
-
-API_ENTRY(glPointSizePointerOES,
- (GLenum type, GLsizei stride, const GLvoid *pointer),
- (type, stride, pointer))
-
-API_ENTRY(glTexGenfOES,
- (GLenum coord, GLenum pname, GLfloat param),
- (coord, pname, param))
-
-API_ENTRY(glTexGenfvOES,
- (GLenum coord, GLenum pname, const GLfloat *params),
- (coord, pname, params))
-
-API_ENTRY(glTexGeniOES,
- (GLenum coord, GLenum pname, GLint param),
- (coord, pname, param))
-
-API_ENTRY(glTexGenivOES,
- (GLenum coord, GLenum pname, const GLint *params),
- (coord, pname, params))
-
-API_ENTRY(glTexGenxOES,
- (GLenum coord, GLenum pname, GLfixed param),
- (coord, pname, param))
-
-API_ENTRY(glTexGenxvOES,
- (GLenum coord, GLenum pname, const GLfixed *params),
- (coord, pname, params))
-
-API_ENTRY(glGetTexGenfvOES,
- (GLenum coord, GLenum pname, GLfloat *params),
- (coord, pname, params))
-
-API_ENTRY(glGetTexGenivOES,
- (GLenum coord, GLenum pname, GLint *params),
- (coord, pname, params))
-
-API_ENTRY(glGetTexGenxvOES,
- (GLenum coord, GLenum pname, GLfixed *params),
- (coord, pname, params))
-
-API_ENTRY_RET(GLboolean,
- glIsRenderbufferOES,
- (GLuint renderbuffer),
- (renderbuffer))
-
-API_ENTRY(glBindRenderbufferOES,
- (GLenum target, GLuint renderbuffer),
- (target, renderbuffer))
-
-API_ENTRY(glDeleteRenderbuffersOES,
- (GLsizei n, const GLuint* renderbuffers),
- (n, renderbuffers))
-
-API_ENTRY(glGenRenderbuffersOES,
- (GLsizei n, GLuint* renderbuffers),
- (n, renderbuffers))
-
-API_ENTRY(glRenderbufferStorageOES,
- (GLenum target, GLenum internalformat, GLsizei width, GLsizei height),
- (target, internalformat, width, height))
-
-API_ENTRY(glGetRenderbufferParameterivOES,
- (GLenum target, GLenum pname, GLint* params),
- (target, pname, params))
-
-API_ENTRY_RET(GLboolean,
- glIsFramebufferOES,
- (GLuint framebuffer),
- (framebuffer))
-
-API_ENTRY(glBindFramebufferOES,
- (GLenum target, GLuint framebuffer),
- (target, framebuffer))
-
-API_ENTRY(glDeleteFramebuffersOES,
- (GLsizei n, const GLuint* framebuffers),
- (n, framebuffers))
-
-API_ENTRY(glGenFramebuffersOES,
- (GLsizei n, GLuint* framebuffers),
- (n, framebuffers))
-
-API_ENTRY_RET(GLenum,
- glCheckFramebufferStatusOES,
- (GLenum target),
- (target))
-
-API_ENTRY(glFramebufferTexture2DOES,
- (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level),
- (target, attachment, textarget, texture, level))
-
-API_ENTRY(glFramebufferRenderbufferOES,
- (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer),
- (target, attachment, renderbuffertarget, renderbuffer))
-
-API_ENTRY(glGetFramebufferAttachmentParameterivOES,
- (GLenum target, GLenum attachment, GLenum pname, GLint* params),
- (target, attachment, pname, params))
-
-API_ENTRY(glGenerateMipmapOES,
- (GLenum target),
- (target))
-
-API_ENTRY(glDrawTexsOES,
- (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height),
- (x, y, z, width, height))
-
-API_ENTRY(glDrawTexiOES,
- (GLint x, GLint y, GLint z, GLint width, GLint height),
- (x, y, z, width, height))
-
-API_ENTRY(glDrawTexfOES,
- (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height),
- (x, y, z, width, height))
-
-API_ENTRY(glDrawTexxOES,
- (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height),
- (x, y, z, width, height))
-
-API_ENTRY(glDrawTexsvOES,
- (const GLshort *coords),
- (coords))
-
-API_ENTRY(glDrawTexivOES,
- (const GLint *coords),
- (coords))
-
-API_ENTRY(glDrawTexfvOES,
- (const GLfloat *coords),
- (coords))
-
-API_ENTRY(glDrawTexxvOES,
- (const GLfixed *coords),
- (coords))
diff --git a/tools/emulator/opengl/system/egl/egl.cfg b/tools/emulator/opengl/system/egl/egl.cfg
deleted file mode 100644
index 9d3f2dc38..000000000
--- a/tools/emulator/opengl/system/egl/egl.cfg
+++ /dev/null
@@ -1 +0,0 @@
-0 0 emulation
diff --git a/tools/emulator/opengl/system/egl/egl.cpp b/tools/emulator/opengl/system/egl/egl.cpp
deleted file mode 100644
index da89c4dee..000000000
--- a/tools/emulator/opengl/system/egl/egl.cpp
+++ /dev/null
@@ -1,1254 +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.
-*/
-
-#include "HostConnection.h"
-#include "ThreadInfo.h"
-#include "eglDisplay.h"
-#include "egl_ftable.h"
-#include <cutils/log.h>
-#include "gralloc_cb.h"
-#include "GLClientState.h"
-#include "GLSharedGroup.h"
-#include "eglContext.h"
-#include "ClientAPIExts.h"
-
-#include "GLEncoder.h"
-#ifdef WITH_GLES2
-#include "GL2Encoder.h"
-#endif
-
-#include <system/window.h>
-
-template<typename T>
-static T setErrorFunc(GLint error, T returnValue) {
- getEGLThreadInfo()->eglError = error;
- return returnValue;
-}
-
-const char * eglStrError(EGLint err)
-{
- switch (err){
- case EGL_SUCCESS: return "EGL_SUCCESS";
- case EGL_NOT_INITIALIZED: return "EGL_NOT_INITIALIZED";
- case EGL_BAD_ACCESS: return "EGL_BAD_ACCESS";
- case EGL_BAD_ALLOC: return "EGL_BAD_ALLOC";
- case EGL_BAD_ATTRIBUTE: return "EGL_BAD_ATTRIBUTE";
- case EGL_BAD_CONFIG: return "EGL_BAD_CONFIG";
- case EGL_BAD_CONTEXT: return "EGL_BAD_CONTEXT";
- case EGL_BAD_CURRENT_SURFACE: return "EGL_BAD_CURRENT_SURFACE";
- case EGL_BAD_DISPLAY: return "EGL_BAD_DISPLAY";
- case EGL_BAD_MATCH: return "EGL_BAD_MATCH";
- case EGL_BAD_NATIVE_PIXMAP: return "EGL_BAD_NATIVE_PIXMAP";
- case EGL_BAD_NATIVE_WINDOW: return "EGL_BAD_NATIVE_WINDOW";
- case EGL_BAD_PARAMETER: return "EGL_BAD_PARAMETER";
- case EGL_BAD_SURFACE: return "EGL_BAD_SURFACE";
- case EGL_CONTEXT_LOST: return "EGL_CONTEXT_LOST";
- default: return "UNKNOWN";
- }
-}
-
-#define LOG_EGL_ERRORS 1
-
-#ifdef LOG_EGL_ERRORS
-
-#define setErrorReturn(error, retVal) \
- { \
- ALOGE("tid %d: %s(%d): error 0x%x (%s)", gettid(), __FUNCTION__, __LINE__, error, eglStrError(error)); \
- return setErrorFunc(error, retVal); \
- }
-
-#define RETURN_ERROR(ret,err) \
- ALOGE("tid %d: %s(%d): error 0x%x (%s)", gettid(), __FUNCTION__, __LINE__, err, eglStrError(err)); \
- getEGLThreadInfo()->eglError = err; \
- return ret;
-
-#else //!LOG_EGL_ERRORS
-
-#define setErrorReturn(error, retVal) return setErrorFunc(error, retVal);
-
-#define RETURN_ERROR(ret,err) \
- getEGLThreadInfo()->eglError = err; \
- return ret;
-
-#endif //LOG_EGL_ERRORS
-
-#define VALIDATE_CONFIG(cfg,ret) \
- if(((int)cfg<0)||((int)cfg>s_display.getNumConfigs())) { \
- RETURN_ERROR(ret,EGL_BAD_CONFIG); \
- }
-
-#define VALIDATE_DISPLAY(dpy,ret) \
- if ((dpy) != (EGLDisplay)&s_display) { \
- RETURN_ERROR(ret, EGL_BAD_DISPLAY); \
- }
-
-#define VALIDATE_DISPLAY_INIT(dpy,ret) \
- VALIDATE_DISPLAY(dpy, ret) \
- if (!s_display.initialized()) { \
- RETURN_ERROR(ret, EGL_NOT_INITIALIZED); \
- }
-
-#define DEFINE_HOST_CONNECTION \
- HostConnection *hostCon = HostConnection::get(); \
- renderControl_encoder_context_t *rcEnc = (hostCon ? hostCon->rcEncoder() : NULL)
-
-#define DEFINE_AND_VALIDATE_HOST_CONNECTION(ret) \
- HostConnection *hostCon = HostConnection::get(); \
- if (!hostCon) { \
- ALOGE("egl: Failed to get host connection\n"); \
- return ret; \
- } \
- renderControl_encoder_context_t *rcEnc = hostCon->rcEncoder(); \
- if (!rcEnc) { \
- ALOGE("egl: Failed to get renderControl encoder context\n"); \
- return ret; \
- }
-
-#define VALIDATE_CONTEXT_RETURN(context,ret) \
- if (!context) { \
- RETURN_ERROR(ret,EGL_BAD_CONTEXT); \
- }
-
-#define VALIDATE_SURFACE_RETURN(surface, ret) \
- if (surface != EGL_NO_SURFACE) { \
- egl_surface_t* s( static_cast<egl_surface_t*>(surface) ); \
- if (s->dpy != (EGLDisplay)&s_display) \
- setErrorReturn(EGL_BAD_DISPLAY, EGL_FALSE); \
- }
-
-
-EGLContext_t::EGLContext_t(EGLDisplay dpy, EGLConfig config, EGLContext_t* shareCtx) :
- dpy(dpy),
- config(config),
- read(EGL_NO_SURFACE),
- draw(EGL_NO_SURFACE),
- shareCtx(shareCtx),
- rcContext(0),
- versionString(NULL),
- vendorString(NULL),
- rendererString(NULL),
- extensionString(NULL)
-{
- flags = 0;
- version = 1;
- clientState = new GLClientState();
- if (shareCtx)
- sharedGroup = shareCtx->getSharedGroup();
- else
- sharedGroup = GLSharedGroupPtr(new GLSharedGroup());
-};
-
-EGLContext_t::~EGLContext_t()
-{
- delete clientState;
- delete [] versionString;
- delete [] vendorString;
- delete [] rendererString;
- delete [] extensionString;
-}
-
-// ----------------------------------------------------------------------------
-//egl_surface_t
-
-//we don't need to handle depth since it's handled when window created on the host
-
-struct egl_surface_t {
-
- EGLDisplay dpy;
- EGLConfig config;
-
-
- egl_surface_t(EGLDisplay dpy, EGLConfig config, EGLint surfaceType);
- virtual ~egl_surface_t();
-
- virtual void setSwapInterval(int interval) = 0;
- virtual EGLBoolean swapBuffers() = 0;
-
- EGLint getSwapBehavior() const;
- uint32_t getRcSurface() { return rcSurface; }
- EGLint getSurfaceType() { return surfaceType; }
-
- EGLint getWidth(){ return width; }
- EGLint getHeight(){ return height; }
- void setTextureFormat(EGLint _texFormat) { texFormat = _texFormat; }
- EGLint getTextureFormat() { return texFormat; }
- void setTextureTarget(EGLint _texTarget) { texTarget = _texTarget; }
- EGLint getTextureTarget() { return texTarget; }
-
-private:
- //
- //Surface attributes
- //
- EGLint width;
- EGLint height;
- EGLint texFormat;
- EGLint texTarget;
-
-protected:
- void setWidth(EGLint w) { width = w; }
- void setHeight(EGLint h) { height = h; }
-
- EGLint surfaceType;
- uint32_t rcSurface; //handle to surface created via remote control
-};
-
-egl_surface_t::egl_surface_t(EGLDisplay dpy, EGLConfig config, EGLint surfaceType)
- : dpy(dpy), config(config), surfaceType(surfaceType), rcSurface(0)
-{
- width = 0;
- height = 0;
- texFormat = EGL_NO_TEXTURE;
- texTarget = EGL_NO_TEXTURE;
-}
-
-EGLint egl_surface_t::getSwapBehavior() const {
- return EGL_BUFFER_PRESERVED;
-}
-
-egl_surface_t::~egl_surface_t()
-{
-}
-
-// ----------------------------------------------------------------------------
-// egl_window_surface_t
-
-struct egl_window_surface_t : public egl_surface_t {
- static egl_window_surface_t* create(
- EGLDisplay dpy, EGLConfig config, EGLint surfType,
- ANativeWindow* window);
-
- virtual ~egl_window_surface_t();
-
- virtual void setSwapInterval(int interval);
- virtual EGLBoolean swapBuffers();
-
-private:
- egl_window_surface_t(
- EGLDisplay dpy, EGLConfig config, EGLint surfType,
- ANativeWindow* window);
- EGLBoolean init();
-
- ANativeWindow* nativeWindow;
- android_native_buffer_t* buffer;
-};
-
-egl_window_surface_t::egl_window_surface_t (
- EGLDisplay dpy, EGLConfig config, EGLint surfType,
- ANativeWindow* window)
-: egl_surface_t(dpy, config, surfType),
- nativeWindow(window),
- buffer(NULL)
-{
- // keep a reference on the window
- nativeWindow->common.incRef(&nativeWindow->common);
- EGLint w,h;
- nativeWindow->query(nativeWindow, NATIVE_WINDOW_WIDTH, &w);
- setWidth(w);
- nativeWindow->query(nativeWindow, NATIVE_WINDOW_HEIGHT, &h);
- setHeight(h);
-}
-
-EGLBoolean egl_window_surface_t::init()
-{
- if (nativeWindow->dequeueBuffer_DEPRECATED(nativeWindow, &buffer) != NO_ERROR) {
- setErrorReturn(EGL_BAD_ALLOC, EGL_FALSE);
- }
-
- DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
- rcSurface = rcEnc->rcCreateWindowSurface(rcEnc, (uint32_t)config,
- getWidth(), getHeight());
- if (!rcSurface) {
- ALOGE("rcCreateWindowSurface returned 0");
- return EGL_FALSE;
- }
- rcEnc->rcSetWindowColorBuffer(rcEnc, rcSurface,
- ((cb_handle_t*)(buffer->handle))->hostHandle);
-
- return EGL_TRUE;
-}
-
-egl_window_surface_t* egl_window_surface_t::create(
- EGLDisplay dpy, EGLConfig config, EGLint surfType,
- ANativeWindow* window)
-{
- egl_window_surface_t* wnd = new egl_window_surface_t(
- dpy, config, surfType, window);
- if (wnd && !wnd->init()) {
- delete wnd;
- wnd = NULL;
- }
- return wnd;
-}
-
-egl_window_surface_t::~egl_window_surface_t() {
- DEFINE_HOST_CONNECTION;
- if (rcSurface && rcEnc) {
- rcEnc->rcDestroyWindowSurface(rcEnc, rcSurface);
- }
- if (buffer) {
- nativeWindow->cancelBuffer_DEPRECATED(nativeWindow, buffer);
- }
- nativeWindow->common.decRef(&nativeWindow->common);
-}
-
-void egl_window_surface_t::setSwapInterval(int interval)
-{
- nativeWindow->setSwapInterval(nativeWindow, interval);
-}
-
-EGLBoolean egl_window_surface_t::swapBuffers()
-{
- DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
-
- rcEnc->rcFlushWindowColorBuffer(rcEnc, rcSurface);
-
- nativeWindow->queueBuffer_DEPRECATED(nativeWindow, buffer);
- if (nativeWindow->dequeueBuffer_DEPRECATED(nativeWindow, &buffer)) {
- buffer = NULL;
- setErrorReturn(EGL_BAD_ALLOC, EGL_FALSE);
- }
-
- rcEnc->rcSetWindowColorBuffer(rcEnc, rcSurface,
- ((cb_handle_t *)(buffer->handle))->hostHandle);
-
- return EGL_TRUE;
-}
-
-// ----------------------------------------------------------------------------
-//egl_pbuffer_surface_t
-
-struct egl_pbuffer_surface_t : public egl_surface_t {
- static egl_pbuffer_surface_t* create(EGLDisplay dpy, EGLConfig config,
- EGLint surfType, int32_t w, int32_t h, GLenum pixelFormat);
-
- virtual ~egl_pbuffer_surface_t();
-
- virtual void setSwapInterval(int interval) {}
- virtual EGLBoolean swapBuffers() { return EGL_TRUE; }
-
- uint32_t getRcColorBuffer() { return rcColorBuffer; }
-
-private:
- egl_pbuffer_surface_t(EGLDisplay dpy, EGLConfig config, EGLint surfType,
- int32_t w, int32_t h);
- EGLBoolean init(GLenum format);
-
- uint32_t rcColorBuffer;
-};
-
-egl_pbuffer_surface_t::egl_pbuffer_surface_t(EGLDisplay dpy, EGLConfig config,
- EGLint surfType, int32_t w, int32_t h)
-: egl_surface_t(dpy, config, surfType),
- rcColorBuffer(0)
-{
- setWidth(w);
- setHeight(h);
-}
-
-egl_pbuffer_surface_t::~egl_pbuffer_surface_t()
-{
- DEFINE_HOST_CONNECTION;
- if (rcEnc) {
- if (rcColorBuffer) rcEnc->rcCloseColorBuffer(rcEnc, rcColorBuffer);
- if (rcSurface) rcEnc->rcDestroyWindowSurface(rcEnc, rcSurface);
- }
-}
-
-EGLBoolean egl_pbuffer_surface_t::init(GLenum pixelFormat)
-{
- DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
-
- rcSurface = rcEnc->rcCreateWindowSurface(rcEnc, (uint32_t)config,
- getWidth(), getHeight());
- if (!rcSurface) {
- ALOGE("rcCreateWindowSurface returned 0");
- return EGL_FALSE;
- }
-
- rcColorBuffer = rcEnc->rcCreateColorBuffer(rcEnc, getWidth(), getHeight(),
- pixelFormat);
- if (!rcColorBuffer) {
- ALOGE("rcCreateColorBuffer returned 0");
- return EGL_FALSE;
- }
-
- rcEnc->rcSetWindowColorBuffer(rcEnc, rcSurface, rcColorBuffer);
-
- return EGL_TRUE;
-}
-
-egl_pbuffer_surface_t* egl_pbuffer_surface_t::create(EGLDisplay dpy,
- EGLConfig config, EGLint surfType, int32_t w, int32_t h,
- GLenum pixelFormat)
-{
- egl_pbuffer_surface_t* pb = new egl_pbuffer_surface_t(dpy, config, surfType,
- w, h);
- if (pb && !pb->init(pixelFormat)) {
- delete pb;
- pb = NULL;
- }
- return pb;
-}
-
-static const char *getGLString(int glEnum)
-{
- EGLThreadInfo *tInfo = getEGLThreadInfo();
- if (!tInfo || !tInfo->currentContext) {
- return NULL;
- }
-
- const char** strPtr = NULL;
-
-#define GL_VENDOR 0x1F00
-#define GL_RENDERER 0x1F01
-#define GL_VERSION 0x1F02
-#define GL_EXTENSIONS 0x1F03
-
- switch(glEnum) {
- case GL_VERSION:
- strPtr = &tInfo->currentContext->versionString;
- break;
- case GL_VENDOR:
- strPtr = &tInfo->currentContext->vendorString;
- break;
- case GL_RENDERER:
- strPtr = &tInfo->currentContext->rendererString;
- break;
- case GL_EXTENSIONS:
- strPtr = &tInfo->currentContext->extensionString;
- break;
- }
-
- if (!strPtr) {
- return NULL;
- }
-
- if (*strPtr != NULL) {
- //
- // string is already cached
- //
- return *strPtr;
- }
-
- //
- // first query of that string - need to query host
- //
- DEFINE_AND_VALIDATE_HOST_CONNECTION(NULL);
- char *hostStr = NULL;
- int n = rcEnc->rcGetGLString(rcEnc, glEnum, NULL, 0);
- if (n < 0) {
- hostStr = new char[-n+1];
- n = rcEnc->rcGetGLString(rcEnc, glEnum, hostStr, -n);
- if (n <= 0) {
- delete [] hostStr;
- hostStr = NULL;
- }
- }
-
- //
- // keep the string in the context and return its value
- //
- *strPtr = hostStr;
- return hostStr;
-}
-
-// ----------------------------------------------------------------------------
-
-// The one and only supported display object.
-static eglDisplay s_display;
-
-static EGLClient_eglInterface s_eglIface = {
- getThreadInfo: getEGLThreadInfo,
- getGLString: getGLString
-};
-
-#define DBG_FUNC DBG("%s\n", __FUNCTION__)
-EGLDisplay eglGetDisplay(EGLNativeDisplayType display_id)
-{
- //
- // we support only EGL_DEFAULT_DISPLAY.
- //
- if (display_id != EGL_DEFAULT_DISPLAY) {
- return EGL_NO_DISPLAY;
- }
-
- return (EGLDisplay)&s_display;
-}
-
-EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
-{
- VALIDATE_DISPLAY(dpy,EGL_FALSE);
-
- if (!s_display.initialize(&s_eglIface)) {
- return EGL_FALSE;
- }
- if (major!=NULL)
- *major = s_display.getVersionMajor();
- if (minor!=NULL)
- *minor = s_display.getVersionMinor();
- return EGL_TRUE;
-}
-
-EGLBoolean eglTerminate(EGLDisplay dpy)
-{
- VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE);
-
- s_display.terminate();
- return EGL_TRUE;
-}
-
-EGLint eglGetError()
-{
- EGLint error = getEGLThreadInfo()->eglError;
- getEGLThreadInfo()->eglError = EGL_SUCCESS;
- return error;
-}
-
-__eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
-{
- // search in EGL function table
- for (int i=0; i<egl_num_funcs; i++) {
- if (!strcmp(egl_funcs_by_name[i].name, procname)) {
- return (__eglMustCastToProperFunctionPointerType)egl_funcs_by_name[i].proc;
- }
- }
-
- //
- // Make sure display is initialized before searching in client APIs
- //
- if (!s_display.initialized()) {
- if (!s_display.initialize(&s_eglIface)) {
- return NULL;
- }
- }
-
- // look in gles client api's extensions table
- return (__eglMustCastToProperFunctionPointerType)ClientAPIExts::getProcAddress(procname);
-
- // Fail - function not found.
- return NULL;
-}
-
-const char* eglQueryString(EGLDisplay dpy, EGLint name)
-{
- VALIDATE_DISPLAY_INIT(dpy, NULL);
-
- return s_display.queryString(name);
-}
-
-EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
-{
- VALIDATE_DISPLAY_INIT(dpy, NULL);
-
- if(!num_config) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_PARAMETER);
- }
-
- GLint numConfigs = s_display.getNumConfigs();
- if (!configs) {
- *num_config = numConfigs;
- return EGL_TRUE;
- }
-
- int i=0;
- for (i=0 ; i<numConfigs && i<config_size ; i++) {
- *configs++ = (EGLConfig)i;
- }
- *num_config = i;
- return EGL_TRUE;
-}
-
-EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
-{
- VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE);
-
- int attribs_size = 0;
- if (attrib_list) {
- const EGLint * attrib_p = attrib_list;
- while (attrib_p[0] != EGL_NONE) {
- attribs_size += 2;
- attrib_p += 2;
- }
- attribs_size++; //for the terminating EGL_NONE
- }
-
- DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
- *num_config = rcEnc->rcChooseConfig(rcEnc, (EGLint*)attrib_list, attribs_size * sizeof(EGLint), (uint32_t*)configs, config_size);
-
- return EGL_TRUE;
-}
-
-EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
-{
- VALIDATE_DISPLAY_INIT(dpy, NULL);
- VALIDATE_CONFIG(config, EGL_FALSE);
-
- if (s_display.getConfigAttrib(config, attribute, value))
- {
- return EGL_TRUE;
- }
- else
- {
- RETURN_ERROR(EGL_FALSE, EGL_BAD_ATTRIBUTE);
- }
-}
-
-EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list)
-{
- VALIDATE_DISPLAY_INIT(dpy, NULL);
- VALIDATE_CONFIG(config, EGL_FALSE);
- if (win == 0) {
- setErrorReturn(EGL_BAD_MATCH, EGL_NO_SURFACE);
- }
-
- EGLint surfaceType;
- if (s_display.getConfigAttrib(config, EGL_SURFACE_TYPE, &surfaceType) == EGL_FALSE) return EGL_FALSE;
-
- if (!(surfaceType & EGL_WINDOW_BIT)) {
- setErrorReturn(EGL_BAD_MATCH, EGL_NO_SURFACE);
- }
-
- if (static_cast<ANativeWindow*>(win)->common.magic != ANDROID_NATIVE_WINDOW_MAGIC) {
- setErrorReturn(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
- }
-
- egl_surface_t* surface = egl_window_surface_t::create(
- &s_display, config, surfaceType, static_cast<ANativeWindow*>(win));
- if (!surface) {
- setErrorReturn(EGL_BAD_ALLOC, EGL_NO_SURFACE);
- }
-
- return surface;
-}
-
-EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
-{
- VALIDATE_DISPLAY_INIT(dpy, NULL);
- VALIDATE_CONFIG(config, EGL_FALSE);
-
- EGLint surfaceType;
- if (s_display.getConfigAttrib(config, EGL_SURFACE_TYPE, &surfaceType) == EGL_FALSE) return EGL_FALSE;
-
- if (!(surfaceType & EGL_PBUFFER_BIT)) {
- setErrorReturn(EGL_BAD_MATCH, EGL_NO_SURFACE);
- }
-
- int32_t w = 0;
- int32_t h = 0;
- EGLint texFormat = EGL_NO_TEXTURE;
- EGLint texTarget = EGL_NO_TEXTURE;
- while (attrib_list[0]) {
- switch (attrib_list[0]) {
- case EGL_WIDTH:
- w = attrib_list[1];
- break;
- case EGL_HEIGHT:
- h = attrib_list[1];
- break;
- case EGL_TEXTURE_FORMAT:
- texFormat = attrib_list[1];
- break;
- case EGL_TEXTURE_TARGET:
- texTarget = attrib_list[1];
- break;
- default:
- break;
- };
- attrib_list+=2;
- }
- if (((texFormat == EGL_NO_TEXTURE)&&(texTarget != EGL_NO_TEXTURE)) ||
- ((texFormat != EGL_NO_TEXTURE)&&(texTarget == EGL_NO_TEXTURE))) {
- setErrorReturn(EGL_BAD_MATCH, EGL_NO_SURFACE);
- }
- // TODO: check EGL_TEXTURE_FORMAT - need to support eglBindTexImage
-
- GLenum pixelFormat;
- if (s_display.getConfigGLPixelFormat(config, &pixelFormat) == EGL_FALSE)
- setErrorReturn(EGL_BAD_MATCH, EGL_NO_SURFACE);
-
- egl_surface_t* surface = egl_pbuffer_surface_t::create(dpy, config,
- surfaceType, w, h, pixelFormat);
- if (!surface) {
- setErrorReturn(EGL_BAD_ALLOC, EGL_NO_SURFACE);
- }
-
- //setup attributes
- surface->setTextureFormat(texFormat);
- surface->setTextureTarget(texTarget);
-
- return surface;
-}
-
-EGLSurface eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list)
-{
- //XXX: Pixmap not supported. The host cannot render to a pixmap resource
- // located on host. In order to support Pixmaps we should either punt
- // to s/w rendering -or- let the host render to a buffer that will be
- // copied back to guest at some sync point. None of those methods not
- // implemented and pixmaps are not used with OpenGL anyway ...
- return EGL_NO_SURFACE;
-}
-
-EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface eglSurface)
-{
- VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE);
- VALIDATE_SURFACE_RETURN(eglSurface, EGL_FALSE);
-
- egl_surface_t* surface(static_cast<egl_surface_t*>(eglSurface));
- delete surface;
-
- return EGL_TRUE;
-}
-
-EGLBoolean eglQuerySurface(EGLDisplay dpy, EGLSurface eglSurface, EGLint attribute, EGLint *value)
-{
- VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE);
- VALIDATE_SURFACE_RETURN(eglSurface, EGL_FALSE);
-
- egl_surface_t* surface( static_cast<egl_surface_t*>(eglSurface) );
- EGLBoolean ret = EGL_TRUE;
- switch (attribute) {
- case EGL_CONFIG_ID:
- ret = s_display.getConfigAttrib(surface->config, EGL_CONFIG_ID, value);
- break;
- case EGL_WIDTH:
- *value = surface->getWidth();
- break;
- case EGL_HEIGHT:
- *value = surface->getHeight();
- break;
- case EGL_TEXTURE_FORMAT:
- *value = surface->getTextureFormat();
- break;
- case EGL_TEXTURE_TARGET:
- *value = surface->getTextureTarget();
- break;
- case EGL_SWAP_BEHAVIOR:
- *value = surface->getSwapBehavior();
- break;
- case EGL_LARGEST_PBUFFER:
- // not modified for a window or pixmap surface
- // and we ignore it when creating a PBuffer surface (default is EGL_FALSE)
- if (surface->getSurfaceType() & EGL_PBUFFER_BIT) *value = EGL_FALSE;
- break;
- //TODO: complete other attributes
- default:
- ALOGE("eglQuerySurface %x EGL_BAD_ATTRIBUTE", attribute);
- ret = setErrorFunc(EGL_BAD_ATTRIBUTE, EGL_FALSE);
- break;
- }
-
- return ret;
-}
-
-EGLBoolean eglBindAPI(EGLenum api)
-{
- if (api != EGL_OPENGL_ES_API)
- setErrorReturn(EGL_BAD_PARAMETER, EGL_FALSE);
- return EGL_TRUE;
-}
-
-EGLenum eglQueryAPI()
-{
- return EGL_OPENGL_ES_API;
-}
-
-EGLBoolean eglWaitClient()
-{
- return eglWaitGL();
-}
-
-EGLBoolean eglReleaseThread()
-{
- EGLThreadInfo *tInfo = getEGLThreadInfo();
- if (tInfo && tInfo->currentContext) {
- return eglMakeCurrent(&s_display, EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_SURFACE);
- }
- return EGL_TRUE;
-}
-
-EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
-{
- //TODO
- ALOGW("%s not implemented", __FUNCTION__);
- return 0;
-}
-
-EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
-{
- //TODO
- ALOGW("%s not implemented", __FUNCTION__);
- return 0;
-}
-
-EGLBoolean eglBindTexImage(EGLDisplay dpy, EGLSurface eglSurface, EGLint buffer)
-{
- VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE);
- VALIDATE_SURFACE_RETURN(eglSurface, EGL_FALSE);
- if (eglSurface == EGL_NO_SURFACE) {
- setErrorReturn(EGL_BAD_SURFACE, EGL_FALSE);
- }
-
- if (buffer != EGL_BACK_BUFFER) {
- setErrorReturn(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- egl_surface_t* surface( static_cast<egl_surface_t*>(eglSurface) );
-
- if (surface->getTextureFormat() == EGL_NO_TEXTURE) {
- setErrorReturn(EGL_BAD_MATCH, EGL_FALSE);
- }
-
- if (!(surface->getSurfaceType() & EGL_PBUFFER_BIT)) {
- setErrorReturn(EGL_BAD_SURFACE, EGL_FALSE);
- }
-
- //It's now safe to cast to pbuffer surface
- egl_pbuffer_surface_t* pbSurface = (egl_pbuffer_surface_t*)surface;
-
- DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
- rcEnc->rcBindTexture(rcEnc, pbSurface->getRcColorBuffer());
-
- return GL_TRUE;
-}
-
-EGLBoolean eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- //TODO
- ALOGW("%s not implemented", __FUNCTION__);
- return 0;
-}
-
-EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval)
-{
- VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE);
- DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
-
- EGLContext_t* ctx = getEGLThreadInfo()->currentContext;
- if (!ctx) {
- setErrorReturn(EGL_BAD_CONTEXT, EGL_FALSE);
- }
- if (!ctx->draw) {
- setErrorReturn(EGL_BAD_SURFACE, EGL_FALSE);
- }
- egl_surface_t* draw(static_cast<egl_surface_t*>(ctx->draw));
- draw->setSwapInterval(interval);
-
- rcEnc->rcFBSetSwapInterval(rcEnc, interval); //TODO: implement on the host
-
- return EGL_TRUE;
-}
-
-EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list)
-{
- VALIDATE_DISPLAY_INIT(dpy, EGL_NO_CONTEXT);
- VALIDATE_CONFIG(config, EGL_NO_CONTEXT);
-
- EGLint version = 1; //default
- while (attrib_list && attrib_list[0]) {
- if (attrib_list[0] == EGL_CONTEXT_CLIENT_VERSION) version = attrib_list[1];
- attrib_list+=2;
- }
-
- uint32_t rcShareCtx = 0;
- EGLContext_t * shareCtx = NULL;
- if (share_context) {
- shareCtx = static_cast<EGLContext_t*>(share_context);
- rcShareCtx = shareCtx->rcContext;
- if (shareCtx->dpy != dpy)
- setErrorReturn(EGL_BAD_MATCH, EGL_NO_CONTEXT);
- }
-
- DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_NO_CONTEXT);
- uint32_t rcContext = rcEnc->rcCreateContext(rcEnc, (uint32_t)config, rcShareCtx, version);
- if (!rcContext) {
- ALOGE("rcCreateContext returned 0");
- setErrorReturn(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
- }
-
- EGLContext_t * context = new EGLContext_t(dpy, config, shareCtx);
- if (!context)
- setErrorReturn(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
-
- context->version = version;
- context->rcContext = rcContext;
-
-
- return context;
-}
-
-EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
-{
- VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE);
- VALIDATE_CONTEXT_RETURN(ctx, EGL_FALSE);
-
- EGLContext_t * context = static_cast<EGLContext_t*>(ctx);
-
- if (getEGLThreadInfo()->currentContext == context)
- {
- eglMakeCurrent(dpy, EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_SURFACE);
- }
-
- if (context->rcContext) {
- DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
- rcEnc->rcDestroyContext(rcEnc, context->rcContext);
- context->rcContext = 0;
- }
-
- delete context;
- return EGL_TRUE;
-}
-
-EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
-{
- VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE);
- VALIDATE_SURFACE_RETURN(draw, EGL_FALSE);
- VALIDATE_SURFACE_RETURN(read, EGL_FALSE);
-
- if ((read == EGL_NO_SURFACE && draw == EGL_NO_SURFACE) && (ctx != EGL_NO_CONTEXT))
- setErrorReturn(EGL_BAD_MATCH, EGL_FALSE);
- if ((read != EGL_NO_SURFACE || draw != EGL_NO_SURFACE) && (ctx == EGL_NO_CONTEXT))
- setErrorReturn(EGL_BAD_MATCH, EGL_FALSE);
-
- EGLContext_t * context = static_cast<EGLContext_t*>(ctx);
- uint32_t ctxHandle = (context) ? context->rcContext : 0;
- egl_surface_t * drawSurf = static_cast<egl_surface_t *>(draw);
- uint32_t drawHandle = (drawSurf) ? drawSurf->getRcSurface() : 0;
- egl_surface_t * readSurf = static_cast<egl_surface_t *>(read);
- uint32_t readHandle = (readSurf) ? readSurf->getRcSurface() : 0;
-
- //
- // Nothing to do if no binding change has made
- //
- EGLThreadInfo *tInfo = getEGLThreadInfo();
- if (tInfo->currentContext == context &&
- (context == NULL ||
- (context && context->draw == draw && context->read == read))) {
- return EGL_TRUE;
- }
-
- if (context && (context->flags & EGLContext_t::IS_CURRENT) && (context != tInfo->currentContext)) {
- //context is current to another thread
- setErrorReturn(EGL_BAD_ACCESS, EGL_FALSE);
- }
-
- DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
- if (rcEnc->rcMakeCurrent(rcEnc, ctxHandle, drawHandle, readHandle) == EGL_FALSE) {
- ALOGE("rcMakeCurrent returned EGL_FALSE");
- setErrorReturn(EGL_BAD_CONTEXT, EGL_FALSE);
- }
-
- //Now make the local bind
- if (context) {
- context->draw = draw;
- context->read = read;
- context->flags |= EGLContext_t::IS_CURRENT;
- //set the client state
- if (context->version == 2) {
- hostCon->gl2Encoder()->setClientState(context->getClientState());
- hostCon->gl2Encoder()->setSharedGroup(context->getSharedGroup());
- }
- else {
- hostCon->glEncoder()->setClientState(context->getClientState());
- hostCon->glEncoder()->setSharedGroup(context->getSharedGroup());
- }
- }
- else {
- //release ClientState & SharedGroup
- if (tInfo->currentContext->version == 2) {
- hostCon->gl2Encoder()->setClientState(NULL);
- hostCon->gl2Encoder()->setSharedGroup(GLSharedGroupPtr(NULL));
- }
- else {
- hostCon->glEncoder()->setClientState(NULL);
- hostCon->glEncoder()->setSharedGroup(GLSharedGroupPtr(NULL));
- }
-
- }
-
- if (tInfo->currentContext)
- tInfo->currentContext->flags &= ~EGLContext_t::IS_CURRENT;
-
- //Now make current
- tInfo->currentContext = context;
-
- //Check maybe we need to init the encoder, if it's first eglMakeCurrent
- if (tInfo->currentContext) {
- if (tInfo->currentContext->version == 2) {
- if (!hostCon->gl2Encoder()->isInitialized()) {
- s_display.gles2_iface()->init();
- hostCon->gl2Encoder()->setInitialized();
- ClientAPIExts::initClientFuncs(s_display.gles2_iface(), 1);
- }
- }
- else {
- if (!hostCon->glEncoder()->isInitialized()) {
- s_display.gles_iface()->init();
- hostCon->glEncoder()->setInitialized();
- ClientAPIExts::initClientFuncs(s_display.gles_iface(), 0);
- }
- }
- }
-
- return EGL_TRUE;
-}
-
-EGLContext eglGetCurrentContext()
-{
- return getEGLThreadInfo()->currentContext;
-}
-
-EGLSurface eglGetCurrentSurface(EGLint readdraw)
-{
- EGLContext_t * context = getEGLThreadInfo()->currentContext;
- if (!context)
- return EGL_NO_SURFACE; //not an error
-
- switch (readdraw) {
- case EGL_READ:
- return context->read;
- case EGL_DRAW:
- return context->draw;
- default:
- setErrorReturn(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
- }
-}
-
-EGLDisplay eglGetCurrentDisplay()
-{
- EGLContext_t * context = getEGLThreadInfo()->currentContext;
- if (!context)
- return EGL_NO_DISPLAY; //not an error
-
- return context->dpy;
-}
-
-EGLBoolean eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
-{
- VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE);
- VALIDATE_CONTEXT_RETURN(ctx, EGL_FALSE);
-
- EGLContext_t * context = static_cast<EGLContext_t*>(ctx);
-
- EGLBoolean ret = EGL_TRUE;
- switch (attribute) {
- case EGL_CONFIG_ID:
- ret = s_display.getConfigAttrib(context->config, EGL_CONFIG_ID, value);
- break;
- case EGL_CONTEXT_CLIENT_TYPE:
- *value = EGL_OPENGL_ES_API;
- break;
- case EGL_CONTEXT_CLIENT_VERSION:
- *value = context->version;
- break;
- case EGL_RENDER_BUFFER:
- if (!context->draw)
- *value = EGL_NONE;
- else
- *value = EGL_BACK_BUFFER; //single buffer not supported
- break;
- default:
- ALOGE("eglQueryContext %x EGL_BAD_ATTRIBUTE", attribute);
- setErrorReturn(EGL_BAD_ATTRIBUTE, EGL_FALSE);
- break;
- }
-
- return ret;
-}
-
-EGLBoolean eglWaitGL()
-{
- EGLThreadInfo *tInfo = getEGLThreadInfo();
- if (!tInfo || !tInfo->currentContext) {
- return EGL_FALSE;
- }
-
- if (tInfo->currentContext->version == 2) {
- s_display.gles2_iface()->finish();
- }
- else {
- s_display.gles_iface()->finish();
- }
-
- return EGL_TRUE;
-}
-
-EGLBoolean eglWaitNative(EGLint engine)
-{
- return EGL_TRUE;
-}
-
-EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface eglSurface)
-{
- VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE);
- if (eglSurface == EGL_NO_SURFACE)
- setErrorReturn(EGL_BAD_SURFACE, EGL_FALSE);
-
- DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
-
- egl_surface_t* d = static_cast<egl_surface_t*>(eglSurface);
- if (d->dpy != dpy)
- setErrorReturn(EGL_BAD_DISPLAY, EGL_FALSE);
-
- // post the surface
- d->swapBuffers();
-
- hostCon->flush();
- return EGL_TRUE;
-}
-
-EGLBoolean eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
-{
- //TODO :later
- return 0;
-}
-
-EGLBoolean eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list)
-{
- //TODO later
- return 0;
-}
-
-EGLBoolean eglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface)
-{
- //TODO later
- return 0;
-}
-
-EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
-{
- VALIDATE_DISPLAY_INIT(dpy, EGL_NO_IMAGE_KHR);
- if (ctx != EGL_NO_CONTEXT) {
- setErrorReturn(EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR);
- }
- if (target != EGL_NATIVE_BUFFER_ANDROID) {
- setErrorReturn(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
- }
-
- android_native_buffer_t* native_buffer = (android_native_buffer_t*)buffer;
-
- if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC)
- setErrorReturn(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
-
- if (native_buffer->common.version != sizeof(android_native_buffer_t))
- setErrorReturn(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
-
- cb_handle_t *cb = (cb_handle_t *)(native_buffer->handle);
-
- switch (cb->format) {
- case HAL_PIXEL_FORMAT_RGBA_8888:
- case HAL_PIXEL_FORMAT_RGBX_8888:
- case HAL_PIXEL_FORMAT_RGB_888:
- case HAL_PIXEL_FORMAT_RGB_565:
- case HAL_PIXEL_FORMAT_BGRA_8888:
- case HAL_PIXEL_FORMAT_RGBA_5551:
- case HAL_PIXEL_FORMAT_RGBA_4444:
- break;
- default:
- setErrorReturn(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
- }
-
- native_buffer->common.incRef(&native_buffer->common);
- return (EGLImageKHR)native_buffer;
-}
-
-EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img)
-{
- VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE);
- android_native_buffer_t* native_buffer = (android_native_buffer_t*)img;
-
- if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC)
- setErrorReturn(EGL_BAD_PARAMETER, EGL_FALSE);
-
- if (native_buffer->common.version != sizeof(android_native_buffer_t))
- setErrorReturn(EGL_BAD_PARAMETER, EGL_FALSE);
-
- native_buffer->common.decRef(&native_buffer->common);
-
- return EGL_TRUE;
-}
-
-#define FENCE_SYNC_HANDLE (EGLSyncKHR)0xFE4CE
-
-EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, EGLenum type,
- const EGLint *attrib_list)
-{
- // TODO: This implementation could be faster. We should require the host EGL
- // to support KHR_fence_sync, or at least pipe the fence command to the host
- // and wait for it (probably involving a glFinish on the host) in
- // eglClientWaitSyncKHR.
-
- VALIDATE_DISPLAY(dpy, EGL_NO_SYNC_KHR);
-
- if (type != EGL_SYNC_FENCE_KHR ||
- (attrib_list != NULL && attrib_list[0] != EGL_NONE)) {
- setErrorReturn(EGL_BAD_ATTRIBUTE, EGL_NO_SYNC_KHR);
- }
-
- EGLThreadInfo *tInfo = getEGLThreadInfo();
- if (!tInfo || !tInfo->currentContext) {
- setErrorReturn(EGL_BAD_MATCH, EGL_NO_SYNC_KHR);
- }
-
- if (tInfo->currentContext->version == 2) {
- s_display.gles2_iface()->finish();
- } else {
- s_display.gles_iface()->finish();
- }
-
- return FENCE_SYNC_HANDLE;
-}
-
-EGLBoolean eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
-{
- if (sync != FENCE_SYNC_HANDLE) {
- setErrorReturn(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- return EGL_TRUE;
-}
-
-EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags,
- EGLTimeKHR timeout)
-{
- if (sync != FENCE_SYNC_HANDLE) {
- setErrorReturn(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- return EGL_CONDITION_SATISFIED_KHR;
-}
-
-EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync,
- EGLint attribute, EGLint *value)
-{
- if (sync != FENCE_SYNC_HANDLE) {
- setErrorReturn(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- switch (attribute) {
- case EGL_SYNC_TYPE_KHR:
- *value = EGL_SYNC_FENCE_KHR;
- return EGL_TRUE;
- case EGL_SYNC_STATUS_KHR:
- *value = EGL_SIGNALED_KHR;
- return EGL_TRUE;
- case EGL_SYNC_CONDITION_KHR:
- *value = EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR;
- return EGL_TRUE;
- default:
- setErrorReturn(EGL_BAD_ATTRIBUTE, EGL_FALSE);
- }
-}
diff --git a/tools/emulator/opengl/system/egl/eglContext.h b/tools/emulator/opengl/system/egl/eglContext.h
deleted file mode 100644
index 2ca6d0c21..000000000
--- a/tools/emulator/opengl/system/egl/eglContext.h
+++ /dev/null
@@ -1,51 +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.
-*/
-#ifndef _EGL_CONTEXT_H
-#define _EGL_CONTEXT_H
-
-#include "GLClientState.h"
-#include "GLSharedGroup.h"
-
-struct EGLContext_t {
-
- enum {
- IS_CURRENT = 0x00010000,
- NEVER_CURRENT = 0x00020000
- };
-
- EGLContext_t(EGLDisplay dpy, EGLConfig config, EGLContext_t* shareCtx);
- ~EGLContext_t();
- uint32_t flags;
- EGLDisplay dpy;
- EGLConfig config;
- EGLSurface read;
- EGLSurface draw;
- EGLContext_t * shareCtx;
- EGLint version;
- uint32_t rcContext;
- const char* versionString;
- const char* vendorString;
- const char* rendererString;
- const char* extensionString;
-
- GLClientState * getClientState(){ return clientState; }
- GLSharedGroupPtr getSharedGroup(){ return sharedGroup; }
-private:
- GLClientState * clientState;
- GLSharedGroupPtr sharedGroup;
-};
-
-#endif
diff --git a/tools/emulator/opengl/system/egl/eglDisplay.cpp b/tools/emulator/opengl/system/egl/eglDisplay.cpp
deleted file mode 100644
index bcb0d4bbe..000000000
--- a/tools/emulator/opengl/system/egl/eglDisplay.cpp
+++ /dev/null
@@ -1,497 +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.
-*/
-#include "eglDisplay.h"
-#include "HostConnection.h"
-#include <dlfcn.h>
-
-static const int systemEGLVersionMajor = 1;
-static const int systemEGLVersionMinor = 4;
-static const char systemEGLVendor[] = "Google Android emulator";
-
-// list of extensions supported by this EGL implementation
-// NOTE that each extension name should be suffixed with space
-static const char systemStaticEGLExtensions[] =
- "EGL_ANDROID_image_native_buffer "
- "EGL_KHR_fence_sync ";
-
-// list of extensions supported by this EGL implementation only if supported
-// on the host implementation.
-// NOTE that each extension name should be suffixed with space
-static const char systemDynamicEGLExtensions[] =
- "EGL_KHR_image_base "
- "EGL_KHR_gl_texture_2d_image ";
-
-
-static void *s_gles_lib = NULL;
-static void *s_gles2_lib = NULL;
-
-// The following function will be called when we (libEGL)
-// gets unloaded
-// At this point we want to unload the gles libraries we
-// might have loaded during initialization
-static void __attribute__ ((destructor)) do_on_unload(void)
-{
- if (s_gles_lib) {
- dlclose(s_gles_lib);
- }
-
- if (s_gles2_lib) {
- dlclose(s_gles2_lib);
- }
-}
-
-eglDisplay::eglDisplay() :
- m_initialized(false),
- m_major(0),
- m_minor(0),
- m_hostRendererVersion(0),
- m_numConfigs(0),
- m_numConfigAttribs(0),
- m_attribs(DefaultKeyedVector<EGLint, EGLint>(ATTRIBUTE_NONE)),
- m_configs(NULL),
- m_gles_iface(NULL),
- m_gles2_iface(NULL),
- m_versionString(NULL),
- m_vendorString(NULL),
- m_extensionString(NULL)
-{
- pthread_mutex_init(&m_lock, NULL);
-}
-
-eglDisplay::~eglDisplay()
-{
- pthread_mutex_destroy(&m_lock);
-}
-
-bool eglDisplay::initialize(EGLClient_eglInterface *eglIface)
-{
- pthread_mutex_lock(&m_lock);
- if (!m_initialized) {
-
- //
- // load GLES client API
- //
- m_gles_iface = loadGLESClientAPI("/system/lib/egl/libGLESv1_CM_emulation.so",
- eglIface,
- &s_gles_lib);
- if (!m_gles_iface) {
- pthread_mutex_unlock(&m_lock);
- ALOGE("Failed to load gles1 iface");
- return false;
- }
-
-#ifdef WITH_GLES2
- m_gles2_iface = loadGLESClientAPI("/system/lib/egl/libGLESv2_emulation.so",
- eglIface,
- &s_gles2_lib);
- // Note that if loading gles2 failed, we can still run with no
- // GLES2 support, having GLES2 is not mandatory.
-#endif
-
- //
- // establish connection with the host
- //
- HostConnection *hcon = HostConnection::get();
- if (!hcon) {
- pthread_mutex_unlock(&m_lock);
- ALOGE("Failed to establish connection with the host\n");
- return false;
- }
-
- //
- // get renderControl encoder instance
- //
- renderControl_encoder_context_t *rcEnc = hcon->rcEncoder();
- if (!rcEnc) {
- pthread_mutex_unlock(&m_lock);
- ALOGE("Failed to get renderControl encoder instance");
- return false;
- }
-
- //
- // Query host reneder and EGL version
- //
- m_hostRendererVersion = rcEnc->rcGetRendererVersion(rcEnc);
- EGLint status = rcEnc->rcGetEGLVersion(rcEnc, &m_major, &m_minor);
- if (status != EGL_TRUE) {
- // host EGL initialization failed !!
- pthread_mutex_unlock(&m_lock);
- return false;
- }
-
- //
- // Take minimum version beween what we support and what the host support
- //
- if (m_major > systemEGLVersionMajor) {
- m_major = systemEGLVersionMajor;
- m_minor = systemEGLVersionMinor;
- }
- else if (m_major == systemEGLVersionMajor &&
- m_minor > systemEGLVersionMinor) {
- m_minor = systemEGLVersionMinor;
- }
-
- //
- // Query the host for the set of configs
- //
- m_numConfigs = rcEnc->rcGetNumConfigs(rcEnc, (uint32_t*)&m_numConfigAttribs);
- if (m_numConfigs <= 0 || m_numConfigAttribs <= 0) {
- // just sanity check - should never happen
- pthread_mutex_unlock(&m_lock);
- return false;
- }
-
- uint32_t nInts = m_numConfigAttribs * (m_numConfigs + 1);
- EGLint tmp_buf[nInts];
- m_configs = new EGLint[nInts-m_numConfigAttribs];
- if (!m_configs) {
- pthread_mutex_unlock(&m_lock);
- return false;
- }
-
- //EGLint n = rcEnc->rcGetConfigs(rcEnc, nInts*sizeof(EGLint), m_configs);
- EGLint n = rcEnc->rcGetConfigs(rcEnc, nInts*sizeof(EGLint), (GLuint*)tmp_buf);
- if (n != m_numConfigs) {
- pthread_mutex_unlock(&m_lock);
- return false;
- }
-
- //Fill the attributes vector.
- //The first m_numConfigAttribs values of tmp_buf are the actual attributes enums.
- for (int i=0; i<m_numConfigAttribs; i++) {
- m_attribs.add(tmp_buf[i], i);
- }
-
- //Copy the actual configs data to m_configs
- memcpy(m_configs, tmp_buf + m_numConfigAttribs, m_numConfigs*m_numConfigAttribs*sizeof(EGLint));
-
- m_initialized = true;
- }
- pthread_mutex_unlock(&m_lock);
-
- processConfigs();
-
- return true;
-}
-
-void eglDisplay::processConfigs()
-{
- for (int i=0; i<m_numConfigs; i++) {
- EGLConfig config = (EGLConfig)i;
- //Setup the EGL_NATIVE_VISUAL_ID attribute
- PixelFormat format;
- if (getConfigNativePixelFormat(config, &format)) {
- setConfigAttrib(config, EGL_NATIVE_VISUAL_ID, format);
- }
- }
-}
-
-void eglDisplay::terminate()
-{
- pthread_mutex_lock(&m_lock);
- if (m_initialized) {
- m_initialized = false;
- delete [] m_configs;
- m_configs = NULL;
-
- if (m_versionString) {
- free(m_versionString);
- m_versionString = NULL;
- }
- if (m_vendorString) {
- free(m_vendorString);
- m_vendorString = NULL;
- }
- if (m_extensionString) {
- free(m_extensionString);
- m_extensionString = NULL;
- }
- }
- pthread_mutex_unlock(&m_lock);
-}
-
-EGLClient_glesInterface *eglDisplay::loadGLESClientAPI(const char *libName,
- EGLClient_eglInterface *eglIface,
- void **libHandle)
-{
- void *lib = dlopen(libName, RTLD_NOW);
- if (!lib) {
- ALOGE("Failed to dlopen %s", libName);
- return NULL;
- }
-
- init_emul_gles_t init_gles_func = (init_emul_gles_t)dlsym(lib,"init_emul_gles");
- if (!init_gles_func) {
- ALOGE("Failed to find init_emul_gles");
- dlclose((void*)lib);
- return NULL;
- }
-
- *libHandle = lib;
- return (*init_gles_func)(eglIface);
-}
-
-static char *queryHostEGLString(EGLint name)
-{
- HostConnection *hcon = HostConnection::get();
- if (hcon) {
- renderControl_encoder_context_t *rcEnc = hcon->rcEncoder();
- if (rcEnc) {
- int n = rcEnc->rcQueryEGLString(rcEnc, name, NULL, 0);
- if (n < 0) {
- // allocate space for the string with additional
- // space charachter to be suffixed at the end.
- char *str = (char *)malloc(-n+2);
- n = rcEnc->rcQueryEGLString(rcEnc, name, str, -n);
- if (n > 0) {
- // add extra space at end of string which will be
- // needed later when filtering the extension list.
- strcat(str, " ");
- return str;
- }
-
- free(str);
- }
- }
- }
-
- return NULL;
-}
-
-static bool findExtInList(const char* token, int tokenlen, const char* list)
-{
- const char* p = list;
- while (*p != '\0') {
- const char* q = strchr(p, ' ');
- if (q == NULL) {
- /* should not happen, list must be space-terminated */
- break;
- }
- if (tokenlen == (q - p) && !memcmp(token, p, tokenlen)) {
- return true; /* found it */
- }
- p = q+1;
- }
- return false; /* not found */
-}
-
-static char *buildExtensionString()
-{
- //Query host extension string
- char *hostExt = queryHostEGLString(EGL_EXTENSIONS);
- if (!hostExt || (hostExt[1] == '\0')) {
- // no extensions on host - only static extension list supported
- return strdup(systemStaticEGLExtensions);
- }
-
- //
- // Filter host extension list to include only extensions
- // we can support (in the systemDynamicEGLExtensions list)
- //
- char *ext = (char *)hostExt;
- char *c = ext;
- char *insert = ext;
- while(*c != '\0') {
- if (*c == ' ') {
- int len = c - ext;
- if (findExtInList(ext, len, systemDynamicEGLExtensions)) {
- if (ext != insert) {
- memcpy(insert, ext, len+1); // including space
- }
- insert += (len + 1);
- }
- ext = c + 1;
- }
- c++;
- }
- *insert = '\0';
-
- int n = strlen(hostExt);
- if (n > 0) {
- char *str;
- asprintf(&str,"%s%s", systemStaticEGLExtensions, hostExt);
- free((char*)hostExt);
- return str;
- }
- else {
- free((char*)hostExt);
- return strdup(systemStaticEGLExtensions);
- }
-}
-
-const char *eglDisplay::queryString(EGLint name)
-{
- if (name == EGL_CLIENT_APIS) {
- return "OpenGL_ES";
- }
- else if (name == EGL_VERSION) {
- pthread_mutex_lock(&m_lock);
- if (m_versionString) {
- pthread_mutex_unlock(&m_lock);
- return m_versionString;
- }
-
- // build version string
- asprintf(&m_versionString, "%d.%d", m_major, m_minor);
- pthread_mutex_unlock(&m_lock);
-
- return m_versionString;
- }
- else if (name == EGL_VENDOR) {
- pthread_mutex_lock(&m_lock);
- if (m_vendorString) {
- pthread_mutex_unlock(&m_lock);
- return m_vendorString;
- }
-
- // build vendor string
- const char *hostVendor = queryHostEGLString(EGL_VENDOR);
-
- if (hostVendor) {
- asprintf(&m_vendorString, "%s Host: %s",
- systemEGLVendor, hostVendor);
- free((char*)hostVendor);
- }
- else {
- m_vendorString = (char *)systemEGLVendor;
- }
- pthread_mutex_unlock(&m_lock);
-
- return m_vendorString;
- }
- else if (name == EGL_EXTENSIONS) {
- pthread_mutex_lock(&m_lock);
- if (m_extensionString) {
- pthread_mutex_unlock(&m_lock);
- return m_extensionString;
- }
-
- // build extension string
- m_extensionString = buildExtensionString();
- pthread_mutex_unlock(&m_lock);
-
- return m_extensionString;
- }
- else {
- ALOGE("[%s] Unknown name %d\n", __FUNCTION__, name);
- return NULL;
- }
-}
-
-/* To get the value of attribute <a> of config <c> use the following formula:
- * value = *(m_configs + (int)c*m_numConfigAttribs + a);
- */
-EGLBoolean eglDisplay::getAttribValue(EGLConfig config, EGLint attribIdx, EGLint * value)
-{
- if (attribIdx == ATTRIBUTE_NONE)
- {
- ALOGE("[%s] Bad attribute idx\n", __FUNCTION__);
- return EGL_FALSE;
- }
- *value = *(m_configs + (int)config*m_numConfigAttribs + attribIdx);
- return EGL_TRUE;
-}
-
-EGLBoolean eglDisplay::getConfigAttrib(EGLConfig config, EGLint attrib, EGLint * value)
-{
- //Though it seems that valueFor() is thread-safe, we don't take chanses
- pthread_mutex_lock(&m_lock);
- EGLBoolean ret = getAttribValue(config, m_attribs.valueFor(attrib), value);
- pthread_mutex_unlock(&m_lock);
- return ret;
-}
-
-void eglDisplay::dumpConfig(EGLConfig config)
-{
- EGLint value = 0;
- DBG("^^^^^^^^^^ dumpConfig %d ^^^^^^^^^^^^^^^^^^", (int)config);
- for (int i=0; i<m_numConfigAttribs; i++) {
- getAttribValue(config, i, &value);
- DBG("{%d}[%d] %d\n", (int)config, i, value);
- }
-}
-
-/* To set the value of attribute <a> of config <c> use the following formula:
- * *(m_configs + (int)c*m_numConfigAttribs + a) = value;
- */
-EGLBoolean eglDisplay::setAttribValue(EGLConfig config, EGLint attribIdx, EGLint value)
-{
- if (attribIdx == ATTRIBUTE_NONE)
- {
- ALOGE("[%s] Bad attribute idx\n", __FUNCTION__);
- return EGL_FALSE;
- }
- *(m_configs + (int)config*m_numConfigAttribs + attribIdx) = value;
- return EGL_TRUE;
-}
-
-EGLBoolean eglDisplay::setConfigAttrib(EGLConfig config, EGLint attrib, EGLint value)
-{
- //Though it seems that valueFor() is thread-safe, we don't take chanses
- pthread_mutex_lock(&m_lock);
- EGLBoolean ret = setAttribValue(config, m_attribs.valueFor(attrib), value);
- pthread_mutex_unlock(&m_lock);
- return ret;
-}
-
-
-EGLBoolean eglDisplay::getConfigNativePixelFormat(EGLConfig config, PixelFormat * format)
-{
- EGLint redSize, blueSize, greenSize, alphaSize;
-
- if ( !(getAttribValue(config, m_attribs.valueFor(EGL_RED_SIZE), &redSize) &&
- getAttribValue(config, m_attribs.valueFor(EGL_BLUE_SIZE), &blueSize) &&
- getAttribValue(config, m_attribs.valueFor(EGL_GREEN_SIZE), &greenSize) &&
- getAttribValue(config, m_attribs.valueFor(EGL_ALPHA_SIZE), &alphaSize)) )
- {
- ALOGE("Couldn't find value for one of the pixel format attributes");
- return EGL_FALSE;
- }
-
- //calculate the GL internal format
- if ((redSize==8)&&(greenSize==8)&&(blueSize==8)&&(alphaSize==8)) *format = PIXEL_FORMAT_RGBA_8888; //XXX: BGR?
- else if ((redSize==8)&&(greenSize==8)&&(blueSize==8)&&(alphaSize==0)) *format = PIXEL_FORMAT_RGBX_8888; //XXX or PIXEL_FORMAT_RGB_888
- else if ((redSize==5)&&(greenSize==6)&&(blueSize==5)&&(alphaSize==0)) *format = PIXEL_FORMAT_RGB_565;
- else if ((redSize==5)&&(greenSize==5)&&(blueSize==5)&&(alphaSize==1)) *format = PIXEL_FORMAT_RGBA_5551;
- else if ((redSize==4)&&(greenSize==4)&&(blueSize==4)&&(alphaSize==4)) *format = PIXEL_FORMAT_RGBA_4444;
- else {
- return EGL_FALSE;
- }
- return EGL_TRUE;
-}
-EGLBoolean eglDisplay::getConfigGLPixelFormat(EGLConfig config, GLenum * format)
-{
- EGLint redSize, blueSize, greenSize, alphaSize;
-
- if ( !(getAttribValue(config, m_attribs.valueFor(EGL_RED_SIZE), &redSize) &&
- getAttribValue(config, m_attribs.valueFor(EGL_BLUE_SIZE), &blueSize) &&
- getAttribValue(config, m_attribs.valueFor(EGL_GREEN_SIZE), &greenSize) &&
- getAttribValue(config, m_attribs.valueFor(EGL_ALPHA_SIZE), &alphaSize)) )
- {
- ALOGE("Couldn't find value for one of the pixel format attributes");
- return EGL_FALSE;
- }
-
- //calculate the GL internal format
- if ((redSize==8)&&(blueSize==8)&&(blueSize==8)&&(alphaSize==8)) *format = GL_RGBA;
- else if ((redSize==8)&&(greenSize==8)&&(blueSize==8)&&(alphaSize==0)) *format = GL_RGB;
- else if ((redSize==5)&&(greenSize==6)&&(blueSize==5)&&(alphaSize==0)) *format = GL_RGB565_OES;
- else if ((redSize==5)&&(greenSize==5)&&(blueSize==5)&&(alphaSize==1)) *format = GL_RGB5_A1_OES;
- else if ((redSize==4)&&(greenSize==4)&&(blueSize==4)&&(alphaSize==4)) *format = GL_RGBA4_OES;
- else return EGL_FALSE;
-
- return EGL_TRUE;
-}
diff --git a/tools/emulator/opengl/system/egl/eglDisplay.h b/tools/emulator/opengl/system/egl/eglDisplay.h
deleted file mode 100644
index 9d979d9d9..000000000
--- a/tools/emulator/opengl/system/egl/eglDisplay.h
+++ /dev/null
@@ -1,89 +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.
-*/
-#ifndef _SYSTEM_EGL_DISPLAY_H
-#define _SYSTEM_EGL_DISPLAY_H
-
-#include <pthread.h>
-#include "glUtils.h"
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include "EGLClientIface.h"
-#include <utils/KeyedVector.h>
-
-#include <ui/PixelFormat.h>
-
-#define ATTRIBUTE_NONE -1
-//FIXME: are we in this namespace?
-using namespace android;
-
-class eglDisplay
-{
-public:
- eglDisplay();
- ~eglDisplay();
-
- bool initialize(EGLClient_eglInterface *eglIface);
- void terminate();
-
- int getVersionMajor() const { return m_major; }
- int getVersionMinor() const { return m_minor; }
- bool initialized() const { return m_initialized; }
-
- const char *queryString(EGLint name);
-
- const EGLClient_glesInterface *gles_iface() const { return m_gles_iface; }
- const EGLClient_glesInterface *gles2_iface() const { return m_gles2_iface; }
-
- int getNumConfigs(){ return m_numConfigs; }
- EGLBoolean getConfigAttrib(EGLConfig config, EGLint attrib, EGLint * value);
- EGLBoolean setConfigAttrib(EGLConfig config, EGLint attrib, EGLint value);
- EGLBoolean getConfigGLPixelFormat(EGLConfig config, GLenum * format);
- EGLBoolean getConfigNativePixelFormat(EGLConfig config, PixelFormat * format);
-
- void dumpConfig(EGLConfig config);
-private:
- EGLClient_glesInterface *loadGLESClientAPI(const char *libName,
- EGLClient_eglInterface *eglIface,
- void **libHandle);
- EGLBoolean getAttribValue(EGLConfig config, EGLint attribIdxi, EGLint * value);
- EGLBoolean setAttribValue(EGLConfig config, EGLint attribIdxi, EGLint value);
- void processConfigs();
-
-private:
- pthread_mutex_t m_lock;
- bool m_initialized;
- int m_major;
- int m_minor;
- int m_hostRendererVersion;
- int m_numConfigs;
- int m_numConfigAttribs;
-
- /* This is the mapping between an attribute name to it's index in any given config */
- DefaultKeyedVector<EGLint, EGLint> m_attribs;
- /* This is an array of all config's attributes values stored in the following sequencial fasion (read: v[c,a] = the value of attribute <a> of config <c>)
- * v[0,0],..,v[0,m_numConfigAttribs-1],
- *...
- * v[m_numConfigs-1,0],..,v[m_numConfigs-1,m_numConfigAttribs-1]
- */
- EGLint *m_configs;
- EGLClient_glesInterface *m_gles_iface;
- EGLClient_glesInterface *m_gles2_iface;
- char *m_versionString;
- char *m_vendorString;
- char *m_extensionString;
-};
-
-#endif
diff --git a/tools/emulator/opengl/system/egl/egl_ftable.h b/tools/emulator/opengl/system/egl/egl_ftable.h
deleted file mode 100644
index 16d130cca..000000000
--- a/tools/emulator/opengl/system/egl/egl_ftable.h
+++ /dev/null
@@ -1,64 +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.
-*/
-static const struct _egl_funcs_by_name {
- const char *name;
- void *proc;
-} egl_funcs_by_name[] = {
- {"eglGetError", (void *)eglGetError},
- {"eglGetDisplay", (void *)eglGetDisplay},
- {"eglInitialize", (void *)eglInitialize},
- {"eglTerminate", (void *)eglTerminate},
- {"eglQueryString", (void *)eglQueryString},
- {"eglGetConfigs", (void *)eglGetConfigs},
- {"eglChooseConfig", (void *)eglChooseConfig},
- {"eglGetConfigAttrib", (void *)eglGetConfigAttrib},
- {"eglCreateWindowSurface", (void *)eglCreateWindowSurface},
- {"eglCreatePbufferSurface", (void *)eglCreatePbufferSurface},
- {"eglCreatePixmapSurface", (void *)eglCreatePixmapSurface},
- {"eglDestroySurface", (void *)eglDestroySurface},
- {"eglQuerySurface", (void *)eglQuerySurface},
- {"eglBindAPI", (void *)eglBindAPI},
- {"eglQueryAPI", (void *)eglQueryAPI},
- {"eglWaitClient", (void *)eglWaitClient},
- {"eglReleaseThread", (void *)eglReleaseThread},
- {"eglCreatePbufferFromClientBuffer", (void *)eglCreatePbufferFromClientBuffer},
- {"eglSurfaceAttrib", (void *)eglSurfaceAttrib},
- {"eglBindTexImage", (void *)eglBindTexImage},
- {"eglReleaseTexImage", (void *)eglReleaseTexImage},
- {"eglSwapInterval", (void *)eglSwapInterval},
- {"eglCreateContext", (void *)eglCreateContext},
- {"eglDestroyContext", (void *)eglDestroyContext},
- {"eglMakeCurrent", (void *)eglMakeCurrent},
- {"eglGetCurrentContext", (void *)eglGetCurrentContext},
- {"eglGetCurrentSurface", (void *)eglGetCurrentSurface},
- {"eglGetCurrentDisplay", (void *)eglGetCurrentDisplay},
- {"eglQueryContext", (void *)eglQueryContext},
- {"eglWaitGL", (void *)eglWaitGL},
- {"eglWaitNative", (void *)eglWaitNative},
- {"eglSwapBuffers", (void *)eglSwapBuffers},
- {"eglCopyBuffers", (void *)eglCopyBuffers},
- {"eglGetProcAddress", (void *)eglGetProcAddress},
- {"eglLockSurfaceKHR", (void *)eglLockSurfaceKHR},
- {"eglUnlockSurfaceKHR", (void *)eglUnlockSurfaceKHR},
- {"eglCreateImageKHR", (void *)eglCreateImageKHR},
- {"eglDestroyImageKHR", (void *)eglDestroyImageKHR},
- {"eglCreateSyncKHR", (void *)eglCreateSyncKHR},
- {"eglDestroySyncKHR", (void *)eglDestroySyncKHR},
- {"eglClientWaitSyncKHR", (void *)eglClientWaitSyncKHR},
- {"eglGetSyncAttribKHR", (void *)eglGetSyncAttribKHR}
-};
-
-static const int egl_num_funcs = sizeof(egl_funcs_by_name) / sizeof(struct _egl_funcs_by_name);
diff --git a/tools/emulator/opengl/system/gralloc/Android.mk b/tools/emulator/opengl/system/gralloc/Android.mk
deleted file mode 100644
index 870560253..000000000
--- a/tools/emulator/opengl/system/gralloc/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-ifneq (false,$(BUILD_EMULATOR_OPENGL_DRIVER))
-
-LOCAL_PATH := $(call my-dir)
-
-$(call emugl-begin-shared-library,gralloc.goldfish)
-$(call emugl-import,libGLESv1_enc lib_renderControl_enc libOpenglSystemCommon)
-$(call emugl-set-shared-library-subpath,hw)
-
-LOCAL_CFLAGS += -DLOG_TAG=\"gralloc_goldfish\"
-
-LOCAL_SRC_FILES := gralloc.cpp
-
-# Need to access the special OPENGL TLS Slot
-LOCAL_C_INCLUDES += bionic/libc/private
-LOCAL_SHARED_LIBRARIES += libdl
-
-$(call emugl-end-module)
-
-endif # BUILD_EMULATOR_OPENGL_DRIVER != false
diff --git a/tools/emulator/opengl/system/gralloc/gralloc.cpp b/tools/emulator/opengl/system/gralloc/gralloc.cpp
deleted file mode 100644
index ac20d492e..000000000
--- a/tools/emulator/opengl/system/gralloc/gralloc.cpp
+++ /dev/null
@@ -1,929 +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.
-*/
-#include <string.h>
-#include <pthread.h>
-#ifdef HAVE_ANDROID_OS // just want PAGE_SIZE define
-# include <asm/page.h>
-#else
-# include <sys/user.h>
-#endif
-#include <cutils/ashmem.h>
-#include <unistd.h>
-#include <errno.h>
-#include <dlfcn.h>
-#include <sys/mman.h>
-#include "gralloc_cb.h"
-#include "HostConnection.h"
-#include "glUtils.h"
-#include <cutils/log.h>
-#include <cutils/properties.h>
-
-/* Set to 1 or 2 to enable debug traces */
-#define DEBUG 0
-
-#if DEBUG >= 1
-# define D(...) ALOGD(__VA_ARGS__)
-#else
-# define D(...) ((void)0)
-#endif
-
-#if DEBUG >= 2
-# define DD(...) ALOGD(__VA_ARGS__)
-#else
-# define DD(...) ((void)0)
-#endif
-
-#define DBG_FUNC DBG("%s\n", __FUNCTION__)
-//
-// our private gralloc module structure
-//
-struct private_module_t {
- gralloc_module_t base;
-};
-
-/* If not NULL, this is a pointer to the fallback module.
- * This really is gralloc.default, which we'll use if we detect
- * that the emulator we're running in does not support GPU emulation.
- */
-static gralloc_module_t* sFallback;
-static pthread_once_t sFallbackOnce = PTHREAD_ONCE_INIT;
-
-static void fallback_init(void); // forward
-
-
-typedef struct _alloc_list_node {
- buffer_handle_t handle;
- _alloc_list_node *next;
- _alloc_list_node *prev;
-} AllocListNode;
-
-//
-// Our gralloc device structure (alloc interface)
-//
-struct gralloc_device_t {
- alloc_device_t device;
-
- AllocListNode *allocListHead; // double linked list of allocated buffers
- pthread_mutex_t lock;
-};
-
-//
-// Our framebuffer device structure
-//
-struct fb_device_t {
- framebuffer_device_t device;
-};
-
-static int map_buffer(cb_handle_t *cb, void **vaddr)
-{
- if (cb->fd < 0 || cb->ashmemSize <= 0) {
- return -EINVAL;
- }
-
- void *addr = mmap(0, cb->ashmemSize, PROT_READ | PROT_WRITE,
- MAP_SHARED, cb->fd, 0);
- if (addr == MAP_FAILED) {
- return -errno;
- }
-
- cb->ashmemBase = intptr_t(addr);
- cb->ashmemBasePid = getpid();
-
- *vaddr = addr;
- return 0;
-}
-
-#define DEFINE_HOST_CONNECTION \
- HostConnection *hostCon = HostConnection::get(); \
- renderControl_encoder_context_t *rcEnc = (hostCon ? hostCon->rcEncoder() : NULL)
-
-#define DEFINE_AND_VALIDATE_HOST_CONNECTION \
- HostConnection *hostCon = HostConnection::get(); \
- if (!hostCon) { \
- ALOGE("gralloc: Failed to get host connection\n"); \
- return -EIO; \
- } \
- renderControl_encoder_context_t *rcEnc = hostCon->rcEncoder(); \
- if (!rcEnc) { \
- ALOGE("gralloc: Failed to get renderControl encoder context\n"); \
- return -EIO; \
- }
-
-
-//
-// gralloc device functions (alloc interface)
-//
-static int gralloc_alloc(alloc_device_t* dev,
- int w, int h, int format, int usage,
- buffer_handle_t* pHandle, int* pStride)
-{
- D("gralloc_alloc w=%d h=%d usage=0x%x\n", w, h, usage);
-
- gralloc_device_t *grdev = (gralloc_device_t *)dev;
- if (!grdev || !pHandle || !pStride) {
- ALOGE("gralloc_alloc: Bad inputs (grdev: %p, pHandle: %p, pStride: %p",
- grdev, pHandle, pStride);
- return -EINVAL;
- }
-
- //
- // Validate usage: buffer cannot be written both by s/w and h/w access.
- //
- bool sw_write = (0 != (usage & GRALLOC_USAGE_SW_WRITE_MASK));
- bool hw_write = (usage & GRALLOC_USAGE_HW_RENDER);
- if (hw_write && sw_write) {
- ALOGE("gralloc_alloc: Mismatched usage flags: %d x %d, usage %x",
- w, h, usage);
- return -EINVAL;
- }
- bool sw_read = (0 != (usage & GRALLOC_USAGE_SW_READ_MASK));
- bool hw_cam_write = usage & GRALLOC_USAGE_HW_CAMERA_WRITE;
- bool hw_cam_read = usage & GRALLOC_USAGE_HW_CAMERA_READ;
- bool hw_vid_enc_read = usage & GRALLOC_USAGE_HW_VIDEO_ENCODER;
-
- // Pick the right concrete pixel format given the endpoints as encoded in
- // the usage bits. Every end-point pair needs explicit listing here.
- if (format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) {
- // Camera as producer
- if (usage & GRALLOC_USAGE_HW_CAMERA_WRITE) {
- if (usage & GRALLOC_USAGE_HW_TEXTURE) {
- // Camera-to-display is RGBA
- format = HAL_PIXEL_FORMAT_RGBA_8888;
- } else if (usage & GRALLOC_USAGE_HW_VIDEO_ENCODER) {
- // Camera-to-encoder is NV21
- format = HAL_PIXEL_FORMAT_YCrCb_420_SP;
- } else if ((usage & GRALLOC_USAGE_HW_CAMERA_MASK) ==
- GRALLOC_USAGE_HW_CAMERA_ZSL) {
- // Camera-to-ZSL-queue is RGB_888
- format = HAL_PIXEL_FORMAT_RGB_888;
- }
- }
-
- if (format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) {
- ALOGE("gralloc_alloc: Requested auto format selection, "
- "but no known format for this usage: %d x %d, usage %x",
- w, h, usage);
- return -EINVAL;
- }
- }
-
- bool yuv_format = false;
-
- int ashmem_size = 0;
- int stride = w;
-
- GLenum glFormat = 0;
- GLenum glType = 0;
-
- int bpp = 0;
- int align = 1;
- switch (format) {
- case HAL_PIXEL_FORMAT_RGBA_8888:
- case HAL_PIXEL_FORMAT_RGBX_8888:
- case HAL_PIXEL_FORMAT_BGRA_8888:
- bpp = 4;
- glFormat = GL_RGBA;
- glType = GL_UNSIGNED_BYTE;
- break;
- case HAL_PIXEL_FORMAT_RGB_888:
- bpp = 3;
- glFormat = GL_RGB;
- glType = GL_UNSIGNED_BYTE;
- break;
- case HAL_PIXEL_FORMAT_RGB_565:
- bpp = 2;
- glFormat = GL_RGB;
- glType = GL_UNSIGNED_SHORT_5_6_5;
- break;
- case HAL_PIXEL_FORMAT_RGBA_5551:
- bpp = 2;
- glFormat = GL_RGB5_A1_OES;
- glType = GL_UNSIGNED_SHORT_5_5_5_1;
- break;
- case HAL_PIXEL_FORMAT_RGBA_4444:
- bpp = 2;
- glFormat = GL_RGBA4_OES;
- glType = GL_UNSIGNED_SHORT_4_4_4_4;
- break;
- case HAL_PIXEL_FORMAT_RAW_SENSOR:
- bpp = 2;
- align = 16*bpp;
- if (! ((sw_read || hw_cam_read) && (sw_write || hw_cam_write) ) ) {
- // Raw sensor data only goes between camera and CPU
- return -EINVAL;
- }
- // Not expecting to actually create any GL surfaces for this
- glFormat = GL_LUMINANCE;
- glType = GL_UNSIGNED_SHORT;
- break;
- case HAL_PIXEL_FORMAT_BLOB:
- bpp = 1;
- if (! (sw_read && hw_cam_write) ) {
- // Blob data cannot be used by HW other than camera emulator
- return -EINVAL;
- }
- // Not expecting to actually create any GL surfaces for this
- glFormat = GL_LUMINANCE;
- glType = GL_UNSIGNED_BYTE;
- break;
- case HAL_PIXEL_FORMAT_YCrCb_420_SP:
- align = 1;
- bpp = 1; // per-channel bpp
- yuv_format = true;
- // Not expecting to actually create any GL surfaces for this
- break;
- case HAL_PIXEL_FORMAT_YV12:
- align = 16;
- bpp = 1; // per-channel bpp
- yuv_format = true;
- // Not expecting to actually create any GL surfaces for this
- break;
- default:
- ALOGE("gralloc_alloc: Unknown format %d", format);
- return -EINVAL;
- }
-
- if (usage & GRALLOC_USAGE_HW_FB) {
- // keep space for postCounter
- ashmem_size += sizeof(uint32_t);
- }
-
- if (sw_read || sw_write || hw_cam_write || hw_vid_enc_read) {
- // keep space for image on guest memory if SW access is needed
- // or if the camera is doing writing
- if (yuv_format) {
- size_t yStride = (w*bpp + (align - 1)) & ~(align-1);
- size_t uvStride = (yStride / 2 + (align - 1)) & ~(align-1);
- size_t uvHeight = h / 2;
- ashmem_size += yStride * h + 2 * (uvHeight * uvStride);
- stride = yStride / bpp;
- } else {
- size_t bpr = (w*bpp + (align-1)) & ~(align-1);
- ashmem_size += (bpr * h);
- stride = bpr / bpp;
- }
- }
-
- D("gralloc_alloc format=%d, ashmem_size=%d, stride=%d, tid %d\n", format,
- ashmem_size, stride, gettid());
-
- //
- // Allocate space in ashmem if needed
- //
- int fd = -1;
- if (ashmem_size > 0) {
- // round to page size;
- ashmem_size = (ashmem_size + (PAGE_SIZE-1)) & ~(PAGE_SIZE-1);
-
- fd = ashmem_create_region("gralloc-buffer", ashmem_size);
- if (fd < 0) {
- ALOGE("gralloc_alloc failed to create ashmem region: %s\n",
- strerror(errno));
- return -errno;
- }
- }
-
- cb_handle_t *cb = new cb_handle_t(fd, ashmem_size, usage,
- w, h, format, glFormat, glType);
-
- if (ashmem_size > 0) {
- //
- // map ashmem region if exist
- //
- void *vaddr;
- int err = map_buffer(cb, &vaddr);
- if (err) {
- close(fd);
- delete cb;
- return err;
- }
-
- cb->setFd(fd);
- }
-
- //
- // Allocate ColorBuffer handle on the host (only if h/w access is allowed)
- // Only do this for some h/w usages, not all.
- //
- if (usage & (GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_RENDER |
- GRALLOC_USAGE_HW_2D | GRALLOC_USAGE_HW_COMPOSER |
- GRALLOC_USAGE_HW_FB) ) {
- DEFINE_HOST_CONNECTION;
- if (hostCon && rcEnc) {
- cb->hostHandle = rcEnc->rcCreateColorBuffer(rcEnc, w, h, glFormat);
- D("Created host ColorBuffer 0x%x\n", cb->hostHandle);
- }
-
- if (!cb->hostHandle) {
- // Could not create colorbuffer on host !!!
- close(fd);
- delete cb;
- return -EIO;
- }
- }
-
- //
- // alloc succeeded - insert the allocated handle to the allocated list
- //
- AllocListNode *node = new AllocListNode();
- pthread_mutex_lock(&grdev->lock);
- node->handle = cb;
- node->next = grdev->allocListHead;
- node->prev = NULL;
- if (grdev->allocListHead) {
- grdev->allocListHead->prev = node;
- }
- grdev->allocListHead = node;
- pthread_mutex_unlock(&grdev->lock);
-
- *pHandle = cb;
- *pStride = stride;
- return 0;
-}
-
-static int gralloc_free(alloc_device_t* dev,
- buffer_handle_t handle)
-{
- const cb_handle_t *cb = (const cb_handle_t *)handle;
- if (!cb_handle_t::validate((cb_handle_t*)cb)) {
- ERR("gralloc_free: invalid handle");
- return -EINVAL;
- }
-
- if (cb->hostHandle != 0) {
- DEFINE_AND_VALIDATE_HOST_CONNECTION;
- D("Closing host ColorBuffer 0x%x\n", cb->hostHandle);
- rcEnc->rcCloseColorBuffer(rcEnc, cb->hostHandle);
- }
-
- //
- // detach and unmap ashmem area if present
- //
- if (cb->fd > 0) {
- if (cb->ashmemSize > 0 && cb->ashmemBase) {
- munmap((void *)cb->ashmemBase, cb->ashmemSize);
- }
- close(cb->fd);
- }
-
- // remove it from the allocated list
- gralloc_device_t *grdev = (gralloc_device_t *)dev;
- pthread_mutex_lock(&grdev->lock);
- AllocListNode *n = grdev->allocListHead;
- while( n && n->handle != cb ) {
- n = n->next;
- }
- if (n) {
- // buffer found on list - remove it from list
- if (n->next) {
- n->next->prev = n->prev;
- }
- if (n->prev) {
- n->prev->next = n->next;
- }
- else {
- grdev->allocListHead = n->next;
- }
-
- delete n;
- }
- pthread_mutex_unlock(&grdev->lock);
-
- delete cb;
-
- return 0;
-}
-
-static int gralloc_device_close(struct hw_device_t *dev)
-{
- gralloc_device_t* d = reinterpret_cast<gralloc_device_t*>(dev);
- if (d) {
-
- // free still allocated buffers
- while( d->allocListHead != NULL ) {
- gralloc_free(&d->device, d->allocListHead->handle);
- }
-
- // free device
- free(d);
- }
- return 0;
-}
-
-static int fb_compositionComplete(struct framebuffer_device_t* dev)
-{
- return 0;
-}
-
-//
-// Framebuffer device functions
-//
-static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer)
-{
- fb_device_t *fbdev = (fb_device_t *)dev;
- cb_handle_t *cb = (cb_handle_t *)buffer;
-
- if (!fbdev || !cb_handle_t::validate(cb) || !cb->canBePosted()) {
- return -EINVAL;
- }
-
- // Make sure we have host connection
- DEFINE_AND_VALIDATE_HOST_CONNECTION;
-
- // increment the post count of the buffer
- uint32_t *postCountPtr = (uint32_t *)cb->ashmemBase;
- if (!postCountPtr) {
- // This should not happen
- return -EINVAL;
- }
- (*postCountPtr)++;
-
- // send post request to host
- rcEnc->rcFBPost(rcEnc, cb->hostHandle);
- hostCon->flush();
-
- return 0;
-}
-
-static int fb_setUpdateRect(struct framebuffer_device_t* dev,
- int l, int t, int w, int h)
-{
- fb_device_t *fbdev = (fb_device_t *)dev;
-
- if (!fbdev) {
- return -EINVAL;
- }
-
- // Make sure we have host connection
- DEFINE_AND_VALIDATE_HOST_CONNECTION;
-
- // send request to host
- // TODO: XXX - should be implemented
- //rcEnc->rc_XXX
-
- return 0;
-}
-
-static int fb_setSwapInterval(struct framebuffer_device_t* dev,
- int interval)
-{
- fb_device_t *fbdev = (fb_device_t *)dev;
-
- if (!fbdev) {
- return -EINVAL;
- }
-
- // Make sure we have host connection
- DEFINE_AND_VALIDATE_HOST_CONNECTION;
-
- // send request to host
- rcEnc->rcFBSetSwapInterval(rcEnc, interval);
- hostCon->flush();
-
- return 0;
-}
-
-static int fb_close(struct hw_device_t *dev)
-{
- fb_device_t *fbdev = (fb_device_t *)dev;
-
- delete fbdev;
-
- return 0;
-}
-
-
-//
-// gralloc module functions - refcount + locking interface
-//
-static int gralloc_register_buffer(gralloc_module_t const* module,
- buffer_handle_t handle)
-{
- pthread_once(&sFallbackOnce, fallback_init);
- if (sFallback != NULL) {
- return sFallback->registerBuffer(sFallback, handle);
- }
-
- D("gralloc_register_buffer(%p) called", handle);
-
- private_module_t *gr = (private_module_t *)module;
- cb_handle_t *cb = (cb_handle_t *)handle;
- if (!gr || !cb_handle_t::validate(cb)) {
- ERR("gralloc_register_buffer(%p): invalid buffer", cb);
- return -EINVAL;
- }
-
- if (cb->hostHandle != 0) {
- DEFINE_AND_VALIDATE_HOST_CONNECTION;
- D("Opening host ColorBuffer 0x%x\n", cb->hostHandle);
- rcEnc->rcOpenColorBuffer(rcEnc, cb->hostHandle);
- }
-
- //
- // if the color buffer has ashmem region and it is not mapped in this
- // process map it now.
- //
- if (cb->ashmemSize > 0 && cb->mappedPid != getpid()) {
- void *vaddr;
- int err = map_buffer(cb, &vaddr);
- if (err) {
- ERR("gralloc_register_buffer(%p): map failed: %s", cb, strerror(-err));
- return -err;
- }
- cb->mappedPid = getpid();
- }
-
- return 0;
-}
-
-static int gralloc_unregister_buffer(gralloc_module_t const* module,
- buffer_handle_t handle)
-{
- if (sFallback != NULL) {
- return sFallback->unregisterBuffer(sFallback, handle);
- }
-
- private_module_t *gr = (private_module_t *)module;
- cb_handle_t *cb = (cb_handle_t *)handle;
- if (!gr || !cb_handle_t::validate(cb)) {
- ERR("gralloc_unregister_buffer(%p): invalid buffer", cb);
- return -EINVAL;
- }
-
- if (cb->hostHandle != 0) {
- DEFINE_AND_VALIDATE_HOST_CONNECTION;
- D("Closing host ColorBuffer 0x%x\n", cb->hostHandle);
- rcEnc->rcCloseColorBuffer(rcEnc, cb->hostHandle);
- }
-
- //
- // unmap ashmem region if it was previously mapped in this process
- // (through register_buffer)
- //
- if (cb->ashmemSize > 0 && cb->mappedPid == getpid()) {
- void *vaddr;
- int err = munmap((void *)cb->ashmemBase, cb->ashmemSize);
- if (err) {
- ERR("gralloc_unregister_buffer(%p): unmap failed", cb);
- return -EINVAL;
- }
- cb->ashmemBase = NULL;
- cb->mappedPid = 0;
- }
-
- D("gralloc_unregister_buffer(%p) done\n", cb);
-
- return 0;
-}
-
-static int gralloc_lock(gralloc_module_t const* module,
- buffer_handle_t handle, int usage,
- int l, int t, int w, int h,
- void** vaddr)
-{
- if (sFallback != NULL) {
- return sFallback->lock(sFallback, handle, usage, l, t, w, h, vaddr);
- }
-
- private_module_t *gr = (private_module_t *)module;
- cb_handle_t *cb = (cb_handle_t *)handle;
- if (!gr || !cb_handle_t::validate(cb)) {
- ALOGE("gralloc_lock bad handle\n");
- return -EINVAL;
- }
-
- // Validate usage,
- // 1. cannot be locked for hw access
- // 2. lock for either sw read or write.
- // 3. locked sw access must match usage during alloc time.
- bool sw_read = (0 != (usage & GRALLOC_USAGE_SW_READ_MASK));
- bool sw_write = (0 != (usage & GRALLOC_USAGE_SW_WRITE_MASK));
- bool hw_read = (usage & GRALLOC_USAGE_HW_TEXTURE);
- bool hw_write = (usage & GRALLOC_USAGE_HW_RENDER);
- bool hw_vid_enc_read = (usage & GRALLOC_USAGE_HW_VIDEO_ENCODER);
- bool hw_cam_write = (usage & GRALLOC_USAGE_HW_CAMERA_WRITE);
- bool hw_cam_read = (usage & GRALLOC_USAGE_HW_CAMERA_READ);
- bool sw_read_allowed = (0 != (cb->usage & GRALLOC_USAGE_SW_READ_MASK));
- bool sw_write_allowed = (0 != (cb->usage & GRALLOC_USAGE_SW_WRITE_MASK));
-
- if ( (hw_read || hw_write) ||
- (!sw_read && !sw_write &&
- !hw_cam_write && !hw_cam_read &&
- !hw_vid_enc_read) ||
- (sw_read && !sw_read_allowed) ||
- (sw_write && !sw_write_allowed) ) {
- ALOGE("gralloc_lock usage mismatch usage=0x%x cb->usage=0x%x\n", usage,
- cb->usage);
- return -EINVAL;
- }
-
- EGLint postCount = 0;
- void *cpu_addr = NULL;
-
- //
- // make sure ashmem area is mapped if needed
- //
- if (cb->canBePosted() || sw_read || sw_write ||
- hw_cam_write || hw_cam_read ||
- hw_vid_enc_read) {
- if (cb->ashmemBasePid != getpid() || !cb->ashmemBase) {
- return -EACCES;
- }
-
- if (cb->canBePosted()) {
- postCount = *((int *)cb->ashmemBase);
- cpu_addr = (void *)(cb->ashmemBase + sizeof(int));
- }
- else {
- cpu_addr = (void *)(cb->ashmemBase);
- }
- }
-
- if (cb->hostHandle) {
- // Make sure we have host connection
- DEFINE_AND_VALIDATE_HOST_CONNECTION;
-
- //
- // flush color buffer write cache on host and get its sync status.
- //
- int hostSyncStatus = rcEnc->rcColorBufferCacheFlush(rcEnc, cb->hostHandle,
- postCount,
- sw_read);
- if (hostSyncStatus < 0) {
- // host failed the color buffer sync - probably since it was already
- // locked for write access. fail the lock.
- ALOGE("gralloc_lock cacheFlush failed postCount=%d sw_read=%d\n",
- postCount, sw_read);
- return -EBUSY;
- }
-
- }
-
- //
- // is virtual address required ?
- //
- if (sw_read || sw_write || hw_cam_write || hw_cam_read || hw_vid_enc_read) {
- *vaddr = cpu_addr;
- }
-
- if (sw_write || hw_cam_write) {
- //
- // Keep locked region if locked for s/w write access.
- //
- cb->lockedLeft = l;
- cb->lockedTop = t;
- cb->lockedWidth = w;
- cb->lockedHeight = h;
- }
-
- DD("gralloc_lock success. vaddr: %p, *vaddr: %p, usage: %x, cpu_addr: %p",
- vaddr, vaddr ? *vaddr : 0, usage, cpu_addr);
-
- return 0;
-}
-
-static int gralloc_unlock(gralloc_module_t const* module,
- buffer_handle_t handle)
-{
- if (sFallback != NULL) {
- return sFallback->unlock(sFallback, handle);
- }
-
- private_module_t *gr = (private_module_t *)module;
- cb_handle_t *cb = (cb_handle_t *)handle;
- if (!gr || !cb_handle_t::validate(cb)) {
- return -EINVAL;
- }
-
- //
- // if buffer was locked for s/w write, we need to update the host with
- // the updated data
- //
- if (cb->lockedWidth > 0 && cb->lockedHeight > 0 && cb->hostHandle) {
-
- // Make sure we have host connection
- DEFINE_AND_VALIDATE_HOST_CONNECTION;
-
- void *cpu_addr;
- if (cb->canBePosted()) {
- cpu_addr = (void *)(cb->ashmemBase + sizeof(int));
- }
- else {
- cpu_addr = (void *)(cb->ashmemBase);
- }
-
- if (cb->lockedWidth < cb->width || cb->lockedHeight < cb->height) {
- int bpp = glUtilsPixelBitSize(cb->glFormat, cb->glType) >> 3;
- char *tmpBuf = new char[cb->lockedWidth * cb->lockedHeight * bpp];
-
- int dst_line_len = cb->lockedWidth * bpp;
- int src_line_len = cb->width * bpp;
- char *src = (char *)cpu_addr + cb->lockedTop*src_line_len + cb->lockedLeft*bpp;
- char *dst = tmpBuf;
- for (int y=0; y<cb->lockedHeight; y++) {
- memcpy(dst, src, dst_line_len);
- src += src_line_len;
- dst += dst_line_len;
- }
-
- rcEnc->rcUpdateColorBuffer(rcEnc, cb->hostHandle,
- cb->lockedLeft, cb->lockedTop,
- cb->lockedWidth, cb->lockedHeight,
- cb->glFormat, cb->glType,
- tmpBuf);
-
- delete [] tmpBuf;
- }
- else {
- rcEnc->rcUpdateColorBuffer(rcEnc, cb->hostHandle, 0, 0,
- cb->width, cb->height,
- cb->glFormat, cb->glType,
- cpu_addr);
- }
- }
-
- cb->lockedWidth = cb->lockedHeight = 0;
- return 0;
-}
-
-
-static int gralloc_device_open(const hw_module_t* module,
- const char* name,
- hw_device_t** device)
-{
- int status = -EINVAL;
-
- D("gralloc_device_open %s\n", name);
-
- pthread_once( &sFallbackOnce, fallback_init );
- if (sFallback != NULL) {
- return sFallback->common.methods->open(&sFallback->common, name, device);
- }
-
- if (!strcmp(name, GRALLOC_HARDWARE_GPU0)) {
-
- // Create host connection and keep it in the TLS.
- // return error if connection with host can not be established
- HostConnection *hostCon = HostConnection::get();
- if (!hostCon) {
- ALOGE("gralloc: failed to get host connection while opening %s\n", name);
- return -EIO;
- }
-
- //
- // Allocate memory for the gralloc device (alloc interface)
- //
- gralloc_device_t *dev;
- dev = (gralloc_device_t*)malloc(sizeof(gralloc_device_t));
- if (NULL == dev) {
- return -ENOMEM;
- }
-
- // Initialize our device structure
- //
- dev->device.common.tag = HARDWARE_DEVICE_TAG;
- dev->device.common.version = 0;
- dev->device.common.module = const_cast<hw_module_t*>(module);
- dev->device.common.close = gralloc_device_close;
-
- dev->device.alloc = gralloc_alloc;
- dev->device.free = gralloc_free;
- dev->allocListHead = NULL;
- pthread_mutex_init(&dev->lock, NULL);
-
- *device = &dev->device.common;
- status = 0;
- }
- else if (!strcmp(name, GRALLOC_HARDWARE_FB0)) {
-
- // return error if connection with host can not be established
- DEFINE_AND_VALIDATE_HOST_CONNECTION;
-
- //
- // Query the host for Framebuffer attributes
- //
- D("gralloc: query Frabuffer attribs\n");
- EGLint width = rcEnc->rcGetFBParam(rcEnc, FB_WIDTH);
- D("gralloc: width=%d\n", width);
- EGLint height = rcEnc->rcGetFBParam(rcEnc, FB_HEIGHT);
- D("gralloc: height=%d\n", height);
- EGLint xdpi = rcEnc->rcGetFBParam(rcEnc, FB_XDPI);
- D("gralloc: xdpi=%d\n", xdpi);
- EGLint ydpi = rcEnc->rcGetFBParam(rcEnc, FB_YDPI);
- D("gralloc: ydpi=%d\n", ydpi);
- EGLint fps = rcEnc->rcGetFBParam(rcEnc, FB_FPS);
- D("gralloc: fps=%d\n", fps);
- EGLint min_si = rcEnc->rcGetFBParam(rcEnc, FB_MIN_SWAP_INTERVAL);
- D("gralloc: min_swap=%d\n", min_si);
- EGLint max_si = rcEnc->rcGetFBParam(rcEnc, FB_MAX_SWAP_INTERVAL);
- D("gralloc: max_swap=%d\n", max_si);
-
- //
- // Allocate memory for the framebuffer device
- //
- fb_device_t *dev;
- dev = (fb_device_t*)malloc(sizeof(fb_device_t));
- if (NULL == dev) {
- return -ENOMEM;
- }
- memset(dev, 0, sizeof(fb_device_t));
-
- // Initialize our device structure
- //
- dev->device.common.tag = HARDWARE_DEVICE_TAG;
- dev->device.common.version = 0;
- dev->device.common.module = const_cast<hw_module_t*>(module);
- dev->device.common.close = fb_close;
- dev->device.setSwapInterval = fb_setSwapInterval;
- dev->device.post = fb_post;
- dev->device.setUpdateRect = 0; //fb_setUpdateRect;
- dev->device.compositionComplete = fb_compositionComplete; //XXX: this is a dummy
-
- const_cast<uint32_t&>(dev->device.flags) = 0;
- const_cast<uint32_t&>(dev->device.width) = width;
- const_cast<uint32_t&>(dev->device.height) = height;
- const_cast<int&>(dev->device.stride) = width;
- const_cast<int&>(dev->device.format) = HAL_PIXEL_FORMAT_RGBA_8888;
- const_cast<float&>(dev->device.xdpi) = xdpi;
- const_cast<float&>(dev->device.ydpi) = ydpi;
- const_cast<float&>(dev->device.fps) = fps;
- const_cast<int&>(dev->device.minSwapInterval) = min_si;
- const_cast<int&>(dev->device.maxSwapInterval) = max_si;
- *device = &dev->device.common;
-
- status = 0;
- }
-
- return status;
-}
-
-//
-// define the HMI symbol - our module interface
-//
-static struct hw_module_methods_t gralloc_module_methods = {
- open: gralloc_device_open
-};
-
-struct private_module_t HAL_MODULE_INFO_SYM = {
- base: {
- common: {
- tag: HARDWARE_MODULE_TAG,
- version_major: 1,
- version_minor: 0,
- id: GRALLOC_HARDWARE_MODULE_ID,
- name: "Graphics Memory Allocator Module",
- author: "The Android Open Source Project",
- methods: &gralloc_module_methods,
- dso: NULL,
- reserved: {0, }
- },
- registerBuffer: gralloc_register_buffer,
- unregisterBuffer: gralloc_unregister_buffer,
- lock: gralloc_lock,
- unlock: gralloc_unlock,
- perform: NULL,
- reserved_proc : {NULL, }
- }
-};
-
-/* This function is called once to detect whether the emulator supports
- * GPU emulation (this is done by looking at the qemu.gles kernel
- * parameter, which must be > 0 if this is the case).
- *
- * If not, then load gralloc.default instead as a fallback.
- */
-static void
-fallback_init(void)
-{
- char prop[PROPERTY_VALUE_MAX];
- void* module;
-
- property_get("ro.kernel.qemu.gles", prop, "0");
- if (atoi(prop) > 0) {
- return;
- }
- ALOGD("Emulator without GPU emulation detected.");
- module = dlopen("/system/lib/hw/gralloc.default.so", RTLD_LAZY|RTLD_LOCAL);
- if (module != NULL) {
- sFallback = reinterpret_cast<gralloc_module_t*>(dlsym(module, HAL_MODULE_INFO_SYM_AS_STR));
- if (sFallback == NULL) {
- dlclose(module);
- }
- }
- if (sFallback == NULL) {
- ALOGE("Could not find software fallback module!?");
- }
-}
diff --git a/tools/emulator/opengl/system/renderControl_enc/Android.mk b/tools/emulator/opengl/system/renderControl_enc/Android.mk
deleted file mode 100644
index 5792440f6..000000000
--- a/tools/emulator/opengl/system/renderControl_enc/Android.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-$(call emugl-begin-shared-library,lib_renderControl_enc)
-
-LOCAL_SRC_FILES := \
- renderControl_client_context.cpp \
- renderControl_enc.cpp \
- renderControl_entry.cpp
-
-$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-$(call emugl-import,libOpenglCodecCommon)
-$(call emugl-end-module)
diff --git a/tools/emulator/opengl/system/renderControl_enc/README b/tools/emulator/opengl/system/renderControl_enc/README
deleted file mode 100644
index 2ee1a5701..000000000
--- a/tools/emulator/opengl/system/renderControl_enc/README
+++ /dev/null
@@ -1,136 +0,0 @@
-The renderControl.in file in this directory defines an API which is decoded
-on the android guest into a stream and get decoded and executed on the host.
-It is used in order to query the host renderer as well as send the host renderer
-control commands.
-
-The following describes each of the entries defined by this renderControl API.
-
-
-GLint rcGetRendererVersion();
- This function queries the host renderer version number.
-
-EGLint rcGetEGLVersion(EGLint* major, EGLint* minor);
- This function queries the host renderer for the EGL version
- it supports. returns EGL_FALSE on failure.
-
-EGLint rcQueryEGLString(EGLenum name, void* buffer, EGLint bufferSize);
- This function queries the host for EGL string (.i.e EGL_EXTENSIONS).
- if buffer is NULL or the bufferSize is not big enough the return value
- is the negative number of bytes required to store the string value
- otherwise the string value is copied to buffer and its size is
- returned.
-
-EGLint rcGetNumConfigs(uint32_t* numAttribs);
- queries the host for the number of supported EGL configs.
- The function returns the number of supported configs and returns in
- numAttribs the number of attributes available for each config.
-
-EGLint rcGetConfigs(uint32_t bufSize, GLuint* buffer);
- This function queries the host for the all set of supported configs
- with their attribute values.
- bufSize is the size of buffer, the size should be at least equal to
- (numConfigs + 1) * numAttribs * sizeof(GLuint)
- where numConfigs and numAttribs are the values returned in
- rcGetNumConfigs. if bufSize is not big enough then the negative number
- of required bytes is returned otherwise the function returns the number
- of configs and buffer is filled as follows: The first 'numAttribs'
- integer values are filled with the EGL enumerant describing a config
- attribute, next for each config there are 'numAttribs' integer values
- holding the attribute values for that config, the values are specified
- in the same order as the attribute vector.
-
-EGLint rcChooseConfig(EGLint *attribs, uint32_t attribs_size, uint32_t *configs, uint32_t configs_size)
- This function triggers an eglChooseConfig on the host, to get a list of
- configs matching the given attribs values.
- attribs - a list of attribute names followed by the desired values, terminated by EGL_NONE
- attribs_size - the size of the list
- configs - the returned matching configuration names (same names as familiar to the client in rcGetConfigs)
- configs_size - the size of the configs buffers
- returns - the actual number of matching configurations (<= configs_size)
-
-EGLint rcGetFBParam(EGLint param);
- queries the host for framebuffer parameter, see renderControl_types.h
- for possible values of 'param'.
-
-uint32_t rcCreateContext(uint32_t config, uint32_t share, uint32_t glVersion);
- This function creates a rendering context on the host and returns its
- handle. config is the config index for the context, share is either zero
- or a handle to a sharing context. glVersion is either 1 or 2 for GLES1
- or GLES2 context respectively.
-
-
-void rcDestroyContext(uint32_t context);
- This function destroys a rendering context on the host.
- context is a handle returned in rcCreateContext.
-
-uint32_t rcCreateWindowSurface(uint32_t config, uint32_t width, uint32_t height);
- This function creates a 'window' surface on the host which can be then
- bind for rendering through rcMakeCurrent.
- The function returns a handle to the created window surface.
-
-void rcDestroyWindowSurface(uint32_t windowSurface);
- This function destoys a window surface.
-
-uint32_t rcCreateColorBuffer(uint32_t width, uint32_t height, GLenum internalFormat);
- This function creates a colorBuffer object on the host which can be then
- be specified as a render target for a window surface through
- rcSetWindowColorBuffer or to be displayed on the framebuffer window
- through rcFBPost.
- The function returns a handle to the colorBuffer object, with an initial
- reference count of 1.
-
-void rcOpenColorBuffer(uint32_t colorbuffer);
- Adds an additional reference to the colorbuffer, typically from a
- different Android process than the one which created it.
-
-void rcCloseColorBuffer(uint32_t colorbuffer);
- Removes a reference to the colorbuffer. When the reference count drops
- to zero the colorbuffer is automatically destroyed.
-
-void rcFlushWindowColorBuffer(uint32_t windowSurface, uint32_t colorBuffer);
- This flushes the current window color buffer
-
-void rcSetWindowColorBuffer(uint32_t windowSurface, uint32_t colorBuffer);
- This set the target color buffer for a windowSurface, when set the
- previous target colorBuffer gets updated before switching to the new
- colorBuffer.
-
-EGLint rcMakeCurrent(uint32_t context, uint32_t drawSurf, uint32_t readSurf);
- Binds a windowSurface(s) and current rendering context for the
- calling thread.
-
-void rcFBPost(uint32_t colorBuffer);
- This function causes the content of the colorBuffer object to be
- displayed on the host framebuffer window. The function returns
- immediatly, the buffer will be displayed at the next swap interval.
-
-void rcFBSetSwapInterval(EGLint interval);
- Sets the swap interval for the host framebuffer window.
-
-void rcBindTexture(uint32_t colorBuffer);
- This function instruct the host to bind the content of the specified
- colorBuffer to the current binded texture object of the calling thread.
- This function should be used to implement eglBindTexImage.
-
-EGLint rcColorBufferCacheFlush(uint32_t colorbuffer, EGLint postCount, int forRead);
- This function returns only after all rendering requests for the specified
- colorBuffer rendering target has been processed and after all 'postCount'
- posts for the buffer requested previously through rcFBPost has been
- processed.
- if 'forRead' is not-zero, the function returns positive value in case
- there was rendering done to the buffer since the last CacheFlush request
- with non-zero 'forRead' value, otherwise the function returns zero or
- negative value on failure.
-
-void rcReadColorBuffer(uint32_t colorbuffer, GLint x, GLint y,
- GLint width, GLint height, GLenum format,
- GLenum type, void* pixels);
- This function queries the host for the pixel content of a colorBuffer's
- subregion. It act the same as OpenGL glReadPixels however pixels
- are always packed with alignment of 1.
-
-void rcUpdateColorBuffer(uint32_t colorbuffer, GLint x, GLint y,
- GLint width, GLint height, GLenum format,
- GLenum type, void* pixels);
- Updates the content of a subregion of a colorBuffer object.
- pixels are always unpacked with alignment of 1.
diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl.attrib b/tools/emulator/opengl/system/renderControl_enc/renderControl.attrib
deleted file mode 100644
index 8b9972ff7..000000000
--- a/tools/emulator/opengl/system/renderControl_enc/renderControl.attrib
+++ /dev/null
@@ -1,41 +0,0 @@
-GLOBAL
- base_opcode 10000
- encoder_headers <stdint.h> <EGL/egl.h> "glUtils.h"
-
-rcGetEGLVersion
- dir major out
- len major sizeof(EGLint)
- dir minor out
- len minor sizeof(EGLint)
-
-rcQueryEGLString
- dir buffer out
- len buffer bufferSize
-
-rcGetGLString
- dir buffer out
- len buffer bufferSize
-
-rcGetNumConfigs
- dir numAttribs out
- len numAttribs sizeof(uint32_t)
-
-rcGetConfigs
- dir buffer out
- len buffer bufSize
-
-rcChooseConfig
- dir attribs in
- len attribs attribs_size
- dir configs out
- var_flag configs nullAllowed
- len configs configs_size*sizeof(uint32_t)
-
-rcReadColorBuffer
- dir pixels out
- len pixels (((glUtilsPixelBitSize(format, type) * width) >> 3) * height)
-
-rcUpdateColorBuffer
- dir pixels in
- len pixels (((glUtilsPixelBitSize(format, type) * width) >> 3) * height)
- var_flag pixels isLarge
diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl.in b/tools/emulator/opengl/system/renderControl_enc/renderControl.in
deleted file mode 100644
index 8281fd945..000000000
--- a/tools/emulator/opengl/system/renderControl_enc/renderControl.in
+++ /dev/null
@@ -1,25 +0,0 @@
-GL_ENRTY(GLint, rcGetRendererVersion)
-GL_ENTRY(EGLint, rcGetEGLVersion, EGLint *major, EGLint *minor)
-GL_ENTRY(EGLint, rcQueryEGLString, EGLenum name, void *buffer, EGLint bufferSize)
-GL_ENTRY(EGLint, rcGetGLString, EGLenum name, void *buffer, EGLint bufferSize)
-GL_ENTRY(EGLint, rcGetNumConfigs, uint32_t *numAttribs)
-GL_ENTRY(EGLint, rcGetConfigs, uint32_t bufSize, GLuint *buffer)
-GL_ENTRY(EGLint, rcChooseConfig, EGLint *attribs, uint32_t attribs_size, uint32_t *configs, uint32_t configs_size)
-GL_ENTRY(EGLint, rcGetFBParam, EGLint param)
-GL_ENTRY(uint32_t, rcCreateContext, uint32_t config, uint32_t share, uint32_t glVersion)
-GL_ENTRY(void, rcDestroyContext, uint32_t context)
-GL_ENTRY(uint32_t, rcCreateWindowSurface, uint32_t config, uint32_t width, uint32_t height)
-GL_ENTRY(void, rcDestroyWindowSurface, uint32_t windowSurface)
-GL_ENTRY(uint32_t, rcCreateColorBuffer, uint32_t width, uint32_t height, GLenum internalFormat)
-GL_ENTRY(void, rcOpenColorBuffer, uint32_t colorbuffer)
-GL_ENTRY(void, rcCloseColorBuffer, uint32_t colorbuffer)
-GL_ENTRY(void, rcSetWindowColorBuffer, uint32_t windowSurface, uint32_t colorBuffer)
-GL_ENTRY(int, rcFlushWindowColorBuffer, uint32_t windowSurface)
-GL_ENTRY(EGLint, rcMakeCurrent, uint32_t context, uint32_t drawSurf, uint32_t readSurf)
-GL_ENTRY(void, rcFBPost, uint32_t colorBuffer)
-GL_ENTRY(void, rcFBSetSwapInterval, EGLint interval)
-GL_ENTRY(void, rcBindTexture, uint32_t colorBuffer)
-GL_ENTRY(void, rcBindRenderbuffer, uint32_t colorBuffer)
-GL_ENTRY(EGLint, rcColorBufferCacheFlush, uint32_t colorbuffer, EGLint postCount,int forRead)
-GL_ENTRY(void, rcReadColorBuffer, uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void *pixels)
-GL_ENTRY(int, rcUpdateColorBuffer, uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void *pixels)
diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl.types b/tools/emulator/opengl/system/renderControl_enc/renderControl.types
deleted file mode 100644
index a7d96abf8..000000000
--- a/tools/emulator/opengl/system/renderControl_enc/renderControl.types
+++ /dev/null
@@ -1,11 +0,0 @@
-uint32_t 32 0x%08x false
-EGLint 32 0x%08x false
-GLint 32 0x%08x false
-GLuint 32 0x%08x false
-GLenum 32 0x%08x false
-EGLenum 32 0x%08x false
-uint32_t* 32 0x%08x true
-EGLint* 32 0x%08x true
-GLint* 32 0x%08x true
-GLuint* 32 0x%08x true
-void* 32 0x%08x true
diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl_client_context.cpp b/tools/emulator/opengl/system/renderControl_enc/renderControl_client_context.cpp
deleted file mode 100644
index 948824847..000000000
--- a/tools/emulator/opengl/system/renderControl_enc/renderControl_client_context.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-
-
-#include <string.h>
-#include "renderControl_client_context.h"
-
-
-#include <stdio.h>
-
-int renderControl_client_context_t::initDispatchByName(void *(*getProc)(const char *, void *userData), void *userData)
-{
- void *ptr;
-
- ptr = getProc("rcGetRendererVersion", userData); set_rcGetRendererVersion((rcGetRendererVersion_client_proc_t)ptr);
- ptr = getProc("rcGetEGLVersion", userData); set_rcGetEGLVersion((rcGetEGLVersion_client_proc_t)ptr);
- ptr = getProc("rcQueryEGLString", userData); set_rcQueryEGLString((rcQueryEGLString_client_proc_t)ptr);
- ptr = getProc("rcGetGLString", userData); set_rcGetGLString((rcGetGLString_client_proc_t)ptr);
- ptr = getProc("rcGetNumConfigs", userData); set_rcGetNumConfigs((rcGetNumConfigs_client_proc_t)ptr);
- ptr = getProc("rcGetConfigs", userData); set_rcGetConfigs((rcGetConfigs_client_proc_t)ptr);
- ptr = getProc("rcChooseConfig", userData); set_rcChooseConfig((rcChooseConfig_client_proc_t)ptr);
- ptr = getProc("rcGetFBParam", userData); set_rcGetFBParam((rcGetFBParam_client_proc_t)ptr);
- ptr = getProc("rcCreateContext", userData); set_rcCreateContext((rcCreateContext_client_proc_t)ptr);
- ptr = getProc("rcDestroyContext", userData); set_rcDestroyContext((rcDestroyContext_client_proc_t)ptr);
- ptr = getProc("rcCreateWindowSurface", userData); set_rcCreateWindowSurface((rcCreateWindowSurface_client_proc_t)ptr);
- ptr = getProc("rcDestroyWindowSurface", userData); set_rcDestroyWindowSurface((rcDestroyWindowSurface_client_proc_t)ptr);
- ptr = getProc("rcCreateColorBuffer", userData); set_rcCreateColorBuffer((rcCreateColorBuffer_client_proc_t)ptr);
- ptr = getProc("rcOpenColorBuffer", userData); set_rcOpenColorBuffer((rcOpenColorBuffer_client_proc_t)ptr);
- ptr = getProc("rcCloseColorBuffer", userData); set_rcCloseColorBuffer((rcCloseColorBuffer_client_proc_t)ptr);
- ptr = getProc("rcSetWindowColorBuffer", userData); set_rcSetWindowColorBuffer((rcSetWindowColorBuffer_client_proc_t)ptr);
- ptr = getProc("rcFlushWindowColorBuffer", userData); set_rcFlushWindowColorBuffer((rcFlushWindowColorBuffer_client_proc_t)ptr);
- ptr = getProc("rcMakeCurrent", userData); set_rcMakeCurrent((rcMakeCurrent_client_proc_t)ptr);
- ptr = getProc("rcFBPost", userData); set_rcFBPost((rcFBPost_client_proc_t)ptr);
- ptr = getProc("rcFBSetSwapInterval", userData); set_rcFBSetSwapInterval((rcFBSetSwapInterval_client_proc_t)ptr);
- ptr = getProc("rcBindTexture", userData); set_rcBindTexture((rcBindTexture_client_proc_t)ptr);
- ptr = getProc("rcBindRenderbuffer", userData); set_rcBindRenderbuffer((rcBindRenderbuffer_client_proc_t)ptr);
- ptr = getProc("rcColorBufferCacheFlush", userData); set_rcColorBufferCacheFlush((rcColorBufferCacheFlush_client_proc_t)ptr);
- ptr = getProc("rcReadColorBuffer", userData); set_rcReadColorBuffer((rcReadColorBuffer_client_proc_t)ptr);
- ptr = getProc("rcUpdateColorBuffer", userData); set_rcUpdateColorBuffer((rcUpdateColorBuffer_client_proc_t)ptr);
- return 0;
-}
-
diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl_client_context.h b/tools/emulator/opengl/system/renderControl_enc/renderControl_client_context.h
deleted file mode 100644
index ed2b1fbf4..000000000
--- a/tools/emulator/opengl/system/renderControl_enc/renderControl_client_context.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-#ifndef __renderControl_client_context_t_h
-#define __renderControl_client_context_t_h
-
-#include "renderControl_client_proc.h"
-
-
-struct renderControl_client_context_t {
-
- rcGetRendererVersion_client_proc_t rcGetRendererVersion;
- rcGetEGLVersion_client_proc_t rcGetEGLVersion;
- rcQueryEGLString_client_proc_t rcQueryEGLString;
- rcGetGLString_client_proc_t rcGetGLString;
- rcGetNumConfigs_client_proc_t rcGetNumConfigs;
- rcGetConfigs_client_proc_t rcGetConfigs;
- rcChooseConfig_client_proc_t rcChooseConfig;
- rcGetFBParam_client_proc_t rcGetFBParam;
- rcCreateContext_client_proc_t rcCreateContext;
- rcDestroyContext_client_proc_t rcDestroyContext;
- rcCreateWindowSurface_client_proc_t rcCreateWindowSurface;
- rcDestroyWindowSurface_client_proc_t rcDestroyWindowSurface;
- rcCreateColorBuffer_client_proc_t rcCreateColorBuffer;
- rcOpenColorBuffer_client_proc_t rcOpenColorBuffer;
- rcCloseColorBuffer_client_proc_t rcCloseColorBuffer;
- rcSetWindowColorBuffer_client_proc_t rcSetWindowColorBuffer;
- rcFlushWindowColorBuffer_client_proc_t rcFlushWindowColorBuffer;
- rcMakeCurrent_client_proc_t rcMakeCurrent;
- rcFBPost_client_proc_t rcFBPost;
- rcFBSetSwapInterval_client_proc_t rcFBSetSwapInterval;
- rcBindTexture_client_proc_t rcBindTexture;
- rcBindRenderbuffer_client_proc_t rcBindRenderbuffer;
- rcColorBufferCacheFlush_client_proc_t rcColorBufferCacheFlush;
- rcReadColorBuffer_client_proc_t rcReadColorBuffer;
- rcUpdateColorBuffer_client_proc_t rcUpdateColorBuffer;
- //Accessors
- virtual rcGetRendererVersion_client_proc_t set_rcGetRendererVersion(rcGetRendererVersion_client_proc_t f) { rcGetRendererVersion_client_proc_t retval = rcGetRendererVersion; rcGetRendererVersion = f; return retval;}
- virtual rcGetEGLVersion_client_proc_t set_rcGetEGLVersion(rcGetEGLVersion_client_proc_t f) { rcGetEGLVersion_client_proc_t retval = rcGetEGLVersion; rcGetEGLVersion = f; return retval;}
- virtual rcQueryEGLString_client_proc_t set_rcQueryEGLString(rcQueryEGLString_client_proc_t f) { rcQueryEGLString_client_proc_t retval = rcQueryEGLString; rcQueryEGLString = f; return retval;}
- virtual rcGetGLString_client_proc_t set_rcGetGLString(rcGetGLString_client_proc_t f) { rcGetGLString_client_proc_t retval = rcGetGLString; rcGetGLString = f; return retval;}
- virtual rcGetNumConfigs_client_proc_t set_rcGetNumConfigs(rcGetNumConfigs_client_proc_t f) { rcGetNumConfigs_client_proc_t retval = rcGetNumConfigs; rcGetNumConfigs = f; return retval;}
- virtual rcGetConfigs_client_proc_t set_rcGetConfigs(rcGetConfigs_client_proc_t f) { rcGetConfigs_client_proc_t retval = rcGetConfigs; rcGetConfigs = f; return retval;}
- virtual rcChooseConfig_client_proc_t set_rcChooseConfig(rcChooseConfig_client_proc_t f) { rcChooseConfig_client_proc_t retval = rcChooseConfig; rcChooseConfig = f; return retval;}
- virtual rcGetFBParam_client_proc_t set_rcGetFBParam(rcGetFBParam_client_proc_t f) { rcGetFBParam_client_proc_t retval = rcGetFBParam; rcGetFBParam = f; return retval;}
- virtual rcCreateContext_client_proc_t set_rcCreateContext(rcCreateContext_client_proc_t f) { rcCreateContext_client_proc_t retval = rcCreateContext; rcCreateContext = f; return retval;}
- virtual rcDestroyContext_client_proc_t set_rcDestroyContext(rcDestroyContext_client_proc_t f) { rcDestroyContext_client_proc_t retval = rcDestroyContext; rcDestroyContext = f; return retval;}
- virtual rcCreateWindowSurface_client_proc_t set_rcCreateWindowSurface(rcCreateWindowSurface_client_proc_t f) { rcCreateWindowSurface_client_proc_t retval = rcCreateWindowSurface; rcCreateWindowSurface = f; return retval;}
- virtual rcDestroyWindowSurface_client_proc_t set_rcDestroyWindowSurface(rcDestroyWindowSurface_client_proc_t f) { rcDestroyWindowSurface_client_proc_t retval = rcDestroyWindowSurface; rcDestroyWindowSurface = f; return retval;}
- virtual rcCreateColorBuffer_client_proc_t set_rcCreateColorBuffer(rcCreateColorBuffer_client_proc_t f) { rcCreateColorBuffer_client_proc_t retval = rcCreateColorBuffer; rcCreateColorBuffer = f; return retval;}
- virtual rcOpenColorBuffer_client_proc_t set_rcOpenColorBuffer(rcOpenColorBuffer_client_proc_t f) { rcOpenColorBuffer_client_proc_t retval = rcOpenColorBuffer; rcOpenColorBuffer = f; return retval;}
- virtual rcCloseColorBuffer_client_proc_t set_rcCloseColorBuffer(rcCloseColorBuffer_client_proc_t f) { rcCloseColorBuffer_client_proc_t retval = rcCloseColorBuffer; rcCloseColorBuffer = f; return retval;}
- virtual rcSetWindowColorBuffer_client_proc_t set_rcSetWindowColorBuffer(rcSetWindowColorBuffer_client_proc_t f) { rcSetWindowColorBuffer_client_proc_t retval = rcSetWindowColorBuffer; rcSetWindowColorBuffer = f; return retval;}
- virtual rcFlushWindowColorBuffer_client_proc_t set_rcFlushWindowColorBuffer(rcFlushWindowColorBuffer_client_proc_t f) { rcFlushWindowColorBuffer_client_proc_t retval = rcFlushWindowColorBuffer; rcFlushWindowColorBuffer = f; return retval;}
- virtual rcMakeCurrent_client_proc_t set_rcMakeCurrent(rcMakeCurrent_client_proc_t f) { rcMakeCurrent_client_proc_t retval = rcMakeCurrent; rcMakeCurrent = f; return retval;}
- virtual rcFBPost_client_proc_t set_rcFBPost(rcFBPost_client_proc_t f) { rcFBPost_client_proc_t retval = rcFBPost; rcFBPost = f; return retval;}
- virtual rcFBSetSwapInterval_client_proc_t set_rcFBSetSwapInterval(rcFBSetSwapInterval_client_proc_t f) { rcFBSetSwapInterval_client_proc_t retval = rcFBSetSwapInterval; rcFBSetSwapInterval = f; return retval;}
- virtual rcBindTexture_client_proc_t set_rcBindTexture(rcBindTexture_client_proc_t f) { rcBindTexture_client_proc_t retval = rcBindTexture; rcBindTexture = f; return retval;}
- virtual rcBindRenderbuffer_client_proc_t set_rcBindRenderbuffer(rcBindRenderbuffer_client_proc_t f) { rcBindRenderbuffer_client_proc_t retval = rcBindRenderbuffer; rcBindRenderbuffer = f; return retval;}
- virtual rcColorBufferCacheFlush_client_proc_t set_rcColorBufferCacheFlush(rcColorBufferCacheFlush_client_proc_t f) { rcColorBufferCacheFlush_client_proc_t retval = rcColorBufferCacheFlush; rcColorBufferCacheFlush = f; return retval;}
- virtual rcReadColorBuffer_client_proc_t set_rcReadColorBuffer(rcReadColorBuffer_client_proc_t f) { rcReadColorBuffer_client_proc_t retval = rcReadColorBuffer; rcReadColorBuffer = f; return retval;}
- virtual rcUpdateColorBuffer_client_proc_t set_rcUpdateColorBuffer(rcUpdateColorBuffer_client_proc_t f) { rcUpdateColorBuffer_client_proc_t retval = rcUpdateColorBuffer; rcUpdateColorBuffer = f; return retval;}
- virtual ~renderControl_client_context_t() {}
-
- typedef renderControl_client_context_t *CONTEXT_ACCESSOR_TYPE(void);
- static void setContextAccessor(CONTEXT_ACCESSOR_TYPE *f);
- int initDispatchByName( void *(*getProc)(const char *name, void *userData), void *userData);
- virtual void setError(unsigned int error){};
- virtual unsigned int getError(){ return 0; };
-};
-
-#endif
diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl_client_proc.h b/tools/emulator/opengl/system/renderControl_enc/renderControl_client_proc.h
deleted file mode 100644
index 3e00290b9..000000000
--- a/tools/emulator/opengl/system/renderControl_enc/renderControl_client_proc.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-#ifndef __renderControl_client_proc_t_h
-#define __renderControl_client_proc_t_h
-
-
-
-#include "renderControl_types.h"
-#ifndef renderControl_APIENTRY
-#define renderControl_APIENTRY
-#endif
-typedef GLint (renderControl_APIENTRY *rcGetRendererVersion_client_proc_t) (void * ctx);
-typedef EGLint (renderControl_APIENTRY *rcGetEGLVersion_client_proc_t) (void * ctx, EGLint*, EGLint*);
-typedef EGLint (renderControl_APIENTRY *rcQueryEGLString_client_proc_t) (void * ctx, EGLenum, void*, EGLint);
-typedef EGLint (renderControl_APIENTRY *rcGetGLString_client_proc_t) (void * ctx, EGLenum, void*, EGLint);
-typedef EGLint (renderControl_APIENTRY *rcGetNumConfigs_client_proc_t) (void * ctx, uint32_t*);
-typedef EGLint (renderControl_APIENTRY *rcGetConfigs_client_proc_t) (void * ctx, uint32_t, GLuint*);
-typedef EGLint (renderControl_APIENTRY *rcChooseConfig_client_proc_t) (void * ctx, EGLint*, uint32_t, uint32_t*, uint32_t);
-typedef EGLint (renderControl_APIENTRY *rcGetFBParam_client_proc_t) (void * ctx, EGLint);
-typedef uint32_t (renderControl_APIENTRY *rcCreateContext_client_proc_t) (void * ctx, uint32_t, uint32_t, uint32_t);
-typedef void (renderControl_APIENTRY *rcDestroyContext_client_proc_t) (void * ctx, uint32_t);
-typedef uint32_t (renderControl_APIENTRY *rcCreateWindowSurface_client_proc_t) (void * ctx, uint32_t, uint32_t, uint32_t);
-typedef void (renderControl_APIENTRY *rcDestroyWindowSurface_client_proc_t) (void * ctx, uint32_t);
-typedef uint32_t (renderControl_APIENTRY *rcCreateColorBuffer_client_proc_t) (void * ctx, uint32_t, uint32_t, GLenum);
-typedef void (renderControl_APIENTRY *rcOpenColorBuffer_client_proc_t) (void * ctx, uint32_t);
-typedef void (renderControl_APIENTRY *rcCloseColorBuffer_client_proc_t) (void * ctx, uint32_t);
-typedef void (renderControl_APIENTRY *rcSetWindowColorBuffer_client_proc_t) (void * ctx, uint32_t, uint32_t);
-typedef int (renderControl_APIENTRY *rcFlushWindowColorBuffer_client_proc_t) (void * ctx, uint32_t);
-typedef EGLint (renderControl_APIENTRY *rcMakeCurrent_client_proc_t) (void * ctx, uint32_t, uint32_t, uint32_t);
-typedef void (renderControl_APIENTRY *rcFBPost_client_proc_t) (void * ctx, uint32_t);
-typedef void (renderControl_APIENTRY *rcFBSetSwapInterval_client_proc_t) (void * ctx, EGLint);
-typedef void (renderControl_APIENTRY *rcBindTexture_client_proc_t) (void * ctx, uint32_t);
-typedef void (renderControl_APIENTRY *rcBindRenderbuffer_client_proc_t) (void * ctx, uint32_t);
-typedef EGLint (renderControl_APIENTRY *rcColorBufferCacheFlush_client_proc_t) (void * ctx, uint32_t, EGLint, int);
-typedef void (renderControl_APIENTRY *rcReadColorBuffer_client_proc_t) (void * ctx, uint32_t, GLint, GLint, GLint, GLint, GLenum, GLenum, void*);
-typedef int (renderControl_APIENTRY *rcUpdateColorBuffer_client_proc_t) (void * ctx, uint32_t, GLint, GLint, GLint, GLint, GLenum, GLenum, void*);
-
-
-#endif
diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl_enc.cpp b/tools/emulator/opengl/system/renderControl_enc/renderControl_enc.cpp
deleted file mode 100644
index 94e256ad3..000000000
--- a/tools/emulator/opengl/system/renderControl_enc/renderControl_enc.cpp
+++ /dev/null
@@ -1,536 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-
-
-#include <string.h>
-#include "renderControl_opcodes.h"
-
-#include "renderControl_enc.h"
-
-
-#include <stdio.h>
-static void enc_unsupported()
-{
- ALOGE("Function is unsupported\n");
-}
-
-GLint rcGetRendererVersion_enc(void *self )
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcGetRendererVersion;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
-
- GLint retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-EGLint rcGetEGLVersion_enc(void *self , EGLint* major, EGLint* minor)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_major = sizeof(EGLint);
- const unsigned int __size_minor = sizeof(EGLint);
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_major + __size_minor + 2*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcGetEGLVersion;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_major; ptr += 4;
- *(unsigned int *)(ptr) = __size_minor; ptr += 4;
- stream->readback(major, __size_major);
- stream->readback(minor, __size_minor);
-
- EGLint retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-EGLint rcQueryEGLString_enc(void *self , EGLenum name, void* buffer, EGLint bufferSize)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_buffer = bufferSize;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_buffer + 4 + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcQueryEGLString;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &name, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_buffer; ptr += 4;
- memcpy(ptr, &bufferSize, 4); ptr += 4;
- stream->readback(buffer, __size_buffer);
-
- EGLint retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-EGLint rcGetGLString_enc(void *self , EGLenum name, void* buffer, EGLint bufferSize)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_buffer = bufferSize;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_buffer + 4 + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcGetGLString;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &name, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_buffer; ptr += 4;
- memcpy(ptr, &bufferSize, 4); ptr += 4;
- stream->readback(buffer, __size_buffer);
-
- EGLint retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-EGLint rcGetNumConfigs_enc(void *self , uint32_t* numAttribs)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_numAttribs = sizeof(uint32_t);
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_numAttribs + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcGetNumConfigs;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_numAttribs; ptr += 4;
- stream->readback(numAttribs, __size_numAttribs);
-
- EGLint retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-EGLint rcGetConfigs_enc(void *self , uint32_t bufSize, GLuint* buffer)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_buffer = bufSize;
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + __size_buffer + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcGetConfigs;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &bufSize, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_buffer; ptr += 4;
- stream->readback(buffer, __size_buffer);
-
- EGLint retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-EGLint rcChooseConfig_enc(void *self , EGLint* attribs, uint32_t attribs_size, uint32_t* configs, uint32_t configs_size)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_attribs = attribs_size;
- const unsigned int __size_configs = ((configs != NULL) ? configs_size*sizeof(uint32_t) : 0);
- unsigned char *ptr;
- const size_t packetSize = 8 + __size_attribs + 4 + __size_configs + 4 + 2*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcChooseConfig;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- *(unsigned int *)(ptr) = __size_attribs; ptr += 4;
- memcpy(ptr, attribs, __size_attribs);ptr += __size_attribs;
- memcpy(ptr, &attribs_size, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_configs; ptr += 4;
- memcpy(ptr, &configs_size, 4); ptr += 4;
- if (configs != NULL) stream->readback(configs, __size_configs);
-
- EGLint retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-EGLint rcGetFBParam_enc(void *self , EGLint param)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcGetFBParam;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &param, 4); ptr += 4;
-
- EGLint retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-uint32_t rcCreateContext_enc(void *self , uint32_t config, uint32_t share, uint32_t glVersion)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcCreateContext;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &config, 4); ptr += 4;
- memcpy(ptr, &share, 4); ptr += 4;
- memcpy(ptr, &glVersion, 4); ptr += 4;
-
- uint32_t retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-void rcDestroyContext_enc(void *self , uint32_t context)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcDestroyContext;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &context, 4); ptr += 4;
-}
-
-uint32_t rcCreateWindowSurface_enc(void *self , uint32_t config, uint32_t width, uint32_t height)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcCreateWindowSurface;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &config, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
-
- uint32_t retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-void rcDestroyWindowSurface_enc(void *self , uint32_t windowSurface)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcDestroyWindowSurface;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &windowSurface, 4); ptr += 4;
-}
-
-uint32_t rcCreateColorBuffer_enc(void *self , uint32_t width, uint32_t height, GLenum internalFormat)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcCreateColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &internalFormat, 4); ptr += 4;
-
- uint32_t retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-void rcOpenColorBuffer_enc(void *self , uint32_t colorbuffer)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcOpenColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &colorbuffer, 4); ptr += 4;
-}
-
-void rcCloseColorBuffer_enc(void *self , uint32_t colorbuffer)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcCloseColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &colorbuffer, 4); ptr += 4;
-}
-
-void rcSetWindowColorBuffer_enc(void *self , uint32_t windowSurface, uint32_t colorBuffer)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcSetWindowColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &windowSurface, 4); ptr += 4;
- memcpy(ptr, &colorBuffer, 4); ptr += 4;
-}
-
-int rcFlushWindowColorBuffer_enc(void *self , uint32_t windowSurface)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcFlushWindowColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &windowSurface, 4); ptr += 4;
-
- int retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-EGLint rcMakeCurrent_enc(void *self , uint32_t context, uint32_t drawSurf, uint32_t readSurf)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcMakeCurrent;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &context, 4); ptr += 4;
- memcpy(ptr, &drawSurf, 4); ptr += 4;
- memcpy(ptr, &readSurf, 4); ptr += 4;
-
- EGLint retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-void rcFBPost_enc(void *self , uint32_t colorBuffer)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcFBPost;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &colorBuffer, 4); ptr += 4;
-}
-
-void rcFBSetSwapInterval_enc(void *self , EGLint interval)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcFBSetSwapInterval;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &interval, 4); ptr += 4;
-}
-
-void rcBindTexture_enc(void *self , uint32_t colorBuffer)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcBindTexture;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &colorBuffer, 4); ptr += 4;
-}
-
-void rcBindRenderbuffer_enc(void *self , uint32_t colorBuffer)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcBindRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &colorBuffer, 4); ptr += 4;
-}
-
-EGLint rcColorBufferCacheFlush_enc(void *self , uint32_t colorbuffer, EGLint postCount, int forRead)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcColorBufferCacheFlush;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &colorbuffer, 4); ptr += 4;
- memcpy(ptr, &postCount, 4); ptr += 4;
- memcpy(ptr, &forRead, 4); ptr += 4;
-
- EGLint retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-void rcReadColorBuffer_enc(void *self , uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_pixels = (((glUtilsPixelBitSize(format, type) * width) >> 3) * height);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
- ptr = stream->alloc(packetSize);
- int tmp = OP_rcReadColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &colorbuffer, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &format, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- *(unsigned int *)(ptr) = __size_pixels; ptr += 4;
- stream->readback(pixels, __size_pixels);
-}
-
-int rcUpdateColorBuffer_enc(void *self , uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
-
- const unsigned int __size_pixels = (((glUtilsPixelBitSize(format, type) * width) >> 3) * height);
- unsigned char *ptr;
- const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
- ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
- int tmp = OP_rcUpdateColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &packetSize, 4); ptr += 4;
-
- memcpy(ptr, &colorbuffer, 4); ptr += 4;
- memcpy(ptr, &x, 4); ptr += 4;
- memcpy(ptr, &y, 4); ptr += 4;
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &format, 4); ptr += 4;
- memcpy(ptr, &type, 4); ptr += 4;
- stream->flush();
- stream->writeFully(&__size_pixels,4);
- stream->writeFully(pixels, __size_pixels);
-
- int retval;
- stream->readback(&retval, 4);
- return retval;
-}
-
-renderControl_encoder_context_t::renderControl_encoder_context_t(IOStream *stream)
-{
- m_stream = stream;
-
- set_rcGetRendererVersion(rcGetRendererVersion_enc);
- set_rcGetEGLVersion(rcGetEGLVersion_enc);
- set_rcQueryEGLString(rcQueryEGLString_enc);
- set_rcGetGLString(rcGetGLString_enc);
- set_rcGetNumConfigs(rcGetNumConfigs_enc);
- set_rcGetConfigs(rcGetConfigs_enc);
- set_rcChooseConfig(rcChooseConfig_enc);
- set_rcGetFBParam(rcGetFBParam_enc);
- set_rcCreateContext(rcCreateContext_enc);
- set_rcDestroyContext(rcDestroyContext_enc);
- set_rcCreateWindowSurface(rcCreateWindowSurface_enc);
- set_rcDestroyWindowSurface(rcDestroyWindowSurface_enc);
- set_rcCreateColorBuffer(rcCreateColorBuffer_enc);
- set_rcOpenColorBuffer(rcOpenColorBuffer_enc);
- set_rcCloseColorBuffer(rcCloseColorBuffer_enc);
- set_rcSetWindowColorBuffer(rcSetWindowColorBuffer_enc);
- set_rcFlushWindowColorBuffer(rcFlushWindowColorBuffer_enc);
- set_rcMakeCurrent(rcMakeCurrent_enc);
- set_rcFBPost(rcFBPost_enc);
- set_rcFBSetSwapInterval(rcFBSetSwapInterval_enc);
- set_rcBindTexture(rcBindTexture_enc);
- set_rcBindRenderbuffer(rcBindRenderbuffer_enc);
- set_rcColorBufferCacheFlush(rcColorBufferCacheFlush_enc);
- set_rcReadColorBuffer(rcReadColorBuffer_enc);
- set_rcUpdateColorBuffer(rcUpdateColorBuffer_enc);
-}
-
diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl_enc.h b/tools/emulator/opengl/system/renderControl_enc/renderControl_enc.h
deleted file mode 100644
index 712eeb9d3..000000000
--- a/tools/emulator/opengl/system/renderControl_enc/renderControl_enc.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-
-#ifndef GUARD_renderControl_encoder_context_t
-#define GUARD_renderControl_encoder_context_t
-
-#include "IOStream.h"
-#include "renderControl_client_context.h"
-
-
-#include <stdint.h>
-#include <EGL/egl.h>
-#include "glUtils.h"
-
-struct renderControl_encoder_context_t : public renderControl_client_context_t {
-
- IOStream *m_stream;
-
- renderControl_encoder_context_t(IOStream *stream);
-
-
-};
-
-extern "C" {
- GLint rcGetRendererVersion_enc(void *self );
- EGLint rcGetEGLVersion_enc(void *self , EGLint* major, EGLint* minor);
- EGLint rcQueryEGLString_enc(void *self , EGLenum name, void* buffer, EGLint bufferSize);
- EGLint rcGetGLString_enc(void *self , EGLenum name, void* buffer, EGLint bufferSize);
- EGLint rcGetNumConfigs_enc(void *self , uint32_t* numAttribs);
- EGLint rcGetConfigs_enc(void *self , uint32_t bufSize, GLuint* buffer);
- EGLint rcChooseConfig_enc(void *self , EGLint* attribs, uint32_t attribs_size, uint32_t* configs, uint32_t configs_size);
- EGLint rcGetFBParam_enc(void *self , EGLint param);
- uint32_t rcCreateContext_enc(void *self , uint32_t config, uint32_t share, uint32_t glVersion);
- void rcDestroyContext_enc(void *self , uint32_t context);
- uint32_t rcCreateWindowSurface_enc(void *self , uint32_t config, uint32_t width, uint32_t height);
- void rcDestroyWindowSurface_enc(void *self , uint32_t windowSurface);
- uint32_t rcCreateColorBuffer_enc(void *self , uint32_t width, uint32_t height, GLenum internalFormat);
- void rcOpenColorBuffer_enc(void *self , uint32_t colorbuffer);
- void rcCloseColorBuffer_enc(void *self , uint32_t colorbuffer);
- void rcSetWindowColorBuffer_enc(void *self , uint32_t windowSurface, uint32_t colorBuffer);
- int rcFlushWindowColorBuffer_enc(void *self , uint32_t windowSurface);
- EGLint rcMakeCurrent_enc(void *self , uint32_t context, uint32_t drawSurf, uint32_t readSurf);
- void rcFBPost_enc(void *self , uint32_t colorBuffer);
- void rcFBSetSwapInterval_enc(void *self , EGLint interval);
- void rcBindTexture_enc(void *self , uint32_t colorBuffer);
- void rcBindRenderbuffer_enc(void *self , uint32_t colorBuffer);
- EGLint rcColorBufferCacheFlush_enc(void *self , uint32_t colorbuffer, EGLint postCount, int forRead);
- void rcReadColorBuffer_enc(void *self , uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels);
- int rcUpdateColorBuffer_enc(void *self , uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels);
-};
-#endif \ No newline at end of file
diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl_entry.cpp b/tools/emulator/opengl/system/renderControl_enc/renderControl_entry.cpp
deleted file mode 100644
index 9a0bba99c..000000000
--- a/tools/emulator/opengl/system/renderControl_enc/renderControl_entry.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-#include <stdio.h>
-#include <stdlib.h>
-#include "renderControl_client_context.h"
-
-#ifndef GL_TRUE
-extern "C" {
- GLint rcGetRendererVersion();
- EGLint rcGetEGLVersion(EGLint* major, EGLint* minor);
- EGLint rcQueryEGLString(EGLenum name, void* buffer, EGLint bufferSize);
- EGLint rcGetGLString(EGLenum name, void* buffer, EGLint bufferSize);
- EGLint rcGetNumConfigs(uint32_t* numAttribs);
- EGLint rcGetConfigs(uint32_t bufSize, GLuint* buffer);
- EGLint rcChooseConfig(EGLint* attribs, uint32_t attribs_size, uint32_t* configs, uint32_t configs_size);
- EGLint rcGetFBParam(EGLint param);
- uint32_t rcCreateContext(uint32_t config, uint32_t share, uint32_t glVersion);
- void rcDestroyContext(uint32_t context);
- uint32_t rcCreateWindowSurface(uint32_t config, uint32_t width, uint32_t height);
- void rcDestroyWindowSurface(uint32_t windowSurface);
- uint32_t rcCreateColorBuffer(uint32_t width, uint32_t height, GLenum internalFormat);
- void rcOpenColorBuffer(uint32_t colorbuffer);
- void rcCloseColorBuffer(uint32_t colorbuffer);
- void rcSetWindowColorBuffer(uint32_t windowSurface, uint32_t colorBuffer);
- int rcFlushWindowColorBuffer(uint32_t windowSurface);
- EGLint rcMakeCurrent(uint32_t context, uint32_t drawSurf, uint32_t readSurf);
- void rcFBPost(uint32_t colorBuffer);
- void rcFBSetSwapInterval(EGLint interval);
- void rcBindTexture(uint32_t colorBuffer);
- void rcBindRenderbuffer(uint32_t colorBuffer);
- EGLint rcColorBufferCacheFlush(uint32_t colorbuffer, EGLint postCount, int forRead);
- void rcReadColorBuffer(uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels);
- int rcUpdateColorBuffer(uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels);
-};
-
-#endif
-#ifndef GET_CONTEXT
-static renderControl_client_context_t::CONTEXT_ACCESSOR_TYPE *getCurrentContext = NULL;
-void renderControl_client_context_t::setContextAccessor(CONTEXT_ACCESSOR_TYPE *f) { getCurrentContext = f; }
-#define GET_CONTEXT renderControl_client_context_t * ctx = getCurrentContext()
-#endif
-
-GLint rcGetRendererVersion()
-{
- GET_CONTEXT;
- return ctx->rcGetRendererVersion(ctx);
-}
-
-EGLint rcGetEGLVersion(EGLint* major, EGLint* minor)
-{
- GET_CONTEXT;
- return ctx->rcGetEGLVersion(ctx, major, minor);
-}
-
-EGLint rcQueryEGLString(EGLenum name, void* buffer, EGLint bufferSize)
-{
- GET_CONTEXT;
- return ctx->rcQueryEGLString(ctx, name, buffer, bufferSize);
-}
-
-EGLint rcGetGLString(EGLenum name, void* buffer, EGLint bufferSize)
-{
- GET_CONTEXT;
- return ctx->rcGetGLString(ctx, name, buffer, bufferSize);
-}
-
-EGLint rcGetNumConfigs(uint32_t* numAttribs)
-{
- GET_CONTEXT;
- return ctx->rcGetNumConfigs(ctx, numAttribs);
-}
-
-EGLint rcGetConfigs(uint32_t bufSize, GLuint* buffer)
-{
- GET_CONTEXT;
- return ctx->rcGetConfigs(ctx, bufSize, buffer);
-}
-
-EGLint rcChooseConfig(EGLint* attribs, uint32_t attribs_size, uint32_t* configs, uint32_t configs_size)
-{
- GET_CONTEXT;
- return ctx->rcChooseConfig(ctx, attribs, attribs_size, configs, configs_size);
-}
-
-EGLint rcGetFBParam(EGLint param)
-{
- GET_CONTEXT;
- return ctx->rcGetFBParam(ctx, param);
-}
-
-uint32_t rcCreateContext(uint32_t config, uint32_t share, uint32_t glVersion)
-{
- GET_CONTEXT;
- return ctx->rcCreateContext(ctx, config, share, glVersion);
-}
-
-void rcDestroyContext(uint32_t context)
-{
- GET_CONTEXT;
- ctx->rcDestroyContext(ctx, context);
-}
-
-uint32_t rcCreateWindowSurface(uint32_t config, uint32_t width, uint32_t height)
-{
- GET_CONTEXT;
- return ctx->rcCreateWindowSurface(ctx, config, width, height);
-}
-
-void rcDestroyWindowSurface(uint32_t windowSurface)
-{
- GET_CONTEXT;
- ctx->rcDestroyWindowSurface(ctx, windowSurface);
-}
-
-uint32_t rcCreateColorBuffer(uint32_t width, uint32_t height, GLenum internalFormat)
-{
- GET_CONTEXT;
- return ctx->rcCreateColorBuffer(ctx, width, height, internalFormat);
-}
-
-void rcOpenColorBuffer(uint32_t colorbuffer)
-{
- GET_CONTEXT;
- ctx->rcOpenColorBuffer(ctx, colorbuffer);
-}
-
-void rcCloseColorBuffer(uint32_t colorbuffer)
-{
- GET_CONTEXT;
- ctx->rcCloseColorBuffer(ctx, colorbuffer);
-}
-
-void rcSetWindowColorBuffer(uint32_t windowSurface, uint32_t colorBuffer)
-{
- GET_CONTEXT;
- ctx->rcSetWindowColorBuffer(ctx, windowSurface, colorBuffer);
-}
-
-int rcFlushWindowColorBuffer(uint32_t windowSurface)
-{
- GET_CONTEXT;
- return ctx->rcFlushWindowColorBuffer(ctx, windowSurface);
-}
-
-EGLint rcMakeCurrent(uint32_t context, uint32_t drawSurf, uint32_t readSurf)
-{
- GET_CONTEXT;
- return ctx->rcMakeCurrent(ctx, context, drawSurf, readSurf);
-}
-
-void rcFBPost(uint32_t colorBuffer)
-{
- GET_CONTEXT;
- ctx->rcFBPost(ctx, colorBuffer);
-}
-
-void rcFBSetSwapInterval(EGLint interval)
-{
- GET_CONTEXT;
- ctx->rcFBSetSwapInterval(ctx, interval);
-}
-
-void rcBindTexture(uint32_t colorBuffer)
-{
- GET_CONTEXT;
- ctx->rcBindTexture(ctx, colorBuffer);
-}
-
-void rcBindRenderbuffer(uint32_t colorBuffer)
-{
- GET_CONTEXT;
- ctx->rcBindRenderbuffer(ctx, colorBuffer);
-}
-
-EGLint rcColorBufferCacheFlush(uint32_t colorbuffer, EGLint postCount, int forRead)
-{
- GET_CONTEXT;
- return ctx->rcColorBufferCacheFlush(ctx, colorbuffer, postCount, forRead);
-}
-
-void rcReadColorBuffer(uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels)
-{
- GET_CONTEXT;
- ctx->rcReadColorBuffer(ctx, colorbuffer, x, y, width, height, format, type, pixels);
-}
-
-int rcUpdateColorBuffer(uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels)
-{
- GET_CONTEXT;
- return ctx->rcUpdateColorBuffer(ctx, colorbuffer, x, y, width, height, format, type, pixels);
-}
-
diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl_ftable.h b/tools/emulator/opengl/system/renderControl_enc/renderControl_ftable.h
deleted file mode 100644
index 1e9e2f937..000000000
--- a/tools/emulator/opengl/system/renderControl_enc/renderControl_ftable.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-#ifndef __renderControl_client_ftable_t_h
-#define __renderControl_client_ftable_t_h
-
-
-static struct _renderControl_funcs_by_name {
- const char *name;
- void *proc;
-} renderControl_funcs_by_name[] = {
- {"rcGetRendererVersion", (void*)rcGetRendererVersion},
- {"rcGetEGLVersion", (void*)rcGetEGLVersion},
- {"rcQueryEGLString", (void*)rcQueryEGLString},
- {"rcGetGLString", (void*)rcGetGLString},
- {"rcGetNumConfigs", (void*)rcGetNumConfigs},
- {"rcGetConfigs", (void*)rcGetConfigs},
- {"rcChooseConfig", (void*)rcChooseConfig},
- {"rcGetFBParam", (void*)rcGetFBParam},
- {"rcCreateContext", (void*)rcCreateContext},
- {"rcDestroyContext", (void*)rcDestroyContext},
- {"rcCreateWindowSurface", (void*)rcCreateWindowSurface},
- {"rcDestroyWindowSurface", (void*)rcDestroyWindowSurface},
- {"rcCreateColorBuffer", (void*)rcCreateColorBuffer},
- {"rcOpenColorBuffer", (void*)rcOpenColorBuffer},
- {"rcCloseColorBuffer", (void*)rcCloseColorBuffer},
- {"rcSetWindowColorBuffer", (void*)rcSetWindowColorBuffer},
- {"rcFlushWindowColorBuffer", (void*)rcFlushWindowColorBuffer},
- {"rcMakeCurrent", (void*)rcMakeCurrent},
- {"rcFBPost", (void*)rcFBPost},
- {"rcFBSetSwapInterval", (void*)rcFBSetSwapInterval},
- {"rcBindTexture", (void*)rcBindTexture},
- {"rcBindRenderbuffer", (void*)rcBindRenderbuffer},
- {"rcColorBufferCacheFlush", (void*)rcColorBufferCacheFlush},
- {"rcReadColorBuffer", (void*)rcReadColorBuffer},
- {"rcUpdateColorBuffer", (void*)rcUpdateColorBuffer},
-};
-static int renderControl_num_funcs = sizeof(renderControl_funcs_by_name) / sizeof(struct _renderControl_funcs_by_name);
-
-
-#endif
diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl_opcodes.h b/tools/emulator/opengl/system/renderControl_enc/renderControl_opcodes.h
deleted file mode 100644
index b44f5d06a..000000000
--- a/tools/emulator/opengl/system/renderControl_enc/renderControl_opcodes.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Generated Code - DO NOT EDIT !!
-// generated by 'emugen'
-#ifndef __GUARD_renderControl_opcodes_h_
-#define __GUARD_renderControl_opcodes_h_
-
-#define OP_rcGetRendererVersion 10000
-#define OP_rcGetEGLVersion 10001
-#define OP_rcQueryEGLString 10002
-#define OP_rcGetGLString 10003
-#define OP_rcGetNumConfigs 10004
-#define OP_rcGetConfigs 10005
-#define OP_rcChooseConfig 10006
-#define OP_rcGetFBParam 10007
-#define OP_rcCreateContext 10008
-#define OP_rcDestroyContext 10009
-#define OP_rcCreateWindowSurface 10010
-#define OP_rcDestroyWindowSurface 10011
-#define OP_rcCreateColorBuffer 10012
-#define OP_rcOpenColorBuffer 10013
-#define OP_rcCloseColorBuffer 10014
-#define OP_rcSetWindowColorBuffer 10015
-#define OP_rcFlushWindowColorBuffer 10016
-#define OP_rcMakeCurrent 10017
-#define OP_rcFBPost 10018
-#define OP_rcFBSetSwapInterval 10019
-#define OP_rcBindTexture 10020
-#define OP_rcBindRenderbuffer 10021
-#define OP_rcColorBufferCacheFlush 10022
-#define OP_rcReadColorBuffer 10023
-#define OP_rcUpdateColorBuffer 10024
-#define OP_last 10025
-
-
-#endif
diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl_types.h b/tools/emulator/opengl/system/renderControl_enc/renderControl_types.h
deleted file mode 100644
index da215bb49..000000000
--- a/tools/emulator/opengl/system/renderControl_enc/renderControl_types.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-* Copyright 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.
-*/
-
-#include <stdint.h>
-#include <EGL/egl.h>
-#include "glUtils.h"
-
-// values for 'param' argument of rcGetFBParam
-#define FB_WIDTH 1
-#define FB_HEIGHT 2
-#define FB_XDPI 3
-#define FB_YDPI 4
-#define FB_FPS 5
-#define FB_MIN_SWAP_INTERVAL 6
-#define FB_MAX_SWAP_INTERVAL 7
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/Android.mk b/tools/emulator/opengl/tests/gles_android_wrapper/Android.mk
deleted file mode 100644
index 90617b4d9..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/Android.mk
+++ /dev/null
@@ -1,74 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-#### libGLESv1_CM_emul.so
-$(call emugl-begin-shared-library,libGLESv1_CM_emul)
-$(call emugl-import,libGLESv1_enc)
-$(call emugl-gen-wrapper,$(EMUGL_PATH)/system/GLESv1_enc,gl)
-$(call emugl-set-shared-library-subpath,egl)
-
-LOCAL_SRC_FILES += glesv1_emul_ifc.cpp
-
-$(call emugl-end-module)
-
-emulatorOpengl := $(LOCAL_PATH)/../..
-logTag := -DLOG_TAG=\"eglWrapper\"
-EMUGEN = $(BUILD_OUT_EXECUTABLES)/emugen
-## comment for no debug
-#debugFlags = -g -O0
-
-#### libGLESv2_CM_emul.so
-$(call emugl-begin-shared-library, libGLESv2_emul)
-$(call emugl-import,libGLESv2_enc)
-$(call emugl-gen-wrapper,$(EMUGL_PATH)/system/GLESv2_enc,gl2)
-LOCAL_SRC_FILES += glesv2_emul_ifc.cpp
-$(call emugl-set-shared-library-subpath,egl)
-$(call emugl-end-module)
-
-##### libEGL_emul.so ###########
-
-# THE FOLLOWING DOESN'T WORK YET
-#
-$(call emugl-begin-shared-library,libEGL_emul)
-$(call emugl-import,libut_rendercontrol_enc libGLESv1_CM_emul libGLESv2_emul libOpenglSystemCommon)
-
-$(call emugl-set-shared-library-subpath,egl)
-LOCAL_CFLAGS += $(logTag)
-
-LOCAL_SRC_FILES := \
- egl.cpp \
- egl_dispatch.cpp \
- ServerConnection.cpp \
- ThreadInfo.cpp
-
-$(call emugl-end-module)
-
-#### egl.cfg ####
-
-# Ensure that this file is only copied to emulator-specific builds.
-# Other builds are device-specific and will provide their own
-# version of this file to point to the appropriate HW EGL libraries.
-#
-ifneq (,$(filter full full_x86 full_mips sdk sdk_x86 sdk_mips cm_goldfish,$(TARGET_PRODUCT)))
-ifeq (,$(BUILD_EMULATOR_OPENGL_DRIVER))
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := egl.cfg
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-
-LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/egl
-LOCAL_MODULE_CLASS := ETC
-
-include $(BUILD_PREBUILT)
-endif # building 'real' driver BUILD_EMULATOR_OPENGL_DRIVER
-endif # TARGET_PRODUCT in 'full sdk full_x86 sdk_x86 full_mips sdk_mips'
-
-#### gles_emul.cfg ####
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := gles_emul.cfg
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-
-LOCAL_MODULE_PATH := $(TARGET_OUT)/etc
-LOCAL_MODULE_CLASS := ETC
-
-include $(BUILD_PREBUILT)
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/ApiInitializer.h b/tools/emulator/opengl/tests/gles_android_wrapper/ApiInitializer.h
deleted file mode 100644
index 793c73578..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/ApiInitializer.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-* Copyright 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.
-*/
-
-#ifndef _API_INITIALIZER_H_
-#define _API_INITIALIZER_H_
-#include <stdlib.h>
-#include <dlfcn.h>
-
-class ApiInitializer {
-public:
- ApiInitializer(void *dso) :
- m_dso(dso) {
- }
- static void *s_getProc(const char *name, void *userData) {
- ApiInitializer *self = (ApiInitializer *)userData;
- return self->getProc(name);
- }
-private:
- void *m_dso;
- void *getProc(const char *name) {
- void *symbol = NULL;
- if (m_dso) {
- symbol = dlsym(m_dso, name);
- }
- return symbol;
- }
-};
-
-#endif
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/CleanSpec.mk b/tools/emulator/opengl/tests/gles_android_wrapper/CleanSpec.mk
deleted file mode 100644
index f56383a35..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/CleanSpec.mk
+++ /dev/null
@@ -1,50 +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.
-#
-
-# If you don't need to do a full clean build but would like to touch
-# a file or delete some intermediate files, add a clean step to the end
-# of the list. These steps will only be run once, if they haven't been
-# run before.
-#
-# E.g.:
-# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
-# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
-#
-# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
-# files that are missing or have been moved.
-#
-# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
-# Use $(OUT_DIR) to refer to the "out" directory.
-#
-# If you need to re-do something that's already mentioned, just copy
-# the command and add it to the bottom of the list. E.g., if a change
-# that you made last week required touching a file and a change you
-# made today requires touching the same file, just copy the old
-# touch step and add it to the end of the list.
-#
-# ************************************************
-# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
-# ************************************************
-
-# For example:
-#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
-#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
-#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
-
-# ************************************************
-# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
-# ************************************************
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/SHARED_LIBRARIES/libGLES_emul_intermediates)
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/ServerConnection.cpp b/tools/emulator/opengl/tests/gles_android_wrapper/ServerConnection.cpp
deleted file mode 100644
index ff4e39001..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/ServerConnection.cpp
+++ /dev/null
@@ -1,125 +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.
-*/
-#include <stdio.h>
-#include <stdlib.h>
-#include "ServerConnection.h"
-#include "TcpStream.h"
-#include "QemuPipeStream.h"
-#include <cutils/log.h>
-#include "ThreadInfo.h"
-
-gl_client_context_t *ServerConnection::s_getGlContext()
-{
- EGLThreadInfo *ti = getEGLThreadInfo();
- if (ti->serverConn) {
- return ti->serverConn->m_glEnc;
- }
- return NULL;
-}
-
-gl2_client_context_t *ServerConnection::s_getGl2Context()
-{
- EGLThreadInfo *ti = getEGLThreadInfo();
- if (ti->serverConn) {
- return ti->serverConn->m_gl2Enc;
- }
- return NULL;
-}
-
-ServerConnection *ServerConnection::s_getServerConnection()
-{
- EGLThreadInfo *ti = getEGLThreadInfo();
- if (!ti->serverConn)
- {
- ti->serverConn = new ServerConnection();
- if (ti->serverConn->create() < 0) {
- delete ti->serverConn;
- ti->serverConn = NULL;
- }
- }
-
- return ti->serverConn;
-}
-
-
-ServerConnection::ServerConnection() :
- m_stream(NULL),
- m_glEnc(NULL),
- m_ut_enc(NULL)
-{
-}
-
-ServerConnection::~ServerConnection()
-{
- delete m_ut_enc;
- delete m_glEnc;
- delete m_stream;
-}
-
-
-
-int ServerConnection::create(size_t bufsize,
- const char *defaultServer)
-{
- /* XXX: Make configurable through system property */
- int useQemuPipe = 1;
-
- if (m_stream != NULL) delete(m_stream);
-
- if (useQemuPipe) {
- QemuPipeStream* pipeStream = new QemuPipeStream(bufsize);
-
- if (pipeStream->connect() < 0) {
- ALOGE("couldn't connect to host server\n");
- delete pipeStream;
- return -1;
- }
- m_stream = pipeStream;
- }
- else /* !useQemuPipe */
- {
- TcpStream* tcpStream = new TcpStream(bufsize);
-
- char *s = getenv(ENV_RGL_SERVER);
- char *hostname;
- if (s == NULL) {
- hostname = strdup(defaultServer);
- } else {
- hostname = strdup(s);
- }
-
- if (tcpStream->connect(hostname, CODEC_SERVER_PORT) < 0) {
- ALOGE("couldn't connect to %s\n", hostname);
- free(hostname);
- delete tcpStream;
- return -1;
- }
- LOGI("connecting to server %s\n", hostname);
- free(hostname);
-
- m_stream = tcpStream;
- }
-
- m_glEnc = new GLEncoder(m_stream);
- m_glEnc->setContextAccessor(s_getGlContext);
-
- m_gl2Enc = new GL2Encoder(m_stream);
- m_gl2Enc->setContextAccessor(s_getGl2Context);
-
- m_ut_enc = new ut_rendercontrol_encoder_context_t(m_stream);
- return 0;
-}
-
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/ServerConnection.h b/tools/emulator/opengl/tests/gles_android_wrapper/ServerConnection.h
deleted file mode 100644
index 84f40d84d..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/ServerConnection.h
+++ /dev/null
@@ -1,55 +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.
-*/
-#ifndef _SERVER_CONNECTION_H
-#define _SERVER_CONNECTION_H
-
-#include "GLEncoder.h"
-#include "GL2Encoder.h"
-#include "IOStream.h"
-#include "codec_defs.h"
-#include "ut_rendercontrol_enc.h"
-#include <pthread.h>
-
-#define ENV_RGL_SERVER "RGL_SERVER"
-#define RGL_DEFAULT_SERVER "10.0.2.2"
-
-class ServerConnection {
-public:
- ~ServerConnection();
- int create(size_t buf_size = 4 * 1024 * 1024, const char *defaultServer = RGL_DEFAULT_SERVER);
- static gl_client_context_t *s_getGlContext();
- static ServerConnection *s_getServerConnection();
- static gl2_client_context_t *s_getGl2Context();
- GLEncoder *glEncoder() { return m_glEnc; }
- GL2Encoder *gl2Encoder() { return m_gl2Enc; }
- ut_rendercontrol_encoder_context_t * utEnc() { return m_ut_enc; }
-
-private:
- ServerConnection();
-
-private:
- static pthread_key_t s_glKey;
- static pthread_key_t s_connectionKey;
- static void s_initKeys();
- IOStream *m_stream;
- GLEncoder *m_glEnc;
- GL2Encoder *m_gl2Enc;
- ut_rendercontrol_encoder_context_t *m_ut_enc;
-
-};
-
-
-#endif
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/ThreadInfo.cpp b/tools/emulator/opengl/tests/gles_android_wrapper/ThreadInfo.cpp
deleted file mode 100644
index 5bf6a7da6..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/ThreadInfo.cpp
+++ /dev/null
@@ -1,39 +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.
-*/
-#include "ThreadInfo.h"
-#include "cutils/threads.h"
-
-thread_store_t s_tls = THREAD_STORE_INITIALIZER;
-
-static void tlsDestruct(void *ptr)
-{
- if (ptr) {
- EGLThreadInfo *ti = (EGLThreadInfo *)ptr;
- delete ti->serverConn;
- delete ti;
- }
-}
-
-EGLThreadInfo *getEGLThreadInfo()
-{
- EGLThreadInfo *ti = (EGLThreadInfo *)thread_store_get(&s_tls);
- if (ti) return ti;
-
- ti = new EGLThreadInfo();
- thread_store_set(&s_tls, ti, tlsDestruct);
-
- return ti;
-}
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/ThreadInfo.h b/tools/emulator/opengl/tests/gles_android_wrapper/ThreadInfo.h
deleted file mode 100644
index f748a3973..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/ThreadInfo.h
+++ /dev/null
@@ -1,49 +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.
-*/
-#ifndef _THREAD_INFO_H
-#define _THREAD_INFO_H
-
-#include "ServerConnection.h"
-#include <EGL/egl.h>
-
-struct EGLWrapperContext
-{
- EGLWrapperContext(EGLContext p_aglContext, int _version) {
- aglContext = p_aglContext;
- clientState = NULL;
- version = _version;
- }
-
- ~EGLWrapperContext() {
- delete clientState;
- }
-
- EGLContext aglContext;
- GLClientState *clientState;
- int version;
-};
-
-struct EGLThreadInfo
-{
- EGLThreadInfo() : currentContext(NULL), serverConn(NULL) {}
-
- EGLWrapperContext *currentContext;
- ServerConnection *serverConn;
-};
-
-
-EGLThreadInfo *getEGLThreadInfo();
-#endif
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/egl.cfg b/tools/emulator/opengl/tests/gles_android_wrapper/egl.cfg
deleted file mode 100644
index 891b07d20..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/egl.cfg
+++ /dev/null
@@ -1 +0,0 @@
-0 0 emul \ No newline at end of file
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/egl.cpp b/tools/emulator/opengl/tests/gles_android_wrapper/egl.cpp
deleted file mode 100644
index 1e2e45665..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/egl.cpp
+++ /dev/null
@@ -1,663 +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.
-*/
-
-//
-// WARNING -------------------------- WARNING
-// This code meant to be used for testing purposes only. It is not production
-// level quality.
-// Use on your own risk !!
-//
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dlfcn.h>
-#include "egl_dispatch.h"
-#include "egl_ftable.h"
-#include <cutils/process_name.h>
-#include <cutils/log.h>
-#include "ServerConnection.h"
-#include "ThreadInfo.h"
-#include <pthread.h>
-#include "gl_wrapper_context.h"
-#include "gl2_wrapper_context.h"
-
-#define GLES_EMUL_TARGETS_FILE "/system/etc/gles_emul.cfg"
-// implementation libraries;
-#define GLESv1_enc_LIB "/system/lib/libGLESv1_enc.so"
-#define GLESv2_enc_LIB "/system/lib/libGLESv2_enc.so"
-#define GLES_android_LIB "/system/lib/egl/libGLES_android.so"
-// driver libraries;
-#define GLESv1_DRIVER "/system/lib/egl/libGLESv1_CM_emul.so"
-#define GLESv2_DRIVER "/system/lib/egl/libGLESv2_emul.so"
-
-
-static struct egl_dispatch *s_dispatch = NULL;
-pthread_once_t dispatchTablesInitialized = PTHREAD_ONCE_INIT;
-
-static bool s_needEncode = false;
-
-static gl_wrapper_context_t *g_gl_dispatch = NULL;
-static gl2_wrapper_context_t *g_gl2_dispatch = NULL;
-
-template <class T>
-int initApi(const char *driverLibName, const char *implLibName, T **dispatchTable, T *(*accessor)())
-{
- void *driverLib = dlopen(driverLibName, RTLD_NOW | RTLD_LOCAL);
- if (driverLib == NULL) {
- ALOGE("failed to load %s : %s\n", driverLibName, dlerror());
- return -1;
- }
-
- typedef T *(*createFcn_t)(void *, T *(*accessor)());
- createFcn_t createFcn;
- createFcn = (createFcn_t) dlsym(driverLib, "createFromLib");
- if (createFcn == NULL) {
- ALOGE("failed to load createFromLib constructor function\n");
- return -1;
- }
-
- void *implLib = dlopen(implLibName, RTLD_NOW | RTLD_LOCAL);
- if (implLib == NULL) {
- ALOGE("couldn't open %s", implLibName);
- return -2;
- }
- *dispatchTable = createFcn(implLib, accessor);
- if (*dispatchTable == NULL) {
- return -3;
- }
-
- // XXX - we do close the impl library since it doesn't have data, as far as we concern.
- dlclose(implLib);
-
- // XXX - we do not dlclose the driver library, so its not initialized when
- // later loaded by android - is this required?
- ALOGD("loading %s into %s complete\n", implLibName, driverLibName);
- return 0;
-
-}
-
-static gl_wrapper_context_t *getGLContext()
-{
- return g_gl_dispatch;
-}
-
-static gl2_wrapper_context_t *getGL2Context()
-{
- return g_gl2_dispatch;
-}
-
-const char *getProcName()
-{
- static const char *procname = NULL;
-
- if (procname == NULL) {
- const char *str = get_process_name();
- if (strcmp(str, "unknown") != 0) {
- procname = str;
- } else {
- // we need to obtain our process name from the command line;
- FILE *fp = fopen("/proc/self/cmdline", "rt");
- if (fp == NULL) {
- ALOGE("couldn't open /proc/self/cmdline\n");
- return NULL;
- }
-
- char line[1000];
- if (fgets(line, sizeof(line), fp) == NULL) {
- ALOGE("couldn't read the self cmdline from \n");
- fclose(fp);
- return NULL;
- }
- fclose(fp);
-
- if (line[0] == '\0') {
- ALOGE("cmdline is empty\n");
- return NULL;
- }
-
- //obtain the basename;
- line[sizeof(line) - 1] = '\0';
- char *p = line;
- while (*p != '\0' &&
- *p != '\t' &&
- *p != ' ' &&
- *p != '\n') {
- p++;
- }
-
- *p = '\0'; p--;
- while (p > line && *p != '/') p--;
- if (*p == '/') p++;
- procname = strdup(p);
- }
- }
-
- return procname;
-}
-
-
-
-bool isNeedEncode()
-{
- const char *procname = getProcName();
- if (procname == NULL) return false;
- ALOGD("isNeedEncode? for %s\n", procname);
- // check on our whitelist
- FILE *fp = fopen(GLES_EMUL_TARGETS_FILE, "rt");
- if (fp == NULL) {
- ALOGE("couldn't open %s\n", GLES_EMUL_TARGETS_FILE);
- return false;
- }
-
- char line[100];
- bool found = false;
- size_t procnameLen = strlen(procname);
-
- while (fgets(line, sizeof(line), fp) != NULL) {
- if (strlen(line) >= procnameLen &&
- !strncmp(procname, line, procnameLen)) {
- char c = line[procnameLen];
- if (c == '\0' || c == ' ' || c == '\t' || c == '\n') {
- found = true;
- ALOGD("should use encoder for %s\n", procname);
- break;
- }
- }
- }
- fclose(fp);
- return found;
-}
-
-void initDispatchTables()
-{
- //
- // Load our back-end implementation of EGL/GLES
- //
- ALOGD("Loading egl dispatch for %s\n", getProcName());
-
- void *gles_android = dlopen("/system/lib/egl/libGLES_android.so", RTLD_NOW | RTLD_LOCAL);
- if (!gles_android) {
- fprintf(stderr,"FATAL ERROR: Could not load libGLES_android lib\n");
- exit(-1);
- }
-
- //
- // Load back-end EGL implementation library
- //
- s_dispatch = create_egl_dispatch( gles_android );
- if (!s_dispatch) {
- fprintf(stderr,"FATAL ERROR: Could not create egl dispatch\n");
- exit(-1);
- }
-
- //
- // initialize gles
- //
- s_needEncode = isNeedEncode();
- void *gles_encoder = NULL;
- if (s_needEncode) {
- // initialize a connection to the server, and the GLESv1/v2 encoders;
- ServerConnection * connection = ServerConnection::s_getServerConnection();
- if (connection == NULL) {
- ALOGE("couldn't create server connection\n");
- s_needEncode = false;
- }
- }
-
- // init dispatch tabels for GLESv1 & GLESv2
- if (s_needEncode) {
- // XXX - we do not check the retrun value because there isn't much we can do here on failure.
-
- if (initApi<gl_wrapper_context_t>(GLESv1_DRIVER, GLESv1_enc_LIB, &g_gl_dispatch, getGLContext) < 0) {
- // fallback to android on faluire
- s_needEncode = false;
- } else {
- initApi<gl2_wrapper_context_t>(GLESv2_DRIVER, GLESv2_enc_LIB, &g_gl2_dispatch, getGL2Context);
- }
- }
-
- if (!s_needEncode) {
- ALOGD("Initializing native opengl for %s\n", getProcName());
- initApi<gl_wrapper_context_t>(GLESv1_DRIVER, GLES_android_LIB, &g_gl_dispatch, getGLContext);
- // try to initialize gl2 from GLES, though its probably going to fail
- initApi<gl2_wrapper_context_t>(GLESv2_DRIVER, GLES_android_LIB, &g_gl2_dispatch, getGL2Context);
- }
-}
-
-static struct egl_dispatch *getDispatch()
-{
- pthread_once(&dispatchTablesInitialized, initDispatchTables);
- return s_dispatch;
-}
-
-__eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
-{
-
- // search in EGL function table
- for (int i=0; i<egl_num_funcs; i++) {
- if (!strcmp(egl_funcs_by_name[i].name, procname)) {
- return (__eglMustCastToProperFunctionPointerType)egl_funcs_by_name[i].proc;
- }
- }
-
- // we do not support eglGetProcAddress for GLESv1 & GLESv2. The loader
- // should be able to find this function through dynamic loading.
- return NULL;
-}
-
-//////////////// Path through functions //////////
-
-EGLint eglGetError()
-{
- return getDispatch()->eglGetError();
-}
-
-EGLDisplay eglGetDisplay(EGLNativeDisplayType display_id)
-{
- return getDispatch()->eglGetDisplay(display_id);
-}
-
-EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
-{
- return getDispatch()->eglInitialize(dpy, major, minor);
-}
-
-EGLBoolean eglTerminate(EGLDisplay dpy)
-{
- return getDispatch()->eglTerminate(dpy);
-}
-
-const char* eglQueryString(EGLDisplay dpy, EGLint name)
-{
- return getDispatch()->eglQueryString(dpy, name);
-}
-
-EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
-{
- return getDispatch()->eglGetConfigs(dpy, configs, config_size, num_config);
-}
-
-static EGLint * filter_es2_bit(const EGLint *attrib_list, bool *isES2)
-{
- if (attrib_list == NULL) {
- if (isES2 != NULL) *isES2 = false;
- return NULL;
- }
-
- EGLint *attribs = NULL;
- int nAttribs = 0;
- while(attrib_list[nAttribs] != EGL_NONE) nAttribs++;
- nAttribs++;
-
- attribs = new EGLint[nAttribs];
- memcpy(attribs, attrib_list, nAttribs * sizeof(EGLint));
- if (isES2 != NULL) *isES2 = false;
-
- // scan the attribute list for ES2 request and replace with ES1.
- for (int i = 0; i < nAttribs; i++) {
- if (attribs[i] == EGL_RENDERABLE_TYPE) {
- if (attribs[i + 1] & EGL_OPENGL_ES2_BIT) {
- attribs[i + 1] &= ~EGL_OPENGL_ES2_BIT;
- attribs[i + 1] |= EGL_OPENGL_ES_BIT;
- ALOGD("removing ES2 bit 0x%x\n", attribs[i + 1]);
- if (isES2 != NULL) *isES2 = true;
- }
- }
- }
- return attribs;
-}
-
-EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
-{
- EGLBoolean res;
- if (s_needEncode) {
- EGLint *attribs = filter_es2_bit(attrib_list, NULL);
- res = getDispatch()->eglChooseConfig(dpy,
- attribs,
- configs,
- config_size,
- num_config);
- ALOGD("eglChooseConfig: %d configs found\n", *num_config);
- if (*num_config == 0 && attribs != NULL) {
- ALOGD("requested attributes:\n");
- for (int i = 0; attribs[i] != EGL_NONE; i++) {
- ALOGD("%d: 0x%x\n", i, attribs[i]);
- }
- }
-
- delete attribs;
- } else {
- res = getDispatch()->eglChooseConfig(dpy, attrib_list, configs, config_size, num_config);
- }
- return res;
-}
-
-EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
-{
- if (s_needEncode && attribute == EGL_RENDERABLE_TYPE) {
- *value = EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT;
- return EGL_TRUE;
- } else {
- return getDispatch()->eglGetConfigAttrib(dpy, config, attribute, value);
- }
-}
-
-EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list)
-{
- EGLSurface surface = getDispatch()->eglCreateWindowSurface(dpy, config, win, attrib_list);
- if (surface != EGL_NO_SURFACE) {
- ServerConnection *server;
- if (s_needEncode && (server = ServerConnection::s_getServerConnection()) != NULL) {
- server->utEnc()->createSurface(server->utEnc(), getpid(), (uint32_t)surface);
- }
- }
- return surface;
-}
-
-EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
-{
- EGLSurface surface = getDispatch()->eglCreatePbufferSurface(dpy, config, attrib_list);
- if (surface != EGL_NO_SURFACE) {
- ServerConnection *server;
- if (s_needEncode && (server = ServerConnection::s_getServerConnection()) != NULL) {
- server->utEnc()->createSurface(server->utEnc(), getpid(), (uint32_t)surface);
- }
- }
- return surface;
-}
-
-EGLSurface eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list)
-{
- EGLSurface surface = getDispatch()->eglCreatePixmapSurface(dpy, config, pixmap, attrib_list);
- if (surface != EGL_NO_SURFACE) {
- ServerConnection *server;
- if (s_needEncode && (server = ServerConnection::s_getServerConnection()) != NULL) {
- server->utEnc()->createSurface(server->utEnc(), getpid(), (uint32_t)surface);
- }
- }
- return surface;
-}
-
-EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
-{
- EGLBoolean res = getDispatch()->eglDestroySurface(dpy, surface);
- if (res && surface != EGL_NO_SURFACE) {
- ServerConnection *server;
- if (s_needEncode && (server = ServerConnection::s_getServerConnection()) != NULL) {
- server->utEnc()->destroySurface(server->utEnc(), getpid(), (uint32_t)surface);
- }
- }
- return res;
-}
-
-EGLBoolean eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
-{
- EGLBoolean res = getDispatch()->eglQuerySurface(dpy, surface, attribute, value);
- if (res && attribute == EGL_RENDERABLE_TYPE) {
- *value |= EGL_OPENGL_ES2_BIT;
- }
- return res;
-}
-
-EGLBoolean eglBindAPI(EGLenum api)
-{
- return getDispatch()->eglBindAPI(api);
-}
-
-EGLenum eglQueryAPI()
-{
- return getDispatch()->eglQueryAPI();
-}
-
-EGLBoolean eglWaitClient()
-{
- return getDispatch()->eglWaitClient();
-}
-
-EGLBoolean eglReleaseThread()
-{
- return getDispatch()->eglReleaseThread();
-}
-
-EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
-{
- return getDispatch()->eglCreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list);
-}
-
-EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
-{
- return getDispatch()->eglSurfaceAttrib(dpy, surface, attribute, value);
-}
-
-EGLBoolean eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- return getDispatch()->eglBindTexImage(dpy, surface, buffer);
-}
-
-EGLBoolean eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- return getDispatch()->eglReleaseTexImage(dpy, surface, buffer);
-}
-
-EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval)
-{
- return getDispatch()->eglSwapInterval(dpy, interval);
-}
-
-EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list)
-{
-
- EGLContext share = share_context;
- if (share) share = ((EGLWrapperContext *)share_context)->aglContext;
-
- // check if are ES2, and convert it to ES1.
- int nAttribs = 0;
- if (attrib_list != NULL) {
- while(attrib_list[nAttribs] != EGL_NONE) {
- nAttribs++;
- }
- nAttribs++;
- }
-
- EGLint *attrib = NULL;
- if (nAttribs > 0) {
- attrib = new EGLint[nAttribs];
- memcpy(attrib, attrib_list, nAttribs * sizeof(EGLint));
- }
-
- int version = 1;
- for (int i = 0; i < nAttribs; i++) {
- if (attrib[i] == EGL_CONTEXT_CLIENT_VERSION &&
- attrib[i + 1] == 2) {
- version = 2;
- attrib[i + 1] = 1; // replace to version 1
- }
- }
-
- EGLContext ctx = getDispatch()->eglCreateContext(dpy, config, share, attrib);
- delete attrib;
- EGLWrapperContext *wctx = new EGLWrapperContext(ctx, version);
- if (ctx != EGL_NO_CONTEXT) {
- ServerConnection *server;
- if (s_needEncode && (server = ServerConnection::s_getServerConnection()) != NULL) {
- wctx->clientState = new GLClientState();
- server->utEnc()->createContext(server->utEnc(), getpid(),
- (uint32_t)wctx,
- (uint32_t)(share_context == EGL_NO_CONTEXT ? 0 : share_context), wctx->version);
- }
- }
- return (EGLContext)wctx;
-}
-
-EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
-{
- EGLWrapperContext *wctx = (EGLWrapperContext *)ctx;
- EGLBoolean res = EGL_FALSE;
-
- if (ctx && ctx != EGL_NO_CONTEXT) {
- res = getDispatch()->eglDestroyContext(dpy, wctx->aglContext);
- if (res) {
- EGLThreadInfo *ti = getEGLThreadInfo();
- ServerConnection *server;
- if (s_needEncode && (server = ServerConnection::s_getServerConnection())) {
- server->utEnc()->destroyContext(ti->serverConn->utEnc(), getpid(), (uint32_t)ctx);
- }
- if (ti->currentContext == wctx) ti->currentContext = NULL;
- delete wctx;
- }
- }
-
- return res;
-}
-
-EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
-{
- EGLWrapperContext *wctx = (EGLWrapperContext *)ctx;
- EGLContext aglContext = (ctx == EGL_NO_CONTEXT ? EGL_NO_CONTEXT : wctx->aglContext);
- EGLThreadInfo *ti = getEGLThreadInfo();
- EGLBoolean res = getDispatch()->eglMakeCurrent(dpy, draw, read, aglContext);
- if (res ) {
- // NOTE - we do get a pointer to the server connection, (rather then using ti->serverConn)
- // for cases that this is the first egl call of the current thread.
-
- ServerConnection *server;
- if (s_needEncode && (server = ServerConnection::s_getServerConnection())) {
- server->utEnc()->makeCurrentContext(server->utEnc(), getpid(),
- (uint32_t) (draw == EGL_NO_SURFACE ? 0 : draw),
- (uint32_t) (read == EGL_NO_SURFACE ? 0 : read),
- (uint32_t) (ctx == EGL_NO_CONTEXT ? 0 : ctx));
- server->glEncoder()->setClientState( wctx ? wctx->clientState : NULL );
- server->gl2Encoder()->setClientState( wctx ? wctx->clientState : NULL );
- }
-
- // set current context in our thread info
- ti->currentContext = wctx;
- }
- return res;
-
-}
-
-EGLContext eglGetCurrentContext()
-{
- EGLThreadInfo *ti = getEGLThreadInfo();
- return (ti->currentContext ? ti->currentContext : EGL_NO_CONTEXT);
-}
-
-EGLSurface eglGetCurrentSurface(EGLint readdraw)
-{
- return getDispatch()->eglGetCurrentSurface(readdraw);
-}
-
-EGLDisplay eglGetCurrentDisplay()
-{
- return getDispatch()->eglGetCurrentDisplay();
-}
-
-EGLBoolean eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
-{
- EGLWrapperContext *wctx = (EGLWrapperContext *)ctx;
- if (wctx) {
- if (attribute == EGL_CONTEXT_CLIENT_VERSION) {
- *value = wctx->version;
- return EGL_TRUE;
- } else {
- return getDispatch()->eglQueryContext(dpy, wctx->aglContext, attribute, value);
- }
- }
- else {
- return EGL_BAD_CONTEXT;
- }
-}
-
-EGLBoolean eglWaitGL()
-{
- return getDispatch()->eglWaitGL();
-}
-
-EGLBoolean eglWaitNative(EGLint engine)
-{
- return getDispatch()->eglWaitNative(engine);
-}
-
-EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
-{
- ServerConnection *server;
- if (s_needEncode && (server = ServerConnection::s_getServerConnection()) != NULL) {
- server->utEnc()->swapBuffers(server->utEnc(), getpid(), (uint32_t)surface);
- server->glEncoder()->flush();
- server->gl2Encoder()->flush();
- return 1;
- }
- return getDispatch()->eglSwapBuffers(dpy, surface);
-}
-
-EGLBoolean eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
-{
- return getDispatch()->eglCopyBuffers(dpy, surface, target);
-}
-
-EGLBoolean eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list)
-{
- return getDispatch()->eglLockSurfaceKHR(display, surface, attrib_list);
-}
-
-EGLBoolean eglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface)
-{
- return getDispatch()->eglUnlockSurfaceKHR(display, surface);
-}
-
-EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
-{
- EGLWrapperContext *wctx = (EGLWrapperContext *)ctx;
- EGLContext aglContext = (wctx ? wctx->aglContext : EGL_NO_CONTEXT);
- return getDispatch()->eglCreateImageKHR(dpy, aglContext, target, buffer, attrib_list);
-}
-
-EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
-{
- return getDispatch()->eglDestroyImageKHR(dpy, image);
-}
-
-EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
-{
- return getDispatch()->eglCreateSyncKHR(dpy, type, attrib_list);
-}
-
-EGLBoolean eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
-{
- return getDispatch()->eglDestroySyncKHR(dpy, sync);
-}
-
-EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout)
-{
- return getDispatch()->eglClientWaitSyncKHR(dpy, sync, flags, timeout);
-}
-
-EGLBoolean eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode)
-{
- return getDispatch()->eglSignalSyncKHR(dpy, sync, mode);
-}
-
-EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value)
-{
- return getDispatch()->eglGetSyncAttribKHR(dpy, sync, attribute, value);
-}
-
-EGLBoolean eglSetSwapRectangleANDROID(EGLDisplay dpy, EGLSurface draw, EGLint left, EGLint top, EGLint width, EGLint height)
-{
- return getDispatch()->eglSetSwapRectangleANDROID(dpy, draw, left, top, width, height);
-}
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/egl_dispatch.cpp b/tools/emulator/opengl/tests/gles_android_wrapper/egl_dispatch.cpp
deleted file mode 100644
index f69ca61a3..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/egl_dispatch.cpp
+++ /dev/null
@@ -1,71 +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.
-*/
-#include <stdio.h>
-#include "egl_dispatch.h"
-#include <dlfcn.h>
-
-egl_dispatch *create_egl_dispatch(void *gles_android)
-{
- egl_dispatch *disp = new egl_dispatch;
-
- void *ptr;
- ptr = dlsym(gles_android,"eglGetError"); disp->set_eglGetError((eglGetError_t)ptr);
- ptr = dlsym(gles_android,"eglGetDisplay"); disp->set_eglGetDisplay((eglGetDisplay_t)ptr);
- ptr = dlsym(gles_android,"eglInitialize"); disp->set_eglInitialize((eglInitialize_t)ptr);
- ptr = dlsym(gles_android,"eglTerminate"); disp->set_eglTerminate((eglTerminate_t)ptr);
- ptr = dlsym(gles_android,"eglQueryString"); disp->set_eglQueryString((eglQueryString_t)ptr);
- ptr = dlsym(gles_android,"eglGetConfigs"); disp->set_eglGetConfigs((eglGetConfigs_t)ptr);
- ptr = dlsym(gles_android,"eglChooseConfig"); disp->set_eglChooseConfig((eglChooseConfig_t)ptr);
- ptr = dlsym(gles_android,"eglGetConfigAttrib"); disp->set_eglGetConfigAttrib((eglGetConfigAttrib_t)ptr);
- ptr = dlsym(gles_android,"eglCreateWindowSurface"); disp->set_eglCreateWindowSurface((eglCreateWindowSurface_t)ptr);
- ptr = dlsym(gles_android,"eglCreatePbufferSurface"); disp->set_eglCreatePbufferSurface((eglCreatePbufferSurface_t)ptr);
- ptr = dlsym(gles_android,"eglCreatePixmapSurface"); disp->set_eglCreatePixmapSurface((eglCreatePixmapSurface_t)ptr);
- ptr = dlsym(gles_android,"eglDestroySurface"); disp->set_eglDestroySurface((eglDestroySurface_t)ptr);
- ptr = dlsym(gles_android,"eglQuerySurface"); disp->set_eglQuerySurface((eglQuerySurface_t)ptr);
- ptr = dlsym(gles_android,"eglBindAPI"); disp->set_eglBindAPI((eglBindAPI_t)ptr);
- ptr = dlsym(gles_android,"eglQueryAPI"); disp->set_eglQueryAPI((eglQueryAPI_t)ptr);
- ptr = dlsym(gles_android,"eglWaitClient"); disp->set_eglWaitClient((eglWaitClient_t)ptr);
- ptr = dlsym(gles_android,"eglReleaseThread"); disp->set_eglReleaseThread((eglReleaseThread_t)ptr);
- ptr = dlsym(gles_android,"eglCreatePbufferFromClientBuffer"); disp->set_eglCreatePbufferFromClientBuffer((eglCreatePbufferFromClientBuffer_t)ptr);
- ptr = dlsym(gles_android,"eglSurfaceAttrib"); disp->set_eglSurfaceAttrib((eglSurfaceAttrib_t)ptr);
- ptr = dlsym(gles_android,"eglBindTexImage"); disp->set_eglBindTexImage((eglBindTexImage_t)ptr);
- ptr = dlsym(gles_android,"eglReleaseTexImage"); disp->set_eglReleaseTexImage((eglReleaseTexImage_t)ptr);
- ptr = dlsym(gles_android,"eglSwapInterval"); disp->set_eglSwapInterval((eglSwapInterval_t)ptr);
- ptr = dlsym(gles_android,"eglCreateContext"); disp->set_eglCreateContext((eglCreateContext_t)ptr);
- ptr = dlsym(gles_android,"eglDestroyContext"); disp->set_eglDestroyContext((eglDestroyContext_t)ptr);
- ptr = dlsym(gles_android,"eglMakeCurrent"); disp->set_eglMakeCurrent((eglMakeCurrent_t)ptr);
- ptr = dlsym(gles_android,"eglGetCurrentContext"); disp->set_eglGetCurrentContext((eglGetCurrentContext_t)ptr);
- ptr = dlsym(gles_android,"eglGetCurrentSurface"); disp->set_eglGetCurrentSurface((eglGetCurrentSurface_t)ptr);
- ptr = dlsym(gles_android,"eglGetCurrentDisplay"); disp->set_eglGetCurrentDisplay((eglGetCurrentDisplay_t)ptr);
- ptr = dlsym(gles_android,"eglQueryContext"); disp->set_eglQueryContext((eglQueryContext_t)ptr);
- ptr = dlsym(gles_android,"eglWaitGL"); disp->set_eglWaitGL((eglWaitGL_t)ptr);
- ptr = dlsym(gles_android,"eglWaitNative"); disp->set_eglWaitNative((eglWaitNative_t)ptr);
- ptr = dlsym(gles_android,"eglSwapBuffers"); disp->set_eglSwapBuffers((eglSwapBuffers_t)ptr);
- ptr = dlsym(gles_android,"eglCopyBuffers"); disp->set_eglCopyBuffers((eglCopyBuffers_t)ptr);
- ptr = dlsym(gles_android,"eglGetProcAddress"); disp->set_eglGetProcAddress((eglGetProcAddress_t)ptr);
- ptr = dlsym(gles_android,"eglLockSurfaceKHR"); disp->set_eglLockSurfaceKHR((eglLockSurfaceKHR_t)ptr);
- ptr = dlsym(gles_android,"eglUnlockSurfaceKHR"); disp->set_eglUnlockSurfaceKHR((eglUnlockSurfaceKHR_t)ptr);
- ptr = dlsym(gles_android,"eglCreateImageKHR"); disp->set_eglCreateImageKHR((eglCreateImageKHR_t)ptr);
- ptr = dlsym(gles_android,"eglDestroyImageKHR"); disp->set_eglDestroyImageKHR((eglDestroyImageKHR_t)ptr);
- ptr = dlsym(gles_android,"eglCreateSyncKHR"); disp->set_eglCreateSyncKHR((eglCreateSyncKHR_t)ptr);
- ptr = dlsym(gles_android,"eglDestroySyncKHR"); disp->set_eglDestroySyncKHR((eglDestroySyncKHR_t)ptr);
- ptr = dlsym(gles_android,"eglClientWaitSyncKHR"); disp->set_eglClientWaitSyncKHR((eglClientWaitSyncKHR_t)ptr);
- ptr = dlsym(gles_android,"eglSignalSyncKHR"); disp->set_eglSignalSyncKHR((eglSignalSyncKHR_t)ptr);
- ptr = dlsym(gles_android,"eglGetSyncAttribKHR"); disp->set_eglGetSyncAttribKHR((eglGetSyncAttribKHR_t)ptr);
- ptr = dlsym(gles_android,"eglSetSwapRectangleANDROID"); disp->set_eglSetSwapRectangleANDROID((eglSetSwapRectangleANDROID_t)ptr);
-
- return disp;
-}
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/egl_dispatch.h b/tools/emulator/opengl/tests/gles_android_wrapper/egl_dispatch.h
deleted file mode 100644
index 1b8de0d81..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/egl_dispatch.h
+++ /dev/null
@@ -1,115 +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.
-*/
-#ifndef _EGL_DISPATCH_H
-#define _EGL_DISPATCH_H
-
-#include "egl_proc.h"
-
-struct egl_dispatch {
- eglGetError_t eglGetError;
- eglGetDisplay_t eglGetDisplay;
- eglInitialize_t eglInitialize;
- eglTerminate_t eglTerminate;
- eglQueryString_t eglQueryString;
- eglGetConfigs_t eglGetConfigs;
- eglChooseConfig_t eglChooseConfig;
- eglGetConfigAttrib_t eglGetConfigAttrib;
- eglCreateWindowSurface_t eglCreateWindowSurface;
- eglCreatePbufferSurface_t eglCreatePbufferSurface;
- eglCreatePixmapSurface_t eglCreatePixmapSurface;
- eglDestroySurface_t eglDestroySurface;
- eglQuerySurface_t eglQuerySurface;
- eglBindAPI_t eglBindAPI;
- eglQueryAPI_t eglQueryAPI;
- eglWaitClient_t eglWaitClient;
- eglReleaseThread_t eglReleaseThread;
- eglCreatePbufferFromClientBuffer_t eglCreatePbufferFromClientBuffer;
- eglSurfaceAttrib_t eglSurfaceAttrib;
- eglBindTexImage_t eglBindTexImage;
- eglReleaseTexImage_t eglReleaseTexImage;
- eglSwapInterval_t eglSwapInterval;
- eglCreateContext_t eglCreateContext;
- eglDestroyContext_t eglDestroyContext;
- eglMakeCurrent_t eglMakeCurrent;
- eglGetCurrentContext_t eglGetCurrentContext;
- eglGetCurrentSurface_t eglGetCurrentSurface;
- eglGetCurrentDisplay_t eglGetCurrentDisplay;
- eglQueryContext_t eglQueryContext;
- eglWaitGL_t eglWaitGL;
- eglWaitNative_t eglWaitNative;
- eglSwapBuffers_t eglSwapBuffers;
- eglCopyBuffers_t eglCopyBuffers;
- eglGetProcAddress_t eglGetProcAddress;
- eglLockSurfaceKHR_t eglLockSurfaceKHR;
- eglUnlockSurfaceKHR_t eglUnlockSurfaceKHR;
- eglCreateImageKHR_t eglCreateImageKHR;
- eglDestroyImageKHR_t eglDestroyImageKHR;
- eglCreateSyncKHR_t eglCreateSyncKHR;
- eglDestroySyncKHR_t eglDestroySyncKHR;
- eglClientWaitSyncKHR_t eglClientWaitSyncKHR;
- eglSignalSyncKHR_t eglSignalSyncKHR;
- eglGetSyncAttribKHR_t eglGetSyncAttribKHR;
- eglSetSwapRectangleANDROID_t eglSetSwapRectangleANDROID;
- //Accessors
- eglGetError_t set_eglGetError(eglGetError_t f) { eglGetError_t retval = eglGetError; eglGetError = f; return retval;}
- eglGetDisplay_t set_eglGetDisplay(eglGetDisplay_t f) { eglGetDisplay_t retval = eglGetDisplay; eglGetDisplay = f; return retval;}
- eglInitialize_t set_eglInitialize(eglInitialize_t f) { eglInitialize_t retval = eglInitialize; eglInitialize = f; return retval;}
- eglTerminate_t set_eglTerminate(eglTerminate_t f) { eglTerminate_t retval = eglTerminate; eglTerminate = f; return retval;}
- eglQueryString_t set_eglQueryString(eglQueryString_t f) { eglQueryString_t retval = eglQueryString; eglQueryString = f; return retval;}
- eglGetConfigs_t set_eglGetConfigs(eglGetConfigs_t f) { eglGetConfigs_t retval = eglGetConfigs; eglGetConfigs = f; return retval;}
- eglChooseConfig_t set_eglChooseConfig(eglChooseConfig_t f) { eglChooseConfig_t retval = eglChooseConfig; eglChooseConfig = f; return retval;}
- eglGetConfigAttrib_t set_eglGetConfigAttrib(eglGetConfigAttrib_t f) { eglGetConfigAttrib_t retval = eglGetConfigAttrib; eglGetConfigAttrib = f; return retval;}
- eglCreateWindowSurface_t set_eglCreateWindowSurface(eglCreateWindowSurface_t f) { eglCreateWindowSurface_t retval = eglCreateWindowSurface; eglCreateWindowSurface = f; return retval;}
- eglCreatePbufferSurface_t set_eglCreatePbufferSurface(eglCreatePbufferSurface_t f) { eglCreatePbufferSurface_t retval = eglCreatePbufferSurface; eglCreatePbufferSurface = f; return retval;}
- eglCreatePixmapSurface_t set_eglCreatePixmapSurface(eglCreatePixmapSurface_t f) { eglCreatePixmapSurface_t retval = eglCreatePixmapSurface; eglCreatePixmapSurface = f; return retval;}
- eglDestroySurface_t set_eglDestroySurface(eglDestroySurface_t f) { eglDestroySurface_t retval = eglDestroySurface; eglDestroySurface = f; return retval;}
- eglQuerySurface_t set_eglQuerySurface(eglQuerySurface_t f) { eglQuerySurface_t retval = eglQuerySurface; eglQuerySurface = f; return retval;}
- eglBindAPI_t set_eglBindAPI(eglBindAPI_t f) { eglBindAPI_t retval = eglBindAPI; eglBindAPI = f; return retval;}
- eglQueryAPI_t set_eglQueryAPI(eglQueryAPI_t f) { eglQueryAPI_t retval = eglQueryAPI; eglQueryAPI = f; return retval;}
- eglWaitClient_t set_eglWaitClient(eglWaitClient_t f) { eglWaitClient_t retval = eglWaitClient; eglWaitClient = f; return retval;}
- eglReleaseThread_t set_eglReleaseThread(eglReleaseThread_t f) { eglReleaseThread_t retval = eglReleaseThread; eglReleaseThread = f; return retval;}
- eglCreatePbufferFromClientBuffer_t set_eglCreatePbufferFromClientBuffer(eglCreatePbufferFromClientBuffer_t f) { eglCreatePbufferFromClientBuffer_t retval = eglCreatePbufferFromClientBuffer; eglCreatePbufferFromClientBuffer = f; return retval;}
- eglSurfaceAttrib_t set_eglSurfaceAttrib(eglSurfaceAttrib_t f) { eglSurfaceAttrib_t retval = eglSurfaceAttrib; eglSurfaceAttrib = f; return retval;}
- eglBindTexImage_t set_eglBindTexImage(eglBindTexImage_t f) { eglBindTexImage_t retval = eglBindTexImage; eglBindTexImage = f; return retval;}
- eglReleaseTexImage_t set_eglReleaseTexImage(eglReleaseTexImage_t f) { eglReleaseTexImage_t retval = eglReleaseTexImage; eglReleaseTexImage = f; return retval;}
- eglSwapInterval_t set_eglSwapInterval(eglSwapInterval_t f) { eglSwapInterval_t retval = eglSwapInterval; eglSwapInterval = f; return retval;}
- eglCreateContext_t set_eglCreateContext(eglCreateContext_t f) { eglCreateContext_t retval = eglCreateContext; eglCreateContext = f; return retval;}
- eglDestroyContext_t set_eglDestroyContext(eglDestroyContext_t f) { eglDestroyContext_t retval = eglDestroyContext; eglDestroyContext = f; return retval;}
- eglMakeCurrent_t set_eglMakeCurrent(eglMakeCurrent_t f) { eglMakeCurrent_t retval = eglMakeCurrent; eglMakeCurrent = f; return retval;}
- eglGetCurrentContext_t set_eglGetCurrentContext(eglGetCurrentContext_t f) { eglGetCurrentContext_t retval = eglGetCurrentContext; eglGetCurrentContext = f; return retval;}
- eglGetCurrentSurface_t set_eglGetCurrentSurface(eglGetCurrentSurface_t f) { eglGetCurrentSurface_t retval = eglGetCurrentSurface; eglGetCurrentSurface = f; return retval;}
- eglGetCurrentDisplay_t set_eglGetCurrentDisplay(eglGetCurrentDisplay_t f) { eglGetCurrentDisplay_t retval = eglGetCurrentDisplay; eglGetCurrentDisplay = f; return retval;}
- eglQueryContext_t set_eglQueryContext(eglQueryContext_t f) { eglQueryContext_t retval = eglQueryContext; eglQueryContext = f; return retval;}
- eglWaitGL_t set_eglWaitGL(eglWaitGL_t f) { eglWaitGL_t retval = eglWaitGL; eglWaitGL = f; return retval;}
- eglWaitNative_t set_eglWaitNative(eglWaitNative_t f) { eglWaitNative_t retval = eglWaitNative; eglWaitNative = f; return retval;}
- eglSwapBuffers_t set_eglSwapBuffers(eglSwapBuffers_t f) { eglSwapBuffers_t retval = eglSwapBuffers; eglSwapBuffers = f; return retval;}
- eglCopyBuffers_t set_eglCopyBuffers(eglCopyBuffers_t f) { eglCopyBuffers_t retval = eglCopyBuffers; eglCopyBuffers = f; return retval;}
- eglGetProcAddress_t set_eglGetProcAddress(eglGetProcAddress_t f) { eglGetProcAddress_t retval = eglGetProcAddress; eglGetProcAddress = f; return retval;}
- eglLockSurfaceKHR_t set_eglLockSurfaceKHR(eglLockSurfaceKHR_t f) { eglLockSurfaceKHR_t retval = eglLockSurfaceKHR; eglLockSurfaceKHR = f; return retval;}
- eglUnlockSurfaceKHR_t set_eglUnlockSurfaceKHR(eglUnlockSurfaceKHR_t f) { eglUnlockSurfaceKHR_t retval = eglUnlockSurfaceKHR; eglUnlockSurfaceKHR = f; return retval;}
- eglCreateImageKHR_t set_eglCreateImageKHR(eglCreateImageKHR_t f) { eglCreateImageKHR_t retval = eglCreateImageKHR; eglCreateImageKHR = f; return retval;}
- eglDestroyImageKHR_t set_eglDestroyImageKHR(eglDestroyImageKHR_t f) { eglDestroyImageKHR_t retval = eglDestroyImageKHR; eglDestroyImageKHR = f; return retval;}
- eglCreateSyncKHR_t set_eglCreateSyncKHR(eglCreateSyncKHR_t f) { eglCreateSyncKHR_t retval = eglCreateSyncKHR; eglCreateSyncKHR = f; return retval;}
- eglDestroySyncKHR_t set_eglDestroySyncKHR(eglDestroySyncKHR_t f) { eglDestroySyncKHR_t retval = eglDestroySyncKHR; eglDestroySyncKHR = f; return retval;}
- eglClientWaitSyncKHR_t set_eglClientWaitSyncKHR(eglClientWaitSyncKHR_t f) { eglClientWaitSyncKHR_t retval = eglClientWaitSyncKHR; eglClientWaitSyncKHR = f; return retval;}
- eglSignalSyncKHR_t set_eglSignalSyncKHR(eglSignalSyncKHR_t f) { eglSignalSyncKHR_t retval = eglSignalSyncKHR; eglSignalSyncKHR = f; return retval;}
- eglGetSyncAttribKHR_t set_eglGetSyncAttribKHR(eglGetSyncAttribKHR_t f) { eglGetSyncAttribKHR_t retval = eglGetSyncAttribKHR; eglGetSyncAttribKHR = f; return retval;}
- eglSetSwapRectangleANDROID_t set_eglSetSwapRectangleANDROID(eglSetSwapRectangleANDROID_t f) { eglSetSwapRectangleANDROID_t retval = eglSetSwapRectangleANDROID; eglSetSwapRectangleANDROID = f; return retval;}
-};
-
-egl_dispatch *create_egl_dispatch(void *gles_andorid);
-
-#endif
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/egl_ftable.h b/tools/emulator/opengl/tests/gles_android_wrapper/egl_ftable.h
deleted file mode 100644
index ee4058590..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/egl_ftable.h
+++ /dev/null
@@ -1,66 +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.
-*/
-static struct _egl_funcs_by_name {
- const char *name;
- void *proc;
-} egl_funcs_by_name[] = {
- {"eglGetError", (void *)eglGetError},
- {"eglGetDisplay", (void *)eglGetDisplay},
- {"eglInitialize", (void *)eglInitialize},
- {"eglTerminate", (void *)eglTerminate},
- {"eglQueryString", (void *)eglQueryString},
- {"eglGetConfigs", (void *)eglGetConfigs},
- {"eglChooseConfig", (void *)eglChooseConfig},
- {"eglGetConfigAttrib", (void *)eglGetConfigAttrib},
- {"eglCreateWindowSurface", (void *)eglCreateWindowSurface},
- {"eglCreatePbufferSurface", (void *)eglCreatePbufferSurface},
- {"eglCreatePixmapSurface", (void *)eglCreatePixmapSurface},
- {"eglDestroySurface", (void *)eglDestroySurface},
- {"eglQuerySurface", (void *)eglQuerySurface},
- {"eglBindAPI", (void *)eglBindAPI},
- {"eglQueryAPI", (void *)eglQueryAPI},
- {"eglWaitClient", (void *)eglWaitClient},
- {"eglReleaseThread", (void *)eglReleaseThread},
- {"eglCreatePbufferFromClientBuffer", (void *)eglCreatePbufferFromClientBuffer},
- {"eglSurfaceAttrib", (void *)eglSurfaceAttrib},
- {"eglBindTexImage", (void *)eglBindTexImage},
- {"eglReleaseTexImage", (void *)eglReleaseTexImage},
- {"eglSwapInterval", (void *)eglSwapInterval},
- {"eglCreateContext", (void *)eglCreateContext},
- {"eglDestroyContext", (void *)eglDestroyContext},
- {"eglMakeCurrent", (void *)eglMakeCurrent},
- {"eglGetCurrentContext", (void *)eglGetCurrentContext},
- {"eglGetCurrentSurface", (void *)eglGetCurrentSurface},
- {"eglGetCurrentDisplay", (void *)eglGetCurrentDisplay},
- {"eglQueryContext", (void *)eglQueryContext},
- {"eglWaitGL", (void *)eglWaitGL},
- {"eglWaitNative", (void *)eglWaitNative},
- {"eglSwapBuffers", (void *)eglSwapBuffers},
- {"eglCopyBuffers", (void *)eglCopyBuffers},
- {"eglGetProcAddress", (void *)eglGetProcAddress},
- {"eglLockSurfaceKHR", (void *)eglLockSurfaceKHR},
- {"eglUnlockSurfaceKHR", (void *)eglUnlockSurfaceKHR},
- {"eglCreateImageKHR", (void *)eglCreateImageKHR},
- {"eglDestroyImageKHR", (void *)eglDestroyImageKHR},
- {"eglCreateSyncKHR", (void *)eglCreateSyncKHR},
- {"eglDestroySyncKHR", (void *)eglDestroySyncKHR},
- {"eglClientWaitSyncKHR", (void *)eglClientWaitSyncKHR},
- {"eglSignalSyncKHR", (void *)eglSignalSyncKHR},
- {"eglGetSyncAttribKHR", (void *)eglGetSyncAttribKHR},
- {"eglSetSwapRectangleANDROID", (void *)eglSetSwapRectangleANDROID}
-};
-
-static int egl_num_funcs = sizeof(egl_funcs_by_name) / sizeof(struct _egl_funcs_by_name);
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/egl_proc.h b/tools/emulator/opengl/tests/gles_android_wrapper/egl_proc.h
deleted file mode 100644
index 140c0309e..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/egl_proc.h
+++ /dev/null
@@ -1,68 +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.
-*/
-#ifndef _EGL_PROC_H
-#define _EGL_PROC_H
-
-#include <EGL/egl.h>
-#define EGL_EGLEXT_PROTOTYPES
-#include <EGL/eglext.h>
-
-typedef EGLint (* eglGetError_t) ();
-typedef EGLDisplay (* eglGetDisplay_t) (EGLNativeDisplayType);
-typedef EGLBoolean (* eglInitialize_t) (EGLDisplay, EGLint*, EGLint*);
-typedef EGLBoolean (* eglTerminate_t) (EGLDisplay);
-typedef char* (* eglQueryString_t) (EGLDisplay, EGLint);
-typedef EGLBoolean (* eglGetConfigs_t) (EGLDisplay, EGLConfig*, EGLint, EGLint*);
-typedef EGLBoolean (* eglChooseConfig_t) (EGLDisplay, const EGLint*, EGLConfig*, EGLint, EGLint*);
-typedef EGLBoolean (* eglGetConfigAttrib_t) (EGLDisplay, EGLConfig, EGLint, EGLint*);
-typedef EGLSurface (* eglCreateWindowSurface_t) (EGLDisplay, EGLConfig, EGLNativeWindowType, const EGLint*);
-typedef EGLSurface (* eglCreatePbufferSurface_t) (EGLDisplay, EGLConfig, const EGLint*);
-typedef EGLSurface (* eglCreatePixmapSurface_t) (EGLDisplay, EGLConfig, EGLNativePixmapType, const EGLint*);
-typedef EGLBoolean (* eglDestroySurface_t) (EGLDisplay, EGLSurface);
-typedef EGLBoolean (* eglQuerySurface_t) (EGLDisplay, EGLSurface, EGLint, EGLint*);
-typedef EGLBoolean (* eglBindAPI_t) (EGLenum);
-typedef EGLenum (* eglQueryAPI_t) ();
-typedef EGLBoolean (* eglWaitClient_t) ();
-typedef EGLBoolean (* eglReleaseThread_t) ();
-typedef EGLSurface (* eglCreatePbufferFromClientBuffer_t) (EGLDisplay, EGLenum, EGLClientBuffer, EGLConfig, const EGLint*);
-typedef EGLBoolean (* eglSurfaceAttrib_t) (EGLDisplay, EGLSurface, EGLint, EGLint);
-typedef EGLBoolean (* eglBindTexImage_t) (EGLDisplay, EGLSurface, EGLint);
-typedef EGLBoolean (* eglReleaseTexImage_t) (EGLDisplay, EGLSurface, EGLint);
-typedef EGLBoolean (* eglSwapInterval_t) (EGLDisplay, EGLint);
-typedef EGLContext (* eglCreateContext_t) (EGLDisplay, EGLConfig, EGLContext, const EGLint*);
-typedef EGLBoolean (* eglDestroyContext_t) (EGLDisplay, EGLContext);
-typedef EGLBoolean (* eglMakeCurrent_t) (EGLDisplay, EGLSurface, EGLSurface, EGLContext);
-typedef EGLContext (* eglGetCurrentContext_t) ();
-typedef EGLSurface (* eglGetCurrentSurface_t) (EGLint);
-typedef EGLDisplay (* eglGetCurrentDisplay_t) ();
-typedef EGLBoolean (* eglQueryContext_t) (EGLDisplay, EGLContext, EGLint, EGLint*);
-typedef EGLBoolean (* eglWaitGL_t) ();
-typedef EGLBoolean (* eglWaitNative_t) (EGLint);
-typedef EGLBoolean (* eglSwapBuffers_t) (EGLDisplay, EGLSurface);
-typedef EGLBoolean (* eglCopyBuffers_t) (EGLDisplay, EGLSurface, EGLNativePixmapType);
-typedef __eglMustCastToProperFunctionPointerType (* eglGetProcAddress_t) (const char*);
-typedef EGLBoolean (* eglLockSurfaceKHR_t) (EGLDisplay, EGLSurface, const EGLint*);
-typedef EGLBoolean (* eglUnlockSurfaceKHR_t) (EGLDisplay, EGLSurface);
-typedef EGLImageKHR (* eglCreateImageKHR_t) (EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint*);
-typedef EGLBoolean (* eglDestroyImageKHR_t) (EGLDisplay, EGLImageKHR image);
-typedef EGLSyncKHR (* eglCreateSyncKHR_t) (EGLDisplay, EGLenum, const EGLint*);
-typedef EGLBoolean (* eglDestroySyncKHR_t) (EGLDisplay, EGLSyncKHR sync);
-typedef EGLint (* eglClientWaitSyncKHR_t) (EGLDisplay, EGLSyncKHR, EGLint, EGLTimeKHR timeout);
-typedef EGLBoolean (* eglSignalSyncKHR_t) (EGLDisplay, EGLSyncKHR, EGLenum);
-typedef EGLBoolean (* eglGetSyncAttribKHR_t) (EGLDisplay, EGLSyncKHR, EGLint, EGLint*);
-typedef EGLBoolean (* eglSetSwapRectangleANDROID_t) (EGLDisplay, EGLSurface, EGLint, EGLint, EGLint, EGLint);
-
-#endif // of _EGL_PROC_H
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/gles.cpp b/tools/emulator/opengl/tests/gles_android_wrapper/gles.cpp
deleted file mode 100644
index c0949c8c3..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/gles.cpp
+++ /dev/null
@@ -1,1410 +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.
-*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "gles_dispatch.h"
-#include "gles_ftable.h"
-#include <EGL/egl.h>
-#include <cutils/log.h>
-
-static struct gles_dispatch *s_dispatch = NULL;
-
-void init_gles(void *gles_android)
-{
- s_dispatch = create_gles_dispatch(gles_android);
- if (s_dispatch == NULL) {
- ALOGE("failed to create gles dispatch\n");
- }
-}
-
-static struct gles_dispatch *getDispatch()
-{
- if (!s_dispatch) {
- fprintf(stderr,"FATAL ERROR: GLES has not been initialized\n");
- exit(-1);
- }
-
- return s_dispatch;
-}
-
-__eglMustCastToProperFunctionPointerType gles_getProcAddress(const char *procname)
-{
- for (int i=0; i<gles_num_funcs; i++) {
- if (!strcmp(gles_funcs_by_name[i].name, procname)) {
- return (__eglMustCastToProperFunctionPointerType)gles_funcs_by_name[i].proc;
- }
- }
-
- return NULL;
-}
-
-///////////// Path-through functions ///////////////
-void glAlphaFunc(GLenum func, GLclampf ref)
-{
- getDispatch()->glAlphaFunc(func, ref);
-}
-
-void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
- getDispatch()->glClearColor(red, green, blue, alpha);
-}
-
-void glClearDepthf(GLclampf depth)
-{
- getDispatch()->glClearDepthf(depth);
-}
-
-void glClipPlanef(GLenum plane, const GLfloat *equation)
-{
- getDispatch()->glClipPlanef(plane, equation);
-}
-
-void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- getDispatch()->glColor4f(red, green, blue, alpha);
-}
-
-void glDepthRangef(GLclampf zNear, GLclampf zFar)
-{
- getDispatch()->glDepthRangef(zNear, zFar);
-}
-
-void glFogf(GLenum pname, GLfloat param)
-{
- getDispatch()->glFogf(pname, param);
-}
-
-void glFogfv(GLenum pname, const GLfloat *params)
-{
- getDispatch()->glFogfv(pname, params);
-}
-
-void glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-{
- getDispatch()->glFrustumf(left, right, bottom, top, zNear, zFar);
-}
-
-void glGetClipPlanef(GLenum pname, GLfloat eqn[4])
-{
- getDispatch()->glGetClipPlanef(pname, eqn);
-}
-
-void glGetFloatv(GLenum pname, GLfloat *params)
-{
- getDispatch()->glGetFloatv(pname, params);
-}
-
-void glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- getDispatch()->glGetLightfv(light, pname, params);
-}
-
-void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- getDispatch()->glGetMaterialfv(face, pname, params);
-}
-
-void glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params)
-{
- getDispatch()->glGetTexEnvfv(env, pname, params);
-}
-
-void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- getDispatch()->glGetTexParameterfv(target, pname, params);
-}
-
-void glLightModelf(GLenum pname, GLfloat param)
-{
- getDispatch()->glLightModelf(pname, param);
-}
-
-void glLightModelfv(GLenum pname, const GLfloat *params)
-{
- getDispatch()->glLightModelfv(pname, params);
-}
-
-void glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- getDispatch()->glLightf(light, pname, param);
-}
-
-void glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- getDispatch()->glLightfv(light, pname, params);
-}
-
-void glLineWidth(GLfloat width)
-{
- getDispatch()->glLineWidth(width);
-}
-
-void glLoadMatrixf(const GLfloat *m)
-{
- getDispatch()->glLoadMatrixf(m);
-}
-
-void glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- getDispatch()->glMaterialf(face, pname, param);
-}
-
-void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- getDispatch()->glMaterialfv(face, pname, params);
-}
-
-void glMultMatrixf(const GLfloat *m)
-{
- getDispatch()->glMultMatrixf(m);
-}
-
-void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- getDispatch()->glMultiTexCoord4f(target, s, t, r, q);
-}
-
-void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- getDispatch()->glNormal3f(nx, ny, nz);
-}
-
-void glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-{
- getDispatch()->glOrthof(left, right, bottom, top, zNear, zFar);
-}
-
-void glPointParameterf(GLenum pname, GLfloat param)
-{
- getDispatch()->glPointParameterf(pname, param);
-}
-
-void glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- getDispatch()->glPointParameterfv(pname, params);
-}
-
-void glPointSize(GLfloat size)
-{
- getDispatch()->glPointSize(size);
-}
-
-void glPolygonOffset(GLfloat factor, GLfloat units)
-{
- getDispatch()->glPolygonOffset(factor, units);
-}
-
-void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- getDispatch()->glRotatef(angle, x, y, z);
-}
-
-void glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- getDispatch()->glScalef(x, y, z);
-}
-
-void glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- getDispatch()->glTexEnvf(target, pname, param);
-}
-
-void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- getDispatch()->glTexEnvfv(target, pname, params);
-}
-
-void glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- getDispatch()->glTexParameterf(target, pname, param);
-}
-
-void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- getDispatch()->glTexParameterfv(target, pname, params);
-}
-
-void glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- getDispatch()->glTranslatef(x, y, z);
-}
-
-void glActiveTexture(GLenum texture)
-{
- getDispatch()->glActiveTexture(texture);
-}
-
-void glAlphaFuncx(GLenum func, GLclampx ref)
-{
- getDispatch()->glAlphaFuncx(func, ref);
-}
-
-void glBindBuffer(GLenum target, GLuint buffer)
-{
- getDispatch()->glBindBuffer(target, buffer);
-}
-
-void glBindTexture(GLenum target, GLuint texture)
-{
- getDispatch()->glBindTexture(target, texture);
-}
-
-void glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- getDispatch()->glBlendFunc(sfactor, dfactor);
-}
-
-void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- getDispatch()->glBufferData(target, size, data, usage);
-}
-
-void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- getDispatch()->glBufferSubData(target, offset, size, data);
-}
-
-void glClear(GLbitfield mask)
-{
- getDispatch()->glClear(mask);
-}
-
-void glClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
-{
- getDispatch()->glClearColorx(red, green, blue, alpha);
-}
-
-void glClearDepthx(GLclampx depth)
-{
- getDispatch()->glClearDepthx(depth);
-}
-
-void glClearStencil(GLint s)
-{
- getDispatch()->glClearStencil(s);
-}
-
-void glClientActiveTexture(GLenum texture)
-{
- getDispatch()->glClientActiveTexture(texture);
-}
-
-void glClipPlanex(GLenum plane, const GLfixed *equation)
-{
- getDispatch()->glClipPlanex(plane, equation);
-}
-
-void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- getDispatch()->glColor4ub(red, green, blue, alpha);
-}
-
-void glColor4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
-{
- getDispatch()->glColor4x(red, green, blue, alpha);
-}
-
-void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- getDispatch()->glColorMask(red, green, blue, alpha);
-}
-
-void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- getDispatch()->glColorPointer(size, type, stride, pointer);
-}
-
-void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- getDispatch()->glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- getDispatch()->glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- getDispatch()->glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- getDispatch()->glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-void glCullFace(GLenum mode)
-{
- getDispatch()->glCullFace(mode);
-}
-
-void glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- getDispatch()->glDeleteBuffers(n, buffers);
-}
-
-void glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- getDispatch()->glDeleteTextures(n, textures);
-}
-
-void glDepthFunc(GLenum func)
-{
- getDispatch()->glDepthFunc(func);
-}
-
-void glDepthMask(GLboolean flag)
-{
- getDispatch()->glDepthMask(flag);
-}
-
-void glDepthRangex(GLclampx zNear, GLclampx zFar)
-{
- getDispatch()->glDepthRangex(zNear, zFar);
-}
-
-void glDisable(GLenum cap)
-{
- getDispatch()->glDisable(cap);
-}
-
-void glDisableClientState(GLenum array)
-{
- getDispatch()->glDisableClientState(array);
-}
-
-void glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- getDispatch()->glDrawArrays(mode, first, count);
-}
-
-void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- getDispatch()->glDrawElements(mode, count, type, indices);
-}
-
-void glEnable(GLenum cap)
-{
- getDispatch()->glEnable(cap);
-}
-
-void glEnableClientState(GLenum array)
-{
- getDispatch()->glEnableClientState(array);
-}
-
-void glFinish()
-{
- getDispatch()->glFinish();
-}
-
-void glFlush()
-{
- getDispatch()->glFlush();
-}
-
-void glFogx(GLenum pname, GLfixed param)
-{
- getDispatch()->glFogx(pname, param);
-}
-
-void glFogxv(GLenum pname, const GLfixed *params)
-{
- getDispatch()->glFogxv(pname, params);
-}
-
-void glFrontFace(GLenum mode)
-{
- getDispatch()->glFrontFace(mode);
-}
-
-void glFrustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-{
- getDispatch()->glFrustumx(left, right, bottom, top, zNear, zFar);
-}
-
-void glGetBooleanv(GLenum pname, GLboolean *params)
-{
- getDispatch()->glGetBooleanv(pname, params);
-}
-
-void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- getDispatch()->glGetBufferParameteriv(target, pname, params);
-}
-
-void glGetClipPlanex(GLenum pname, GLfixed eqn[4])
-{
- getDispatch()->glGetClipPlanex(pname, eqn);
-}
-
-void glGenBuffers(GLsizei n, GLuint *buffers)
-{
- getDispatch()->glGenBuffers(n, buffers);
-}
-
-void glGenTextures(GLsizei n, GLuint *textures)
-{
- getDispatch()->glGenTextures(n, textures);
-}
-
-GLenum glGetError()
-{
- return getDispatch()->glGetError();
-}
-
-void glGetFixedv(GLenum pname, GLfixed *params)
-{
- getDispatch()->glGetFixedv(pname, params);
-}
-
-void glGetIntegerv(GLenum pname, GLint *params)
-{
- getDispatch()->glGetIntegerv(pname, params);
-}
-
-void glGetLightxv(GLenum light, GLenum pname, GLfixed *params)
-{
- getDispatch()->glGetLightxv(light, pname, params);
-}
-
-void glGetMaterialxv(GLenum face, GLenum pname, GLfixed *params)
-{
- getDispatch()->glGetMaterialxv(face, pname, params);
-}
-
-void glGetPointerv(GLenum pname, GLvoid **params)
-{
- getDispatch()->glGetPointerv(pname, params);
-}
-
-const GLubyte* glGetString(GLenum name)
-{
- return getDispatch()->glGetString(name);
-}
-
-void glGetTexEnviv(GLenum env, GLenum pname, GLint *params)
-{
- getDispatch()->glGetTexEnviv(env, pname, params);
-}
-
-void glGetTexEnvxv(GLenum env, GLenum pname, GLfixed *params)
-{
- getDispatch()->glGetTexEnvxv(env, pname, params);
-}
-
-void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- getDispatch()->glGetTexParameteriv(target, pname, params);
-}
-
-void glGetTexParameterxv(GLenum target, GLenum pname, GLfixed *params)
-{
- getDispatch()->glGetTexParameterxv(target, pname, params);
-}
-
-void glHint(GLenum target, GLenum mode)
-{
- getDispatch()->glHint(target, mode);
-}
-
-GLboolean glIsBuffer(GLuint buffer)
-{
- return getDispatch()->glIsBuffer(buffer);
-}
-
-GLboolean glIsEnabled(GLenum cap)
-{
- return getDispatch()->glIsEnabled(cap);
-}
-
-GLboolean glIsTexture(GLuint texture)
-{
- return getDispatch()->glIsTexture(texture);
-}
-
-void glLightModelx(GLenum pname, GLfixed param)
-{
- getDispatch()->glLightModelx(pname, param);
-}
-
-void glLightModelxv(GLenum pname, const GLfixed *params)
-{
- getDispatch()->glLightModelxv(pname, params);
-}
-
-void glLightx(GLenum light, GLenum pname, GLfixed param)
-{
- getDispatch()->glLightx(light, pname, param);
-}
-
-void glLightxv(GLenum light, GLenum pname, const GLfixed *params)
-{
- getDispatch()->glLightxv(light, pname, params);
-}
-
-void glLineWidthx(GLfixed width)
-{
- getDispatch()->glLineWidthx(width);
-}
-
-void glLoadIdentity()
-{
- getDispatch()->glLoadIdentity();
-}
-
-void glLoadMatrixx(const GLfixed *m)
-{
- getDispatch()->glLoadMatrixx(m);
-}
-
-void glLogicOp(GLenum opcode)
-{
- getDispatch()->glLogicOp(opcode);
-}
-
-void glMaterialx(GLenum face, GLenum pname, GLfixed param)
-{
- getDispatch()->glMaterialx(face, pname, param);
-}
-
-void glMaterialxv(GLenum face, GLenum pname, const GLfixed *params)
-{
- getDispatch()->glMaterialxv(face, pname, params);
-}
-
-void glMatrixMode(GLenum mode)
-{
- getDispatch()->glMatrixMode(mode);
-}
-
-void glMultMatrixx(const GLfixed *m)
-{
- getDispatch()->glMultMatrixx(m);
-}
-
-void glMultiTexCoord4x(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
-{
- getDispatch()->glMultiTexCoord4x(target, s, t, r, q);
-}
-
-void glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz)
-{
- getDispatch()->glNormal3x(nx, ny, nz);
-}
-
-void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- getDispatch()->glNormalPointer(type, stride, pointer);
-}
-
-void glOrthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-{
- getDispatch()->glOrthox(left, right, bottom, top, zNear, zFar);
-}
-
-void glPixelStorei(GLenum pname, GLint param)
-{
- getDispatch()->glPixelStorei(pname, param);
-}
-
-void glPointParameterx(GLenum pname, GLfixed param)
-{
- getDispatch()->glPointParameterx(pname, param);
-}
-
-void glPointParameterxv(GLenum pname, const GLfixed *params)
-{
- getDispatch()->glPointParameterxv(pname, params);
-}
-
-void glPointSizex(GLfixed size)
-{
- getDispatch()->glPointSizex(size);
-}
-
-void glPolygonOffsetx(GLfixed factor, GLfixed units)
-{
- getDispatch()->glPolygonOffsetx(factor, units);
-}
-
-void glPopMatrix()
-{
- getDispatch()->glPopMatrix();
-}
-
-void glPushMatrix()
-{
- getDispatch()->glPushMatrix();
-}
-
-void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- getDispatch()->glReadPixels(x, y, width, height, format, type, pixels);
-}
-
-void glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
-{
- getDispatch()->glRotatex(angle, x, y, z);
-}
-
-void glSampleCoverage(GLclampf value, GLboolean invert)
-{
- getDispatch()->glSampleCoverage(value, invert);
-}
-
-void glSampleCoveragex(GLclampx value, GLboolean invert)
-{
- getDispatch()->glSampleCoveragex(value, invert);
-}
-
-void glScalex(GLfixed x, GLfixed y, GLfixed z)
-{
- getDispatch()->glScalex(x, y, z);
-}
-
-void glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- getDispatch()->glScissor(x, y, width, height);
-}
-
-void glShadeModel(GLenum mode)
-{
- getDispatch()->glShadeModel(mode);
-}
-
-void glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- getDispatch()->glStencilFunc(func, ref, mask);
-}
-
-void glStencilMask(GLuint mask)
-{
- getDispatch()->glStencilMask(mask);
-}
-
-void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- getDispatch()->glStencilOp(fail, zfail, zpass);
-}
-
-void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- getDispatch()->glTexCoordPointer(size, type, stride, pointer);
-}
-
-void glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- getDispatch()->glTexEnvi(target, pname, param);
-}
-
-void glTexEnvx(GLenum target, GLenum pname, GLfixed param)
-{
- getDispatch()->glTexEnvx(target, pname, param);
-}
-
-void glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- getDispatch()->glTexEnviv(target, pname, params);
-}
-
-void glTexEnvxv(GLenum target, GLenum pname, const GLfixed *params)
-{
- getDispatch()->glTexEnvxv(target, pname, params);
-}
-
-void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- getDispatch()->glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-void glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- getDispatch()->glTexParameteri(target, pname, param);
-}
-
-void glTexParameterx(GLenum target, GLenum pname, GLfixed param)
-{
- getDispatch()->glTexParameterx(target, pname, param);
-}
-
-void glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- getDispatch()->glTexParameteriv(target, pname, params);
-}
-
-void glTexParameterxv(GLenum target, GLenum pname, const GLfixed *params)
-{
- getDispatch()->glTexParameterxv(target, pname, params);
-}
-
-void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- getDispatch()->glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-void glTranslatex(GLfixed x, GLfixed y, GLfixed z)
-{
- getDispatch()->glTranslatex(x, y, z);
-}
-
-void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- getDispatch()->glVertexPointer(size, type, stride, pointer);
-}
-
-void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- getDispatch()->glViewport(x, y, width, height);
-}
-
-void glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- getDispatch()->glPointSizePointerOES(type, stride, pointer);
-}
-
-void glBlendEquationSeparateOES(GLenum modeRGB, GLenum modeAlpha)
-{
- getDispatch()->glBlendEquationSeparateOES(modeRGB, modeAlpha);
-}
-
-void glBlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- getDispatch()->glBlendFuncSeparateOES(srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-void glBlendEquationOES(GLenum mode)
-{
- getDispatch()->glBlendEquationOES(mode);
-}
-
-void glDrawTexsOES(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height)
-{
- getDispatch()->glDrawTexsOES(x, y, z, width, height);
-}
-
-void glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height)
-{
- getDispatch()->glDrawTexiOES(x, y, z, width, height);
-}
-
-void glDrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height)
-{
- getDispatch()->glDrawTexxOES(x, y, z, width, height);
-}
-
-void glDrawTexsvOES(const GLshort *coords)
-{
- getDispatch()->glDrawTexsvOES(coords);
-}
-
-void glDrawTexivOES(const GLint *coords)
-{
- getDispatch()->glDrawTexivOES(coords);
-}
-
-void glDrawTexxvOES(const GLfixed *coords)
-{
- getDispatch()->glDrawTexxvOES(coords);
-}
-
-void glDrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height)
-{
- getDispatch()->glDrawTexfOES(x, y, z, width, height);
-}
-
-void glDrawTexfvOES(const GLfloat *coords)
-{
- getDispatch()->glDrawTexfvOES(coords);
-}
-
-void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
-{
- getDispatch()->glEGLImageTargetTexture2DOES(target, image);
-}
-
-void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
-{
- getDispatch()->glEGLImageTargetRenderbufferStorageOES(target, image);
-}
-
-void glAlphaFuncxOES(GLenum func, GLclampx ref)
-{
- getDispatch()->glAlphaFuncxOES(func, ref);
-}
-
-void glClearColorxOES(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
-{
- getDispatch()->glClearColorxOES(red, green, blue, alpha);
-}
-
-void glClearDepthxOES(GLclampx depth)
-{
- getDispatch()->glClearDepthxOES(depth);
-}
-
-void glClipPlanexOES(GLenum plane, const GLfixed *equation)
-{
- getDispatch()->glClipPlanexOES(plane, equation);
-}
-
-void glColor4xOES(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
-{
- getDispatch()->glColor4xOES(red, green, blue, alpha);
-}
-
-void glDepthRangexOES(GLclampx zNear, GLclampx zFar)
-{
- getDispatch()->glDepthRangexOES(zNear, zFar);
-}
-
-void glFogxOES(GLenum pname, GLfixed param)
-{
- getDispatch()->glFogxOES(pname, param);
-}
-
-void glFogxvOES(GLenum pname, const GLfixed *params)
-{
- getDispatch()->glFogxvOES(pname, params);
-}
-
-void glFrustumxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-{
- getDispatch()->glFrustumxOES(left, right, bottom, top, zNear, zFar);
-}
-
-void glGetClipPlanexOES(GLenum pname, GLfixed eqn[4])
-{
- getDispatch()->glGetClipPlanexOES(pname, eqn);
-}
-
-void glGetFixedvOES(GLenum pname, GLfixed *params)
-{
- getDispatch()->glGetFixedvOES(pname, params);
-}
-
-void glGetLightxvOES(GLenum light, GLenum pname, GLfixed *params)
-{
- getDispatch()->glGetLightxvOES(light, pname, params);
-}
-
-void glGetMaterialxvOES(GLenum face, GLenum pname, GLfixed *params)
-{
- getDispatch()->glGetMaterialxvOES(face, pname, params);
-}
-
-void glGetTexEnvxvOES(GLenum env, GLenum pname, GLfixed *params)
-{
- getDispatch()->glGetTexEnvxvOES(env, pname, params);
-}
-
-void glGetTexParameterxvOES(GLenum target, GLenum pname, GLfixed *params)
-{
- getDispatch()->glGetTexParameterxvOES(target, pname, params);
-}
-
-void glLightModelxOES(GLenum pname, GLfixed param)
-{
- getDispatch()->glLightModelxOES(pname, param);
-}
-
-void glLightModelxvOES(GLenum pname, const GLfixed *params)
-{
- getDispatch()->glLightModelxvOES(pname, params);
-}
-
-void glLightxOES(GLenum light, GLenum pname, GLfixed param)
-{
- getDispatch()->glLightxOES(light, pname, param);
-}
-
-void glLightxvOES(GLenum light, GLenum pname, const GLfixed *params)
-{
- getDispatch()->glLightxvOES(light, pname, params);
-}
-
-void glLineWidthxOES(GLfixed width)
-{
- getDispatch()->glLineWidthxOES(width);
-}
-
-void glLoadMatrixxOES(const GLfixed *m)
-{
- getDispatch()->glLoadMatrixxOES(m);
-}
-
-void glMaterialxOES(GLenum face, GLenum pname, GLfixed param)
-{
- getDispatch()->glMaterialxOES(face, pname, param);
-}
-
-void glMaterialxvOES(GLenum face, GLenum pname, const GLfixed *params)
-{
- getDispatch()->glMaterialxvOES(face, pname, params);
-}
-
-void glMultMatrixxOES(const GLfixed *m)
-{
- getDispatch()->glMultMatrixxOES(m);
-}
-
-void glMultiTexCoord4xOES(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
-{
- getDispatch()->glMultiTexCoord4xOES(target, s, t, r, q);
-}
-
-void glNormal3xOES(GLfixed nx, GLfixed ny, GLfixed nz)
-{
- getDispatch()->glNormal3xOES(nx, ny, nz);
-}
-
-void glOrthoxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-{
- getDispatch()->glOrthoxOES(left, right, bottom, top, zNear, zFar);
-}
-
-void glPointParameterxOES(GLenum pname, GLfixed param)
-{
- getDispatch()->glPointParameterxOES(pname, param);
-}
-
-void glPointParameterxvOES(GLenum pname, const GLfixed *params)
-{
- getDispatch()->glPointParameterxvOES(pname, params);
-}
-
-void glPointSizexOES(GLfixed size)
-{
- getDispatch()->glPointSizexOES(size);
-}
-
-void glPolygonOffsetxOES(GLfixed factor, GLfixed units)
-{
- getDispatch()->glPolygonOffsetxOES(factor, units);
-}
-
-void glRotatexOES(GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
-{
- getDispatch()->glRotatexOES(angle, x, y, z);
-}
-
-void glSampleCoveragexOES(GLclampx value, GLboolean invert)
-{
- getDispatch()->glSampleCoveragexOES(value, invert);
-}
-
-void glScalexOES(GLfixed x, GLfixed y, GLfixed z)
-{
- getDispatch()->glScalexOES(x, y, z);
-}
-
-void glTexEnvxOES(GLenum target, GLenum pname, GLfixed param)
-{
- getDispatch()->glTexEnvxOES(target, pname, param);
-}
-
-void glTexEnvxvOES(GLenum target, GLenum pname, const GLfixed *params)
-{
- getDispatch()->glTexEnvxvOES(target, pname, params);
-}
-
-void glTexParameterxOES(GLenum target, GLenum pname, GLfixed param)
-{
- getDispatch()->glTexParameterxOES(target, pname, param);
-}
-
-void glTexParameterxvOES(GLenum target, GLenum pname, const GLfixed *params)
-{
- getDispatch()->glTexParameterxvOES(target, pname, params);
-}
-
-void glTranslatexOES(GLfixed x, GLfixed y, GLfixed z)
-{
- getDispatch()->glTranslatexOES(x, y, z);
-}
-
-GLboolean glIsRenderbufferOES(GLuint renderbuffer)
-{
- return getDispatch()->glIsRenderbufferOES(renderbuffer);
-}
-
-void glBindRenderbufferOES(GLenum target, GLuint renderbuffer)
-{
- getDispatch()->glBindRenderbufferOES(target, renderbuffer);
-}
-
-void glDeleteRenderbuffersOES(GLsizei n, const GLuint *renderbuffers)
-{
- getDispatch()->glDeleteRenderbuffersOES(n, renderbuffers);
-}
-
-void glGenRenderbuffersOES(GLsizei n, GLuint *renderbuffers)
-{
- getDispatch()->glGenRenderbuffersOES(n, renderbuffers);
-}
-
-void glRenderbufferStorageOES(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- getDispatch()->glRenderbufferStorageOES(target, internalformat, width, height);
-}
-
-void glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint *params)
-{
- getDispatch()->glGetRenderbufferParameterivOES(target, pname, params);
-}
-
-GLboolean glIsFramebufferOES(GLuint framebuffer)
-{
- return getDispatch()->glIsFramebufferOES(framebuffer);
-}
-
-void glBindFramebufferOES(GLenum target, GLuint framebuffer)
-{
- getDispatch()->glBindFramebufferOES(target, framebuffer);
-}
-
-void glDeleteFramebuffersOES(GLsizei n, const GLuint *framebuffers)
-{
- getDispatch()->glDeleteFramebuffersOES(n, framebuffers);
-}
-
-void glGenFramebuffersOES(GLsizei n, GLuint *framebuffers)
-{
- getDispatch()->glGenFramebuffersOES(n, framebuffers);
-}
-
-GLenum glCheckFramebufferStatusOES(GLenum target)
-{
- return getDispatch()->glCheckFramebufferStatusOES(target);
-}
-
-void glFramebufferRenderbufferOES(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- getDispatch()->glFramebufferRenderbufferOES(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-void glFramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- getDispatch()->glFramebufferTexture2DOES(target, attachment, textarget, texture, level);
-}
-
-void glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint *params)
-{
- getDispatch()->glGetFramebufferAttachmentParameterivOES(target, attachment, pname, params);
-}
-
-void glGenerateMipmapOES(GLenum target)
-{
- getDispatch()->glGenerateMipmapOES(target);
-}
-
-void* glMapBufferOES(GLenum target, GLenum access)
-{
- return getDispatch()->glMapBufferOES(target, access);
-}
-
-GLboolean glUnmapBufferOES(GLenum target)
-{
- return getDispatch()->glUnmapBufferOES(target);
-}
-
-void glGetBufferPointervOES(GLenum target, GLenum pname, GLvoid **ptr)
-{
- getDispatch()->glGetBufferPointervOES(target, pname, ptr);
-}
-
-void glCurrentPaletteMatrixOES(GLuint matrixpaletteindex)
-{
- getDispatch()->glCurrentPaletteMatrixOES(matrixpaletteindex);
-}
-
-void glLoadPaletteFromModelViewMatrixOES()
-{
- getDispatch()->glLoadPaletteFromModelViewMatrixOES();
-}
-
-void glMatrixIndexPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- getDispatch()->glMatrixIndexPointerOES(size, type, stride, pointer);
-}
-
-void glWeightPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- getDispatch()->glWeightPointerOES(size, type, stride, pointer);
-}
-
-GLbitfield glQueryMatrixxOES(GLfixed mantissa[16], GLint exponent[16])
-{
- return getDispatch()->glQueryMatrixxOES(mantissa, exponent);
-}
-
-void glDepthRangefOES(GLclampf zNear, GLclampf zFar)
-{
- getDispatch()->glDepthRangefOES(zNear, zFar);
-}
-
-void glFrustumfOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-{
- getDispatch()->glFrustumfOES(left, right, bottom, top, zNear, zFar);
-}
-
-void glOrthofOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-{
- getDispatch()->glOrthofOES(left, right, bottom, top, zNear, zFar);
-}
-
-void glClipPlanefOES(GLenum plane, const GLfloat *equation)
-{
- getDispatch()->glClipPlanefOES(plane, equation);
-}
-
-void glGetClipPlanefOES(GLenum pname, GLfloat eqn[4])
-{
- getDispatch()->glGetClipPlanefOES(pname, eqn);
-}
-
-void glClearDepthfOES(GLclampf depth)
-{
- getDispatch()->glClearDepthfOES(depth);
-}
-
-void glTexGenfOES(GLenum coord, GLenum pname, GLfloat param)
-{
- getDispatch()->glTexGenfOES(coord, pname, param);
-}
-
-void glTexGenfvOES(GLenum coord, GLenum pname, const GLfloat *params)
-{
- getDispatch()->glTexGenfvOES(coord, pname, params);
-}
-
-void glTexGeniOES(GLenum coord, GLenum pname, GLint param)
-{
- getDispatch()->glTexGeniOES(coord, pname, param);
-}
-
-void glTexGenivOES(GLenum coord, GLenum pname, const GLint *params)
-{
- getDispatch()->glTexGenivOES(coord, pname, params);
-}
-
-void glTexGenxOES(GLenum coord, GLenum pname, GLfixed param)
-{
- getDispatch()->glTexGenxOES(coord, pname, param);
-}
-
-void glTexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params)
-{
- getDispatch()->glTexGenxvOES(coord, pname, params);
-}
-
-void glGetTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params)
-{
- getDispatch()->glGetTexGenfvOES(coord, pname, params);
-}
-
-void glGetTexGenivOES(GLenum coord, GLenum pname, GLint *params)
-{
- getDispatch()->glGetTexGenivOES(coord, pname, params);
-}
-
-void glGetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params)
-{
- getDispatch()->glGetTexGenxvOES(coord, pname, params);
-}
-
-void glBindVertexArrayOES(GLuint array)
-{
- getDispatch()->glBindVertexArrayOES(array);
-}
-
-void glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays)
-{
- getDispatch()->glDeleteVertexArraysOES(n, arrays);
-}
-
-void glGenVertexArraysOES(GLsizei n, GLuint *arrays)
-{
- getDispatch()->glGenVertexArraysOES(n, arrays);
-}
-
-GLboolean glIsVertexArrayOES(GLuint array)
-{
- return getDispatch()->glIsVertexArrayOES(array);
-}
-
-void glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments)
-{
- getDispatch()->glDiscardFramebufferEXT(target, numAttachments, attachments);
-}
-
-void glMultiDrawArraysEXT(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount)
-{
- getDispatch()->glMultiDrawArraysEXT(mode, first, count, primcount);
-}
-
-void glMultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount)
-{
- getDispatch()->glMultiDrawElementsEXT(mode, count, type, indices, primcount);
-}
-
-void glClipPlanefIMG(GLenum p, const GLfloat *eqn)
-{
- getDispatch()->glClipPlanefIMG(p, eqn);
-}
-
-void glClipPlanexIMG(GLenum p, const GLfixed *eqn)
-{
- getDispatch()->glClipPlanexIMG(p, eqn);
-}
-
-void glRenderbufferStorageMultisampleIMG(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- getDispatch()->glRenderbufferStorageMultisampleIMG(target, samples, internalformat, width, height);
-}
-
-void glFramebufferTexture2DMultisampleIMG(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples)
-{
- getDispatch()->glFramebufferTexture2DMultisampleIMG(target, attachment, textarget, texture, level, samples);
-}
-
-void glDeleteFencesNV(GLsizei n, const GLuint *fences)
-{
- getDispatch()->glDeleteFencesNV(n, fences);
-}
-
-void glGenFencesNV(GLsizei n, GLuint *fences)
-{
- getDispatch()->glGenFencesNV(n, fences);
-}
-
-GLboolean glIsFenceNV(GLuint fence)
-{
- return getDispatch()->glIsFenceNV(fence);
-}
-
-GLboolean glTestFenceNV(GLuint fence)
-{
- return getDispatch()->glTestFenceNV(fence);
-}
-
-void glGetFenceivNV(GLuint fence, GLenum pname, GLint *params)
-{
- getDispatch()->glGetFenceivNV(fence, pname, params);
-}
-
-void glFinishFenceNV(GLuint fence)
-{
- getDispatch()->glFinishFenceNV(fence);
-}
-
-void glSetFenceNV(GLuint fence, GLenum condition)
-{
- getDispatch()->glSetFenceNV(fence, condition);
-}
-
-void glGetDriverControlsQCOM(GLint *num, GLsizei size, GLuint *driverControls)
-{
- getDispatch()->glGetDriverControlsQCOM(num, size, driverControls);
-}
-
-void glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString)
-{
- getDispatch()->glGetDriverControlStringQCOM(driverControl, bufSize, length, driverControlString);
-}
-
-void glEnableDriverControlQCOM(GLuint driverControl)
-{
- getDispatch()->glEnableDriverControlQCOM(driverControl);
-}
-
-void glDisableDriverControlQCOM(GLuint driverControl)
-{
- getDispatch()->glDisableDriverControlQCOM(driverControl);
-}
-
-void glExtGetTexturesQCOM(GLuint *textures, GLint maxTextures, GLint *numTextures)
-{
- getDispatch()->glExtGetTexturesQCOM(textures, maxTextures, numTextures);
-}
-
-void glExtGetBuffersQCOM(GLuint *buffers, GLint maxBuffers, GLint *numBuffers)
-{
- getDispatch()->glExtGetBuffersQCOM(buffers, maxBuffers, numBuffers);
-}
-
-void glExtGetRenderbuffersQCOM(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers)
-{
- getDispatch()->glExtGetRenderbuffersQCOM(renderbuffers, maxRenderbuffers, numRenderbuffers);
-}
-
-void glExtGetFramebuffersQCOM(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers)
-{
- getDispatch()->glExtGetFramebuffersQCOM(framebuffers, maxFramebuffers, numFramebuffers);
-}
-
-void glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params)
-{
- getDispatch()->glExtGetTexLevelParameterivQCOM(texture, face, level, pname, params);
-}
-
-void glExtTexObjectStateOverrideiQCOM(GLenum target, GLenum pname, GLint param)
-{
- getDispatch()->glExtTexObjectStateOverrideiQCOM(target, pname, param);
-}
-
-void glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels)
-{
- getDispatch()->glExtGetTexSubImageQCOM(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texels);
-}
-
-void glExtGetBufferPointervQCOM(GLenum target, GLvoid **params)
-{
- getDispatch()->glExtGetBufferPointervQCOM(target, params);
-}
-
-void glExtGetShadersQCOM(GLuint *shaders, GLint maxShaders, GLint *numShaders)
-{
- getDispatch()->glExtGetShadersQCOM(shaders, maxShaders, numShaders);
-}
-
-void glExtGetProgramsQCOM(GLuint *programs, GLint maxPrograms, GLint *numPrograms)
-{
- getDispatch()->glExtGetProgramsQCOM(programs, maxPrograms, numPrograms);
-}
-
-GLboolean glExtIsProgramBinaryQCOM(GLuint program)
-{
- return getDispatch()->glExtIsProgramBinaryQCOM(program);
-}
-
-void glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar *source, GLint *length)
-{
- getDispatch()->glExtGetProgramBinarySourceQCOM(program, shadertype, source, length);
-}
-
-void glStartTilingQCOM(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask)
-{
- getDispatch()->glStartTilingQCOM(x, y, width, height, preserveMask);
-}
-
-void glEndTilingQCOM(GLbitfield preserveMask)
-{
- getDispatch()->glEndTilingQCOM(preserveMask);
-}
-
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/gles_dispatch.cpp b/tools/emulator/opengl/tests/gles_android_wrapper/gles_dispatch.cpp
deleted file mode 100644
index 0a1762485..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/gles_dispatch.cpp
+++ /dev/null
@@ -1,298 +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.
-*/
-#include "gles_dispatch.h"
-#include <stdio.h>
-#include <dlfcn.h>
-
-gles_dispatch *create_gles_dispatch(void *gles_android)
-{
- gles_dispatch *disp = new gles_dispatch;
-
- void *ptr;
- ptr = dlsym(gles_android,"glAlphaFunc"); disp->set_glAlphaFunc((glAlphaFunc_t)ptr);
- ptr = dlsym(gles_android,"glClearColor"); disp->set_glClearColor((glClearColor_t)ptr);
- ptr = dlsym(gles_android,"glClearDepthf"); disp->set_glClearDepthf((glClearDepthf_t)ptr);
- ptr = dlsym(gles_android,"glClipPlanef"); disp->set_glClipPlanef((glClipPlanef_t)ptr);
- ptr = dlsym(gles_android,"glColor4f"); disp->set_glColor4f((glColor4f_t)ptr);
- ptr = dlsym(gles_android,"glDepthRangef"); disp->set_glDepthRangef((glDepthRangef_t)ptr);
- ptr = dlsym(gles_android,"glFogf"); disp->set_glFogf((glFogf_t)ptr);
- ptr = dlsym(gles_android,"glFogfv"); disp->set_glFogfv((glFogfv_t)ptr);
- ptr = dlsym(gles_android,"glFrustumf"); disp->set_glFrustumf((glFrustumf_t)ptr);
- ptr = dlsym(gles_android,"glGetClipPlanef"); disp->set_glGetClipPlanef((glGetClipPlanef_t)ptr);
- ptr = dlsym(gles_android,"glGetFloatv"); disp->set_glGetFloatv((glGetFloatv_t)ptr);
- ptr = dlsym(gles_android,"glGetLightfv"); disp->set_glGetLightfv((glGetLightfv_t)ptr);
- ptr = dlsym(gles_android,"glGetMaterialfv"); disp->set_glGetMaterialfv((glGetMaterialfv_t)ptr);
- ptr = dlsym(gles_android,"glGetTexEnvfv"); disp->set_glGetTexEnvfv((glGetTexEnvfv_t)ptr);
- ptr = dlsym(gles_android,"glGetTexParameterfv"); disp->set_glGetTexParameterfv((glGetTexParameterfv_t)ptr);
- ptr = dlsym(gles_android,"glLightModelf"); disp->set_glLightModelf((glLightModelf_t)ptr);
- ptr = dlsym(gles_android,"glLightModelfv"); disp->set_glLightModelfv((glLightModelfv_t)ptr);
- ptr = dlsym(gles_android,"glLightf"); disp->set_glLightf((glLightf_t)ptr);
- ptr = dlsym(gles_android,"glLightfv"); disp->set_glLightfv((glLightfv_t)ptr);
- ptr = dlsym(gles_android,"glLineWidth"); disp->set_glLineWidth((glLineWidth_t)ptr);
- ptr = dlsym(gles_android,"glLoadMatrixf"); disp->set_glLoadMatrixf((glLoadMatrixf_t)ptr);
- ptr = dlsym(gles_android,"glMaterialf"); disp->set_glMaterialf((glMaterialf_t)ptr);
- ptr = dlsym(gles_android,"glMaterialfv"); disp->set_glMaterialfv((glMaterialfv_t)ptr);
- ptr = dlsym(gles_android,"glMultMatrixf"); disp->set_glMultMatrixf((glMultMatrixf_t)ptr);
- ptr = dlsym(gles_android,"glMultiTexCoord4f"); disp->set_glMultiTexCoord4f((glMultiTexCoord4f_t)ptr);
- ptr = dlsym(gles_android,"glNormal3f"); disp->set_glNormal3f((glNormal3f_t)ptr);
- ptr = dlsym(gles_android,"glOrthof"); disp->set_glOrthof((glOrthof_t)ptr);
- ptr = dlsym(gles_android,"glPointParameterf"); disp->set_glPointParameterf((glPointParameterf_t)ptr);
- ptr = dlsym(gles_android,"glPointParameterfv"); disp->set_glPointParameterfv((glPointParameterfv_t)ptr);
- ptr = dlsym(gles_android,"glPointSize"); disp->set_glPointSize((glPointSize_t)ptr);
- ptr = dlsym(gles_android,"glPolygonOffset"); disp->set_glPolygonOffset((glPolygonOffset_t)ptr);
- ptr = dlsym(gles_android,"glRotatef"); disp->set_glRotatef((glRotatef_t)ptr);
- ptr = dlsym(gles_android,"glScalef"); disp->set_glScalef((glScalef_t)ptr);
- ptr = dlsym(gles_android,"glTexEnvf"); disp->set_glTexEnvf((glTexEnvf_t)ptr);
- ptr = dlsym(gles_android,"glTexEnvfv"); disp->set_glTexEnvfv((glTexEnvfv_t)ptr);
- ptr = dlsym(gles_android,"glTexParameterf"); disp->set_glTexParameterf((glTexParameterf_t)ptr);
- ptr = dlsym(gles_android,"glTexParameterfv"); disp->set_glTexParameterfv((glTexParameterfv_t)ptr);
- ptr = dlsym(gles_android,"glTranslatef"); disp->set_glTranslatef((glTranslatef_t)ptr);
- ptr = dlsym(gles_android,"glActiveTexture"); disp->set_glActiveTexture((glActiveTexture_t)ptr);
- ptr = dlsym(gles_android,"glAlphaFuncx"); disp->set_glAlphaFuncx((glAlphaFuncx_t)ptr);
- ptr = dlsym(gles_android,"glBindBuffer"); disp->set_glBindBuffer((glBindBuffer_t)ptr);
- ptr = dlsym(gles_android,"glBindTexture"); disp->set_glBindTexture((glBindTexture_t)ptr);
- ptr = dlsym(gles_android,"glBlendFunc"); disp->set_glBlendFunc((glBlendFunc_t)ptr);
- ptr = dlsym(gles_android,"glBufferData"); disp->set_glBufferData((glBufferData_t)ptr);
- ptr = dlsym(gles_android,"glBufferSubData"); disp->set_glBufferSubData((glBufferSubData_t)ptr);
- ptr = dlsym(gles_android,"glClear"); disp->set_glClear((glClear_t)ptr);
- ptr = dlsym(gles_android,"glClearColorx"); disp->set_glClearColorx((glClearColorx_t)ptr);
- ptr = dlsym(gles_android,"glClearDepthx"); disp->set_glClearDepthx((glClearDepthx_t)ptr);
- ptr = dlsym(gles_android,"glClearStencil"); disp->set_glClearStencil((glClearStencil_t)ptr);
- ptr = dlsym(gles_android,"glClientActiveTexture"); disp->set_glClientActiveTexture((glClientActiveTexture_t)ptr);
- ptr = dlsym(gles_android,"glClipPlanex"); disp->set_glClipPlanex((glClipPlanex_t)ptr);
- ptr = dlsym(gles_android,"glColor4ub"); disp->set_glColor4ub((glColor4ub_t)ptr);
- ptr = dlsym(gles_android,"glColor4x"); disp->set_glColor4x((glColor4x_t)ptr);
- ptr = dlsym(gles_android,"glColorMask"); disp->set_glColorMask((glColorMask_t)ptr);
- ptr = dlsym(gles_android,"glColorPointer"); disp->set_glColorPointer((glColorPointer_t)ptr);
- ptr = dlsym(gles_android,"glCompressedTexImage2D"); disp->set_glCompressedTexImage2D((glCompressedTexImage2D_t)ptr);
- ptr = dlsym(gles_android,"glCompressedTexSubImage2D"); disp->set_glCompressedTexSubImage2D((glCompressedTexSubImage2D_t)ptr);
- ptr = dlsym(gles_android,"glCopyTexImage2D"); disp->set_glCopyTexImage2D((glCopyTexImage2D_t)ptr);
- ptr = dlsym(gles_android,"glCopyTexSubImage2D"); disp->set_glCopyTexSubImage2D((glCopyTexSubImage2D_t)ptr);
- ptr = dlsym(gles_android,"glCullFace"); disp->set_glCullFace((glCullFace_t)ptr);
- ptr = dlsym(gles_android,"glDeleteBuffers"); disp->set_glDeleteBuffers((glDeleteBuffers_t)ptr);
- ptr = dlsym(gles_android,"glDeleteTextures"); disp->set_glDeleteTextures((glDeleteTextures_t)ptr);
- ptr = dlsym(gles_android,"glDepthFunc"); disp->set_glDepthFunc((glDepthFunc_t)ptr);
- ptr = dlsym(gles_android,"glDepthMask"); disp->set_glDepthMask((glDepthMask_t)ptr);
- ptr = dlsym(gles_android,"glDepthRangex"); disp->set_glDepthRangex((glDepthRangex_t)ptr);
- ptr = dlsym(gles_android,"glDisable"); disp->set_glDisable((glDisable_t)ptr);
- ptr = dlsym(gles_android,"glDisableClientState"); disp->set_glDisableClientState((glDisableClientState_t)ptr);
- ptr = dlsym(gles_android,"glDrawArrays"); disp->set_glDrawArrays((glDrawArrays_t)ptr);
- ptr = dlsym(gles_android,"glDrawElements"); disp->set_glDrawElements((glDrawElements_t)ptr);
- ptr = dlsym(gles_android,"glEnable"); disp->set_glEnable((glEnable_t)ptr);
- ptr = dlsym(gles_android,"glEnableClientState"); disp->set_glEnableClientState((glEnableClientState_t)ptr);
- ptr = dlsym(gles_android,"glFinish"); disp->set_glFinish((glFinish_t)ptr);
- ptr = dlsym(gles_android,"glFlush"); disp->set_glFlush((glFlush_t)ptr);
- ptr = dlsym(gles_android,"glFogx"); disp->set_glFogx((glFogx_t)ptr);
- ptr = dlsym(gles_android,"glFogxv"); disp->set_glFogxv((glFogxv_t)ptr);
- ptr = dlsym(gles_android,"glFrontFace"); disp->set_glFrontFace((glFrontFace_t)ptr);
- ptr = dlsym(gles_android,"glFrustumx"); disp->set_glFrustumx((glFrustumx_t)ptr);
- ptr = dlsym(gles_android,"glGetBooleanv"); disp->set_glGetBooleanv((glGetBooleanv_t)ptr);
- ptr = dlsym(gles_android,"glGetBufferParameteriv"); disp->set_glGetBufferParameteriv((glGetBufferParameteriv_t)ptr);
- ptr = dlsym(gles_android,"glGetClipPlanex"); disp->set_glGetClipPlanex((glGetClipPlanex_t)ptr);
- ptr = dlsym(gles_android,"glGenBuffers"); disp->set_glGenBuffers((glGenBuffers_t)ptr);
- ptr = dlsym(gles_android,"glGenTextures"); disp->set_glGenTextures((glGenTextures_t)ptr);
- ptr = dlsym(gles_android,"glGetError"); disp->set_glGetError((glGetError_t)ptr);
- ptr = dlsym(gles_android,"glGetFixedv"); disp->set_glGetFixedv((glGetFixedv_t)ptr);
- ptr = dlsym(gles_android,"glGetIntegerv"); disp->set_glGetIntegerv((glGetIntegerv_t)ptr);
- ptr = dlsym(gles_android,"glGetLightxv"); disp->set_glGetLightxv((glGetLightxv_t)ptr);
- ptr = dlsym(gles_android,"glGetMaterialxv"); disp->set_glGetMaterialxv((glGetMaterialxv_t)ptr);
- ptr = dlsym(gles_android,"glGetPointerv"); disp->set_glGetPointerv((glGetPointerv_t)ptr);
- ptr = dlsym(gles_android,"glGetString"); disp->set_glGetString((glGetString_t)ptr);
- ptr = dlsym(gles_android,"glGetTexEnviv"); disp->set_glGetTexEnviv((glGetTexEnviv_t)ptr);
- ptr = dlsym(gles_android,"glGetTexEnvxv"); disp->set_glGetTexEnvxv((glGetTexEnvxv_t)ptr);
- ptr = dlsym(gles_android,"glGetTexParameteriv"); disp->set_glGetTexParameteriv((glGetTexParameteriv_t)ptr);
- ptr = dlsym(gles_android,"glGetTexParameterxv"); disp->set_glGetTexParameterxv((glGetTexParameterxv_t)ptr);
- ptr = dlsym(gles_android,"glHint"); disp->set_glHint((glHint_t)ptr);
- ptr = dlsym(gles_android,"glIsBuffer"); disp->set_glIsBuffer((glIsBuffer_t)ptr);
- ptr = dlsym(gles_android,"glIsEnabled"); disp->set_glIsEnabled((glIsEnabled_t)ptr);
- ptr = dlsym(gles_android,"glIsTexture"); disp->set_glIsTexture((glIsTexture_t)ptr);
- ptr = dlsym(gles_android,"glLightModelx"); disp->set_glLightModelx((glLightModelx_t)ptr);
- ptr = dlsym(gles_android,"glLightModelxv"); disp->set_glLightModelxv((glLightModelxv_t)ptr);
- ptr = dlsym(gles_android,"glLightx"); disp->set_glLightx((glLightx_t)ptr);
- ptr = dlsym(gles_android,"glLightxv"); disp->set_glLightxv((glLightxv_t)ptr);
- ptr = dlsym(gles_android,"glLineWidthx"); disp->set_glLineWidthx((glLineWidthx_t)ptr);
- ptr = dlsym(gles_android,"glLoadIdentity"); disp->set_glLoadIdentity((glLoadIdentity_t)ptr);
- ptr = dlsym(gles_android,"glLoadMatrixx"); disp->set_glLoadMatrixx((glLoadMatrixx_t)ptr);
- ptr = dlsym(gles_android,"glLogicOp"); disp->set_glLogicOp((glLogicOp_t)ptr);
- ptr = dlsym(gles_android,"glMaterialx"); disp->set_glMaterialx((glMaterialx_t)ptr);
- ptr = dlsym(gles_android,"glMaterialxv"); disp->set_glMaterialxv((glMaterialxv_t)ptr);
- ptr = dlsym(gles_android,"glMatrixMode"); disp->set_glMatrixMode((glMatrixMode_t)ptr);
- ptr = dlsym(gles_android,"glMultMatrixx"); disp->set_glMultMatrixx((glMultMatrixx_t)ptr);
- ptr = dlsym(gles_android,"glMultiTexCoord4x"); disp->set_glMultiTexCoord4x((glMultiTexCoord4x_t)ptr);
- ptr = dlsym(gles_android,"glNormal3x"); disp->set_glNormal3x((glNormal3x_t)ptr);
- ptr = dlsym(gles_android,"glNormalPointer"); disp->set_glNormalPointer((glNormalPointer_t)ptr);
- ptr = dlsym(gles_android,"glOrthox"); disp->set_glOrthox((glOrthox_t)ptr);
- ptr = dlsym(gles_android,"glPixelStorei"); disp->set_glPixelStorei((glPixelStorei_t)ptr);
- ptr = dlsym(gles_android,"glPointParameterx"); disp->set_glPointParameterx((glPointParameterx_t)ptr);
- ptr = dlsym(gles_android,"glPointParameterxv"); disp->set_glPointParameterxv((glPointParameterxv_t)ptr);
- ptr = dlsym(gles_android,"glPointSizex"); disp->set_glPointSizex((glPointSizex_t)ptr);
- ptr = dlsym(gles_android,"glPolygonOffsetx"); disp->set_glPolygonOffsetx((glPolygonOffsetx_t)ptr);
- ptr = dlsym(gles_android,"glPopMatrix"); disp->set_glPopMatrix((glPopMatrix_t)ptr);
- ptr = dlsym(gles_android,"glPushMatrix"); disp->set_glPushMatrix((glPushMatrix_t)ptr);
- ptr = dlsym(gles_android,"glReadPixels"); disp->set_glReadPixels((glReadPixels_t)ptr);
- ptr = dlsym(gles_android,"glRotatex"); disp->set_glRotatex((glRotatex_t)ptr);
- ptr = dlsym(gles_android,"glSampleCoverage"); disp->set_glSampleCoverage((glSampleCoverage_t)ptr);
- ptr = dlsym(gles_android,"glSampleCoveragex"); disp->set_glSampleCoveragex((glSampleCoveragex_t)ptr);
- ptr = dlsym(gles_android,"glScalex"); disp->set_glScalex((glScalex_t)ptr);
- ptr = dlsym(gles_android,"glScissor"); disp->set_glScissor((glScissor_t)ptr);
- ptr = dlsym(gles_android,"glShadeModel"); disp->set_glShadeModel((glShadeModel_t)ptr);
- ptr = dlsym(gles_android,"glStencilFunc"); disp->set_glStencilFunc((glStencilFunc_t)ptr);
- ptr = dlsym(gles_android,"glStencilMask"); disp->set_glStencilMask((glStencilMask_t)ptr);
- ptr = dlsym(gles_android,"glStencilOp"); disp->set_glStencilOp((glStencilOp_t)ptr);
- ptr = dlsym(gles_android,"glTexCoordPointer"); disp->set_glTexCoordPointer((glTexCoordPointer_t)ptr);
- ptr = dlsym(gles_android,"glTexEnvi"); disp->set_glTexEnvi((glTexEnvi_t)ptr);
- ptr = dlsym(gles_android,"glTexEnvx"); disp->set_glTexEnvx((glTexEnvx_t)ptr);
- ptr = dlsym(gles_android,"glTexEnviv"); disp->set_glTexEnviv((glTexEnviv_t)ptr);
- ptr = dlsym(gles_android,"glTexEnvxv"); disp->set_glTexEnvxv((glTexEnvxv_t)ptr);
- ptr = dlsym(gles_android,"glTexImage2D"); disp->set_glTexImage2D((glTexImage2D_t)ptr);
- ptr = dlsym(gles_android,"glTexParameteri"); disp->set_glTexParameteri((glTexParameteri_t)ptr);
- ptr = dlsym(gles_android,"glTexParameterx"); disp->set_glTexParameterx((glTexParameterx_t)ptr);
- ptr = dlsym(gles_android,"glTexParameteriv"); disp->set_glTexParameteriv((glTexParameteriv_t)ptr);
- ptr = dlsym(gles_android,"glTexParameterxv"); disp->set_glTexParameterxv((glTexParameterxv_t)ptr);
- ptr = dlsym(gles_android,"glTexSubImage2D"); disp->set_glTexSubImage2D((glTexSubImage2D_t)ptr);
- ptr = dlsym(gles_android,"glTranslatex"); disp->set_glTranslatex((glTranslatex_t)ptr);
- ptr = dlsym(gles_android,"glVertexPointer"); disp->set_glVertexPointer((glVertexPointer_t)ptr);
- ptr = dlsym(gles_android,"glViewport"); disp->set_glViewport((glViewport_t)ptr);
- ptr = dlsym(gles_android,"glPointSizePointerOES"); disp->set_glPointSizePointerOES((glPointSizePointerOES_t)ptr);
- ptr = dlsym(gles_android,"glBlendEquationSeparateOES"); disp->set_glBlendEquationSeparateOES((glBlendEquationSeparateOES_t)ptr);
- ptr = dlsym(gles_android,"glBlendFuncSeparateOES"); disp->set_glBlendFuncSeparateOES((glBlendFuncSeparateOES_t)ptr);
- ptr = dlsym(gles_android,"glBlendEquationOES"); disp->set_glBlendEquationOES((glBlendEquationOES_t)ptr);
- ptr = dlsym(gles_android,"glDrawTexsOES"); disp->set_glDrawTexsOES((glDrawTexsOES_t)ptr);
- ptr = dlsym(gles_android,"glDrawTexiOES"); disp->set_glDrawTexiOES((glDrawTexiOES_t)ptr);
- ptr = dlsym(gles_android,"glDrawTexxOES"); disp->set_glDrawTexxOES((glDrawTexxOES_t)ptr);
- ptr = dlsym(gles_android,"glDrawTexsvOES"); disp->set_glDrawTexsvOES((glDrawTexsvOES_t)ptr);
- ptr = dlsym(gles_android,"glDrawTexivOES"); disp->set_glDrawTexivOES((glDrawTexivOES_t)ptr);
- ptr = dlsym(gles_android,"glDrawTexxvOES"); disp->set_glDrawTexxvOES((glDrawTexxvOES_t)ptr);
- ptr = dlsym(gles_android,"glDrawTexfOES"); disp->set_glDrawTexfOES((glDrawTexfOES_t)ptr);
- ptr = dlsym(gles_android,"glDrawTexfvOES"); disp->set_glDrawTexfvOES((glDrawTexfvOES_t)ptr);
- ptr = dlsym(gles_android,"glEGLImageTargetTexture2DOES"); disp->set_glEGLImageTargetTexture2DOES((glEGLImageTargetTexture2DOES_t)ptr);
- ptr = dlsym(gles_android,"glEGLImageTargetRenderbufferStorageOES"); disp->set_glEGLImageTargetRenderbufferStorageOES((glEGLImageTargetRenderbufferStorageOES_t)ptr);
- ptr = dlsym(gles_android,"glAlphaFuncxOES"); disp->set_glAlphaFuncxOES((glAlphaFuncxOES_t)ptr);
- ptr = dlsym(gles_android,"glClearColorxOES"); disp->set_glClearColorxOES((glClearColorxOES_t)ptr);
- ptr = dlsym(gles_android,"glClearDepthxOES"); disp->set_glClearDepthxOES((glClearDepthxOES_t)ptr);
- ptr = dlsym(gles_android,"glClipPlanexOES"); disp->set_glClipPlanexOES((glClipPlanexOES_t)ptr);
- ptr = dlsym(gles_android,"glColor4xOES"); disp->set_glColor4xOES((glColor4xOES_t)ptr);
- ptr = dlsym(gles_android,"glDepthRangexOES"); disp->set_glDepthRangexOES((glDepthRangexOES_t)ptr);
- ptr = dlsym(gles_android,"glFogxOES"); disp->set_glFogxOES((glFogxOES_t)ptr);
- ptr = dlsym(gles_android,"glFogxvOES"); disp->set_glFogxvOES((glFogxvOES_t)ptr);
- ptr = dlsym(gles_android,"glFrustumxOES"); disp->set_glFrustumxOES((glFrustumxOES_t)ptr);
- ptr = dlsym(gles_android,"glGetClipPlanexOES"); disp->set_glGetClipPlanexOES((glGetClipPlanexOES_t)ptr);
- ptr = dlsym(gles_android,"glGetFixedvOES"); disp->set_glGetFixedvOES((glGetFixedvOES_t)ptr);
- ptr = dlsym(gles_android,"glGetLightxvOES"); disp->set_glGetLightxvOES((glGetLightxvOES_t)ptr);
- ptr = dlsym(gles_android,"glGetMaterialxvOES"); disp->set_glGetMaterialxvOES((glGetMaterialxvOES_t)ptr);
- ptr = dlsym(gles_android,"glGetTexEnvxvOES"); disp->set_glGetTexEnvxvOES((glGetTexEnvxvOES_t)ptr);
- ptr = dlsym(gles_android,"glGetTexParameterxvOES"); disp->set_glGetTexParameterxvOES((glGetTexParameterxvOES_t)ptr);
- ptr = dlsym(gles_android,"glLightModelxOES"); disp->set_glLightModelxOES((glLightModelxOES_t)ptr);
- ptr = dlsym(gles_android,"glLightModelxvOES"); disp->set_glLightModelxvOES((glLightModelxvOES_t)ptr);
- ptr = dlsym(gles_android,"glLightxOES"); disp->set_glLightxOES((glLightxOES_t)ptr);
- ptr = dlsym(gles_android,"glLightxvOES"); disp->set_glLightxvOES((glLightxvOES_t)ptr);
- ptr = dlsym(gles_android,"glLineWidthxOES"); disp->set_glLineWidthxOES((glLineWidthxOES_t)ptr);
- ptr = dlsym(gles_android,"glLoadMatrixxOES"); disp->set_glLoadMatrixxOES((glLoadMatrixxOES_t)ptr);
- ptr = dlsym(gles_android,"glMaterialxOES"); disp->set_glMaterialxOES((glMaterialxOES_t)ptr);
- ptr = dlsym(gles_android,"glMaterialxvOES"); disp->set_glMaterialxvOES((glMaterialxvOES_t)ptr);
- ptr = dlsym(gles_android,"glMultMatrixxOES"); disp->set_glMultMatrixxOES((glMultMatrixxOES_t)ptr);
- ptr = dlsym(gles_android,"glMultiTexCoord4xOES"); disp->set_glMultiTexCoord4xOES((glMultiTexCoord4xOES_t)ptr);
- ptr = dlsym(gles_android,"glNormal3xOES"); disp->set_glNormal3xOES((glNormal3xOES_t)ptr);
- ptr = dlsym(gles_android,"glOrthoxOES"); disp->set_glOrthoxOES((glOrthoxOES_t)ptr);
- ptr = dlsym(gles_android,"glPointParameterxOES"); disp->set_glPointParameterxOES((glPointParameterxOES_t)ptr);
- ptr = dlsym(gles_android,"glPointParameterxvOES"); disp->set_glPointParameterxvOES((glPointParameterxvOES_t)ptr);
- ptr = dlsym(gles_android,"glPointSizexOES"); disp->set_glPointSizexOES((glPointSizexOES_t)ptr);
- ptr = dlsym(gles_android,"glPolygonOffsetxOES"); disp->set_glPolygonOffsetxOES((glPolygonOffsetxOES_t)ptr);
- ptr = dlsym(gles_android,"glRotatexOES"); disp->set_glRotatexOES((glRotatexOES_t)ptr);
- ptr = dlsym(gles_android,"glSampleCoveragexOES"); disp->set_glSampleCoveragexOES((glSampleCoveragexOES_t)ptr);
- ptr = dlsym(gles_android,"glScalexOES"); disp->set_glScalexOES((glScalexOES_t)ptr);
- ptr = dlsym(gles_android,"glTexEnvxOES"); disp->set_glTexEnvxOES((glTexEnvxOES_t)ptr);
- ptr = dlsym(gles_android,"glTexEnvxvOES"); disp->set_glTexEnvxvOES((glTexEnvxvOES_t)ptr);
- ptr = dlsym(gles_android,"glTexParameterxOES"); disp->set_glTexParameterxOES((glTexParameterxOES_t)ptr);
- ptr = dlsym(gles_android,"glTexParameterxvOES"); disp->set_glTexParameterxvOES((glTexParameterxvOES_t)ptr);
- ptr = dlsym(gles_android,"glTranslatexOES"); disp->set_glTranslatexOES((glTranslatexOES_t)ptr);
- ptr = dlsym(gles_android,"glIsRenderbufferOES"); disp->set_glIsRenderbufferOES((glIsRenderbufferOES_t)ptr);
- ptr = dlsym(gles_android,"glBindRenderbufferOES"); disp->set_glBindRenderbufferOES((glBindRenderbufferOES_t)ptr);
- ptr = dlsym(gles_android,"glDeleteRenderbuffersOES"); disp->set_glDeleteRenderbuffersOES((glDeleteRenderbuffersOES_t)ptr);
- ptr = dlsym(gles_android,"glGenRenderbuffersOES"); disp->set_glGenRenderbuffersOES((glGenRenderbuffersOES_t)ptr);
- ptr = dlsym(gles_android,"glRenderbufferStorageOES"); disp->set_glRenderbufferStorageOES((glRenderbufferStorageOES_t)ptr);
- ptr = dlsym(gles_android,"glGetRenderbufferParameterivOES"); disp->set_glGetRenderbufferParameterivOES((glGetRenderbufferParameterivOES_t)ptr);
- ptr = dlsym(gles_android,"glIsFramebufferOES"); disp->set_glIsFramebufferOES((glIsFramebufferOES_t)ptr);
- ptr = dlsym(gles_android,"glBindFramebufferOES"); disp->set_glBindFramebufferOES((glBindFramebufferOES_t)ptr);
- ptr = dlsym(gles_android,"glDeleteFramebuffersOES"); disp->set_glDeleteFramebuffersOES((glDeleteFramebuffersOES_t)ptr);
- ptr = dlsym(gles_android,"glGenFramebuffersOES"); disp->set_glGenFramebuffersOES((glGenFramebuffersOES_t)ptr);
- ptr = dlsym(gles_android,"glCheckFramebufferStatusOES"); disp->set_glCheckFramebufferStatusOES((glCheckFramebufferStatusOES_t)ptr);
- ptr = dlsym(gles_android,"glFramebufferRenderbufferOES"); disp->set_glFramebufferRenderbufferOES((glFramebufferRenderbufferOES_t)ptr);
- ptr = dlsym(gles_android,"glFramebufferTexture2DOES"); disp->set_glFramebufferTexture2DOES((glFramebufferTexture2DOES_t)ptr);
- ptr = dlsym(gles_android,"glGetFramebufferAttachmentParameterivOES"); disp->set_glGetFramebufferAttachmentParameterivOES((glGetFramebufferAttachmentParameterivOES_t)ptr);
- ptr = dlsym(gles_android,"glGenerateMipmapOES"); disp->set_glGenerateMipmapOES((glGenerateMipmapOES_t)ptr);
- ptr = dlsym(gles_android,"glMapBufferOES"); disp->set_glMapBufferOES((glMapBufferOES_t)ptr);
- ptr = dlsym(gles_android,"glUnmapBufferOES"); disp->set_glUnmapBufferOES((glUnmapBufferOES_t)ptr);
- ptr = dlsym(gles_android,"glGetBufferPointervOES"); disp->set_glGetBufferPointervOES((glGetBufferPointervOES_t)ptr);
- ptr = dlsym(gles_android,"glCurrentPaletteMatrixOES"); disp->set_glCurrentPaletteMatrixOES((glCurrentPaletteMatrixOES_t)ptr);
- ptr = dlsym(gles_android,"glLoadPaletteFromModelViewMatrixOES"); disp->set_glLoadPaletteFromModelViewMatrixOES((glLoadPaletteFromModelViewMatrixOES_t)ptr);
- ptr = dlsym(gles_android,"glMatrixIndexPointerOES"); disp->set_glMatrixIndexPointerOES((glMatrixIndexPointerOES_t)ptr);
- ptr = dlsym(gles_android,"glWeightPointerOES"); disp->set_glWeightPointerOES((glWeightPointerOES_t)ptr);
- ptr = dlsym(gles_android,"glQueryMatrixxOES"); disp->set_glQueryMatrixxOES((glQueryMatrixxOES_t)ptr);
- ptr = dlsym(gles_android,"glDepthRangefOES"); disp->set_glDepthRangefOES((glDepthRangefOES_t)ptr);
- ptr = dlsym(gles_android,"glFrustumfOES"); disp->set_glFrustumfOES((glFrustumfOES_t)ptr);
- ptr = dlsym(gles_android,"glOrthofOES"); disp->set_glOrthofOES((glOrthofOES_t)ptr);
- ptr = dlsym(gles_android,"glClipPlanefOES"); disp->set_glClipPlanefOES((glClipPlanefOES_t)ptr);
- ptr = dlsym(gles_android,"glGetClipPlanefOES"); disp->set_glGetClipPlanefOES((glGetClipPlanefOES_t)ptr);
- ptr = dlsym(gles_android,"glClearDepthfOES"); disp->set_glClearDepthfOES((glClearDepthfOES_t)ptr);
- ptr = dlsym(gles_android,"glTexGenfOES"); disp->set_glTexGenfOES((glTexGenfOES_t)ptr);
- ptr = dlsym(gles_android,"glTexGenfvOES"); disp->set_glTexGenfvOES((glTexGenfvOES_t)ptr);
- ptr = dlsym(gles_android,"glTexGeniOES"); disp->set_glTexGeniOES((glTexGeniOES_t)ptr);
- ptr = dlsym(gles_android,"glTexGenivOES"); disp->set_glTexGenivOES((glTexGenivOES_t)ptr);
- ptr = dlsym(gles_android,"glTexGenxOES"); disp->set_glTexGenxOES((glTexGenxOES_t)ptr);
- ptr = dlsym(gles_android,"glTexGenxvOES"); disp->set_glTexGenxvOES((glTexGenxvOES_t)ptr);
- ptr = dlsym(gles_android,"glGetTexGenfvOES"); disp->set_glGetTexGenfvOES((glGetTexGenfvOES_t)ptr);
- ptr = dlsym(gles_android,"glGetTexGenivOES"); disp->set_glGetTexGenivOES((glGetTexGenivOES_t)ptr);
- ptr = dlsym(gles_android,"glGetTexGenxvOES"); disp->set_glGetTexGenxvOES((glGetTexGenxvOES_t)ptr);
- ptr = dlsym(gles_android,"glBindVertexArrayOES"); disp->set_glBindVertexArrayOES((glBindVertexArrayOES_t)ptr);
- ptr = dlsym(gles_android,"glDeleteVertexArraysOES"); disp->set_glDeleteVertexArraysOES((glDeleteVertexArraysOES_t)ptr);
- ptr = dlsym(gles_android,"glGenVertexArraysOES"); disp->set_glGenVertexArraysOES((glGenVertexArraysOES_t)ptr);
- ptr = dlsym(gles_android,"glIsVertexArrayOES"); disp->set_glIsVertexArrayOES((glIsVertexArrayOES_t)ptr);
- ptr = dlsym(gles_android,"glDiscardFramebufferEXT"); disp->set_glDiscardFramebufferEXT((glDiscardFramebufferEXT_t)ptr);
- ptr = dlsym(gles_android,"glMultiDrawArraysEXT"); disp->set_glMultiDrawArraysEXT((glMultiDrawArraysEXT_t)ptr);
- ptr = dlsym(gles_android,"glMultiDrawElementsEXT"); disp->set_glMultiDrawElementsEXT((glMultiDrawElementsEXT_t)ptr);
- ptr = dlsym(gles_android,"glClipPlanefIMG"); disp->set_glClipPlanefIMG((glClipPlanefIMG_t)ptr);
- ptr = dlsym(gles_android,"glClipPlanexIMG"); disp->set_glClipPlanexIMG((glClipPlanexIMG_t)ptr);
- ptr = dlsym(gles_android,"glRenderbufferStorageMultisampleIMG"); disp->set_glRenderbufferStorageMultisampleIMG((glRenderbufferStorageMultisampleIMG_t)ptr);
- ptr = dlsym(gles_android,"glFramebufferTexture2DMultisampleIMG"); disp->set_glFramebufferTexture2DMultisampleIMG((glFramebufferTexture2DMultisampleIMG_t)ptr);
- ptr = dlsym(gles_android,"glDeleteFencesNV"); disp->set_glDeleteFencesNV((glDeleteFencesNV_t)ptr);
- ptr = dlsym(gles_android,"glGenFencesNV"); disp->set_glGenFencesNV((glGenFencesNV_t)ptr);
- ptr = dlsym(gles_android,"glIsFenceNV"); disp->set_glIsFenceNV((glIsFenceNV_t)ptr);
- ptr = dlsym(gles_android,"glTestFenceNV"); disp->set_glTestFenceNV((glTestFenceNV_t)ptr);
- ptr = dlsym(gles_android,"glGetFenceivNV"); disp->set_glGetFenceivNV((glGetFenceivNV_t)ptr);
- ptr = dlsym(gles_android,"glFinishFenceNV"); disp->set_glFinishFenceNV((glFinishFenceNV_t)ptr);
- ptr = dlsym(gles_android,"glSetFenceNV"); disp->set_glSetFenceNV((glSetFenceNV_t)ptr);
- ptr = dlsym(gles_android,"glGetDriverControlsQCOM"); disp->set_glGetDriverControlsQCOM((glGetDriverControlsQCOM_t)ptr);
- ptr = dlsym(gles_android,"glGetDriverControlStringQCOM"); disp->set_glGetDriverControlStringQCOM((glGetDriverControlStringQCOM_t)ptr);
- ptr = dlsym(gles_android,"glEnableDriverControlQCOM"); disp->set_glEnableDriverControlQCOM((glEnableDriverControlQCOM_t)ptr);
- ptr = dlsym(gles_android,"glDisableDriverControlQCOM"); disp->set_glDisableDriverControlQCOM((glDisableDriverControlQCOM_t)ptr);
- ptr = dlsym(gles_android,"glExtGetTexturesQCOM"); disp->set_glExtGetTexturesQCOM((glExtGetTexturesQCOM_t)ptr);
- ptr = dlsym(gles_android,"glExtGetBuffersQCOM"); disp->set_glExtGetBuffersQCOM((glExtGetBuffersQCOM_t)ptr);
- ptr = dlsym(gles_android,"glExtGetRenderbuffersQCOM"); disp->set_glExtGetRenderbuffersQCOM((glExtGetRenderbuffersQCOM_t)ptr);
- ptr = dlsym(gles_android,"glExtGetFramebuffersQCOM"); disp->set_glExtGetFramebuffersQCOM((glExtGetFramebuffersQCOM_t)ptr);
- ptr = dlsym(gles_android,"glExtGetTexLevelParameterivQCOM"); disp->set_glExtGetTexLevelParameterivQCOM((glExtGetTexLevelParameterivQCOM_t)ptr);
- ptr = dlsym(gles_android,"glExtTexObjectStateOverrideiQCOM"); disp->set_glExtTexObjectStateOverrideiQCOM((glExtTexObjectStateOverrideiQCOM_t)ptr);
- ptr = dlsym(gles_android,"glExtGetTexSubImageQCOM"); disp->set_glExtGetTexSubImageQCOM((glExtGetTexSubImageQCOM_t)ptr);
- ptr = dlsym(gles_android,"glExtGetBufferPointervQCOM"); disp->set_glExtGetBufferPointervQCOM((glExtGetBufferPointervQCOM_t)ptr);
- ptr = dlsym(gles_android,"glExtGetShadersQCOM"); disp->set_glExtGetShadersQCOM((glExtGetShadersQCOM_t)ptr);
- ptr = dlsym(gles_android,"glExtGetProgramsQCOM"); disp->set_glExtGetProgramsQCOM((glExtGetProgramsQCOM_t)ptr);
- ptr = dlsym(gles_android,"glExtIsProgramBinaryQCOM"); disp->set_glExtIsProgramBinaryQCOM((glExtIsProgramBinaryQCOM_t)ptr);
- ptr = dlsym(gles_android,"glExtGetProgramBinarySourceQCOM"); disp->set_glExtGetProgramBinarySourceQCOM((glExtGetProgramBinarySourceQCOM_t)ptr);
- ptr = dlsym(gles_android,"glStartTilingQCOM"); disp->set_glStartTilingQCOM((glStartTilingQCOM_t)ptr);
- ptr = dlsym(gles_android,"glEndTilingQCOM"); disp->set_glEndTilingQCOM((glEndTilingQCOM_t)ptr);
-
- return disp;
-}
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/gles_dispatch.h b/tools/emulator/opengl/tests/gles_android_wrapper/gles_dispatch.h
deleted file mode 100644
index 98a4fcaeb..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/gles_dispatch.h
+++ /dev/null
@@ -1,570 +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.
-*/
-#ifndef _GLES_DISPATCH_H
-#define _GLES_DISPATCH_H
-
-#include "gles_proc.h"
-
-
-struct gles_dispatch {
- glAlphaFunc_t glAlphaFunc;
- glClearColor_t glClearColor;
- glClearDepthf_t glClearDepthf;
- glClipPlanef_t glClipPlanef;
- glColor4f_t glColor4f;
- glDepthRangef_t glDepthRangef;
- glFogf_t glFogf;
- glFogfv_t glFogfv;
- glFrustumf_t glFrustumf;
- glGetClipPlanef_t glGetClipPlanef;
- glGetFloatv_t glGetFloatv;
- glGetLightfv_t glGetLightfv;
- glGetMaterialfv_t glGetMaterialfv;
- glGetTexEnvfv_t glGetTexEnvfv;
- glGetTexParameterfv_t glGetTexParameterfv;
- glLightModelf_t glLightModelf;
- glLightModelfv_t glLightModelfv;
- glLightf_t glLightf;
- glLightfv_t glLightfv;
- glLineWidth_t glLineWidth;
- glLoadMatrixf_t glLoadMatrixf;
- glMaterialf_t glMaterialf;
- glMaterialfv_t glMaterialfv;
- glMultMatrixf_t glMultMatrixf;
- glMultiTexCoord4f_t glMultiTexCoord4f;
- glNormal3f_t glNormal3f;
- glOrthof_t glOrthof;
- glPointParameterf_t glPointParameterf;
- glPointParameterfv_t glPointParameterfv;
- glPointSize_t glPointSize;
- glPolygonOffset_t glPolygonOffset;
- glRotatef_t glRotatef;
- glScalef_t glScalef;
- glTexEnvf_t glTexEnvf;
- glTexEnvfv_t glTexEnvfv;
- glTexParameterf_t glTexParameterf;
- glTexParameterfv_t glTexParameterfv;
- glTranslatef_t glTranslatef;
- glActiveTexture_t glActiveTexture;
- glAlphaFuncx_t glAlphaFuncx;
- glBindBuffer_t glBindBuffer;
- glBindTexture_t glBindTexture;
- glBlendFunc_t glBlendFunc;
- glBufferData_t glBufferData;
- glBufferSubData_t glBufferSubData;
- glClear_t glClear;
- glClearColorx_t glClearColorx;
- glClearDepthx_t glClearDepthx;
- glClearStencil_t glClearStencil;
- glClientActiveTexture_t glClientActiveTexture;
- glClipPlanex_t glClipPlanex;
- glColor4ub_t glColor4ub;
- glColor4x_t glColor4x;
- glColorMask_t glColorMask;
- glColorPointer_t glColorPointer;
- glCompressedTexImage2D_t glCompressedTexImage2D;
- glCompressedTexSubImage2D_t glCompressedTexSubImage2D;
- glCopyTexImage2D_t glCopyTexImage2D;
- glCopyTexSubImage2D_t glCopyTexSubImage2D;
- glCullFace_t glCullFace;
- glDeleteBuffers_t glDeleteBuffers;
- glDeleteTextures_t glDeleteTextures;
- glDepthFunc_t glDepthFunc;
- glDepthMask_t glDepthMask;
- glDepthRangex_t glDepthRangex;
- glDisable_t glDisable;
- glDisableClientState_t glDisableClientState;
- glDrawArrays_t glDrawArrays;
- glDrawElements_t glDrawElements;
- glEnable_t glEnable;
- glEnableClientState_t glEnableClientState;
- glFinish_t glFinish;
- glFlush_t glFlush;
- glFogx_t glFogx;
- glFogxv_t glFogxv;
- glFrontFace_t glFrontFace;
- glFrustumx_t glFrustumx;
- glGetBooleanv_t glGetBooleanv;
- glGetBufferParameteriv_t glGetBufferParameteriv;
- glGetClipPlanex_t glGetClipPlanex;
- glGenBuffers_t glGenBuffers;
- glGenTextures_t glGenTextures;
- glGetError_t glGetError;
- glGetFixedv_t glGetFixedv;
- glGetIntegerv_t glGetIntegerv;
- glGetLightxv_t glGetLightxv;
- glGetMaterialxv_t glGetMaterialxv;
- glGetPointerv_t glGetPointerv;
- glGetString_t glGetString;
- glGetTexEnviv_t glGetTexEnviv;
- glGetTexEnvxv_t glGetTexEnvxv;
- glGetTexParameteriv_t glGetTexParameteriv;
- glGetTexParameterxv_t glGetTexParameterxv;
- glHint_t glHint;
- glIsBuffer_t glIsBuffer;
- glIsEnabled_t glIsEnabled;
- glIsTexture_t glIsTexture;
- glLightModelx_t glLightModelx;
- glLightModelxv_t glLightModelxv;
- glLightx_t glLightx;
- glLightxv_t glLightxv;
- glLineWidthx_t glLineWidthx;
- glLoadIdentity_t glLoadIdentity;
- glLoadMatrixx_t glLoadMatrixx;
- glLogicOp_t glLogicOp;
- glMaterialx_t glMaterialx;
- glMaterialxv_t glMaterialxv;
- glMatrixMode_t glMatrixMode;
- glMultMatrixx_t glMultMatrixx;
- glMultiTexCoord4x_t glMultiTexCoord4x;
- glNormal3x_t glNormal3x;
- glNormalPointer_t glNormalPointer;
- glOrthox_t glOrthox;
- glPixelStorei_t glPixelStorei;
- glPointParameterx_t glPointParameterx;
- glPointParameterxv_t glPointParameterxv;
- glPointSizex_t glPointSizex;
- glPolygonOffsetx_t glPolygonOffsetx;
- glPopMatrix_t glPopMatrix;
- glPushMatrix_t glPushMatrix;
- glReadPixels_t glReadPixels;
- glRotatex_t glRotatex;
- glSampleCoverage_t glSampleCoverage;
- glSampleCoveragex_t glSampleCoveragex;
- glScalex_t glScalex;
- glScissor_t glScissor;
- glShadeModel_t glShadeModel;
- glStencilFunc_t glStencilFunc;
- glStencilMask_t glStencilMask;
- glStencilOp_t glStencilOp;
- glTexCoordPointer_t glTexCoordPointer;
- glTexEnvi_t glTexEnvi;
- glTexEnvx_t glTexEnvx;
- glTexEnviv_t glTexEnviv;
- glTexEnvxv_t glTexEnvxv;
- glTexImage2D_t glTexImage2D;
- glTexParameteri_t glTexParameteri;
- glTexParameterx_t glTexParameterx;
- glTexParameteriv_t glTexParameteriv;
- glTexParameterxv_t glTexParameterxv;
- glTexSubImage2D_t glTexSubImage2D;
- glTranslatex_t glTranslatex;
- glVertexPointer_t glVertexPointer;
- glViewport_t glViewport;
- glPointSizePointerOES_t glPointSizePointerOES;
- glBlendEquationSeparateOES_t glBlendEquationSeparateOES;
- glBlendFuncSeparateOES_t glBlendFuncSeparateOES;
- glBlendEquationOES_t glBlendEquationOES;
- glDrawTexsOES_t glDrawTexsOES;
- glDrawTexiOES_t glDrawTexiOES;
- glDrawTexxOES_t glDrawTexxOES;
- glDrawTexsvOES_t glDrawTexsvOES;
- glDrawTexivOES_t glDrawTexivOES;
- glDrawTexxvOES_t glDrawTexxvOES;
- glDrawTexfOES_t glDrawTexfOES;
- glDrawTexfvOES_t glDrawTexfvOES;
- glEGLImageTargetTexture2DOES_t glEGLImageTargetTexture2DOES;
- glEGLImageTargetRenderbufferStorageOES_t glEGLImageTargetRenderbufferStorageOES;
- glAlphaFuncxOES_t glAlphaFuncxOES;
- glClearColorxOES_t glClearColorxOES;
- glClearDepthxOES_t glClearDepthxOES;
- glClipPlanexOES_t glClipPlanexOES;
- glColor4xOES_t glColor4xOES;
- glDepthRangexOES_t glDepthRangexOES;
- glFogxOES_t glFogxOES;
- glFogxvOES_t glFogxvOES;
- glFrustumxOES_t glFrustumxOES;
- glGetClipPlanexOES_t glGetClipPlanexOES;
- glGetFixedvOES_t glGetFixedvOES;
- glGetLightxvOES_t glGetLightxvOES;
- glGetMaterialxvOES_t glGetMaterialxvOES;
- glGetTexEnvxvOES_t glGetTexEnvxvOES;
- glGetTexParameterxvOES_t glGetTexParameterxvOES;
- glLightModelxOES_t glLightModelxOES;
- glLightModelxvOES_t glLightModelxvOES;
- glLightxOES_t glLightxOES;
- glLightxvOES_t glLightxvOES;
- glLineWidthxOES_t glLineWidthxOES;
- glLoadMatrixxOES_t glLoadMatrixxOES;
- glMaterialxOES_t glMaterialxOES;
- glMaterialxvOES_t glMaterialxvOES;
- glMultMatrixxOES_t glMultMatrixxOES;
- glMultiTexCoord4xOES_t glMultiTexCoord4xOES;
- glNormal3xOES_t glNormal3xOES;
- glOrthoxOES_t glOrthoxOES;
- glPointParameterxOES_t glPointParameterxOES;
- glPointParameterxvOES_t glPointParameterxvOES;
- glPointSizexOES_t glPointSizexOES;
- glPolygonOffsetxOES_t glPolygonOffsetxOES;
- glRotatexOES_t glRotatexOES;
- glSampleCoveragexOES_t glSampleCoveragexOES;
- glScalexOES_t glScalexOES;
- glTexEnvxOES_t glTexEnvxOES;
- glTexEnvxvOES_t glTexEnvxvOES;
- glTexParameterxOES_t glTexParameterxOES;
- glTexParameterxvOES_t glTexParameterxvOES;
- glTranslatexOES_t glTranslatexOES;
- glIsRenderbufferOES_t glIsRenderbufferOES;
- glBindRenderbufferOES_t glBindRenderbufferOES;
- glDeleteRenderbuffersOES_t glDeleteRenderbuffersOES;
- glGenRenderbuffersOES_t glGenRenderbuffersOES;
- glRenderbufferStorageOES_t glRenderbufferStorageOES;
- glGetRenderbufferParameterivOES_t glGetRenderbufferParameterivOES;
- glIsFramebufferOES_t glIsFramebufferOES;
- glBindFramebufferOES_t glBindFramebufferOES;
- glDeleteFramebuffersOES_t glDeleteFramebuffersOES;
- glGenFramebuffersOES_t glGenFramebuffersOES;
- glCheckFramebufferStatusOES_t glCheckFramebufferStatusOES;
- glFramebufferRenderbufferOES_t glFramebufferRenderbufferOES;
- glFramebufferTexture2DOES_t glFramebufferTexture2DOES;
- glGetFramebufferAttachmentParameterivOES_t glGetFramebufferAttachmentParameterivOES;
- glGenerateMipmapOES_t glGenerateMipmapOES;
- glMapBufferOES_t glMapBufferOES;
- glUnmapBufferOES_t glUnmapBufferOES;
- glGetBufferPointervOES_t glGetBufferPointervOES;
- glCurrentPaletteMatrixOES_t glCurrentPaletteMatrixOES;
- glLoadPaletteFromModelViewMatrixOES_t glLoadPaletteFromModelViewMatrixOES;
- glMatrixIndexPointerOES_t glMatrixIndexPointerOES;
- glWeightPointerOES_t glWeightPointerOES;
- glQueryMatrixxOES_t glQueryMatrixxOES;
- glDepthRangefOES_t glDepthRangefOES;
- glFrustumfOES_t glFrustumfOES;
- glOrthofOES_t glOrthofOES;
- glClipPlanefOES_t glClipPlanefOES;
- glGetClipPlanefOES_t glGetClipPlanefOES;
- glClearDepthfOES_t glClearDepthfOES;
- glTexGenfOES_t glTexGenfOES;
- glTexGenfvOES_t glTexGenfvOES;
- glTexGeniOES_t glTexGeniOES;
- glTexGenivOES_t glTexGenivOES;
- glTexGenxOES_t glTexGenxOES;
- glTexGenxvOES_t glTexGenxvOES;
- glGetTexGenfvOES_t glGetTexGenfvOES;
- glGetTexGenivOES_t glGetTexGenivOES;
- glGetTexGenxvOES_t glGetTexGenxvOES;
- glBindVertexArrayOES_t glBindVertexArrayOES;
- glDeleteVertexArraysOES_t glDeleteVertexArraysOES;
- glGenVertexArraysOES_t glGenVertexArraysOES;
- glIsVertexArrayOES_t glIsVertexArrayOES;
- glDiscardFramebufferEXT_t glDiscardFramebufferEXT;
- glMultiDrawArraysEXT_t glMultiDrawArraysEXT;
- glMultiDrawElementsEXT_t glMultiDrawElementsEXT;
- glClipPlanefIMG_t glClipPlanefIMG;
- glClipPlanexIMG_t glClipPlanexIMG;
- glRenderbufferStorageMultisampleIMG_t glRenderbufferStorageMultisampleIMG;
- glFramebufferTexture2DMultisampleIMG_t glFramebufferTexture2DMultisampleIMG;
- glDeleteFencesNV_t glDeleteFencesNV;
- glGenFencesNV_t glGenFencesNV;
- glIsFenceNV_t glIsFenceNV;
- glTestFenceNV_t glTestFenceNV;
- glGetFenceivNV_t glGetFenceivNV;
- glFinishFenceNV_t glFinishFenceNV;
- glSetFenceNV_t glSetFenceNV;
- glGetDriverControlsQCOM_t glGetDriverControlsQCOM;
- glGetDriverControlStringQCOM_t glGetDriverControlStringQCOM;
- glEnableDriverControlQCOM_t glEnableDriverControlQCOM;
- glDisableDriverControlQCOM_t glDisableDriverControlQCOM;
- glExtGetTexturesQCOM_t glExtGetTexturesQCOM;
- glExtGetBuffersQCOM_t glExtGetBuffersQCOM;
- glExtGetRenderbuffersQCOM_t glExtGetRenderbuffersQCOM;
- glExtGetFramebuffersQCOM_t glExtGetFramebuffersQCOM;
- glExtGetTexLevelParameterivQCOM_t glExtGetTexLevelParameterivQCOM;
- glExtTexObjectStateOverrideiQCOM_t glExtTexObjectStateOverrideiQCOM;
- glExtGetTexSubImageQCOM_t glExtGetTexSubImageQCOM;
- glExtGetBufferPointervQCOM_t glExtGetBufferPointervQCOM;
- glExtGetShadersQCOM_t glExtGetShadersQCOM;
- glExtGetProgramsQCOM_t glExtGetProgramsQCOM;
- glExtIsProgramBinaryQCOM_t glExtIsProgramBinaryQCOM;
- glExtGetProgramBinarySourceQCOM_t glExtGetProgramBinarySourceQCOM;
- glStartTilingQCOM_t glStartTilingQCOM;
- glEndTilingQCOM_t glEndTilingQCOM;
- //Accessors
- glAlphaFunc_t set_glAlphaFunc(glAlphaFunc_t f) { glAlphaFunc_t retval = glAlphaFunc; glAlphaFunc = f; return retval;}
- glClearColor_t set_glClearColor(glClearColor_t f) { glClearColor_t retval = glClearColor; glClearColor = f; return retval;}
- glClearDepthf_t set_glClearDepthf(glClearDepthf_t f) { glClearDepthf_t retval = glClearDepthf; glClearDepthf = f; return retval;}
- glClipPlanef_t set_glClipPlanef(glClipPlanef_t f) { glClipPlanef_t retval = glClipPlanef; glClipPlanef = f; return retval;}
- glColor4f_t set_glColor4f(glColor4f_t f) { glColor4f_t retval = glColor4f; glColor4f = f; return retval;}
- glDepthRangef_t set_glDepthRangef(glDepthRangef_t f) { glDepthRangef_t retval = glDepthRangef; glDepthRangef = f; return retval;}
- glFogf_t set_glFogf(glFogf_t f) { glFogf_t retval = glFogf; glFogf = f; return retval;}
- glFogfv_t set_glFogfv(glFogfv_t f) { glFogfv_t retval = glFogfv; glFogfv = f; return retval;}
- glFrustumf_t set_glFrustumf(glFrustumf_t f) { glFrustumf_t retval = glFrustumf; glFrustumf = f; return retval;}
- glGetClipPlanef_t set_glGetClipPlanef(glGetClipPlanef_t f) { glGetClipPlanef_t retval = glGetClipPlanef; glGetClipPlanef = f; return retval;}
- glGetFloatv_t set_glGetFloatv(glGetFloatv_t f) { glGetFloatv_t retval = glGetFloatv; glGetFloatv = f; return retval;}
- glGetLightfv_t set_glGetLightfv(glGetLightfv_t f) { glGetLightfv_t retval = glGetLightfv; glGetLightfv = f; return retval;}
- glGetMaterialfv_t set_glGetMaterialfv(glGetMaterialfv_t f) { glGetMaterialfv_t retval = glGetMaterialfv; glGetMaterialfv = f; return retval;}
- glGetTexEnvfv_t set_glGetTexEnvfv(glGetTexEnvfv_t f) { glGetTexEnvfv_t retval = glGetTexEnvfv; glGetTexEnvfv = f; return retval;}
- glGetTexParameterfv_t set_glGetTexParameterfv(glGetTexParameterfv_t f) { glGetTexParameterfv_t retval = glGetTexParameterfv; glGetTexParameterfv = f; return retval;}
- glLightModelf_t set_glLightModelf(glLightModelf_t f) { glLightModelf_t retval = glLightModelf; glLightModelf = f; return retval;}
- glLightModelfv_t set_glLightModelfv(glLightModelfv_t f) { glLightModelfv_t retval = glLightModelfv; glLightModelfv = f; return retval;}
- glLightf_t set_glLightf(glLightf_t f) { glLightf_t retval = glLightf; glLightf = f; return retval;}
- glLightfv_t set_glLightfv(glLightfv_t f) { glLightfv_t retval = glLightfv; glLightfv = f; return retval;}
- glLineWidth_t set_glLineWidth(glLineWidth_t f) { glLineWidth_t retval = glLineWidth; glLineWidth = f; return retval;}
- glLoadMatrixf_t set_glLoadMatrixf(glLoadMatrixf_t f) { glLoadMatrixf_t retval = glLoadMatrixf; glLoadMatrixf = f; return retval;}
- glMaterialf_t set_glMaterialf(glMaterialf_t f) { glMaterialf_t retval = glMaterialf; glMaterialf = f; return retval;}
- glMaterialfv_t set_glMaterialfv(glMaterialfv_t f) { glMaterialfv_t retval = glMaterialfv; glMaterialfv = f; return retval;}
- glMultMatrixf_t set_glMultMatrixf(glMultMatrixf_t f) { glMultMatrixf_t retval = glMultMatrixf; glMultMatrixf = f; return retval;}
- glMultiTexCoord4f_t set_glMultiTexCoord4f(glMultiTexCoord4f_t f) { glMultiTexCoord4f_t retval = glMultiTexCoord4f; glMultiTexCoord4f = f; return retval;}
- glNormal3f_t set_glNormal3f(glNormal3f_t f) { glNormal3f_t retval = glNormal3f; glNormal3f = f; return retval;}
- glOrthof_t set_glOrthof(glOrthof_t f) { glOrthof_t retval = glOrthof; glOrthof = f; return retval;}
- glPointParameterf_t set_glPointParameterf(glPointParameterf_t f) { glPointParameterf_t retval = glPointParameterf; glPointParameterf = f; return retval;}
- glPointParameterfv_t set_glPointParameterfv(glPointParameterfv_t f) { glPointParameterfv_t retval = glPointParameterfv; glPointParameterfv = f; return retval;}
- glPointSize_t set_glPointSize(glPointSize_t f) { glPointSize_t retval = glPointSize; glPointSize = f; return retval;}
- glPolygonOffset_t set_glPolygonOffset(glPolygonOffset_t f) { glPolygonOffset_t retval = glPolygonOffset; glPolygonOffset = f; return retval;}
- glRotatef_t set_glRotatef(glRotatef_t f) { glRotatef_t retval = glRotatef; glRotatef = f; return retval;}
- glScalef_t set_glScalef(glScalef_t f) { glScalef_t retval = glScalef; glScalef = f; return retval;}
- glTexEnvf_t set_glTexEnvf(glTexEnvf_t f) { glTexEnvf_t retval = glTexEnvf; glTexEnvf = f; return retval;}
- glTexEnvfv_t set_glTexEnvfv(glTexEnvfv_t f) { glTexEnvfv_t retval = glTexEnvfv; glTexEnvfv = f; return retval;}
- glTexParameterf_t set_glTexParameterf(glTexParameterf_t f) { glTexParameterf_t retval = glTexParameterf; glTexParameterf = f; return retval;}
- glTexParameterfv_t set_glTexParameterfv(glTexParameterfv_t f) { glTexParameterfv_t retval = glTexParameterfv; glTexParameterfv = f; return retval;}
- glTranslatef_t set_glTranslatef(glTranslatef_t f) { glTranslatef_t retval = glTranslatef; glTranslatef = f; return retval;}
- glActiveTexture_t set_glActiveTexture(glActiveTexture_t f) { glActiveTexture_t retval = glActiveTexture; glActiveTexture = f; return retval;}
- glAlphaFuncx_t set_glAlphaFuncx(glAlphaFuncx_t f) { glAlphaFuncx_t retval = glAlphaFuncx; glAlphaFuncx = f; return retval;}
- glBindBuffer_t set_glBindBuffer(glBindBuffer_t f) { glBindBuffer_t retval = glBindBuffer; glBindBuffer = f; return retval;}
- glBindTexture_t set_glBindTexture(glBindTexture_t f) { glBindTexture_t retval = glBindTexture; glBindTexture = f; return retval;}
- glBlendFunc_t set_glBlendFunc(glBlendFunc_t f) { glBlendFunc_t retval = glBlendFunc; glBlendFunc = f; return retval;}
- glBufferData_t set_glBufferData(glBufferData_t f) { glBufferData_t retval = glBufferData; glBufferData = f; return retval;}
- glBufferSubData_t set_glBufferSubData(glBufferSubData_t f) { glBufferSubData_t retval = glBufferSubData; glBufferSubData = f; return retval;}
- glClear_t set_glClear(glClear_t f) { glClear_t retval = glClear; glClear = f; return retval;}
- glClearColorx_t set_glClearColorx(glClearColorx_t f) { glClearColorx_t retval = glClearColorx; glClearColorx = f; return retval;}
- glClearDepthx_t set_glClearDepthx(glClearDepthx_t f) { glClearDepthx_t retval = glClearDepthx; glClearDepthx = f; return retval;}
- glClearStencil_t set_glClearStencil(glClearStencil_t f) { glClearStencil_t retval = glClearStencil; glClearStencil = f; return retval;}
- glClientActiveTexture_t set_glClientActiveTexture(glClientActiveTexture_t f) { glClientActiveTexture_t retval = glClientActiveTexture; glClientActiveTexture = f; return retval;}
- glClipPlanex_t set_glClipPlanex(glClipPlanex_t f) { glClipPlanex_t retval = glClipPlanex; glClipPlanex = f; return retval;}
- glColor4ub_t set_glColor4ub(glColor4ub_t f) { glColor4ub_t retval = glColor4ub; glColor4ub = f; return retval;}
- glColor4x_t set_glColor4x(glColor4x_t f) { glColor4x_t retval = glColor4x; glColor4x = f; return retval;}
- glColorMask_t set_glColorMask(glColorMask_t f) { glColorMask_t retval = glColorMask; glColorMask = f; return retval;}
- glColorPointer_t set_glColorPointer(glColorPointer_t f) { glColorPointer_t retval = glColorPointer; glColorPointer = f; return retval;}
- glCompressedTexImage2D_t set_glCompressedTexImage2D(glCompressedTexImage2D_t f) { glCompressedTexImage2D_t retval = glCompressedTexImage2D; glCompressedTexImage2D = f; return retval;}
- glCompressedTexSubImage2D_t set_glCompressedTexSubImage2D(glCompressedTexSubImage2D_t f) { glCompressedTexSubImage2D_t retval = glCompressedTexSubImage2D; glCompressedTexSubImage2D = f; return retval;}
- glCopyTexImage2D_t set_glCopyTexImage2D(glCopyTexImage2D_t f) { glCopyTexImage2D_t retval = glCopyTexImage2D; glCopyTexImage2D = f; return retval;}
- glCopyTexSubImage2D_t set_glCopyTexSubImage2D(glCopyTexSubImage2D_t f) { glCopyTexSubImage2D_t retval = glCopyTexSubImage2D; glCopyTexSubImage2D = f; return retval;}
- glCullFace_t set_glCullFace(glCullFace_t f) { glCullFace_t retval = glCullFace; glCullFace = f; return retval;}
- glDeleteBuffers_t set_glDeleteBuffers(glDeleteBuffers_t f) { glDeleteBuffers_t retval = glDeleteBuffers; glDeleteBuffers = f; return retval;}
- glDeleteTextures_t set_glDeleteTextures(glDeleteTextures_t f) { glDeleteTextures_t retval = glDeleteTextures; glDeleteTextures = f; return retval;}
- glDepthFunc_t set_glDepthFunc(glDepthFunc_t f) { glDepthFunc_t retval = glDepthFunc; glDepthFunc = f; return retval;}
- glDepthMask_t set_glDepthMask(glDepthMask_t f) { glDepthMask_t retval = glDepthMask; glDepthMask = f; return retval;}
- glDepthRangex_t set_glDepthRangex(glDepthRangex_t f) { glDepthRangex_t retval = glDepthRangex; glDepthRangex = f; return retval;}
- glDisable_t set_glDisable(glDisable_t f) { glDisable_t retval = glDisable; glDisable = f; return retval;}
- glDisableClientState_t set_glDisableClientState(glDisableClientState_t f) { glDisableClientState_t retval = glDisableClientState; glDisableClientState = f; return retval;}
- glDrawArrays_t set_glDrawArrays(glDrawArrays_t f) { glDrawArrays_t retval = glDrawArrays; glDrawArrays = f; return retval;}
- glDrawElements_t set_glDrawElements(glDrawElements_t f) { glDrawElements_t retval = glDrawElements; glDrawElements = f; return retval;}
- glEnable_t set_glEnable(glEnable_t f) { glEnable_t retval = glEnable; glEnable = f; return retval;}
- glEnableClientState_t set_glEnableClientState(glEnableClientState_t f) { glEnableClientState_t retval = glEnableClientState; glEnableClientState = f; return retval;}
- glFinish_t set_glFinish(glFinish_t f) { glFinish_t retval = glFinish; glFinish = f; return retval;}
- glFlush_t set_glFlush(glFlush_t f) { glFlush_t retval = glFlush; glFlush = f; return retval;}
- glFogx_t set_glFogx(glFogx_t f) { glFogx_t retval = glFogx; glFogx = f; return retval;}
- glFogxv_t set_glFogxv(glFogxv_t f) { glFogxv_t retval = glFogxv; glFogxv = f; return retval;}
- glFrontFace_t set_glFrontFace(glFrontFace_t f) { glFrontFace_t retval = glFrontFace; glFrontFace = f; return retval;}
- glFrustumx_t set_glFrustumx(glFrustumx_t f) { glFrustumx_t retval = glFrustumx; glFrustumx = f; return retval;}
- glGetBooleanv_t set_glGetBooleanv(glGetBooleanv_t f) { glGetBooleanv_t retval = glGetBooleanv; glGetBooleanv = f; return retval;}
- glGetBufferParameteriv_t set_glGetBufferParameteriv(glGetBufferParameteriv_t f) { glGetBufferParameteriv_t retval = glGetBufferParameteriv; glGetBufferParameteriv = f; return retval;}
- glGetClipPlanex_t set_glGetClipPlanex(glGetClipPlanex_t f) { glGetClipPlanex_t retval = glGetClipPlanex; glGetClipPlanex = f; return retval;}
- glGenBuffers_t set_glGenBuffers(glGenBuffers_t f) { glGenBuffers_t retval = glGenBuffers; glGenBuffers = f; return retval;}
- glGenTextures_t set_glGenTextures(glGenTextures_t f) { glGenTextures_t retval = glGenTextures; glGenTextures = f; return retval;}
- glGetError_t set_glGetError(glGetError_t f) { glGetError_t retval = glGetError; glGetError = f; return retval;}
- glGetFixedv_t set_glGetFixedv(glGetFixedv_t f) { glGetFixedv_t retval = glGetFixedv; glGetFixedv = f; return retval;}
- glGetIntegerv_t set_glGetIntegerv(glGetIntegerv_t f) { glGetIntegerv_t retval = glGetIntegerv; glGetIntegerv = f; return retval;}
- glGetLightxv_t set_glGetLightxv(glGetLightxv_t f) { glGetLightxv_t retval = glGetLightxv; glGetLightxv = f; return retval;}
- glGetMaterialxv_t set_glGetMaterialxv(glGetMaterialxv_t f) { glGetMaterialxv_t retval = glGetMaterialxv; glGetMaterialxv = f; return retval;}
- glGetPointerv_t set_glGetPointerv(glGetPointerv_t f) { glGetPointerv_t retval = glGetPointerv; glGetPointerv = f; return retval;}
- glGetString_t set_glGetString(glGetString_t f) { glGetString_t retval = glGetString; glGetString = f; return retval;}
- glGetTexEnviv_t set_glGetTexEnviv(glGetTexEnviv_t f) { glGetTexEnviv_t retval = glGetTexEnviv; glGetTexEnviv = f; return retval;}
- glGetTexEnvxv_t set_glGetTexEnvxv(glGetTexEnvxv_t f) { glGetTexEnvxv_t retval = glGetTexEnvxv; glGetTexEnvxv = f; return retval;}
- glGetTexParameteriv_t set_glGetTexParameteriv(glGetTexParameteriv_t f) { glGetTexParameteriv_t retval = glGetTexParameteriv; glGetTexParameteriv = f; return retval;}
- glGetTexParameterxv_t set_glGetTexParameterxv(glGetTexParameterxv_t f) { glGetTexParameterxv_t retval = glGetTexParameterxv; glGetTexParameterxv = f; return retval;}
- glHint_t set_glHint(glHint_t f) { glHint_t retval = glHint; glHint = f; return retval;}
- glIsBuffer_t set_glIsBuffer(glIsBuffer_t f) { glIsBuffer_t retval = glIsBuffer; glIsBuffer = f; return retval;}
- glIsEnabled_t set_glIsEnabled(glIsEnabled_t f) { glIsEnabled_t retval = glIsEnabled; glIsEnabled = f; return retval;}
- glIsTexture_t set_glIsTexture(glIsTexture_t f) { glIsTexture_t retval = glIsTexture; glIsTexture = f; return retval;}
- glLightModelx_t set_glLightModelx(glLightModelx_t f) { glLightModelx_t retval = glLightModelx; glLightModelx = f; return retval;}
- glLightModelxv_t set_glLightModelxv(glLightModelxv_t f) { glLightModelxv_t retval = glLightModelxv; glLightModelxv = f; return retval;}
- glLightx_t set_glLightx(glLightx_t f) { glLightx_t retval = glLightx; glLightx = f; return retval;}
- glLightxv_t set_glLightxv(glLightxv_t f) { glLightxv_t retval = glLightxv; glLightxv = f; return retval;}
- glLineWidthx_t set_glLineWidthx(glLineWidthx_t f) { glLineWidthx_t retval = glLineWidthx; glLineWidthx = f; return retval;}
- glLoadIdentity_t set_glLoadIdentity(glLoadIdentity_t f) { glLoadIdentity_t retval = glLoadIdentity; glLoadIdentity = f; return retval;}
- glLoadMatrixx_t set_glLoadMatrixx(glLoadMatrixx_t f) { glLoadMatrixx_t retval = glLoadMatrixx; glLoadMatrixx = f; return retval;}
- glLogicOp_t set_glLogicOp(glLogicOp_t f) { glLogicOp_t retval = glLogicOp; glLogicOp = f; return retval;}
- glMaterialx_t set_glMaterialx(glMaterialx_t f) { glMaterialx_t retval = glMaterialx; glMaterialx = f; return retval;}
- glMaterialxv_t set_glMaterialxv(glMaterialxv_t f) { glMaterialxv_t retval = glMaterialxv; glMaterialxv = f; return retval;}
- glMatrixMode_t set_glMatrixMode(glMatrixMode_t f) { glMatrixMode_t retval = glMatrixMode; glMatrixMode = f; return retval;}
- glMultMatrixx_t set_glMultMatrixx(glMultMatrixx_t f) { glMultMatrixx_t retval = glMultMatrixx; glMultMatrixx = f; return retval;}
- glMultiTexCoord4x_t set_glMultiTexCoord4x(glMultiTexCoord4x_t f) { glMultiTexCoord4x_t retval = glMultiTexCoord4x; glMultiTexCoord4x = f; return retval;}
- glNormal3x_t set_glNormal3x(glNormal3x_t f) { glNormal3x_t retval = glNormal3x; glNormal3x = f; return retval;}
- glNormalPointer_t set_glNormalPointer(glNormalPointer_t f) { glNormalPointer_t retval = glNormalPointer; glNormalPointer = f; return retval;}
- glOrthox_t set_glOrthox(glOrthox_t f) { glOrthox_t retval = glOrthox; glOrthox = f; return retval;}
- glPixelStorei_t set_glPixelStorei(glPixelStorei_t f) { glPixelStorei_t retval = glPixelStorei; glPixelStorei = f; return retval;}
- glPointParameterx_t set_glPointParameterx(glPointParameterx_t f) { glPointParameterx_t retval = glPointParameterx; glPointParameterx = f; return retval;}
- glPointParameterxv_t set_glPointParameterxv(glPointParameterxv_t f) { glPointParameterxv_t retval = glPointParameterxv; glPointParameterxv = f; return retval;}
- glPointSizex_t set_glPointSizex(glPointSizex_t f) { glPointSizex_t retval = glPointSizex; glPointSizex = f; return retval;}
- glPolygonOffsetx_t set_glPolygonOffsetx(glPolygonOffsetx_t f) { glPolygonOffsetx_t retval = glPolygonOffsetx; glPolygonOffsetx = f; return retval;}
- glPopMatrix_t set_glPopMatrix(glPopMatrix_t f) { glPopMatrix_t retval = glPopMatrix; glPopMatrix = f; return retval;}
- glPushMatrix_t set_glPushMatrix(glPushMatrix_t f) { glPushMatrix_t retval = glPushMatrix; glPushMatrix = f; return retval;}
- glReadPixels_t set_glReadPixels(glReadPixels_t f) { glReadPixels_t retval = glReadPixels; glReadPixels = f; return retval;}
- glRotatex_t set_glRotatex(glRotatex_t f) { glRotatex_t retval = glRotatex; glRotatex = f; return retval;}
- glSampleCoverage_t set_glSampleCoverage(glSampleCoverage_t f) { glSampleCoverage_t retval = glSampleCoverage; glSampleCoverage = f; return retval;}
- glSampleCoveragex_t set_glSampleCoveragex(glSampleCoveragex_t f) { glSampleCoveragex_t retval = glSampleCoveragex; glSampleCoveragex = f; return retval;}
- glScalex_t set_glScalex(glScalex_t f) { glScalex_t retval = glScalex; glScalex = f; return retval;}
- glScissor_t set_glScissor(glScissor_t f) { glScissor_t retval = glScissor; glScissor = f; return retval;}
- glShadeModel_t set_glShadeModel(glShadeModel_t f) { glShadeModel_t retval = glShadeModel; glShadeModel = f; return retval;}
- glStencilFunc_t set_glStencilFunc(glStencilFunc_t f) { glStencilFunc_t retval = glStencilFunc; glStencilFunc = f; return retval;}
- glStencilMask_t set_glStencilMask(glStencilMask_t f) { glStencilMask_t retval = glStencilMask; glStencilMask = f; return retval;}
- glStencilOp_t set_glStencilOp(glStencilOp_t f) { glStencilOp_t retval = glStencilOp; glStencilOp = f; return retval;}
- glTexCoordPointer_t set_glTexCoordPointer(glTexCoordPointer_t f) { glTexCoordPointer_t retval = glTexCoordPointer; glTexCoordPointer = f; return retval;}
- glTexEnvi_t set_glTexEnvi(glTexEnvi_t f) { glTexEnvi_t retval = glTexEnvi; glTexEnvi = f; return retval;}
- glTexEnvx_t set_glTexEnvx(glTexEnvx_t f) { glTexEnvx_t retval = glTexEnvx; glTexEnvx = f; return retval;}
- glTexEnviv_t set_glTexEnviv(glTexEnviv_t f) { glTexEnviv_t retval = glTexEnviv; glTexEnviv = f; return retval;}
- glTexEnvxv_t set_glTexEnvxv(glTexEnvxv_t f) { glTexEnvxv_t retval = glTexEnvxv; glTexEnvxv = f; return retval;}
- glTexImage2D_t set_glTexImage2D(glTexImage2D_t f) { glTexImage2D_t retval = glTexImage2D; glTexImage2D = f; return retval;}
- glTexParameteri_t set_glTexParameteri(glTexParameteri_t f) { glTexParameteri_t retval = glTexParameteri; glTexParameteri = f; return retval;}
- glTexParameterx_t set_glTexParameterx(glTexParameterx_t f) { glTexParameterx_t retval = glTexParameterx; glTexParameterx = f; return retval;}
- glTexParameteriv_t set_glTexParameteriv(glTexParameteriv_t f) { glTexParameteriv_t retval = glTexParameteriv; glTexParameteriv = f; return retval;}
- glTexParameterxv_t set_glTexParameterxv(glTexParameterxv_t f) { glTexParameterxv_t retval = glTexParameterxv; glTexParameterxv = f; return retval;}
- glTexSubImage2D_t set_glTexSubImage2D(glTexSubImage2D_t f) { glTexSubImage2D_t retval = glTexSubImage2D; glTexSubImage2D = f; return retval;}
- glTranslatex_t set_glTranslatex(glTranslatex_t f) { glTranslatex_t retval = glTranslatex; glTranslatex = f; return retval;}
- glVertexPointer_t set_glVertexPointer(glVertexPointer_t f) { glVertexPointer_t retval = glVertexPointer; glVertexPointer = f; return retval;}
- glViewport_t set_glViewport(glViewport_t f) { glViewport_t retval = glViewport; glViewport = f; return retval;}
- glPointSizePointerOES_t set_glPointSizePointerOES(glPointSizePointerOES_t f) { glPointSizePointerOES_t retval = glPointSizePointerOES; glPointSizePointerOES = f; return retval;}
- glBlendEquationSeparateOES_t set_glBlendEquationSeparateOES(glBlendEquationSeparateOES_t f) { glBlendEquationSeparateOES_t retval = glBlendEquationSeparateOES; glBlendEquationSeparateOES = f; return retval;}
- glBlendFuncSeparateOES_t set_glBlendFuncSeparateOES(glBlendFuncSeparateOES_t f) { glBlendFuncSeparateOES_t retval = glBlendFuncSeparateOES; glBlendFuncSeparateOES = f; return retval;}
- glBlendEquationOES_t set_glBlendEquationOES(glBlendEquationOES_t f) { glBlendEquationOES_t retval = glBlendEquationOES; glBlendEquationOES = f; return retval;}
- glDrawTexsOES_t set_glDrawTexsOES(glDrawTexsOES_t f) { glDrawTexsOES_t retval = glDrawTexsOES; glDrawTexsOES = f; return retval;}
- glDrawTexiOES_t set_glDrawTexiOES(glDrawTexiOES_t f) { glDrawTexiOES_t retval = glDrawTexiOES; glDrawTexiOES = f; return retval;}
- glDrawTexxOES_t set_glDrawTexxOES(glDrawTexxOES_t f) { glDrawTexxOES_t retval = glDrawTexxOES; glDrawTexxOES = f; return retval;}
- glDrawTexsvOES_t set_glDrawTexsvOES(glDrawTexsvOES_t f) { glDrawTexsvOES_t retval = glDrawTexsvOES; glDrawTexsvOES = f; return retval;}
- glDrawTexivOES_t set_glDrawTexivOES(glDrawTexivOES_t f) { glDrawTexivOES_t retval = glDrawTexivOES; glDrawTexivOES = f; return retval;}
- glDrawTexxvOES_t set_glDrawTexxvOES(glDrawTexxvOES_t f) { glDrawTexxvOES_t retval = glDrawTexxvOES; glDrawTexxvOES = f; return retval;}
- glDrawTexfOES_t set_glDrawTexfOES(glDrawTexfOES_t f) { glDrawTexfOES_t retval = glDrawTexfOES; glDrawTexfOES = f; return retval;}
- glDrawTexfvOES_t set_glDrawTexfvOES(glDrawTexfvOES_t f) { glDrawTexfvOES_t retval = glDrawTexfvOES; glDrawTexfvOES = f; return retval;}
- glEGLImageTargetTexture2DOES_t set_glEGLImageTargetTexture2DOES(glEGLImageTargetTexture2DOES_t f) { glEGLImageTargetTexture2DOES_t retval = glEGLImageTargetTexture2DOES; glEGLImageTargetTexture2DOES = f; return retval;}
- glEGLImageTargetRenderbufferStorageOES_t set_glEGLImageTargetRenderbufferStorageOES(glEGLImageTargetRenderbufferStorageOES_t f) { glEGLImageTargetRenderbufferStorageOES_t retval = glEGLImageTargetRenderbufferStorageOES; glEGLImageTargetRenderbufferStorageOES = f; return retval;}
- glAlphaFuncxOES_t set_glAlphaFuncxOES(glAlphaFuncxOES_t f) { glAlphaFuncxOES_t retval = glAlphaFuncxOES; glAlphaFuncxOES = f; return retval;}
- glClearColorxOES_t set_glClearColorxOES(glClearColorxOES_t f) { glClearColorxOES_t retval = glClearColorxOES; glClearColorxOES = f; return retval;}
- glClearDepthxOES_t set_glClearDepthxOES(glClearDepthxOES_t f) { glClearDepthxOES_t retval = glClearDepthxOES; glClearDepthxOES = f; return retval;}
- glClipPlanexOES_t set_glClipPlanexOES(glClipPlanexOES_t f) { glClipPlanexOES_t retval = glClipPlanexOES; glClipPlanexOES = f; return retval;}
- glColor4xOES_t set_glColor4xOES(glColor4xOES_t f) { glColor4xOES_t retval = glColor4xOES; glColor4xOES = f; return retval;}
- glDepthRangexOES_t set_glDepthRangexOES(glDepthRangexOES_t f) { glDepthRangexOES_t retval = glDepthRangexOES; glDepthRangexOES = f; return retval;}
- glFogxOES_t set_glFogxOES(glFogxOES_t f) { glFogxOES_t retval = glFogxOES; glFogxOES = f; return retval;}
- glFogxvOES_t set_glFogxvOES(glFogxvOES_t f) { glFogxvOES_t retval = glFogxvOES; glFogxvOES = f; return retval;}
- glFrustumxOES_t set_glFrustumxOES(glFrustumxOES_t f) { glFrustumxOES_t retval = glFrustumxOES; glFrustumxOES = f; return retval;}
- glGetClipPlanexOES_t set_glGetClipPlanexOES(glGetClipPlanexOES_t f) { glGetClipPlanexOES_t retval = glGetClipPlanexOES; glGetClipPlanexOES = f; return retval;}
- glGetFixedvOES_t set_glGetFixedvOES(glGetFixedvOES_t f) { glGetFixedvOES_t retval = glGetFixedvOES; glGetFixedvOES = f; return retval;}
- glGetLightxvOES_t set_glGetLightxvOES(glGetLightxvOES_t f) { glGetLightxvOES_t retval = glGetLightxvOES; glGetLightxvOES = f; return retval;}
- glGetMaterialxvOES_t set_glGetMaterialxvOES(glGetMaterialxvOES_t f) { glGetMaterialxvOES_t retval = glGetMaterialxvOES; glGetMaterialxvOES = f; return retval;}
- glGetTexEnvxvOES_t set_glGetTexEnvxvOES(glGetTexEnvxvOES_t f) { glGetTexEnvxvOES_t retval = glGetTexEnvxvOES; glGetTexEnvxvOES = f; return retval;}
- glGetTexParameterxvOES_t set_glGetTexParameterxvOES(glGetTexParameterxvOES_t f) { glGetTexParameterxvOES_t retval = glGetTexParameterxvOES; glGetTexParameterxvOES = f; return retval;}
- glLightModelxOES_t set_glLightModelxOES(glLightModelxOES_t f) { glLightModelxOES_t retval = glLightModelxOES; glLightModelxOES = f; return retval;}
- glLightModelxvOES_t set_glLightModelxvOES(glLightModelxvOES_t f) { glLightModelxvOES_t retval = glLightModelxvOES; glLightModelxvOES = f; return retval;}
- glLightxOES_t set_glLightxOES(glLightxOES_t f) { glLightxOES_t retval = glLightxOES; glLightxOES = f; return retval;}
- glLightxvOES_t set_glLightxvOES(glLightxvOES_t f) { glLightxvOES_t retval = glLightxvOES; glLightxvOES = f; return retval;}
- glLineWidthxOES_t set_glLineWidthxOES(glLineWidthxOES_t f) { glLineWidthxOES_t retval = glLineWidthxOES; glLineWidthxOES = f; return retval;}
- glLoadMatrixxOES_t set_glLoadMatrixxOES(glLoadMatrixxOES_t f) { glLoadMatrixxOES_t retval = glLoadMatrixxOES; glLoadMatrixxOES = f; return retval;}
- glMaterialxOES_t set_glMaterialxOES(glMaterialxOES_t f) { glMaterialxOES_t retval = glMaterialxOES; glMaterialxOES = f; return retval;}
- glMaterialxvOES_t set_glMaterialxvOES(glMaterialxvOES_t f) { glMaterialxvOES_t retval = glMaterialxvOES; glMaterialxvOES = f; return retval;}
- glMultMatrixxOES_t set_glMultMatrixxOES(glMultMatrixxOES_t f) { glMultMatrixxOES_t retval = glMultMatrixxOES; glMultMatrixxOES = f; return retval;}
- glMultiTexCoord4xOES_t set_glMultiTexCoord4xOES(glMultiTexCoord4xOES_t f) { glMultiTexCoord4xOES_t retval = glMultiTexCoord4xOES; glMultiTexCoord4xOES = f; return retval;}
- glNormal3xOES_t set_glNormal3xOES(glNormal3xOES_t f) { glNormal3xOES_t retval = glNormal3xOES; glNormal3xOES = f; return retval;}
- glOrthoxOES_t set_glOrthoxOES(glOrthoxOES_t f) { glOrthoxOES_t retval = glOrthoxOES; glOrthoxOES = f; return retval;}
- glPointParameterxOES_t set_glPointParameterxOES(glPointParameterxOES_t f) { glPointParameterxOES_t retval = glPointParameterxOES; glPointParameterxOES = f; return retval;}
- glPointParameterxvOES_t set_glPointParameterxvOES(glPointParameterxvOES_t f) { glPointParameterxvOES_t retval = glPointParameterxvOES; glPointParameterxvOES = f; return retval;}
- glPointSizexOES_t set_glPointSizexOES(glPointSizexOES_t f) { glPointSizexOES_t retval = glPointSizexOES; glPointSizexOES = f; return retval;}
- glPolygonOffsetxOES_t set_glPolygonOffsetxOES(glPolygonOffsetxOES_t f) { glPolygonOffsetxOES_t retval = glPolygonOffsetxOES; glPolygonOffsetxOES = f; return retval;}
- glRotatexOES_t set_glRotatexOES(glRotatexOES_t f) { glRotatexOES_t retval = glRotatexOES; glRotatexOES = f; return retval;}
- glSampleCoveragexOES_t set_glSampleCoveragexOES(glSampleCoveragexOES_t f) { glSampleCoveragexOES_t retval = glSampleCoveragexOES; glSampleCoveragexOES = f; return retval;}
- glScalexOES_t set_glScalexOES(glScalexOES_t f) { glScalexOES_t retval = glScalexOES; glScalexOES = f; return retval;}
- glTexEnvxOES_t set_glTexEnvxOES(glTexEnvxOES_t f) { glTexEnvxOES_t retval = glTexEnvxOES; glTexEnvxOES = f; return retval;}
- glTexEnvxvOES_t set_glTexEnvxvOES(glTexEnvxvOES_t f) { glTexEnvxvOES_t retval = glTexEnvxvOES; glTexEnvxvOES = f; return retval;}
- glTexParameterxOES_t set_glTexParameterxOES(glTexParameterxOES_t f) { glTexParameterxOES_t retval = glTexParameterxOES; glTexParameterxOES = f; return retval;}
- glTexParameterxvOES_t set_glTexParameterxvOES(glTexParameterxvOES_t f) { glTexParameterxvOES_t retval = glTexParameterxvOES; glTexParameterxvOES = f; return retval;}
- glTranslatexOES_t set_glTranslatexOES(glTranslatexOES_t f) { glTranslatexOES_t retval = glTranslatexOES; glTranslatexOES = f; return retval;}
- glIsRenderbufferOES_t set_glIsRenderbufferOES(glIsRenderbufferOES_t f) { glIsRenderbufferOES_t retval = glIsRenderbufferOES; glIsRenderbufferOES = f; return retval;}
- glBindRenderbufferOES_t set_glBindRenderbufferOES(glBindRenderbufferOES_t f) { glBindRenderbufferOES_t retval = glBindRenderbufferOES; glBindRenderbufferOES = f; return retval;}
- glDeleteRenderbuffersOES_t set_glDeleteRenderbuffersOES(glDeleteRenderbuffersOES_t f) { glDeleteRenderbuffersOES_t retval = glDeleteRenderbuffersOES; glDeleteRenderbuffersOES = f; return retval;}
- glGenRenderbuffersOES_t set_glGenRenderbuffersOES(glGenRenderbuffersOES_t f) { glGenRenderbuffersOES_t retval = glGenRenderbuffersOES; glGenRenderbuffersOES = f; return retval;}
- glRenderbufferStorageOES_t set_glRenderbufferStorageOES(glRenderbufferStorageOES_t f) { glRenderbufferStorageOES_t retval = glRenderbufferStorageOES; glRenderbufferStorageOES = f; return retval;}
- glGetRenderbufferParameterivOES_t set_glGetRenderbufferParameterivOES(glGetRenderbufferParameterivOES_t f) { glGetRenderbufferParameterivOES_t retval = glGetRenderbufferParameterivOES; glGetRenderbufferParameterivOES = f; return retval;}
- glIsFramebufferOES_t set_glIsFramebufferOES(glIsFramebufferOES_t f) { glIsFramebufferOES_t retval = glIsFramebufferOES; glIsFramebufferOES = f; return retval;}
- glBindFramebufferOES_t set_glBindFramebufferOES(glBindFramebufferOES_t f) { glBindFramebufferOES_t retval = glBindFramebufferOES; glBindFramebufferOES = f; return retval;}
- glDeleteFramebuffersOES_t set_glDeleteFramebuffersOES(glDeleteFramebuffersOES_t f) { glDeleteFramebuffersOES_t retval = glDeleteFramebuffersOES; glDeleteFramebuffersOES = f; return retval;}
- glGenFramebuffersOES_t set_glGenFramebuffersOES(glGenFramebuffersOES_t f) { glGenFramebuffersOES_t retval = glGenFramebuffersOES; glGenFramebuffersOES = f; return retval;}
- glCheckFramebufferStatusOES_t set_glCheckFramebufferStatusOES(glCheckFramebufferStatusOES_t f) { glCheckFramebufferStatusOES_t retval = glCheckFramebufferStatusOES; glCheckFramebufferStatusOES = f; return retval;}
- glFramebufferRenderbufferOES_t set_glFramebufferRenderbufferOES(glFramebufferRenderbufferOES_t f) { glFramebufferRenderbufferOES_t retval = glFramebufferRenderbufferOES; glFramebufferRenderbufferOES = f; return retval;}
- glFramebufferTexture2DOES_t set_glFramebufferTexture2DOES(glFramebufferTexture2DOES_t f) { glFramebufferTexture2DOES_t retval = glFramebufferTexture2DOES; glFramebufferTexture2DOES = f; return retval;}
- glGetFramebufferAttachmentParameterivOES_t set_glGetFramebufferAttachmentParameterivOES(glGetFramebufferAttachmentParameterivOES_t f) { glGetFramebufferAttachmentParameterivOES_t retval = glGetFramebufferAttachmentParameterivOES; glGetFramebufferAttachmentParameterivOES = f; return retval;}
- glGenerateMipmapOES_t set_glGenerateMipmapOES(glGenerateMipmapOES_t f) { glGenerateMipmapOES_t retval = glGenerateMipmapOES; glGenerateMipmapOES = f; return retval;}
- glMapBufferOES_t set_glMapBufferOES(glMapBufferOES_t f) { glMapBufferOES_t retval = glMapBufferOES; glMapBufferOES = f; return retval;}
- glUnmapBufferOES_t set_glUnmapBufferOES(glUnmapBufferOES_t f) { glUnmapBufferOES_t retval = glUnmapBufferOES; glUnmapBufferOES = f; return retval;}
- glGetBufferPointervOES_t set_glGetBufferPointervOES(glGetBufferPointervOES_t f) { glGetBufferPointervOES_t retval = glGetBufferPointervOES; glGetBufferPointervOES = f; return retval;}
- glCurrentPaletteMatrixOES_t set_glCurrentPaletteMatrixOES(glCurrentPaletteMatrixOES_t f) { glCurrentPaletteMatrixOES_t retval = glCurrentPaletteMatrixOES; glCurrentPaletteMatrixOES = f; return retval;}
- glLoadPaletteFromModelViewMatrixOES_t set_glLoadPaletteFromModelViewMatrixOES(glLoadPaletteFromModelViewMatrixOES_t f) { glLoadPaletteFromModelViewMatrixOES_t retval = glLoadPaletteFromModelViewMatrixOES; glLoadPaletteFromModelViewMatrixOES = f; return retval;}
- glMatrixIndexPointerOES_t set_glMatrixIndexPointerOES(glMatrixIndexPointerOES_t f) { glMatrixIndexPointerOES_t retval = glMatrixIndexPointerOES; glMatrixIndexPointerOES = f; return retval;}
- glWeightPointerOES_t set_glWeightPointerOES(glWeightPointerOES_t f) { glWeightPointerOES_t retval = glWeightPointerOES; glWeightPointerOES = f; return retval;}
- glQueryMatrixxOES_t set_glQueryMatrixxOES(glQueryMatrixxOES_t f) { glQueryMatrixxOES_t retval = glQueryMatrixxOES; glQueryMatrixxOES = f; return retval;}
- glDepthRangefOES_t set_glDepthRangefOES(glDepthRangefOES_t f) { glDepthRangefOES_t retval = glDepthRangefOES; glDepthRangefOES = f; return retval;}
- glFrustumfOES_t set_glFrustumfOES(glFrustumfOES_t f) { glFrustumfOES_t retval = glFrustumfOES; glFrustumfOES = f; return retval;}
- glOrthofOES_t set_glOrthofOES(glOrthofOES_t f) { glOrthofOES_t retval = glOrthofOES; glOrthofOES = f; return retval;}
- glClipPlanefOES_t set_glClipPlanefOES(glClipPlanefOES_t f) { glClipPlanefOES_t retval = glClipPlanefOES; glClipPlanefOES = f; return retval;}
- glGetClipPlanefOES_t set_glGetClipPlanefOES(glGetClipPlanefOES_t f) { glGetClipPlanefOES_t retval = glGetClipPlanefOES; glGetClipPlanefOES = f; return retval;}
- glClearDepthfOES_t set_glClearDepthfOES(glClearDepthfOES_t f) { glClearDepthfOES_t retval = glClearDepthfOES; glClearDepthfOES = f; return retval;}
- glTexGenfOES_t set_glTexGenfOES(glTexGenfOES_t f) { glTexGenfOES_t retval = glTexGenfOES; glTexGenfOES = f; return retval;}
- glTexGenfvOES_t set_glTexGenfvOES(glTexGenfvOES_t f) { glTexGenfvOES_t retval = glTexGenfvOES; glTexGenfvOES = f; return retval;}
- glTexGeniOES_t set_glTexGeniOES(glTexGeniOES_t f) { glTexGeniOES_t retval = glTexGeniOES; glTexGeniOES = f; return retval;}
- glTexGenivOES_t set_glTexGenivOES(glTexGenivOES_t f) { glTexGenivOES_t retval = glTexGenivOES; glTexGenivOES = f; return retval;}
- glTexGenxOES_t set_glTexGenxOES(glTexGenxOES_t f) { glTexGenxOES_t retval = glTexGenxOES; glTexGenxOES = f; return retval;}
- glTexGenxvOES_t set_glTexGenxvOES(glTexGenxvOES_t f) { glTexGenxvOES_t retval = glTexGenxvOES; glTexGenxvOES = f; return retval;}
- glGetTexGenfvOES_t set_glGetTexGenfvOES(glGetTexGenfvOES_t f) { glGetTexGenfvOES_t retval = glGetTexGenfvOES; glGetTexGenfvOES = f; return retval;}
- glGetTexGenivOES_t set_glGetTexGenivOES(glGetTexGenivOES_t f) { glGetTexGenivOES_t retval = glGetTexGenivOES; glGetTexGenivOES = f; return retval;}
- glGetTexGenxvOES_t set_glGetTexGenxvOES(glGetTexGenxvOES_t f) { glGetTexGenxvOES_t retval = glGetTexGenxvOES; glGetTexGenxvOES = f; return retval;}
- glBindVertexArrayOES_t set_glBindVertexArrayOES(glBindVertexArrayOES_t f) { glBindVertexArrayOES_t retval = glBindVertexArrayOES; glBindVertexArrayOES = f; return retval;}
- glDeleteVertexArraysOES_t set_glDeleteVertexArraysOES(glDeleteVertexArraysOES_t f) { glDeleteVertexArraysOES_t retval = glDeleteVertexArraysOES; glDeleteVertexArraysOES = f; return retval;}
- glGenVertexArraysOES_t set_glGenVertexArraysOES(glGenVertexArraysOES_t f) { glGenVertexArraysOES_t retval = glGenVertexArraysOES; glGenVertexArraysOES = f; return retval;}
- glIsVertexArrayOES_t set_glIsVertexArrayOES(glIsVertexArrayOES_t f) { glIsVertexArrayOES_t retval = glIsVertexArrayOES; glIsVertexArrayOES = f; return retval;}
- glDiscardFramebufferEXT_t set_glDiscardFramebufferEXT(glDiscardFramebufferEXT_t f) { glDiscardFramebufferEXT_t retval = glDiscardFramebufferEXT; glDiscardFramebufferEXT = f; return retval;}
- glMultiDrawArraysEXT_t set_glMultiDrawArraysEXT(glMultiDrawArraysEXT_t f) { glMultiDrawArraysEXT_t retval = glMultiDrawArraysEXT; glMultiDrawArraysEXT = f; return retval;}
- glMultiDrawElementsEXT_t set_glMultiDrawElementsEXT(glMultiDrawElementsEXT_t f) { glMultiDrawElementsEXT_t retval = glMultiDrawElementsEXT; glMultiDrawElementsEXT = f; return retval;}
- glClipPlanefIMG_t set_glClipPlanefIMG(glClipPlanefIMG_t f) { glClipPlanefIMG_t retval = glClipPlanefIMG; glClipPlanefIMG = f; return retval;}
- glClipPlanexIMG_t set_glClipPlanexIMG(glClipPlanexIMG_t f) { glClipPlanexIMG_t retval = glClipPlanexIMG; glClipPlanexIMG = f; return retval;}
- glRenderbufferStorageMultisampleIMG_t set_glRenderbufferStorageMultisampleIMG(glRenderbufferStorageMultisampleIMG_t f) { glRenderbufferStorageMultisampleIMG_t retval = glRenderbufferStorageMultisampleIMG; glRenderbufferStorageMultisampleIMG = f; return retval;}
- glFramebufferTexture2DMultisampleIMG_t set_glFramebufferTexture2DMultisampleIMG(glFramebufferTexture2DMultisampleIMG_t f) { glFramebufferTexture2DMultisampleIMG_t retval = glFramebufferTexture2DMultisampleIMG; glFramebufferTexture2DMultisampleIMG = f; return retval;}
- glDeleteFencesNV_t set_glDeleteFencesNV(glDeleteFencesNV_t f) { glDeleteFencesNV_t retval = glDeleteFencesNV; glDeleteFencesNV = f; return retval;}
- glGenFencesNV_t set_glGenFencesNV(glGenFencesNV_t f) { glGenFencesNV_t retval = glGenFencesNV; glGenFencesNV = f; return retval;}
- glIsFenceNV_t set_glIsFenceNV(glIsFenceNV_t f) { glIsFenceNV_t retval = glIsFenceNV; glIsFenceNV = f; return retval;}
- glTestFenceNV_t set_glTestFenceNV(glTestFenceNV_t f) { glTestFenceNV_t retval = glTestFenceNV; glTestFenceNV = f; return retval;}
- glGetFenceivNV_t set_glGetFenceivNV(glGetFenceivNV_t f) { glGetFenceivNV_t retval = glGetFenceivNV; glGetFenceivNV = f; return retval;}
- glFinishFenceNV_t set_glFinishFenceNV(glFinishFenceNV_t f) { glFinishFenceNV_t retval = glFinishFenceNV; glFinishFenceNV = f; return retval;}
- glSetFenceNV_t set_glSetFenceNV(glSetFenceNV_t f) { glSetFenceNV_t retval = glSetFenceNV; glSetFenceNV = f; return retval;}
- glGetDriverControlsQCOM_t set_glGetDriverControlsQCOM(glGetDriverControlsQCOM_t f) { glGetDriverControlsQCOM_t retval = glGetDriverControlsQCOM; glGetDriverControlsQCOM = f; return retval;}
- glGetDriverControlStringQCOM_t set_glGetDriverControlStringQCOM(glGetDriverControlStringQCOM_t f) { glGetDriverControlStringQCOM_t retval = glGetDriverControlStringQCOM; glGetDriverControlStringQCOM = f; return retval;}
- glEnableDriverControlQCOM_t set_glEnableDriverControlQCOM(glEnableDriverControlQCOM_t f) { glEnableDriverControlQCOM_t retval = glEnableDriverControlQCOM; glEnableDriverControlQCOM = f; return retval;}
- glDisableDriverControlQCOM_t set_glDisableDriverControlQCOM(glDisableDriverControlQCOM_t f) { glDisableDriverControlQCOM_t retval = glDisableDriverControlQCOM; glDisableDriverControlQCOM = f; return retval;}
- glExtGetTexturesQCOM_t set_glExtGetTexturesQCOM(glExtGetTexturesQCOM_t f) { glExtGetTexturesQCOM_t retval = glExtGetTexturesQCOM; glExtGetTexturesQCOM = f; return retval;}
- glExtGetBuffersQCOM_t set_glExtGetBuffersQCOM(glExtGetBuffersQCOM_t f) { glExtGetBuffersQCOM_t retval = glExtGetBuffersQCOM; glExtGetBuffersQCOM = f; return retval;}
- glExtGetRenderbuffersQCOM_t set_glExtGetRenderbuffersQCOM(glExtGetRenderbuffersQCOM_t f) { glExtGetRenderbuffersQCOM_t retval = glExtGetRenderbuffersQCOM; glExtGetRenderbuffersQCOM = f; return retval;}
- glExtGetFramebuffersQCOM_t set_glExtGetFramebuffersQCOM(glExtGetFramebuffersQCOM_t f) { glExtGetFramebuffersQCOM_t retval = glExtGetFramebuffersQCOM; glExtGetFramebuffersQCOM = f; return retval;}
- glExtGetTexLevelParameterivQCOM_t set_glExtGetTexLevelParameterivQCOM(glExtGetTexLevelParameterivQCOM_t f) { glExtGetTexLevelParameterivQCOM_t retval = glExtGetTexLevelParameterivQCOM; glExtGetTexLevelParameterivQCOM = f; return retval;}
- glExtTexObjectStateOverrideiQCOM_t set_glExtTexObjectStateOverrideiQCOM(glExtTexObjectStateOverrideiQCOM_t f) { glExtTexObjectStateOverrideiQCOM_t retval = glExtTexObjectStateOverrideiQCOM; glExtTexObjectStateOverrideiQCOM = f; return retval;}
- glExtGetTexSubImageQCOM_t set_glExtGetTexSubImageQCOM(glExtGetTexSubImageQCOM_t f) { glExtGetTexSubImageQCOM_t retval = glExtGetTexSubImageQCOM; glExtGetTexSubImageQCOM = f; return retval;}
- glExtGetBufferPointervQCOM_t set_glExtGetBufferPointervQCOM(glExtGetBufferPointervQCOM_t f) { glExtGetBufferPointervQCOM_t retval = glExtGetBufferPointervQCOM; glExtGetBufferPointervQCOM = f; return retval;}
- glExtGetShadersQCOM_t set_glExtGetShadersQCOM(glExtGetShadersQCOM_t f) { glExtGetShadersQCOM_t retval = glExtGetShadersQCOM; glExtGetShadersQCOM = f; return retval;}
- glExtGetProgramsQCOM_t set_glExtGetProgramsQCOM(glExtGetProgramsQCOM_t f) { glExtGetProgramsQCOM_t retval = glExtGetProgramsQCOM; glExtGetProgramsQCOM = f; return retval;}
- glExtIsProgramBinaryQCOM_t set_glExtIsProgramBinaryQCOM(glExtIsProgramBinaryQCOM_t f) { glExtIsProgramBinaryQCOM_t retval = glExtIsProgramBinaryQCOM; glExtIsProgramBinaryQCOM = f; return retval;}
- glExtGetProgramBinarySourceQCOM_t set_glExtGetProgramBinarySourceQCOM(glExtGetProgramBinarySourceQCOM_t f) { glExtGetProgramBinarySourceQCOM_t retval = glExtGetProgramBinarySourceQCOM; glExtGetProgramBinarySourceQCOM = f; return retval;}
- glStartTilingQCOM_t set_glStartTilingQCOM(glStartTilingQCOM_t f) { glStartTilingQCOM_t retval = glStartTilingQCOM; glStartTilingQCOM = f; return retval;}
- glEndTilingQCOM_t set_glEndTilingQCOM(glEndTilingQCOM_t f) { glEndTilingQCOM_t retval = glEndTilingQCOM; glEndTilingQCOM = f; return retval;}
-};
-
-gles_dispatch *create_gles_dispatch(void *gles_andorid);
-
-#endif
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/gles_emul.cfg b/tools/emulator/opengl/tests/gles_android_wrapper/gles_emul.cfg
deleted file mode 100644
index a83780704..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/gles_emul.cfg
+++ /dev/null
@@ -1,7 +0,0 @@
-angeles
-my-tritex
-org.zeroxlab.benchmark
-com.cooliris.media
-com.polarbit.waveblazerlite
-test-opengl-gl2_basic
-com.trendy.ddapp
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/gles_ftable.h b/tools/emulator/opengl/tests/gles_android_wrapper/gles_ftable.h
deleted file mode 100644
index 1895b182c..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/gles_ftable.h
+++ /dev/null
@@ -1,292 +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.
-*/
-static struct _gles_funcs_by_name {
- const char *name;
- void *proc;
-} gles_funcs_by_name[] = {
- {"glAlphaFunc", (void *)glAlphaFunc},
- {"glClearColor", (void *)glClearColor},
- {"glClearDepthf", (void *)glClearDepthf},
- {"glClipPlanef", (void *)glClipPlanef},
- {"glColor4f", (void *)glColor4f},
- {"glDepthRangef", (void *)glDepthRangef},
- {"glFogf", (void *)glFogf},
- {"glFogfv", (void *)glFogfv},
- {"glFrustumf", (void *)glFrustumf},
- {"glGetClipPlanef", (void *)glGetClipPlanef},
- {"glGetFloatv", (void *)glGetFloatv},
- {"glGetLightfv", (void *)glGetLightfv},
- {"glGetMaterialfv", (void *)glGetMaterialfv},
- {"glGetTexEnvfv", (void *)glGetTexEnvfv},
- {"glGetTexParameterfv", (void *)glGetTexParameterfv},
- {"glLightModelf", (void *)glLightModelf},
- {"glLightModelfv", (void *)glLightModelfv},
- {"glLightf", (void *)glLightf},
- {"glLightfv", (void *)glLightfv},
- {"glLineWidth", (void *)glLineWidth},
- {"glLoadMatrixf", (void *)glLoadMatrixf},
- {"glMaterialf", (void *)glMaterialf},
- {"glMaterialfv", (void *)glMaterialfv},
- {"glMultMatrixf", (void *)glMultMatrixf},
- {"glMultiTexCoord4f", (void *)glMultiTexCoord4f},
- {"glNormal3f", (void *)glNormal3f},
- {"glOrthof", (void *)glOrthof},
- {"glPointParameterf", (void *)glPointParameterf},
- {"glPointParameterfv", (void *)glPointParameterfv},
- {"glPointSize", (void *)glPointSize},
- {"glPolygonOffset", (void *)glPolygonOffset},
- {"glRotatef", (void *)glRotatef},
- {"glScalef", (void *)glScalef},
- {"glTexEnvf", (void *)glTexEnvf},
- {"glTexEnvfv", (void *)glTexEnvfv},
- {"glTexParameterf", (void *)glTexParameterf},
- {"glTexParameterfv", (void *)glTexParameterfv},
- {"glTranslatef", (void *)glTranslatef},
- {"glActiveTexture", (void *)glActiveTexture},
- {"glAlphaFuncx", (void *)glAlphaFuncx},
- {"glBindBuffer", (void *)glBindBuffer},
- {"glBindTexture", (void *)glBindTexture},
- {"glBlendFunc", (void *)glBlendFunc},
- {"glBufferData", (void *)glBufferData},
- {"glBufferSubData", (void *)glBufferSubData},
- {"glClear", (void *)glClear},
- {"glClearColorx", (void *)glClearColorx},
- {"glClearDepthx", (void *)glClearDepthx},
- {"glClearStencil", (void *)glClearStencil},
- {"glClientActiveTexture", (void *)glClientActiveTexture},
- {"glClipPlanex", (void *)glClipPlanex},
- {"glColor4ub", (void *)glColor4ub},
- {"glColor4x", (void *)glColor4x},
- {"glColorMask", (void *)glColorMask},
- {"glColorPointer", (void *)glColorPointer},
- {"glCompressedTexImage2D", (void *)glCompressedTexImage2D},
- {"glCompressedTexSubImage2D", (void *)glCompressedTexSubImage2D},
- {"glCopyTexImage2D", (void *)glCopyTexImage2D},
- {"glCopyTexSubImage2D", (void *)glCopyTexSubImage2D},
- {"glCullFace", (void *)glCullFace},
- {"glDeleteBuffers", (void *)glDeleteBuffers},
- {"glDeleteTextures", (void *)glDeleteTextures},
- {"glDepthFunc", (void *)glDepthFunc},
- {"glDepthMask", (void *)glDepthMask},
- {"glDepthRangex", (void *)glDepthRangex},
- {"glDisable", (void *)glDisable},
- {"glDisableClientState", (void *)glDisableClientState},
- {"glDrawArrays", (void *)glDrawArrays},
- {"glDrawElements", (void *)glDrawElements},
- {"glEnable", (void *)glEnable},
- {"glEnableClientState", (void *)glEnableClientState},
- {"glFinish", (void *)glFinish},
- {"glFlush", (void *)glFlush},
- {"glFogx", (void *)glFogx},
- {"glFogxv", (void *)glFogxv},
- {"glFrontFace", (void *)glFrontFace},
- {"glFrustumx", (void *)glFrustumx},
- {"glGetBooleanv", (void *)glGetBooleanv},
- {"glGetBufferParameteriv", (void *)glGetBufferParameteriv},
- {"glGetClipPlanex", (void *)glGetClipPlanex},
- {"glGenBuffers", (void *)glGenBuffers},
- {"glGenTextures", (void *)glGenTextures},
- {"glGetError", (void *)glGetError},
- {"glGetFixedv", (void *)glGetFixedv},
- {"glGetIntegerv", (void *)glGetIntegerv},
- {"glGetLightxv", (void *)glGetLightxv},
- {"glGetMaterialxv", (void *)glGetMaterialxv},
- {"glGetPointerv", (void *)glGetPointerv},
- {"glGetString", (void *)glGetString},
- {"glGetTexEnviv", (void *)glGetTexEnviv},
- {"glGetTexEnvxv", (void *)glGetTexEnvxv},
- {"glGetTexParameteriv", (void *)glGetTexParameteriv},
- {"glGetTexParameterxv", (void *)glGetTexParameterxv},
- {"glHint", (void *)glHint},
- {"glIsBuffer", (void *)glIsBuffer},
- {"glIsEnabled", (void *)glIsEnabled},
- {"glIsTexture", (void *)glIsTexture},
- {"glLightModelx", (void *)glLightModelx},
- {"glLightModelxv", (void *)glLightModelxv},
- {"glLightx", (void *)glLightx},
- {"glLightxv", (void *)glLightxv},
- {"glLineWidthx", (void *)glLineWidthx},
- {"glLoadIdentity", (void *)glLoadIdentity},
- {"glLoadMatrixx", (void *)glLoadMatrixx},
- {"glLogicOp", (void *)glLogicOp},
- {"glMaterialx", (void *)glMaterialx},
- {"glMaterialxv", (void *)glMaterialxv},
- {"glMatrixMode", (void *)glMatrixMode},
- {"glMultMatrixx", (void *)glMultMatrixx},
- {"glMultiTexCoord4x", (void *)glMultiTexCoord4x},
- {"glNormal3x", (void *)glNormal3x},
- {"glNormalPointer", (void *)glNormalPointer},
- {"glOrthox", (void *)glOrthox},
- {"glPixelStorei", (void *)glPixelStorei},
- {"glPointParameterx", (void *)glPointParameterx},
- {"glPointParameterxv", (void *)glPointParameterxv},
- {"glPointSizex", (void *)glPointSizex},
- {"glPolygonOffsetx", (void *)glPolygonOffsetx},
- {"glPopMatrix", (void *)glPopMatrix},
- {"glPushMatrix", (void *)glPushMatrix},
- {"glReadPixels", (void *)glReadPixels},
- {"glRotatex", (void *)glRotatex},
- {"glSampleCoverage", (void *)glSampleCoverage},
- {"glSampleCoveragex", (void *)glSampleCoveragex},
- {"glScalex", (void *)glScalex},
- {"glScissor", (void *)glScissor},
- {"glShadeModel", (void *)glShadeModel},
- {"glStencilFunc", (void *)glStencilFunc},
- {"glStencilMask", (void *)glStencilMask},
- {"glStencilOp", (void *)glStencilOp},
- {"glTexCoordPointer", (void *)glTexCoordPointer},
- {"glTexEnvi", (void *)glTexEnvi},
- {"glTexEnvx", (void *)glTexEnvx},
- {"glTexEnviv", (void *)glTexEnviv},
- {"glTexEnvxv", (void *)glTexEnvxv},
- {"glTexImage2D", (void *)glTexImage2D},
- {"glTexParameteri", (void *)glTexParameteri},
- {"glTexParameterx", (void *)glTexParameterx},
- {"glTexParameteriv", (void *)glTexParameteriv},
- {"glTexParameterxv", (void *)glTexParameterxv},
- {"glTexSubImage2D", (void *)glTexSubImage2D},
- {"glTranslatex", (void *)glTranslatex},
- {"glVertexPointer", (void *)glVertexPointer},
- {"glViewport", (void *)glViewport},
- {"glPointSizePointerOES", (void *)glPointSizePointerOES},
- {"glBlendEquationSeparateOES", (void *)glBlendEquationSeparateOES},
- {"glBlendFuncSeparateOES", (void *)glBlendFuncSeparateOES},
- {"glBlendEquationOES", (void *)glBlendEquationOES},
- {"glDrawTexsOES", (void *)glDrawTexsOES},
- {"glDrawTexiOES", (void *)glDrawTexiOES},
- {"glDrawTexxOES", (void *)glDrawTexxOES},
- {"glDrawTexsvOES", (void *)glDrawTexsvOES},
- {"glDrawTexivOES", (void *)glDrawTexivOES},
- {"glDrawTexxvOES", (void *)glDrawTexxvOES},
- {"glDrawTexfOES", (void *)glDrawTexfOES},
- {"glDrawTexfvOES", (void *)glDrawTexfvOES},
- {"glEGLImageTargetTexture2DOES", (void *)glEGLImageTargetTexture2DOES},
- {"glEGLImageTargetRenderbufferStorageOES", (void *)glEGLImageTargetRenderbufferStorageOES},
- {"glAlphaFuncxOES", (void *)glAlphaFuncxOES},
- {"glClearColorxOES", (void *)glClearColorxOES},
- {"glClearDepthxOES", (void *)glClearDepthxOES},
- {"glClipPlanexOES", (void *)glClipPlanexOES},
- {"glColor4xOES", (void *)glColor4xOES},
- {"glDepthRangexOES", (void *)glDepthRangexOES},
- {"glFogxOES", (void *)glFogxOES},
- {"glFogxvOES", (void *)glFogxvOES},
- {"glFrustumxOES", (void *)glFrustumxOES},
- {"glGetClipPlanexOES", (void *)glGetClipPlanexOES},
- {"glGetFixedvOES", (void *)glGetFixedvOES},
- {"glGetLightxvOES", (void *)glGetLightxvOES},
- {"glGetMaterialxvOES", (void *)glGetMaterialxvOES},
- {"glGetTexEnvxvOES", (void *)glGetTexEnvxvOES},
- {"glGetTexParameterxvOES", (void *)glGetTexParameterxvOES},
- {"glLightModelxOES", (void *)glLightModelxOES},
- {"glLightModelxvOES", (void *)glLightModelxvOES},
- {"glLightxOES", (void *)glLightxOES},
- {"glLightxvOES", (void *)glLightxvOES},
- {"glLineWidthxOES", (void *)glLineWidthxOES},
- {"glLoadMatrixxOES", (void *)glLoadMatrixxOES},
- {"glMaterialxOES", (void *)glMaterialxOES},
- {"glMaterialxvOES", (void *)glMaterialxvOES},
- {"glMultMatrixxOES", (void *)glMultMatrixxOES},
- {"glMultiTexCoord4xOES", (void *)glMultiTexCoord4xOES},
- {"glNormal3xOES", (void *)glNormal3xOES},
- {"glOrthoxOES", (void *)glOrthoxOES},
- {"glPointParameterxOES", (void *)glPointParameterxOES},
- {"glPointParameterxvOES", (void *)glPointParameterxvOES},
- {"glPointSizexOES", (void *)glPointSizexOES},
- {"glPolygonOffsetxOES", (void *)glPolygonOffsetxOES},
- {"glRotatexOES", (void *)glRotatexOES},
- {"glSampleCoveragexOES", (void *)glSampleCoveragexOES},
- {"glScalexOES", (void *)glScalexOES},
- {"glTexEnvxOES", (void *)glTexEnvxOES},
- {"glTexEnvxvOES", (void *)glTexEnvxvOES},
- {"glTexParameterxOES", (void *)glTexParameterxOES},
- {"glTexParameterxvOES", (void *)glTexParameterxvOES},
- {"glTranslatexOES", (void *)glTranslatexOES},
- {"glIsRenderbufferOES", (void *)glIsRenderbufferOES},
- {"glBindRenderbufferOES", (void *)glBindRenderbufferOES},
- {"glDeleteRenderbuffersOES", (void *)glDeleteRenderbuffersOES},
- {"glGenRenderbuffersOES", (void *)glGenRenderbuffersOES},
- {"glRenderbufferStorageOES", (void *)glRenderbufferStorageOES},
- {"glGetRenderbufferParameterivOES", (void *)glGetRenderbufferParameterivOES},
- {"glIsFramebufferOES", (void *)glIsFramebufferOES},
- {"glBindFramebufferOES", (void *)glBindFramebufferOES},
- {"glDeleteFramebuffersOES", (void *)glDeleteFramebuffersOES},
- {"glGenFramebuffersOES", (void *)glGenFramebuffersOES},
- {"glCheckFramebufferStatusOES", (void *)glCheckFramebufferStatusOES},
- {"glFramebufferRenderbufferOES", (void *)glFramebufferRenderbufferOES},
- {"glFramebufferTexture2DOES", (void *)glFramebufferTexture2DOES},
- {"glGetFramebufferAttachmentParameterivOES", (void *)glGetFramebufferAttachmentParameterivOES},
- {"glGenerateMipmapOES", (void *)glGenerateMipmapOES},
- {"glMapBufferOES", (void *)glMapBufferOES},
- {"glUnmapBufferOES", (void *)glUnmapBufferOES},
- {"glGetBufferPointervOES", (void *)glGetBufferPointervOES},
- {"glCurrentPaletteMatrixOES", (void *)glCurrentPaletteMatrixOES},
- {"glLoadPaletteFromModelViewMatrixOES", (void *)glLoadPaletteFromModelViewMatrixOES},
- {"glMatrixIndexPointerOES", (void *)glMatrixIndexPointerOES},
- {"glWeightPointerOES", (void *)glWeightPointerOES},
- {"glQueryMatrixxOES", (void *)glQueryMatrixxOES},
- {"glDepthRangefOES", (void *)glDepthRangefOES},
- {"glFrustumfOES", (void *)glFrustumfOES},
- {"glOrthofOES", (void *)glOrthofOES},
- {"glClipPlanefOES", (void *)glClipPlanefOES},
- {"glGetClipPlanefOES", (void *)glGetClipPlanefOES},
- {"glClearDepthfOES", (void *)glClearDepthfOES},
- {"glTexGenfOES", (void *)glTexGenfOES},
- {"glTexGenfvOES", (void *)glTexGenfvOES},
- {"glTexGeniOES", (void *)glTexGeniOES},
- {"glTexGenivOES", (void *)glTexGenivOES},
- {"glTexGenxOES", (void *)glTexGenxOES},
- {"glTexGenxvOES", (void *)glTexGenxvOES},
- {"glGetTexGenfvOES", (void *)glGetTexGenfvOES},
- {"glGetTexGenivOES", (void *)glGetTexGenivOES},
- {"glGetTexGenxvOES", (void *)glGetTexGenxvOES},
- {"glBindVertexArrayOES", (void *)glBindVertexArrayOES},
- {"glDeleteVertexArraysOES", (void *)glDeleteVertexArraysOES},
- {"glGenVertexArraysOES", (void *)glGenVertexArraysOES},
- {"glIsVertexArrayOES", (void *)glIsVertexArrayOES},
- {"glDiscardFramebufferEXT", (void *)glDiscardFramebufferEXT},
- {"glMultiDrawArraysEXT", (void *)glMultiDrawArraysEXT},
- {"glMultiDrawElementsEXT", (void *)glMultiDrawElementsEXT},
- {"glClipPlanefIMG", (void *)glClipPlanefIMG},
- {"glClipPlanexIMG", (void *)glClipPlanexIMG},
- {"glRenderbufferStorageMultisampleIMG", (void *)glRenderbufferStorageMultisampleIMG},
- {"glFramebufferTexture2DMultisampleIMG", (void *)glFramebufferTexture2DMultisampleIMG},
- {"glDeleteFencesNV", (void *)glDeleteFencesNV},
- {"glGenFencesNV", (void *)glGenFencesNV},
- {"glIsFenceNV", (void *)glIsFenceNV},
- {"glTestFenceNV", (void *)glTestFenceNV},
- {"glGetFenceivNV", (void *)glGetFenceivNV},
- {"glFinishFenceNV", (void *)glFinishFenceNV},
- {"glSetFenceNV", (void *)glSetFenceNV},
- {"glGetDriverControlsQCOM", (void *)glGetDriverControlsQCOM},
- {"glGetDriverControlStringQCOM", (void *)glGetDriverControlStringQCOM},
- {"glEnableDriverControlQCOM", (void *)glEnableDriverControlQCOM},
- {"glDisableDriverControlQCOM", (void *)glDisableDriverControlQCOM},
- {"glExtGetTexturesQCOM", (void *)glExtGetTexturesQCOM},
- {"glExtGetBuffersQCOM", (void *)glExtGetBuffersQCOM},
- {"glExtGetRenderbuffersQCOM", (void *)glExtGetRenderbuffersQCOM},
- {"glExtGetFramebuffersQCOM", (void *)glExtGetFramebuffersQCOM},
- {"glExtGetTexLevelParameterivQCOM", (void *)glExtGetTexLevelParameterivQCOM},
- {"glExtTexObjectStateOverrideiQCOM", (void *)glExtTexObjectStateOverrideiQCOM},
- {"glExtGetTexSubImageQCOM", (void *)glExtGetTexSubImageQCOM},
- {"glExtGetBufferPointervQCOM", (void *)glExtGetBufferPointervQCOM},
- {"glExtGetShadersQCOM", (void *)glExtGetShadersQCOM},
- {"glExtGetProgramsQCOM", (void *)glExtGetProgramsQCOM},
- {"glExtIsProgramBinaryQCOM", (void *)glExtIsProgramBinaryQCOM},
- {"glExtGetProgramBinarySourceQCOM", (void *)glExtGetProgramBinarySourceQCOM},
- {"glStartTilingQCOM", (void *)glStartTilingQCOM},
- {"glEndTilingQCOM", (void *)glEndTilingQCOM}
-};
-static int gles_num_funcs = sizeof(gles_funcs_by_name) / sizeof(struct _gles_funcs_by_name);
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/gles_proc.h b/tools/emulator/opengl/tests/gles_android_wrapper/gles_proc.h
deleted file mode 100644
index afd94b9fb..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/gles_proc.h
+++ /dev/null
@@ -1,296 +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.
-*/
-#ifndef _GLES_PROC_H
-#define _GLES_PROC_H
-
-#include <GLES/gl.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GLES/glext.h>
-
-typedef void (* glAlphaFunc_t) (GLenum, GLclampf);
-typedef void (* glClearColor_t) (GLclampf, GLclampf, GLclampf, GLclampf);
-typedef void (* glClearDepthf_t) (GLclampf);
-typedef void (* glClipPlanef_t) (GLenum, const GLfloat*);
-typedef void (* glColor4f_t) (GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (* glDepthRangef_t) (GLclampf, GLclampf);
-typedef void (* glFogf_t) (GLenum, GLfloat);
-typedef void (* glFogfv_t) (GLenum, const GLfloat*);
-typedef void (* glFrustumf_t) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (* glGetClipPlanef_t) (GLenum, GLfloat*);
-typedef void (* glGetFloatv_t) (GLenum, GLfloat*);
-typedef void (* glGetLightfv_t) (GLenum, GLenum, GLfloat*);
-typedef void (* glGetMaterialfv_t) (GLenum, GLenum, GLfloat*);
-typedef void (* glGetTexEnvfv_t) (GLenum, GLenum, GLfloat*);
-typedef void (* glGetTexParameterfv_t) (GLenum, GLenum, GLfloat*);
-typedef void (* glLightModelf_t) (GLenum, GLfloat);
-typedef void (* glLightModelfv_t) (GLenum, const GLfloat*);
-typedef void (* glLightf_t) (GLenum, GLenum, GLfloat);
-typedef void (* glLightfv_t) (GLenum, GLenum, const GLfloat*);
-typedef void (* glLineWidth_t) (GLfloat);
-typedef void (* glLoadMatrixf_t) (const GLfloat*);
-typedef void (* glMaterialf_t) (GLenum, GLenum, GLfloat);
-typedef void (* glMaterialfv_t) (GLenum, GLenum, const GLfloat*);
-typedef void (* glMultMatrixf_t) (const GLfloat*);
-typedef void (* glMultiTexCoord4f_t) (GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (* glNormal3f_t) (GLfloat, GLfloat, GLfloat);
-typedef void (* glOrthof_t) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (* glPointParameterf_t) (GLenum, GLfloat);
-typedef void (* glPointParameterfv_t) (GLenum, const GLfloat*);
-typedef void (* glPointSize_t) (GLfloat);
-typedef void (* glPolygonOffset_t) (GLfloat, GLfloat);
-typedef void (* glRotatef_t) (GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (* glScalef_t) (GLfloat, GLfloat, GLfloat);
-typedef void (* glTexEnvf_t) (GLenum, GLenum, GLfloat);
-typedef void (* glTexEnvfv_t) (GLenum, GLenum, const GLfloat*);
-typedef void (* glTexParameterf_t) (GLenum, GLenum, GLfloat);
-typedef void (* glTexParameterfv_t) (GLenum, GLenum, const GLfloat*);
-typedef void (* glTranslatef_t) (GLfloat, GLfloat, GLfloat);
-typedef void (* glActiveTexture_t) (GLenum);
-typedef void (* glAlphaFuncx_t) (GLenum, GLclampx);
-typedef void (* glBindBuffer_t) (GLenum, GLuint);
-typedef void (* glBindTexture_t) (GLenum, GLuint);
-typedef void (* glBlendFunc_t) (GLenum, GLenum);
-typedef void (* glBufferData_t) (GLenum, GLsizeiptr, const GLvoid*, GLenum);
-typedef void (* glBufferSubData_t) (GLenum, GLintptr, GLsizeiptr, const GLvoid*);
-typedef void (* glClear_t) (GLbitfield);
-typedef void (* glClearColorx_t) (GLclampx, GLclampx, GLclampx, GLclampx);
-typedef void (* glClearDepthx_t) (GLclampx);
-typedef void (* glClearStencil_t) (GLint);
-typedef void (* glClientActiveTexture_t) (GLenum);
-typedef void (* glClipPlanex_t) (GLenum, const GLfixed*);
-typedef void (* glColor4ub_t) (GLubyte, GLubyte, GLubyte, GLubyte);
-typedef void (* glColor4x_t) (GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (* glColorMask_t) (GLboolean, GLboolean, GLboolean, GLboolean);
-typedef void (* glColorPointer_t) (GLint, GLenum, GLsizei, const GLvoid*);
-typedef void (* glCompressedTexImage2D_t) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*);
-typedef void (* glCompressedTexSubImage2D_t) (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*);
-typedef void (* glCopyTexImage2D_t) (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
-typedef void (* glCopyTexSubImage2D_t) (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
-typedef void (* glCullFace_t) (GLenum);
-typedef void (* glDeleteBuffers_t) (GLsizei, const GLuint*);
-typedef void (* glDeleteTextures_t) (GLsizei, const GLuint*);
-typedef void (* glDepthFunc_t) (GLenum);
-typedef void (* glDepthMask_t) (GLboolean);
-typedef void (* glDepthRangex_t) (GLclampx, GLclampx);
-typedef void (* glDisable_t) (GLenum);
-typedef void (* glDisableClientState_t) (GLenum);
-typedef void (* glDrawArrays_t) (GLenum, GLint, GLsizei);
-typedef void (* glDrawElements_t) (GLenum, GLsizei, GLenum, const GLvoid*);
-typedef void (* glEnable_t) (GLenum);
-typedef void (* glEnableClientState_t) (GLenum);
-typedef void (* glFinish_t) ();
-typedef void (* glFlush_t) ();
-typedef void (* glFogx_t) (GLenum, GLfixed);
-typedef void (* glFogxv_t) (GLenum, const GLfixed*);
-typedef void (* glFrontFace_t) (GLenum);
-typedef void (* glFrustumx_t) (GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (* glGetBooleanv_t) (GLenum, GLboolean*);
-typedef void (* glGetBufferParameteriv_t) (GLenum, GLenum, GLint*);
-typedef void (* glGetClipPlanex_t) (GLenum, GLfixed*);
-typedef void (* glGenBuffers_t) (GLsizei, GLuint*);
-typedef void (* glGenTextures_t) (GLsizei, GLuint*);
-typedef GLenum (* glGetError_t) ();
-typedef void (* glGetFixedv_t) (GLenum, GLfixed*);
-typedef void (* glGetIntegerv_t) (GLenum, GLint*);
-typedef void (* glGetLightxv_t) (GLenum, GLenum, GLfixed*);
-typedef void (* glGetMaterialxv_t) (GLenum, GLenum, GLfixed*);
-typedef void (* glGetPointerv_t) (GLenum, GLvoid**);
-typedef const GLubyte* (* glGetString_t) (GLenum);
-typedef void (* glGetTexEnviv_t) (GLenum, GLenum, GLint*);
-typedef void (* glGetTexEnvxv_t) (GLenum, GLenum, GLfixed*);
-typedef void (* glGetTexParameteriv_t) (GLenum, GLenum, GLint*);
-typedef void (* glGetTexParameterxv_t) (GLenum, GLenum, GLfixed*);
-typedef void (* glHint_t) (GLenum, GLenum);
-typedef GLboolean (* glIsBuffer_t) (GLuint);
-typedef GLboolean (* glIsEnabled_t) (GLenum);
-typedef GLboolean (* glIsTexture_t) (GLuint);
-typedef void (* glLightModelx_t) (GLenum, GLfixed);
-typedef void (* glLightModelxv_t) (GLenum, const GLfixed*);
-typedef void (* glLightx_t) (GLenum, GLenum, GLfixed);
-typedef void (* glLightxv_t) (GLenum, GLenum, const GLfixed*);
-typedef void (* glLineWidthx_t) (GLfixed);
-typedef void (* glLoadIdentity_t) ();
-typedef void (* glLoadMatrixx_t) (const GLfixed*);
-typedef void (* glLogicOp_t) (GLenum);
-typedef void (* glMaterialx_t) (GLenum, GLenum, GLfixed);
-typedef void (* glMaterialxv_t) (GLenum, GLenum, const GLfixed*);
-typedef void (* glMatrixMode_t) (GLenum);
-typedef void (* glMultMatrixx_t) (const GLfixed*);
-typedef void (* glMultiTexCoord4x_t) (GLenum, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (* glNormal3x_t) (GLfixed, GLfixed, GLfixed);
-typedef void (* glNormalPointer_t) (GLenum, GLsizei, const GLvoid*);
-typedef void (* glOrthox_t) (GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (* glPixelStorei_t) (GLenum, GLint);
-typedef void (* glPointParameterx_t) (GLenum, GLfixed);
-typedef void (* glPointParameterxv_t) (GLenum, const GLfixed*);
-typedef void (* glPointSizex_t) (GLfixed);
-typedef void (* glPolygonOffsetx_t) (GLfixed, GLfixed);
-typedef void (* glPopMatrix_t) ();
-typedef void (* glPushMatrix_t) ();
-typedef void (* glReadPixels_t) (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*);
-typedef void (* glRotatex_t) (GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (* glSampleCoverage_t) (GLclampf, GLboolean);
-typedef void (* glSampleCoveragex_t) (GLclampx, GLboolean);
-typedef void (* glScalex_t) (GLfixed, GLfixed, GLfixed);
-typedef void (* glScissor_t) (GLint, GLint, GLsizei, GLsizei);
-typedef void (* glShadeModel_t) (GLenum);
-typedef void (* glStencilFunc_t) (GLenum, GLint, GLuint);
-typedef void (* glStencilMask_t) (GLuint);
-typedef void (* glStencilOp_t) (GLenum, GLenum, GLenum);
-typedef void (* glTexCoordPointer_t) (GLint, GLenum, GLsizei, const GLvoid*);
-typedef void (* glTexEnvi_t) (GLenum, GLenum, GLint);
-typedef void (* glTexEnvx_t) (GLenum, GLenum, GLfixed);
-typedef void (* glTexEnviv_t) (GLenum, GLenum, const GLint*);
-typedef void (* glTexEnvxv_t) (GLenum, GLenum, const GLfixed*);
-typedef void (* glTexImage2D_t) (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*);
-typedef void (* glTexParameteri_t) (GLenum, GLenum, GLint);
-typedef void (* glTexParameterx_t) (GLenum, GLenum, GLfixed);
-typedef void (* glTexParameteriv_t) (GLenum, GLenum, const GLint*);
-typedef void (* glTexParameterxv_t) (GLenum, GLenum, const GLfixed*);
-typedef void (* glTexSubImage2D_t) (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*);
-typedef void (* glTranslatex_t) (GLfixed, GLfixed, GLfixed);
-typedef void (* glVertexPointer_t) (GLint, GLenum, GLsizei, const GLvoid*);
-typedef void (* glViewport_t) (GLint, GLint, GLsizei, GLsizei);
-typedef void (* glPointSizePointerOES_t) (GLenum, GLsizei, const GLvoid*);
-typedef void (* glBlendEquationSeparateOES_t) (GLenum, GLenum);
-typedef void (* glBlendFuncSeparateOES_t) (GLenum, GLenum, GLenum, GLenum);
-typedef void (* glBlendEquationOES_t) (GLenum);
-typedef void (* glDrawTexsOES_t) (GLshort, GLshort, GLshort, GLshort, GLshort);
-typedef void (* glDrawTexiOES_t) (GLint, GLint, GLint, GLint, GLint);
-typedef void (* glDrawTexxOES_t) (GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (* glDrawTexsvOES_t) (const GLshort*);
-typedef void (* glDrawTexivOES_t) (const GLint*);
-typedef void (* glDrawTexxvOES_t) (const GLfixed*);
-typedef void (* glDrawTexfOES_t) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (* glDrawTexfvOES_t) (const GLfloat*);
-typedef void (* glEGLImageTargetTexture2DOES_t) (GLenum, GLeglImageOES);
-typedef void (* glEGLImageTargetRenderbufferStorageOES_t) (GLenum, GLeglImageOES);
-typedef void (* glAlphaFuncxOES_t) (GLenum, GLclampx);
-typedef void (* glClearColorxOES_t) (GLclampx, GLclampx, GLclampx, GLclampx);
-typedef void (* glClearDepthxOES_t) (GLclampx);
-typedef void (* glClipPlanexOES_t) (GLenum, const GLfixed*);
-typedef void (* glColor4xOES_t) (GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (* glDepthRangexOES_t) (GLclampx, GLclampx);
-typedef void (* glFogxOES_t) (GLenum, GLfixed);
-typedef void (* glFogxvOES_t) (GLenum, const GLfixed*);
-typedef void (* glFrustumxOES_t) (GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (* glGetClipPlanexOES_t) (GLenum, GLfixed*);
-typedef void (* glGetFixedvOES_t) (GLenum, GLfixed*);
-typedef void (* glGetLightxvOES_t) (GLenum, GLenum, GLfixed*);
-typedef void (* glGetMaterialxvOES_t) (GLenum, GLenum, GLfixed*);
-typedef void (* glGetTexEnvxvOES_t) (GLenum, GLenum, GLfixed*);
-typedef void (* glGetTexParameterxvOES_t) (GLenum, GLenum, GLfixed*);
-typedef void (* glLightModelxOES_t) (GLenum, GLfixed);
-typedef void (* glLightModelxvOES_t) (GLenum, const GLfixed*);
-typedef void (* glLightxOES_t) (GLenum, GLenum, GLfixed);
-typedef void (* glLightxvOES_t) (GLenum, GLenum, const GLfixed*);
-typedef void (* glLineWidthxOES_t) (GLfixed);
-typedef void (* glLoadMatrixxOES_t) (const GLfixed*);
-typedef void (* glMaterialxOES_t) (GLenum, GLenum, GLfixed);
-typedef void (* glMaterialxvOES_t) (GLenum, GLenum, const GLfixed*);
-typedef void (* glMultMatrixxOES_t) (const GLfixed*);
-typedef void (* glMultiTexCoord4xOES_t) (GLenum, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (* glNormal3xOES_t) (GLfixed, GLfixed, GLfixed);
-typedef void (* glOrthoxOES_t) (GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (* glPointParameterxOES_t) (GLenum, GLfixed);
-typedef void (* glPointParameterxvOES_t) (GLenum, const GLfixed*);
-typedef void (* glPointSizexOES_t) (GLfixed);
-typedef void (* glPolygonOffsetxOES_t) (GLfixed, GLfixed);
-typedef void (* glRotatexOES_t) (GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (* glSampleCoveragexOES_t) (GLclampx, GLboolean);
-typedef void (* glScalexOES_t) (GLfixed, GLfixed, GLfixed);
-typedef void (* glTexEnvxOES_t) (GLenum, GLenum, GLfixed);
-typedef void (* glTexEnvxvOES_t) (GLenum, GLenum, const GLfixed*);
-typedef void (* glTexParameterxOES_t) (GLenum, GLenum, GLfixed);
-typedef void (* glTexParameterxvOES_t) (GLenum, GLenum, const GLfixed*);
-typedef void (* glTranslatexOES_t) (GLfixed, GLfixed, GLfixed);
-typedef GLboolean (* glIsRenderbufferOES_t) (GLuint);
-typedef void (* glBindRenderbufferOES_t) (GLenum, GLuint);
-typedef void (* glDeleteRenderbuffersOES_t) (GLsizei, const GLuint*);
-typedef void (* glGenRenderbuffersOES_t) (GLsizei, GLuint*);
-typedef void (* glRenderbufferStorageOES_t) (GLenum, GLenum, GLsizei, GLsizei);
-typedef void (* glGetRenderbufferParameterivOES_t) (GLenum, GLenum, GLint*);
-typedef GLboolean (* glIsFramebufferOES_t) (GLuint);
-typedef void (* glBindFramebufferOES_t) (GLenum, GLuint);
-typedef void (* glDeleteFramebuffersOES_t) (GLsizei, const GLuint*);
-typedef void (* glGenFramebuffersOES_t) (GLsizei, GLuint*);
-typedef GLenum (* glCheckFramebufferStatusOES_t) (GLenum);
-typedef void (* glFramebufferRenderbufferOES_t) (GLenum, GLenum, GLenum, GLuint);
-typedef void (* glFramebufferTexture2DOES_t) (GLenum, GLenum, GLenum, GLuint, GLint);
-typedef void (* glGetFramebufferAttachmentParameterivOES_t) (GLenum, GLenum, GLenum, GLint*);
-typedef void (* glGenerateMipmapOES_t) (GLenum);
-typedef void* (* glMapBufferOES_t) (GLenum, GLenum);
-typedef GLboolean (* glUnmapBufferOES_t) (GLenum);
-typedef void (* glGetBufferPointervOES_t) (GLenum, GLenum, GLvoid*);
-typedef void (* glCurrentPaletteMatrixOES_t) (GLuint);
-typedef void (* glLoadPaletteFromModelViewMatrixOES_t) ();
-typedef void (* glMatrixIndexPointerOES_t) (GLint, GLenum, GLsizei, const GLvoid*);
-typedef void (* glWeightPointerOES_t) (GLint, GLenum, GLsizei, const GLvoid*);
-typedef GLbitfield (* glQueryMatrixxOES_t) (GLfixed*, GLint*);
-typedef void (* glDepthRangefOES_t) (GLclampf, GLclampf);
-typedef void (* glFrustumfOES_t) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (* glOrthofOES_t) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (* glClipPlanefOES_t) (GLenum, const GLfloat*);
-typedef void (* glGetClipPlanefOES_t) (GLenum, GLfloat*);
-typedef void (* glClearDepthfOES_t) (GLclampf);
-typedef void (* glTexGenfOES_t) (GLenum, GLenum, GLfloat);
-typedef void (* glTexGenfvOES_t) (GLenum, GLenum, const GLfloat*);
-typedef void (* glTexGeniOES_t) (GLenum, GLenum, GLint);
-typedef void (* glTexGenivOES_t) (GLenum, GLenum, const GLint*);
-typedef void (* glTexGenxOES_t) (GLenum, GLenum, GLfixed);
-typedef void (* glTexGenxvOES_t) (GLenum, GLenum, const GLfixed*);
-typedef void (* glGetTexGenfvOES_t) (GLenum, GLenum, GLfloat*);
-typedef void (* glGetTexGenivOES_t) (GLenum, GLenum, GLint*);
-typedef void (* glGetTexGenxvOES_t) (GLenum, GLenum, GLfixed*);
-typedef void (* glBindVertexArrayOES_t) (GLuint);
-typedef void (* glDeleteVertexArraysOES_t) (GLsizei, const GLuint*);
-typedef void (* glGenVertexArraysOES_t) (GLsizei, GLuint*);
-typedef GLboolean (* glIsVertexArrayOES_t) (GLuint);
-typedef void (* glDiscardFramebufferEXT_t) (GLenum, GLsizei, const GLenum*);
-typedef void (* glMultiDrawArraysEXT_t) (GLenum, GLint*, GLsizei*, GLsizei);
-typedef void (* glMultiDrawElementsEXT_t) (GLenum, const GLsizei*, GLenum, const GLvoid**, GLsizei);
-typedef void (* glClipPlanefIMG_t) (GLenum, const GLfloat*);
-typedef void (* glClipPlanexIMG_t) (GLenum, const GLfixed*);
-typedef void (* glRenderbufferStorageMultisampleIMG_t) (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
-typedef void (* glFramebufferTexture2DMultisampleIMG_t) (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
-typedef void (* glDeleteFencesNV_t) (GLsizei, const GLuint*);
-typedef void (* glGenFencesNV_t) (GLsizei, GLuint*);
-typedef GLboolean (* glIsFenceNV_t) (GLuint);
-typedef GLboolean (* glTestFenceNV_t) (GLuint);
-typedef void (* glGetFenceivNV_t) (GLuint, GLenum, GLint*);
-typedef void (* glFinishFenceNV_t) (GLuint);
-typedef void (* glSetFenceNV_t) (GLuint, GLenum);
-typedef void (* glGetDriverControlsQCOM_t) (GLint*, GLsizei, GLuint*);
-typedef void (* glGetDriverControlStringQCOM_t) (GLuint, GLsizei, GLsizei*, GLchar*);
-typedef void (* glEnableDriverControlQCOM_t) (GLuint);
-typedef void (* glDisableDriverControlQCOM_t) (GLuint);
-typedef void (* glExtGetTexturesQCOM_t) (GLuint*, GLint, GLint*);
-typedef void (* glExtGetBuffersQCOM_t) (GLuint*, GLint, GLint*);
-typedef void (* glExtGetRenderbuffersQCOM_t) (GLuint*, GLint, GLint*);
-typedef void (* glExtGetFramebuffersQCOM_t) (GLuint*, GLint, GLint*);
-typedef void (* glExtGetTexLevelParameterivQCOM_t) (GLuint, GLenum, GLint, GLenum, GLint*);
-typedef void (* glExtTexObjectStateOverrideiQCOM_t) (GLenum, GLenum, GLint);
-typedef void (* glExtGetTexSubImageQCOM_t) (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLvoid*);
-typedef void (* glExtGetBufferPointervQCOM_t) (GLenum, GLvoid**);
-typedef void (* glExtGetShadersQCOM_t) (GLuint*, GLint, GLint*);
-typedef void (* glExtGetProgramsQCOM_t) (GLuint*, GLint, GLint*);
-typedef GLboolean (* glExtIsProgramBinaryQCOM_t) (GLuint);
-typedef void (* glExtGetProgramBinarySourceQCOM_t) (GLuint, GLenum, GLchar*, GLint*);
-typedef void (* glStartTilingQCOM_t) (GLuint, GLuint, GLuint, GLuint, GLbitfield);
-typedef void (* glEndTilingQCOM_t) (GLbitfield);
-
-
-#endif
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/glesv1_emul_ifc.cpp b/tools/emulator/opengl/tests/gles_android_wrapper/glesv1_emul_ifc.cpp
deleted file mode 100644
index 26c98a833..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/glesv1_emul_ifc.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-* Copyright 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.
-*/
-
-#include <stdlib.h>
-#include "ApiInitializer.h"
-#include <dlfcn.h>
-#include "gl_wrapper_context.h"
-
-extern "C" {
- gl_wrapper_context_t *createFromLib(void *solib, gl_wrapper_context_t *(*accessor)());
-}
-
-gl_wrapper_context_t * createFromLib(void *solib, gl_wrapper_context_t *(accessor)())
-{
- gl_wrapper_context_t *ctx = new gl_wrapper_context_t;
- if (ctx == NULL) {
- return NULL;
- }
- ApiInitializer *initializer = new ApiInitializer(solib);
- ctx->initDispatchByName(ApiInitializer::s_getProc, initializer);
- gl_wrapper_context_t::setContextAccessor(accessor);
- delete initializer;
- return ctx;
-}
-
-
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/glesv2_emul_ifc.cpp b/tools/emulator/opengl/tests/gles_android_wrapper/glesv2_emul_ifc.cpp
deleted file mode 100644
index 4ae13dd22..000000000
--- a/tools/emulator/opengl/tests/gles_android_wrapper/glesv2_emul_ifc.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-* Copyright 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.
-*/
-
-#include <stdlib.h>
-#include "ApiInitializer.h"
-#include <dlfcn.h>
-#include "gl2_wrapper_context.h"
-
-extern "C" {
- gl2_wrapper_context_t *createFromLib(void *solib, gl2_wrapper_context_t *(*accessor)());
-}
-
-gl2_wrapper_context_t * createFromLib(void *solib, gl2_wrapper_context_t *(*accessor)())
-{
- gl2_wrapper_context_t *ctx = new gl2_wrapper_context_t;
- if (ctx == NULL) {
- return NULL;
- }
- ApiInitializer *initializer = new ApiInitializer(solib);
- ctx->initDispatchByName(ApiInitializer::s_getProc, initializer);
- gl2_wrapper_context_t::setContextAccessor(accessor);
- delete initializer;
- return ctx;
-}
-
-
-
diff --git a/tools/emulator/opengl/tests/ut_rendercontrol_enc/Android.mk b/tools/emulator/opengl/tests/ut_rendercontrol_enc/Android.mk
deleted file mode 100644
index ae234b2c4..000000000
--- a/tools/emulator/opengl/tests/ut_rendercontrol_enc/Android.mk
+++ /dev/null
@@ -1,8 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-$(call emugl-begin-shared-library,libut_rendercontrol_enc)
-$(call emugl-import,libOpenglCodecCommon)
-$(call emugl-gen-encoder,$(LOCAL_PATH),ut_rendercontrol)
-$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-$(call emugl-end-module)
-
diff --git a/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.attrib b/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.attrib
deleted file mode 100644
index c47a9f99f..000000000
--- a/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.attrib
+++ /dev/null
@@ -1,4 +0,0 @@
-GLOBAL
- base_opcode 10000
- encoder_headers <stdint.h>
-
diff --git a/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.in b/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.in
deleted file mode 100644
index 0d5942f9f..000000000
--- a/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.in
+++ /dev/null
@@ -1,11 +0,0 @@
-GL_ENTRY(int, createContext, uint32_t pid, uint32_t handle, uint32_t shareCtx, int version)
-GL_ENTRY(int, createSurface, uint32_t pid, uint32_t handle)
-GL_ENTRY(int, makeCurrentContext, uint32_t pid, uint32_t drawSurface, uint32_t readSurface, uint32_t ctxHandle)
-GL_ENTRY(void, swapBuffers, uint32_t pid, uint32_t surface)
-GL_ENTRY(int, destroyContext, uint32_t pid, uint32_t handle)
-GL_ENTRY(int, destroySurface, uint32_t pid, uint32_t handle)
-
-
-
-
-
diff --git a/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.types b/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.types
deleted file mode 100644
index 9d945ab54..000000000
--- a/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.types
+++ /dev/null
@@ -1,2 +0,0 @@
-uint32_t 32 0x%08x false
-
diff --git a/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol_types.h b/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol_types.h
deleted file mode 100644
index 9b7864dc1..000000000
--- a/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol_types.h
+++ /dev/null
@@ -1,17 +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.
-*/
-
-#include <stdint.h>
diff --git a/tools/emulator/system/camera/Android.mk b/tools/emulator/system/camera/Android.mk
deleted file mode 100755
index 83dcefed0..000000000
--- a/tools/emulator/system/camera/Android.mk
+++ /dev/null
@@ -1,72 +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.
-
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
-LOCAL_CFLAGS += -fno-short-enums -DQEMU_HARDWARE
-LOCAL_SHARED_LIBRARIES:= \
- libbinder \
- libutils \
- libcutils \
- libcamera_client \
- libui \
-
-# JPEG conversion libraries and includes.
-LOCAL_SHARED_LIBRARIES += \
- libjpeg \
- libskia \
- libandroid_runtime \
- libcamera_metadata
-
-LOCAL_C_INCLUDES += external/jpeg \
- external/skia/include/core/ \
- frameworks/native/include/media/hardware \
- frameworks/base/core/jni/android/graphics \
- $(LOCAL_PATH)/../../opengl/system/OpenglSystemCommon \
- $(call include-path-for, camera)
-
-LOCAL_SRC_FILES := \
- EmulatedCameraHal.cpp \
- EmulatedCameraFactory.cpp \
- EmulatedBaseCamera.cpp \
- EmulatedCamera.cpp \
- EmulatedCameraDevice.cpp \
- EmulatedQemuCamera.cpp \
- EmulatedQemuCameraDevice.cpp \
- EmulatedFakeCamera.cpp \
- EmulatedFakeCameraDevice.cpp \
- Converters.cpp \
- PreviewWindow.cpp \
- CallbackNotifier.cpp \
- QemuClient.cpp \
- JpegCompressor.cpp \
- EmulatedCamera2.cpp \
- EmulatedFakeCamera2.cpp \
- EmulatedQemuCamera2.cpp \
- fake-pipeline2/Scene.cpp \
- fake-pipeline2/Sensor.cpp \
- fake-pipeline2/JpegCompressor.cpp
-
-
-ifeq ($(TARGET_PRODUCT),vbox_x86)
-LOCAL_MODULE := camera.vbox_x86
-else
-LOCAL_MODULE := camera.goldfish
-endif
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tools/emulator/system/camera/CallbackNotifier.cpp b/tools/emulator/system/camera/CallbackNotifier.cpp
deleted file mode 100755
index 140c872b3..000000000
--- a/tools/emulator/system/camera/CallbackNotifier.cpp
+++ /dev/null
@@ -1,294 +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.
- */
-
-/*
- * Contains implementation of a class CallbackNotifier that manages callbacks set
- * via set_callbacks, enable_msg_type, and disable_msg_type camera HAL API.
- */
-
-#define LOG_NDEBUG 0
-#define LOG_TAG "EmulatedCamera_CallbackNotifier"
-#include <cutils/log.h>
-#include <MetadataBufferType.h>
-#include "EmulatedCameraDevice.h"
-#include "CallbackNotifier.h"
-#include "JpegCompressor.h"
-
-namespace android {
-
-/* String representation of camera messages. */
-static const char* lCameraMessages[] =
-{
- "CAMERA_MSG_ERROR",
- "CAMERA_MSG_SHUTTER",
- "CAMERA_MSG_FOCUS",
- "CAMERA_MSG_ZOOM",
- "CAMERA_MSG_PREVIEW_FRAME",
- "CAMERA_MSG_VIDEO_FRAME",
- "CAMERA_MSG_POSTVIEW_FRAME",
- "CAMERA_MSG_RAW_IMAGE",
- "CAMERA_MSG_COMPRESSED_IMAGE",
- "CAMERA_MSG_RAW_IMAGE_NOTIFY",
- "CAMERA_MSG_PREVIEW_METADATA"
-};
-static const int lCameraMessagesNum = sizeof(lCameraMessages) / sizeof(char*);
-
-/* Builds an array of strings for the given set of messages.
- * Param:
- * msg - Messages to get strings for,
- * strings - Array where to save strings
- * max - Maximum number of entries in the array.
- * Return:
- * Number of strings saved into the 'strings' array.
- */
-static int GetMessageStrings(uint32_t msg, const char** strings, int max)
-{
- int index = 0;
- int out = 0;
- while (msg != 0 && out < max && index < lCameraMessagesNum) {
- while ((msg & 0x1) == 0 && index < lCameraMessagesNum) {
- msg >>= 1;
- index++;
- }
- if ((msg & 0x1) != 0 && index < lCameraMessagesNum) {
- strings[out] = lCameraMessages[index];
- out++;
- msg >>= 1;
- index++;
- }
- }
-
- return out;
-}
-
-/* Logs messages, enabled by the mask. */
-static void PrintMessages(uint32_t msg)
-{
- const char* strs[lCameraMessagesNum];
- const int translated = GetMessageStrings(msg, strs, lCameraMessagesNum);
- for (int n = 0; n < translated; n++) {
- ALOGV(" %s", strs[n]);
- }
-}
-
-CallbackNotifier::CallbackNotifier()
- : mNotifyCB(NULL),
- mDataCB(NULL),
- mDataCBTimestamp(NULL),
- mGetMemoryCB(NULL),
- mCBOpaque(NULL),
- mLastFrameTimestamp(0),
- mFrameRefreshFreq(0),
- mMessageEnabler(0),
- mJpegQuality(90),
- mVideoRecEnabled(false),
- mTakingPicture(false)
-{
-}
-
-CallbackNotifier::~CallbackNotifier()
-{
-}
-
-/****************************************************************************
- * Camera API
- ***************************************************************************/
-
-void CallbackNotifier::setCallbacks(camera_notify_callback notify_cb,
- camera_data_callback data_cb,
- camera_data_timestamp_callback data_cb_timestamp,
- camera_request_memory get_memory,
- void* user)
-{
- ALOGV("%s: %p, %p, %p, %p (%p)",
- __FUNCTION__, notify_cb, data_cb, data_cb_timestamp, get_memory, user);
-
- Mutex::Autolock locker(&mObjectLock);
- mNotifyCB = notify_cb;
- mDataCB = data_cb;
- mDataCBTimestamp = data_cb_timestamp;
- mGetMemoryCB = get_memory;
- mCBOpaque = user;
-}
-
-void CallbackNotifier::enableMessage(uint msg_type)
-{
- ALOGV("%s: msg_type = 0x%x", __FUNCTION__, msg_type);
- PrintMessages(msg_type);
-
- Mutex::Autolock locker(&mObjectLock);
- mMessageEnabler |= msg_type;
- ALOGV("**** Currently enabled messages:");
- PrintMessages(mMessageEnabler);
-}
-
-void CallbackNotifier::disableMessage(uint msg_type)
-{
- ALOGV("%s: msg_type = 0x%x", __FUNCTION__, msg_type);
- PrintMessages(msg_type);
-
- Mutex::Autolock locker(&mObjectLock);
- mMessageEnabler &= ~msg_type;
- ALOGV("**** Currently enabled messages:");
- PrintMessages(mMessageEnabler);
-}
-
-status_t CallbackNotifier::enableVideoRecording(int fps)
-{
- ALOGV("%s: FPS = %d", __FUNCTION__, fps);
-
- Mutex::Autolock locker(&mObjectLock);
- mVideoRecEnabled = true;
- mLastFrameTimestamp = 0;
- mFrameRefreshFreq = 1000000000LL / fps;
-
- return NO_ERROR;
-}
-
-void CallbackNotifier::disableVideoRecording()
-{
- ALOGV("%s:", __FUNCTION__);
-
- Mutex::Autolock locker(&mObjectLock);
- mVideoRecEnabled = false;
- mLastFrameTimestamp = 0;
- mFrameRefreshFreq = 0;
-}
-
-void CallbackNotifier::releaseRecordingFrame(const void* opaque)
-{
- /* We don't really have anything to release here, since we report video
- * frames by copying them directly to the camera memory. */
-}
-
-status_t CallbackNotifier::storeMetaDataInBuffers(bool enable)
-{
- /* Return INVALID_OPERATION means HAL does not support metadata. So HAL will
- * return actual frame data with CAMERA_MSG_VIDEO_FRRAME. Return
- * INVALID_OPERATION to mean metadata is not supported. */
- return INVALID_OPERATION;
-}
-
-/****************************************************************************
- * Public API
- ***************************************************************************/
-
-void CallbackNotifier::cleanupCBNotifier()
-{
- Mutex::Autolock locker(&mObjectLock);
- mMessageEnabler = 0;
- mNotifyCB = NULL;
- mDataCB = NULL;
- mDataCBTimestamp = NULL;
- mGetMemoryCB = NULL;
- mCBOpaque = NULL;
- mLastFrameTimestamp = 0;
- mFrameRefreshFreq = 0;
- mJpegQuality = 90;
- mVideoRecEnabled = false;
- mTakingPicture = false;
-}
-
-void CallbackNotifier::onNextFrameAvailable(const void* frame,
- nsecs_t timestamp,
- EmulatedCameraDevice* camera_dev)
-{
- if (isMessageEnabled(CAMERA_MSG_VIDEO_FRAME) && isVideoRecordingEnabled() &&
- isNewVideoFrameTime(timestamp)) {
- camera_memory_t* cam_buff =
- mGetMemoryCB(-1, camera_dev->getFrameBufferSize(), 1, NULL);
- if (NULL != cam_buff && NULL != cam_buff->data) {
- memcpy(cam_buff->data, frame, camera_dev->getFrameBufferSize());
- mDataCBTimestamp(timestamp, CAMERA_MSG_VIDEO_FRAME,
- cam_buff, 0, mCBOpaque);
- } else {
- ALOGE("%s: Memory failure in CAMERA_MSG_VIDEO_FRAME", __FUNCTION__);
- }
- }
-
- if (isMessageEnabled(CAMERA_MSG_PREVIEW_FRAME)) {
- camera_memory_t* cam_buff =
- mGetMemoryCB(-1, camera_dev->getFrameBufferSize(), 1, NULL);
- if (NULL != cam_buff && NULL != cam_buff->data) {
- memcpy(cam_buff->data, frame, camera_dev->getFrameBufferSize());
- mDataCB(CAMERA_MSG_PREVIEW_FRAME, cam_buff, 0, NULL, mCBOpaque);
- cam_buff->release(cam_buff);
- } else {
- ALOGE("%s: Memory failure in CAMERA_MSG_PREVIEW_FRAME", __FUNCTION__);
- }
- }
-
- if (mTakingPicture) {
- /* This happens just once. */
- mTakingPicture = false;
- /* The sequence of callbacks during picture taking is:
- * - CAMERA_MSG_SHUTTER
- * - CAMERA_MSG_RAW_IMAGE_NOTIFY
- * - CAMERA_MSG_COMPRESSED_IMAGE
- */
- if (isMessageEnabled(CAMERA_MSG_SHUTTER)) {
- mNotifyCB(CAMERA_MSG_SHUTTER, 0, 0, mCBOpaque);
- }
- if (isMessageEnabled(CAMERA_MSG_RAW_IMAGE_NOTIFY)) {
- mNotifyCB(CAMERA_MSG_RAW_IMAGE_NOTIFY, 0, 0, mCBOpaque);
- }
- if (isMessageEnabled(CAMERA_MSG_COMPRESSED_IMAGE)) {
- /* Compress the frame to JPEG. Note that when taking pictures, we
- * have requested camera device to provide us with NV21 frames. */
- NV21JpegCompressor compressor;
- status_t res =
- compressor.compressRawImage(frame, camera_dev->getFrameWidth(),
- camera_dev->getFrameHeight(),
- mJpegQuality);
- if (res == NO_ERROR) {
- camera_memory_t* jpeg_buff =
- mGetMemoryCB(-1, compressor.getCompressedSize(), 1, NULL);
- if (NULL != jpeg_buff && NULL != jpeg_buff->data) {
- compressor.getCompressedImage(jpeg_buff->data);
- mDataCB(CAMERA_MSG_COMPRESSED_IMAGE, jpeg_buff, 0, NULL, mCBOpaque);
- jpeg_buff->release(jpeg_buff);
- } else {
- ALOGE("%s: Memory failure in CAMERA_MSG_VIDEO_FRAME", __FUNCTION__);
- }
- } else {
- ALOGE("%s: Compression failure in CAMERA_MSG_VIDEO_FRAME", __FUNCTION__);
- }
- }
- }
-}
-
-void CallbackNotifier::onCameraDeviceError(int err)
-{
- if (isMessageEnabled(CAMERA_MSG_ERROR) && mNotifyCB != NULL) {
- mNotifyCB(CAMERA_MSG_ERROR, err, 0, mCBOpaque);
- }
-}
-
-/****************************************************************************
- * Private API
- ***************************************************************************/
-
-bool CallbackNotifier::isNewVideoFrameTime(nsecs_t timestamp)
-{
- Mutex::Autolock locker(&mObjectLock);
- if ((timestamp - mLastFrameTimestamp) >= mFrameRefreshFreq) {
- mLastFrameTimestamp = timestamp;
- return true;
- }
- return false;
-}
-
-}; /* namespace android */
diff --git a/tools/emulator/system/camera/CallbackNotifier.h b/tools/emulator/system/camera/CallbackNotifier.h
deleted file mode 100755
index 63301d2e3..000000000
--- a/tools/emulator/system/camera/CallbackNotifier.h
+++ /dev/null
@@ -1,233 +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.
- */
-
-#ifndef HW_EMULATOR_CAMERA_CALLBACK_NOTIFIER_H
-#define HW_EMULATOR_CAMERA_CALLBACK_NOTIFIER_H
-
-/*
- * Contains declaration of a class CallbackNotifier that manages callbacks set
- * via set_callbacks, enable_msg_type, and disable_msg_type camera HAL API.
- */
-
-namespace android {
-
-class EmulatedCameraDevice;
-
-/* Manages callbacks set via set_callbacks, enable_msg_type, and disable_msg_type
- * camera HAL API.
- *
- * Objects of this class are contained in EmulatedCamera objects, and handle
- * relevant camera API callbacks.
- * Locking considerations. Apparently, it's not allowed to call callbacks
- * registered in this class, while holding a lock: recursion is quite possible,
- * which will cause a deadlock.
- */
-class CallbackNotifier {
-public:
- /* Constructs CallbackNotifier instance. */
- CallbackNotifier();
-
- /* Destructs CallbackNotifier instance. */
- ~CallbackNotifier();
-
- /****************************************************************************
- * Camera API
- ***************************************************************************/
-
-public:
- /* Actual handler for camera_device_ops_t::set_callbacks callback.
- * This method is called by the containing emulated camera object when it is
- * handing the camera_device_ops_t::set_callbacks callback.
- */
- void setCallbacks(camera_notify_callback notify_cb,
- camera_data_callback data_cb,
- camera_data_timestamp_callback data_cb_timestamp,
- camera_request_memory get_memory,
- void* user);
-
- /* Actual handler for camera_device_ops_t::enable_msg_type callback.
- * This method is called by the containing emulated camera object when it is
- * handing the camera_device_ops_t::enable_msg_type callback.
- */
- void enableMessage(uint msg_type);
-
- /* Actual handler for camera_device_ops_t::disable_msg_type callback.
- * This method is called by the containing emulated camera object when it is
- * handing the camera_device_ops_t::disable_msg_type callback.
- */
- void disableMessage(uint msg_type);
-
- /* Actual handler for camera_device_ops_t::store_meta_data_in_buffers
- * callback. This method is called by the containing emulated camera object
- * when it is handing the camera_device_ops_t::store_meta_data_in_buffers
- * callback.
- * Return:
- * NO_ERROR on success, or an appropriate error status.
- */
- status_t storeMetaDataInBuffers(bool enable);
-
- /* Enables video recording.
- * This method is called by the containing emulated camera object when it is
- * handing the camera_device_ops_t::start_recording callback.
- * Param:
- * fps - Video frame frequency. This parameter determins when a frame
- * received via onNextFrameAvailable call will be pushed through the
- * callback.
- * Return:
- * NO_ERROR on success, or an appropriate error status.
- */
- status_t enableVideoRecording(int fps);
-
- /* Disables video recording.
- * This method is called by the containing emulated camera object when it is
- * handing the camera_device_ops_t::stop_recording callback.
- */
- void disableVideoRecording();
-
- /* Releases video frame, sent to the framework.
- * This method is called by the containing emulated camera object when it is
- * handing the camera_device_ops_t::release_recording_frame callback.
- */
- void releaseRecordingFrame(const void* opaque);
-
- /* Actual handler for camera_device_ops_t::msg_type_enabled callback.
- * This method is called by the containing emulated camera object when it is
- * handing the camera_device_ops_t::msg_type_enabled callback.
- * Note: this method doesn't grab a lock while checking message status, since
- * upon exit the status would be undefined anyway. So, grab a lock before
- * calling this method if you care about persisting a defined message status.
- * Return:
- * 0 if message is disabled, or non-zero value, if message is enabled.
- */
- inline int isMessageEnabled(uint msg_type)
- {
- return mMessageEnabler & msg_type;
- }
-
- /* Checks id video recording is enabled.
- * This method is called by the containing emulated camera object when it is
- * handing the camera_device_ops_t::recording_enabled callback.
- * Note: this method doesn't grab a lock while checking video recordin status,
- * since upon exit the status would be undefined anyway. So, grab a lock
- * before calling this method if you care about persisting of a defined video
- * recording status.
- * Return:
- * true if video recording is enabled, or false if it is disabled.
- */
- inline bool isVideoRecordingEnabled()
- {
- return mVideoRecEnabled;
- }
-
- /****************************************************************************
- * Public API
- ***************************************************************************/
-
-public:
- /* Resets the callback notifier. */
- void cleanupCBNotifier();
-
- /* Next frame is available in the camera device.
- * This is a notification callback that is invoked by the camera device when
- * a new frame is available.
- * Note that most likely this method is called in context of a worker thread
- * that camera device has created for frame capturing.
- * Param:
- * frame - Captured frame, or NULL if camera device didn't pull the frame
- * yet. If NULL is passed in this parameter use GetCurrentFrame method
- * of the camera device class to obtain the next frame. Also note that
- * the size of the frame that is passed here (as well as the frame
- * returned from the GetCurrentFrame method) is defined by the current
- * frame settings (width + height + pixel format) for the camera device.
- * timestamp - Frame's timestamp.
- * camera_dev - Camera device instance that delivered the frame.
- */
- void onNextFrameAvailable(const void* frame,
- nsecs_t timestamp,
- EmulatedCameraDevice* camera_dev);
-
- /* Entry point for notifications that occur in camera device.
- * Param:
- * err - CAMERA_ERROR_XXX error code.
- */
- void onCameraDeviceError(int err);
-
- /* Sets, or resets taking picture state.
- * This state control whether or not to notify the framework about compressed
- * image, shutter, and other picture related events.
- */
- void setTakingPicture(bool taking)
- {
- mTakingPicture = taking;
- }
-
- /* Sets JPEG quality used to compress frame during picture taking. */
- void setJpegQuality(int jpeg_quality)
- {
- mJpegQuality = jpeg_quality;
- }
-
- /****************************************************************************
- * Private API
- ***************************************************************************/
-
-protected:
- /* Checks if it's time to push new video frame.
- * Note that this method must be called while object is locked.
- * Param:
- * timestamp - Timestamp for the new frame. */
- bool isNewVideoFrameTime(nsecs_t timestamp);
-
- /****************************************************************************
- * Data members
- ***************************************************************************/
-
-protected:
- /* Locks this instance for data change. */
- Mutex mObjectLock;
-
- /*
- * Callbacks, registered in set_callbacks.
- */
-
- camera_notify_callback mNotifyCB;
- camera_data_callback mDataCB;
- camera_data_timestamp_callback mDataCBTimestamp;
- camera_request_memory mGetMemoryCB;
- void* mCBOpaque;
-
- /* Timestamp when last frame has been delivered to the framework. */
- nsecs_t mLastFrameTimestamp;
-
- /* Video frequency in nanosec. */
- nsecs_t mFrameRefreshFreq;
-
- /* Message enabler. */
- uint32_t mMessageEnabler;
-
- /* JPEG quality used to compress frame during picture taking. */
- int mJpegQuality;
-
- /* Video recording status. */
- bool mVideoRecEnabled;
-
- /* Picture taking status. */
- bool mTakingPicture;
-};
-
-}; /* namespace android */
-
-#endif /* HW_EMULATOR_CAMERA_CALLBACK_NOTIFIER_H */
diff --git a/tools/emulator/system/camera/Converters.cpp b/tools/emulator/system/camera/Converters.cpp
deleted file mode 100755
index f63f67f11..000000000
--- a/tools/emulator/system/camera/Converters.cpp
+++ /dev/null
@@ -1,173 +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.
- */
-
-/*
- * Contains implemenation of framebuffer conversion routines.
- */
-
-#define LOG_NDEBUG 0
-#define LOG_TAG "EmulatedCamera_Converter"
-#include <cutils/log.h>
-#include "Converters.h"
-
-namespace android {
-
-static void _YUV420SToRGB565(const uint8_t* Y,
- const uint8_t* U,
- const uint8_t* V,
- int dUV,
- uint16_t* rgb,
- int width,
- int height)
-{
- const uint8_t* U_pos = U;
- const uint8_t* V_pos = V;
-
- for (int y = 0; y < height; y++) {
- for (int x = 0; x < width; x += 2, U += dUV, V += dUV) {
- const uint8_t nU = *U;
- const uint8_t nV = *V;
- *rgb = YUVToRGB565(*Y, nU, nV);
- Y++; rgb++;
- *rgb = YUVToRGB565(*Y, nU, nV);
- Y++; rgb++;
- }
- if (y & 0x1) {
- U_pos = U;
- V_pos = V;
- } else {
- U = U_pos;
- V = V_pos;
- }
- }
-}
-
-static void _YUV420SToRGB32(const uint8_t* Y,
- const uint8_t* U,
- const uint8_t* V,
- int dUV,
- uint32_t* rgb,
- int width,
- int height)
-{
- const uint8_t* U_pos = U;
- const uint8_t* V_pos = V;
-
- for (int y = 0; y < height; y++) {
- for (int x = 0; x < width; x += 2, U += dUV, V += dUV) {
- const uint8_t nU = *U;
- const uint8_t nV = *V;
- *rgb = YUVToRGB32(*Y, nU, nV);
- Y++; rgb++;
- *rgb = YUVToRGB32(*Y, nU, nV);
- Y++; rgb++;
- }
- if (y & 0x1) {
- U_pos = U;
- V_pos = V;
- } else {
- U = U_pos;
- V = V_pos;
- }
- }
-}
-
-void YV12ToRGB565(const void* yv12, void* rgb, int width, int height)
-{
- const int pix_total = width * height;
- const uint8_t* Y = reinterpret_cast<const uint8_t*>(yv12);
- const uint8_t* U = Y + pix_total;
- const uint8_t* V = U + pix_total / 4;
- _YUV420SToRGB565(Y, U, V, 1, reinterpret_cast<uint16_t*>(rgb), width, height);
-}
-
-void YV12ToRGB32(const void* yv12, void* rgb, int width, int height)
-{
- const int pix_total = width * height;
- const uint8_t* Y = reinterpret_cast<const uint8_t*>(yv12);
- const uint8_t* V = Y + pix_total;
- const uint8_t* U = V + pix_total / 4;
- _YUV420SToRGB32(Y, U, V, 1, reinterpret_cast<uint32_t*>(rgb), width, height);
-}
-
-void YU12ToRGB32(const void* yu12, void* rgb, int width, int height)
-{
- const int pix_total = width * height;
- const uint8_t* Y = reinterpret_cast<const uint8_t*>(yu12);
- const uint8_t* U = Y + pix_total;
- const uint8_t* V = U + pix_total / 4;
- _YUV420SToRGB32(Y, U, V, 1, reinterpret_cast<uint32_t*>(rgb), width, height);
-}
-
-/* Common converter for YUV 4:2:0 interleaved to RGB565.
- * y, u, and v point to Y,U, and V panes, where U and V values are interleaved.
- */
-static void _NVXXToRGB565(const uint8_t* Y,
- const uint8_t* U,
- const uint8_t* V,
- uint16_t* rgb,
- int width,
- int height)
-{
- _YUV420SToRGB565(Y, U, V, 2, rgb, width, height);
-}
-
-/* Common converter for YUV 4:2:0 interleaved to RGB32.
- * y, u, and v point to Y,U, and V panes, where U and V values are interleaved.
- */
-static void _NVXXToRGB32(const uint8_t* Y,
- const uint8_t* U,
- const uint8_t* V,
- uint32_t* rgb,
- int width,
- int height)
-{
- _YUV420SToRGB32(Y, U, V, 2, rgb, width, height);
-}
-
-void NV12ToRGB565(const void* nv12, void* rgb, int width, int height)
-{
- const int pix_total = width * height;
- const uint8_t* y = reinterpret_cast<const uint8_t*>(nv12);
- _NVXXToRGB565(y, y + pix_total, y + pix_total + 1,
- reinterpret_cast<uint16_t*>(rgb), width, height);
-}
-
-void NV12ToRGB32(const void* nv12, void* rgb, int width, int height)
-{
- const int pix_total = width * height;
- const uint8_t* y = reinterpret_cast<const uint8_t*>(nv12);
- _NVXXToRGB32(y, y + pix_total, y + pix_total + 1,
- reinterpret_cast<uint32_t*>(rgb), width, height);
-}
-
-void NV21ToRGB565(const void* nv21, void* rgb, int width, int height)
-{
- const int pix_total = width * height;
- const uint8_t* y = reinterpret_cast<const uint8_t*>(nv21);
- _NVXXToRGB565(y, y + pix_total + 1, y + pix_total,
- reinterpret_cast<uint16_t*>(rgb), width, height);
-}
-
-void NV21ToRGB32(const void* nv21, void* rgb, int width, int height)
-{
- const int pix_total = width * height;
- const uint8_t* y = reinterpret_cast<const uint8_t*>(nv21);
- _NVXXToRGB32(y, y + pix_total + 1, y + pix_total,
- reinterpret_cast<uint32_t*>(rgb), width, height);
-}
-
-}; /* namespace android */
diff --git a/tools/emulator/system/camera/Converters.h b/tools/emulator/system/camera/Converters.h
deleted file mode 100755
index 13e2a8540..000000000
--- a/tools/emulator/system/camera/Converters.h
+++ /dev/null
@@ -1,314 +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.
- */
-
-#ifndef HW_EMULATOR_CAMERA_CONVERTERS_H
-#define HW_EMULATOR_CAMERA_CONVERTERS_H
-
-#include <endian.h>
-
-#ifndef __BYTE_ORDER
-#error "could not determine byte order"
-#endif
-
-/*
- * Contains declaration of framebuffer conversion routines.
- *
- * NOTE: RGB and big/little endian considerations. Wherewer in this code RGB
- * pixels are represented as WORD, or DWORD, the color order inside the
- * WORD / DWORD matches the one that would occur if that WORD / DWORD would have
- * been read from the typecasted framebuffer:
- *
- * const uint32_t rgb = *reinterpret_cast<const uint32_t*>(framebuffer);
- *
- * So, if this code runs on the little endian CPU, red color in 'rgb' would be
- * masked as 0x000000ff, and blue color would be masked as 0x00ff0000, while if
- * the code runs on a big endian CPU, the red color in 'rgb' would be masked as
- * 0xff000000, and blue color would be masked as 0x0000ff00,
- */
-
-namespace android {
-
-/*
- * RGB565 color masks
- */
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-static const uint16_t kRed5 = 0x001f;
-static const uint16_t kGreen6 = 0x07e0;
-static const uint16_t kBlue5 = 0xf800;
-#else // __BYTE_ORDER
-static const uint16_t kRed5 = 0xf800;
-static const uint16_t kGreen6 = 0x07e0;
-static const uint16_t kBlue5 = 0x001f;
-#endif // __BYTE_ORDER
-static const uint32_t kBlack16 = 0x0000;
-static const uint32_t kWhite16 = kRed5 | kGreen6 | kBlue5;
-
-/*
- * RGB32 color masks
- */
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-static const uint32_t kRed8 = 0x000000ff;
-static const uint32_t kGreen8 = 0x0000ff00;
-static const uint32_t kBlue8 = 0x00ff0000;
-#else // __BYTE_ORDER
-static const uint32_t kRed8 = 0x00ff0000;
-static const uint32_t kGreen8 = 0x0000ff00;
-static const uint32_t kBlue8 = 0x000000ff;
-#endif // __BYTE_ORDER
-static const uint32_t kBlack32 = 0x00000000;
-static const uint32_t kWhite32 = kRed8 | kGreen8 | kBlue8;
-
-/*
- * Extracting, and saving color bytes from / to WORD / DWORD RGB.
- */
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-/* Extract red, green, and blue bytes from RGB565 word. */
-#define R16(rgb) static_cast<uint8_t>(rgb & kRed5)
-#define G16(rgb) static_cast<uint8_t>((rgb & kGreen6) >> 5)
-#define B16(rgb) static_cast<uint8_t>((rgb & kBlue5) >> 11)
-/* Make 8 bits red, green, and blue, extracted from RGB565 word. */
-#define R16_32(rgb) static_cast<uint8_t>(((rgb & kRed5) << 3) | ((rgb & kRed5) >> 2))
-#define G16_32(rgb) static_cast<uint8_t>(((rgb & kGreen6) >> 3) | ((rgb & kGreen6) >> 9))
-#define B16_32(rgb) static_cast<uint8_t>(((rgb & kBlue5) >> 8) | ((rgb & kBlue5) >> 14))
-/* Extract red, green, and blue bytes from RGB32 dword. */
-#define R32(rgb) static_cast<uint8_t>(rgb & kRed8)
-#define G32(rgb) static_cast<uint8_t>(((rgb & kGreen8) >> 8) & 0xff)
-#define B32(rgb) static_cast<uint8_t>(((rgb & kBlue8) >> 16) & 0xff)
-/* Build RGB565 word from red, green, and blue bytes. */
-#define RGB565(r, g, b) static_cast<uint16_t>((((static_cast<uint16_t>(b) << 6) | g) << 5) | r)
-/* Build RGB32 dword from red, green, and blue bytes. */
-#define RGB32(r, g, b) static_cast<uint32_t>((((static_cast<uint32_t>(b) << 8) | g) << 8) | r)
-#else // __BYTE_ORDER
-/* Extract red, green, and blue bytes from RGB565 word. */
-#define R16(rgb) static_cast<uint8_t>((rgb & kRed5) >> 11)
-#define G16(rgb) static_cast<uint8_t>((rgb & kGreen6) >> 5)
-#define B16(rgb) static_cast<uint8_t>(rgb & kBlue5)
-/* Make 8 bits red, green, and blue, extracted from RGB565 word. */
-#define R16_32(rgb) static_cast<uint8_t>(((rgb & kRed5) >> 8) | ((rgb & kRed5) >> 14))
-#define G16_32(rgb) static_cast<uint8_t>(((rgb & kGreen6) >> 3) | ((rgb & kGreen6) >> 9))
-#define B16_32(rgb) static_cast<uint8_t>(((rgb & kBlue5) << 3) | ((rgb & kBlue5) >> 2))
-/* Extract red, green, and blue bytes from RGB32 dword. */
-#define R32(rgb) static_cast<uint8_t>((rgb & kRed8) >> 16)
-#define G32(rgb) static_cast<uint8_t>((rgb & kGreen8) >> 8)
-#define B32(rgb) static_cast<uint8_t>(rgb & kBlue8)
-/* Build RGB565 word from red, green, and blue bytes. */
-#define RGB565(r, g, b) static_cast<uint16_t>((((static_cast<uint16_t>(r) << 6) | g) << 5) | b)
-/* Build RGB32 dword from red, green, and blue bytes. */
-#define RGB32(r, g, b) static_cast<uint32_t>((((static_cast<uint32_t>(r) << 8) | g) << 8) | b)
-#endif // __BYTE_ORDER
-
-/* An union that simplifies breaking 32 bit RGB into separate R, G, and B colors.
- */
-typedef union RGB32_t {
- uint32_t color;
- struct {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
- uint8_t r; uint8_t g; uint8_t b; uint8_t a;
-#else // __BYTE_ORDER
- uint8_t a; uint8_t b; uint8_t g; uint8_t r;
-#endif // __BYTE_ORDER
- };
-} RGB32_t;
-
-
-/* Clips a value to the unsigned 0-255 range, treating negative values as zero.
- */
-static __inline__ int
-clamp(int x)
-{
- if (x > 255) return 255;
- if (x < 0) return 0;
- return x;
-}
-
-/********************************************************************************
- * Basics of RGB -> YUV conversion
- *******************************************************************************/
-
-/*
- * RGB -> YUV conversion macros
- */
-#define RGB2Y(r, g, b) (uint8_t)(((66 * (r) + 129 * (g) + 25 * (b) + 128) >> 8) + 16)
-#define RGB2U(r, g, b) (uint8_t)(((-38 * (r) - 74 * (g) + 112 * (b) + 128) >> 8) + 128)
-#define RGB2V(r, g, b) (uint8_t)(((112 * (r) - 94 * (g) - 18 * (b) + 128) >> 8) + 128)
-
-/* Converts R8 G8 B8 color to YUV. */
-static __inline__ void
-R8G8B8ToYUV(uint8_t r, uint8_t g, uint8_t b, uint8_t* y, uint8_t* u, uint8_t* v)
-{
- *y = RGB2Y((int)r, (int)g, (int)b);
- *u = RGB2U((int)r, (int)g, (int)b);
- *v = RGB2V((int)r, (int)g, (int)b);
-}
-
-/* Converts RGB565 color to YUV. */
-static __inline__ void
-RGB565ToYUV(uint16_t rgb, uint8_t* y, uint8_t* u, uint8_t* v)
-{
- R8G8B8ToYUV(R16_32(rgb), G16_32(rgb), B16_32(rgb), y, u, v);
-}
-
-/* Converts RGB32 color to YUV. */
-static __inline__ void
-RGB32ToYUV(uint32_t rgb, uint8_t* y, uint8_t* u, uint8_t* v)
-{
- RGB32_t rgb_c;
- rgb_c.color = rgb;
- R8G8B8ToYUV(rgb_c.r, rgb_c.g, rgb_c.b, y, u, v);
-}
-
-/********************************************************************************
- * Basics of YUV -> RGB conversion.
- * Note that due to the fact that guest uses RGB only on preview window, and the
- * RGB format that is used is RGB565, we can limit YUV -> RGB conversions to
- * RGB565 only.
- *******************************************************************************/
-
-/*
- * YUV -> RGB conversion macros
- */
-
-/* "Optimized" macros that take specialy prepared Y, U, and V values:
- * C = Y - 16
- * D = U - 128
- * E = V - 128
- */
-#define YUV2RO(C, D, E) clamp((298 * (C) + 409 * (E) + 128) >> 8)
-#define YUV2GO(C, D, E) clamp((298 * (C) - 100 * (D) - 208 * (E) + 128) >> 8)
-#define YUV2BO(C, D, E) clamp((298 * (C) + 516 * (D) + 128) >> 8)
-
-/*
- * Main macros that take the original Y, U, and V values
- */
-#define YUV2R(y, u, v) clamp((298 * ((y)-16) + 409 * ((v)-128) + 128) >> 8)
-#define YUV2G(y, u, v) clamp((298 * ((y)-16) - 100 * ((u)-128) - 208 * ((v)-128) + 128) >> 8)
-#define YUV2B(y, u, v) clamp((298 * ((y)-16) + 516 * ((u)-128) + 128) >> 8)
-
-
-/* Converts YUV color to RGB565. */
-static __inline__ uint16_t
-YUVToRGB565(int y, int u, int v)
-{
- /* Calculate C, D, and E values for the optimized macro. */
- y -= 16; u -= 128; v -= 128;
- const uint16_t r = (YUV2RO(y,u,v) >> 3) & 0x1f;
- const uint16_t g = (YUV2GO(y,u,v) >> 2) & 0x3f;
- const uint16_t b = (YUV2BO(y,u,v) >> 3) & 0x1f;
- return RGB565(r, g, b);
-}
-
-/* Converts YUV color to RGB32. */
-static __inline__ uint32_t
-YUVToRGB32(int y, int u, int v)
-{
- /* Calculate C, D, and E values for the optimized macro. */
- y -= 16; u -= 128; v -= 128;
- RGB32_t rgb;
- rgb.r = YUV2RO(y,u,v) & 0xff;
- rgb.g = YUV2GO(y,u,v) & 0xff;
- rgb.b = YUV2BO(y,u,v) & 0xff;
- return rgb.color;
-}
-
-/* YUV pixel descriptor. */
-struct YUVPixel {
- uint8_t Y;
- uint8_t U;
- uint8_t V;
-
- inline YUVPixel()
- : Y(0), U(0), V(0)
- {
- }
-
- inline explicit YUVPixel(uint16_t rgb565)
- {
- RGB565ToYUV(rgb565, &Y, &U, &V);
- }
-
- inline explicit YUVPixel(uint32_t rgb32)
- {
- RGB32ToYUV(rgb32, &Y, &U, &V);
- }
-
- inline void get(uint8_t* pY, uint8_t* pU, uint8_t* pV) const
- {
- *pY = Y; *pU = U; *pV = V;
- }
-};
-
-/* Converts an YV12 framebuffer to RGB565 framebuffer.
- * Param:
- * yv12 - YV12 framebuffer.
- * rgb - RGB565 framebuffer.
- * width, height - Dimensions for both framebuffers.
- */
-void YV12ToRGB565(const void* yv12, void* rgb, int width, int height);
-
-/* Converts an YV12 framebuffer to RGB32 framebuffer.
- * Param:
- * yv12 - YV12 framebuffer.
- * rgb - RGB32 framebuffer.
- * width, height - Dimensions for both framebuffers.
- */
-void YV12ToRGB32(const void* yv12, void* rgb, int width, int height);
-
-/* Converts an YU12 framebuffer to RGB32 framebuffer.
- * Param:
- * yu12 - YU12 framebuffer.
- * rgb - RGB32 framebuffer.
- * width, height - Dimensions for both framebuffers.
- */
-void YU12ToRGB32(const void* yu12, void* rgb, int width, int height);
-
-/* Converts an NV12 framebuffer to RGB565 framebuffer.
- * Param:
- * nv12 - NV12 framebuffer.
- * rgb - RGB565 framebuffer.
- * width, height - Dimensions for both framebuffers.
- */
-void NV12ToRGB565(const void* nv12, void* rgb, int width, int height);
-
-/* Converts an NV12 framebuffer to RGB32 framebuffer.
- * Param:
- * nv12 - NV12 framebuffer.
- * rgb - RGB32 framebuffer.
- * width, height - Dimensions for both framebuffers.
- */
-void NV12ToRGB32(const void* nv12, void* rgb, int width, int height);
-
-/* Converts an NV21 framebuffer to RGB565 framebuffer.
- * Param:
- * nv21 - NV21 framebuffer.
- * rgb - RGB565 framebuffer.
- * width, height - Dimensions for both framebuffers.
- */
-void NV21ToRGB565(const void* nv21, void* rgb, int width, int height);
-
-/* Converts an NV21 framebuffer to RGB32 framebuffer.
- * Param:
- * nv21 - NV21 framebuffer.
- * rgb - RGB32 framebuffer.
- * width, height - Dimensions for both framebuffers.
- */
-void NV21ToRGB32(const void* nv21, void* rgb, int width, int height);
-
-}; /* namespace android */
-
-#endif /* HW_EMULATOR_CAMERA_CONVERTERS_H */
diff --git a/tools/emulator/system/camera/EmulatedBaseCamera.cpp b/tools/emulator/system/camera/EmulatedBaseCamera.cpp
deleted file mode 100644
index 19d398e2c..000000000
--- a/tools/emulator/system/camera/EmulatedBaseCamera.cpp
+++ /dev/null
@@ -1,73 +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.
- */
-
-/*
- * Contains implementation of a class EmulatedBaseCamera that encapsulates
- * functionality common to all emulated camera device versions ("fake",
- * "webcam", "video file", "cam2.0" etc.). Instances of this class (for each
- * emulated camera) are created during the construction of the
- * EmulatedCameraFactory instance. This class serves as an entry point for all
- * camera API calls that are common across all versions of the
- * camera_device_t/camera_module_t structures.
- */
-
-#define LOG_NDEBUG 0
-#define LOG_TAG "EmulatedCamera_BaseCamera"
-#include <cutils/log.h>
-
-#include "EmulatedBaseCamera.h"
-
-namespace android {
-
-EmulatedBaseCamera::EmulatedBaseCamera(int cameraId,
- uint32_t cameraVersion,
- struct hw_device_t* device,
- struct hw_module_t* module)
- : mCameraInfo(NULL),
- mCameraID(cameraId),
- mCameraDeviceVersion(cameraVersion)
-{
- /*
- * Initialize camera_device descriptor for this object.
- */
-
- /* Common header */
- device->tag = HARDWARE_DEVICE_TAG;
- device->version = cameraVersion;
- device->module = module;
- device->close = NULL; // Must be filled in by child implementation
-}
-
-EmulatedBaseCamera::~EmulatedBaseCamera()
-{
-}
-
-status_t EmulatedBaseCamera::getCameraInfo(struct camera_info* info)
-{
- ALOGV("%s", __FUNCTION__);
-
- info->device_version = mCameraDeviceVersion;
- if (mCameraDeviceVersion >= HARDWARE_DEVICE_API_VERSION(2, 0)) {
- info->static_camera_characteristics = mCameraInfo;
- } else {
- info->static_camera_characteristics = (camera_metadata_t*)0xcafef00d;
- }
-
- return NO_ERROR;
-}
-
-
-} /* namespace android */
diff --git a/tools/emulator/system/camera/EmulatedBaseCamera.h b/tools/emulator/system/camera/EmulatedBaseCamera.h
deleted file mode 100644
index 5888ca0a0..000000000
--- a/tools/emulator/system/camera/EmulatedBaseCamera.h
+++ /dev/null
@@ -1,101 +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.
- */
-
-#ifndef HW_EMULATOR_CAMERA_EMULATED_BASE_CAMERA_H
-#define HW_EMULATOR_CAMERA_EMULATED_BASE_CAMERA_H
-
-#include <hardware/camera_common.h>
-#include <utils/Errors.h>
-
-namespace android {
-
-/*
- * Contains declaration of a class EmulatedBaseCamera that encapsulates
- * functionality common to all emulated camera device versions ("fake",
- * "webcam", "video file", etc.). Instances of this class (for each emulated
- * camera) are created during the construction of the EmulatedCameraFactory
- * instance. This class serves as an entry point for all camera API calls that
- * are common across all versions of the camera_device_t/camera_module_t
- * structures.
- */
-
-class EmulatedBaseCamera {
- public:
- EmulatedBaseCamera(int cameraId,
- uint32_t cameraVersion,
- struct hw_device_t* device,
- struct hw_module_t* module);
-
- virtual ~EmulatedBaseCamera();
-
- /****************************************************************************
- * Public API
- ***************************************************************************/
-
- public:
- /* Initializes EmulatedCamera instance.
- * Return:
- * NO_ERROR on success, or an appropriate error status on failure.
- */
- virtual status_t Initialize() = 0;
-
- /****************************************************************************
- * Camera API implementation
- ***************************************************************************/
-
- public:
- /* Creates connection to the emulated camera device.
- * This method is called in response to hw_module_methods_t::open callback.
- * NOTE: When this method is called the object is locked.
- * Note that failures in this method are reported as negative EXXX statuses.
- */
- virtual status_t connectCamera(hw_device_t** device) = 0;
-
- /* Closes connection to the emulated camera.
- * This method is called in response to camera_device::close callback.
- * NOTE: When this method is called the object is locked.
- * Note that failures in this method are reported as negative EXXX statuses.
- */
- virtual status_t closeCamera() = 0;
-
- /* Gets camera information.
- * This method is called in response to camera_module_t::get_camera_info
- * callback.
- * NOTE: When this method is called the object is locked.
- * Note that failures in this method are reported as negative EXXX statuses.
- */
- virtual status_t getCameraInfo(struct camera_info* info) = 0;
-
- /****************************************************************************
- * Data members
- ***************************************************************************/
-
- protected:
- /* Fixed camera information for camera2 devices. Must be valid to access if
- * mCameraDeviceVersion is >= HARDWARE_DEVICE_API_VERSION(2,0) */
- camera_metadata_t *mCameraInfo;
-
- private:
- /* Zero-based ID assigned to this camera. */
- int mCameraID;
-
- /* Version of the camera device HAL implemented by this camera */
- int mCameraDeviceVersion;
-};
-
-} /* namespace android */
-
-#endif /* HW_EMULATOR_CAMERA_EMULATED_BASE_CAMERA_H */
diff --git a/tools/emulator/system/camera/EmulatedCamera.cpp b/tools/emulator/system/camera/EmulatedCamera.cpp
deleted file mode 100755
index 28aede16b..000000000
--- a/tools/emulator/system/camera/EmulatedCamera.cpp
+++ /dev/null
@@ -1,1041 +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.
- */
-
-/*
- * Contains implementation of a class EmulatedCamera that encapsulates
- * functionality common to all emulated cameras ("fake", "webcam", "video file",
- * etc.). Instances of this class (for each emulated camera) are created during
- * the construction of the EmulatedCameraFactory instance. This class serves as
- * an entry point for all camera API calls that defined by camera_device_ops_t
- * API.
- */
-
-#define LOG_NDEBUG 0
-#define LOG_TAG "EmulatedCamera_Camera"
-#include <cutils/log.h>
-#include <ui/Rect.h>
-#include "EmulatedCamera.h"
-//#include "EmulatedFakeCameraDevice.h"
-#include "Converters.h"
-
-/* Defines whether we should trace parameter changes. */
-#define DEBUG_PARAM 1
-
-namespace android {
-
-#if DEBUG_PARAM
-/* Calculates and logs parameter changes.
- * Param:
- * current - Current set of camera parameters.
- * new_par - String representation of new parameters.
- */
-static void PrintParamDiff(const CameraParameters& current, const char* new_par);
-#else
-#define PrintParamDiff(current, new_par) (void(0))
-#endif /* DEBUG_PARAM */
-
-/* A helper routine that adds a value to the camera parameter.
- * Param:
- * param - Camera parameter to add a value to.
- * val - Value to add.
- * Return:
- * A new string containing parameter with the added value on success, or NULL on
- * a failure. If non-NULL string is returned, the caller is responsible for
- * freeing it with 'free'.
- */
-static char* AddValue(const char* param, const char* val);
-
-EmulatedCamera::EmulatedCamera(int cameraId,
- struct hw_module_t* module)
- : EmulatedBaseCamera(cameraId,
- HARDWARE_DEVICE_API_VERSION(1, 0),
- &common,
- module),
- mPreviewWindow(),
- mCallbackNotifier()
-{
- /* camera_device v1 fields. */
- common.close = EmulatedCamera::close;
- ops = &mDeviceOps;
- priv = this;
-}
-
-EmulatedCamera::~EmulatedCamera()
-{
-}
-
-/****************************************************************************
- * Public API
- ***************************************************************************/
-
-status_t EmulatedCamera::Initialize()
-{
- /* Preview formats supported by this HAL. */
- char preview_formats[1024];
- snprintf(preview_formats, sizeof(preview_formats), "%s,%s,%s",
- CameraParameters::PIXEL_FORMAT_YUV420SP,
- CameraParameters::PIXEL_FORMAT_YUV420P,
- CameraParameters::PIXEL_FORMAT_RGBA8888);
-
- /*
- * Fake required parameters.
- */
-
- mParameters.set(CameraParameters::KEY_SUPPORTED_JPEG_THUMBNAIL_SIZES, "320x240,0x0");
-
- mParameters.set(CameraParameters::KEY_JPEG_THUMBNAIL_WIDTH, "512");
- mParameters.set(CameraParameters::KEY_JPEG_THUMBNAIL_HEIGHT, "384");
- mParameters.set(CameraParameters::KEY_JPEG_QUALITY, "90");
- mParameters.set(CameraParameters::KEY_FOCAL_LENGTH, "4.31");
- mParameters.set(CameraParameters::KEY_HORIZONTAL_VIEW_ANGLE, "54.8");
- mParameters.set(CameraParameters::KEY_VERTICAL_VIEW_ANGLE, "42.5");
- mParameters.set(CameraParameters::KEY_JPEG_THUMBNAIL_QUALITY, "90");
-
- /* Preview format settings used here are related to panoramic view only. It's
- * not related to the preview window that works only with RGB frames, which
- * is explicitly stated when set_buffers_geometry is called on the preview
- * window object. */
- mParameters.set(CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS,
- preview_formats);
- mParameters.setPreviewFormat(CameraParameters::PIXEL_FORMAT_YUV420SP);
-
- /* We don't relay on the actual frame rates supported by the camera device,
- * since we will emulate them through timeouts in the emulated camera device
- * worker thread. */
- mParameters.set(CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES,
- "30,24,20,15,10,5");
- mParameters.set(CameraParameters::KEY_SUPPORTED_PREVIEW_FPS_RANGE, "(5,30)");
- mParameters.set(CameraParameters::KEY_PREVIEW_FPS_RANGE, "5,30");
- mParameters.setPreviewFrameRate(24);
-
- /* Only PIXEL_FORMAT_YUV420P is accepted by video framework in emulator! */
- mParameters.set(CameraParameters::KEY_VIDEO_FRAME_FORMAT,
- CameraParameters::PIXEL_FORMAT_YUV420P);
- mParameters.set(CameraParameters::KEY_SUPPORTED_PICTURE_FORMATS,
- CameraParameters::PIXEL_FORMAT_JPEG);
- mParameters.setPictureFormat(CameraParameters::PIXEL_FORMAT_JPEG);
-
- /* Set exposure compensation. */
- mParameters.set(CameraParameters::KEY_MAX_EXPOSURE_COMPENSATION, "6");
- mParameters.set(CameraParameters::KEY_MIN_EXPOSURE_COMPENSATION, "-6");
- mParameters.set(CameraParameters::KEY_EXPOSURE_COMPENSATION_STEP, "0.5");
- mParameters.set(CameraParameters::KEY_EXPOSURE_COMPENSATION, "0");
-
- /* Sets the white balance modes and the device-dependent scale factors. */
- char supported_white_balance[1024];
- snprintf(supported_white_balance, sizeof(supported_white_balance),
- "%s,%s,%s,%s",
- CameraParameters::WHITE_BALANCE_AUTO,
- CameraParameters::WHITE_BALANCE_INCANDESCENT,
- CameraParameters::WHITE_BALANCE_DAYLIGHT,
- CameraParameters::WHITE_BALANCE_TWILIGHT);
- mParameters.set(CameraParameters::KEY_SUPPORTED_WHITE_BALANCE,
- supported_white_balance);
- mParameters.set(CameraParameters::KEY_WHITE_BALANCE,
- CameraParameters::WHITE_BALANCE_AUTO);
- getCameraDevice()->initializeWhiteBalanceModes(
- CameraParameters::WHITE_BALANCE_AUTO, 1.0f, 1.0f);
- getCameraDevice()->initializeWhiteBalanceModes(
- CameraParameters::WHITE_BALANCE_INCANDESCENT, 1.38f, 0.60f);
- getCameraDevice()->initializeWhiteBalanceModes(
- CameraParameters::WHITE_BALANCE_DAYLIGHT, 1.09f, 0.92f);
- getCameraDevice()->initializeWhiteBalanceModes(
- CameraParameters::WHITE_BALANCE_TWILIGHT, 0.92f, 1.22f);
- getCameraDevice()->setWhiteBalanceMode(CameraParameters::WHITE_BALANCE_AUTO);
-
- /* Not supported features
- */
- mParameters.set(CameraParameters::KEY_SUPPORTED_FOCUS_MODES,
- CameraParameters::FOCUS_MODE_FIXED);
- mParameters.set(CameraParameters::KEY_FOCUS_MODE,
- CameraParameters::FOCUS_MODE_FIXED);
-
- return NO_ERROR;
-}
-
-void EmulatedCamera::onNextFrameAvailable(const void* frame,
- nsecs_t timestamp,
- EmulatedCameraDevice* camera_dev)
-{
- /* Notify the preview window first. */
- mPreviewWindow.onNextFrameAvailable(frame, timestamp, camera_dev);
-
- /* Notify callback notifier next. */
- mCallbackNotifier.onNextFrameAvailable(frame, timestamp, camera_dev);
-}
-
-void EmulatedCamera::onCameraDeviceError(int err)
-{
- /* Errors are reported through the callback notifier */
- mCallbackNotifier.onCameraDeviceError(err);
-}
-
-/****************************************************************************
- * Camera API implementation.
- ***************************************************************************/
-
-status_t EmulatedCamera::connectCamera(hw_device_t** device)
-{
- ALOGV("%s", __FUNCTION__);
-
- status_t res = EINVAL;
- EmulatedCameraDevice* const camera_dev = getCameraDevice();
- ALOGE_IF(camera_dev == NULL, "%s: No camera device instance.", __FUNCTION__);
-
- if (camera_dev != NULL) {
- /* Connect to the camera device. */
- res = getCameraDevice()->connectDevice();
- if (res == NO_ERROR) {
- *device = &common;
- }
- }
-
- return -res;
-}
-
-status_t EmulatedCamera::closeCamera()
-{
- ALOGV("%s", __FUNCTION__);
-
- return cleanupCamera();
-}
-
-status_t EmulatedCamera::getCameraInfo(struct camera_info* info)
-{
- ALOGV("%s", __FUNCTION__);
-
- const char* valstr = NULL;
-
- valstr = mParameters.get(EmulatedCamera::FACING_KEY);
- if (valstr != NULL) {
- if (strcmp(valstr, EmulatedCamera::FACING_FRONT) == 0) {
- info->facing = CAMERA_FACING_FRONT;
- }
- else if (strcmp(valstr, EmulatedCamera::FACING_BACK) == 0) {
- info->facing = CAMERA_FACING_BACK;
- }
- } else {
- info->facing = CAMERA_FACING_BACK;
- }
-
- valstr = mParameters.get(EmulatedCamera::ORIENTATION_KEY);
- if (valstr != NULL) {
- info->orientation = atoi(valstr);
- } else {
- info->orientation = 0;
- }
-
- return EmulatedBaseCamera::getCameraInfo(info);
-}
-
-status_t EmulatedCamera::setPreviewWindow(struct preview_stream_ops* window)
-{
- /* Callback should return a negative errno. */
- return -mPreviewWindow.setPreviewWindow(window,
- mParameters.getPreviewFrameRate());
-}
-
-void EmulatedCamera::setCallbacks(camera_notify_callback notify_cb,
- camera_data_callback data_cb,
- camera_data_timestamp_callback data_cb_timestamp,
- camera_request_memory get_memory,
- void* user)
-{
- mCallbackNotifier.setCallbacks(notify_cb, data_cb, data_cb_timestamp,
- get_memory, user);
-}
-
-void EmulatedCamera::enableMsgType(int32_t msg_type)
-{
- mCallbackNotifier.enableMessage(msg_type);
-}
-
-void EmulatedCamera::disableMsgType(int32_t msg_type)
-{
- mCallbackNotifier.disableMessage(msg_type);
-}
-
-int EmulatedCamera::isMsgTypeEnabled(int32_t msg_type)
-{
- return mCallbackNotifier.isMessageEnabled(msg_type);
-}
-
-status_t EmulatedCamera::startPreview()
-{
- /* Callback should return a negative errno. */
- return -doStartPreview();
-}
-
-void EmulatedCamera::stopPreview()
-{
- doStopPreview();
-}
-
-int EmulatedCamera::isPreviewEnabled()
-{
- return mPreviewWindow.isPreviewEnabled();
-}
-
-status_t EmulatedCamera::storeMetaDataInBuffers(int enable)
-{
- /* Callback should return a negative errno. */
- return -mCallbackNotifier.storeMetaDataInBuffers(enable);
-}
-
-status_t EmulatedCamera::startRecording()
-{
- /* Callback should return a negative errno. */
- return -mCallbackNotifier.enableVideoRecording(mParameters.getPreviewFrameRate());
-}
-
-void EmulatedCamera::stopRecording()
-{
- mCallbackNotifier.disableVideoRecording();
-}
-
-int EmulatedCamera::isRecordingEnabled()
-{
- return mCallbackNotifier.isVideoRecordingEnabled();
-}
-
-void EmulatedCamera::releaseRecordingFrame(const void* opaque)
-{
- mCallbackNotifier.releaseRecordingFrame(opaque);
-}
-
-status_t EmulatedCamera::setAutoFocus()
-{
- ALOGV("%s", __FUNCTION__);
-
- /* TODO: Future enhancements. */
- return NO_ERROR;
-}
-
-status_t EmulatedCamera::cancelAutoFocus()
-{
- ALOGV("%s", __FUNCTION__);
-
- /* TODO: Future enhancements. */
- return NO_ERROR;
-}
-
-status_t EmulatedCamera::takePicture()
-{
- ALOGV("%s", __FUNCTION__);
-
- status_t res;
- int width, height;
- uint32_t org_fmt;
-
- /* Collect frame info for the picture. */
- mParameters.getPictureSize(&width, &height);
- const char* pix_fmt = mParameters.getPictureFormat();
- if (strcmp(pix_fmt, CameraParameters::PIXEL_FORMAT_YUV420P) == 0) {
- org_fmt = V4L2_PIX_FMT_YUV420;
- } else if (strcmp(pix_fmt, CameraParameters::PIXEL_FORMAT_RGBA8888) == 0) {
- org_fmt = V4L2_PIX_FMT_RGB32;
- } else if (strcmp(pix_fmt, CameraParameters::PIXEL_FORMAT_YUV420SP) == 0) {
- org_fmt = V4L2_PIX_FMT_NV21;
- } else if (strcmp(pix_fmt, CameraParameters::PIXEL_FORMAT_JPEG) == 0) {
- /* We only have JPEG converted for NV21 format. */
- org_fmt = V4L2_PIX_FMT_NV21;
- } else {
- ALOGE("%s: Unsupported pixel format %s", __FUNCTION__, pix_fmt);
- return EINVAL;
- }
- /* Get JPEG quality. */
- int jpeg_quality = mParameters.getInt(CameraParameters::KEY_JPEG_QUALITY);
- if (jpeg_quality <= 0) {
- jpeg_quality = 90; /* Fall back to default. */
- }
-
- /*
- * Make sure preview is not running, and device is stopped before taking
- * picture.
- */
-
- const bool preview_on = mPreviewWindow.isPreviewEnabled();
- if (preview_on) {
- doStopPreview();
- }
-
- /* Camera device should have been stopped when the shutter message has been
- * enabled. */
- EmulatedCameraDevice* const camera_dev = getCameraDevice();
- if (camera_dev->isStarted()) {
- ALOGW("%s: Camera device is started", __FUNCTION__);
- camera_dev->stopDeliveringFrames();
- camera_dev->stopDevice();
- }
-
- /*
- * Take the picture now.
- */
-
- /* Start camera device for the picture frame. */
- ALOGD("Starting camera for picture: %.4s(%s)[%dx%d]",
- reinterpret_cast<const char*>(&org_fmt), pix_fmt, width, height);
- res = camera_dev->startDevice(width, height, org_fmt);
- if (res != NO_ERROR) {
- if (preview_on) {
- doStartPreview();
- }
- return res;
- }
-
- /* Deliver one frame only. */
- mCallbackNotifier.setJpegQuality(jpeg_quality);
- mCallbackNotifier.setTakingPicture(true);
- res = camera_dev->startDeliveringFrames(true);
- if (res != NO_ERROR) {
- mCallbackNotifier.setTakingPicture(false);
- if (preview_on) {
- doStartPreview();
- }
- }
- return res;
-}
-
-status_t EmulatedCamera::cancelPicture()
-{
- ALOGV("%s", __FUNCTION__);
-
- return NO_ERROR;
-}
-
-status_t EmulatedCamera::setParameters(const char* parms)
-{
- ALOGV("%s", __FUNCTION__);
- PrintParamDiff(mParameters, parms);
-
- CameraParameters new_param;
- String8 str8_param(parms);
- new_param.unflatten(str8_param);
-
- /*
- * Check for new exposure compensation parameter.
- */
- int new_exposure_compensation = new_param.getInt(
- CameraParameters::KEY_EXPOSURE_COMPENSATION);
- const int min_exposure_compensation = new_param.getInt(
- CameraParameters::KEY_MIN_EXPOSURE_COMPENSATION);
- const int max_exposure_compensation = new_param.getInt(
- CameraParameters::KEY_MAX_EXPOSURE_COMPENSATION);
-
- // Checks if the exposure compensation change is supported.
- if ((min_exposure_compensation != 0) || (max_exposure_compensation != 0)) {
- if (new_exposure_compensation > max_exposure_compensation) {
- new_exposure_compensation = max_exposure_compensation;
- }
- if (new_exposure_compensation < min_exposure_compensation) {
- new_exposure_compensation = min_exposure_compensation;
- }
-
- const int current_exposure_compensation = mParameters.getInt(
- CameraParameters::KEY_EXPOSURE_COMPENSATION);
- if (current_exposure_compensation != new_exposure_compensation) {
- const float exposure_value = new_exposure_compensation *
- new_param.getFloat(
- CameraParameters::KEY_EXPOSURE_COMPENSATION_STEP);
-
- getCameraDevice()->setExposureCompensation(
- exposure_value);
- }
- }
-
- const char* new_white_balance = new_param.get(
- CameraParameters::KEY_WHITE_BALANCE);
- const char* supported_white_balance = new_param.get(
- CameraParameters::KEY_SUPPORTED_WHITE_BALANCE);
-
- if ((supported_white_balance != NULL) && (new_white_balance != NULL) &&
- (strstr(supported_white_balance, new_white_balance) != NULL)) {
-
- const char* current_white_balance = mParameters.get(
- CameraParameters::KEY_WHITE_BALANCE);
- if ((current_white_balance == NULL) ||
- (strcmp(current_white_balance, new_white_balance) != 0)) {
- ALOGV("Setting white balance to %s", new_white_balance);
- getCameraDevice()->setWhiteBalanceMode(new_white_balance);
- }
- }
-
- mParameters = new_param;
-
- return NO_ERROR;
-}
-
-/* A dumb variable indicating "no params" / error on the exit from
- * EmulatedCamera::getParameters(). */
-static char lNoParam = '\0';
-char* EmulatedCamera::getParameters()
-{
- String8 params(mParameters.flatten());
- char* ret_str =
- reinterpret_cast<char*>(malloc(sizeof(char) * (params.length()+1)));
- memset(ret_str, 0, params.length()+1);
- if (ret_str != NULL) {
- strncpy(ret_str, params.string(), params.length()+1);
- return ret_str;
- } else {
- ALOGE("%s: Unable to allocate string for %s", __FUNCTION__, params.string());
- /* Apparently, we can't return NULL fron this routine. */
- return &lNoParam;
- }
-}
-
-void EmulatedCamera::putParameters(char* params)
-{
- /* This method simply frees parameters allocated in getParameters(). */
- if (params != NULL && params != &lNoParam) {
- free(params);
- }
-}
-
-status_t EmulatedCamera::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2)
-{
- ALOGV("%s: cmd = %d, arg1 = %d, arg2 = %d", __FUNCTION__, cmd, arg1, arg2);
-
- /* TODO: Future enhancements. */
- return 0;
-}
-
-void EmulatedCamera::releaseCamera()
-{
- ALOGV("%s", __FUNCTION__);
-
- cleanupCamera();
-}
-
-status_t EmulatedCamera::dumpCamera(int fd)
-{
- ALOGV("%s", __FUNCTION__);
-
- /* TODO: Future enhancements. */
- return -EINVAL;
-}
-
-/****************************************************************************
- * Preview management.
- ***************************************************************************/
-
-status_t EmulatedCamera::doStartPreview()
-{
- ALOGV("%s", __FUNCTION__);
-
- EmulatedCameraDevice* camera_dev = getCameraDevice();
- if (camera_dev->isStarted()) {
- camera_dev->stopDeliveringFrames();
- camera_dev->stopDevice();
- }
-
- status_t res = mPreviewWindow.startPreview();
- if (res != NO_ERROR) {
- return res;
- }
-
- /* Make sure camera device is connected. */
- if (!camera_dev->isConnected()) {
- res = camera_dev->connectDevice();
- if (res != NO_ERROR) {
- mPreviewWindow.stopPreview();
- return res;
- }
- }
-
- int width, height;
- /* Lets see what should we use for frame width, and height. */
- if (mParameters.get(CameraParameters::KEY_VIDEO_SIZE) != NULL) {
- mParameters.getVideoSize(&width, &height);
- } else {
- mParameters.getPreviewSize(&width, &height);
- }
- /* Lets see what should we use for the frame pixel format. Note that there
- * are two parameters that define pixel formats for frames sent to the
- * application via notification callbacks:
- * - KEY_VIDEO_FRAME_FORMAT, that is used when recording video, and
- * - KEY_PREVIEW_FORMAT, that is used for preview frame notification.
- * We choose one or the other, depending on "recording-hint" property set by
- * the framework that indicating intention: video, or preview. */
- const char* pix_fmt = NULL;
- const char* is_video = mParameters.get(EmulatedCamera::RECORDING_HINT_KEY);
- if (is_video == NULL) {
- is_video = CameraParameters::FALSE;
- }
- if (strcmp(is_video, CameraParameters::TRUE) == 0) {
- /* Video recording is requested. Lets see if video frame format is set. */
- pix_fmt = mParameters.get(CameraParameters::KEY_VIDEO_FRAME_FORMAT);
- }
- /* If this was not video recording, or video frame format is not set, lets
- * use preview pixel format for the main framebuffer. */
- if (pix_fmt == NULL) {
- pix_fmt = mParameters.getPreviewFormat();
- }
- if (pix_fmt == NULL) {
- ALOGE("%s: Unable to obtain video format", __FUNCTION__);
- mPreviewWindow.stopPreview();
- return EINVAL;
- }
-
- /* Convert framework's pixel format to the FOURCC one. */
- uint32_t org_fmt;
- if (strcmp(pix_fmt, CameraParameters::PIXEL_FORMAT_YUV420P) == 0) {
- org_fmt = V4L2_PIX_FMT_YUV420;
- } else if (strcmp(pix_fmt, CameraParameters::PIXEL_FORMAT_RGBA8888) == 0) {
- org_fmt = V4L2_PIX_FMT_RGB32;
- } else if (strcmp(pix_fmt, CameraParameters::PIXEL_FORMAT_YUV420SP) == 0) {
- org_fmt = V4L2_PIX_FMT_NV21;
- } else {
- ALOGE("%s: Unsupported pixel format %s", __FUNCTION__, pix_fmt);
- mPreviewWindow.stopPreview();
- return EINVAL;
- }
- ALOGD("Starting camera: %dx%d -> %.4s(%s)",
- width, height, reinterpret_cast<const char*>(&org_fmt), pix_fmt);
- res = camera_dev->startDevice(width, height, org_fmt);
- if (res != NO_ERROR) {
- mPreviewWindow.stopPreview();
- return res;
- }
-
- res = camera_dev->startDeliveringFrames(false);
- if (res != NO_ERROR) {
- camera_dev->stopDevice();
- mPreviewWindow.stopPreview();
- }
-
- return res;
-}
-
-status_t EmulatedCamera::doStopPreview()
-{
- ALOGV("%s", __FUNCTION__);
-
- status_t res = NO_ERROR;
- if (mPreviewWindow.isPreviewEnabled()) {
- /* Stop the camera. */
- if (getCameraDevice()->isStarted()) {
- getCameraDevice()->stopDeliveringFrames();
- res = getCameraDevice()->stopDevice();
- }
-
- if (res == NO_ERROR) {
- /* Disable preview as well. */
- mPreviewWindow.stopPreview();
- }
- }
-
- return NO_ERROR;
-}
-
-/****************************************************************************
- * Private API.
- ***************************************************************************/
-
-status_t EmulatedCamera::cleanupCamera()
-{
- status_t res = NO_ERROR;
-
- /* If preview is running - stop it. */
- res = doStopPreview();
- if (res != NO_ERROR) {
- return -res;
- }
-
- /* Stop and disconnect the camera device. */
- EmulatedCameraDevice* const camera_dev = getCameraDevice();
- if (camera_dev != NULL) {
- if (camera_dev->isStarted()) {
- camera_dev->stopDeliveringFrames();
- res = camera_dev->stopDevice();
- if (res != NO_ERROR) {
- return -res;
- }
- }
- if (camera_dev->isConnected()) {
- res = camera_dev->disconnectDevice();
- if (res != NO_ERROR) {
- return -res;
- }
- }
- }
-
- mCallbackNotifier.cleanupCBNotifier();
-
- return NO_ERROR;
-}
-
-/****************************************************************************
- * Camera API callbacks as defined by camera_device_ops structure.
- *
- * Callbacks here simply dispatch the calls to an appropriate method inside
- * EmulatedCamera instance, defined by the 'dev' parameter.
- ***************************************************************************/
-
-int EmulatedCamera::set_preview_window(struct camera_device* dev,
- struct preview_stream_ops* window)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return -EINVAL;
- }
- return ec->setPreviewWindow(window);
-}
-
-void EmulatedCamera::set_callbacks(
- struct camera_device* dev,
- camera_notify_callback notify_cb,
- camera_data_callback data_cb,
- camera_data_timestamp_callback data_cb_timestamp,
- camera_request_memory get_memory,
- void* user)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return;
- }
- ec->setCallbacks(notify_cb, data_cb, data_cb_timestamp, get_memory, user);
-}
-
-void EmulatedCamera::enable_msg_type(struct camera_device* dev, int32_t msg_type)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return;
- }
- ec->enableMsgType(msg_type);
-}
-
-void EmulatedCamera::disable_msg_type(struct camera_device* dev, int32_t msg_type)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return;
- }
- ec->disableMsgType(msg_type);
-}
-
-int EmulatedCamera::msg_type_enabled(struct camera_device* dev, int32_t msg_type)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return -EINVAL;
- }
- return ec->isMsgTypeEnabled(msg_type);
-}
-
-int EmulatedCamera::start_preview(struct camera_device* dev)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return -EINVAL;
- }
- return ec->startPreview();
-}
-
-void EmulatedCamera::stop_preview(struct camera_device* dev)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return;
- }
- ec->stopPreview();
-}
-
-int EmulatedCamera::preview_enabled(struct camera_device* dev)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return -EINVAL;
- }
- return ec->isPreviewEnabled();
-}
-
-int EmulatedCamera::store_meta_data_in_buffers(struct camera_device* dev,
- int enable)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return -EINVAL;
- }
- return ec->storeMetaDataInBuffers(enable);
-}
-
-int EmulatedCamera::start_recording(struct camera_device* dev)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return -EINVAL;
- }
- return ec->startRecording();
-}
-
-void EmulatedCamera::stop_recording(struct camera_device* dev)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return;
- }
- ec->stopRecording();
-}
-
-int EmulatedCamera::recording_enabled(struct camera_device* dev)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return -EINVAL;
- }
- return ec->isRecordingEnabled();
-}
-
-void EmulatedCamera::release_recording_frame(struct camera_device* dev,
- const void* opaque)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return;
- }
- ec->releaseRecordingFrame(opaque);
-}
-
-int EmulatedCamera::auto_focus(struct camera_device* dev)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return -EINVAL;
- }
- return ec->setAutoFocus();
-}
-
-int EmulatedCamera::cancel_auto_focus(struct camera_device* dev)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return -EINVAL;
- }
- return ec->cancelAutoFocus();
-}
-
-int EmulatedCamera::take_picture(struct camera_device* dev)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return -EINVAL;
- }
- return ec->takePicture();
-}
-
-int EmulatedCamera::cancel_picture(struct camera_device* dev)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return -EINVAL;
- }
- return ec->cancelPicture();
-}
-
-int EmulatedCamera::set_parameters(struct camera_device* dev, const char* parms)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return -EINVAL;
- }
- return ec->setParameters(parms);
-}
-
-char* EmulatedCamera::get_parameters(struct camera_device* dev)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return NULL;
- }
- return ec->getParameters();
-}
-
-void EmulatedCamera::put_parameters(struct camera_device* dev, char* params)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return;
- }
- ec->putParameters(params);
-}
-
-int EmulatedCamera::send_command(struct camera_device* dev,
- int32_t cmd,
- int32_t arg1,
- int32_t arg2)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return -EINVAL;
- }
- return ec->sendCommand(cmd, arg1, arg2);
-}
-
-void EmulatedCamera::release(struct camera_device* dev)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return;
- }
- ec->releaseCamera();
-}
-
-int EmulatedCamera::dump(struct camera_device* dev, int fd)
-{
- EmulatedCamera* ec = reinterpret_cast<EmulatedCamera*>(dev->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return -EINVAL;
- }
- return ec->dumpCamera(fd);
-}
-
-int EmulatedCamera::close(struct hw_device_t* device)
-{
- EmulatedCamera* ec =
- reinterpret_cast<EmulatedCamera*>(reinterpret_cast<struct camera_device*>(device)->priv);
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera device", __FUNCTION__);
- return -EINVAL;
- }
- return ec->closeCamera();
-}
-
-/****************************************************************************
- * Static initializer for the camera callback API
- ****************************************************************************/
-
-camera_device_ops_t EmulatedCamera::mDeviceOps = {
- EmulatedCamera::set_preview_window,
- EmulatedCamera::set_callbacks,
- EmulatedCamera::enable_msg_type,
- EmulatedCamera::disable_msg_type,
- EmulatedCamera::msg_type_enabled,
- EmulatedCamera::start_preview,
- EmulatedCamera::stop_preview,
- EmulatedCamera::preview_enabled,
- EmulatedCamera::store_meta_data_in_buffers,
- EmulatedCamera::start_recording,
- EmulatedCamera::stop_recording,
- EmulatedCamera::recording_enabled,
- EmulatedCamera::release_recording_frame,
- EmulatedCamera::auto_focus,
- EmulatedCamera::cancel_auto_focus,
- EmulatedCamera::take_picture,
- EmulatedCamera::cancel_picture,
- EmulatedCamera::set_parameters,
- EmulatedCamera::get_parameters,
- EmulatedCamera::put_parameters,
- EmulatedCamera::send_command,
- EmulatedCamera::release,
- EmulatedCamera::dump
-};
-
-/****************************************************************************
- * Common keys
- ***************************************************************************/
-
-const char EmulatedCamera::FACING_KEY[] = "prop-facing";
-const char EmulatedCamera::ORIENTATION_KEY[] = "prop-orientation";
-const char EmulatedCamera::RECORDING_HINT_KEY[] = "recording-hint";
-
-/****************************************************************************
- * Common string values
- ***************************************************************************/
-
-const char EmulatedCamera::FACING_BACK[] = "back";
-const char EmulatedCamera::FACING_FRONT[] = "front";
-
-/****************************************************************************
- * Helper routines
- ***************************************************************************/
-
-static char* AddValue(const char* param, const char* val)
-{
- const size_t len1 = strlen(param);
- const size_t len2 = strlen(val);
- char* ret = reinterpret_cast<char*>(malloc(len1 + len2 + 2));
- ALOGE_IF(ret == NULL, "%s: Memory failure", __FUNCTION__);
- if (ret != NULL) {
- memcpy(ret, param, len1);
- ret[len1] = ',';
- memcpy(ret + len1 + 1, val, len2);
- ret[len1 + len2 + 1] = '\0';
- }
- return ret;
-}
-
-/****************************************************************************
- * Parameter debugging helpers
- ***************************************************************************/
-
-#if DEBUG_PARAM
-static void PrintParamDiff(const CameraParameters& current,
- const char* new_par)
-{
- char tmp[2048];
- const char* wrk = new_par;
-
- /* Divided with ';' */
- const char* next = strchr(wrk, ';');
- while (next != NULL) {
- snprintf(tmp, sizeof(tmp), "%.*s", next-wrk, wrk);
- /* in the form key=value */
- char* val = strchr(tmp, '=');
- if (val != NULL) {
- *val = '\0'; val++;
- const char* in_current = current.get(tmp);
- if (in_current != NULL) {
- if (strcmp(in_current, val)) {
- ALOGD("=== Value changed: %s: %s -> %s", tmp, in_current, val);
- }
- } else {
- ALOGD("+++ New parameter: %s=%s", tmp, val);
- }
- } else {
- ALOGW("No value separator in %s", tmp);
- }
- wrk = next + 1;
- next = strchr(wrk, ';');
- }
-}
-#endif /* DEBUG_PARAM */
-
-}; /* namespace android */
diff --git a/tools/emulator/system/camera/EmulatedCamera.h b/tools/emulator/system/camera/EmulatedCamera.h
deleted file mode 100755
index 9825d5d48..000000000
--- a/tools/emulator/system/camera/EmulatedCamera.h
+++ /dev/null
@@ -1,401 +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.
- */
-
-#ifndef HW_EMULATOR_CAMERA_EMULATED_CAMERA_H
-#define HW_EMULATOR_CAMERA_EMULATED_CAMERA_H
-
-/*
- * Contains declaration of a class EmulatedCamera that encapsulates
- * functionality common to all version 1.0 emulated camera devices ("fake",
- * "webcam", "video file", etc.). Instances of this class (for each emulated
- * camera) are created during the construction of the EmulatedCameraFactory
- * instance. This class serves as an entry point for all camera API calls that
- * defined by camera_device_ops_t API.
- */
-
-#include <camera/CameraParameters.h>
-#include "EmulatedBaseCamera.h"
-#include "EmulatedCameraDevice.h"
-#include "PreviewWindow.h"
-#include "CallbackNotifier.h"
-
-namespace android {
-
-/* Encapsulates functionality common to all version 1.0 emulated camera devices
- * ("fake", "webcam", "file stream", etc.).
- *
- * Note that EmulatedCameraFactory instantiates object of this class just once,
- * when EmulatedCameraFactory instance gets constructed. Connection to /
- * disconnection from the actual camera device is handled by calls to
- * connectDevice(), and closeCamera() methods of this class that are ivoked in
- * response to hw_module_methods_t::open, and camera_device::close callbacks.
- */
-class EmulatedCamera : public camera_device, public EmulatedBaseCamera {
-public:
- /* Constructs EmulatedCamera instance.
- * Param:
- * cameraId - Zero based camera identifier, which is an index of the camera
- * instance in camera factory's array.
- * module - Emulated camera HAL module descriptor.
- */
- EmulatedCamera(int cameraId,
- struct hw_module_t* module);
-
- /* Destructs EmulatedCamera instance. */
- virtual ~EmulatedCamera();
-
- /****************************************************************************
- * Abstract API
- ***************************************************************************/
-
-public:
- /* Gets emulated camera device used by this instance of the emulated camera.
- */
- virtual EmulatedCameraDevice* getCameraDevice() = 0;
-
- /****************************************************************************
- * Public API
- ***************************************************************************/
-
-public:
- /** Override of base class method */
- virtual status_t Initialize();
-
- /* Next frame is available in the camera device.
- * This is a notification callback that is invoked by the camera device when
- * a new frame is available.
- * Note that most likely this method is called in context of a worker thread
- * that camera device has created for frame capturing.
- * Param:
- * frame - Captured frame, or NULL if camera device didn't pull the frame
- * yet. If NULL is passed in this parameter use GetCurrentFrame method
- * of the camera device class to obtain the next frame. Also note that
- * the size of the frame that is passed here (as well as the frame
- * returned from the GetCurrentFrame method) is defined by the current
- * frame settings (width + height + pixel format) for the camera device.
- * timestamp - Frame's timestamp.
- * camera_dev - Camera device instance that delivered the frame.
- */
- virtual void onNextFrameAvailable(const void* frame,
- nsecs_t timestamp,
- EmulatedCameraDevice* camera_dev);
-
- /* Entry point for notifications that occur in camera device.
- * Param:
- * err - CAMERA_ERROR_XXX error code.
- */
- virtual void onCameraDeviceError(int err);
-
- /****************************************************************************
- * Camera API implementation
- ***************************************************************************/
-
-public:
- /** Override of base class method */
- virtual status_t connectCamera(hw_device_t** device);
-
- /** Override of base class method */
- virtual status_t closeCamera();
-
- /** Override of base class method */
- virtual status_t getCameraInfo(struct camera_info* info);
-
- /****************************************************************************
- * Camera API implementation.
- * These methods are called from the camera API callback routines.
- ***************************************************************************/
-
-protected:
- /* Actual handler for camera_device_ops_t::set_preview_window callback.
- * NOTE: When this method is called the object is locked.
- * Note that failures in this method are reported as negave EXXX statuses.
- */
- virtual status_t setPreviewWindow(struct preview_stream_ops *window);
-
- /* Actual handler for camera_device_ops_t::set_callbacks callback.
- * NOTE: When this method is called the object is locked.
- */
- virtual void setCallbacks(camera_notify_callback notify_cb,
- camera_data_callback data_cb,
- camera_data_timestamp_callback data_cb_timestamp,
- camera_request_memory get_memory,
- void* user);
-
- /* Actual handler for camera_device_ops_t::enable_msg_type callback.
- * NOTE: When this method is called the object is locked.
- */
- virtual void enableMsgType(int32_t msg_type);
-
- /* Actual handler for camera_device_ops_t::disable_msg_type callback.
- * NOTE: When this method is called the object is locked.
- */
- virtual void disableMsgType(int32_t msg_type);
-
- /* Actual handler for camera_device_ops_t::msg_type_enabled callback.
- * NOTE: When this method is called the object is locked.
- * Return:
- * 0 if message(s) is (are) disabled, != 0 if enabled.
- */
- virtual int isMsgTypeEnabled(int32_t msg_type);
-
- /* Actual handler for camera_device_ops_t::start_preview callback.
- * NOTE: When this method is called the object is locked.
- * Note that failures in this method are reported as negave EXXX statuses.
- */
- virtual status_t startPreview();
-
- /* Actual handler for camera_device_ops_t::stop_preview callback.
- * NOTE: When this method is called the object is locked.
- */
- virtual void stopPreview();
-
- /* Actual handler for camera_device_ops_t::preview_enabled callback.
- * NOTE: When this method is called the object is locked.
- * Return:
- * 0 if preview is disabled, != 0 if enabled.
- */
- virtual int isPreviewEnabled();
-
- /* Actual handler for camera_device_ops_t::store_meta_data_in_buffers callback.
- * NOTE: When this method is called the object is locked.
- * Note that failures in this method are reported as negave EXXX statuses.
- */
- virtual status_t storeMetaDataInBuffers(int enable);
-
- /* Actual handler for camera_device_ops_t::start_recording callback.
- * NOTE: When this method is called the object is locked.
- * Note that failures in this method are reported as negave EXXX statuses.
- */
- virtual status_t startRecording();
-
- /* Actual handler for camera_device_ops_t::stop_recording callback.
- * NOTE: When this method is called the object is locked.
- */
- virtual void stopRecording();
-
- /* Actual handler for camera_device_ops_t::recording_enabled callback.
- * NOTE: When this method is called the object is locked.
- * Return:
- * 0 if recording is disabled, != 0 if enabled.
- */
- virtual int isRecordingEnabled();
-
- /* Actual handler for camera_device_ops_t::release_recording_frame callback.
- * NOTE: When this method is called the object is locked.
- */
- virtual void releaseRecordingFrame(const void* opaque);
-
- /* Actual handler for camera_device_ops_t::auto_focus callback.
- * NOTE: When this method is called the object is locked.
- * Note that failures in this method are reported as negave EXXX statuses.
- */
- virtual status_t setAutoFocus();
-
- /* Actual handler for camera_device_ops_t::cancel_auto_focus callback.
- * NOTE: When this method is called the object is locked.
- * Note that failures in this method are reported as negave EXXX statuses.
- */
- virtual status_t cancelAutoFocus();
-
- /* Actual handler for camera_device_ops_t::take_picture callback.
- * NOTE: When this method is called the object is locked.
- * Note that failures in this method are reported as negave EXXX statuses.
- */
- virtual status_t takePicture();
-
- /* Actual handler for camera_device_ops_t::cancel_picture callback.
- * NOTE: When this method is called the object is locked.
- * Note that failures in this method are reported as negave EXXX statuses.
- */
- virtual status_t cancelPicture();
-
- /* Actual handler for camera_device_ops_t::set_parameters callback.
- * NOTE: When this method is called the object is locked.
- * Note that failures in this method are reported as negave EXXX statuses.
- */
- virtual status_t setParameters(const char* parms);
-
- /* Actual handler for camera_device_ops_t::get_parameters callback.
- * NOTE: When this method is called the object is locked.
- * Return:
- * Flattened parameters string. The caller will free the buffer allocated
- * for the string by calling camera_device_ops_t::put_parameters callback.
- */
- virtual char* getParameters();
-
- /* Actual handler for camera_device_ops_t::put_parameters callback.
- * Called to free the string returned from camera_device_ops_t::get_parameters
- * callback. There is nothing more to it: the name of the callback is just
- * misleading.
- * NOTE: When this method is called the object is locked.
- */
- virtual void putParameters(char* params);
-
- /* Actual handler for camera_device_ops_t::send_command callback.
- * NOTE: When this method is called the object is locked.
- * Note that failures in this method are reported as negave EXXX statuses.
- */
- virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2);
-
- /* Actual handler for camera_device_ops_t::release callback.
- * NOTE: When this method is called the object is locked.
- */
- virtual void releaseCamera();
-
- /* Actual handler for camera_device_ops_t::dump callback.
- * NOTE: When this method is called the object is locked.
- * Note that failures in this method are reported as negave EXXX statuses.
- */
- virtual status_t dumpCamera(int fd);
-
- /****************************************************************************
- * Preview management.
- ***************************************************************************/
-
-protected:
- /* Starts preview.
- * Note that when this method is called mPreviewWindow may be NULL,
- * indicating that framework has an intention to start displaying video
- * frames, but didn't create the preview window yet.
- * Return:
- * NO_ERROR on success, or an appropriate error status on failure.
- */
- virtual status_t doStartPreview();
-
- /* Stops preview.
- * This method reverts DoStartPreview.
- * Return:
- * NO_ERROR on success, or an appropriate error status on failure.
- */
- virtual status_t doStopPreview();
-
- /****************************************************************************
- * Private API.
- ***************************************************************************/
-
-protected:
- /* Cleans up camera when released. */
- virtual status_t cleanupCamera();
-
- /****************************************************************************
- * Camera API callbacks as defined by camera_device_ops structure.
- * See hardware/libhardware/include/hardware/camera.h for information on
- * each of these callbacks. Implemented in this class, these callbacks simply
- * dispatch the call into an instance of EmulatedCamera class defined by the
- * 'camera_device' parameter.
- ***************************************************************************/
-
-private:
- static int set_preview_window(struct camera_device* dev,
- struct preview_stream_ops* window);
-
- static void set_callbacks(struct camera_device* dev,
- camera_notify_callback notify_cb,
- camera_data_callback data_cb,
- camera_data_timestamp_callback data_cb_timestamp,
- camera_request_memory get_memory,
- void* user);
-
- static void enable_msg_type(struct camera_device* dev, int32_t msg_type);
-
- static void disable_msg_type(struct camera_device* dev, int32_t msg_type);
-
- static int msg_type_enabled(struct camera_device* dev, int32_t msg_type);
-
- static int start_preview(struct camera_device* dev);
-
- static void stop_preview(struct camera_device* dev);
-
- static int preview_enabled(struct camera_device* dev);
-
- static int store_meta_data_in_buffers(struct camera_device* dev, int enable);
-
- static int start_recording(struct camera_device* dev);
-
- static void stop_recording(struct camera_device* dev);
-
- static int recording_enabled(struct camera_device* dev);
-
- static void release_recording_frame(struct camera_device* dev,
- const void* opaque);
-
- static int auto_focus(struct camera_device* dev);
-
- static int cancel_auto_focus(struct camera_device* dev);
-
- static int take_picture(struct camera_device* dev);
-
- static int cancel_picture(struct camera_device* dev);
-
- static int set_parameters(struct camera_device* dev, const char* parms);
-
- static char* get_parameters(struct camera_device* dev);
-
- static void put_parameters(struct camera_device* dev, char* params);
-
- static int send_command(struct camera_device* dev,
- int32_t cmd,
- int32_t arg1,
- int32_t arg2);
-
- static void release(struct camera_device* dev);
-
- static int dump(struct camera_device* dev, int fd);
-
- static int close(struct hw_device_t* device);
-
- /****************************************************************************
- * Data members
- ***************************************************************************/
-
-protected:
- /* Locks this instance for parameters, state, etc. change. */
- Mutex mObjectLock;
-
- /* Camera parameters. */
- CameraParameters mParameters;
-
- /* Preview window. */
- PreviewWindow mPreviewWindow;
-
- /* Callback notifier. */
- CallbackNotifier mCallbackNotifier;
-
-private:
- /* Registered callbacks implementing camera API. */
- static camera_device_ops_t mDeviceOps;
-
- /****************************************************************************
- * Common keys
- ***************************************************************************/
-
-public:
- static const char FACING_KEY[];
- static const char ORIENTATION_KEY[];
- static const char RECORDING_HINT_KEY[];
-
- /****************************************************************************
- * Common string values
- ***************************************************************************/
-
- /* Possible values for FACING_KEY */
- static const char FACING_BACK[];
- static const char FACING_FRONT[];
-};
-
-}; /* namespace android */
-
-#endif /* HW_EMULATOR_CAMERA_EMULATED_CAMERA_H */
diff --git a/tools/emulator/system/camera/EmulatedCamera2.cpp b/tools/emulator/system/camera/EmulatedCamera2.cpp
deleted file mode 100644
index bbc17400f..000000000
--- a/tools/emulator/system/camera/EmulatedCamera2.cpp
+++ /dev/null
@@ -1,408 +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.
- */
-
-/*
- * Contains implementation of a class EmulatedCamera that encapsulates
- * functionality common to all version 2.0 emulated camera devices. Instances
- * of this class (for each emulated camera) are created during the construction
- * of the EmulatedCameraFactory instance. This class serves as an entry point
- * for all camera API calls that defined by camera2_device_ops_t API.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "EmulatedCamera2_Camera"
-#include <cutils/log.h>
-
-#include "EmulatedCamera2.h"
-#include "system/camera_metadata.h"
-
-namespace android {
-
-/* Constructs EmulatedCamera2 instance.
- * Param:
- * cameraId - Zero based camera identifier, which is an index of the camera
- * instance in camera factory's array.
- * module - Emulated camera HAL module descriptor.
- */
-EmulatedCamera2::EmulatedCamera2(int cameraId,
- struct hw_module_t* module):
- EmulatedBaseCamera(cameraId,
- CAMERA_DEVICE_API_VERSION_2_0,
- &common,
- module)
-{
- common.close = EmulatedCamera2::close;
- ops = &sDeviceOps;
- priv = this;
-
- mNotifyCb = NULL;
-
- mRequestQueueSrc = NULL;
- mFrameQueueDst = NULL;
-
- mVendorTagOps.get_camera_vendor_section_name =
- EmulatedCamera2::get_camera_vendor_section_name;
- mVendorTagOps.get_camera_vendor_tag_name =
- EmulatedCamera2::get_camera_vendor_tag_name;
- mVendorTagOps.get_camera_vendor_tag_type =
- EmulatedCamera2::get_camera_vendor_tag_type;
- mVendorTagOps.parent = this;
-}
-
-/* Destructs EmulatedCamera2 instance. */
-EmulatedCamera2::~EmulatedCamera2() {
-}
-
-/****************************************************************************
- * Abstract API
- ***************************************************************************/
-
-/****************************************************************************
- * Public API
- ***************************************************************************/
-
-status_t EmulatedCamera2::Initialize() {
- return NO_ERROR;
-}
-
-/****************************************************************************
- * Camera API implementation
- ***************************************************************************/
-
-status_t EmulatedCamera2::connectCamera(hw_device_t** device) {
- *device = &common;
- return NO_ERROR;
-}
-
-status_t EmulatedCamera2::closeCamera() {
- return NO_ERROR;
-}
-
-status_t EmulatedCamera2::getCameraInfo(struct camera_info* info) {
- return EmulatedBaseCamera::getCameraInfo(info);
-}
-
-/****************************************************************************
- * Camera Device API implementation.
- * These methods are called from the camera API callback routines.
- ***************************************************************************/
-
-/** Request input queue */
-
-int EmulatedCamera2::requestQueueNotify() {
- return INVALID_OPERATION;
-}
-
-/** Count of requests in flight */
-int EmulatedCamera2::getInProgressCount() {
- return INVALID_OPERATION;
-}
-
-/** Cancel all captures in flight */
-int EmulatedCamera2::flushCapturesInProgress() {
- return INVALID_OPERATION;
-}
-
-/** Construct a default request for a given use case */
-int EmulatedCamera2::constructDefaultRequest(
- int request_template,
- camera_metadata_t **request) {
- return INVALID_OPERATION;
-}
-
-/** Output stream creation and management */
-
-int EmulatedCamera2::allocateStream(
- uint32_t width,
- uint32_t height,
- int format,
- const camera2_stream_ops_t *stream_ops,
- uint32_t *stream_id,
- uint32_t *format_actual,
- uint32_t *usage,
- uint32_t *max_buffers) {
- return INVALID_OPERATION;
-}
-
-int EmulatedCamera2::registerStreamBuffers(
- uint32_t stream_id,
- int num_buffers,
- buffer_handle_t *buffers) {
- return INVALID_OPERATION;
-}
-
-
-int EmulatedCamera2::releaseStream(uint32_t stream_id) {
- return INVALID_OPERATION;
-}
-
-/** Reprocessing input stream management */
-
-int EmulatedCamera2::allocateReprocessStream(
- uint32_t width,
- uint32_t height,
- uint32_t format,
- const camera2_stream_in_ops_t *reprocess_stream_ops,
- uint32_t *stream_id,
- uint32_t *consumer_usage,
- uint32_t *max_buffers) {
- return INVALID_OPERATION;
-}
-
-int EmulatedCamera2::allocateReprocessStreamFromStream(
- uint32_t output_stream_id,
- const camera2_stream_in_ops_t *reprocess_stream_ops,
- uint32_t *stream_id) {
- return INVALID_OPERATION;
-}
-
-int EmulatedCamera2::releaseReprocessStream(uint32_t stream_id) {
- return INVALID_OPERATION;
-}
-
-/** 3A triggering */
-
-int EmulatedCamera2::triggerAction(uint32_t trigger_id,
- int ext1, int ext2) {
- return INVALID_OPERATION;
-}
-
-/** Custom tag query methods */
-
-const char* EmulatedCamera2::getVendorSectionName(uint32_t tag) {
- return NULL;
-}
-
-const char* EmulatedCamera2::getVendorTagName(uint32_t tag) {
- return NULL;
-}
-
-int EmulatedCamera2::getVendorTagType(uint32_t tag) {
- return -1;
-}
-
-/** Debug methods */
-
-int EmulatedCamera2::dump(int fd) {
- return INVALID_OPERATION;
-}
-
-/****************************************************************************
- * Private API.
- ***************************************************************************/
-
-/****************************************************************************
- * Camera API callbacks as defined by camera2_device_ops structure. See
- * hardware/libhardware/include/hardware/camera2.h for information on each
- * of these callbacks. Implemented in this class, these callbacks simply
- * dispatch the call into an instance of EmulatedCamera2 class defined by the
- * 'camera_device2' parameter, or set a member value in the same.
- ***************************************************************************/
-
-EmulatedCamera2* getInstance(const camera2_device_t *d) {
- const EmulatedCamera2* cec = static_cast<const EmulatedCamera2*>(d);
- return const_cast<EmulatedCamera2*>(cec);
-}
-
-int EmulatedCamera2::set_request_queue_src_ops(const camera2_device_t *d,
- const camera2_request_queue_src_ops *queue_src_ops) {
- EmulatedCamera2* ec = getInstance(d);
- ec->mRequestQueueSrc = queue_src_ops;
- return NO_ERROR;
-}
-
-int EmulatedCamera2::notify_request_queue_not_empty(const camera2_device_t *d) {
- EmulatedCamera2* ec = getInstance(d);
- return ec->requestQueueNotify();
-}
-
-int EmulatedCamera2::set_frame_queue_dst_ops(const camera2_device_t *d,
- const camera2_frame_queue_dst_ops *queue_dst_ops) {
- EmulatedCamera2* ec = getInstance(d);
- ec->mFrameQueueDst = queue_dst_ops;
- return NO_ERROR;
-}
-
-int EmulatedCamera2::get_in_progress_count(const camera2_device_t *d) {
- EmulatedCamera2* ec = getInstance(d);
- return ec->getInProgressCount();
-}
-
-int EmulatedCamera2::flush_captures_in_progress(const camera2_device_t *d) {
- EmulatedCamera2* ec = getInstance(d);
- return ec->flushCapturesInProgress();
-}
-
-int EmulatedCamera2::construct_default_request(const camera2_device_t *d,
- int request_template,
- camera_metadata_t **request) {
- EmulatedCamera2* ec = getInstance(d);
- return ec->constructDefaultRequest(request_template, request);
-}
-
-int EmulatedCamera2::allocate_stream(const camera2_device_t *d,
- uint32_t width,
- uint32_t height,
- int format,
- const camera2_stream_ops_t *stream_ops,
- uint32_t *stream_id,
- uint32_t *format_actual,
- uint32_t *usage,
- uint32_t *max_buffers) {
- EmulatedCamera2* ec = getInstance(d);
- return ec->allocateStream(width, height, format, stream_ops,
- stream_id, format_actual, usage, max_buffers);
-}
-
-int EmulatedCamera2::register_stream_buffers(const camera2_device_t *d,
- uint32_t stream_id,
- int num_buffers,
- buffer_handle_t *buffers) {
- EmulatedCamera2* ec = getInstance(d);
- return ec->registerStreamBuffers(stream_id,
- num_buffers,
- buffers);
-}
-int EmulatedCamera2::release_stream(const camera2_device_t *d,
- uint32_t stream_id) {
- EmulatedCamera2* ec = getInstance(d);
- return ec->releaseStream(stream_id);
-}
-
-int EmulatedCamera2::allocate_reprocess_stream(const camera2_device_t *d,
- uint32_t width,
- uint32_t height,
- uint32_t format,
- const camera2_stream_in_ops_t *reprocess_stream_ops,
- uint32_t *stream_id,
- uint32_t *consumer_usage,
- uint32_t *max_buffers) {
- EmulatedCamera2* ec = getInstance(d);
- return ec->allocateReprocessStream(width, height, format,
- reprocess_stream_ops, stream_id, consumer_usage, max_buffers);
-}
-
-int EmulatedCamera2::allocate_reprocess_stream_from_stream(
- const camera2_device_t *d,
- uint32_t output_stream_id,
- const camera2_stream_in_ops_t *reprocess_stream_ops,
- uint32_t *stream_id) {
- EmulatedCamera2* ec = getInstance(d);
- return ec->allocateReprocessStreamFromStream(output_stream_id,
- reprocess_stream_ops, stream_id);
-}
-
-
-int EmulatedCamera2::release_reprocess_stream(const camera2_device_t *d,
- uint32_t stream_id) {
- EmulatedCamera2* ec = getInstance(d);
- return ec->releaseReprocessStream(stream_id);
-}
-
-int EmulatedCamera2::trigger_action(const camera2_device_t *d,
- uint32_t trigger_id,
- int ext1,
- int ext2) {
- EmulatedCamera2* ec = getInstance(d);
- return ec->triggerAction(trigger_id, ext1, ext2);
-}
-
-int EmulatedCamera2::set_notify_callback(const camera2_device_t *d,
- camera2_notify_callback notify_cb, void* user) {
- EmulatedCamera2* ec = getInstance(d);
- Mutex::Autolock l(ec->mMutex);
- ec->mNotifyCb = notify_cb;
- ec->mNotifyUserPtr = user;
- return NO_ERROR;
-}
-
-int EmulatedCamera2::get_metadata_vendor_tag_ops(const camera2_device_t *d,
- vendor_tag_query_ops_t **ops) {
- EmulatedCamera2* ec = getInstance(d);
- *ops = static_cast<vendor_tag_query_ops_t*>(
- &ec->mVendorTagOps);
- return NO_ERROR;
-}
-
-const char* EmulatedCamera2::get_camera_vendor_section_name(
- const vendor_tag_query_ops_t *v,
- uint32_t tag) {
- EmulatedCamera2* ec = static_cast<const TagOps*>(v)->parent;
- return ec->getVendorSectionName(tag);
-}
-
-const char* EmulatedCamera2::get_camera_vendor_tag_name(
- const vendor_tag_query_ops_t *v,
- uint32_t tag) {
- EmulatedCamera2* ec = static_cast<const TagOps*>(v)->parent;
- return ec->getVendorTagName(tag);
-}
-
-int EmulatedCamera2::get_camera_vendor_tag_type(
- const vendor_tag_query_ops_t *v,
- uint32_t tag) {
- EmulatedCamera2* ec = static_cast<const TagOps*>(v)->parent;
- return ec->getVendorTagType(tag);
-}
-
-int EmulatedCamera2::dump(const camera2_device_t *d, int fd) {
- EmulatedCamera2* ec = getInstance(d);
- return ec->dump(fd);
-}
-
-int EmulatedCamera2::close(struct hw_device_t* device) {
- EmulatedCamera2* ec =
- static_cast<EmulatedCamera2*>(
- reinterpret_cast<camera2_device_t*>(device) );
- if (ec == NULL) {
- ALOGE("%s: Unexpected NULL camera2 device", __FUNCTION__);
- return -EINVAL;
- }
- return ec->closeCamera();
-}
-
-void EmulatedCamera2::sendNotification(int32_t msgType,
- int32_t ext1, int32_t ext2, int32_t ext3) {
- camera2_notify_callback notifyCb;
- {
- Mutex::Autolock l(mMutex);
- notifyCb = mNotifyCb;
- }
- if (notifyCb != NULL) {
- notifyCb(msgType, ext1, ext2, ext3, mNotifyUserPtr);
- }
-}
-
-camera2_device_ops_t EmulatedCamera2::sDeviceOps = {
- EmulatedCamera2::set_request_queue_src_ops,
- EmulatedCamera2::notify_request_queue_not_empty,
- EmulatedCamera2::set_frame_queue_dst_ops,
- EmulatedCamera2::get_in_progress_count,
- EmulatedCamera2::flush_captures_in_progress,
- EmulatedCamera2::construct_default_request,
- EmulatedCamera2::allocate_stream,
- EmulatedCamera2::register_stream_buffers,
- EmulatedCamera2::release_stream,
- EmulatedCamera2::allocate_reprocess_stream,
- EmulatedCamera2::allocate_reprocess_stream_from_stream,
- EmulatedCamera2::release_reprocess_stream,
- EmulatedCamera2::trigger_action,
- EmulatedCamera2::set_notify_callback,
- EmulatedCamera2::get_metadata_vendor_tag_ops,
- EmulatedCamera2::dump
-};
-
-}; /* namespace android */
diff --git a/tools/emulator/system/camera/EmulatedCamera2.h b/tools/emulator/system/camera/EmulatedCamera2.h
deleted file mode 100644
index 755ed0e18..000000000
--- a/tools/emulator/system/camera/EmulatedCamera2.h
+++ /dev/null
@@ -1,272 +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.
- */
-
-#ifndef HW_EMULATOR_CAMERA_EMULATED_CAMERA2_H
-#define HW_EMULATOR_CAMERA_EMULATED_CAMERA2_H
-
-/*
- * Contains declaration of a class EmulatedCamera that encapsulates
- * functionality common to all version 2.0 emulated camera devices. Instances
- * of this class (for each emulated camera) are created during the construction
- * of the EmulatedCameraFactory instance. This class serves as an entry point
- * for all camera API calls that defined by camera2_device_ops_t API.
- */
-
-#include "hardware/camera2.h"
-#include "system/camera_metadata.h"
-#include "EmulatedBaseCamera.h"
-#include <utils/Thread.h>
-#include <utils/Mutex.h>
-
-namespace android {
-
-/* Encapsulates functionality common to all version 2.0 emulated camera devices
- *
- * Note that EmulatedCameraFactory instantiates object of this class just once,
- * when EmulatedCameraFactory instance gets constructed. Connection to /
- * disconnection from the actual camera device is handled by calls to
- * connectDevice(), and closeCamera() methods of this class that are invoked in
- * response to hw_module_methods_t::open, and camera_device::close callbacks.
- */
-class EmulatedCamera2 : public camera2_device, public EmulatedBaseCamera {
-public:
- /* Constructs EmulatedCamera2 instance.
- * Param:
- * cameraId - Zero based camera identifier, which is an index of the camera
- * instance in camera factory's array.
- * module - Emulated camera HAL module descriptor.
- */
- EmulatedCamera2(int cameraId,
- struct hw_module_t* module);
-
- /* Destructs EmulatedCamera2 instance. */
- virtual ~EmulatedCamera2();
-
- /****************************************************************************
- * Abstract API
- ***************************************************************************/
-
-public:
-
- /****************************************************************************
- * Public API
- ***************************************************************************/
-
-public:
- virtual status_t Initialize();
-
- /****************************************************************************
- * Camera module API and generic hardware device API implementation
- ***************************************************************************/
-
-public:
- virtual status_t connectCamera(hw_device_t** device);
-
- virtual status_t closeCamera();
-
- virtual status_t getCameraInfo(struct camera_info* info) = 0;
-
- /****************************************************************************
- * Camera API implementation.
- * These methods are called from the camera API callback routines.
- ***************************************************************************/
-
-protected:
- /** Request input queue notification */
- virtual int requestQueueNotify();
-
- /** Count of requests in flight */
- virtual int getInProgressCount();
-
- /** Cancel all captures in flight */
- virtual int flushCapturesInProgress();
-
- virtual int constructDefaultRequest(
- int request_template,
- camera_metadata_t **request);
-
- /** Output stream creation and management */
- virtual int allocateStream(
- uint32_t width,
- uint32_t height,
- int format,
- const camera2_stream_ops_t *stream_ops,
- uint32_t *stream_id,
- uint32_t *format_actual,
- uint32_t *usage,
- uint32_t *max_buffers);
-
- virtual int registerStreamBuffers(
- uint32_t stream_id,
- int num_buffers,
- buffer_handle_t *buffers);
-
- virtual int releaseStream(uint32_t stream_id);
-
- /** Input stream creation and management */
- virtual int allocateReprocessStream(
- uint32_t width,
- uint32_t height,
- uint32_t format,
- const camera2_stream_in_ops_t *reprocess_stream_ops,
- uint32_t *stream_id,
- uint32_t *consumer_usage,
- uint32_t *max_buffers);
-
- virtual int allocateReprocessStreamFromStream(
- uint32_t output_stream_id,
- const camera2_stream_in_ops_t *reprocess_stream_ops,
- uint32_t *stream_id);
-
- virtual int releaseReprocessStream(uint32_t stream_id);
-
- /** 3A action triggering */
- virtual int triggerAction(uint32_t trigger_id,
- int32_t ext1, int32_t ext2);
-
- /** Custom tag definitions */
- virtual const char* getVendorSectionName(uint32_t tag);
- virtual const char* getVendorTagName(uint32_t tag);
- virtual int getVendorTagType(uint32_t tag);
-
- /** Debug methods */
-
- virtual int dump(int fd);
-
- /****************************************************************************
- * Camera API callbacks as defined by camera2_device_ops structure. See
- * hardware/libhardware/include/hardware/camera2.h for information on each
- * of these callbacks. Implemented in this class, these callbacks simply
- * dispatch the call into an instance of EmulatedCamera2 class defined in
- * the 'camera_device2' parameter.
- ***************************************************************************/
-
-private:
- /** Input request queue */
- static int set_request_queue_src_ops(const camera2_device_t *,
- const camera2_request_queue_src_ops *queue_src_ops);
- static int notify_request_queue_not_empty(const camera2_device_t *);
-
- /** Output frame queue */
- static int set_frame_queue_dst_ops(const camera2_device_t *,
- const camera2_frame_queue_dst_ops *queue_dst_ops);
-
- /** In-progress request management */
- static int get_in_progress_count(const camera2_device_t *);
-
- static int flush_captures_in_progress(const camera2_device_t *);
-
- /** Request template creation */
- static int construct_default_request(const camera2_device_t *,
- int request_template,
- camera_metadata_t **request);
-
- /** Stream management */
- static int allocate_stream(const camera2_device_t *,
- uint32_t width,
- uint32_t height,
- int format,
- const camera2_stream_ops_t *stream_ops,
- uint32_t *stream_id,
- uint32_t *format_actual,
- uint32_t *usage,
- uint32_t *max_buffers);
-
- static int register_stream_buffers(const camera2_device_t *,
- uint32_t stream_id,
- int num_buffers,
- buffer_handle_t *buffers);
-
- static int release_stream(const camera2_device_t *,
- uint32_t stream_id);
-
- static int allocate_reprocess_stream(const camera2_device_t *,
- uint32_t width,
- uint32_t height,
- uint32_t format,
- const camera2_stream_in_ops_t *reprocess_stream_ops,
- uint32_t *stream_id,
- uint32_t *consumer_usage,
- uint32_t *max_buffers);
-
- static int allocate_reprocess_stream_from_stream(const camera2_device_t *,
- uint32_t output_stream_id,
- const camera2_stream_in_ops_t *reprocess_stream_ops,
- uint32_t *stream_id);
-
- static int release_reprocess_stream(const camera2_device_t *,
- uint32_t stream_id);
-
- /** 3A triggers*/
- static int trigger_action(const camera2_device_t *,
- uint32_t trigger_id,
- int ext1,
- int ext2);
-
- /** Notifications to application */
- static int set_notify_callback(const camera2_device_t *,
- camera2_notify_callback notify_cb,
- void *user);
-
- /** Vendor metadata registration */
- static int get_metadata_vendor_tag_ops(const camera2_device_t *,
- vendor_tag_query_ops_t **ops);
- // for get_metadata_vendor_tag_ops
- static const char* get_camera_vendor_section_name(
- const vendor_tag_query_ops_t *,
- uint32_t tag);
- static const char* get_camera_vendor_tag_name(
- const vendor_tag_query_ops_t *,
- uint32_t tag);
- static int get_camera_vendor_tag_type(
- const vendor_tag_query_ops_t *,
- uint32_t tag);
-
- static int dump(const camera2_device_t *, int fd);
-
- /** For hw_device_t ops */
- static int close(struct hw_device_t* device);
-
- /****************************************************************************
- * Data members shared with implementations
- ***************************************************************************/
- protected:
- /** Mutex for calls through camera2 device interface */
- Mutex mMutex;
-
- const camera2_request_queue_src_ops *mRequestQueueSrc;
- const camera2_frame_queue_dst_ops *mFrameQueueDst;
-
- struct TagOps : public vendor_tag_query_ops {
- EmulatedCamera2 *parent;
- };
- TagOps mVendorTagOps;
-
- void sendNotification(int32_t msgType,
- int32_t ext1, int32_t ext2, int32_t ext3);
-
- /****************************************************************************
- * Data members
- ***************************************************************************/
- private:
- static camera2_device_ops_t sDeviceOps;
- camera2_notify_callback mNotifyCb;
- void* mNotifyUserPtr;
-};
-
-}; /* namespace android */
-
-#endif /* HW_EMULATOR_CAMERA_EMULATED_CAMERA2_H */
diff --git a/tools/emulator/system/camera/EmulatedCameraCommon.h b/tools/emulator/system/camera/EmulatedCameraCommon.h
deleted file mode 100755
index c1d575c93..000000000
--- a/tools/emulator/system/camera/EmulatedCameraCommon.h
+++ /dev/null
@@ -1,60 +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.
- */
-
-#ifndef HW_EMULATOR_CAMERA_EMULATED_CAMERA_COMMON_H
-#define HW_EMULATOR_CAMERA_EMULATED_CAMERA_COMMON_H
-
-/*
- * Contains common declarations that are used across the camera emulation.
- */
-
-#include <linux/videodev2.h>
-#include <hardware/camera.h>
-
-/* A helper class that tracks a routine execution.
- * Basically, it dumps an enry message in its constructor, and an exit message
- * in its destructor. Use LOGRE() macro (declared bellow) to create instances
- * of this class at the beginning of the tracked routines / methods.
- */
-class HWERoutineTracker {
-public:
- /* Constructor that prints an "entry" trace message. */
- explicit HWERoutineTracker(const char* name)
- : mName(name) {
- ALOGV("Entering %s", mName);
- }
-
- /* Destructor that prints a "leave" trace message. */
- ~HWERoutineTracker() {
- ALOGV("Leaving %s", mName);
- }
-
-private:
- /* Stores the routine name. */
- const char* mName;
-};
-
-/* Logs an execution of a routine / method. */
-#define LOGRE() HWERoutineTracker hwertracker_##__LINE__(__FUNCTION__)
-
-/*
- * min / max macros
- */
-
-#define min(a,b) (((a) < (b)) ? (a) : (b))
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-
-#endif /* HW_EMULATOR_CAMERA_EMULATED_CAMERA_COMMON_H */
diff --git a/tools/emulator/system/camera/EmulatedCameraDevice.cpp b/tools/emulator/system/camera/EmulatedCameraDevice.cpp
deleted file mode 100755
index 5c5280830..000000000
--- a/tools/emulator/system/camera/EmulatedCameraDevice.cpp
+++ /dev/null
@@ -1,397 +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.
- */
-
-/*
- * Contains implementation of an abstract class EmulatedCameraDevice that defines
- * functionality expected from an emulated physical camera device:
- * - Obtaining and setting camera parameters
- * - Capturing frames
- * - Streaming video
- * - etc.
- */
-
-#define LOG_NDEBUG 0
-#define LOG_TAG "EmulatedCamera_Device"
-#include <cutils/log.h>
-#include <sys/select.h>
-#include <cmath>
-#include "EmulatedCameraDevice.h"
-
-namespace android {
-
-const float GAMMA_CORRECTION = 2.2f;
-EmulatedCameraDevice::EmulatedCameraDevice(EmulatedCamera* camera_hal)
- : mObjectLock(),
- mCurFrameTimestamp(0),
- mCameraHAL(camera_hal),
- mCurrentFrame(NULL),
- mExposureCompensation(1.0f),
- mWhiteBalanceScale(NULL),
- mSupportedWhiteBalanceScale(),
- mState(ECDS_CONSTRUCTED)
-{
-}
-
-EmulatedCameraDevice::~EmulatedCameraDevice()
-{
- ALOGV("EmulatedCameraDevice destructor");
- if (mCurrentFrame != NULL) {
- delete[] mCurrentFrame;
- }
- for (int i = 0; i < mSupportedWhiteBalanceScale.size(); ++i) {
- if (mSupportedWhiteBalanceScale.valueAt(i) != NULL) {
- delete[] mSupportedWhiteBalanceScale.valueAt(i);
- }
- }
-}
-
-/****************************************************************************
- * Emulated camera device public API
- ***************************************************************************/
-
-status_t EmulatedCameraDevice::Initialize()
-{
- if (isInitialized()) {
- ALOGW("%s: Emulated camera device is already initialized: mState = %d",
- __FUNCTION__, mState);
- return NO_ERROR;
- }
-
- /* Instantiate worker thread object. */
- mWorkerThread = new WorkerThread(this);
- if (getWorkerThread() == NULL) {
- ALOGE("%s: Unable to instantiate worker thread object", __FUNCTION__);
- return ENOMEM;
- }
-
- mState = ECDS_INITIALIZED;
-
- return NO_ERROR;
-}
-
-status_t EmulatedCameraDevice::startDeliveringFrames(bool one_burst)
-{
- ALOGV("%s", __FUNCTION__);
-
- if (!isStarted()) {
- ALOGE("%s: Device is not started", __FUNCTION__);
- return EINVAL;
- }
-
- /* Frames will be delivered from the thread routine. */
- const status_t res = startWorkerThread(one_burst);
- ALOGE_IF(res != NO_ERROR, "%s: startWorkerThread failed", __FUNCTION__);
- return res;
-}
-
-status_t EmulatedCameraDevice::stopDeliveringFrames()
-{
- ALOGV("%s", __FUNCTION__);
-
- if (!isStarted()) {
- ALOGW("%s: Device is not started", __FUNCTION__);
- return NO_ERROR;
- }
-
- const status_t res = stopWorkerThread();
- ALOGE_IF(res != NO_ERROR, "%s: startWorkerThread failed", __FUNCTION__);
- return res;
-}
-
-void EmulatedCameraDevice::setExposureCompensation(const float ev) {
- ALOGV("%s", __FUNCTION__);
-
- if (!isStarted()) {
- ALOGW("%s: Fake camera device is not started.", __FUNCTION__);
- }
-
- mExposureCompensation = std::pow(2.0f, ev / GAMMA_CORRECTION);
- ALOGV("New exposure compensation is %f", mExposureCompensation);
-}
-
-void EmulatedCameraDevice::initializeWhiteBalanceModes(const char* mode,
- const float r_scale,
- const float b_scale) {
- ALOGV("%s with %s, %f, %f", __FUNCTION__, mode, r_scale, b_scale);
- float* value = new float[3];
- value[0] = r_scale; value[1] = 1.0f; value[2] = b_scale;
- mSupportedWhiteBalanceScale.add(String8(mode), value);
-}
-
-void EmulatedCameraDevice::setWhiteBalanceMode(const char* mode) {
- ALOGV("%s with white balance %s", __FUNCTION__, mode);
- mWhiteBalanceScale =
- mSupportedWhiteBalanceScale.valueFor(String8(mode));
-}
-
-/* Computes the pixel value after adjusting the white balance to the current
- * one. The input the y, u, v channel of the pixel and the adjusted value will
- * be stored in place. The adjustment is done in RGB space.
- */
-void EmulatedCameraDevice::changeWhiteBalance(uint8_t& y,
- uint8_t& u,
- uint8_t& v) const {
- float r_scale = mWhiteBalanceScale[0];
- float b_scale = mWhiteBalanceScale[2];
- int r = static_cast<float>(YUV2R(y, u, v)) / r_scale;
- int g = YUV2G(y, u, v);
- int b = static_cast<float>(YUV2B(y, u, v)) / b_scale;
-
- y = RGB2Y(r, g, b);
- u = RGB2U(r, g, b);
- v = RGB2V(r, g, b);
-}
-
-status_t EmulatedCameraDevice::getCurrentPreviewFrame(void* buffer)
-{
- if (!isStarted()) {
- ALOGE("%s: Device is not started", __FUNCTION__);
- return EINVAL;
- }
- if (mCurrentFrame == NULL || buffer == NULL) {
- ALOGE("%s: No framebuffer", __FUNCTION__);
- return EINVAL;
- }
-
- /* In emulation the framebuffer is never RGB. */
- switch (mPixelFormat) {
- case V4L2_PIX_FMT_YVU420:
- YV12ToRGB32(mCurrentFrame, buffer, mFrameWidth, mFrameHeight);
- return NO_ERROR;
- case V4L2_PIX_FMT_YUV420:
- YU12ToRGB32(mCurrentFrame, buffer, mFrameWidth, mFrameHeight);
- return NO_ERROR;
- case V4L2_PIX_FMT_NV21:
- NV21ToRGB32(mCurrentFrame, buffer, mFrameWidth, mFrameHeight);
- return NO_ERROR;
- case V4L2_PIX_FMT_NV12:
- NV12ToRGB32(mCurrentFrame, buffer, mFrameWidth, mFrameHeight);
- return NO_ERROR;
-
- default:
- ALOGE("%s: Unknown pixel format %.4s",
- __FUNCTION__, reinterpret_cast<const char*>(&mPixelFormat));
- return EINVAL;
- }
-}
-
-/****************************************************************************
- * Emulated camera device private API
- ***************************************************************************/
-
-status_t EmulatedCameraDevice::commonStartDevice(int width,
- int height,
- uint32_t pix_fmt)
-{
- /* Validate pixel format, and calculate framebuffer size at the same time. */
- switch (pix_fmt) {
- case V4L2_PIX_FMT_YVU420:
- case V4L2_PIX_FMT_YUV420:
- case V4L2_PIX_FMT_NV21:
- case V4L2_PIX_FMT_NV12:
- mFrameBufferSize = (width * height * 12) / 8;
- break;
-
- default:
- ALOGE("%s: Unknown pixel format %.4s",
- __FUNCTION__, reinterpret_cast<const char*>(&pix_fmt));
- return EINVAL;
- }
-
- /* Cache framebuffer info. */
- mFrameWidth = width;
- mFrameHeight = height;
- mPixelFormat = pix_fmt;
- mTotalPixels = width * height;
-
- /* Allocate framebuffer. */
- mCurrentFrame = new uint8_t[mFrameBufferSize];
- if (mCurrentFrame == NULL) {
- ALOGE("%s: Unable to allocate framebuffer", __FUNCTION__);
- return ENOMEM;
- }
- ALOGV("%s: Allocated %p %d bytes for %d pixels in %.4s[%dx%d] frame",
- __FUNCTION__, mCurrentFrame, mFrameBufferSize, mTotalPixels,
- reinterpret_cast<const char*>(&mPixelFormat), mFrameWidth, mFrameHeight);
- return NO_ERROR;
-}
-
-void EmulatedCameraDevice::commonStopDevice()
-{
- mFrameWidth = mFrameHeight = mTotalPixels = 0;
- mPixelFormat = 0;
-
- if (mCurrentFrame != NULL) {
- delete[] mCurrentFrame;
- mCurrentFrame = NULL;
- }
-}
-
-/****************************************************************************
- * Worker thread management.
- ***************************************************************************/
-
-status_t EmulatedCameraDevice::startWorkerThread(bool one_burst)
-{
- ALOGV("%s", __FUNCTION__);
-
- if (!isInitialized()) {
- ALOGE("%s: Emulated camera device is not initialized", __FUNCTION__);
- return EINVAL;
- }
-
- const status_t res = getWorkerThread()->startThread(one_burst);
- ALOGE_IF(res != NO_ERROR, "%s: Unable to start worker thread", __FUNCTION__);
- return res;
-}
-
-status_t EmulatedCameraDevice::stopWorkerThread()
-{
- ALOGV("%s", __FUNCTION__);
-
- if (!isInitialized()) {
- ALOGE("%s: Emulated camera device is not initialized", __FUNCTION__);
- return EINVAL;
- }
-
- const status_t res = getWorkerThread()->stopThread();
- ALOGE_IF(res != NO_ERROR, "%s: Unable to stop worker thread", __FUNCTION__);
- return res;
-}
-
-bool EmulatedCameraDevice::inWorkerThread()
-{
- /* This will end the thread loop, and will terminate the thread. Derived
- * classes must override this method. */
- return false;
-}
-
-/****************************************************************************
- * Worker thread implementation.
- ***************************************************************************/
-
-status_t EmulatedCameraDevice::WorkerThread::readyToRun()
-{
- ALOGV("Starting emulated camera device worker thread...");
-
- ALOGW_IF(mThreadControl >= 0 || mControlFD >= 0,
- "%s: Thread control FDs are opened", __FUNCTION__);
- /* Create a pair of FDs that would be used to control the thread. */
- int thread_fds[2];
- if (pipe(thread_fds) == 0) {
- mThreadControl = thread_fds[1];
- mControlFD = thread_fds[0];
- ALOGV("Emulated device's worker thread has been started.");
- return NO_ERROR;
- } else {
- ALOGE("%s: Unable to create thread control FDs: %d -> %s",
- __FUNCTION__, errno, strerror(errno));
- return errno;
- }
-}
-
-status_t EmulatedCameraDevice::WorkerThread::stopThread()
-{
- ALOGV("Stopping emulated camera device's worker thread...");
-
- status_t res = EINVAL;
- if (mThreadControl >= 0) {
- /* Send "stop" message to the thread loop. */
- const ControlMessage msg = THREAD_STOP;
- const int wres =
- TEMP_FAILURE_RETRY(write(mThreadControl, &msg, sizeof(msg)));
- if (wres == sizeof(msg)) {
- /* Stop the thread, and wait till it's terminated. */
- res = requestExitAndWait();
- if (res == NO_ERROR) {
- /* Close control FDs. */
- if (mThreadControl >= 0) {
- close(mThreadControl);
- mThreadControl = -1;
- }
- if (mControlFD >= 0) {
- close(mControlFD);
- mControlFD = -1;
- }
- ALOGV("Emulated camera device's worker thread has been stopped.");
- } else {
- ALOGE("%s: requestExitAndWait failed: %d -> %s",
- __FUNCTION__, res, strerror(-res));
- }
- } else {
- ALOGE("%s: Unable to send THREAD_STOP message: %d -> %s",
- __FUNCTION__, errno, strerror(errno));
- res = errno ? errno : EINVAL;
- }
- } else {
- ALOGE("%s: Thread control FDs are not opened", __FUNCTION__);
- }
-
- return res;
-}
-
-EmulatedCameraDevice::WorkerThread::SelectRes
-EmulatedCameraDevice::WorkerThread::Select(int fd, int timeout)
-{
- fd_set fds[1];
- struct timeval tv, *tvp = NULL;
-
- const int fd_num = (fd >= 0) ? max(fd, mControlFD) + 1 :
- mControlFD + 1;
- FD_ZERO(fds);
- FD_SET(mControlFD, fds);
- if (fd >= 0) {
- FD_SET(fd, fds);
- }
- if (timeout) {
- tv.tv_sec = timeout / 1000000;
- tv.tv_usec = timeout % 1000000;
- tvp = &tv;
- }
- int res = TEMP_FAILURE_RETRY(select(fd_num, fds, NULL, NULL, tvp));
- if (res < 0) {
- ALOGE("%s: select returned %d and failed: %d -> %s",
- __FUNCTION__, res, errno, strerror(errno));
- return ERROR;
- } else if (res == 0) {
- /* Timeout. */
- return TIMEOUT;
- } else if (FD_ISSET(mControlFD, fds)) {
- /* A control event. Lets read the message. */
- ControlMessage msg;
- res = TEMP_FAILURE_RETRY(read(mControlFD, &msg, sizeof(msg)));
- if (res != sizeof(msg)) {
- ALOGE("%s: Unexpected message size %d, or an error %d -> %s",
- __FUNCTION__, res, errno, strerror(errno));
- return ERROR;
- }
- /* THREAD_STOP is the only message expected here. */
- if (msg == THREAD_STOP) {
- ALOGV("%s: THREAD_STOP message is received", __FUNCTION__);
- return EXIT_THREAD;
- } else {
- ALOGE("Unknown worker thread message %d", msg);
- return ERROR;
- }
- } else {
- /* Must be an FD. */
- ALOGW_IF(fd < 0 || !FD_ISSET(fd, fds), "%s: Undefined 'select' result",
- __FUNCTION__);
- return READY;
- }
-}
-
-}; /* namespace android */
diff --git a/tools/emulator/system/camera/EmulatedCameraDevice.h b/tools/emulator/system/camera/EmulatedCameraDevice.h
deleted file mode 100755
index b7cdcb7a4..000000000
--- a/tools/emulator/system/camera/EmulatedCameraDevice.h
+++ /dev/null
@@ -1,544 +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.
- */
-
-#ifndef HW_EMULATOR_CAMERA_EMULATED_CAMERA_DEVICE_H
-#define HW_EMULATOR_CAMERA_EMULATED_CAMERA_DEVICE_H
-
-/*
- * Contains declaration of an abstract class EmulatedCameraDevice that defines
- * functionality expected from an emulated physical camera device:
- * - Obtaining and setting camera device parameters
- * - Capturing frames
- * - Streaming video
- * - etc.
- */
-
-#include <utils/threads.h>
-#include <utils/KeyedVector.h>
-#include <utils/String8.h>
-#include "EmulatedCameraCommon.h"
-#include "Converters.h"
-
-namespace android {
-
-class EmulatedCamera;
-
-/* Encapsulates an abstract class EmulatedCameraDevice that defines
- * functionality expected from an emulated physical camera device:
- * - Obtaining and setting camera device parameters
- * - Capturing frames
- * - Streaming video
- * - etc.
- */
-class EmulatedCameraDevice {
-public:
- /* Constructs EmulatedCameraDevice instance.
- * Param:
- * camera_hal - Emulated camera that implements the camera HAL API, and
- * manages (contains) this object.
- */
- explicit EmulatedCameraDevice(EmulatedCamera* camera_hal);
-
- /* Destructs EmulatedCameraDevice instance. */
- virtual ~EmulatedCameraDevice();
-
- /***************************************************************************
- * Emulated camera device abstract interface
- **************************************************************************/
-
-public:
- /* Connects to the camera device.
- * This method must be called on an initialized instance of this class.
- * Return:
- * NO_ERROR on success, or an appropriate error status.
- */
- virtual status_t connectDevice() = 0;
-
- /* Disconnects from the camera device.
- * Return:
- * NO_ERROR on success, or an appropriate error status. If this method is
- * called for already disconnected, or uninitialized instance of this class,
- * a successful status must be returned from this method. If this method is
- * called for an instance that is in the "started" state, this method must
- * return a failure.
- */
- virtual status_t disconnectDevice() = 0;
-
- /* Starts the camera device.
- * This method tells the camera device to start capturing frames of the given
- * dimensions for the given pixel format. Note that this method doesn't start
- * the delivery of the captured frames to the emulated camera. Call
- * startDeliveringFrames method to start delivering frames. This method must
- * be called on a connected instance of this class. If it is called on a
- * disconnected instance, this method must return a failure.
- * Param:
- * width, height - Frame dimensions to use when capturing video frames.
- * pix_fmt - Pixel format to use when capturing video frames.
- * Return:
- * NO_ERROR on success, or an appropriate error status.
- */
- virtual status_t startDevice(int width, int height, uint32_t pix_fmt) = 0;
-
- /* Stops the camera device.
- * This method tells the camera device to stop capturing frames. Note that
- * this method doesn't stop delivering frames to the emulated camera. Always
- * call stopDeliveringFrames prior to calling this method.
- * Return:
- * NO_ERROR on success, or an appropriate error status. If this method is
- * called for an object that is not capturing frames, or is disconnected,
- * or is uninitialized, a successful status must be returned from this
- * method.
- */
- virtual status_t stopDevice() = 0;
-
- /***************************************************************************
- * Emulated camera device public API
- **************************************************************************/
-
-public:
- /* Initializes EmulatedCameraDevice instance.
- * Derived classes should override this method in order to cache static
- * properties of the physical device (list of supported pixel formats, frame
- * sizes, etc.) If this method is called on an already initialized instance,
- * it must return a successful status.
- * Return:
- * NO_ERROR on success, or an appropriate error status.
- */
- virtual status_t Initialize();
-
- /* Initializes the white balance modes parameters.
- * The parameters are passed by each individual derived camera API to
- * represent that different camera manufacturers may have different
- * preferences on the white balance parameters. Green channel in the RGB
- * color space is fixed to keep the luminance to be reasonably constant.
- *
- * Param:
- * mode the text describing the current white balance mode
- * r_scale the scale factor for the R channel in RGB space
- * b_scale the scale factor for the B channel in RGB space.
- */
- void initializeWhiteBalanceModes(const char* mode,
- const float r_scale,
- const float b_scale);
-
- /* Starts delivering frames captured from the camera device.
- * This method will start the worker thread that would be pulling frames from
- * the camera device, and will deliver the pulled frames back to the emulated
- * camera via onNextFrameAvailable callback. This method must be called on a
- * connected instance of this class with a started camera device. If it is
- * called on a disconnected instance, or camera device has not been started,
- * this method must return a failure.
- * Param:
- * one_burst - Controls how many frames should be delivered. If this
- * parameter is 'true', only one captured frame will be delivered to the
- * emulated camera. If this parameter is 'false', frames will keep
- * coming until stopDeliveringFrames method is called. Typically, this
- * parameter is set to 'true' only in order to obtain a single frame
- * that will be used as a "picture" in takePicture method of the
- * emulated camera.
- * Return:
- * NO_ERROR on success, or an appropriate error status.
- */
- virtual status_t startDeliveringFrames(bool one_burst);
-
- /* Stops delivering frames captured from the camera device.
- * This method will stop the worker thread started by startDeliveringFrames.
- * Return:
- * NO_ERROR on success, or an appropriate error status.
- */
- virtual status_t stopDeliveringFrames();
-
- /* Sets the exposure compensation for the camera device.
- */
- void setExposureCompensation(const float ev);
-
- /* Sets the white balance mode for the device.
- */
- void setWhiteBalanceMode(const char* mode);
-
- /* Gets current framebuffer, converted into preview frame format.
- * This method must be called on a connected instance of this class with a
- * started camera device. If it is called on a disconnected instance, or
- * camera device has not been started, this method must return a failure.
- * Note that this method should be called only after at least one frame has
- * been captured and delivered. Otherwise it will return garbage in the
- * preview frame buffer. Typically, this method shuld be called from
- * onNextFrameAvailable callback.
- * Param:
- * buffer - Buffer, large enough to contain the entire preview frame.
- * Return:
- * NO_ERROR on success, or an appropriate error status.
- */
- virtual status_t getCurrentPreviewFrame(void* buffer);
-
- /* Gets width of the frame obtained from the physical device.
- * Return:
- * Width of the frame obtained from the physical device. Note that value
- * returned from this method is valid only in case if camera device has been
- * started.
- */
- inline int getFrameWidth() const
- {
- ALOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__);
- return mFrameWidth;
- }
-
- /* Gets height of the frame obtained from the physical device.
- * Return:
- * Height of the frame obtained from the physical device. Note that value
- * returned from this method is valid only in case if camera device has been
- * started.
- */
- inline int getFrameHeight() const
- {
- ALOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__);
- return mFrameHeight;
- }
-
- /* Gets byte size of the current frame buffer.
- * Return:
- * Byte size of the frame buffer. Note that value returned from this method
- * is valid only in case if camera device has been started.
- */
- inline size_t getFrameBufferSize() const
- {
- ALOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__);
- return mFrameBufferSize;
- }
-
- /* Gets number of pixels in the current frame buffer.
- * Return:
- * Number of pixels in the frame buffer. Note that value returned from this
- * method is valid only in case if camera device has been started.
- */
- inline int getPixelNum() const
- {
- ALOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__);
- return mTotalPixels;
- }
-
- /* Gets pixel format of the frame that camera device streams to this class.
- * Throughout camera framework, there are three different forms of pixel
- * format representation:
- * - Original format, as reported by the actual camera device. Values for
- * this format are declared in bionic/libc/kernel/common/linux/videodev2.h
- * - String representation as defined in CameraParameters::PIXEL_FORMAT_XXX
- * strings in frameworks/base/include/camera/CameraParameters.h
- * - HAL_PIXEL_FORMAT_XXX format, as defined in system/core/include/system/graphics.h
- * Since emulated camera device gets its data from the actual device, it gets
- * pixel format in the original form. And that's the pixel format
- * representation that will be returned from this method. HAL components will
- * need to translate value returned from this method to the appropriate form.
- * This method must be called only on started instance of this class, since
- * it's applicable only when camera device is ready to stream frames.
- * Param:
- * pix_fmt - Upon success contains the original pixel format.
- * Return:
- * Current framebuffer's pixel format. Note that value returned from this
- * method is valid only in case if camera device has been started.
- */
- inline uint32_t getOriginalPixelFormat() const
- {
- ALOGE_IF(!isStarted(), "%s: Device is not started", __FUNCTION__);
- return mPixelFormat;
- }
-
- /*
- * State checkers.
- */
-
- inline bool isInitialized() const {
- /* Instance is initialized when the worker thread has been successfuly
- * created (but not necessarily started). */
- return mWorkerThread.get() != NULL && mState != ECDS_CONSTRUCTED;
- }
- inline bool isConnected() const {
- /* Instance is connected when its status is either"connected", or
- * "started". */
- return mState == ECDS_CONNECTED || mState == ECDS_STARTED;
- }
- inline bool isStarted() const {
- return mState == ECDS_STARTED;
- }
-
- /****************************************************************************
- * Emulated camera device private API
- ***************************************************************************/
-protected:
- /* Performs common validation and calculation of startDevice parameters.
- * Param:
- * width, height, pix_fmt - Parameters passed to the startDevice method.
- * Return:
- * NO_ERROR on success, or an appropriate error status.
- */
- virtual status_t commonStartDevice(int width, int height, uint32_t pix_fmt);
-
- /* Performs common cleanup on stopDevice.
- * This method will undo what commonStartDevice had done.
- */
- virtual void commonStopDevice();
-
- /** Computes a luminance value after taking the exposure compensation.
- * value into account.
- *
- * Param:
- * inputY - The input luminance value.
- * Return:
- * The luminance value after adjusting the exposure compensation.
- */
- inline uint8_t changeExposure(const uint8_t& inputY) const {
- return static_cast<uint8_t>(clamp(static_cast<float>(inputY) *
- mExposureCompensation));
- }
-
- /** Computes the pixel value in YUV space after adjusting to the current
- * white balance mode.
- */
- void changeWhiteBalance(uint8_t& y, uint8_t& u, uint8_t& v) const;
-
- /****************************************************************************
- * Worker thread management.
- * Typicaly when emulated camera device starts capturing frames from the
- * actual device, it does that in a worker thread created in StartCapturing,
- * and terminated in StopCapturing. Since this is such a typical scenario,
- * it makes sence to encapsulate worker thread management in the base class
- * for all emulated camera devices.
- ***************************************************************************/
-
-protected:
- /* Starts the worker thread.
- * Typically, worker thread is started from startDeliveringFrames method of
- * this class.
- * Param:
- * one_burst - Controls how many times thread loop should run. If this
- * parameter is 'true', thread routine will run only once If this
- * parameter is 'false', thread routine will run until stopWorkerThread
- * method is called. See startDeliveringFrames for more info.
- * Return:
- * NO_ERROR on success, or an appropriate error status.
- */
- virtual status_t startWorkerThread(bool one_burst);
-
- /* Stops the worker thread.
- * Note that this method will always wait for the worker thread to terminate.
- * Typically, worker thread is started from stopDeliveringFrames method of
- * this class.
- * Return:
- * NO_ERROR on success, or an appropriate error status.
- */
- virtual status_t stopWorkerThread();
-
- /* Implementation of the worker thread routine.
- * In the default implementation of the worker thread routine we simply
- * return 'false' forcing the thread loop to exit, and the thread to
- * terminate. Derived class should override that method to provide there the
- * actual frame delivery.
- * Return:
- * true To continue thread loop (this method will be called again), or false
- * to exit the thread loop and to terminate the thread.
- */
- virtual bool inWorkerThread();
-
- /* Encapsulates a worker thread used by the emulated camera device.
- */
- friend class WorkerThread;
- class WorkerThread : public Thread {
-
- /****************************************************************************
- * Public API
- ***************************************************************************/
-
- public:
- inline explicit WorkerThread(EmulatedCameraDevice* camera_dev)
- : Thread(true), // Callbacks may involve Java calls.
- mCameraDevice(camera_dev),
- mThreadControl(-1),
- mControlFD(-1)
- {
- }
-
- inline ~WorkerThread()
- {
- ALOGW_IF(mThreadControl >= 0 || mControlFD >= 0,
- "%s: Control FDs are opened in the destructor",
- __FUNCTION__);
- if (mThreadControl >= 0) {
- close(mThreadControl);
- }
- if (mControlFD >= 0) {
- close(mControlFD);
- }
- }
-
- /* Starts the thread
- * Param:
- * one_burst - Controls how many times thread loop should run. If
- * this parameter is 'true', thread routine will run only once
- * If this parameter is 'false', thread routine will run until
- * stopThread method is called. See startWorkerThread for more
- * info.
- * Return:
- * NO_ERROR on success, or an appropriate error status.
- */
- inline status_t startThread(bool one_burst)
- {
- mOneBurst = one_burst;
- return run(NULL, ANDROID_PRIORITY_URGENT_DISPLAY, 0);
- }
-
- /* Overriden base class method.
- * It is overriden in order to provide one-time initialization just
- * prior to starting the thread routine.
- */
- status_t readyToRun();
-
- /* Stops the thread. */
- status_t stopThread();
-
- /* Values returned from the Select method of this class. */
- enum SelectRes {
- /* A timeout has occurred. */
- TIMEOUT,
- /* Data are available for read on the provided FD. */
- READY,
- /* Thread exit request has been received. */
- EXIT_THREAD,
- /* An error has occurred. */
- ERROR
- };
-
- /* Select on an FD event, keeping in mind thread exit message.
- * Param:
- * fd - File descriptor on which to wait for an event. This
- * parameter may be negative. If it is negative this method will
- * only wait on a control message to the thread.
- * timeout - Timeout in microseconds. 0 indicates no timeout (wait
- * forever).
- * Return:
- * See SelectRes enum comments.
- */
- SelectRes Select(int fd, int timeout);
-
- /****************************************************************************
- * Private API
- ***************************************************************************/
-
- private:
- /* Implements abstract method of the base Thread class. */
- bool threadLoop()
- {
- /* Simply dispatch the call to the containing camera device. */
- if (mCameraDevice->inWorkerThread()) {
- /* Respect "one burst" parameter (see startThread). */
- return !mOneBurst;
- } else {
- return false;
- }
- }
-
- /* Containing camera device object. */
- EmulatedCameraDevice* mCameraDevice;
-
- /* FD that is used to send control messages into the thread. */
- int mThreadControl;
-
- /* FD that thread uses to receive control messages. */
- int mControlFD;
-
- /* Controls number of times the thread loop runs.
- * See startThread for more information. */
- bool mOneBurst;
-
- /* Enumerates control messages that can be sent into the thread. */
- enum ControlMessage {
- /* Stop the thread. */
- THREAD_STOP
- };
- };
-
- /* Worker thread accessor. */
- inline WorkerThread* getWorkerThread() const
- {
- return mWorkerThread.get();
- }
-
- /****************************************************************************
- * Data members
- ***************************************************************************/
-
-protected:
- /* Locks this instance for parameters, state, etc. change. */
- Mutex mObjectLock;
-
- /* Worker thread that is used in frame capturing. */
- sp<WorkerThread> mWorkerThread;
-
- /* Timestamp of the current frame. */
- nsecs_t mCurFrameTimestamp;
-
- /* Emulated camera object containing this instance. */
- EmulatedCamera* mCameraHAL;
-
- /* Framebuffer containing the current frame. */
- uint8_t* mCurrentFrame;
-
- /*
- * Framebuffer properties.
- */
-
- /* Byte size of the framebuffer. */
- size_t mFrameBufferSize;
-
- /* Original pixel format (one of the V4L2_PIX_FMT_XXX values, as defined in
- * bionic/libc/kernel/common/linux/videodev2.h */
- uint32_t mPixelFormat;
-
- /* Frame width */
- int mFrameWidth;
-
- /* Frame height */
- int mFrameHeight;
-
- /* Total number of pixels */
- int mTotalPixels;
-
- /* Exposure compensation value */
- float mExposureCompensation;
-
- float* mWhiteBalanceScale;
-
- DefaultKeyedVector<String8, float*> mSupportedWhiteBalanceScale;
-
- /* Defines possible states of the emulated camera device object.
- */
- enum EmulatedCameraDeviceState {
- /* Object has been constructed. */
- ECDS_CONSTRUCTED,
- /* Object has been initialized. */
- ECDS_INITIALIZED,
- /* Object has been connected to the physical device. */
- ECDS_CONNECTED,
- /* Camera device has been started. */
- ECDS_STARTED,
- };
-
- /* Object state. */
- EmulatedCameraDeviceState mState;
-};
-
-}; /* namespace android */
-
-#endif /* HW_EMULATOR_CAMERA_EMULATED_CAMERA_DEVICE_H */
diff --git a/tools/emulator/system/camera/EmulatedCameraFactory.cpp b/tools/emulator/system/camera/EmulatedCameraFactory.cpp
deleted file mode 100755
index 84248caa6..000000000
--- a/tools/emulator/system/camera/EmulatedCameraFactory.cpp
+++ /dev/null
@@ -1,449 +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.
- */
-
-/*
- * Contains implementation of a class EmulatedCameraFactory that manages cameras
- * available for emulation.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "EmulatedCamera_Factory"
-#include <cutils/log.h>
-#include <cutils/properties.h>
-#include "EmulatedQemuCamera.h"
-#include "EmulatedFakeCamera.h"
-#include "EmulatedFakeCamera2.h"
-#include "EmulatedCameraFactory.h"
-
-extern camera_module_t HAL_MODULE_INFO_SYM;
-
-/* A global instance of EmulatedCameraFactory is statically instantiated and
- * initialized when camera emulation HAL is loaded.
- */
-android::EmulatedCameraFactory gEmulatedCameraFactory;
-
-namespace android {
-
-EmulatedCameraFactory::EmulatedCameraFactory()
- : mQemuClient(),
- mEmulatedCameras(NULL),
- mEmulatedCameraNum(0),
- mFakeCameraNum(0),
- mConstructedOK(false)
-{
- status_t res;
- /* Connect to the factory service in the emulator, and create Qemu cameras. */
- if (mQemuClient.connectClient(NULL) == NO_ERROR) {
- /* Connection has succeeded. Create emulated cameras for each camera
- * device, reported by the service. */
- createQemuCameras();
- }
-
- if (isBackFakeCameraEmulationOn()) {
- /* Camera ID. */
- const int camera_id = mEmulatedCameraNum;
- /* Use fake camera to emulate back-facing camera. */
- mEmulatedCameraNum++;
-
- /* Make sure that array is allocated (in case there were no 'qemu'
- * cameras created. Note that we preallocate the array so it may contain
- * two fake cameras: one facing back, and another facing front. */
- if (mEmulatedCameras == NULL) {
- mEmulatedCameras = new EmulatedBaseCamera*[mEmulatedCameraNum + 1];
- if (mEmulatedCameras == NULL) {
- ALOGE("%s: Unable to allocate emulated camera array for %d entries",
- __FUNCTION__, mEmulatedCameraNum);
- return;
- }
- memset(mEmulatedCameras, 0,
- (mEmulatedCameraNum + 1) * sizeof(EmulatedBaseCamera*));
- }
-
- /* Create, and initialize the fake camera */
- switch (getBackCameraHalVersion()) {
- case 1:
- mEmulatedCameras[camera_id] =
- new EmulatedFakeCamera(camera_id, true,
- &HAL_MODULE_INFO_SYM.common);
- break;
- case 2:
- mEmulatedCameras[camera_id] =
- new EmulatedFakeCamera2(camera_id, true,
- &HAL_MODULE_INFO_SYM.common);
- break;
- default:
- ALOGE("%s: Unknown back camera hal version requested: %d", __FUNCTION__,
- getBackCameraHalVersion());
- }
- if (mEmulatedCameras[camera_id] != NULL) {
- ALOGV("%s: Back camera device version is %d", __FUNCTION__,
- getBackCameraHalVersion());
- res = mEmulatedCameras[camera_id]->Initialize();
- if (res != NO_ERROR) {
- ALOGE("%s: Unable to intialize back camera %d: %s (%d)",
- __FUNCTION__, camera_id, strerror(-res), res);
- delete mEmulatedCameras[camera_id];
- mEmulatedCameraNum--;
- }
- } else {
- mEmulatedCameraNum--;
- ALOGE("%s: Unable to instantiate fake camera class", __FUNCTION__);
- }
- }
-
- if (isFrontFakeCameraEmulationOn()) {
- /* Camera ID. */
- const int camera_id = mEmulatedCameraNum;
- /* Use fake camera to emulate front-facing camera. */
- mEmulatedCameraNum++;
-
- /* Make sure that array is allocated (in case there were no 'qemu'
- * cameras created. */
- if (mEmulatedCameras == NULL) {
- mEmulatedCameras = new EmulatedBaseCamera*[mEmulatedCameraNum];
- if (mEmulatedCameras == NULL) {
- ALOGE("%s: Unable to allocate emulated camera array for %d entries",
- __FUNCTION__, mEmulatedCameraNum);
- return;
- }
- memset(mEmulatedCameras, 0,
- mEmulatedCameraNum * sizeof(EmulatedBaseCamera*));
- }
-
- /* Create, and initialize the fake camera */
- switch (getFrontCameraHalVersion()) {
- case 1:
- mEmulatedCameras[camera_id] =
- new EmulatedFakeCamera(camera_id, false,
- &HAL_MODULE_INFO_SYM.common);
- break;
- case 2:
- mEmulatedCameras[camera_id] =
- new EmulatedFakeCamera2(camera_id, false,
- &HAL_MODULE_INFO_SYM.common);
- break;
- default:
- ALOGE("%s: Unknown front camera hal version requested: %d",
- __FUNCTION__,
- getFrontCameraHalVersion());
- }
- if (mEmulatedCameras[camera_id] != NULL) {
- ALOGV("%s: Front camera device version is %d", __FUNCTION__,
- getFrontCameraHalVersion());
- res = mEmulatedCameras[camera_id]->Initialize();
- if (res != NO_ERROR) {
- ALOGE("%s: Unable to intialize front camera %d: %s (%d)",
- __FUNCTION__, camera_id, strerror(-res), res);
- delete mEmulatedCameras[camera_id];
- mEmulatedCameraNum--;
- }
- } else {
- mEmulatedCameraNum--;
- ALOGE("%s: Unable to instantiate fake camera class", __FUNCTION__);
- }
- }
-
- ALOGV("%d cameras are being emulated. %d of them are fake cameras.",
- mEmulatedCameraNum, mFakeCameraNum);
-
- mConstructedOK = true;
-}
-
-EmulatedCameraFactory::~EmulatedCameraFactory()
-{
- if (mEmulatedCameras != NULL) {
- for (int n = 0; n < mEmulatedCameraNum; n++) {
- if (mEmulatedCameras[n] != NULL) {
- delete mEmulatedCameras[n];
- }
- }
- delete[] mEmulatedCameras;
- }
-}
-
-/****************************************************************************
- * Camera HAL API handlers.
- *
- * Each handler simply verifies existence of an appropriate EmulatedBaseCamera
- * instance, and dispatches the call to that instance.
- *
- ***************************************************************************/
-
-int EmulatedCameraFactory::cameraDeviceOpen(int camera_id, hw_device_t** device)
-{
- ALOGV("%s: id = %d", __FUNCTION__, camera_id);
-
- *device = NULL;
-
- if (!isConstructedOK()) {
- ALOGE("%s: EmulatedCameraFactory has failed to initialize", __FUNCTION__);
- return -EINVAL;
- }
-
- if (camera_id < 0 || camera_id >= getEmulatedCameraNum()) {
- ALOGE("%s: Camera id %d is out of bounds (%d)",
- __FUNCTION__, camera_id, getEmulatedCameraNum());
- return -EINVAL;
- }
-
- return mEmulatedCameras[camera_id]->connectCamera(device);
-}
-
-int EmulatedCameraFactory::getCameraInfo(int camera_id, struct camera_info* info)
-{
- ALOGV("%s: id = %d", __FUNCTION__, camera_id);
-
- if (!isConstructedOK()) {
- ALOGE("%s: EmulatedCameraFactory has failed to initialize", __FUNCTION__);
- return -EINVAL;
- }
-
- if (camera_id < 0 || camera_id >= getEmulatedCameraNum()) {
- ALOGE("%s: Camera id %d is out of bounds (%d)",
- __FUNCTION__, camera_id, getEmulatedCameraNum());
- return -EINVAL;
- }
-
- return mEmulatedCameras[camera_id]->getCameraInfo(info);
-}
-
-/****************************************************************************
- * Camera HAL API callbacks.
- ***************************************************************************/
-
-int EmulatedCameraFactory::device_open(const hw_module_t* module,
- const char* name,
- hw_device_t** device)
-{
- /*
- * Simply verify the parameters, and dispatch the call inside the
- * EmulatedCameraFactory instance.
- */
-
- if (module != &HAL_MODULE_INFO_SYM.common) {
- ALOGE("%s: Invalid module %p expected %p",
- __FUNCTION__, module, &HAL_MODULE_INFO_SYM.common);
- return -EINVAL;
- }
- if (name == NULL) {
- ALOGE("%s: NULL name is not expected here", __FUNCTION__);
- return -EINVAL;
- }
-
- return gEmulatedCameraFactory.cameraDeviceOpen(atoi(name), device);
-}
-
-int EmulatedCameraFactory::get_number_of_cameras(void)
-{
- return gEmulatedCameraFactory.getEmulatedCameraNum();
-}
-
-int EmulatedCameraFactory::get_camera_info(int camera_id,
- struct camera_info* info)
-{
- return gEmulatedCameraFactory.getCameraInfo(camera_id, info);
-}
-
-/********************************************************************************
- * Internal API
- *******************************************************************************/
-
-/*
- * Camera information tokens passed in response to the "list" factory query.
- */
-
-/* Device name token. */
-static const char lListNameToken[] = "name=";
-/* Frame dimensions token. */
-static const char lListDimsToken[] = "framedims=";
-/* Facing direction token. */
-static const char lListDirToken[] = "dir=";
-
-void EmulatedCameraFactory::createQemuCameras()
-{
- /* Obtain camera list. */
- char* camera_list = NULL;
- status_t res = mQemuClient.listCameras(&camera_list);
- /* Empty list, or list containing just an EOL means that there were no
- * connected cameras found. */
- if (res != NO_ERROR || camera_list == NULL || *camera_list == '\0' ||
- *camera_list == '\n') {
- if (camera_list != NULL) {
- free(camera_list);
- }
- return;
- }
-
- /*
- * Calculate number of connected cameras. Number of EOLs in the camera list
- * is the number of the connected cameras.
- */
-
- int num = 0;
- const char* eol = strchr(camera_list, '\n');
- while (eol != NULL) {
- num++;
- eol = strchr(eol + 1, '\n');
- }
-
- /* Allocate the array for emulated camera instances. Note that we allocate
- * two more entries for back and front fake camera emulation. */
- mEmulatedCameras = new EmulatedBaseCamera*[num + 2];
- if (mEmulatedCameras == NULL) {
- ALOGE("%s: Unable to allocate emulated camera array for %d entries",
- __FUNCTION__, num + 1);
- free(camera_list);
- return;
- }
- memset(mEmulatedCameras, 0, sizeof(EmulatedBaseCamera*) * (num + 1));
-
- /*
- * Iterate the list, creating, and initializin emulated qemu cameras for each
- * entry (line) in the list.
- */
-
- int index = 0;
- char* cur_entry = camera_list;
- while (cur_entry != NULL && *cur_entry != '\0' && index < num) {
- /* Find the end of the current camera entry, and terminate it with zero
- * for simpler string manipulation. */
- char* next_entry = strchr(cur_entry, '\n');
- if (next_entry != NULL) {
- *next_entry = '\0';
- next_entry++; // Start of the next entry.
- }
-
- /* Find 'name', 'framedims', and 'dir' tokens that are required here. */
- char* name_start = strstr(cur_entry, lListNameToken);
- char* dim_start = strstr(cur_entry, lListDimsToken);
- char* dir_start = strstr(cur_entry, lListDirToken);
- if (name_start != NULL && dim_start != NULL && dir_start != NULL) {
- /* Advance to the token values. */
- name_start += strlen(lListNameToken);
- dim_start += strlen(lListDimsToken);
- dir_start += strlen(lListDirToken);
-
- /* Terminate token values with zero. */
- char* s = strchr(name_start, ' ');
- if (s != NULL) {
- *s = '\0';
- }
- s = strchr(dim_start, ' ');
- if (s != NULL) {
- *s = '\0';
- }
- s = strchr(dir_start, ' ');
- if (s != NULL) {
- *s = '\0';
- }
-
- /* Create and initialize qemu camera. */
- EmulatedQemuCamera* qemu_cam =
- new EmulatedQemuCamera(index, &HAL_MODULE_INFO_SYM.common);
- if (NULL != qemu_cam) {
- res = qemu_cam->Initialize(name_start, dim_start, dir_start);
- if (res == NO_ERROR) {
- mEmulatedCameras[index] = qemu_cam;
- index++;
- } else {
- delete qemu_cam;
- }
- } else {
- ALOGE("%s: Unable to instantiate EmulatedQemuCamera",
- __FUNCTION__);
- }
- } else {
- ALOGW("%s: Bad camera information: %s", __FUNCTION__, cur_entry);
- }
-
- cur_entry = next_entry;
- }
-
- mEmulatedCameraNum = index;
-}
-
-bool EmulatedCameraFactory::isBackFakeCameraEmulationOn()
-{
- /* Defined by 'qemu.sf.fake_camera' boot property: if property exist, and
- * is set to 'both', or 'back', then fake camera is used to emulate back
- * camera. */
- char prop[PROPERTY_VALUE_MAX];
- if ((property_get("qemu.sf.fake_camera", prop, NULL) > 0) &&
- (!strcmp(prop, "both") || !strcmp(prop, "back"))) {
- return true;
- } else {
- return false;
- }
-}
-
-int EmulatedCameraFactory::getBackCameraHalVersion()
-{
- /* Defined by 'qemu.sf.back_camera_hal_version' boot property: if the
- * property doesn't exist, it is assumed to be 1. */
- char prop[PROPERTY_VALUE_MAX];
- if (property_get("qemu.sf.back_camera_hal", prop, NULL) > 0) {
- char *prop_end = prop;
- int val = strtol(prop, &prop_end, 10);
- if (*prop_end == '\0') {
- return val;
- }
- // Badly formatted property, should just be a number
- ALOGE("qemu.sf.back_camera_hal is not a number: %s", prop);
- }
- return 1;
-}
-
-bool EmulatedCameraFactory::isFrontFakeCameraEmulationOn()
-{
- /* Defined by 'qemu.sf.fake_camera' boot property: if property exist, and
- * is set to 'both', or 'front', then fake camera is used to emulate front
- * camera. */
- char prop[PROPERTY_VALUE_MAX];
- if ((property_get("qemu.sf.fake_camera", prop, NULL) > 0) &&
- (!strcmp(prop, "both") || !strcmp(prop, "front"))) {
- return true;
- } else {
- return false;
- }
-}
-
-int EmulatedCameraFactory::getFrontCameraHalVersion()
-{
- /* Defined by 'qemu.sf.front_camera_hal_version' boot property: if the
- * property doesn't exist, it is assumed to be 1. */
- char prop[PROPERTY_VALUE_MAX];
- if (property_get("qemu.sf.front_camera_hal", prop, NULL) > 0) {
- char *prop_end = prop;
- int val = strtol(prop, &prop_end, 10);
- if (*prop_end == '\0') {
- return val;
- }
- // Badly formatted property, should just be a number
- ALOGE("qemu.sf.front_camera_hal is not a number: %s", prop);
- }
- return 1;
-}
-
-/********************************************************************************
- * Initializer for the static member structure.
- *******************************************************************************/
-
-/* Entry point for camera HAL API. */
-struct hw_module_methods_t EmulatedCameraFactory::mCameraModuleMethods = {
- open: EmulatedCameraFactory::device_open
-};
-
-}; /* namespace android */
diff --git a/tools/emulator/system/camera/EmulatedCameraFactory.h b/tools/emulator/system/camera/EmulatedCameraFactory.h
deleted file mode 100755
index 123e73550..000000000
--- a/tools/emulator/system/camera/EmulatedCameraFactory.h
+++ /dev/null
@@ -1,176 +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.
- */
-
-#ifndef HW_EMULATOR_CAMERA_EMULATED_CAMERA_FACTORY_H
-#define HW_EMULATOR_CAMERA_EMULATED_CAMERA_FACTORY_H
-
-#include "EmulatedBaseCamera.h"
-#include "QemuClient.h"
-
-namespace android {
-
-/*
- * Contains declaration of a class EmulatedCameraFactory that manages cameras
- * available for the emulation. A global instance of this class is statically
- * instantiated and initialized when camera emulation HAL is loaded.
- */
-
-/* Class EmulatedCameraFactoryManages cameras available for the emulation.
- *
- * When the global static instance of this class is created on the module load,
- * it enumerates cameras available for the emulation by connecting to the
- * emulator's 'camera' service. For every camera found out there it creates an
- * instance of an appropriate class, and stores it an in array of emulated
- * cameras. In addition to the cameras reported by the emulator, a fake camera
- * emulator is always created, so there is always at least one camera that is
- * available.
- *
- * Instance of this class is also used as the entry point for the camera HAL API,
- * including:
- * - hw_module_methods_t::open entry point
- * - camera_module_t::get_number_of_cameras entry point
- * - camera_module_t::get_camera_info entry point
- *
- */
-class EmulatedCameraFactory {
-public:
- /* Constructs EmulatedCameraFactory instance.
- * In this constructor the factory will create and initialize a list of
- * emulated cameras. All errors that occur on this constructor are reported
- * via mConstructedOK data member of this class.
- */
- EmulatedCameraFactory();
-
- /* Destructs EmulatedCameraFactory instance. */
- ~EmulatedCameraFactory();
-
- /****************************************************************************
- * Camera HAL API handlers.
- ***************************************************************************/
-
-public:
- /* Opens (connects to) a camera device.
- * This method is called in response to hw_module_methods_t::open callback.
- */
- int cameraDeviceOpen(int camera_id, hw_device_t** device);
-
- /* Gets emulated camera information.
- * This method is called in response to camera_module_t::get_camera_info callback.
- */
- int getCameraInfo(int camera_id, struct camera_info *info);
-
- /****************************************************************************
- * Camera HAL API callbacks.
- ***************************************************************************/
-
-public:
- /* camera_module_t::get_number_of_cameras callback entry point. */
- static int get_number_of_cameras(void);
-
- /* camera_module_t::get_camera_info callback entry point. */
- static int get_camera_info(int camera_id, struct camera_info *info);
-
-private:
- /* hw_module_methods_t::open callback entry point. */
- static int device_open(const hw_module_t* module,
- const char* name,
- hw_device_t** device);
-
- /****************************************************************************
- * Public API.
- ***************************************************************************/
-
-public:
-
- /* Gets fake camera orientation. */
- int getFakeCameraOrientation() {
- /* TODO: Have a boot property that controls that. */
- return 90;
- }
-
- /* Gets qemu camera orientation. */
- int getQemuCameraOrientation() {
- /* TODO: Have a boot property that controls that. */
- return 270;
- }
-
- /* Gets number of emulated cameras.
- */
- int getEmulatedCameraNum() const {
- return mEmulatedCameraNum;
- }
-
- /* Checks whether or not the constructor has succeeded.
- */
- bool isConstructedOK() const {
- return mConstructedOK;
- }
-
- /****************************************************************************
- * Private API
- ***************************************************************************/
-
-private:
- /* Populates emulated cameras array with cameras that are available via
- * 'camera' service in the emulator. For each such camera and instance of
- * the EmulatedCameraQemud will be created and added to the mEmulatedCameras
- * array.
- */
- void createQemuCameras();
-
- /* Checks if fake camera emulation is on for the camera facing back. */
- bool isBackFakeCameraEmulationOn();
-
- /* Gets camera device version number to use for back camera emulation */
- int getBackCameraHalVersion();
-
- /* Checks if fake camera emulation is on for the camera facing front. */
- bool isFrontFakeCameraEmulationOn();
-
- /* Gets camera device version number to use for front camera emulation */
- int getFrontCameraHalVersion();
-
- /****************************************************************************
- * Data members.
- ***************************************************************************/
-
-private:
- /* Connection to the camera service in the emulator. */
- FactoryQemuClient mQemuClient;
-
- /* Array of cameras available for the emulation. */
- EmulatedBaseCamera** mEmulatedCameras;
-
- /* Number of emulated cameras (including the fake ones). */
- int mEmulatedCameraNum;
-
- /* Number of emulated fake cameras. */
- int mFakeCameraNum;
-
- /* Flags whether or not constructor has succeeded. */
- bool mConstructedOK;
-
-public:
- /* Contains device open entry point, as required by HAL API. */
- static struct hw_module_methods_t mCameraModuleMethods;
-};
-
-}; /* namespace android */
-
-/* References the global EmulatedCameraFactory instance. */
-extern android::EmulatedCameraFactory gEmulatedCameraFactory;
-
-#endif /* HW_EMULATOR_CAMERA_EMULATED_CAMERA_FACTORY_H */
diff --git a/tools/emulator/system/camera/EmulatedCameraHal.cpp b/tools/emulator/system/camera/EmulatedCameraHal.cpp
deleted file mode 100755
index aa0cb0093..000000000
--- a/tools/emulator/system/camera/EmulatedCameraHal.cpp
+++ /dev/null
@@ -1,45 +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.
- */
-
-/*
- * Contains implementation of the camera HAL layer in the system running
- * under the emulator.
- *
- * This file contains only required HAL header, which directs all the API calls
- * to the EmulatedCameraFactory class implementation, wich is responsible for
- * managing emulated cameras.
- */
-
-#include "EmulatedCameraFactory.h"
-
-/*
- * Required HAL header.
- */
-camera_module_t HAL_MODULE_INFO_SYM = {
- common: {
- tag: HARDWARE_MODULE_TAG,
- module_api_version: CAMERA_MODULE_API_VERSION_2_0,
- hal_api_version: HARDWARE_HAL_API_VERSION,
- id: CAMERA_HARDWARE_MODULE_ID,
- name: "Emulated Camera Module",
- author: "The Android Open Source Project",
- methods: &android::EmulatedCameraFactory::mCameraModuleMethods,
- dso: NULL,
- reserved: {0},
- },
- get_number_of_cameras: android::EmulatedCameraFactory::get_number_of_cameras,
- get_camera_info: android::EmulatedCameraFactory::get_camera_info,
-};
diff --git a/tools/emulator/system/camera/EmulatedFakeCamera.cpp b/tools/emulator/system/camera/EmulatedFakeCamera.cpp
deleted file mode 100755
index 457850d2e..000000000
--- a/tools/emulator/system/camera/EmulatedFakeCamera.cpp
+++ /dev/null
@@ -1,90 +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.
- */
-
-/*
- * Contains implementation of a class EmulatedFakeCamera that encapsulates
- * functionality of a fake camera.
- */
-
-#define LOG_NDEBUG 0
-#define LOG_TAG "EmulatedCamera_FakeCamera"
-#include <cutils/log.h>
-#include <cutils/properties.h>
-#include "EmulatedFakeCamera.h"
-#include "EmulatedCameraFactory.h"
-
-namespace android {
-
-EmulatedFakeCamera::EmulatedFakeCamera(int cameraId,
- bool facingBack,
- struct hw_module_t* module)
- : EmulatedCamera(cameraId, module),
- mFacingBack(facingBack),
- mFakeCameraDevice(this)
-{
-}
-
-EmulatedFakeCamera::~EmulatedFakeCamera()
-{
-}
-
-/****************************************************************************
- * Public API overrides
- ***************************************************************************/
-
-status_t EmulatedFakeCamera::Initialize()
-{
- status_t res = mFakeCameraDevice.Initialize();
- if (res != NO_ERROR) {
- return res;
- }
-
- const char* facing = mFacingBack ? EmulatedCamera::FACING_BACK :
- EmulatedCamera::FACING_FRONT;
-
- mParameters.set(EmulatedCamera::FACING_KEY, facing);
- ALOGD("%s: Fake camera is facing %s", __FUNCTION__, facing);
-
- mParameters.set(EmulatedCamera::ORIENTATION_KEY,
- gEmulatedCameraFactory.getFakeCameraOrientation());
-
- res = EmulatedCamera::Initialize();
- if (res != NO_ERROR) {
- return res;
- }
-
- /*
- * Parameters provided by the camera device.
- */
-
- /* 352x288 and 320x240 frame dimensions are required by the framework for
- * video mode preview and video recording. */
- mParameters.set(CameraParameters::KEY_SUPPORTED_PICTURE_SIZES,
- "640x480,352x288,320x240");
- mParameters.set(CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES,
- "640x480,352x288,320x240");
- mParameters.setPreviewSize(640, 480);
- mParameters.setPictureSize(640, 480);
-
- return NO_ERROR;
-}
-
-EmulatedCameraDevice* EmulatedFakeCamera::getCameraDevice()
-{
- return &mFakeCameraDevice;
-}
-
-}; /* namespace android */
diff --git a/tools/emulator/system/camera/EmulatedFakeCamera.h b/tools/emulator/system/camera/EmulatedFakeCamera.h
deleted file mode 100755
index 4bfbd7047..000000000
--- a/tools/emulator/system/camera/EmulatedFakeCamera.h
+++ /dev/null
@@ -1,74 +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.
- */
-
-#ifndef HW_EMULATOR_CAMERA_EMULATED_FAKE_CAMERA_H
-#define HW_EMULATOR_CAMERA_EMULATED_FAKE_CAMERA_H
-
-/*
- * Contains declaration of a class EmulatedFakeCamera that encapsulates
- * functionality of a fake camera. This class is nothing more than a placeholder
- * for EmulatedFakeCameraDevice instance.
- */
-
-#include "EmulatedCamera.h"
-#include "EmulatedFakeCameraDevice.h"
-
-namespace android {
-
-/* Encapsulates functionality of a fake camera.
- * This class is nothing more than a placeholder for EmulatedFakeCameraDevice
- * instance that emulates a fake camera device.
- */
-class EmulatedFakeCamera : public EmulatedCamera {
-public:
- /* Constructs EmulatedFakeCamera instance. */
- EmulatedFakeCamera(int cameraId, bool facingBack, struct hw_module_t* module);
-
- /* Destructs EmulatedFakeCamera instance. */
- ~EmulatedFakeCamera();
-
- /****************************************************************************
- * EmulatedCamera virtual overrides.
- ***************************************************************************/
-
-public:
- /* Initializes EmulatedFakeCamera instance. */
- status_t Initialize();
-
- /****************************************************************************
- * EmulatedCamera abstract API implementation.
- ***************************************************************************/
-
-protected:
- /* Gets emulated camera device ised by this instance of the emulated camera.
- */
- EmulatedCameraDevice* getCameraDevice();
-
- /****************************************************************************
- * Data memebers.
- ***************************************************************************/
-
-protected:
- /* Facing back (true) or front (false) switch. */
- bool mFacingBack;
-
- /* Contained fake camera device object. */
- EmulatedFakeCameraDevice mFakeCameraDevice;
-};
-
-}; /* namespace android */
-
-#endif /* HW_EMULATOR_CAMERA_EMULATED_FAKE_CAMERA_H */
diff --git a/tools/emulator/system/camera/EmulatedFakeCamera2.cpp b/tools/emulator/system/camera/EmulatedFakeCamera2.cpp
deleted file mode 100644
index 4e4ee548d..000000000
--- a/tools/emulator/system/camera/EmulatedFakeCamera2.cpp
+++ /dev/null
@@ -1,2705 +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.
- */
-
-/*
- * Contains implementation of a class EmulatedFakeCamera2 that encapsulates
- * functionality of an advanced fake camera.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "EmulatedCamera_FakeCamera2"
-#include <utils/Log.h>
-
-#include "EmulatedFakeCamera2.h"
-#include "EmulatedCameraFactory.h"
-#include <ui/Rect.h>
-#include <ui/GraphicBufferMapper.h>
-#include "gralloc_cb.h"
-
-namespace android {
-
-const int64_t USEC = 1000LL;
-const int64_t MSEC = USEC * 1000LL;
-const int64_t SEC = MSEC * 1000LL;
-
-const uint32_t EmulatedFakeCamera2::kAvailableFormats[4] = {
- HAL_PIXEL_FORMAT_RAW_SENSOR,
- HAL_PIXEL_FORMAT_BLOB,
- HAL_PIXEL_FORMAT_RGBA_8888,
- // HAL_PIXEL_FORMAT_YV12,
- HAL_PIXEL_FORMAT_YCrCb_420_SP
-};
-
-const uint32_t EmulatedFakeCamera2::kAvailableRawSizes[2] = {
- 640, 480
- // Sensor::kResolution[0], Sensor::kResolution[1]
-};
-
-const uint64_t EmulatedFakeCamera2::kAvailableRawMinDurations[1] = {
- Sensor::kFrameDurationRange[0]
-};
-
-const uint32_t EmulatedFakeCamera2::kAvailableProcessedSizesBack[4] = {
- 640, 480, 320, 240
- // Sensor::kResolution[0], Sensor::kResolution[1]
-};
-
-const uint32_t EmulatedFakeCamera2::kAvailableProcessedSizesFront[4] = {
- 320, 240, 160, 120
- // Sensor::kResolution[0], Sensor::kResolution[1]
-};
-
-const uint64_t EmulatedFakeCamera2::kAvailableProcessedMinDurations[1] = {
- Sensor::kFrameDurationRange[0]
-};
-
-const uint32_t EmulatedFakeCamera2::kAvailableJpegSizesBack[2] = {
- 640, 480
- // Sensor::kResolution[0], Sensor::kResolution[1]
-};
-
-const uint32_t EmulatedFakeCamera2::kAvailableJpegSizesFront[2] = {
- 320, 240
- // Sensor::kResolution[0], Sensor::kResolution[1]
-};
-
-
-const uint64_t EmulatedFakeCamera2::kAvailableJpegMinDurations[1] = {
- Sensor::kFrameDurationRange[0]
-};
-
-
-EmulatedFakeCamera2::EmulatedFakeCamera2(int cameraId,
- bool facingBack,
- struct hw_module_t* module)
- : EmulatedCamera2(cameraId,module),
- mFacingBack(facingBack)
-{
- ALOGD("Constructing emulated fake camera 2 facing %s",
- facingBack ? "back" : "front");
-}
-
-EmulatedFakeCamera2::~EmulatedFakeCamera2() {
- if (mCameraInfo != NULL) {
- free_camera_metadata(mCameraInfo);
- }
-}
-
-/****************************************************************************
- * Public API overrides
- ***************************************************************************/
-
-status_t EmulatedFakeCamera2::Initialize() {
- status_t res;
-
- set_camera_metadata_vendor_tag_ops(
- static_cast<vendor_tag_query_ops_t*>(&mVendorTagOps));
-
- res = constructStaticInfo(&mCameraInfo, true);
- if (res != OK) {
- ALOGE("%s: Unable to allocate static info: %s (%d)",
- __FUNCTION__, strerror(-res), res);
- return res;
- }
- res = constructStaticInfo(&mCameraInfo, false);
- if (res != OK) {
- ALOGE("%s: Unable to fill in static info: %s (%d)",
- __FUNCTION__, strerror(-res), res);
- return res;
- }
- if (res != OK) return res;
-
- mNextStreamId = 1;
- mNextReprocessStreamId = 1;
- mRawStreamCount = 0;
- mProcessedStreamCount = 0;
- mJpegStreamCount = 0;
- mReprocessStreamCount = 0;
-
- return NO_ERROR;
-}
-
-/****************************************************************************
- * Camera module API overrides
- ***************************************************************************/
-
-status_t EmulatedFakeCamera2::connectCamera(hw_device_t** device) {
- status_t res;
- ALOGV("%s", __FUNCTION__);
-
- mConfigureThread = new ConfigureThread(this);
- mReadoutThread = new ReadoutThread(this);
- mControlThread = new ControlThread(this);
- mSensor = new Sensor(this);
- mJpegCompressor = new JpegCompressor(this);
-
- mNextStreamId = 1;
- mNextReprocessStreamId = 1;
-
- res = mSensor->startUp();
- if (res != NO_ERROR) return res;
-
- res = mConfigureThread->run("EmulatedFakeCamera2::configureThread");
- if (res != NO_ERROR) return res;
-
- res = mReadoutThread->run("EmulatedFakeCamera2::readoutThread");
- if (res != NO_ERROR) return res;
-
- res = mControlThread->run("EmulatedFakeCamera2::controlThread");
- if (res != NO_ERROR) return res;
-
- return EmulatedCamera2::connectCamera(device);
-}
-
-status_t EmulatedFakeCamera2::closeCamera() {
- Mutex::Autolock l(mMutex);
-
- status_t res;
- ALOGV("%s", __FUNCTION__);
-
- res = mSensor->shutDown();
- if (res != NO_ERROR) {
- ALOGE("%s: Unable to shut down sensor: %d", __FUNCTION__, res);
- return res;
- }
-
- mConfigureThread->requestExit();
- mReadoutThread->requestExit();
- mControlThread->requestExit();
- mJpegCompressor->cancel();
-
- mConfigureThread->join();
- mReadoutThread->join();
- mControlThread->join();
-
- ALOGV("%s exit", __FUNCTION__);
- return NO_ERROR;
-}
-
-status_t EmulatedFakeCamera2::getCameraInfo(struct camera_info *info) {
- info->facing = mFacingBack ? CAMERA_FACING_BACK : CAMERA_FACING_FRONT;
- info->orientation = gEmulatedCameraFactory.getFakeCameraOrientation();
- return EmulatedCamera2::getCameraInfo(info);
-}
-
-/****************************************************************************
- * Camera device API overrides
- ***************************************************************************/
-
-/** Request input queue */
-
-int EmulatedFakeCamera2::requestQueueNotify() {
- ALOGV("Request queue notification received");
-
- ALOG_ASSERT(mRequestQueueSrc != NULL,
- "%s: Request queue src not set, but received queue notification!",
- __FUNCTION__);
- ALOG_ASSERT(mFrameQueueDst != NULL,
- "%s: Request queue src not set, but received queue notification!",
- __FUNCTION__);
- ALOG_ASSERT(mStreams.size() != 0,
- "%s: No streams allocated, but received queue notification!",
- __FUNCTION__);
- return mConfigureThread->newRequestAvailable();
-}
-
-int EmulatedFakeCamera2::getInProgressCount() {
- Mutex::Autolock l(mMutex);
-
- int requestCount = 0;
- requestCount += mConfigureThread->getInProgressCount();
- requestCount += mReadoutThread->getInProgressCount();
- requestCount += mJpegCompressor->isBusy() ? 1 : 0;
-
- return requestCount;
-}
-
-int EmulatedFakeCamera2::constructDefaultRequest(
- int request_template,
- camera_metadata_t **request) {
-
- if (request == NULL) return BAD_VALUE;
- if (request_template < 0 || request_template >= CAMERA2_TEMPLATE_COUNT) {
- return BAD_VALUE;
- }
- status_t res;
- // Pass 1, calculate size and allocate
- res = constructDefaultRequest(request_template,
- request,
- true);
- if (res != OK) {
- return res;
- }
- // Pass 2, build request
- res = constructDefaultRequest(request_template,
- request,
- false);
- if (res != OK) {
- ALOGE("Unable to populate new request for template %d",
- request_template);
- }
-
- return res;
-}
-
-int EmulatedFakeCamera2::allocateStream(
- uint32_t width,
- uint32_t height,
- int format,
- const camera2_stream_ops_t *stream_ops,
- uint32_t *stream_id,
- uint32_t *format_actual,
- uint32_t *usage,
- uint32_t *max_buffers) {
- Mutex::Autolock l(mMutex);
-
- // Temporary shim until FORMAT_ZSL is removed
- if (format == CAMERA2_HAL_PIXEL_FORMAT_ZSL) {
- format = HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED;
- }
-
- if (format != HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) {
- unsigned int numFormats = sizeof(kAvailableFormats) / sizeof(uint32_t);
- unsigned int formatIdx = 0;
- unsigned int sizeOffsetIdx = 0;
- for (; formatIdx < numFormats; formatIdx++) {
- if (format == (int)kAvailableFormats[formatIdx]) break;
- }
- if (formatIdx == numFormats) {
- ALOGE("%s: Format 0x%x is not supported", __FUNCTION__, format);
- return BAD_VALUE;
- }
- }
-
- const uint32_t *availableSizes;
- size_t availableSizeCount;
- switch (format) {
- case HAL_PIXEL_FORMAT_RAW_SENSOR:
- availableSizes = kAvailableRawSizes;
- availableSizeCount = sizeof(kAvailableRawSizes)/sizeof(uint32_t);
- break;
- case HAL_PIXEL_FORMAT_BLOB:
- availableSizes = mFacingBack ?
- kAvailableJpegSizesBack : kAvailableJpegSizesFront;
- availableSizeCount = mFacingBack ?
- sizeof(kAvailableJpegSizesBack)/sizeof(uint32_t) :
- sizeof(kAvailableJpegSizesFront)/sizeof(uint32_t);
- break;
- case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
- case HAL_PIXEL_FORMAT_RGBA_8888:
- case HAL_PIXEL_FORMAT_YV12:
- case HAL_PIXEL_FORMAT_YCrCb_420_SP:
- availableSizes = mFacingBack ?
- kAvailableProcessedSizesBack : kAvailableProcessedSizesFront;
- availableSizeCount = mFacingBack ?
- sizeof(kAvailableProcessedSizesBack)/sizeof(uint32_t) :
- sizeof(kAvailableProcessedSizesFront)/sizeof(uint32_t);
- break;
- default:
- ALOGE("%s: Unknown format 0x%x", __FUNCTION__, format);
- return BAD_VALUE;
- }
-
- unsigned int resIdx = 0;
- for (; resIdx < availableSizeCount; resIdx++) {
- if (availableSizes[resIdx * 2] == width &&
- availableSizes[resIdx * 2 + 1] == height) break;
- }
- if (resIdx == availableSizeCount) {
- ALOGE("%s: Format 0x%x does not support resolution %d, %d", __FUNCTION__,
- format, width, height);
- return BAD_VALUE;
- }
-
- switch (format) {
- case HAL_PIXEL_FORMAT_RAW_SENSOR:
- if (mRawStreamCount >= kMaxRawStreamCount) {
- ALOGE("%s: Cannot allocate another raw stream (%d already allocated)",
- __FUNCTION__, mRawStreamCount);
- return INVALID_OPERATION;
- }
- mRawStreamCount++;
- break;
- case HAL_PIXEL_FORMAT_BLOB:
- if (mJpegStreamCount >= kMaxJpegStreamCount) {
- ALOGE("%s: Cannot allocate another JPEG stream (%d already allocated)",
- __FUNCTION__, mJpegStreamCount);
- return INVALID_OPERATION;
- }
- mJpegStreamCount++;
- break;
- default:
- if (mProcessedStreamCount >= kMaxProcessedStreamCount) {
- ALOGE("%s: Cannot allocate another processed stream (%d already allocated)",
- __FUNCTION__, mProcessedStreamCount);
- return INVALID_OPERATION;
- }
- mProcessedStreamCount++;
- }
-
- Stream newStream;
- newStream.ops = stream_ops;
- newStream.width = width;
- newStream.height = height;
- newStream.format = format;
- // TODO: Query stride from gralloc
- newStream.stride = width;
-
- mStreams.add(mNextStreamId, newStream);
-
- *stream_id = mNextStreamId;
- if (format_actual) *format_actual = format;
- *usage = GRALLOC_USAGE_HW_CAMERA_WRITE;
- *max_buffers = kMaxBufferCount;
-
- ALOGV("Stream allocated: %d, %d x %d, 0x%x. U: %x, B: %d",
- *stream_id, width, height, format, *usage, *max_buffers);
-
- mNextStreamId++;
- return NO_ERROR;
-}
-
-int EmulatedFakeCamera2::registerStreamBuffers(
- uint32_t stream_id,
- int num_buffers,
- buffer_handle_t *buffers) {
- Mutex::Autolock l(mMutex);
-
- ALOGV("%s: Stream %d registering %d buffers", __FUNCTION__,
- stream_id, num_buffers);
- // Need to find out what the final concrete pixel format for our stream is
- // Assumes that all buffers have the same format.
- if (num_buffers < 1) {
- ALOGE("%s: Stream %d only has %d buffers!",
- __FUNCTION__, stream_id, num_buffers);
- return BAD_VALUE;
- }
- const cb_handle_t *streamBuffer =
- reinterpret_cast<const cb_handle_t*>(buffers[0]);
-
- int finalFormat = streamBuffer->format;
-
- if (finalFormat == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) {
- ALOGE("%s: Stream %d: Bad final pixel format "
- "HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED; "
- "concrete pixel format required!", __FUNCTION__, stream_id);
- return BAD_VALUE;
- }
-
- ssize_t streamIndex = mStreams.indexOfKey(stream_id);
- if (streamIndex < 0) {
- ALOGE("%s: Unknown stream id %d!", __FUNCTION__, stream_id);
- return BAD_VALUE;
- }
-
- Stream &stream = mStreams.editValueAt(streamIndex);
-
- ALOGV("%s: Stream %d format set to %x, previously %x",
- __FUNCTION__, stream_id, finalFormat, stream.format);
-
- stream.format = finalFormat;
-
- return NO_ERROR;
-}
-
-int EmulatedFakeCamera2::releaseStream(uint32_t stream_id) {
- Mutex::Autolock l(mMutex);
-
- ssize_t streamIndex = mStreams.indexOfKey(stream_id);
- if (streamIndex < 0) {
- ALOGE("%s: Unknown stream id %d!", __FUNCTION__, stream_id);
- return BAD_VALUE;
- }
-
- if (isStreamInUse(stream_id)) {
- ALOGE("%s: Cannot release stream %d; in use!", __FUNCTION__,
- stream_id);
- return BAD_VALUE;
- }
-
- switch(mStreams.valueAt(streamIndex).format) {
- case HAL_PIXEL_FORMAT_RAW_SENSOR:
- mRawStreamCount--;
- break;
- case HAL_PIXEL_FORMAT_BLOB:
- mJpegStreamCount--;
- break;
- default:
- mProcessedStreamCount--;
- break;
- }
-
- mStreams.removeItemsAt(streamIndex);
-
- return NO_ERROR;
-}
-
-int EmulatedFakeCamera2::allocateReprocessStreamFromStream(
- uint32_t output_stream_id,
- const camera2_stream_in_ops_t *stream_ops,
- uint32_t *stream_id) {
- Mutex::Autolock l(mMutex);
-
- ssize_t baseStreamIndex = mStreams.indexOfKey(output_stream_id);
- if (baseStreamIndex < 0) {
- ALOGE("%s: Unknown output stream id %d!", __FUNCTION__, output_stream_id);
- return BAD_VALUE;
- }
-
- const Stream &baseStream = mStreams[baseStreamIndex];
-
- // We'll reprocess anything we produced
-
- if (mReprocessStreamCount >= kMaxReprocessStreamCount) {
- ALOGE("%s: Cannot allocate another reprocess stream (%d already allocated)",
- __FUNCTION__, mReprocessStreamCount);
- return INVALID_OPERATION;
- }
- mReprocessStreamCount++;
-
- ReprocessStream newStream;
- newStream.ops = stream_ops;
- newStream.width = baseStream.width;
- newStream.height = baseStream.height;
- newStream.format = baseStream.format;
- newStream.stride = baseStream.stride;
- newStream.sourceStreamId = output_stream_id;
-
- *stream_id = mNextReprocessStreamId;
- mReprocessStreams.add(mNextReprocessStreamId, newStream);
-
- ALOGV("Reprocess stream allocated: %d: %d, %d, 0x%x. Parent stream: %d",
- *stream_id, newStream.width, newStream.height, newStream.format,
- output_stream_id);
-
- mNextReprocessStreamId++;
- return NO_ERROR;
-}
-
-int EmulatedFakeCamera2::releaseReprocessStream(uint32_t stream_id) {
- Mutex::Autolock l(mMutex);
-
- ssize_t streamIndex = mReprocessStreams.indexOfKey(stream_id);
- if (streamIndex < 0) {
- ALOGE("%s: Unknown reprocess stream id %d!", __FUNCTION__, stream_id);
- return BAD_VALUE;
- }
-
- if (isReprocessStreamInUse(stream_id)) {
- ALOGE("%s: Cannot release reprocessing stream %d; in use!", __FUNCTION__,
- stream_id);
- return BAD_VALUE;
- }
-
- mReprocessStreamCount--;
- mReprocessStreams.removeItemsAt(streamIndex);
-
- return NO_ERROR;
-}
-
-int EmulatedFakeCamera2::triggerAction(uint32_t trigger_id,
- int32_t ext1,
- int32_t ext2) {
- Mutex::Autolock l(mMutex);
- return mControlThread->triggerAction(trigger_id,
- ext1, ext2);
-}
-
-/** Custom tag definitions */
-
-// Emulator camera metadata sections
-enum {
- EMULATOR_SCENE = VENDOR_SECTION,
- END_EMULATOR_SECTIONS
-};
-
-enum {
- EMULATOR_SCENE_START = EMULATOR_SCENE << 16,
-};
-
-// Emulator camera metadata tags
-enum {
- // Hour of day to use for lighting calculations (0-23). Default: 12
- EMULATOR_SCENE_HOUROFDAY = EMULATOR_SCENE_START,
- EMULATOR_SCENE_END
-};
-
-unsigned int emulator_metadata_section_bounds[END_EMULATOR_SECTIONS -
- VENDOR_SECTION][2] = {
- { EMULATOR_SCENE_START, EMULATOR_SCENE_END }
-};
-
-const char *emulator_metadata_section_names[END_EMULATOR_SECTIONS -
- VENDOR_SECTION] = {
- "com.android.emulator.scene"
-};
-
-typedef struct emulator_tag_info {
- const char *tag_name;
- uint8_t tag_type;
-} emulator_tag_info_t;
-
-emulator_tag_info_t emulator_scene[EMULATOR_SCENE_END - EMULATOR_SCENE_START] = {
- { "hourOfDay", TYPE_INT32 }
-};
-
-emulator_tag_info_t *tag_info[END_EMULATOR_SECTIONS -
- VENDOR_SECTION] = {
- emulator_scene
-};
-
-const char* EmulatedFakeCamera2::getVendorSectionName(uint32_t tag) {
- ALOGV("%s", __FUNCTION__);
- uint32_t section = tag >> 16;
- if (section < VENDOR_SECTION || section > END_EMULATOR_SECTIONS) return NULL;
- return emulator_metadata_section_names[section - VENDOR_SECTION];
-}
-
-const char* EmulatedFakeCamera2::getVendorTagName(uint32_t tag) {
- ALOGV("%s", __FUNCTION__);
- uint32_t section = tag >> 16;
- if (section < VENDOR_SECTION || section > END_EMULATOR_SECTIONS) return NULL;
- uint32_t section_index = section - VENDOR_SECTION;
- if (tag >= emulator_metadata_section_bounds[section_index][1]) {
- return NULL;
- }
- uint32_t tag_index = tag & 0xFFFF;
- return tag_info[section_index][tag_index].tag_name;
-}
-
-int EmulatedFakeCamera2::getVendorTagType(uint32_t tag) {
- ALOGV("%s", __FUNCTION__);
- uint32_t section = tag >> 16;
- if (section < VENDOR_SECTION || section > END_EMULATOR_SECTIONS) return -1;
- uint32_t section_index = section - VENDOR_SECTION;
- if (tag >= emulator_metadata_section_bounds[section_index][1]) {
- return -1;
- }
- uint32_t tag_index = tag & 0xFFFF;
- return tag_info[section_index][tag_index].tag_type;
-}
-
-/** Shutdown and debug methods */
-
-int EmulatedFakeCamera2::dump(int fd) {
- String8 result;
-
- result.appendFormat(" Camera HAL device: EmulatedFakeCamera2\n");
- result.appendFormat(" Streams:\n");
- for (size_t i = 0; i < mStreams.size(); i++) {
- int id = mStreams.keyAt(i);
- const Stream& s = mStreams.valueAt(i);
- result.appendFormat(
- " Stream %d: %d x %d, format 0x%x, stride %d\n",
- id, s.width, s.height, s.format, s.stride);
- }
-
- write(fd, result.string(), result.size());
-
- return NO_ERROR;
-}
-
-void EmulatedFakeCamera2::signalError() {
- // TODO: Let parent know so we can shut down cleanly
- ALOGE("Worker thread is signaling a serious error");
-}
-
-/** Pipeline control worker thread methods */
-
-EmulatedFakeCamera2::ConfigureThread::ConfigureThread(EmulatedFakeCamera2 *parent):
- Thread(false),
- mParent(parent),
- mRequestCount(0),
- mNextBuffers(NULL) {
- mRunning = false;
-}
-
-EmulatedFakeCamera2::ConfigureThread::~ConfigureThread() {
-}
-
-status_t EmulatedFakeCamera2::ConfigureThread::readyToRun() {
- Mutex::Autolock lock(mInputMutex);
-
- ALOGV("Starting up ConfigureThread");
- mRequest = NULL;
- mActive = false;
- mRunning = true;
-
- mInputSignal.signal();
- return NO_ERROR;
-}
-
-status_t EmulatedFakeCamera2::ConfigureThread::waitUntilRunning() {
- Mutex::Autolock lock(mInputMutex);
- if (!mRunning) {
- ALOGV("Waiting for configure thread to start");
- mInputSignal.wait(mInputMutex);
- }
- return OK;
-}
-
-status_t EmulatedFakeCamera2::ConfigureThread::newRequestAvailable() {
- waitUntilRunning();
-
- Mutex::Autolock lock(mInputMutex);
-
- mActive = true;
- mInputSignal.signal();
-
- return OK;
-}
-
-bool EmulatedFakeCamera2::ConfigureThread::isStreamInUse(uint32_t id) {
- Mutex::Autolock lock(mInternalsMutex);
-
- if (mNextBuffers == NULL) return false;
- for (size_t i=0; i < mNextBuffers->size(); i++) {
- if ((*mNextBuffers)[i].streamId == (int)id) return true;
- }
- return false;
-}
-
-int EmulatedFakeCamera2::ConfigureThread::getInProgressCount() {
- Mutex::Autolock lock(mInputMutex);
- return mRequestCount;
-}
-
-bool EmulatedFakeCamera2::ConfigureThread::threadLoop() {
- status_t res;
-
- // Check if we're currently processing or just waiting
- {
- Mutex::Autolock lock(mInputMutex);
- if (!mActive) {
- // Inactive, keep waiting until we've been signaled
- status_t res;
- res = mInputSignal.waitRelative(mInputMutex, kWaitPerLoop);
- if (res != NO_ERROR && res != TIMED_OUT) {
- ALOGE("%s: Error waiting for input requests: %d",
- __FUNCTION__, res);
- return false;
- }
- if (!mActive) return true;
- ALOGV("New request available");
- }
- // Active
- }
- if (mRequest == NULL) {
- Mutex::Autolock il(mInternalsMutex);
-
- ALOGV("Configure: Getting next request");
- res = mParent->mRequestQueueSrc->dequeue_request(
- mParent->mRequestQueueSrc,
- &mRequest);
- if (res != NO_ERROR) {
- ALOGE("%s: Error dequeuing next request: %d", __FUNCTION__, res);
- mParent->signalError();
- return false;
- }
- if (mRequest == NULL) {
- ALOGV("Configure: Request queue empty, going inactive");
- // No requests available, go into inactive mode
- Mutex::Autolock lock(mInputMutex);
- mActive = false;
- return true;
- } else {
- Mutex::Autolock lock(mInputMutex);
- mRequestCount++;
- }
-
- camera_metadata_entry_t type;
- res = find_camera_metadata_entry(mRequest,
- ANDROID_REQUEST_TYPE,
- &type);
- if (res != NO_ERROR) {
- ALOGE("%s: error reading request type", __FUNCTION__);
- mParent->signalError();
- return false;
- }
- bool success = false;;
- switch (type.data.u8[0]) {
- case ANDROID_REQUEST_TYPE_CAPTURE:
- success = setupCapture();
- break;
- case ANDROID_REQUEST_TYPE_REPROCESS:
- success = setupReprocess();
- break;
- default:
- ALOGE("%s: Unexpected request type %d",
- __FUNCTION__, type.data.u8[0]);
- mParent->signalError();
- break;
- }
- if (!success) return false;
-
- }
-
- if (mWaitingForReadout) {
- bool readoutDone;
- readoutDone = mParent->mReadoutThread->waitForReady(kWaitPerLoop);
- if (!readoutDone) return true;
-
- if (mNextNeedsJpeg) {
- ALOGV("Configure: Waiting for JPEG compressor");
- } else {
- ALOGV("Configure: Waiting for sensor");
- }
- mWaitingForReadout = false;
- }
-
- if (mNextNeedsJpeg) {
- bool jpegDone;
- jpegDone = mParent->mJpegCompressor->waitForDone(kWaitPerLoop);
- if (!jpegDone) return true;
-
- ALOGV("Configure: Waiting for sensor");
- mNextNeedsJpeg = false;
- }
-
- if (mNextIsCapture) {
- return configureNextCapture();
- } else {
- return configureNextReprocess();
- }
-}
-
-bool EmulatedFakeCamera2::ConfigureThread::setupCapture() {
- status_t res;
-
- mNextIsCapture = true;
- // Get necessary parameters for sensor config
- mParent->mControlThread->processRequest(mRequest);
-
- camera_metadata_entry_t streams;
- res = find_camera_metadata_entry(mRequest,
- ANDROID_REQUEST_OUTPUT_STREAMS,
- &streams);
- if (res != NO_ERROR) {
- ALOGE("%s: error reading output stream tag", __FUNCTION__);
- mParent->signalError();
- return false;
- }
-
- mNextBuffers = new Buffers;
- mNextNeedsJpeg = false;
- ALOGV("Configure: Setting up buffers for capture");
- for (size_t i = 0; i < streams.count; i++) {
- int streamId = streams.data.u8[i];
- const Stream &s = mParent->getStreamInfo(streamId);
- if (s.format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) {
- ALOGE("%s: Stream %d does not have a concrete pixel format, but "
- "is included in a request!", __FUNCTION__, streamId);
- mParent->signalError();
- return false;
- }
- StreamBuffer b;
- b.streamId = streams.data.u8[i];
- b.width = s.width;
- b.height = s.height;
- b.format = s.format;
- b.stride = s.stride;
- mNextBuffers->push_back(b);
- ALOGV("Configure: Buffer %d: Stream %d, %d x %d, format 0x%x, "
- "stride %d",
- i, b.streamId, b.width, b.height, b.format, b.stride);
- if (b.format == HAL_PIXEL_FORMAT_BLOB) {
- mNextNeedsJpeg = true;
- }
- }
-
- camera_metadata_entry_t e;
- res = find_camera_metadata_entry(mRequest,
- ANDROID_REQUEST_FRAME_COUNT,
- &e);
- if (res != NO_ERROR) {
- ALOGE("%s: error reading frame count tag: %s (%d)",
- __FUNCTION__, strerror(-res), res);
- mParent->signalError();
- return false;
- }
- mNextFrameNumber = *e.data.i32;
-
- res = find_camera_metadata_entry(mRequest,
- ANDROID_SENSOR_EXPOSURE_TIME,
- &e);
- if (res != NO_ERROR) {
- ALOGE("%s: error reading exposure time tag: %s (%d)",
- __FUNCTION__, strerror(-res), res);
- mParent->signalError();
- return false;
- }
- mNextExposureTime = *e.data.i64;
-
- res = find_camera_metadata_entry(mRequest,
- ANDROID_SENSOR_FRAME_DURATION,
- &e);
- if (res != NO_ERROR) {
- ALOGE("%s: error reading frame duration tag", __FUNCTION__);
- mParent->signalError();
- return false;
- }
- mNextFrameDuration = *e.data.i64;
-
- if (mNextFrameDuration <
- mNextExposureTime + Sensor::kMinVerticalBlank) {
- mNextFrameDuration = mNextExposureTime + Sensor::kMinVerticalBlank;
- }
- res = find_camera_metadata_entry(mRequest,
- ANDROID_SENSOR_SENSITIVITY,
- &e);
- if (res != NO_ERROR) {
- ALOGE("%s: error reading sensitivity tag", __FUNCTION__);
- mParent->signalError();
- return false;
- }
- mNextSensitivity = *e.data.i32;
-
- res = find_camera_metadata_entry(mRequest,
- EMULATOR_SCENE_HOUROFDAY,
- &e);
- if (res == NO_ERROR) {
- ALOGV("Setting hour: %d", *e.data.i32);
- mParent->mSensor->getScene().setHour(*e.data.i32);
- }
-
- // Start waiting on readout thread
- mWaitingForReadout = true;
- ALOGV("Configure: Waiting for readout thread");
-
- return true;
-}
-
-bool EmulatedFakeCamera2::ConfigureThread::configureNextCapture() {
- bool vsync = mParent->mSensor->waitForVSync(kWaitPerLoop);
- if (!vsync) return true;
-
- Mutex::Autolock il(mInternalsMutex);
- ALOGV("Configure: Configuring sensor for capture %d", mNextFrameNumber);
- mParent->mSensor->setExposureTime(mNextExposureTime);
- mParent->mSensor->setFrameDuration(mNextFrameDuration);
- mParent->mSensor->setSensitivity(mNextSensitivity);
-
- getBuffers();
-
- ALOGV("Configure: Done configure for capture %d", mNextFrameNumber);
- mParent->mReadoutThread->setNextOperation(true, mRequest, mNextBuffers);
- mParent->mSensor->setDestinationBuffers(mNextBuffers);
-
- mRequest = NULL;
- mNextBuffers = NULL;
-
- Mutex::Autolock lock(mInputMutex);
- mRequestCount--;
-
- return true;
-}
-
-bool EmulatedFakeCamera2::ConfigureThread::setupReprocess() {
- status_t res;
-
- mNextNeedsJpeg = true;
- mNextIsCapture = false;
-
- camera_metadata_entry_t reprocessStreams;
- res = find_camera_metadata_entry(mRequest,
- ANDROID_REQUEST_INPUT_STREAMS,
- &reprocessStreams);
- if (res != NO_ERROR) {
- ALOGE("%s: error reading output stream tag", __FUNCTION__);
- mParent->signalError();
- return false;
- }
-
- mNextBuffers = new Buffers;
-
- ALOGV("Configure: Setting up input buffers for reprocess");
- for (size_t i = 0; i < reprocessStreams.count; i++) {
- int streamId = reprocessStreams.data.u8[i];
- const ReprocessStream &s = mParent->getReprocessStreamInfo(streamId);
- if (s.format != HAL_PIXEL_FORMAT_RGB_888) {
- ALOGE("%s: Only ZSL reprocessing supported!",
- __FUNCTION__);
- mParent->signalError();
- return false;
- }
- StreamBuffer b;
- b.streamId = -streamId;
- b.width = s.width;
- b.height = s.height;
- b.format = s.format;
- b.stride = s.stride;
- mNextBuffers->push_back(b);
- }
-
- camera_metadata_entry_t streams;
- res = find_camera_metadata_entry(mRequest,
- ANDROID_REQUEST_OUTPUT_STREAMS,
- &streams);
- if (res != NO_ERROR) {
- ALOGE("%s: error reading output stream tag", __FUNCTION__);
- mParent->signalError();
- return false;
- }
-
- ALOGV("Configure: Setting up output buffers for reprocess");
- for (size_t i = 0; i < streams.count; i++) {
- int streamId = streams.data.u8[i];
- const Stream &s = mParent->getStreamInfo(streamId);
- if (s.format != HAL_PIXEL_FORMAT_BLOB) {
- // TODO: Support reprocess to YUV
- ALOGE("%s: Non-JPEG output stream %d for reprocess not supported",
- __FUNCTION__, streamId);
- mParent->signalError();
- return false;
- }
- StreamBuffer b;
- b.streamId = streams.data.u8[i];
- b.width = s.width;
- b.height = s.height;
- b.format = s.format;
- b.stride = s.stride;
- mNextBuffers->push_back(b);
- ALOGV("Configure: Buffer %d: Stream %d, %d x %d, format 0x%x, "
- "stride %d",
- i, b.streamId, b.width, b.height, b.format, b.stride);
- }
-
- camera_metadata_entry_t e;
- res = find_camera_metadata_entry(mRequest,
- ANDROID_REQUEST_FRAME_COUNT,
- &e);
- if (res != NO_ERROR) {
- ALOGE("%s: error reading frame count tag: %s (%d)",
- __FUNCTION__, strerror(-res), res);
- mParent->signalError();
- return false;
- }
- mNextFrameNumber = *e.data.i32;
-
- return true;
-}
-
-bool EmulatedFakeCamera2::ConfigureThread::configureNextReprocess() {
- Mutex::Autolock il(mInternalsMutex);
-
- getBuffers();
-
- ALOGV("Configure: Done configure for reprocess %d", mNextFrameNumber);
- mParent->mReadoutThread->setNextOperation(false, mRequest, mNextBuffers);
-
- mRequest = NULL;
- mNextBuffers = NULL;
-
- Mutex::Autolock lock(mInputMutex);
- mRequestCount--;
-
- return true;
-}
-
-bool EmulatedFakeCamera2::ConfigureThread::getBuffers() {
- status_t res;
- /** Get buffers to fill for this frame */
- for (size_t i = 0; i < mNextBuffers->size(); i++) {
- StreamBuffer &b = mNextBuffers->editItemAt(i);
-
- if (b.streamId > 0) {
- Stream s = mParent->getStreamInfo(b.streamId);
- ALOGV("Configure: Dequeing buffer from stream %d", b.streamId);
- res = s.ops->dequeue_buffer(s.ops, &(b.buffer) );
- if (res != NO_ERROR || b.buffer == NULL) {
- ALOGE("%s: Unable to dequeue buffer from stream %d: %s (%d)",
- __FUNCTION__, b.streamId, strerror(-res), res);
- mParent->signalError();
- return false;
- }
-
- /* Lock the buffer from the perspective of the graphics mapper */
- const Rect rect(s.width, s.height);
-
- res = GraphicBufferMapper::get().lock(*(b.buffer),
- GRALLOC_USAGE_HW_CAMERA_WRITE,
- rect, (void**)&(b.img) );
-
- if (res != NO_ERROR) {
- ALOGE("%s: grbuffer_mapper.lock failure: %s (%d)",
- __FUNCTION__, strerror(-res), res);
- s.ops->cancel_buffer(s.ops,
- b.buffer);
- mParent->signalError();
- return false;
- }
- } else {
- ReprocessStream s = mParent->getReprocessStreamInfo(-b.streamId);
- ALOGV("Configure: Acquiring buffer from reprocess stream %d",
- -b.streamId);
- res = s.ops->acquire_buffer(s.ops, &(b.buffer) );
- if (res != NO_ERROR || b.buffer == NULL) {
- ALOGE("%s: Unable to acquire buffer from reprocess stream %d: "
- "%s (%d)", __FUNCTION__, -b.streamId,
- strerror(-res), res);
- mParent->signalError();
- return false;
- }
-
- /* Lock the buffer from the perspective of the graphics mapper */
- const Rect rect(s.width, s.height);
-
- res = GraphicBufferMapper::get().lock(*(b.buffer),
- GRALLOC_USAGE_HW_CAMERA_READ,
- rect, (void**)&(b.img) );
- if (res != NO_ERROR) {
- ALOGE("%s: grbuffer_mapper.lock failure: %s (%d)",
- __FUNCTION__, strerror(-res), res);
- s.ops->release_buffer(s.ops,
- b.buffer);
- mParent->signalError();
- return false;
- }
- }
- }
- return true;
-}
-
-EmulatedFakeCamera2::ReadoutThread::ReadoutThread(EmulatedFakeCamera2 *parent):
- Thread(false),
- mParent(parent),
- mRunning(false),
- mActive(false),
- mRequestCount(0),
- mRequest(NULL),
- mBuffers(NULL) {
- mInFlightQueue = new InFlightQueue[kInFlightQueueSize];
- mInFlightHead = 0;
- mInFlightTail = 0;
-}
-
-EmulatedFakeCamera2::ReadoutThread::~ReadoutThread() {
- delete mInFlightQueue;
-}
-
-status_t EmulatedFakeCamera2::ReadoutThread::readyToRun() {
- Mutex::Autolock lock(mInputMutex);
- ALOGV("Starting up ReadoutThread");
- mRunning = true;
- mInputSignal.signal();
- return NO_ERROR;
-}
-
-status_t EmulatedFakeCamera2::ReadoutThread::waitUntilRunning() {
- Mutex::Autolock lock(mInputMutex);
- if (!mRunning) {
- ALOGV("Waiting for readout thread to start");
- mInputSignal.wait(mInputMutex);
- }
- return OK;
-}
-
-bool EmulatedFakeCamera2::ReadoutThread::waitForReady(nsecs_t timeout) {
- status_t res;
- Mutex::Autolock lock(mInputMutex);
- while (!readyForNextCapture()) {
- res = mReadySignal.waitRelative(mInputMutex, timeout);
- if (res == TIMED_OUT) return false;
- if (res != OK) {
- ALOGE("%s: Error waiting for ready: %s (%d)", __FUNCTION__,
- strerror(-res), res);
- return false;
- }
- }
- return true;
-}
-
-bool EmulatedFakeCamera2::ReadoutThread::readyForNextCapture() {
- return (mInFlightTail + 1) % kInFlightQueueSize != mInFlightHead;
-}
-
-void EmulatedFakeCamera2::ReadoutThread::setNextOperation(
- bool isCapture,
- camera_metadata_t *request,
- Buffers *buffers) {
- Mutex::Autolock lock(mInputMutex);
- if ( !readyForNextCapture() ) {
- ALOGE("In flight queue full, dropping captures");
- mParent->signalError();
- return;
- }
- mInFlightQueue[mInFlightTail].isCapture = isCapture;
- mInFlightQueue[mInFlightTail].request = request;
- mInFlightQueue[mInFlightTail].buffers = buffers;
- mInFlightTail = (mInFlightTail + 1) % kInFlightQueueSize;
- mRequestCount++;
-
- if (!mActive) {
- mActive = true;
- mInputSignal.signal();
- }
-}
-
-bool EmulatedFakeCamera2::ReadoutThread::isStreamInUse(uint32_t id) {
- Mutex::Autolock lock(mInputMutex);
-
- size_t i = mInFlightHead;
- while (i != mInFlightTail) {
- for (size_t j = 0; j < mInFlightQueue[i].buffers->size(); j++) {
- if ( (*(mInFlightQueue[i].buffers))[j].streamId == (int)id )
- return true;
- }
- i = (i + 1) % kInFlightQueueSize;
- }
-
- Mutex::Autolock iLock(mInternalsMutex);
-
- if (mBuffers != NULL) {
- for (i = 0; i < mBuffers->size(); i++) {
- if ( (*mBuffers)[i].streamId == (int)id) return true;
- }
- }
-
- return false;
-}
-
-int EmulatedFakeCamera2::ReadoutThread::getInProgressCount() {
- Mutex::Autolock lock(mInputMutex);
-
- return mRequestCount;
-}
-
-bool EmulatedFakeCamera2::ReadoutThread::threadLoop() {
- static const nsecs_t kWaitPerLoop = 10000000L; // 10 ms
- status_t res;
- int32_t frameNumber;
-
- // Check if we're currently processing or just waiting
- {
- Mutex::Autolock lock(mInputMutex);
- if (!mActive) {
- // Inactive, keep waiting until we've been signaled
- res = mInputSignal.waitRelative(mInputMutex, kWaitPerLoop);
- if (res != NO_ERROR && res != TIMED_OUT) {
- ALOGE("%s: Error waiting for capture requests: %d",
- __FUNCTION__, res);
- mParent->signalError();
- return false;
- }
- if (!mActive) return true;
- }
- // Active, see if we need a new request
- if (mRequest == NULL) {
- if (mInFlightHead == mInFlightTail) {
- // Go inactive
- ALOGV("Waiting for sensor data");
- mActive = false;
- return true;
- } else {
- Mutex::Autolock iLock(mInternalsMutex);
- mReadySignal.signal();
- mIsCapture = mInFlightQueue[mInFlightHead].isCapture;
- mRequest = mInFlightQueue[mInFlightHead].request;
- mBuffers = mInFlightQueue[mInFlightHead].buffers;
- mInFlightQueue[mInFlightHead].request = NULL;
- mInFlightQueue[mInFlightHead].buffers = NULL;
- mInFlightHead = (mInFlightHead + 1) % kInFlightQueueSize;
- ALOGV("Ready to read out request %p, %d buffers",
- mRequest, mBuffers->size());
- }
- }
- }
-
- // Active with request, wait on sensor to complete
-
- nsecs_t captureTime;
-
- if (mIsCapture) {
- bool gotFrame;
- gotFrame = mParent->mSensor->waitForNewFrame(kWaitPerLoop,
- &captureTime);
-
- if (!gotFrame) return true;
- }
-
- Mutex::Autolock iLock(mInternalsMutex);
-
- camera_metadata_entry_t entry;
- if (!mIsCapture) {
- res = find_camera_metadata_entry(mRequest,
- ANDROID_SENSOR_TIMESTAMP,
- &entry);
- if (res != NO_ERROR) {
- ALOGE("%s: error reading reprocessing timestamp: %s (%d)",
- __FUNCTION__, strerror(-res), res);
- mParent->signalError();
- return false;
- }
- captureTime = entry.data.i64[0];
- }
-
- res = find_camera_metadata_entry(mRequest,
- ANDROID_REQUEST_FRAME_COUNT,
- &entry);
- if (res != NO_ERROR) {
- ALOGE("%s: error reading frame count tag: %s (%d)",
- __FUNCTION__, strerror(-res), res);
- mParent->signalError();
- return false;
- }
- frameNumber = *entry.data.i32;
-
- res = find_camera_metadata_entry(mRequest,
- ANDROID_REQUEST_METADATA_MODE,
- &entry);
- if (res != NO_ERROR) {
- ALOGE("%s: error reading metadata mode tag: %s (%d)",
- __FUNCTION__, strerror(-res), res);
- mParent->signalError();
- return false;
- }
-
- // Got sensor data and request, construct frame and send it out
- ALOGV("Readout: Constructing metadata and frames for request %d",
- frameNumber);
-
- if (*entry.data.u8 == ANDROID_REQUEST_METADATA_FULL) {
- ALOGV("Readout: Metadata requested, constructing");
-
- camera_metadata_t *frame = NULL;
-
- size_t frame_entries = get_camera_metadata_entry_count(mRequest);
- size_t frame_data = get_camera_metadata_data_count(mRequest);
-
- // TODO: Dynamically calculate based on enabled statistics, etc
- frame_entries += 10;
- frame_data += 100;
-
- res = mParent->mFrameQueueDst->dequeue_frame(mParent->mFrameQueueDst,
- frame_entries, frame_data, &frame);
-
- if (res != NO_ERROR || frame == NULL) {
- ALOGE("%s: Unable to dequeue frame metadata buffer", __FUNCTION__);
- mParent->signalError();
- return false;
- }
-
- res = append_camera_metadata(frame, mRequest);
- if (res != NO_ERROR) {
- ALOGE("Unable to append request metadata");
- }
-
- if (mIsCapture) {
- add_camera_metadata_entry(frame,
- ANDROID_SENSOR_TIMESTAMP,
- &captureTime,
- 1);
-
- int32_t hourOfDay = (int32_t)mParent->mSensor->getScene().getHour();
- camera_metadata_entry_t requestedHour;
- res = find_camera_metadata_entry(frame,
- EMULATOR_SCENE_HOUROFDAY,
- &requestedHour);
- if (res == NAME_NOT_FOUND) {
- res = add_camera_metadata_entry(frame,
- EMULATOR_SCENE_HOUROFDAY,
- &hourOfDay, 1);
- if (res != NO_ERROR) {
- ALOGE("Unable to add vendor tag");
- }
- } else if (res == OK) {
- *requestedHour.data.i32 = hourOfDay;
- } else {
- ALOGE("%s: Error looking up vendor tag", __FUNCTION__);
- }
-
- collectStatisticsMetadata(frame);
- // TODO: Collect all final values used from sensor in addition to timestamp
- }
-
- ALOGV("Readout: Enqueue frame %d", frameNumber);
- mParent->mFrameQueueDst->enqueue_frame(mParent->mFrameQueueDst,
- frame);
- }
- ALOGV("Readout: Free request");
- res = mParent->mRequestQueueSrc->free_request(mParent->mRequestQueueSrc, mRequest);
- if (res != NO_ERROR) {
- ALOGE("%s: Unable to return request buffer to queue: %d",
- __FUNCTION__, res);
- mParent->signalError();
- return false;
- }
- mRequest = NULL;
-
- int compressedBufferIndex = -1;
- ALOGV("Readout: Processing %d buffers", mBuffers->size());
- for (size_t i = 0; i < mBuffers->size(); i++) {
- const StreamBuffer &b = (*mBuffers)[i];
- ALOGV("Readout: Buffer %d: Stream %d, %d x %d, format 0x%x, stride %d",
- i, b.streamId, b.width, b.height, b.format, b.stride);
- if (b.streamId > 0) {
- if (b.format == HAL_PIXEL_FORMAT_BLOB) {
- // Assumes only one BLOB buffer type per capture
- compressedBufferIndex = i;
- } else {
- ALOGV("Readout: Sending image buffer %d (%p) to output stream %d",
- i, (void*)*(b.buffer), b.streamId);
- GraphicBufferMapper::get().unlock(*(b.buffer));
- const Stream &s = mParent->getStreamInfo(b.streamId);
- res = s.ops->enqueue_buffer(s.ops, captureTime, b.buffer);
- if (res != OK) {
- ALOGE("Error enqueuing image buffer %p: %s (%d)", b.buffer,
- strerror(-res), res);
- mParent->signalError();
- }
- }
- }
- }
-
- if (compressedBufferIndex == -1) {
- delete mBuffers;
- mBuffers = NULL;
- } else {
- ALOGV("Readout: Starting JPEG compression for buffer %d, stream %d",
- compressedBufferIndex,
- (*mBuffers)[compressedBufferIndex].streamId);
- mParent->mJpegCompressor->start(mBuffers, captureTime);
- mBuffers = NULL;
- }
-
- Mutex::Autolock l(mInputMutex);
- mRequestCount--;
- ALOGV("Readout: Done with request %d", frameNumber);
- return true;
-}
-
-status_t EmulatedFakeCamera2::ReadoutThread::collectStatisticsMetadata(
- camera_metadata_t *frame) {
- // Completely fake face rectangles, don't correspond to real faces in scene
- ALOGV("Readout: Collecting statistics metadata");
-
- status_t res;
- camera_metadata_entry_t entry;
- res = find_camera_metadata_entry(frame,
- ANDROID_STATS_FACE_DETECT_MODE,
- &entry);
- if (res != OK) {
- ALOGE("%s: Unable to find face detect mode!", __FUNCTION__);
- return BAD_VALUE;
- }
-
- if (entry.data.u8[0] == ANDROID_STATS_FACE_DETECTION_OFF) return OK;
-
- // The coordinate system for the face regions is the raw sensor pixel
- // coordinates. Here, we map from the scene coordinates (0-19 in both axis)
- // to raw pixels, for the scene defined in fake-pipeline2/Scene.cpp. We
- // approximately place two faces on top of the windows of the house. No
- // actual faces exist there, but might one day. Note that this doesn't
- // account for the offsets used to account for aspect ratio differences, so
- // the rectangles don't line up quite right.
- const size_t numFaces = 2;
- int32_t rects[numFaces * 4] = {
- Sensor::kResolution[0] * 10 / 20,
- Sensor::kResolution[1] * 15 / 20,
- Sensor::kResolution[0] * 12 / 20,
- Sensor::kResolution[1] * 17 / 20,
-
- Sensor::kResolution[0] * 16 / 20,
- Sensor::kResolution[1] * 15 / 20,
- Sensor::kResolution[0] * 18 / 20,
- Sensor::kResolution[1] * 17 / 20
- };
- // To simulate some kind of real detection going on, we jitter the rectangles on
- // each frame by a few pixels in each dimension.
- for (size_t i = 0; i < numFaces * 4; i++) {
- rects[i] += (int32_t)(((float)rand() / RAND_MAX) * 6 - 3);
- }
- // The confidence scores (0-100) are similarly jittered.
- uint8_t scores[numFaces] = { 85, 95 };
- for (size_t i = 0; i < numFaces; i++) {
- scores[i] += (int32_t)(((float)rand() / RAND_MAX) * 10 - 5);
- }
-
- res = add_camera_metadata_entry(frame, ANDROID_STATS_FACE_RECTANGLES,
- rects, numFaces * 4);
- if (res != OK) {
- ALOGE("%s: Unable to add face rectangles!", __FUNCTION__);
- return BAD_VALUE;
- }
-
- res = add_camera_metadata_entry(frame, ANDROID_STATS_FACE_SCORES,
- scores, numFaces);
- if (res != OK) {
- ALOGE("%s: Unable to add face scores!", __FUNCTION__);
- return BAD_VALUE;
- }
-
- if (entry.data.u8[0] == ANDROID_STATS_FACE_DETECTION_SIMPLE) return OK;
-
- // Advanced face detection options - add eye/mouth coordinates. The
- // coordinates in order are (leftEyeX, leftEyeY, rightEyeX, rightEyeY,
- // mouthX, mouthY). The mapping is the same as the face rectangles.
- int32_t features[numFaces * 6] = {
- Sensor::kResolution[0] * 10.5 / 20,
- Sensor::kResolution[1] * 16 / 20,
- Sensor::kResolution[0] * 11.5 / 20,
- Sensor::kResolution[1] * 16 / 20,
- Sensor::kResolution[0] * 11 / 20,
- Sensor::kResolution[1] * 16.5 / 20,
-
- Sensor::kResolution[0] * 16.5 / 20,
- Sensor::kResolution[1] * 16 / 20,
- Sensor::kResolution[0] * 17.5 / 20,
- Sensor::kResolution[1] * 16 / 20,
- Sensor::kResolution[0] * 17 / 20,
- Sensor::kResolution[1] * 16.5 / 20,
- };
- // Jitter these a bit less than the rects
- for (size_t i = 0; i < numFaces * 6; i++) {
- features[i] += (int32_t)(((float)rand() / RAND_MAX) * 4 - 2);
- }
- // These are unique IDs that are used to identify each face while it's
- // visible to the detector (if a face went away and came back, it'd get a
- // new ID).
- int32_t ids[numFaces] = {
- 100, 200
- };
-
- res = add_camera_metadata_entry(frame, ANDROID_STATS_FACE_LANDMARKS,
- features, numFaces * 6);
- if (res != OK) {
- ALOGE("%s: Unable to add face landmarks!", __FUNCTION__);
- return BAD_VALUE;
- }
-
- res = add_camera_metadata_entry(frame, ANDROID_STATS_FACE_IDS,
- ids, numFaces);
- if (res != OK) {
- ALOGE("%s: Unable to add face scores!", __FUNCTION__);
- return BAD_VALUE;
- }
-
- return OK;
-}
-
-EmulatedFakeCamera2::ControlThread::ControlThread(EmulatedFakeCamera2 *parent):
- Thread(false),
- mParent(parent) {
- mRunning = false;
-}
-
-EmulatedFakeCamera2::ControlThread::~ControlThread() {
-}
-
-status_t EmulatedFakeCamera2::ControlThread::readyToRun() {
- Mutex::Autolock lock(mInputMutex);
-
- ALOGV("Starting up ControlThread");
- mRunning = true;
- mStartAf = false;
- mCancelAf = false;
- mStartPrecapture = false;
-
- mControlMode = ANDROID_CONTROL_AUTO;
-
- mEffectMode = ANDROID_CONTROL_EFFECT_OFF;
- mSceneMode = ANDROID_CONTROL_SCENE_MODE_FACE_PRIORITY;
-
- mAfMode = ANDROID_CONTROL_AF_AUTO;
- mAfModeChange = false;
-
- mAeMode = ANDROID_CONTROL_AE_ON;
- mAwbMode = ANDROID_CONTROL_AWB_AUTO;
-
- mAfTriggerId = 0;
- mPrecaptureTriggerId = 0;
-
- mAfState = ANDROID_CONTROL_AF_STATE_INACTIVE;
- mAeState = ANDROID_CONTROL_AE_STATE_INACTIVE;
- mAwbState = ANDROID_CONTROL_AWB_STATE_INACTIVE;
-
- mExposureTime = kNormalExposureTime;
-
- mInputSignal.signal();
- return NO_ERROR;
-}
-
-status_t EmulatedFakeCamera2::ControlThread::waitUntilRunning() {
- Mutex::Autolock lock(mInputMutex);
- if (!mRunning) {
- ALOGV("Waiting for control thread to start");
- mInputSignal.wait(mInputMutex);
- }
- return OK;
-}
-
-status_t EmulatedFakeCamera2::ControlThread::processRequest(camera_metadata_t *request) {
- Mutex::Autolock lock(mInputMutex);
- // TODO: Add handling for all android.control.* fields here
- camera_metadata_entry_t mode;
- status_t res;
-
- res = find_camera_metadata_entry(request,
- ANDROID_CONTROL_MODE,
- &mode);
- mControlMode = mode.data.u8[0];
-
- res = find_camera_metadata_entry(request,
- ANDROID_CONTROL_EFFECT_MODE,
- &mode);
- mEffectMode = mode.data.u8[0];
-
- res = find_camera_metadata_entry(request,
- ANDROID_CONTROL_SCENE_MODE,
- &mode);
- mSceneMode = mode.data.u8[0];
-
- res = find_camera_metadata_entry(request,
- ANDROID_CONTROL_AF_MODE,
- &mode);
- if (mAfMode != mode.data.u8[0]) {
- ALOGV("AF new mode: %d, old mode %d", mode.data.u8[0], mAfMode);
- mAfMode = mode.data.u8[0];
- mAfModeChange = true;
- mStartAf = false;
- mCancelAf = false;
- }
-
- res = find_camera_metadata_entry(request,
- ANDROID_CONTROL_AE_MODE,
- &mode);
- mAeMode = mode.data.u8[0];
-
- res = find_camera_metadata_entry(request,
- ANDROID_CONTROL_AE_LOCK,
- &mode);
- bool aeLock = (mode.data.u8[0] == ANDROID_CONTROL_AE_LOCK_ON);
- if (mAeLock && !aeLock) {
- mAeState = ANDROID_CONTROL_AE_STATE_INACTIVE;
- }
- mAeLock = aeLock;
-
- res = find_camera_metadata_entry(request,
- ANDROID_CONTROL_AWB_MODE,
- &mode);
- mAwbMode = mode.data.u8[0];
-
- // TODO: Override more control fields
-
- if (mAeMode != ANDROID_CONTROL_AE_OFF) {
- camera_metadata_entry_t exposureTime;
- res = find_camera_metadata_entry(request,
- ANDROID_SENSOR_EXPOSURE_TIME,
- &exposureTime);
- if (res == OK) {
- exposureTime.data.i64[0] = mExposureTime;
- }
- }
-
- return OK;
-}
-
-status_t EmulatedFakeCamera2::ControlThread::triggerAction(uint32_t msgType,
- int32_t ext1, int32_t ext2) {
- ALOGV("%s: Triggering %d (%d, %d)", __FUNCTION__, msgType, ext1, ext2);
- Mutex::Autolock lock(mInputMutex);
- switch (msgType) {
- case CAMERA2_TRIGGER_AUTOFOCUS:
- mAfTriggerId = ext1;
- mStartAf = true;
- mCancelAf = false;
- break;
- case CAMERA2_TRIGGER_CANCEL_AUTOFOCUS:
- mAfTriggerId = ext1;
- mStartAf = false;
- mCancelAf = true;
- break;
- case CAMERA2_TRIGGER_PRECAPTURE_METERING:
- mPrecaptureTriggerId = ext1;
- mStartPrecapture = true;
- break;
- default:
- ALOGE("%s: Unknown action triggered: %d (arguments %d %d)",
- __FUNCTION__, msgType, ext1, ext2);
- return BAD_VALUE;
- }
- return OK;
-}
-
-const nsecs_t EmulatedFakeCamera2::ControlThread::kControlCycleDelay = 100 * MSEC;
-const nsecs_t EmulatedFakeCamera2::ControlThread::kMinAfDuration = 500 * MSEC;
-const nsecs_t EmulatedFakeCamera2::ControlThread::kMaxAfDuration = 900 * MSEC;
-const float EmulatedFakeCamera2::ControlThread::kAfSuccessRate = 0.9;
- // Once every 5 seconds
-const float EmulatedFakeCamera2::ControlThread::kContinuousAfStartRate =
- kControlCycleDelay / 5.0 * SEC;
-const nsecs_t EmulatedFakeCamera2::ControlThread::kMinAeDuration = 500 * MSEC;
-const nsecs_t EmulatedFakeCamera2::ControlThread::kMaxAeDuration = 2 * SEC;
-const nsecs_t EmulatedFakeCamera2::ControlThread::kMinPrecaptureAeDuration = 100 * MSEC;
-const nsecs_t EmulatedFakeCamera2::ControlThread::kMaxPrecaptureAeDuration = 400 * MSEC;
- // Once every 3 seconds
-const float EmulatedFakeCamera2::ControlThread::kAeScanStartRate =
- kControlCycleDelay / 3000000000.0;
-
-const nsecs_t EmulatedFakeCamera2::ControlThread::kNormalExposureTime = 10 * MSEC;
-const nsecs_t EmulatedFakeCamera2::ControlThread::kExposureJump = 2 * MSEC;
-const nsecs_t EmulatedFakeCamera2::ControlThread::kMinExposureTime = 1 * MSEC;
-
-bool EmulatedFakeCamera2::ControlThread::threadLoop() {
- bool afModeChange = false;
- bool afTriggered = false;
- bool afCancelled = false;
- uint8_t afState;
- uint8_t afMode;
- int32_t afTriggerId;
- bool precaptureTriggered = false;
- uint8_t aeState;
- uint8_t aeMode;
- bool aeLock;
- int32_t precaptureTriggerId;
- nsecs_t nextSleep = kControlCycleDelay;
-
- {
- Mutex::Autolock lock(mInputMutex);
- if (mStartAf) {
- ALOGD("Starting AF trigger processing");
- afTriggered = true;
- mStartAf = false;
- } else if (mCancelAf) {
- ALOGD("Starting cancel AF trigger processing");
- afCancelled = true;
- mCancelAf = false;
- }
- afState = mAfState;
- afMode = mAfMode;
- afModeChange = mAfModeChange;
- mAfModeChange = false;
-
- afTriggerId = mAfTriggerId;
-
- if(mStartPrecapture) {
- ALOGD("Starting precapture trigger processing");
- precaptureTriggered = true;
- mStartPrecapture = false;
- }
- aeState = mAeState;
- aeMode = mAeMode;
- aeLock = mAeLock;
- precaptureTriggerId = mPrecaptureTriggerId;
- }
-
- if (afCancelled || afModeChange) {
- ALOGV("Resetting AF state due to cancel/mode change");
- afState = ANDROID_CONTROL_AF_STATE_INACTIVE;
- updateAfState(afState, afTriggerId);
- mAfScanDuration = 0;
- mLockAfterPassiveScan = false;
- }
-
- uint8_t oldAfState = afState;
-
- if (afTriggered) {
- afState = processAfTrigger(afMode, afState);
- }
-
- afState = maybeStartAfScan(afMode, afState);
- afState = updateAfScan(afMode, afState, &nextSleep);
- updateAfState(afState, afTriggerId);
-
- if (precaptureTriggered) {
- aeState = processPrecaptureTrigger(aeMode, aeState);
- }
-
- aeState = maybeStartAeScan(aeMode, aeLock, aeState);
- aeState = updateAeScan(aeMode, aeLock, aeState, &nextSleep);
- updateAeState(aeState, precaptureTriggerId);
-
- int ret;
- timespec t;
- t.tv_sec = 0;
- t.tv_nsec = nextSleep;
- do {
- ret = nanosleep(&t, &t);
- } while (ret != 0);
-
- if (mAfScanDuration > 0) {
- mAfScanDuration -= nextSleep;
- }
- if (mAeScanDuration > 0) {
- mAeScanDuration -= nextSleep;
- }
-
- return true;
-}
-
-int EmulatedFakeCamera2::ControlThread::processAfTrigger(uint8_t afMode,
- uint8_t afState) {
- switch (afMode) {
- case ANDROID_CONTROL_AF_OFF:
- case ANDROID_CONTROL_AF_EDOF:
- // Do nothing
- break;
- case ANDROID_CONTROL_AF_MACRO:
- case ANDROID_CONTROL_AF_AUTO:
- switch (afState) {
- case ANDROID_CONTROL_AF_STATE_INACTIVE:
- case ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED:
- case ANDROID_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED:
- // Start new focusing cycle
- mAfScanDuration = ((double)rand() / RAND_MAX) *
- (kMaxAfDuration - kMinAfDuration) + kMinAfDuration;
- afState = ANDROID_CONTROL_AF_STATE_ACTIVE_SCAN;
- ALOGV("%s: AF scan start, duration %lld ms",
- __FUNCTION__, mAfScanDuration / 1000000);
- break;
- case ANDROID_CONTROL_AF_STATE_ACTIVE_SCAN:
- // Ignore new request, already scanning
- break;
- default:
- ALOGE("Unexpected AF state in AUTO/MACRO AF mode: %d",
- afState);
- }
- break;
- case ANDROID_CONTROL_AF_CONTINUOUS_PICTURE:
- switch (afState) {
- // Picture mode waits for passive scan to complete
- case ANDROID_CONTROL_AF_STATE_PASSIVE_SCAN:
- mLockAfterPassiveScan = true;
- break;
- case ANDROID_CONTROL_AF_STATE_INACTIVE:
- afState = ANDROID_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED;
- break;
- case ANDROID_CONTROL_AF_STATE_PASSIVE_FOCUSED:
- afState = ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED;
- break;
- case ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED:
- case ANDROID_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED:
- // Must cancel to get out of these states
- break;
- default:
- ALOGE("Unexpected AF state in CONTINUOUS_PICTURE AF mode: %d",
- afState);
- }
- break;
- case ANDROID_CONTROL_AF_CONTINUOUS_VIDEO:
- switch (afState) {
- // Video mode does not wait for passive scan to complete
- case ANDROID_CONTROL_AF_STATE_PASSIVE_SCAN:
- case ANDROID_CONTROL_AF_STATE_INACTIVE:
- afState = ANDROID_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED;
- break;
- case ANDROID_CONTROL_AF_STATE_PASSIVE_FOCUSED:
- afState = ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED;
- break;
- case ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED:
- case ANDROID_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED:
- // Must cancel to get out of these states
- break;
- default:
- ALOGE("Unexpected AF state in CONTINUOUS_VIDEO AF mode: %d",
- afState);
- }
- break;
- default:
- break;
- }
- return afState;
-}
-
-int EmulatedFakeCamera2::ControlThread::maybeStartAfScan(uint8_t afMode,
- uint8_t afState) {
- if ((afMode == ANDROID_CONTROL_AF_CONTINUOUS_VIDEO ||
- afMode == ANDROID_CONTROL_AF_CONTINUOUS_PICTURE) &&
- (afState == ANDROID_CONTROL_AF_STATE_INACTIVE ||
- afState == ANDROID_CONTROL_AF_STATE_PASSIVE_FOCUSED)) {
-
- bool startScan = ((double)rand() / RAND_MAX) < kContinuousAfStartRate;
- if (startScan) {
- // Start new passive focusing cycle
- mAfScanDuration = ((double)rand() / RAND_MAX) *
- (kMaxAfDuration - kMinAfDuration) + kMinAfDuration;
- afState = ANDROID_CONTROL_AF_STATE_PASSIVE_SCAN;
- ALOGV("%s: AF passive scan start, duration %lld ms",
- __FUNCTION__, mAfScanDuration / 1000000);
- }
- }
- return afState;
-}
-
-int EmulatedFakeCamera2::ControlThread::updateAfScan(uint8_t afMode,
- uint8_t afState, nsecs_t *maxSleep) {
- if (! (afState == ANDROID_CONTROL_AF_STATE_ACTIVE_SCAN ||
- afState == ANDROID_CONTROL_AF_STATE_PASSIVE_SCAN ) ) {
- return afState;
- }
-
- if (mAfScanDuration <= 0) {
- ALOGV("%s: AF scan done", __FUNCTION__);
- switch (afMode) {
- case ANDROID_CONTROL_AF_MACRO:
- case ANDROID_CONTROL_AF_AUTO: {
- bool success = ((double)rand() / RAND_MAX) < kAfSuccessRate;
- if (success) {
- afState = ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED;
- } else {
- afState = ANDROID_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED;
- }
- break;
- }
- case ANDROID_CONTROL_AF_CONTINUOUS_PICTURE:
- if (mLockAfterPassiveScan) {
- afState = ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED;
- mLockAfterPassiveScan = false;
- } else {
- afState = ANDROID_CONTROL_AF_STATE_PASSIVE_FOCUSED;
- }
- break;
- case ANDROID_CONTROL_AF_CONTINUOUS_VIDEO:
- afState = ANDROID_CONTROL_AF_STATE_PASSIVE_FOCUSED;
- break;
- default:
- ALOGE("Unexpected AF mode in scan state");
- }
- } else {
- if (mAfScanDuration <= *maxSleep) {
- *maxSleep = mAfScanDuration;
- }
- }
- return afState;
-}
-
-void EmulatedFakeCamera2::ControlThread::updateAfState(uint8_t newState,
- int32_t triggerId) {
- Mutex::Autolock lock(mInputMutex);
- if (mAfState != newState) {
- ALOGV("%s: Autofocus state now %d, id %d", __FUNCTION__,
- newState, triggerId);
- mAfState = newState;
- mParent->sendNotification(CAMERA2_MSG_AUTOFOCUS,
- newState, triggerId, 0);
- }
-}
-
-int EmulatedFakeCamera2::ControlThread::processPrecaptureTrigger(uint8_t aeMode,
- uint8_t aeState) {
- switch (aeMode) {
- case ANDROID_CONTROL_AE_OFF:
- // Don't do anything for these
- return aeState;
- case ANDROID_CONTROL_AE_ON:
- case ANDROID_CONTROL_AE_ON_AUTO_FLASH:
- case ANDROID_CONTROL_AE_ON_ALWAYS_FLASH:
- case ANDROID_CONTROL_AE_ON_AUTO_FLASH_REDEYE:
- // Trigger a precapture cycle
- aeState = ANDROID_CONTROL_AE_STATE_PRECAPTURE;
- mAeScanDuration = ((double)rand() / RAND_MAX) *
- (kMaxPrecaptureAeDuration - kMinPrecaptureAeDuration) +
- kMinPrecaptureAeDuration;
- ALOGD("%s: AE precapture scan start, duration %lld ms",
- __FUNCTION__, mAeScanDuration / 1000000);
-
- }
- return aeState;
-}
-
-int EmulatedFakeCamera2::ControlThread::maybeStartAeScan(uint8_t aeMode,
- bool aeLocked,
- uint8_t aeState) {
- if (aeLocked) return aeState;
- switch (aeMode) {
- case ANDROID_CONTROL_AE_OFF:
- break;
- case ANDROID_CONTROL_AE_ON:
- case ANDROID_CONTROL_AE_ON_AUTO_FLASH:
- case ANDROID_CONTROL_AE_ON_ALWAYS_FLASH:
- case ANDROID_CONTROL_AE_ON_AUTO_FLASH_REDEYE: {
- if (aeState != ANDROID_CONTROL_AE_STATE_INACTIVE &&
- aeState != ANDROID_CONTROL_AE_STATE_CONVERGED) break;
-
- bool startScan = ((double)rand() / RAND_MAX) < kAeScanStartRate;
- if (startScan) {
- mAeScanDuration = ((double)rand() / RAND_MAX) *
- (kMaxAeDuration - kMinAeDuration) + kMinAeDuration;
- aeState = ANDROID_CONTROL_AE_STATE_SEARCHING;
- ALOGD("%s: AE scan start, duration %lld ms",
- __FUNCTION__, mAeScanDuration / 1000000);
- }
- }
- }
-
- return aeState;
-}
-
-int EmulatedFakeCamera2::ControlThread::updateAeScan(uint8_t aeMode,
- bool aeLock, uint8_t aeState, nsecs_t *maxSleep) {
- if (aeLock && aeState != ANDROID_CONTROL_AE_STATE_PRECAPTURE) {
- mAeScanDuration = 0;
- aeState = ANDROID_CONTROL_AE_STATE_LOCKED;
- } else if ((aeState == ANDROID_CONTROL_AE_STATE_SEARCHING) ||
- (aeState == ANDROID_CONTROL_AE_STATE_PRECAPTURE ) ) {
- if (mAeScanDuration <= 0) {
- ALOGD("%s: AE scan done", __FUNCTION__);
- aeState = aeLock ?
- ANDROID_CONTROL_AE_STATE_LOCKED :ANDROID_CONTROL_AE_STATE_CONVERGED;
-
- Mutex::Autolock lock(mInputMutex);
- mExposureTime = kNormalExposureTime;
- } else {
- if (mAeScanDuration <= *maxSleep) {
- *maxSleep = mAeScanDuration;
- }
-
- int64_t exposureDelta =
- ((double)rand() / RAND_MAX) * 2 * kExposureJump -
- kExposureJump;
- Mutex::Autolock lock(mInputMutex);
- mExposureTime = mExposureTime + exposureDelta;
- if (mExposureTime < kMinExposureTime) mExposureTime = kMinExposureTime;
- }
- }
-
- return aeState;
-}
-
-
-void EmulatedFakeCamera2::ControlThread::updateAeState(uint8_t newState,
- int32_t triggerId) {
- Mutex::Autolock lock(mInputMutex);
- if (mAeState != newState) {
- ALOGD("%s: Autoexposure state now %d, id %d", __FUNCTION__,
- newState, triggerId);
- mAeState = newState;
- mParent->sendNotification(CAMERA2_MSG_AUTOEXPOSURE,
- newState, triggerId, 0);
- }
-}
-
-/** Private methods */
-
-status_t EmulatedFakeCamera2::constructStaticInfo(
- camera_metadata_t **info,
- bool sizeRequest) const {
-
- size_t entryCount = 0;
- size_t dataCount = 0;
- status_t ret;
-
-#define ADD_OR_SIZE( tag, data, count ) \
- if ( ( ret = addOrSize(*info, sizeRequest, &entryCount, &dataCount, \
- tag, data, count) ) != OK ) return ret
-
- // android.lens
-
- // 5 cm min focus distance for back camera, infinity (fixed focus) for front
- const float minFocusDistance = mFacingBack ? 1.0/0.05 : 0.0;
- ADD_OR_SIZE(ANDROID_LENS_MINIMUM_FOCUS_DISTANCE,
- &minFocusDistance, 1);
- // 5 m hyperfocal distance for back camera, infinity (fixed focus) for front
- const float hyperFocalDistance = mFacingBack ? 1.0/5.0 : 0.0;
- ADD_OR_SIZE(ANDROID_LENS_HYPERFOCAL_DISTANCE,
- &minFocusDistance, 1);
-
- static const float focalLength = 3.30f; // mm
- ADD_OR_SIZE(ANDROID_LENS_AVAILABLE_FOCAL_LENGTHS,
- &focalLength, 1);
- static const float aperture = 2.8f;
- ADD_OR_SIZE(ANDROID_LENS_AVAILABLE_APERTURES,
- &aperture, 1);
- static const float filterDensity = 0;
- ADD_OR_SIZE(ANDROID_LENS_AVAILABLE_FILTER_DENSITY,
- &filterDensity, 1);
- static const uint8_t availableOpticalStabilization =
- ANDROID_LENS_OPTICAL_STABILIZATION_OFF;
- ADD_OR_SIZE(ANDROID_LENS_AVAILABLE_OPTICAL_STABILIZATION,
- &availableOpticalStabilization, 1);
-
- static const int32_t lensShadingMapSize[] = {1, 1};
- ADD_OR_SIZE(ANDROID_LENS_SHADING_MAP_SIZE, lensShadingMapSize,
- sizeof(lensShadingMapSize)/sizeof(int32_t));
-
- static const float lensShadingMap[3 * 1 * 1 ] =
- { 1.f, 1.f, 1.f };
- ADD_OR_SIZE(ANDROID_LENS_SHADING_MAP, lensShadingMap,
- sizeof(lensShadingMap)/sizeof(float));
-
- // Identity transform
- static const int32_t geometricCorrectionMapSize[] = {2, 2};
- ADD_OR_SIZE(ANDROID_LENS_GEOMETRIC_CORRECTION_MAP_SIZE,
- geometricCorrectionMapSize,
- sizeof(geometricCorrectionMapSize)/sizeof(int32_t));
-
- static const float geometricCorrectionMap[2 * 3 * 2 * 2] = {
- 0.f, 0.f, 0.f, 0.f, 0.f, 0.f,
- 1.f, 0.f, 1.f, 0.f, 1.f, 0.f,
- 0.f, 1.f, 0.f, 1.f, 0.f, 1.f,
- 1.f, 1.f, 1.f, 1.f, 1.f, 1.f};
- ADD_OR_SIZE(ANDROID_LENS_GEOMETRIC_CORRECTION_MAP,
- geometricCorrectionMap,
- sizeof(geometricCorrectionMap)/sizeof(float));
-
- int32_t lensFacing = mFacingBack ?
- ANDROID_LENS_FACING_BACK : ANDROID_LENS_FACING_FRONT;
- ADD_OR_SIZE(ANDROID_LENS_FACING, &lensFacing, 1);
-
- float lensPosition[3];
- if (mFacingBack) {
- // Back-facing camera is center-top on device
- lensPosition[0] = 0;
- lensPosition[1] = 20;
- lensPosition[2] = -5;
- } else {
- // Front-facing camera is center-right on device
- lensPosition[0] = 20;
- lensPosition[1] = 20;
- lensPosition[2] = 0;
- }
- ADD_OR_SIZE(ANDROID_LENS_POSITION, lensPosition, sizeof(lensPosition)/
- sizeof(float));
-
- // android.sensor
-
- ADD_OR_SIZE(ANDROID_SENSOR_EXPOSURE_TIME_RANGE,
- Sensor::kExposureTimeRange, 2);
-
- ADD_OR_SIZE(ANDROID_SENSOR_MAX_FRAME_DURATION,
- &Sensor::kFrameDurationRange[1], 1);
-
- ADD_OR_SIZE(ANDROID_SENSOR_AVAILABLE_SENSITIVITIES,
- Sensor::kAvailableSensitivities,
- sizeof(Sensor::kAvailableSensitivities)
- /sizeof(uint32_t));
-
- ADD_OR_SIZE(ANDROID_SENSOR_COLOR_FILTER_ARRANGEMENT,
- &Sensor::kColorFilterArrangement, 1);
-
- static const float sensorPhysicalSize[2] = {3.20f, 2.40f}; // mm
- ADD_OR_SIZE(ANDROID_SENSOR_PHYSICAL_SIZE,
- sensorPhysicalSize, 2);
-
- ADD_OR_SIZE(ANDROID_SENSOR_PIXEL_ARRAY_SIZE,
- Sensor::kResolution, 2);
-
- ADD_OR_SIZE(ANDROID_SENSOR_ACTIVE_ARRAY_SIZE,
- Sensor::kResolution, 2);
-
- ADD_OR_SIZE(ANDROID_SENSOR_WHITE_LEVEL,
- &Sensor::kMaxRawValue, 1);
-
- static const int32_t blackLevelPattern[4] = {
- Sensor::kBlackLevel, Sensor::kBlackLevel,
- Sensor::kBlackLevel, Sensor::kBlackLevel
- };
- ADD_OR_SIZE(ANDROID_SENSOR_BLACK_LEVEL_PATTERN,
- blackLevelPattern, sizeof(blackLevelPattern)/sizeof(int32_t));
-
- //TODO: sensor color calibration fields
-
- // android.flash
- static const uint8_t flashAvailable = 0;
- ADD_OR_SIZE(ANDROID_FLASH_AVAILABLE, &flashAvailable, 1);
-
- static const int64_t flashChargeDuration = 0;
- ADD_OR_SIZE(ANDROID_FLASH_CHARGE_DURATION, &flashChargeDuration, 1);
-
- // android.tonemap
-
- static const int32_t tonemapCurvePoints = 128;
- ADD_OR_SIZE(ANDROID_TONEMAP_MAX_CURVE_POINTS, &tonemapCurvePoints, 1);
-
- // android.scaler
-
- ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_FORMATS,
- kAvailableFormats,
- sizeof(kAvailableFormats)/sizeof(uint32_t));
-
- ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_RAW_SIZES,
- kAvailableRawSizes,
- sizeof(kAvailableRawSizes)/sizeof(uint32_t));
-
- ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_RAW_MIN_DURATIONS,
- kAvailableRawMinDurations,
- sizeof(kAvailableRawMinDurations)/sizeof(uint64_t));
-
- if (mFacingBack) {
- ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES,
- kAvailableProcessedSizesBack,
- sizeof(kAvailableProcessedSizesBack)/sizeof(uint32_t));
- } else {
- ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES,
- kAvailableProcessedSizesFront,
- sizeof(kAvailableProcessedSizesFront)/sizeof(uint32_t));
- }
-
- ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_PROCESSED_MIN_DURATIONS,
- kAvailableProcessedMinDurations,
- sizeof(kAvailableProcessedMinDurations)/sizeof(uint64_t));
-
- if (mFacingBack) {
- ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_JPEG_SIZES,
- kAvailableJpegSizesBack,
- sizeof(kAvailableJpegSizesBack)/sizeof(uint32_t));
- } else {
- ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_JPEG_SIZES,
- kAvailableJpegSizesFront,
- sizeof(kAvailableJpegSizesFront)/sizeof(uint32_t));
- }
-
- ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_JPEG_MIN_DURATIONS,
- kAvailableJpegMinDurations,
- sizeof(kAvailableJpegMinDurations)/sizeof(uint64_t));
-
- static const float maxZoom = 10;
- ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_MAX_ZOOM,
- &maxZoom, 1);
-
- // android.jpeg
-
- static const int32_t jpegThumbnailSizes[] = {
- 0, 0,
- 160, 120,
- 320, 240
- };
- ADD_OR_SIZE(ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES,
- jpegThumbnailSizes, sizeof(jpegThumbnailSizes)/sizeof(int32_t));
-
- static const int32_t jpegMaxSize = JpegCompressor::kMaxJpegSize;
- ADD_OR_SIZE(ANDROID_JPEG_MAX_SIZE, &jpegMaxSize, 1);
-
- // android.stats
-
- static const uint8_t availableFaceDetectModes[] = {
- ANDROID_STATS_FACE_DETECTION_OFF,
- ANDROID_STATS_FACE_DETECTION_SIMPLE,
- ANDROID_STATS_FACE_DETECTION_FULL
- };
-
- ADD_OR_SIZE(ANDROID_STATS_AVAILABLE_FACE_DETECT_MODES,
- availableFaceDetectModes,
- sizeof(availableFaceDetectModes));
-
- static const int32_t maxFaceCount = 8;
- ADD_OR_SIZE(ANDROID_STATS_MAX_FACE_COUNT,
- &maxFaceCount, 1);
-
- static const int32_t histogramSize = 64;
- ADD_OR_SIZE(ANDROID_STATS_HISTOGRAM_BUCKET_COUNT,
- &histogramSize, 1);
-
- static const int32_t maxHistogramCount = 1000;
- ADD_OR_SIZE(ANDROID_STATS_MAX_HISTOGRAM_COUNT,
- &maxHistogramCount, 1);
-
- static const int32_t sharpnessMapSize[2] = {64, 64};
- ADD_OR_SIZE(ANDROID_STATS_SHARPNESS_MAP_SIZE,
- sharpnessMapSize, sizeof(sharpnessMapSize)/sizeof(int32_t));
-
- static const int32_t maxSharpnessMapValue = 1000;
- ADD_OR_SIZE(ANDROID_STATS_MAX_SHARPNESS_MAP_VALUE,
- &maxSharpnessMapValue, 1);
-
- // android.control
-
- static const uint8_t availableSceneModes[] = {
- ANDROID_CONTROL_SCENE_MODE_UNSUPPORTED
- };
- ADD_OR_SIZE(ANDROID_CONTROL_AVAILABLE_SCENE_MODES,
- availableSceneModes, sizeof(availableSceneModes));
-
- static const uint8_t availableEffects[] = {
- ANDROID_CONTROL_EFFECT_OFF
- };
- ADD_OR_SIZE(ANDROID_CONTROL_AVAILABLE_EFFECTS,
- availableEffects, sizeof(availableEffects));
-
- int32_t max3aRegions = 0;
- ADD_OR_SIZE(ANDROID_CONTROL_MAX_REGIONS,
- &max3aRegions, 1);
-
- static const uint8_t availableAeModes[] = {
- ANDROID_CONTROL_AE_OFF,
- ANDROID_CONTROL_AE_ON
- };
- ADD_OR_SIZE(ANDROID_CONTROL_AE_AVAILABLE_MODES,
- availableAeModes, sizeof(availableAeModes));
-
- static const camera_metadata_rational exposureCompensationStep = {
- 1, 3
- };
- ADD_OR_SIZE(ANDROID_CONTROL_AE_EXP_COMPENSATION_STEP,
- &exposureCompensationStep, 1);
-
- int32_t exposureCompensationRange[] = {-9, 9};
- ADD_OR_SIZE(ANDROID_CONTROL_AE_EXP_COMPENSATION_RANGE,
- exposureCompensationRange,
- sizeof(exposureCompensationRange)/sizeof(int32_t));
-
- static const int32_t availableTargetFpsRanges[] = {
- 5, 30, 15, 30
- };
- ADD_OR_SIZE(ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES,
- availableTargetFpsRanges,
- sizeof(availableTargetFpsRanges)/sizeof(int32_t));
-
- static const uint8_t availableAntibandingModes[] = {
- ANDROID_CONTROL_AE_ANTIBANDING_OFF,
- ANDROID_CONTROL_AE_ANTIBANDING_AUTO
- };
- ADD_OR_SIZE(ANDROID_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES,
- availableAntibandingModes, sizeof(availableAntibandingModes));
-
- static const uint8_t availableAwbModes[] = {
- ANDROID_CONTROL_AWB_OFF,
- ANDROID_CONTROL_AWB_AUTO,
- ANDROID_CONTROL_AWB_INCANDESCENT,
- ANDROID_CONTROL_AWB_FLUORESCENT,
- ANDROID_CONTROL_AWB_DAYLIGHT,
- ANDROID_CONTROL_AWB_SHADE
- };
- ADD_OR_SIZE(ANDROID_CONTROL_AWB_AVAILABLE_MODES,
- availableAwbModes, sizeof(availableAwbModes));
-
- static const uint8_t availableAfModesBack[] = {
- ANDROID_CONTROL_AF_OFF,
- ANDROID_CONTROL_AF_AUTO,
- ANDROID_CONTROL_AF_MACRO,
- ANDROID_CONTROL_AF_CONTINUOUS_VIDEO,
- ANDROID_CONTROL_AF_CONTINUOUS_PICTURE
- };
-
- static const uint8_t availableAfModesFront[] = {
- ANDROID_CONTROL_AF_OFF
- };
-
- if (mFacingBack) {
- ADD_OR_SIZE(ANDROID_CONTROL_AF_AVAILABLE_MODES,
- availableAfModesBack, sizeof(availableAfModesBack));
- } else {
- ADD_OR_SIZE(ANDROID_CONTROL_AF_AVAILABLE_MODES,
- availableAfModesFront, sizeof(availableAfModesFront));
- }
-
- static const uint8_t availableVstabModes[] = {
- ANDROID_CONTROL_VIDEO_STABILIZATION_OFF
- };
- ADD_OR_SIZE(ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES,
- availableVstabModes, sizeof(availableVstabModes));
-
-#undef ADD_OR_SIZE
- /** Allocate metadata if sizing */
- if (sizeRequest) {
- ALOGV("Allocating %d entries, %d extra bytes for "
- "static camera info",
- entryCount, dataCount);
- *info = allocate_camera_metadata(entryCount, dataCount);
- if (*info == NULL) {
- ALOGE("Unable to allocate camera static info"
- "(%d entries, %d bytes extra data)",
- entryCount, dataCount);
- return NO_MEMORY;
- }
- }
- return OK;
-}
-
-status_t EmulatedFakeCamera2::constructDefaultRequest(
- int request_template,
- camera_metadata_t **request,
- bool sizeRequest) const {
-
- size_t entryCount = 0;
- size_t dataCount = 0;
- status_t ret;
-
-#define ADD_OR_SIZE( tag, data, count ) \
- if ( ( ret = addOrSize(*request, sizeRequest, &entryCount, &dataCount, \
- tag, data, count) ) != OK ) return ret
-
- /** android.request */
-
- static const uint8_t requestType = ANDROID_REQUEST_TYPE_CAPTURE;
- ADD_OR_SIZE(ANDROID_REQUEST_TYPE, &requestType, 1);
-
- static const uint8_t metadataMode = ANDROID_REQUEST_METADATA_FULL;
- ADD_OR_SIZE(ANDROID_REQUEST_METADATA_MODE, &metadataMode, 1);
-
- static const int32_t id = 0;
- ADD_OR_SIZE(ANDROID_REQUEST_ID, &id, 1);
-
- static const int32_t frameCount = 0;
- ADD_OR_SIZE(ANDROID_REQUEST_FRAME_COUNT, &frameCount, 1);
-
- // OUTPUT_STREAMS set by user
- entryCount += 1;
- dataCount += 5; // TODO: Should be maximum stream number
-
- /** android.lens */
-
- static const float focusDistance = 0;
- ADD_OR_SIZE(ANDROID_LENS_FOCUS_DISTANCE, &focusDistance, 1);
-
- static const float aperture = 2.8f;
- ADD_OR_SIZE(ANDROID_LENS_APERTURE, &aperture, 1);
-
- static const float focalLength = 5.0f;
- ADD_OR_SIZE(ANDROID_LENS_FOCAL_LENGTH, &focalLength, 1);
-
- static const float filterDensity = 0;
- ADD_OR_SIZE(ANDROID_LENS_FILTER_DENSITY, &filterDensity, 1);
-
- static const uint8_t opticalStabilizationMode =
- ANDROID_LENS_OPTICAL_STABILIZATION_OFF;
- ADD_OR_SIZE(ANDROID_LENS_OPTICAL_STABILIZATION_MODE,
- &opticalStabilizationMode, 1);
-
- // FOCUS_RANGE set only in frame
-
- /** android.sensor */
-
- static const int64_t exposureTime = 10 * MSEC;
- ADD_OR_SIZE(ANDROID_SENSOR_EXPOSURE_TIME, &exposureTime, 1);
-
- static const int64_t frameDuration = 33333333L; // 1/30 s
- ADD_OR_SIZE(ANDROID_SENSOR_FRAME_DURATION, &frameDuration, 1);
-
- static const int32_t sensitivity = 100;
- ADD_OR_SIZE(ANDROID_SENSOR_SENSITIVITY, &sensitivity, 1);
-
- // TIMESTAMP set only in frame
-
- /** android.flash */
-
- static const uint8_t flashMode = ANDROID_FLASH_OFF;
- ADD_OR_SIZE(ANDROID_FLASH_MODE, &flashMode, 1);
-
- static const uint8_t flashPower = 10;
- ADD_OR_SIZE(ANDROID_FLASH_FIRING_POWER, &flashPower, 1);
-
- static const int64_t firingTime = 0;
- ADD_OR_SIZE(ANDROID_FLASH_FIRING_TIME, &firingTime, 1);
-
- /** Processing block modes */
- uint8_t hotPixelMode = 0;
- uint8_t demosaicMode = 0;
- uint8_t noiseMode = 0;
- uint8_t shadingMode = 0;
- uint8_t geometricMode = 0;
- uint8_t colorMode = 0;
- uint8_t tonemapMode = 0;
- uint8_t edgeMode = 0;
- switch (request_template) {
- case CAMERA2_TEMPLATE_PREVIEW:
- hotPixelMode = ANDROID_PROCESSING_FAST;
- demosaicMode = ANDROID_PROCESSING_FAST;
- noiseMode = ANDROID_PROCESSING_FAST;
- shadingMode = ANDROID_PROCESSING_FAST;
- geometricMode = ANDROID_PROCESSING_FAST;
- colorMode = ANDROID_PROCESSING_FAST;
- tonemapMode = ANDROID_PROCESSING_FAST;
- edgeMode = ANDROID_PROCESSING_FAST;
- break;
- case CAMERA2_TEMPLATE_STILL_CAPTURE:
- hotPixelMode = ANDROID_PROCESSING_HIGH_QUALITY;
- demosaicMode = ANDROID_PROCESSING_HIGH_QUALITY;
- noiseMode = ANDROID_PROCESSING_HIGH_QUALITY;
- shadingMode = ANDROID_PROCESSING_HIGH_QUALITY;
- geometricMode = ANDROID_PROCESSING_HIGH_QUALITY;
- colorMode = ANDROID_PROCESSING_HIGH_QUALITY;
- tonemapMode = ANDROID_PROCESSING_HIGH_QUALITY;
- edgeMode = ANDROID_PROCESSING_HIGH_QUALITY;
- break;
- case CAMERA2_TEMPLATE_VIDEO_RECORD:
- hotPixelMode = ANDROID_PROCESSING_FAST;
- demosaicMode = ANDROID_PROCESSING_FAST;
- noiseMode = ANDROID_PROCESSING_FAST;
- shadingMode = ANDROID_PROCESSING_FAST;
- geometricMode = ANDROID_PROCESSING_FAST;
- colorMode = ANDROID_PROCESSING_FAST;
- tonemapMode = ANDROID_PROCESSING_FAST;
- edgeMode = ANDROID_PROCESSING_FAST;
- break;
- case CAMERA2_TEMPLATE_VIDEO_SNAPSHOT:
- hotPixelMode = ANDROID_PROCESSING_HIGH_QUALITY;
- demosaicMode = ANDROID_PROCESSING_HIGH_QUALITY;
- noiseMode = ANDROID_PROCESSING_HIGH_QUALITY;
- shadingMode = ANDROID_PROCESSING_HIGH_QUALITY;
- geometricMode = ANDROID_PROCESSING_HIGH_QUALITY;
- colorMode = ANDROID_PROCESSING_HIGH_QUALITY;
- tonemapMode = ANDROID_PROCESSING_HIGH_QUALITY;
- edgeMode = ANDROID_PROCESSING_HIGH_QUALITY;
- break;
- case CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG:
- hotPixelMode = ANDROID_PROCESSING_HIGH_QUALITY;
- demosaicMode = ANDROID_PROCESSING_HIGH_QUALITY;
- noiseMode = ANDROID_PROCESSING_HIGH_QUALITY;
- shadingMode = ANDROID_PROCESSING_HIGH_QUALITY;
- geometricMode = ANDROID_PROCESSING_HIGH_QUALITY;
- colorMode = ANDROID_PROCESSING_HIGH_QUALITY;
- tonemapMode = ANDROID_PROCESSING_HIGH_QUALITY;
- edgeMode = ANDROID_PROCESSING_HIGH_QUALITY;
- break;
- default:
- hotPixelMode = ANDROID_PROCESSING_FAST;
- demosaicMode = ANDROID_PROCESSING_FAST;
- noiseMode = ANDROID_PROCESSING_FAST;
- shadingMode = ANDROID_PROCESSING_FAST;
- geometricMode = ANDROID_PROCESSING_FAST;
- colorMode = ANDROID_PROCESSING_FAST;
- tonemapMode = ANDROID_PROCESSING_FAST;
- edgeMode = ANDROID_PROCESSING_FAST;
- break;
- }
- ADD_OR_SIZE(ANDROID_HOT_PIXEL_MODE, &hotPixelMode, 1);
- ADD_OR_SIZE(ANDROID_DEMOSAIC_MODE, &demosaicMode, 1);
- ADD_OR_SIZE(ANDROID_NOISE_MODE, &noiseMode, 1);
- ADD_OR_SIZE(ANDROID_SHADING_MODE, &shadingMode, 1);
- ADD_OR_SIZE(ANDROID_GEOMETRIC_MODE, &geometricMode, 1);
- ADD_OR_SIZE(ANDROID_COLOR_MODE, &colorMode, 1);
- ADD_OR_SIZE(ANDROID_TONEMAP_MODE, &tonemapMode, 1);
- ADD_OR_SIZE(ANDROID_EDGE_MODE, &edgeMode, 1);
-
- /** android.noise */
- static const uint8_t noiseStrength = 5;
- ADD_OR_SIZE(ANDROID_NOISE_STRENGTH, &noiseStrength, 1);
-
- /** android.color */
- static const float colorTransform[9] = {
- 1.0f, 0.f, 0.f,
- 0.f, 1.f, 0.f,
- 0.f, 0.f, 1.f
- };
- ADD_OR_SIZE(ANDROID_COLOR_TRANSFORM, colorTransform, 9);
-
- /** android.tonemap */
- static const float tonemapCurve[4] = {
- 0.f, 0.f,
- 1.f, 1.f
- };
- ADD_OR_SIZE(ANDROID_TONEMAP_CURVE_RED, tonemapCurve, 4);
- ADD_OR_SIZE(ANDROID_TONEMAP_CURVE_GREEN, tonemapCurve, 4);
- ADD_OR_SIZE(ANDROID_TONEMAP_CURVE_BLUE, tonemapCurve, 4);
-
- /** android.edge */
- static const uint8_t edgeStrength = 5;
- ADD_OR_SIZE(ANDROID_EDGE_STRENGTH, &edgeStrength, 1);
-
- /** android.scaler */
- static const int32_t cropRegion[3] = {
- 0, 0, Sensor::kResolution[0]
- };
- ADD_OR_SIZE(ANDROID_SCALER_CROP_REGION, cropRegion, 3);
-
- /** android.jpeg */
- static const int32_t jpegQuality = 80;
- ADD_OR_SIZE(ANDROID_JPEG_QUALITY, &jpegQuality, 1);
-
- static const int32_t thumbnailSize[2] = {
- 640, 480
- };
- ADD_OR_SIZE(ANDROID_JPEG_THUMBNAIL_SIZE, thumbnailSize, 2);
-
- static const int32_t thumbnailQuality = 80;
- ADD_OR_SIZE(ANDROID_JPEG_THUMBNAIL_QUALITY, &thumbnailQuality, 1);
-
- static const double gpsCoordinates[2] = {
- 0, 0
- };
- ADD_OR_SIZE(ANDROID_JPEG_GPS_COORDINATES, gpsCoordinates, 2);
-
- static const uint8_t gpsProcessingMethod[32] = "None";
- ADD_OR_SIZE(ANDROID_JPEG_GPS_PROCESSING_METHOD, gpsProcessingMethod, 32);
-
- static const int64_t gpsTimestamp = 0;
- ADD_OR_SIZE(ANDROID_JPEG_GPS_TIMESTAMP, &gpsTimestamp, 1);
-
- static const int32_t jpegOrientation = 0;
- ADD_OR_SIZE(ANDROID_JPEG_ORIENTATION, &jpegOrientation, 1);
-
- /** android.stats */
-
- static const uint8_t faceDetectMode = ANDROID_STATS_FACE_DETECTION_OFF;
- ADD_OR_SIZE(ANDROID_STATS_FACE_DETECT_MODE, &faceDetectMode, 1);
-
- static const uint8_t histogramMode = ANDROID_STATS_OFF;
- ADD_OR_SIZE(ANDROID_STATS_HISTOGRAM_MODE, &histogramMode, 1);
-
- static const uint8_t sharpnessMapMode = ANDROID_STATS_OFF;
- ADD_OR_SIZE(ANDROID_STATS_SHARPNESS_MAP_MODE, &sharpnessMapMode, 1);
-
- // faceRectangles, faceScores, faceLandmarks, faceIds, histogram,
- // sharpnessMap only in frames
-
- /** android.control */
-
- uint8_t controlIntent = 0;
- switch (request_template) {
- case CAMERA2_TEMPLATE_PREVIEW:
- controlIntent = ANDROID_CONTROL_INTENT_PREVIEW;
- break;
- case CAMERA2_TEMPLATE_STILL_CAPTURE:
- controlIntent = ANDROID_CONTROL_INTENT_STILL_CAPTURE;
- break;
- case CAMERA2_TEMPLATE_VIDEO_RECORD:
- controlIntent = ANDROID_CONTROL_INTENT_VIDEO_RECORD;
- break;
- case CAMERA2_TEMPLATE_VIDEO_SNAPSHOT:
- controlIntent = ANDROID_CONTROL_INTENT_VIDEO_SNAPSHOT;
- break;
- case CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG:
- controlIntent = ANDROID_CONTROL_INTENT_ZERO_SHUTTER_LAG;
- break;
- default:
- controlIntent = ANDROID_CONTROL_INTENT_CUSTOM;
- break;
- }
- ADD_OR_SIZE(ANDROID_CONTROL_CAPTURE_INTENT, &controlIntent, 1);
-
- static const uint8_t controlMode = ANDROID_CONTROL_AUTO;
- ADD_OR_SIZE(ANDROID_CONTROL_MODE, &controlMode, 1);
-
- static const uint8_t effectMode = ANDROID_CONTROL_EFFECT_OFF;
- ADD_OR_SIZE(ANDROID_CONTROL_EFFECT_MODE, &effectMode, 1);
-
- static const uint8_t sceneMode = ANDROID_CONTROL_SCENE_MODE_FACE_PRIORITY;
- ADD_OR_SIZE(ANDROID_CONTROL_SCENE_MODE, &sceneMode, 1);
-
- static const uint8_t aeMode = ANDROID_CONTROL_AE_ON_AUTO_FLASH;
- ADD_OR_SIZE(ANDROID_CONTROL_AE_MODE, &aeMode, 1);
-
- static const uint8_t aeLock = ANDROID_CONTROL_AE_LOCK_OFF;
- ADD_OR_SIZE(ANDROID_CONTROL_AE_LOCK, &aeLock, 1);
-
- static const int32_t controlRegions[5] = {
- 0, 0, Sensor::kResolution[0], Sensor::kResolution[1], 1000
- };
- ADD_OR_SIZE(ANDROID_CONTROL_AE_REGIONS, controlRegions, 5);
-
- static const int32_t aeExpCompensation = 0;
- ADD_OR_SIZE(ANDROID_CONTROL_AE_EXP_COMPENSATION, &aeExpCompensation, 1);
-
- static const int32_t aeTargetFpsRange[2] = {
- 10, 30
- };
- ADD_OR_SIZE(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, aeTargetFpsRange, 2);
-
- static const uint8_t aeAntibandingMode =
- ANDROID_CONTROL_AE_ANTIBANDING_AUTO;
- ADD_OR_SIZE(ANDROID_CONTROL_AE_ANTIBANDING_MODE, &aeAntibandingMode, 1);
-
- static const uint8_t awbMode =
- ANDROID_CONTROL_AWB_AUTO;
- ADD_OR_SIZE(ANDROID_CONTROL_AWB_MODE, &awbMode, 1);
-
- static const uint8_t awbLock = ANDROID_CONTROL_AWB_LOCK_OFF;
- ADD_OR_SIZE(ANDROID_CONTROL_AWB_LOCK, &awbLock, 1);
-
- ADD_OR_SIZE(ANDROID_CONTROL_AWB_REGIONS, controlRegions, 5);
-
- uint8_t afMode = 0;
- switch (request_template) {
- case CAMERA2_TEMPLATE_PREVIEW:
- afMode = ANDROID_CONTROL_AF_AUTO;
- break;
- case CAMERA2_TEMPLATE_STILL_CAPTURE:
- afMode = ANDROID_CONTROL_AF_AUTO;
- break;
- case CAMERA2_TEMPLATE_VIDEO_RECORD:
- afMode = ANDROID_CONTROL_AF_CONTINUOUS_VIDEO;
- break;
- case CAMERA2_TEMPLATE_VIDEO_SNAPSHOT:
- afMode = ANDROID_CONTROL_AF_CONTINUOUS_VIDEO;
- break;
- case CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG:
- afMode = ANDROID_CONTROL_AF_CONTINUOUS_PICTURE;
- break;
- default:
- afMode = ANDROID_CONTROL_AF_AUTO;
- break;
- }
- ADD_OR_SIZE(ANDROID_CONTROL_AF_MODE, &afMode, 1);
-
- ADD_OR_SIZE(ANDROID_CONTROL_AF_REGIONS, controlRegions, 5);
-
- static const uint8_t vstabMode = ANDROID_CONTROL_VIDEO_STABILIZATION_OFF;
- ADD_OR_SIZE(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE, &vstabMode, 1);
-
- // aeState, awbState, afState only in frame
-
- /** Allocate metadata if sizing */
- if (sizeRequest) {
- ALOGV("Allocating %d entries, %d extra bytes for "
- "request template type %d",
- entryCount, dataCount, request_template);
- *request = allocate_camera_metadata(entryCount, dataCount);
- if (*request == NULL) {
- ALOGE("Unable to allocate new request template type %d "
- "(%d entries, %d bytes extra data)", request_template,
- entryCount, dataCount);
- return NO_MEMORY;
- }
- }
- return OK;
-#undef ADD_OR_SIZE
-}
-
-status_t EmulatedFakeCamera2::addOrSize(camera_metadata_t *request,
- bool sizeRequest,
- size_t *entryCount,
- size_t *dataCount,
- uint32_t tag,
- const void *entryData,
- size_t entryDataCount) {
- status_t res;
- if (!sizeRequest) {
- return add_camera_metadata_entry(request, tag, entryData,
- entryDataCount);
- } else {
- int type = get_camera_metadata_tag_type(tag);
- if (type < 0 ) return BAD_VALUE;
- (*entryCount)++;
- (*dataCount) += calculate_camera_metadata_entry_data_size(type,
- entryDataCount);
- return OK;
- }
-}
-
-bool EmulatedFakeCamera2::isStreamInUse(uint32_t id) {
- // Assumes mMutex is locked; otherwise new requests could enter
- // configureThread while readoutThread is being checked
-
- // Order of isStreamInUse calls matters
- if (mConfigureThread->isStreamInUse(id) ||
- mReadoutThread->isStreamInUse(id) ||
- mJpegCompressor->isStreamInUse(id) ) {
- ALOGE("%s: Stream %d is in use in active requests!",
- __FUNCTION__, id);
- return true;
- }
- return false;
-}
-
-bool EmulatedFakeCamera2::isReprocessStreamInUse(uint32_t id) {
- // TODO: implement
- return false;
-}
-
-const Stream& EmulatedFakeCamera2::getStreamInfo(uint32_t streamId) {
- Mutex::Autolock lock(mMutex);
-
- return mStreams.valueFor(streamId);
-}
-
-const ReprocessStream& EmulatedFakeCamera2::getReprocessStreamInfo(uint32_t streamId) {
- Mutex::Autolock lock(mMutex);
-
- return mReprocessStreams.valueFor(streamId);
-}
-
-}; /* namespace android */
diff --git a/tools/emulator/system/camera/EmulatedFakeCamera2.h b/tools/emulator/system/camera/EmulatedFakeCamera2.h
deleted file mode 100644
index ee472354d..000000000
--- a/tools/emulator/system/camera/EmulatedFakeCamera2.h
+++ /dev/null
@@ -1,424 +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.
- */
-
-#ifndef HW_EMULATOR_CAMERA_EMULATED_FAKE_CAMERA2_H
-#define HW_EMULATOR_CAMERA_EMULATED_FAKE_CAMERA2_H
-
-/*
- * Contains declaration of a class EmulatedFakeCamera2 that encapsulates
- * functionality of a fake camera that implements version 2 of the camera device
- * interface.
- */
-
-#include "EmulatedCamera2.h"
-#include "fake-pipeline2/Base.h"
-#include "fake-pipeline2/Sensor.h"
-#include "fake-pipeline2/JpegCompressor.h"
-#include <utils/Condition.h>
-#include <utils/KeyedVector.h>
-#include <utils/String8.h>
-#include <utils/String16.h>
-
-namespace android {
-
-/* Encapsulates functionality of an advanced fake camera. This camera contains
- * a simple simulation of a scene, sensor, and image processing pipeline.
- */
-class EmulatedFakeCamera2 : public EmulatedCamera2 {
-public:
- /* Constructs EmulatedFakeCamera instance. */
- EmulatedFakeCamera2(int cameraId, bool facingBack, struct hw_module_t* module);
-
- /* Destructs EmulatedFakeCamera instance. */
- ~EmulatedFakeCamera2();
-
- /****************************************************************************
- * EmulatedCamera2 virtual overrides.
- ***************************************************************************/
-
-public:
- /* Initializes EmulatedFakeCamera2 instance. */
- status_t Initialize();
-
- /****************************************************************************
- * Camera Module API and generic hardware device API implementation
- ***************************************************************************/
-public:
-
- virtual status_t connectCamera(hw_device_t** device);
-
- virtual status_t closeCamera();
-
- virtual status_t getCameraInfo(struct camera_info *info);
-
- /****************************************************************************
- * EmulatedCamera2 abstract API implementation.
- ***************************************************************************/
-protected:
- /** Request input queue */
-
- virtual int requestQueueNotify();
-
- /** Count of requests in flight */
- virtual int getInProgressCount();
-
- /** Cancel all captures in flight */
- //virtual int flushCapturesInProgress();
-
- /** Construct default request */
- virtual int constructDefaultRequest(
- int request_template,
- camera_metadata_t **request);
-
- virtual int allocateStream(
- uint32_t width,
- uint32_t height,
- int format,
- const camera2_stream_ops_t *stream_ops,
- uint32_t *stream_id,
- uint32_t *format_actual,
- uint32_t *usage,
- uint32_t *max_buffers);
-
- virtual int registerStreamBuffers(
- uint32_t stream_id,
- int num_buffers,
- buffer_handle_t *buffers);
-
- virtual int releaseStream(uint32_t stream_id);
-
- // virtual int allocateReprocessStream(
- // uint32_t width,
- // uint32_t height,
- // uint32_t format,
- // const camera2_stream_ops_t *stream_ops,
- // uint32_t *stream_id,
- // uint32_t *format_actual,
- // uint32_t *usage,
- // uint32_t *max_buffers);
-
- virtual int allocateReprocessStreamFromStream(
- uint32_t output_stream_id,
- const camera2_stream_in_ops_t *stream_ops,
- uint32_t *stream_id);
-
- virtual int releaseReprocessStream(uint32_t stream_id);
-
- virtual int triggerAction(uint32_t trigger_id,
- int32_t ext1,
- int32_t ext2);
-
- /** Custom tag definitions */
- virtual const char* getVendorSectionName(uint32_t tag);
- virtual const char* getVendorTagName(uint32_t tag);
- virtual int getVendorTagType(uint32_t tag);
-
- /** Debug methods */
-
- virtual int dump(int fd);
-
-public:
- /****************************************************************************
- * Utility methods called by configure/readout threads and pipeline
- ***************************************************************************/
-
- // Get information about a given stream. Will lock mMutex
- const Stream &getStreamInfo(uint32_t streamId);
- const ReprocessStream &getReprocessStreamInfo(uint32_t streamId);
-
- // Notifies rest of camera subsystem of serious error
- void signalError();
-
-private:
- /****************************************************************************
- * Utility methods
- ***************************************************************************/
- /** Construct static camera metadata, two-pass */
- status_t constructStaticInfo(
- camera_metadata_t **info,
- bool sizeRequest) const;
-
- /** Two-pass implementation of constructDefaultRequest */
- status_t constructDefaultRequest(
- int request_template,
- camera_metadata_t **request,
- bool sizeRequest) const;
- /** Helper function for constructDefaultRequest */
- static status_t addOrSize( camera_metadata_t *request,
- bool sizeRequest,
- size_t *entryCount,
- size_t *dataCount,
- uint32_t tag,
- const void *entry_data,
- size_t entry_count);
-
- /** Determine if the stream id is listed in any currently-in-flight
- * requests. Assumes mMutex is locked */
- bool isStreamInUse(uint32_t streamId);
-
- /** Determine if the reprocess stream id is listed in any
- * currently-in-flight requests. Assumes mMutex is locked */
- bool isReprocessStreamInUse(uint32_t streamId);
-
- /****************************************************************************
- * Pipeline controller threads
- ***************************************************************************/
-
- class ConfigureThread: public Thread {
- public:
- ConfigureThread(EmulatedFakeCamera2 *parent);
- ~ConfigureThread();
-
- status_t waitUntilRunning();
- status_t newRequestAvailable();
- status_t readyToRun();
-
- bool isStreamInUse(uint32_t id);
- int getInProgressCount();
- private:
- EmulatedFakeCamera2 *mParent;
- static const nsecs_t kWaitPerLoop = 10000000L; // 10 ms
-
- bool mRunning;
- bool threadLoop();
-
- bool setupCapture();
- bool setupReprocess();
-
- bool configureNextCapture();
- bool configureNextReprocess();
-
- bool getBuffers();
-
- Mutex mInputMutex; // Protects mActive, mRequestCount
- Condition mInputSignal;
- bool mActive; // Whether we're waiting for input requests or actively
- // working on them
- size_t mRequestCount;
-
- camera_metadata_t *mRequest;
-
- Mutex mInternalsMutex; // Lock before accessing below members.
- bool mWaitingForReadout;
- bool mNextNeedsJpeg;
- bool mNextIsCapture;
- int32_t mNextFrameNumber;
- int64_t mNextExposureTime;
- int64_t mNextFrameDuration;
- int32_t mNextSensitivity;
- Buffers *mNextBuffers;
- };
-
- class ReadoutThread: public Thread {
- public:
- ReadoutThread(EmulatedFakeCamera2 *parent);
- ~ReadoutThread();
-
- status_t readyToRun();
-
- // Input
- status_t waitUntilRunning();
- bool waitForReady(nsecs_t timeout);
- void setNextOperation(bool isCapture,
- camera_metadata_t *request,
- Buffers *buffers);
- bool isStreamInUse(uint32_t id);
- int getInProgressCount();
- private:
- EmulatedFakeCamera2 *mParent;
-
- bool mRunning;
- bool threadLoop();
-
- bool readyForNextCapture();
- status_t collectStatisticsMetadata(camera_metadata_t *frame);
-
- // Inputs
- Mutex mInputMutex; // Protects mActive, mInFlightQueue, mRequestCount
- Condition mInputSignal;
- Condition mReadySignal;
-
- bool mActive;
-
- static const int kInFlightQueueSize = 4;
- struct InFlightQueue {
- bool isCapture;
- camera_metadata_t *request;
- Buffers *buffers;
- } *mInFlightQueue;
-
- size_t mInFlightHead;
- size_t mInFlightTail;
-
- size_t mRequestCount;
-
- // Internals
- Mutex mInternalsMutex;
-
- bool mIsCapture;
- camera_metadata_t *mRequest;
- Buffers *mBuffers;
-
- };
-
- // 3A management thread (auto-exposure, focus, white balance)
- class ControlThread: public Thread {
- public:
- ControlThread(EmulatedFakeCamera2 *parent);
- ~ControlThread();
-
- status_t readyToRun();
-
- status_t waitUntilRunning();
-
- // Interpret request's control parameters and override
- // capture settings as needed
- status_t processRequest(camera_metadata_t *request);
-
- status_t triggerAction(uint32_t msgType,
- int32_t ext1, int32_t ext2);
- private:
- ControlThread(const ControlThread &t);
- ControlThread& operator=(const ControlThread &t);
-
- // Constants controlling fake 3A behavior
- static const nsecs_t kControlCycleDelay;
- static const nsecs_t kMinAfDuration;
- static const nsecs_t kMaxAfDuration;
- static const float kAfSuccessRate;
- static const float kContinuousAfStartRate;
-
- static const float kAeScanStartRate;
- static const nsecs_t kMinAeDuration;
- static const nsecs_t kMaxAeDuration;
- static const nsecs_t kMinPrecaptureAeDuration;
- static const nsecs_t kMaxPrecaptureAeDuration;
-
- static const nsecs_t kNormalExposureTime;
- static const nsecs_t kExposureJump;
- static const nsecs_t kMinExposureTime;
-
- EmulatedFakeCamera2 *mParent;
-
- bool mRunning;
- bool threadLoop();
-
- Mutex mInputMutex; // Protects input methods
- Condition mInputSignal;
-
- // Trigger notifications
- bool mStartAf;
- bool mCancelAf;
- bool mStartPrecapture;
-
- // Latest state for 3A request fields
- uint8_t mControlMode;
-
- uint8_t mEffectMode;
- uint8_t mSceneMode;
-
- uint8_t mAfMode;
- bool mAfModeChange;
-
- uint8_t mAwbMode;
- uint8_t mAeMode;
-
- // Latest trigger IDs
- int32_t mAfTriggerId;
- int32_t mPrecaptureTriggerId;
-
- // Current state for 3A algorithms
- uint8_t mAfState;
- uint8_t mAeState;
- uint8_t mAwbState;
- bool mAeLock;
-
- // Current control parameters
- nsecs_t mExposureTime;
-
- // Private to threadLoop and its utility methods
-
- nsecs_t mAfScanDuration;
- nsecs_t mAeScanDuration;
- bool mLockAfterPassiveScan;
-
- // Utility methods for AF
- int processAfTrigger(uint8_t afMode, uint8_t afState);
- int maybeStartAfScan(uint8_t afMode, uint8_t afState);
- int updateAfScan(uint8_t afMode, uint8_t afState, nsecs_t *maxSleep);
- void updateAfState(uint8_t newState, int32_t triggerId);
-
- // Utility methods for precapture trigger
- int processPrecaptureTrigger(uint8_t aeMode, uint8_t aeState);
- int maybeStartAeScan(uint8_t aeMode, bool aeLock, uint8_t aeState);
- int updateAeScan(uint8_t aeMode, bool aeLock, uint8_t aeState,
- nsecs_t *maxSleep);
- void updateAeState(uint8_t newState, int32_t triggerId);
- };
-
- /****************************************************************************
- * Static configuration information
- ***************************************************************************/
-private:
- static const uint32_t kMaxRawStreamCount = 1;
- static const uint32_t kMaxProcessedStreamCount = 3;
- static const uint32_t kMaxJpegStreamCount = 1;
- static const uint32_t kMaxReprocessStreamCount = 2;
- static const uint32_t kMaxBufferCount = 4;
- static const uint32_t kAvailableFormats[];
- static const uint32_t kAvailableRawSizes[];
- static const uint64_t kAvailableRawMinDurations[];
- static const uint32_t kAvailableProcessedSizesBack[];
- static const uint32_t kAvailableProcessedSizesFront[];
- static const uint64_t kAvailableProcessedMinDurations[];
- static const uint32_t kAvailableJpegSizesBack[];
- static const uint32_t kAvailableJpegSizesFront[];
- static const uint64_t kAvailableJpegMinDurations[];
-
- /****************************************************************************
- * Data members.
- ***************************************************************************/
-
-protected:
- /* Facing back (true) or front (false) switch. */
- bool mFacingBack;
-
-private:
- /** Stream manipulation */
- uint32_t mNextStreamId;
- uint32_t mRawStreamCount;
- uint32_t mProcessedStreamCount;
- uint32_t mJpegStreamCount;
-
- uint32_t mNextReprocessStreamId;
- uint32_t mReprocessStreamCount;
-
- KeyedVector<uint32_t, Stream> mStreams;
- KeyedVector<uint32_t, ReprocessStream> mReprocessStreams;
-
- /** Simulated hardware interfaces */
- sp<Sensor> mSensor;
- sp<JpegCompressor> mJpegCompressor;
-
- /** Pipeline control threads */
- sp<ConfigureThread> mConfigureThread;
- sp<ReadoutThread> mReadoutThread;
- sp<ControlThread> mControlThread;
-};
-
-}; /* namespace android */
-
-#endif /* HW_EMULATOR_CAMERA_EMULATED_FAKE_CAMERA2_H */
diff --git a/tools/emulator/system/camera/EmulatedFakeCameraDevice.cpp b/tools/emulator/system/camera/EmulatedFakeCameraDevice.cpp
deleted file mode 100755
index 0bc4c5491..000000000
--- a/tools/emulator/system/camera/EmulatedFakeCameraDevice.cpp
+++ /dev/null
@@ -1,430 +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.
- */
-
-/*
- * Contains implementation of a class EmulatedFakeCameraDevice that encapsulates
- * fake camera device.
- */
-
-#define LOG_NDEBUG 0
-#define LOG_TAG "EmulatedCamera_FakeDevice"
-#include <cutils/log.h>
-#include "EmulatedFakeCamera.h"
-#include "EmulatedFakeCameraDevice.h"
-
-namespace android {
-
-EmulatedFakeCameraDevice::EmulatedFakeCameraDevice(EmulatedFakeCamera* camera_hal)
- : EmulatedCameraDevice(camera_hal),
- mBlackYUV(kBlack32),
- mWhiteYUV(kWhite32),
- mRedYUV(kRed8),
- mGreenYUV(kGreen8),
- mBlueYUV(kBlue8),
- mLastRedrawn(0),
- mCheckX(0),
- mCheckY(0),
- mCcounter(0)
-#if EFCD_ROTATE_FRAME
- , mLastRotatedAt(0),
- mCurrentFrameType(0),
- mCurrentColor(&mWhiteYUV)
-#endif // EFCD_ROTATE_FRAME
-{
- // Makes the image with the original exposure compensation darker.
- // So the effects of changing the exposure compensation can be seen.
- mBlackYUV.Y = mBlackYUV.Y / 2;
- mWhiteYUV.Y = mWhiteYUV.Y / 2;
- mRedYUV.Y = mRedYUV.Y / 2;
- mGreenYUV.Y = mGreenYUV.Y / 2;
- mBlueYUV.Y = mBlueYUV.Y / 2;
-}
-
-EmulatedFakeCameraDevice::~EmulatedFakeCameraDevice()
-{
-}
-
-/****************************************************************************
- * Emulated camera device abstract interface implementation.
- ***************************************************************************/
-
-status_t EmulatedFakeCameraDevice::connectDevice()
-{
- ALOGV("%s", __FUNCTION__);
-
- Mutex::Autolock locker(&mObjectLock);
- if (!isInitialized()) {
- ALOGE("%s: Fake camera device is not initialized.", __FUNCTION__);
- return EINVAL;
- }
- if (isConnected()) {
- ALOGW("%s: Fake camera device is already connected.", __FUNCTION__);
- return NO_ERROR;
- }
-
- /* There is no device to connect to. */
- mState = ECDS_CONNECTED;
-
- return NO_ERROR;
-}
-
-status_t EmulatedFakeCameraDevice::disconnectDevice()
-{
- ALOGV("%s", __FUNCTION__);
-
- Mutex::Autolock locker(&mObjectLock);
- if (!isConnected()) {
- ALOGW("%s: Fake camera device is already disconnected.", __FUNCTION__);
- return NO_ERROR;
- }
- if (isStarted()) {
- ALOGE("%s: Cannot disconnect from the started device.", __FUNCTION__);
- return EINVAL;
- }
-
- /* There is no device to disconnect from. */
- mState = ECDS_INITIALIZED;
-
- return NO_ERROR;
-}
-
-status_t EmulatedFakeCameraDevice::startDevice(int width,
- int height,
- uint32_t pix_fmt)
-{
- ALOGV("%s", __FUNCTION__);
-
- Mutex::Autolock locker(&mObjectLock);
- if (!isConnected()) {
- ALOGE("%s: Fake camera device is not connected.", __FUNCTION__);
- return EINVAL;
- }
- if (isStarted()) {
- ALOGE("%s: Fake camera device is already started.", __FUNCTION__);
- return EINVAL;
- }
-
- /* Initialize the base class. */
- const status_t res =
- EmulatedCameraDevice::commonStartDevice(width, height, pix_fmt);
- if (res == NO_ERROR) {
- /* Calculate U/V panes inside the framebuffer. */
- switch (mPixelFormat) {
- case V4L2_PIX_FMT_YVU420:
- mFrameV = mCurrentFrame + mTotalPixels;
- mFrameU = mFrameU + mTotalPixels / 4;
- mUVStep = 1;
- mUVTotalNum = mTotalPixels / 4;
- break;
-
- case V4L2_PIX_FMT_YUV420:
- mFrameU = mCurrentFrame + mTotalPixels;
- mFrameV = mFrameU + mTotalPixels / 4;
- mUVStep = 1;
- mUVTotalNum = mTotalPixels / 4;
- break;
-
- case V4L2_PIX_FMT_NV21:
- /* Interleaved UV pane, V first. */
- mFrameV = mCurrentFrame + mTotalPixels;
- mFrameU = mFrameV + 1;
- mUVStep = 2;
- mUVTotalNum = mTotalPixels / 4;
- break;
-
- case V4L2_PIX_FMT_NV12:
- /* Interleaved UV pane, U first. */
- mFrameU = mCurrentFrame + mTotalPixels;
- mFrameV = mFrameU + 1;
- mUVStep = 2;
- mUVTotalNum = mTotalPixels / 4;
- break;
-
- default:
- ALOGE("%s: Unknown pixel format %.4s", __FUNCTION__,
- reinterpret_cast<const char*>(&mPixelFormat));
- return EINVAL;
- }
- /* Number of items in a single row inside U/V panes. */
- mUVInRow = (width / 2) * mUVStep;
- mState = ECDS_STARTED;
- } else {
- ALOGE("%s: commonStartDevice failed", __FUNCTION__);
- }
-
- return res;
-}
-
-status_t EmulatedFakeCameraDevice::stopDevice()
-{
- ALOGV("%s", __FUNCTION__);
-
- Mutex::Autolock locker(&mObjectLock);
- if (!isStarted()) {
- ALOGW("%s: Fake camera device is not started.", __FUNCTION__);
- return NO_ERROR;
- }
-
- mFrameU = mFrameV = NULL;
- EmulatedCameraDevice::commonStopDevice();
- mState = ECDS_CONNECTED;
-
- return NO_ERROR;
-}
-
-/****************************************************************************
- * Worker thread management overrides.
- ***************************************************************************/
-
-bool EmulatedFakeCameraDevice::inWorkerThread()
-{
- /* Wait till FPS timeout expires, or thread exit message is received. */
- WorkerThread::SelectRes res =
- getWorkerThread()->Select(-1, 1000000 / mEmulatedFPS);
- if (res == WorkerThread::EXIT_THREAD) {
- ALOGV("%s: Worker thread has been terminated.", __FUNCTION__);
- return false;
- }
-
- /* Lets see if we need to generate a new frame. */
- if ((systemTime(SYSTEM_TIME_MONOTONIC) - mLastRedrawn) >= mRedrawAfter) {
- /*
- * Time to generate a new frame.
- */
-
-#if EFCD_ROTATE_FRAME
- const int frame_type = rotateFrame();
- switch (frame_type) {
- case 0:
- drawCheckerboard();
- break;
- case 1:
- drawStripes();
- break;
- case 2:
- drawSolid(mCurrentColor);
- break;
- }
-#else
- /* Draw the checker board. */
- drawCheckerboard();
-
-#endif // EFCD_ROTATE_FRAME
-
- mLastRedrawn = systemTime(SYSTEM_TIME_MONOTONIC);
- }
-
- /* Timestamp the current frame, and notify the camera HAL about new frame. */
- mCurFrameTimestamp = systemTime(SYSTEM_TIME_MONOTONIC);
- mCameraHAL->onNextFrameAvailable(mCurrentFrame, mCurFrameTimestamp, this);
-
- return true;
-}
-
-/****************************************************************************
- * Fake camera device private API
- ***************************************************************************/
-
-void EmulatedFakeCameraDevice::drawCheckerboard()
-{
- const int size = mFrameWidth / 10;
- bool black = true;
-
- if((mCheckX / size) & 1)
- black = false;
- if((mCheckY / size) & 1)
- black = !black;
-
- int county = mCheckY % size;
- int checkxremainder = mCheckX % size;
- uint8_t* Y = mCurrentFrame;
- uint8_t* U_pos = mFrameU;
- uint8_t* V_pos = mFrameV;
- uint8_t* U = U_pos;
- uint8_t* V = V_pos;
-
- YUVPixel adjustedWhite = YUVPixel(mWhiteYUV);
- changeWhiteBalance(adjustedWhite.Y, adjustedWhite.U, adjustedWhite.V);
-
- for(int y = 0; y < mFrameHeight; y++) {
- int countx = checkxremainder;
- bool current = black;
- for(int x = 0; x < mFrameWidth; x += 2) {
- if (current) {
- mBlackYUV.get(Y, U, V);
- } else {
- adjustedWhite.get(Y, U, V);
- }
- *Y = changeExposure(*Y);
- Y[1] = *Y;
- Y += 2; U += mUVStep; V += mUVStep;
- countx += 2;
- if(countx >= size) {
- countx = 0;
- current = !current;
- }
- }
- if (y & 0x1) {
- U_pos = U;
- V_pos = V;
- } else {
- U = U_pos;
- V = V_pos;
- }
- if(county++ >= size) {
- county = 0;
- black = !black;
- }
- }
- mCheckX += 3;
- mCheckY++;
-
- /* Run the square. */
- int sqx = ((mCcounter * 3) & 255);
- if(sqx > 128) sqx = 255 - sqx;
- int sqy = ((mCcounter * 5) & 255);
- if(sqy > 128) sqy = 255 - sqy;
- const int sqsize = mFrameWidth / 10;
- drawSquare(sqx * sqsize / 32, sqy * sqsize / 32, (sqsize * 5) >> 1,
- (mCcounter & 0x100) ? &mRedYUV : &mGreenYUV);
- mCcounter++;
-}
-
-void EmulatedFakeCameraDevice::drawSquare(int x,
- int y,
- int size,
- const YUVPixel* color)
-{
- const int square_xstop = min(mFrameWidth, x + size);
- const int square_ystop = min(mFrameHeight, y + size);
- uint8_t* Y_pos = mCurrentFrame + y * mFrameWidth + x;
-
- YUVPixel adjustedColor = *color;
- changeWhiteBalance(adjustedColor.Y, adjustedColor.U, adjustedColor.V);
-
- // Draw the square.
- for (; y < square_ystop; y++) {
- const int iUV = (y / 2) * mUVInRow + (x / 2) * mUVStep;
- uint8_t* sqU = mFrameU + iUV;
- uint8_t* sqV = mFrameV + iUV;
- uint8_t* sqY = Y_pos;
- for (int i = x; i < square_xstop; i += 2) {
- adjustedColor.get(sqY, sqU, sqV);
- *sqY = changeExposure(*sqY);
- sqY[1] = *sqY;
- sqY += 2; sqU += mUVStep; sqV += mUVStep;
- }
- Y_pos += mFrameWidth;
- }
-}
-
-#if EFCD_ROTATE_FRAME
-
-void EmulatedFakeCameraDevice::drawSolid(YUVPixel* color)
-{
- YUVPixel adjustedColor = *color;
- changeWhiteBalance(adjustedColor.Y, adjustedColor.U, adjustedColor.V);
-
- /* All Ys are the same. */
- memset(mCurrentFrame, changeExposure(adjustedColor.Y), mTotalPixels);
-
- /* Fill U, and V panes. */
- uint8_t* U = mFrameU;
- uint8_t* V = mFrameV;
- for (int k = 0; k < mUVTotalNum; k++, U += mUVStep, V += mUVStep) {
- *U = color->U;
- *V = color->V;
- }
-}
-
-void EmulatedFakeCameraDevice::drawStripes()
-{
- /* Divide frame into 4 stripes. */
- const int change_color_at = mFrameHeight / 4;
- const int each_in_row = mUVInRow / mUVStep;
- uint8_t* pY = mCurrentFrame;
- for (int y = 0; y < mFrameHeight; y++, pY += mFrameWidth) {
- /* Select the color. */
- YUVPixel* color;
- const int color_index = y / change_color_at;
- if (color_index == 0) {
- /* White stripe on top. */
- color = &mWhiteYUV;
- } else if (color_index == 1) {
- /* Then the red stripe. */
- color = &mRedYUV;
- } else if (color_index == 2) {
- /* Then the green stripe. */
- color = &mGreenYUV;
- } else {
- /* And the blue stripe at the bottom. */
- color = &mBlueYUV;
- }
- changeWhiteBalance(color->Y, color->U, color->V);
-
- /* All Ys at the row are the same. */
- memset(pY, changeExposure(color->Y), mFrameWidth);
-
- /* Offset of the current row inside U/V panes. */
- const int uv_off = (y / 2) * mUVInRow;
- /* Fill U, and V panes. */
- uint8_t* U = mFrameU + uv_off;
- uint8_t* V = mFrameV + uv_off;
- for (int k = 0; k < each_in_row; k++, U += mUVStep, V += mUVStep) {
- *U = color->U;
- *V = color->V;
- }
- }
-}
-
-int EmulatedFakeCameraDevice::rotateFrame()
-{
- if ((systemTime(SYSTEM_TIME_MONOTONIC) - mLastRotatedAt) >= mRotateFreq) {
- mLastRotatedAt = systemTime(SYSTEM_TIME_MONOTONIC);
- mCurrentFrameType++;
- if (mCurrentFrameType > 2) {
- mCurrentFrameType = 0;
- }
- if (mCurrentFrameType == 2) {
- ALOGD("********** Rotated to the SOLID COLOR frame **********");
- /* Solid color: lets rotate color too. */
- if (mCurrentColor == &mWhiteYUV) {
- ALOGD("----- Painting a solid RED frame -----");
- mCurrentColor = &mRedYUV;
- } else if (mCurrentColor == &mRedYUV) {
- ALOGD("----- Painting a solid GREEN frame -----");
- mCurrentColor = &mGreenYUV;
- } else if (mCurrentColor == &mGreenYUV) {
- ALOGD("----- Painting a solid BLUE frame -----");
- mCurrentColor = &mBlueYUV;
- } else {
- /* Back to white. */
- ALOGD("----- Painting a solid WHITE frame -----");
- mCurrentColor = &mWhiteYUV;
- }
- } else if (mCurrentFrameType == 0) {
- ALOGD("********** Rotated to the CHECKERBOARD frame **********");
- } else if (mCurrentFrameType == 1) {
- ALOGD("********** Rotated to the STRIPED frame **********");
- }
- }
-
- return mCurrentFrameType;
-}
-
-#endif // EFCD_ROTATE_FRAME
-
-}; /* namespace android */
diff --git a/tools/emulator/system/camera/EmulatedFakeCameraDevice.h b/tools/emulator/system/camera/EmulatedFakeCameraDevice.h
deleted file mode 100755
index f66f07647..000000000
--- a/tools/emulator/system/camera/EmulatedFakeCameraDevice.h
+++ /dev/null
@@ -1,197 +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.
- */
-
-#ifndef HW_EMULATOR_CAMERA_EMULATED_FAKE_CAMERA_DEVICE_H
-#define HW_EMULATOR_CAMERA_EMULATED_FAKE_CAMERA_DEVICE_H
-
-/*
- * Contains declaration of a class EmulatedFakeCameraDevice that encapsulates
- * a fake camera device.
- */
-
-#include "Converters.h"
-#include "EmulatedCameraDevice.h"
-
-/* This is used for debugging format / conversion issues. If EFCD_ROTATE_FRAME is
- * set to 0, the frame content will be always the "checkerboard". Otherwise, if
- * EFCD_ROTATE_FRAME is set to a non-zero value, the frame content will "rotate"
- * from a "checkerboard" frame to a "white/red/green/blue stripes" frame, to a
- * "white/red/green/blue" frame. Frame content rotation helps finding bugs in
- * format conversions.
- */
-#define EFCD_ROTATE_FRAME 0
-
-namespace android {
-
-class EmulatedFakeCamera;
-
-/* Encapsulates a fake camera device.
- * Fake camera device emulates a camera device by providing frames containing
- * a black and white checker board, moving diagonally towards the 0,0 corner.
- * There is also a green, or red square that bounces inside the frame, changing
- * its color when bouncing off the 0,0 corner.
- */
-class EmulatedFakeCameraDevice : public EmulatedCameraDevice {
-public:
- /* Constructs EmulatedFakeCameraDevice instance. */
- explicit EmulatedFakeCameraDevice(EmulatedFakeCamera* camera_hal);
-
- /* Destructs EmulatedFakeCameraDevice instance. */
- ~EmulatedFakeCameraDevice();
-
- /***************************************************************************
- * Emulated camera device abstract interface implementation.
- * See declarations of these methods in EmulatedCameraDevice class for
- * information on each of these methods.
- **************************************************************************/
-
-public:
- /* Connects to the camera device.
- * Since there is no real device to connect to, this method does nothing,
- * but changes the state.
- */
- status_t connectDevice();
-
- /* Disconnects from the camera device.
- * Since there is no real device to disconnect from, this method does
- * nothing, but changes the state.
- */
- status_t disconnectDevice();
-
- /* Starts the camera device. */
- status_t startDevice(int width, int height, uint32_t pix_fmt);
-
- /* Stops the camera device. */
- status_t stopDevice();
-
- /* Gets current preview fame into provided buffer. */
- status_t getPreviewFrame(void* buffer);
-
- /***************************************************************************
- * Worker thread management overrides.
- * See declarations of these methods in EmulatedCameraDevice class for
- * information on each of these methods.
- **************************************************************************/
-
-protected:
- /* Implementation of the worker thread routine.
- * This method simply sleeps for a period of time defined by the FPS property
- * of the fake camera (simulating frame frequency), and then calls emulated
- * camera's onNextFrameAvailable method.
- */
- bool inWorkerThread();
-
- /****************************************************************************
- * Fake camera device private API
- ***************************************************************************/
-
-private:
-
- /* Draws a black and white checker board in the current frame buffer. */
- void drawCheckerboard();
-
- /* Draws a square of the given color in the current frame buffer.
- * Param:
- * x, y - Coordinates of the top left corner of the square in the buffer.
- * size - Size of the square's side.
- * color - Square's color.
- */
- void drawSquare(int x, int y, int size, const YUVPixel* color);
-
-#if EFCD_ROTATE_FRAME
- void drawSolid(YUVPixel* color);
- void drawStripes();
- int rotateFrame();
-#endif // EFCD_ROTATE_FRAME
-
- /****************************************************************************
- * Fake camera device data members
- ***************************************************************************/
-
-private:
- /*
- * Pixel colors in YUV format used when drawing the checker board.
- */
-
- YUVPixel mBlackYUV;
- YUVPixel mWhiteYUV;
- YUVPixel mRedYUV;
- YUVPixel mGreenYUV;
- YUVPixel mBlueYUV;
-
- /* Last time the frame has been redrawn. */
- nsecs_t mLastRedrawn;
-
- /*
- * Precalculated values related to U/V panes.
- */
-
- /* U pane inside the framebuffer. */
- uint8_t* mFrameU;
-
- /* V pane inside the framebuffer. */
- uint8_t* mFrameV;
-
- /* Defines byte distance between adjacent U, and V values. */
- int mUVStep;
-
- /* Defines number of Us and Vs in a row inside the U/V panes.
- * Note that if U/V panes are interleaved, this value reflects the total
- * number of both, Us and Vs in a single row in the interleaved UV pane. */
- int mUVInRow;
-
- /* Total number of each, U, and V elements in the framebuffer. */
- int mUVTotalNum;
-
- /*
- * Checkerboard drawing related stuff
- */
-
- int mCheckX;
- int mCheckY;
- int mCcounter;
-
- /* Emulated FPS (frames per second).
- * We will emulate 50 FPS. */
- static const int mEmulatedFPS = 50;
-
- /* Defines time (in nanoseconds) between redrawing the checker board.
- * We will redraw the checker board every 15 milliseconds. */
- static const nsecs_t mRedrawAfter = 15000000LL;
-
-#if EFCD_ROTATE_FRAME
- /* Frame rotation frequency in nanosec (currently - 3 sec) */
- static const nsecs_t mRotateFreq = 3000000000LL;
-
- /* Last time the frame has rotated. */
- nsecs_t mLastRotatedAt;
-
- /* Type of the frame to display in the current rotation:
- * 0 - Checkerboard.
- * 1 - White/Red/Green/Blue horisontal stripes
- * 2 - Solid color. */
- int mCurrentFrameType;
-
- /* Color to use to paint the solid color frame. Colors will rotate between
- * white, red, gree, and blue each time rotation comes to the solid color
- * frame. */
- YUVPixel* mCurrentColor;
-#endif // EFCD_ROTATE_FRAME
-};
-
-}; /* namespace android */
-
-#endif /* HW_EMULATOR_CAMERA_EMULATED_FAKE_CAMERA_DEVICE_H */
diff --git a/tools/emulator/system/camera/EmulatedQemuCamera.cpp b/tools/emulator/system/camera/EmulatedQemuCamera.cpp
deleted file mode 100755
index af1e32499..000000000
--- a/tools/emulator/system/camera/EmulatedQemuCamera.cpp
+++ /dev/null
@@ -1,119 +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.
- */
-
-/*
- * Contains implementation of a class EmulatedQemuCamera that encapsulates
- * functionality of an emulated camera connected to the host.
- */
-
-#define LOG_NDEBUG 0
-#define LOG_TAG "EmulatedCamera_QemuCamera"
-#include <cutils/log.h>
-#include "EmulatedQemuCamera.h"
-#include "EmulatedCameraFactory.h"
-
-namespace android {
-
-EmulatedQemuCamera::EmulatedQemuCamera(int cameraId, struct hw_module_t* module)
- : EmulatedCamera(cameraId, module),
- mQemuCameraDevice(this)
-{
-}
-
-EmulatedQemuCamera::~EmulatedQemuCamera()
-{
-}
-
-/****************************************************************************
- * EmulatedCamera virtual overrides.
- ***************************************************************************/
-
-status_t EmulatedQemuCamera::Initialize(const char* device_name,
- const char* frame_dims,
- const char* facing_dir)
-{
- ALOGV("%s:\n Name=%s\n Facing '%s'\n Dimensions=%s",
- __FUNCTION__, device_name, facing_dir, frame_dims);
- /* Save dimensions. */
- mFrameDims = frame_dims;
-
- /* Initialize camera device. */
- status_t res = mQemuCameraDevice.Initialize(device_name);
- if (res != NO_ERROR) {
- return res;
- }
-
- /* Initialize base class. */
- res = EmulatedCamera::Initialize();
- if (res != NO_ERROR) {
- return res;
- }
-
- /*
- * Set customizable parameters.
- */
-
- mParameters.set(EmulatedCamera::FACING_KEY, facing_dir);
- mParameters.set(EmulatedCamera::ORIENTATION_KEY,
- gEmulatedCameraFactory.getQemuCameraOrientation());
- mParameters.set(CameraParameters::KEY_SUPPORTED_PICTURE_SIZES, frame_dims);
- mParameters.set(CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES, frame_dims);
-
- /*
- * Use first dimension reported by the device to set current preview and
- * picture sizes.
- */
-
- char first_dim[128];
- /* Dimensions are separated with ',' */
- const char* c = strchr(frame_dims, ',');
- if (c == NULL) {
- strncpy(first_dim, frame_dims, sizeof(first_dim));
- first_dim[sizeof(first_dim)-1] = '\0';
- } else if (static_cast<size_t>(c - frame_dims) < sizeof(first_dim)) {
- memcpy(first_dim, frame_dims, c - frame_dims);
- first_dim[c - frame_dims] = '\0';
- } else {
- memcpy(first_dim, frame_dims, sizeof(first_dim));
- first_dim[sizeof(first_dim)-1] = '\0';
- }
-
- /* Width and height are separated with 'x' */
- char* sep = strchr(first_dim, 'x');
- if (sep == NULL) {
- ALOGE("%s: Invalid first dimension format in %s",
- __FUNCTION__, frame_dims);
- return EINVAL;
- }
-
- *sep = '\0';
- const int x = atoi(first_dim);
- const int y = atoi(sep + 1);
- mParameters.setPreviewSize(x, y);
- mParameters.setPictureSize(x, y);
-
- ALOGV("%s: Qemu camera %s is initialized. Current frame is %dx%d",
- __FUNCTION__, device_name, x, y);
-
- return NO_ERROR;
-}
-
-EmulatedCameraDevice* EmulatedQemuCamera::getCameraDevice()
-{
- return &mQemuCameraDevice;
-}
-
-}; /* namespace android */
diff --git a/tools/emulator/system/camera/EmulatedQemuCamera.h b/tools/emulator/system/camera/EmulatedQemuCamera.h
deleted file mode 100755
index 1b826c7f8..000000000
--- a/tools/emulator/system/camera/EmulatedQemuCamera.h
+++ /dev/null
@@ -1,73 +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.
- */
-
-#ifndef HW_EMULATOR_CAMERA_EMULATED_QEMU_CAMERA_H
-#define HW_EMULATOR_CAMERA_EMULATED_QEMU_CAMERA_H
-
-/*
- * Contains declaration of a class EmulatedQemuCamera that encapsulates
- * functionality of an emulated camera connected to the host.
- */
-
-#include "EmulatedCamera.h"
-#include "EmulatedQemuCameraDevice.h"
-
-namespace android {
-
-/* Encapsulates functionality of an emulated camera connected to the host.
- */
-class EmulatedQemuCamera : public EmulatedCamera {
-public:
- /* Constructs EmulatedQemuCamera instance. */
- EmulatedQemuCamera(int cameraId, struct hw_module_t* module);
-
- /* Destructs EmulatedQemuCamera instance. */
- ~EmulatedQemuCamera();
-
- /***************************************************************************
- * EmulatedCamera virtual overrides.
- **************************************************************************/
-
-public:
- /* Initializes EmulatedQemuCamera instance. */
- status_t Initialize(const char* device_name,
- const char* frame_dims,
- const char* facing_dir);
-
- /***************************************************************************
- * EmulatedCamera abstract API implementation.
- **************************************************************************/
-
-protected:
- /* Gets emulated camera device ised by this instance of the emulated camera.
- */
- EmulatedCameraDevice* getCameraDevice();
-
- /***************************************************************************
- * Data memebers.
- **************************************************************************/
-
-protected:
- /* Contained qemu camera device object. */
- EmulatedQemuCameraDevice mQemuCameraDevice;
-
- /* Supported frame dimensions reported by the camera device. */
- String8 mFrameDims;
-};
-
-}; /* namespace android */
-
-#endif /* HW_EMULATOR_CAMERA_EMULATED_QEMU_CAMERA_H */
diff --git a/tools/emulator/system/camera/EmulatedQemuCamera2.cpp b/tools/emulator/system/camera/EmulatedQemuCamera2.cpp
deleted file mode 100644
index 2c94f0e31..000000000
--- a/tools/emulator/system/camera/EmulatedQemuCamera2.cpp
+++ /dev/null
@@ -1,55 +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.
- */
-
-/*
- * Contains implementation of a class EmulatedQemuCamera2 that encapsulates
- * functionality of a host webcam with further processing to simulate the
- * capabilities of a v2 camera device.
- */
-
-#define LOG_NDEBUG 0
-#define LOG_TAG "EmulatedCamera_QemuCamera2"
-#include <cutils/log.h>
-#include <cutils/properties.h>
-#include "EmulatedQemuCamera2.h"
-#include "EmulatedCameraFactory.h"
-
-namespace android {
-
-EmulatedQemuCamera2::EmulatedQemuCamera2(int cameraId,
- bool facingBack,
- struct hw_module_t* module)
- : EmulatedCamera2(cameraId,module),
- mFacingBack(facingBack)
-{
- ALOGD("Constructing emulated qemu camera 2 facing %s",
- facingBack ? "back" : "front");
-}
-
-EmulatedQemuCamera2::~EmulatedQemuCamera2()
-{
-}
-
-/****************************************************************************
- * Public API overrides
- ***************************************************************************/
-
-status_t EmulatedQemuCamera2::Initialize()
-{
- return NO_ERROR;
-}
-
-}; /* namespace android */
diff --git a/tools/emulator/system/camera/EmulatedQemuCamera2.h b/tools/emulator/system/camera/EmulatedQemuCamera2.h
deleted file mode 100644
index 520ccce89..000000000
--- a/tools/emulator/system/camera/EmulatedQemuCamera2.h
+++ /dev/null
@@ -1,66 +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.
- */
-
-#ifndef HW_EMULATOR_CAMERA_EMULATED_QEMU_CAMERA2_H
-#define HW_EMULATOR_CAMERA_EMULATED_QEMU_CAMERA2_H
-
-/*
- * Contains declaration of a class EmulatedQemuCamera2 that encapsulates
- * functionality of a host webcam with added processing to implement version 2
- * of the camera device interface.
- */
-
-#include "EmulatedCamera2.h"
-
-namespace android {
-
-/* Encapsulates functionality of an advanced fake camera based on real host camera data.
- */
-class EmulatedQemuCamera2 : public EmulatedCamera2 {
-public:
- /* Constructs EmulatedFakeCamera instance. */
- EmulatedQemuCamera2(int cameraId, bool facingBack, struct hw_module_t* module);
-
- /* Destructs EmulatedFakeCamera instance. */
- ~EmulatedQemuCamera2();
-
- /****************************************************************************
- * EmulatedCamera2 virtual overrides.
- ***************************************************************************/
-
-public:
- /* Initializes EmulatedQemuCamera2 instance. */
- status_t Initialize();
-
- /****************************************************************************
- * EmulatedCamera abstract API implementation.
- ***************************************************************************/
-
-protected:
-
- /****************************************************************************
- * Data memebers.
- ***************************************************************************/
-
-protected:
- /* Facing back (true) or front (false) switch. */
- bool mFacingBack;
-
-};
-
-}; /* namespace android */
-
-#endif /* HW_EMULATOR_CAMERA_EMULATED_QEMU_CAMERA2_H */
diff --git a/tools/emulator/system/camera/EmulatedQemuCameraDevice.cpp b/tools/emulator/system/camera/EmulatedQemuCameraDevice.cpp
deleted file mode 100755
index 07837afd9..000000000
--- a/tools/emulator/system/camera/EmulatedQemuCameraDevice.cpp
+++ /dev/null
@@ -1,265 +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.
- */
-
-/*
- * Contains implementation of a class EmulatedQemuCameraDevice that encapsulates
- * an emulated camera device connected to the host.
- */
-
-#define LOG_NDEBUG 0
-#define LOG_TAG "EmulatedCamera_QemuDevice"
-#include <cutils/log.h>
-#include "EmulatedQemuCamera.h"
-#include "EmulatedQemuCameraDevice.h"
-
-namespace android {
-
-EmulatedQemuCameraDevice::EmulatedQemuCameraDevice(EmulatedQemuCamera* camera_hal)
- : EmulatedCameraDevice(camera_hal),
- mQemuClient(),
- mPreviewFrame(NULL)
-{
-}
-
-EmulatedQemuCameraDevice::~EmulatedQemuCameraDevice()
-{
- if (mPreviewFrame != NULL) {
- delete[] mPreviewFrame;
- }
-}
-
-/****************************************************************************
- * Public API
- ***************************************************************************/
-
-status_t EmulatedQemuCameraDevice::Initialize(const char* device_name)
-{
- /* Connect to the service. */
- char connect_str[256];
- snprintf(connect_str, sizeof(connect_str), "name=%s", device_name);
- status_t res = mQemuClient.connectClient(connect_str);
- if (res != NO_ERROR) {
- return res;
- }
-
- /* Initialize base class. */
- res = EmulatedCameraDevice::Initialize();
- if (res == NO_ERROR) {
- ALOGV("%s: Connected to the emulated camera service '%s'",
- __FUNCTION__, device_name);
- mDeviceName = device_name;
- } else {
- mQemuClient.queryDisconnect();
- }
-
- return res;
-}
-
-/****************************************************************************
- * Emulated camera device abstract interface implementation.
- ***************************************************************************/
-
-status_t EmulatedQemuCameraDevice::connectDevice()
-{
- ALOGV("%s", __FUNCTION__);
-
- Mutex::Autolock locker(&mObjectLock);
- if (!isInitialized()) {
- ALOGE("%s: Qemu camera device is not initialized.", __FUNCTION__);
- return EINVAL;
- }
- if (isConnected()) {
- ALOGW("%s: Qemu camera device '%s' is already connected.",
- __FUNCTION__, (const char*)mDeviceName);
- return NO_ERROR;
- }
-
- /* Connect to the camera device via emulator. */
- const status_t res = mQemuClient.queryConnect();
- if (res == NO_ERROR) {
- ALOGV("%s: Connected to device '%s'",
- __FUNCTION__, (const char*)mDeviceName);
- mState = ECDS_CONNECTED;
- } else {
- ALOGE("%s: Connection to device '%s' failed",
- __FUNCTION__, (const char*)mDeviceName);
- }
-
- return res;
-}
-
-status_t EmulatedQemuCameraDevice::disconnectDevice()
-{
- ALOGV("%s", __FUNCTION__);
-
- Mutex::Autolock locker(&mObjectLock);
- if (!isConnected()) {
- ALOGW("%s: Qemu camera device '%s' is already disconnected.",
- __FUNCTION__, (const char*)mDeviceName);
- return NO_ERROR;
- }
- if (isStarted()) {
- ALOGE("%s: Cannot disconnect from the started device '%s.",
- __FUNCTION__, (const char*)mDeviceName);
- return EINVAL;
- }
-
- /* Disconnect from the camera device via emulator. */
- const status_t res = mQemuClient.queryDisconnect();
- if (res == NO_ERROR) {
- ALOGV("%s: Disonnected from device '%s'",
- __FUNCTION__, (const char*)mDeviceName);
- mState = ECDS_INITIALIZED;
- } else {
- ALOGE("%s: Disconnection from device '%s' failed",
- __FUNCTION__, (const char*)mDeviceName);
- }
-
- return res;
-}
-
-status_t EmulatedQemuCameraDevice::startDevice(int width,
- int height,
- uint32_t pix_fmt)
-{
- ALOGV("%s", __FUNCTION__);
-
- Mutex::Autolock locker(&mObjectLock);
- if (!isConnected()) {
- ALOGE("%s: Qemu camera device '%s' is not connected.",
- __FUNCTION__, (const char*)mDeviceName);
- return EINVAL;
- }
- if (isStarted()) {
- ALOGW("%s: Qemu camera device '%s' is already started.",
- __FUNCTION__, (const char*)mDeviceName);
- return NO_ERROR;
- }
-
- status_t res = EmulatedCameraDevice::commonStartDevice(width, height, pix_fmt);
- if (res != NO_ERROR) {
- ALOGE("%s: commonStartDevice failed", __FUNCTION__);
- return res;
- }
-
- /* Allocate preview frame buffer. */
- /* TODO: Watch out for preview format changes! At this point we implement
- * RGB32 only.*/
- mPreviewFrame = new uint32_t[mTotalPixels];
- if (mPreviewFrame == NULL) {
- ALOGE("%s: Unable to allocate %d bytes for preview frame",
- __FUNCTION__, mTotalPixels);
- return ENOMEM;
- }
-
- /* Start the actual camera device. */
- res = mQemuClient.queryStart(mPixelFormat, mFrameWidth, mFrameHeight);
- if (res == NO_ERROR) {
- ALOGV("%s: Qemu camera device '%s' is started for %.4s[%dx%d] frames",
- __FUNCTION__, (const char*)mDeviceName,
- reinterpret_cast<const char*>(&mPixelFormat),
- mFrameWidth, mFrameHeight);
- mState = ECDS_STARTED;
- } else {
- ALOGE("%s: Unable to start device '%s' for %.4s[%dx%d] frames",
- __FUNCTION__, (const char*)mDeviceName,
- reinterpret_cast<const char*>(&pix_fmt), width, height);
- }
-
- return res;
-}
-
-status_t EmulatedQemuCameraDevice::stopDevice()
-{
- ALOGV("%s", __FUNCTION__);
-
- Mutex::Autolock locker(&mObjectLock);
- if (!isStarted()) {
- ALOGW("%s: Qemu camera device '%s' is not started.",
- __FUNCTION__, (const char*)mDeviceName);
- return NO_ERROR;
- }
-
- /* Stop the actual camera device. */
- status_t res = mQemuClient.queryStop();
- if (res == NO_ERROR) {
- if (mPreviewFrame == NULL) {
- delete[] mPreviewFrame;
- mPreviewFrame = NULL;
- }
- EmulatedCameraDevice::commonStopDevice();
- mState = ECDS_CONNECTED;
- ALOGV("%s: Qemu camera device '%s' is stopped",
- __FUNCTION__, (const char*)mDeviceName);
- } else {
- ALOGE("%s: Unable to stop device '%s'",
- __FUNCTION__, (const char*)mDeviceName);
- }
-
- return res;
-}
-
-/****************************************************************************
- * EmulatedCameraDevice virtual overrides
- ***************************************************************************/
-
-status_t EmulatedQemuCameraDevice::getCurrentPreviewFrame(void* buffer)
-{
- ALOGW_IF(mPreviewFrame == NULL, "%s: No preview frame", __FUNCTION__);
- if (mPreviewFrame != NULL) {
- memcpy(buffer, mPreviewFrame, mTotalPixels * 4);
- return 0;
- } else {
- return EmulatedCameraDevice::getCurrentPreviewFrame(buffer);
- }
-}
-
-/****************************************************************************
- * Worker thread management overrides.
- ***************************************************************************/
-
-bool EmulatedQemuCameraDevice::inWorkerThread()
-{
- /* Wait till FPS timeout expires, or thread exit message is received. */
- WorkerThread::SelectRes res =
- getWorkerThread()->Select(-1, 1000000 / mEmulatedFPS);
- if (res == WorkerThread::EXIT_THREAD) {
- ALOGV("%s: Worker thread has been terminated.", __FUNCTION__);
- return false;
- }
-
- /* Query frames from the service. */
- status_t query_res = mQemuClient.queryFrame(mCurrentFrame, mPreviewFrame,
- mFrameBufferSize,
- mTotalPixels * 4,
- mWhiteBalanceScale[0],
- mWhiteBalanceScale[1],
- mWhiteBalanceScale[2],
- mExposureCompensation);
- if (query_res == NO_ERROR) {
- /* Timestamp the current frame, and notify the camera HAL. */
- mCurFrameTimestamp = systemTime(SYSTEM_TIME_MONOTONIC);
- mCameraHAL->onNextFrameAvailable(mCurrentFrame, mCurFrameTimestamp, this);
- return true;
- } else {
- ALOGE("%s: Unable to get current video frame: %s",
- __FUNCTION__, strerror(query_res));
- mCameraHAL->onCameraDeviceError(CAMERA_ERROR_SERVER_DIED);
- return false;
- }
-}
-
-}; /* namespace android */
diff --git a/tools/emulator/system/camera/EmulatedQemuCameraDevice.h b/tools/emulator/system/camera/EmulatedQemuCameraDevice.h
deleted file mode 100755
index 8ef562b2a..000000000
--- a/tools/emulator/system/camera/EmulatedQemuCameraDevice.h
+++ /dev/null
@@ -1,121 +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.
- */
-
-#ifndef HW_EMULATOR_CAMERA_EMULATED_QEMU_CAMERA_DEVICE_H
-#define HW_EMULATOR_CAMERA_EMULATED_QEMU_CAMERA_DEVICE_H
-
-/*
- * Contains declaration of a class EmulatedQemuCameraDevice that encapsulates
- * an emulated camera device connected to the host.
- */
-
-#include "EmulatedCameraDevice.h"
-#include "QemuClient.h"
-
-namespace android {
-
-class EmulatedQemuCamera;
-
-/* Encapsulates an emulated camera device connected to the host.
- */
-class EmulatedQemuCameraDevice : public EmulatedCameraDevice {
-public:
- /* Constructs EmulatedQemuCameraDevice instance. */
- explicit EmulatedQemuCameraDevice(EmulatedQemuCamera* camera_hal);
-
- /* Destructs EmulatedQemuCameraDevice instance. */
- ~EmulatedQemuCameraDevice();
-
- /***************************************************************************
- * Public API
- **************************************************************************/
-
-public:
- /* Initializes EmulatedQemuCameraDevice instance.
- * Param:
- * device_name - Name of the camera device connected to the host. The name
- * that is used here must have been reported by the 'factory' camera
- * service when it listed camera devices connected to the host.
- * Return:
- * NO_ERROR on success, or an appropriate error status.
- */
- status_t Initialize(const char* device_name);
-
- /***************************************************************************
- * Emulated camera device abstract interface implementation.
- * See declarations of these methods in EmulatedCameraDevice class for
- * information on each of these methods.
- **************************************************************************/
-
-public:
- /* Connects to the camera device. */
- status_t connectDevice();
-
- /* Disconnects from the camera device. */
- status_t disconnectDevice();
-
- /* Starts capturing frames from the camera device. */
- status_t startDevice(int width, int height, uint32_t pix_fmt);
-
- /* Stops capturing frames from the camera device. */
- status_t stopDevice();
-
- /***************************************************************************
- * EmulatedCameraDevice virtual overrides
- * See declarations of these methods in EmulatedCameraDevice class for
- * information on each of these methods.
- **************************************************************************/
-
-public:
- /* Gets current preview fame into provided buffer.
- * We override this method in order to provide preview frames cached in this
- * object.
- */
- status_t getCurrentPreviewFrame(void* buffer);
-
- /***************************************************************************
- * Worker thread management overrides.
- * See declarations of these methods in EmulatedCameraDevice class for
- * information on each of these methods.
- **************************************************************************/
-
-protected:
- /* Implementation of the worker thread routine. */
- bool inWorkerThread();
-
- /***************************************************************************
- * Qemu camera device data members
- **************************************************************************/
-
-private:
- /* Qemu client that is used to communicate with the 'emulated camera'
- * service, created for this instance in the emulator. */
- CameraQemuClient mQemuClient;
-
- /* Name of the camera device connected to the host. */
- String8 mDeviceName;
-
- /* Current preview framebuffer. */
- uint32_t* mPreviewFrame;
-
- /* Emulated FPS (frames per second).
- * We will emulate 50 FPS. */
- static const int mEmulatedFPS = 50;
-};
-
-}; /* namespace android */
-
-#endif /* HW_EMULATOR_CAMERA_EMULATED_QEMU_CAMERA_DEVICE_H */
diff --git a/tools/emulator/system/camera/JpegCompressor.cpp b/tools/emulator/system/camera/JpegCompressor.cpp
deleted file mode 100644
index 8eec52df5..000000000
--- a/tools/emulator/system/camera/JpegCompressor.cpp
+++ /dev/null
@@ -1,64 +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.
- */
-
-/*
- * Contains implementation of a class NV21JpegCompressor that encapsulates a
- * converter between NV21, and JPEG formats.
- */
-
-#define LOG_NDEBUG 0
-#define LOG_TAG "EmulatedCamera_JPEG"
-#include <cutils/log.h>
-#include "JpegCompressor.h"
-
-namespace android {
-
-NV21JpegCompressor::NV21JpegCompressor()
- : Yuv420SpToJpegEncoder(mStrides)
-{
-}
-
-NV21JpegCompressor::~NV21JpegCompressor()
-{
-}
-
-/****************************************************************************
- * Public API
- ***************************************************************************/
-
-status_t NV21JpegCompressor::compressRawImage(const void* image,
- int width,
- int height,
- int quality)
-{
- ALOGV("%s: %p[%dx%d]", __FUNCTION__, image, width, height);
- void* pY = const_cast<void*>(image);
- int offsets[2];
- offsets[0] = 0;
- offsets[1] = width * height;
- mStrides[0] = width;
- mStrides[1] = width;
- if (encode(&mStream, pY, width, height, offsets, quality)) {
- ALOGV("%s: Compressed JPEG: %d[%dx%d] -> %d bytes",
- __FUNCTION__, (width * height * 12) / 8, width, height, mStream.getOffset());
- return NO_ERROR;
- } else {
- ALOGE("%s: JPEG compression failed", __FUNCTION__);
- return errno ? errno : EINVAL;
- }
-}
-
-}; /* namespace android */
diff --git a/tools/emulator/system/camera/JpegCompressor.h b/tools/emulator/system/camera/JpegCompressor.h
deleted file mode 100644
index 504ffcd2f..000000000
--- a/tools/emulator/system/camera/JpegCompressor.h
+++ /dev/null
@@ -1,98 +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.
- */
-
-#ifndef HW_EMULATOR_CAMERA_JPEG_COMPRESSOR_H
-#define HW_EMULATOR_CAMERA_JPEG_COMPRESSOR_H
-
-/*
- * Contains declaration of a class NV21JpegCompressor that encapsulates a
- * converter between YV21, and JPEG formats.
- */
-
-#include <YuvToJpegEncoder.h>
-#include <utils/threads.h>
-
-namespace android {
-
-/* Encapsulates a converter between YV12, and JPEG formats.
- */
-class NV21JpegCompressor : protected Yuv420SpToJpegEncoder
-{
-public:
- /* Constructs JpegCompressor instance. */
- NV21JpegCompressor();
- /* Destructs JpegCompressor instance. */
- ~NV21JpegCompressor();
-
- /****************************************************************************
- * Public API
- ***************************************************************************/
-
-public:
- /* Compresses raw NV21 image into a JPEG.
- * The compressed image will be saved in mStream member of this class. Use
- * getCompressedSize method to obtain buffer size of the compressed image,
- * and getCompressedImage to copy out the compressed image.
- * Param:
- * image - Raw NV21 image.
- * width, height - Image dimensions.
- * quality - JPEG quality.
- * Return:
- * NO_ERROR on success, or an appropriate error status.
- *
- */
- status_t compressRawImage(const void* image,
- int width,
- int height,
- int quality);
-
- /* Get size of the compressed JPEG buffer.
- * This method must be called only after a successful completion of
- * compressRawImage call.
- * Return:
- * Size of the compressed JPEG buffer.
- */
- size_t getCompressedSize() const
- {
- return mStream.getOffset();
- }
-
- /* Copies out compressed JPEG buffer.
- * This method must be called only after a successful completion of
- * compressRawImage call.
- * Param:
- * buff - Buffer where to copy the JPEG. Must be large enough to contain the
- * entire image.
- */
- void getCompressedImage(void* buff) const
- {
- mStream.copyTo(buff);
- }
-
- /****************************************************************************
- * Class data
- ***************************************************************************/
-
-protected:
- /* Memory stream where converted JPEG is saved. */
- SkDynamicMemoryWStream mStream;
- /* Strides for Y (the first element), and UV (the second one) panes. */
- int mStrides[2];
-};
-
-}; /* namespace android */
-
-#endif /* HW_EMULATOR_CAMERA_JPEG_COMPRESSOR_H */
diff --git a/tools/emulator/system/camera/PreviewWindow.cpp b/tools/emulator/system/camera/PreviewWindow.cpp
deleted file mode 100755
index 4101ed965..000000000
--- a/tools/emulator/system/camera/PreviewWindow.cpp
+++ /dev/null
@@ -1,216 +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.
- */
-
-/*
- * Contains implementation of a class PreviewWindow that encapsulates
- * functionality of a preview window set via set_preview_window camera HAL API.
- */
-
-#define LOG_NDEBUG 0
-#define LOG_TAG "EmulatedCamera_Preview"
-#include <cutils/log.h>
-#include <ui/Rect.h>
-#include <ui/GraphicBufferMapper.h>
-#include "EmulatedCameraDevice.h"
-#include "PreviewWindow.h"
-
-namespace android {
-
-PreviewWindow::PreviewWindow()
- : mPreviewWindow(NULL),
- mLastPreviewed(0),
- mPreviewFrameWidth(0),
- mPreviewFrameHeight(0),
- mPreviewEnabled(false)
-{
-}
-
-PreviewWindow::~PreviewWindow()
-{
-}
-
-/****************************************************************************
- * Camera API
- ***************************************************************************/
-
-status_t PreviewWindow::setPreviewWindow(struct preview_stream_ops* window,
- int preview_fps)
-{
- ALOGV("%s: current: %p -> new: %p", __FUNCTION__, mPreviewWindow, window);
-
- status_t res = NO_ERROR;
- Mutex::Autolock locker(&mObjectLock);
-
- /* Reset preview info. */
- mPreviewFrameWidth = mPreviewFrameHeight = 0;
- mPreviewAfter = 0;
- mLastPreviewed = 0;
-
- if (window != NULL) {
- /* The CPU will write each frame to the preview window buffer.
- * Note that we delay setting preview window buffer geometry until
- * frames start to come in. */
- res = window->set_usage(window, GRALLOC_USAGE_SW_WRITE_OFTEN);
- if (res == NO_ERROR) {
- /* Set preview frequency. */
- mPreviewAfter = 1000000 / preview_fps;
- } else {
- window = NULL;
- res = -res; // set_usage returns a negative errno.
- ALOGE("%s: Error setting preview window usage %d -> %s",
- __FUNCTION__, res, strerror(res));
- }
- }
- mPreviewWindow = window;
-
- return res;
-}
-
-status_t PreviewWindow::startPreview()
-{
- ALOGV("%s", __FUNCTION__);
-
- Mutex::Autolock locker(&mObjectLock);
- mPreviewEnabled = true;
-
- return NO_ERROR;
-}
-
-void PreviewWindow::stopPreview()
-{
- ALOGV("%s", __FUNCTION__);
-
- Mutex::Autolock locker(&mObjectLock);
- mPreviewEnabled = false;
-}
-
-/****************************************************************************
- * Public API
- ***************************************************************************/
-
-void PreviewWindow::onNextFrameAvailable(const void* frame,
- nsecs_t timestamp,
- EmulatedCameraDevice* camera_dev)
-{
- int res;
- Mutex::Autolock locker(&mObjectLock);
-
- if (!isPreviewEnabled() || mPreviewWindow == NULL || !isPreviewTime()) {
- return;
- }
-
- /* Make sure that preview window dimensions are OK with the camera device */
- if (adjustPreviewDimensions(camera_dev)) {
- /* Need to set / adjust buffer geometry for the preview window.
- * Note that in the emulator preview window uses only RGB for pixel
- * formats. */
- ALOGV("%s: Adjusting preview windows %p geometry to %dx%d",
- __FUNCTION__, mPreviewWindow, mPreviewFrameWidth,
- mPreviewFrameHeight);
- res = mPreviewWindow->set_buffers_geometry(mPreviewWindow,
- mPreviewFrameWidth,
- mPreviewFrameHeight,
- HAL_PIXEL_FORMAT_RGBA_8888);
- if (res != NO_ERROR) {
- ALOGE("%s: Error in set_buffers_geometry %d -> %s",
- __FUNCTION__, -res, strerror(-res));
- return;
- }
- }
-
- /*
- * Push new frame to the preview window.
- */
-
- /* Dequeue preview window buffer for the frame. */
- buffer_handle_t* buffer = NULL;
- int stride = 0;
- res = mPreviewWindow->dequeue_buffer(mPreviewWindow, &buffer, &stride);
- if (res != NO_ERROR || buffer == NULL) {
- ALOGE("%s: Unable to dequeue preview window buffer: %d -> %s",
- __FUNCTION__, -res, strerror(-res));
- return;
- }
-
- /* Let the preview window to lock the buffer. */
- res = mPreviewWindow->lock_buffer(mPreviewWindow, buffer);
- if (res != NO_ERROR) {
- ALOGE("%s: Unable to lock preview window buffer: %d -> %s",
- __FUNCTION__, -res, strerror(-res));
- mPreviewWindow->cancel_buffer(mPreviewWindow, buffer);
- return;
- }
-
- /* Now let the graphics framework to lock the buffer, and provide
- * us with the framebuffer data address. */
- void* img = NULL;
- const Rect rect(mPreviewFrameWidth, mPreviewFrameHeight);
- GraphicBufferMapper& grbuffer_mapper(GraphicBufferMapper::get());
- res = grbuffer_mapper.lock(*buffer, GRALLOC_USAGE_SW_WRITE_OFTEN, rect, &img);
- if (res != NO_ERROR) {
- ALOGE("%s: grbuffer_mapper.lock failure: %d -> %s",
- __FUNCTION__, res, strerror(res));
- mPreviewWindow->cancel_buffer(mPreviewWindow, buffer);
- return;
- }
-
- /* Frames come in in YV12/NV12/NV21 format. Since preview window doesn't
- * supports those formats, we need to obtain the frame in RGB565. */
- res = camera_dev->getCurrentPreviewFrame(img);
- if (res == NO_ERROR) {
- /* Show it. */
- mPreviewWindow->set_timestamp(mPreviewWindow, timestamp);
- mPreviewWindow->enqueue_buffer(mPreviewWindow, buffer);
- } else {
- ALOGE("%s: Unable to obtain preview frame: %d", __FUNCTION__, res);
- mPreviewWindow->cancel_buffer(mPreviewWindow, buffer);
- }
- grbuffer_mapper.unlock(*buffer);
-}
-
-/***************************************************************************
- * Private API
- **************************************************************************/
-
-bool PreviewWindow::adjustPreviewDimensions(EmulatedCameraDevice* camera_dev)
-{
- /* Match the cached frame dimensions against the actual ones. */
- if (mPreviewFrameWidth == camera_dev->getFrameWidth() &&
- mPreviewFrameHeight == camera_dev->getFrameHeight()) {
- /* They match. */
- return false;
- }
-
- /* They don't match: adjust the cache. */
- mPreviewFrameWidth = camera_dev->getFrameWidth();
- mPreviewFrameHeight = camera_dev->getFrameHeight();
-
- return true;
-}
-
-bool PreviewWindow::isPreviewTime()
-{
- timeval cur_time;
- gettimeofday(&cur_time, NULL);
- const uint64_t cur_mks = cur_time.tv_sec * 1000000LL + cur_time.tv_usec;
- if ((cur_mks - mLastPreviewed) >= mPreviewAfter) {
- mLastPreviewed = cur_mks;
- return true;
- }
- return false;
-}
-
-}; /* namespace android */
diff --git a/tools/emulator/system/camera/PreviewWindow.h b/tools/emulator/system/camera/PreviewWindow.h
deleted file mode 100755
index d037c95de..000000000
--- a/tools/emulator/system/camera/PreviewWindow.h
+++ /dev/null
@@ -1,165 +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.
- */
-
-#ifndef HW_EMULATOR_CAMERA_PREVIEW_WINDOW_H
-#define HW_EMULATOR_CAMERA_PREVIEW_WINDOW_H
-
-/*
- * Contains declaration of a class PreviewWindow that encapsulates functionality
- * of a preview window set via set_preview_window camera HAL API.
- */
-
-namespace android {
-
-class EmulatedCameraDevice;
-
-/* Encapsulates functionality of a preview window set via set_preview_window
- * camera HAL API.
- *
- * Objects of this class are contained in EmulatedCamera objects, and handle
- * relevant camera API callbacks.
- */
-class PreviewWindow {
-public:
- /* Constructs PreviewWindow instance. */
- PreviewWindow();
-
- /* Destructs PreviewWindow instance. */
- ~PreviewWindow();
-
- /***************************************************************************
- * Camera API
- **************************************************************************/
-
-public:
- /* Actual handler for camera_device_ops_t::set_preview_window callback.
- * This method is called by the containing emulated camera object when it is
- * handing the camera_device_ops_t::set_preview_window callback.
- * Param:
- * window - Preview window to set. This parameter might be NULL, which
- * indicates preview window reset.
- * preview_fps - Preview's frame frequency. This parameter determins when
- * a frame received via onNextFrameAvailable call will be pushed to
- * the preview window. If 'window' parameter passed to this method is
- * NULL, this parameter is ignored.
- * Return:
- * NO_ERROR on success, or an appropriate error status.
- */
- status_t setPreviewWindow(struct preview_stream_ops* window,
- int preview_fps);
-
- /* Starts the preview.
- * This method is called by the containing emulated camera object when it is
- * handing the camera_device_ops_t::start_preview callback.
- */
- status_t startPreview();
-
- /* Stops the preview.
- * This method is called by the containing emulated camera object when it is
- * handing the camera_device_ops_t::start_preview callback.
- */
- void stopPreview();
-
- /* Checks if preview is enabled. */
- inline bool isPreviewEnabled()
- {
- return mPreviewEnabled;
- }
-
- /****************************************************************************
- * Public API
- ***************************************************************************/
-
-public:
- /* Next frame is available in the camera device.
- * This is a notification callback that is invoked by the camera device when
- * a new frame is available.
- * Note that most likely this method is called in context of a worker thread
- * that camera device has created for frame capturing.
- * Param:
- * frame - Captured frame, or NULL if camera device didn't pull the frame
- * yet. If NULL is passed in this parameter use GetCurrentFrame method
- * of the camera device class to obtain the next frame. Also note that
- * the size of the frame that is passed here (as well as the frame
- * returned from the GetCurrentFrame method) is defined by the current
- * frame settings (width + height + pixel format) for the camera device.
- * timestamp - Frame's timestamp.
- * camera_dev - Camera device instance that delivered the frame.
- */
- void onNextFrameAvailable(const void* frame,
- nsecs_t timestamp,
- EmulatedCameraDevice* camera_dev);
-
- /***************************************************************************
- * Private API
- **************************************************************************/
-
-protected:
- /* Adjusts cached dimensions of the preview window frame according to the
- * frame dimensions used by the camera device.
- *
- * When preview is started, it's not known (hard to define) what are going
- * to be the dimensions of the frames that are going to be displayed. Plus,
- * it might be possible, that such dimensions can be changed on the fly. So,
- * in order to be always in sync with frame dimensions, this method is
- * called for each frame passed to onNextFrameAvailable method, in order to
- * properly adjust frame dimensions, used by the preview window.
- * Note that this method must be called while object is locked.
- * Param:
- * camera_dev - Camera device, prpviding frames displayed in the preview
- * window.
- * Return:
- * true if cached dimensions have been adjusted, or false if cached
- * dimensions match device's frame dimensions.
- */
- bool adjustPreviewDimensions(EmulatedCameraDevice* camera_dev);
-
- /* Checks if it's the time to push new frame to the preview window.
- * Note that this method must be called while object is locked. */
- bool isPreviewTime();
-
- /***************************************************************************
- * Data members
- **************************************************************************/
-
-protected:
- /* Locks this instance for data changes. */
- Mutex mObjectLock;
-
- /* Preview window instance. */
- preview_stream_ops* mPreviewWindow;
-
- /* Timestamp (abs. microseconds) when last frame has been pushed to the
- * preview window. */
- uint64_t mLastPreviewed;
-
- /* Preview frequency in microseconds. */
- uint32_t mPreviewAfter;
-
- /*
- * Cached preview window frame dimensions.
- */
-
- int mPreviewFrameWidth;
- int mPreviewFrameHeight;
-
- /* Preview status. */
- bool mPreviewEnabled;
-};
-
-}; /* namespace android */
-
-#endif /* HW_EMULATOR_CAMERA_PREVIEW_WINDOW_H */
diff --git a/tools/emulator/system/camera/QemuClient.cpp b/tools/emulator/system/camera/QemuClient.cpp
deleted file mode 100755
index 17e6f98ba..000000000
--- a/tools/emulator/system/camera/QemuClient.cpp
+++ /dev/null
@@ -1,559 +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.
- */
-
-/*
- * Contains implementation of classes that encapsulate connection to camera
- * services in the emulator via qemu pipe.
- */
-
-#define LOG_NDEBUG 1
-#define LOG_TAG "EmulatedCamera_QemuClient"
-#include <cutils/log.h>
-#include "EmulatedCamera.h"
-#include "QemuClient.h"
-
-#define LOG_QUERIES 0
-#if LOG_QUERIES
-#define LOGQ(...) ALOGD(__VA_ARGS__)
-#else
-#define LOGQ(...) (void(0))
-
-#endif // LOG_QUERIES
-namespace android {
-
-/****************************************************************************
- * Qemu query
- ***************************************************************************/
-
-QemuQuery::QemuQuery()
- : mQuery(mQueryPrealloc),
- mQueryDeliveryStatus(NO_ERROR),
- mReplyBuffer(NULL),
- mReplyData(NULL),
- mReplySize(0),
- mReplyDataSize(0),
- mReplyStatus(0)
-{
- *mQuery = '\0';
-}
-
-QemuQuery::QemuQuery(const char* query_string)
- : mQuery(mQueryPrealloc),
- mQueryDeliveryStatus(NO_ERROR),
- mReplyBuffer(NULL),
- mReplyData(NULL),
- mReplySize(0),
- mReplyDataSize(0),
- mReplyStatus(0)
-{
- mQueryDeliveryStatus = QemuQuery::createQuery(query_string, NULL);
-}
-
-QemuQuery::QemuQuery(const char* query_name, const char* query_param)
- : mQuery(mQueryPrealloc),
- mQueryDeliveryStatus(NO_ERROR),
- mReplyBuffer(NULL),
- mReplyData(NULL),
- mReplySize(0),
- mReplyDataSize(0),
- mReplyStatus(0)
-{
- mQueryDeliveryStatus = QemuQuery::createQuery(query_name, query_param);
-}
-
-QemuQuery::~QemuQuery()
-{
- QemuQuery::resetQuery();
-}
-
-status_t QemuQuery::createQuery(const char* name, const char* param)
-{
- /* Reset from the previous use. */
- resetQuery();
-
- /* Query name cannot be NULL or an empty string. */
- if (name == NULL || *name == '\0') {
- ALOGE("%s: NULL or an empty string is passed as query name.",
- __FUNCTION__);
- mQueryDeliveryStatus = EINVAL;
- return EINVAL;
- }
-
- const size_t name_len = strlen(name);
- const size_t param_len = (param != NULL) ? strlen(param) : 0;
- const size_t required = strlen(name) + (param_len ? (param_len + 2) : 1);
-
- if (required > sizeof(mQueryPrealloc)) {
- /* Preallocated buffer was too small. Allocate a bigger query buffer. */
- mQuery = new char[required];
- if (mQuery == NULL) {
- ALOGE("%s: Unable to allocate %d bytes for query buffer",
- __FUNCTION__, required);
- mQueryDeliveryStatus = ENOMEM;
- return ENOMEM;
- }
- }
-
- /* At this point mQuery buffer is big enough for the query. */
- if (param_len) {
- sprintf(mQuery, "%s %s", name, param);
- } else {
- memcpy(mQuery, name, name_len + 1);
- }
-
- return NO_ERROR;
-}
-
-status_t QemuQuery::completeQuery(status_t status)
-{
- /* Save query completion status. */
- mQueryDeliveryStatus = status;
- if (mQueryDeliveryStatus != NO_ERROR) {
- return mQueryDeliveryStatus;
- }
-
- /* Make sure reply buffer contains at least 'ok', or 'ko'.
- * Note that 'ok', or 'ko' prefixes are always 3 characters long: in case
- * there are more data in the reply, that data will be separated from 'ok'/'ko'
- * with a ':'. If there is no more data in the reply, the prefix will be
- * zero-terminated, and the terminator will be inculded in the reply. */
- if (mReplyBuffer == NULL || mReplySize < 3) {
- ALOGE("%s: Invalid reply to the query", __FUNCTION__);
- mQueryDeliveryStatus = EINVAL;
- return EINVAL;
- }
-
- /* Lets see the reply status. */
- if (!memcmp(mReplyBuffer, "ok", 2)) {
- mReplyStatus = 1;
- } else if (!memcmp(mReplyBuffer, "ko", 2)) {
- mReplyStatus = 0;
- } else {
- ALOGE("%s: Invalid query reply: '%s'", __FUNCTION__, mReplyBuffer);
- mQueryDeliveryStatus = EINVAL;
- return EINVAL;
- }
-
- /* Lets see if there are reply data that follow. */
- if (mReplySize > 3) {
- /* There are extra data. Make sure they are separated from the status
- * with a ':' */
- if (mReplyBuffer[2] != ':') {
- ALOGE("%s: Invalid query reply: '%s'", __FUNCTION__, mReplyBuffer);
- mQueryDeliveryStatus = EINVAL;
- return EINVAL;
- }
- mReplyData = mReplyBuffer + 3;
- mReplyDataSize = mReplySize - 3;
- } else {
- /* Make sure reply buffer containing just 'ok'/'ko' ends with
- * zero-terminator. */
- if (mReplyBuffer[2] != '\0') {
- ALOGE("%s: Invalid query reply: '%s'", __FUNCTION__, mReplyBuffer);
- mQueryDeliveryStatus = EINVAL;
- return EINVAL;
- }
- }
-
- return NO_ERROR;
-}
-
-void QemuQuery::resetQuery()
-{
- if (mQuery != NULL && mQuery != mQueryPrealloc) {
- delete[] mQuery;
- }
- mQuery = mQueryPrealloc;
- mQueryDeliveryStatus = NO_ERROR;
- if (mReplyBuffer != NULL) {
- free(mReplyBuffer);
- mReplyBuffer = NULL;
- }
- mReplyData = NULL;
- mReplySize = mReplyDataSize = 0;
- mReplyStatus = 0;
-}
-
-/****************************************************************************
- * Qemu client base
- ***************************************************************************/
-
-/* Camera service name. */
-const char QemuClient::mCameraServiceName[] = "camera";
-
-QemuClient::QemuClient()
- : mPipeFD(-1)
-{
-}
-
-QemuClient::~QemuClient()
-{
- if (mPipeFD >= 0) {
- close(mPipeFD);
- }
-}
-
-/****************************************************************************
- * Qemu client API
- ***************************************************************************/
-
-status_t QemuClient::connectClient(const char* param)
-{
- ALOGV("%s: '%s'", __FUNCTION__, param ? param : "");
-
- /* Make sure that client is not connected already. */
- if (mPipeFD >= 0) {
- ALOGE("%s: Qemu client is already connected", __FUNCTION__);
- return EINVAL;
- }
-
- /* Select one of the two: 'factory', or 'emulated camera' service */
- if (param == NULL || *param == '\0') {
- /* No parameters: connect to the factory service. */
- char pipe_name[512];
- snprintf(pipe_name, sizeof(pipe_name), "qemud:%s", mCameraServiceName);
- mPipeFD = qemu_pipe_open(pipe_name);
- } else {
- /* One extra char ':' that separates service name and parameters + six
- * characters for 'qemud:'. This is required by qemu pipe protocol. */
- char* connection_str = new char[strlen(mCameraServiceName) +
- strlen(param) + 8];
- sprintf(connection_str, "qemud:%s:%s", mCameraServiceName, param);
-
- mPipeFD = qemu_pipe_open(connection_str);
- delete[] connection_str;
- }
- if (mPipeFD < 0) {
- ALOGE("%s: Unable to connect to the camera service '%s': %s",
- __FUNCTION__, param ? param : "Factory", strerror(errno));
- return errno ? errno : EINVAL;
- }
-
- return NO_ERROR;
-}
-
-void QemuClient::disconnectClient()
-{
- ALOGV("%s", __FUNCTION__);
-
- if (mPipeFD >= 0) {
- close(mPipeFD);
- mPipeFD = -1;
- }
-}
-
-status_t QemuClient::sendMessage(const void* data, size_t data_size)
-{
- if (mPipeFD < 0) {
- ALOGE("%s: Qemu client is not connected", __FUNCTION__);
- return EINVAL;
- }
-
- /* Note that we don't use here qemud_client_send, since with qemu pipes we
- * don't need to provide payload size prior to payload when we're writing to
- * the pipe. So, we can use simple write, and qemu pipe will take care of the
- * rest, calling the receiving end with the number of bytes transferred. */
- const size_t written = qemud_fd_write(mPipeFD, data, data_size);
- if (written == data_size) {
- return NO_ERROR;
- } else {
- ALOGE("%s: Error sending data via qemu pipe: '%s'",
- __FUNCTION__, strerror(errno));
- return errno ? errno : EIO;
- }
-}
-
-status_t QemuClient::receiveMessage(void** data, size_t* data_size)
-{
- *data = NULL;
- *data_size = 0;
-
- if (mPipeFD < 0) {
- ALOGE("%s: Qemu client is not connected", __FUNCTION__);
- return EINVAL;
- }
-
- /* The way the service replies to a query, it sends payload size first, and
- * then it sends the payload itself. Note that payload size is sent as a
- * string, containing 8 characters representing a hexadecimal payload size
- * value. Note also, that the string doesn't contain zero-terminator. */
- size_t payload_size;
- char payload_size_str[9];
- int rd_res = qemud_fd_read(mPipeFD, payload_size_str, 8);
- if (rd_res != 8) {
- ALOGE("%s: Unable to obtain payload size: %s",
- __FUNCTION__, strerror(errno));
- return errno ? errno : EIO;
- }
-
- /* Convert payload size. */
- errno = 0;
- payload_size_str[8] = '\0';
- payload_size = strtol(payload_size_str, NULL, 16);
- if (errno) {
- ALOGE("%s: Invalid payload size '%s'", __FUNCTION__, payload_size_str);
- return EIO;
- }
-
- /* Allocate payload data buffer, and read the payload there. */
- *data = malloc(payload_size);
- if (*data == NULL) {
- ALOGE("%s: Unable to allocate %d bytes payload buffer",
- __FUNCTION__, payload_size);
- return ENOMEM;
- }
- rd_res = qemud_fd_read(mPipeFD, *data, payload_size);
- if (static_cast<size_t>(rd_res) == payload_size) {
- *data_size = payload_size;
- return NO_ERROR;
- } else {
- ALOGE("%s: Read size %d doesnt match expected payload size %d: %s",
- __FUNCTION__, rd_res, payload_size, strerror(errno));
- free(*data);
- *data = NULL;
- return errno ? errno : EIO;
- }
-}
-
-status_t QemuClient::doQuery(QemuQuery* query)
-{
- /* Make sure that query has been successfuly constructed. */
- if (query->mQueryDeliveryStatus != NO_ERROR) {
- ALOGE("%s: Query is invalid", __FUNCTION__);
- return query->mQueryDeliveryStatus;
- }
-
- LOGQ("Send query '%s'", query->mQuery);
-
- /* Send the query. */
- status_t res = sendMessage(query->mQuery, strlen(query->mQuery) + 1);
- if (res == NO_ERROR) {
- /* Read the response. */
- res = receiveMessage(reinterpret_cast<void**>(&query->mReplyBuffer),
- &query->mReplySize);
- if (res == NO_ERROR) {
- LOGQ("Response to query '%s': Status = '%.2s', %d bytes in response",
- query->mQuery, query->mReplyBuffer, query->mReplySize);
- } else {
- ALOGE("%s Response to query '%s' has failed: %s",
- __FUNCTION__, query->mQuery, strerror(res));
- }
- } else {
- ALOGE("%s: Send query '%s' failed: %s",
- __FUNCTION__, query->mQuery, strerror(res));
- }
-
- /* Complete the query, and return its completion handling status. */
- const status_t res1 = query->completeQuery(res);
- ALOGE_IF(res1 != NO_ERROR && res1 != res,
- "%s: Error %d in query '%s' completion",
- __FUNCTION__, res1, query->mQuery);
- return res1;
-}
-
-/****************************************************************************
- * Qemu client for the 'factory' service.
- ***************************************************************************/
-
-/*
- * Factory service queries.
- */
-
-/* Queries list of cameras connected to the host. */
-const char FactoryQemuClient::mQueryList[] = "list";
-
-FactoryQemuClient::FactoryQemuClient()
- : QemuClient()
-{
-}
-
-FactoryQemuClient::~FactoryQemuClient()
-{
-}
-
-status_t FactoryQemuClient::listCameras(char** list)
-{
- ALOGV("%s", __FUNCTION__);
-
- QemuQuery query(mQueryList);
- if (doQuery(&query) || !query.isQuerySucceeded()) {
- ALOGE("%s: List cameras query failed: %s", __FUNCTION__,
- query.mReplyData ? query.mReplyData : "No error message");
- return query.getCompletionStatus();
- }
-
- /* Make sure there is a list returned. */
- if (query.mReplyDataSize == 0) {
- ALOGE("%s: No camera list is returned.", __FUNCTION__);
- return EINVAL;
- }
-
- /* Copy the list over. */
- *list = (char*)malloc(query.mReplyDataSize);
- if (*list != NULL) {
- memcpy(*list, query.mReplyData, query.mReplyDataSize);
- ALOGD("Emulated camera list: %s", *list);
- return NO_ERROR;
- } else {
- ALOGE("%s: Unable to allocate %d bytes",
- __FUNCTION__, query.mReplyDataSize);
- return ENOMEM;
- }
-}
-
-/****************************************************************************
- * Qemu client for an 'emulated camera' service.
- ***************************************************************************/
-
-/*
- * Emulated camera queries
- */
-
-/* Connect to the camera device. */
-const char CameraQemuClient::mQueryConnect[] = "connect";
-/* Disconect from the camera device. */
-const char CameraQemuClient::mQueryDisconnect[] = "disconnect";
-/* Start capturing video from the camera device. */
-const char CameraQemuClient::mQueryStart[] = "start";
-/* Stop capturing video from the camera device. */
-const char CameraQemuClient::mQueryStop[] = "stop";
-/* Get next video frame from the camera device. */
-const char CameraQemuClient::mQueryFrame[] = "frame";
-
-CameraQemuClient::CameraQemuClient()
- : QemuClient()
-{
-}
-
-CameraQemuClient::~CameraQemuClient()
-{
-
-}
-
-status_t CameraQemuClient::queryConnect()
-{
- ALOGV("%s", __FUNCTION__);
-
- QemuQuery query(mQueryConnect);
- doQuery(&query);
- const status_t res = query.getCompletionStatus();
- ALOGE_IF(res != NO_ERROR, "%s: Query failed: %s",
- __FUNCTION__, query.mReplyData ? query.mReplyData :
- "No error message");
- return res;
-}
-
-status_t CameraQemuClient::queryDisconnect()
-{
- ALOGV("%s", __FUNCTION__);
-
- QemuQuery query(mQueryDisconnect);
- doQuery(&query);
- const status_t res = query.getCompletionStatus();
- ALOGE_IF(res != NO_ERROR, "%s: Query failed: %s",
- __FUNCTION__, query.mReplyData ? query.mReplyData :
- "No error message");
- return res;
-}
-
-status_t CameraQemuClient::queryStart(uint32_t pixel_format,
- int width,
- int height)
-{
- ALOGV("%s", __FUNCTION__);
-
- char query_str[256];
- snprintf(query_str, sizeof(query_str), "%s dim=%dx%d pix=%d",
- mQueryStart, width, height, pixel_format);
- QemuQuery query(query_str);
- doQuery(&query);
- const status_t res = query.getCompletionStatus();
- ALOGE_IF(res != NO_ERROR, "%s: Query failed: %s",
- __FUNCTION__, query.mReplyData ? query.mReplyData :
- "No error message");
- return res;
-}
-
-status_t CameraQemuClient::queryStop()
-{
- ALOGV("%s", __FUNCTION__);
-
- QemuQuery query(mQueryStop);
- doQuery(&query);
- const status_t res = query.getCompletionStatus();
- ALOGE_IF(res != NO_ERROR, "%s: Query failed: %s",
- __FUNCTION__, query.mReplyData ? query.mReplyData :
- "No error message");
- return res;
-}
-
-status_t CameraQemuClient::queryFrame(void* vframe,
- void* pframe,
- size_t vframe_size,
- size_t pframe_size,
- float r_scale,
- float g_scale,
- float b_scale,
- float exposure_comp)
-{
- ALOGV("%s", __FUNCTION__);
-
- char query_str[256];
- snprintf(query_str, sizeof(query_str), "%s video=%d preview=%d whiteb=%g,%g,%g expcomp=%g",
- mQueryFrame, (vframe && vframe_size) ? vframe_size : 0,
- (pframe && pframe_size) ? pframe_size : 0, r_scale, g_scale, b_scale,
- exposure_comp);
- QemuQuery query(query_str);
- doQuery(&query);
- const status_t res = query.getCompletionStatus();
- if( res != NO_ERROR) {
- ALOGE("%s: Query failed: %s",
- __FUNCTION__, query.mReplyData ? query.mReplyData :
- "No error message");
- return res;
- }
-
- /* Copy requested frames. */
- size_t cur_offset = 0;
- const uint8_t* frame = reinterpret_cast<const uint8_t*>(query.mReplyData);
- /* Video frame is always first. */
- if (vframe != NULL && vframe_size != 0) {
- /* Make sure that video frame is in. */
- if ((query.mReplyDataSize - cur_offset) >= vframe_size) {
- memcpy(vframe, frame, vframe_size);
- cur_offset += vframe_size;
- } else {
- ALOGE("%s: Reply %d bytes is to small to contain %d bytes video frame",
- __FUNCTION__, query.mReplyDataSize - cur_offset, vframe_size);
- return EINVAL;
- }
- }
- if (pframe != NULL && pframe_size != 0) {
- /* Make sure that preview frame is in. */
- if ((query.mReplyDataSize - cur_offset) >= pframe_size) {
- memcpy(pframe, frame + cur_offset, pframe_size);
- cur_offset += pframe_size;
- } else {
- ALOGE("%s: Reply %d bytes is to small to contain %d bytes preview frame",
- __FUNCTION__, query.mReplyDataSize - cur_offset, pframe_size);
- return EINVAL;
- }
- }
-
- return NO_ERROR;
-}
-
-}; /* namespace android */
diff --git a/tools/emulator/system/camera/QemuClient.h b/tools/emulator/system/camera/QemuClient.h
deleted file mode 100755
index 16443211f..000000000
--- a/tools/emulator/system/camera/QemuClient.h
+++ /dev/null
@@ -1,437 +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.
- */
-
-#ifndef HW_EMULATOR_CAMERA_QEMU_CLIENT_H
-#define HW_EMULATOR_CAMERA_QEMU_CLIENT_H
-
-/*
- * Contains declaration of classes that encapsulate connection to camera services
- * in the emulator via qemu pipe.
- */
-
-#include <hardware/qemud.h>
-
-namespace android {
-
-/****************************************************************************
- * Qemu query
- ***************************************************************************/
-
-/* Encapsulates a query to the emulator.
- * Guest exchanges data with the emulator via queries sent over the qemu pipe.
- * The queries as well as replies to the queries are all strings (except for the
- * 'frame' query where reply is a framebuffer).
- * Each query is formatted as such:
- *
- * "<query name>[ <parameters>]",
- *
- * where <query name> is a string representing query name, and <parameters> are
- * optional parameters for the query. If parameters are present, they must be
- * separated from the query name with a single space, and they must be formatted
- * as such:
- *
- * "<name1>=<value1> <name2>=<value2> ... <nameN>=<valueN>"
- *
- * I.e.:
- * - Every parameter must have a name, and a value.
- * - Name and value must be separated with '='.
- * - No spaces are allowed around '=' separating name and value.
- * - Parameters must be separated with a single space character.
- * - No '=' character is allowed in name and in value.
- *
- * There are certain restrictions on strings used in the query:
- * - Spaces are allowed only as separators.
- * - '=' are allowed only to divide parameter names from parameter values.
- *
- * Emulator replies to each query in two chunks:
- * - 8 bytes encoding the payload size as a string containing hexadecimal
- * representation of the payload size value. This is done in order to simplify
- * dealing with different endianness on the host, and on the guest.
- * - Payload, whose size is defined by the first chunk.
- *
- * Every payload always begins with two characters, encoding the result of the
- * query:
- * - 'ok' Encoding the success
- * - 'ko' Encoding a failure.
- * After that payload may have optional data. If payload has more data following
- * the query result, there is a ':' character separating them. If payload carries
- * only the result, it always ends with a zero-terminator. So, payload 'ok'/'ko'
- * prefix is always 3 bytes long: it either includes a zero-terminator, if there
- * is no data, or a ':' separator.
- */
-class QemuQuery {
-public:
- /* Constructs an uninitialized QemuQuery instance. */
- QemuQuery();
-
- /* Constructs and initializes QemuQuery instance for a query.
- * Param:
- * query_string - Query string. This constructor can also be used to
- * construct a query that doesn't have parameters. In this case query
- * name can be passed as a parameter here.
- */
- explicit QemuQuery(const char* query_string);
-
- /* Constructs and initializes QemuQuery instance for a query with parameters.
- * Param:
- * query_name - Query name.
- * query_param - Query parameters. Can be NULL.
- */
- QemuQuery(const char* query_name, const char* query_param);
-
- /* Destructs QemuQuery instance. */
- ~QemuQuery();
-
- /****************************************************************************
- * Public API
- ***************************************************************************/
-
- /* Creates new query.
- * Note: this method will reset this instance prior to creating a new query
- * in order to discard possible "leftovers" from the previous query.
- * Param:
- * query_name - Query name.
- * query_param - Query parameters. Can be NULL.
- * Return:
- * NO_ERROR on success, or an appropriate error status.
- */
- status_t createQuery(const char* name, const char* param);
-
- /* Completes the query after a reply from the emulator.
- * This method will parse the reply buffer, and calculate the final query
- * status, which depends not only on the transport success / failure, but
- * also on 'ok' / 'ko' in the reply buffer.
- * Param:
- * status - Query delivery status. This status doesn't necessarily reflects
- * the final query status (which is defined by 'ok'/'ko' prefix in the
- * reply buffer). This status simply states whether or not the query has
- * been sent, and a reply has been received successfuly. However, if
- * this status indicates a failure, it means that the entire query has
- * failed.
- * Return:
- * NO_ERROR on success, or an appropriate error status on failure. Note that
- * status returned here just signals whether or not the method has succeeded.
- * Use isQuerySucceeded() / getCompletionStatus() methods of this class to
- * check the final query status.
- */
- status_t completeQuery(status_t status);
-
- /* Resets the query from a previous use. */
- void resetQuery();
-
- /* Checks if query has succeeded.
- * Note that this method must be called after completeQuery() method of this
- * class has been executed.
- */
- inline bool isQuerySucceeded() const {
- return mQueryDeliveryStatus == NO_ERROR && mReplyStatus != 0;
- }
-
- /* Gets final completion status of the query.
- * Note that this method must be called after completeQuery() method of this
- * class has been executed.
- * Return:
- * NO_ERROR if query has succeeded, or an appropriate error status on query
- * failure.
- */
- inline status_t getCompletionStatus() const {
- if (mQueryDeliveryStatus == NO_ERROR) {
- if (mReplyStatus) {
- return NO_ERROR;
- } else {
- return EINVAL;
- }
- } else {
- return mQueryDeliveryStatus;
- }
- }
-
- /****************************************************************************
- * Public data memebers
- ***************************************************************************/
-
-public:
- /* Query string. */
- char* mQuery;
- /* Query delivery status. */
- status_t mQueryDeliveryStatus;
- /* Reply buffer */
- char* mReplyBuffer;
- /* Reply data (past 'ok'/'ko'). If NULL, there were no data in reply. */
- char* mReplyData;
- /* Reply buffer size. */
- size_t mReplySize;
- /* Reply data size. */
- size_t mReplyDataSize;
- /* Reply status: 1 - ok, 0 - ko. */
- int mReplyStatus;
-
- /****************************************************************************
- * Private data memebers
- ***************************************************************************/
-
-protected:
- /* Preallocated buffer for small queries. */
- char mQueryPrealloc[256];
-};
-
-/****************************************************************************
- * Qemu client base
- ***************************************************************************/
-
-/* Encapsulates a connection to the 'camera' service in the emulator via qemu
- * pipe.
- */
-class QemuClient {
-public:
- /* Constructs QemuClient instance. */
- QemuClient();
-
- /* Destructs QemuClient instance. */
- virtual ~QemuClient();
-
- /****************************************************************************
- * Qemu client API
- ***************************************************************************/
-
-public:
- /* Connects to the 'camera' service in the emulator via qemu pipe.
- * Param:
- * param - Parameters to pass to the camera service. There are two types of
- * camera services implemented by the emulator. The first one is a
- * 'camera factory' type of service that provides list of cameras
- * connected to the host. Another one is an 'emulated camera' type of
- * service that provides interface to a camera connected to the host. At
- * the connection time emulator makes distinction between the two by
- * looking at connection parameters: no parameters means connection to
- * the 'factory' service, while connection with parameters means
- * connection to an 'emulated camera' service, where camera is identified
- * by one of the connection parameters. So, passing NULL, or an empty
- * string to this method will establish a connection with the 'factory'
- * service, while not empty string passed here will establish connection
- * with an 'emulated camera' service. Parameters defining the emulated
- * camera must be formatted as such:
- *
- * "name=<device name> [inp_channel=<input channel #>]",
- *
- * where 'device name' is a required parameter defining name of the
- * camera device, and 'input channel' is an optional parameter (positive
- * integer), defining the input channel to use on the camera device.
- * Note that device name passed here must have been previously obtained
- * from the factory service using 'list' query.
- * Return:
- * NO_ERROR on success, or an appropriate error status.
- */
- virtual status_t connectClient(const char* param);
-
- /* Disconnects from the service. */
- virtual void disconnectClient();
-
- /* Sends data to the service.
- * Param:
- * data, data_size - Data to send.
- * Return:
- * NO_ERROR on success, or an appropriate error status on failure.
- */
- virtual status_t sendMessage(const void* data, size_t data_size);
-
- /* Receives data from the service.
- * This method assumes that data to receive will come in two chunks: 8
- * characters encoding the payload size in hexadecimal string, followed by
- * the paylod (if any).
- * This method will allocate data buffer where to receive the response.
- * Param:
- * data - Upon success contains address of the allocated data buffer with
- * the data received from the service. The caller is responsible for
- * freeing allocated data buffer.
- * data_size - Upon success contains size of the data received from the
- * service.
- * Return:
- * NO_ERROR on success, or an appropriate error status on failure.
- */
- virtual status_t receiveMessage(void** data, size_t* data_size);
-
- /* Sends a query, and receives a response from the service.
- * Param:
- * query - Query to send to the service. When this method returns, the query
- * is completed, and all its relevant data members are properly initialized.
- * Return:
- * NO_ERROR on success, or an appropriate error status on failure. Note that
- * status returned here is not the final query status. Use isQuerySucceeded(),
- * or getCompletionStatus() method on the query object to see if it has
- * succeeded. However, if this method returns a failure, it means that the
- * query has failed, and there is no guarantee that its data members are
- * properly initialized (except for the 'mQueryDeliveryStatus', which is
- * always in the proper state).
- */
- virtual status_t doQuery(QemuQuery* query);
-
- /****************************************************************************
- * Data members
- ***************************************************************************/
-
-protected:
- /* Qemu pipe handle. */
- int mPipeFD;
-
-private:
- /* Camera service name. */
- static const char mCameraServiceName[];
-};
-
-/****************************************************************************
- * Qemu client for the 'factory' service.
- ***************************************************************************/
-
-/* Encapsulates QemuClient for the 'factory' service. */
-class FactoryQemuClient : public QemuClient {
-public:
- /* Constructs FactoryQemuClient instance. */
- FactoryQemuClient();
-
- /* Destructs FactoryQemuClient instance. */
- ~FactoryQemuClient();
-
- /****************************************************************************
- * Public API
- ***************************************************************************/
-
-public:
- /* Lists camera devices connected to the host.
- * Param:
- * list - Upon success contains a list of cameras connected to the host. The
- * list returned here is represented as a string, containing multiple
- * lines separated with '\n', where each line represents a camera. Each
- * camera line is formatted as such:
- *
- * "name=<device name> channel=<num> pix=<num> framedims=<dimensions>\n"
- *
- * Where:
- * - 'name' is the name of the camera device attached to the host. This
- * name must be used for subsequent connection to the 'emulated camera'
- * service for that camera.
- * - 'channel' - input channel number (positive int) to use to communicate
- * with the camera.
- * - 'pix' - pixel format (a "fourcc" uint), chosen for the video frames
- * by the camera service.
- * - 'framedims' contains a list of frame dimensions supported by the
- * camera for the chosen pixel format. Each etry in the list is in form
- * '<width>x<height>', where 'width' and 'height' are numeric values
- * for width and height of a supported frame dimension. Entries in
- * this list are separated with ',' with no spaces between the entries.
- * Return:
- * NO_ERROR on success, or an appropriate error status on failure.
- */
- status_t listCameras(char** list);
-
- /****************************************************************************
- * Names of the queries available for the emulated camera factory.
- ***************************************************************************/
-
-private:
- /* List cameras connected to the host. */
- static const char mQueryList[];
-};
-
-/****************************************************************************
- * Qemu client for an 'emulated camera' service.
- ***************************************************************************/
-
-/* Encapsulates QemuClient for an 'emulated camera' service.
- */
-class CameraQemuClient : public QemuClient {
-public:
- /* Constructs CameraQemuClient instance. */
- CameraQemuClient();
-
- /* Destructs CameraQemuClient instance. */
- ~CameraQemuClient();
-
- /****************************************************************************
- * Public API
- ***************************************************************************/
-
-public:
- /* Queries camera connection.
- * Return:
- * NO_ERROR on success, or an appropriate error status on failure.
- */
- status_t queryConnect();
-
- /* Queries camera disconnection.
- * Return:
- * NO_ERROR on success, or an appropriate error status on failure.
- */
- status_t queryDisconnect();
-
- /* Queries camera to start capturing video.
- * Param:
- * pixel_format - Pixel format that is used by the client to push video
- * frames to the camera framework.
- * width, height - Frame dimensions, requested by the framework.
- * Return:
- * NO_ERROR on success, or an appropriate error status on failure.
- */
- status_t queryStart(uint32_t pixel_format, int width, int height);
-
- /* Queries camera to stop capturing video.
- * Return:
- * NO_ERROR on success, or an appropriate error status on failure.
- */
- status_t queryStop();
-
- /* Queries camera for the next video frame.
- * Param:
- * vframe, vframe_size - Define buffer, allocated to receive a video frame.
- * Any of these parameters can be 0, indicating that the caller is
- * interested only in preview frame.
- * pframe, pframe_size - Define buffer, allocated to receive a preview frame.
- * Any of these parameters can be 0, indicating that the caller is
- * interested only in video frame.
- * r_scale, g_scale, b_scale - White balance scale.
- * exposure_comp - Expsoure compensation.
- * Return:
- * NO_ERROR on success, or an appropriate error status on failure.
- */
- status_t queryFrame(void* vframe,
- void* pframe,
- size_t vframe_size,
- size_t pframe_size,
- float r_scale,
- float g_scale,
- float b_scale,
- float exposure_comp);
-
- /****************************************************************************
- * Names of the queries available for the emulated camera.
- ***************************************************************************/
-
-private:
- /* Connect to the camera. */
- static const char mQueryConnect[];
- /* Disconnect from the camera. */
- static const char mQueryDisconnect[];
- /* Start video capturing. */
- static const char mQueryStart[];
- /* Stop video capturing. */
- static const char mQueryStop[];
- /* Query frame(s). */
- static const char mQueryFrame[];
-};
-
-}; /* namespace android */
-
-#endif /* HW_EMULATOR_CAMERA_QEMU_CLIENT_H */
diff --git a/tools/emulator/system/camera/fake-pipeline2/Base.h b/tools/emulator/system/camera/fake-pipeline2/Base.h
deleted file mode 100644
index 057629b66..000000000
--- a/tools/emulator/system/camera/fake-pipeline2/Base.h
+++ /dev/null
@@ -1,64 +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.
- */
-
-/**
- * This file includes various basic structures that are needed by multiple parts
- * of the fake camera 2 implementation.
- */
-
-#ifndef HW_EMULATOR_CAMERA2_BASE_H
-#define HW_EMULATOR_CAMERA2_BASE_H
-
-#include <system/window.h>
-#include <hardware/camera2.h>
-#include <utils/Vector.h>
-
-namespace android {
-
-
-/* Internal structure for passing buffers across threads */
-struct StreamBuffer {
- // Positive numbers are output streams
- // Negative numbers are input reprocess streams
- // Zero is an auxillary buffer
- int streamId;
- uint32_t width, height;
- uint32_t format;
- uint32_t stride;
- buffer_handle_t *buffer;
- uint8_t *img;
-};
-typedef Vector<StreamBuffer> Buffers;
-
-struct Stream {
- const camera2_stream_ops_t *ops;
- uint32_t width, height;
- int32_t format;
- uint32_t stride;
-};
-
-struct ReprocessStream {
- const camera2_stream_in_ops_t *ops;
- uint32_t width, height;
- int32_t format;
- uint32_t stride;
- // -1 if the reprocessing stream is independent
- int32_t sourceStreamId;
-};
-
-} // namespace android;
-
-#endif
diff --git a/tools/emulator/system/camera/fake-pipeline2/JpegCompressor.cpp b/tools/emulator/system/camera/fake-pipeline2/JpegCompressor.cpp
deleted file mode 100644
index 20b9634f1..000000000
--- a/tools/emulator/system/camera/fake-pipeline2/JpegCompressor.cpp
+++ /dev/null
@@ -1,270 +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.
- */
-
-#define LOG_NDEBUG 0
-#define LOG_TAG "EmulatedCamera2_JpegCompressor"
-
-#include <utils/Log.h>
-#include <ui/GraphicBufferMapper.h>
-
-#include "JpegCompressor.h"
-#include "../EmulatedFakeCamera2.h"
-
-namespace android {
-
-JpegCompressor::JpegCompressor(EmulatedFakeCamera2 *parent):
- Thread(false),
- mIsBusy(false),
- mParent(parent),
- mBuffers(NULL),
- mCaptureTime(0) {
-}
-
-JpegCompressor::~JpegCompressor() {
- Mutex::Autolock lock(mMutex);
-}
-
-status_t JpegCompressor::start(Buffers *buffers,
- nsecs_t captureTime) {
- Mutex::Autolock lock(mMutex);
- {
- Mutex::Autolock busyLock(mBusyMutex);
-
- if (mIsBusy) {
- ALOGE("%s: Already processing a buffer!", __FUNCTION__);
- return INVALID_OPERATION;
- }
-
- mIsBusy = true;
-
- mBuffers = buffers;
- mCaptureTime = captureTime;
- }
-
- status_t res;
- res = run("EmulatedFakeCamera2::JpegCompressor");
- if (res != OK) {
- ALOGE("%s: Unable to start up compression thread: %s (%d)",
- __FUNCTION__, strerror(-res), res);
- delete mBuffers;
- }
- return res;
-}
-
-status_t JpegCompressor::cancel() {
- requestExitAndWait();
- return OK;
-}
-
-status_t JpegCompressor::readyToRun() {
- return OK;
-}
-
-bool JpegCompressor::threadLoop() {
- Mutex::Autolock lock(mMutex);
- ALOGV("%s: Starting compression thread", __FUNCTION__);
-
- // Find source and target buffers. Assumes only one buffer matches
- // each condition!
-
- bool foundJpeg = false, mFoundAux = false;
- for (size_t i = 0; i < mBuffers->size(); i++) {
- const StreamBuffer &b = (*mBuffers)[i];
- if (b.format == HAL_PIXEL_FORMAT_BLOB) {
- mJpegBuffer = b;
- mFoundJpeg = true;
- } else if (b.streamId <= 0) {
- mAuxBuffer = b;
- mFoundAux = true;
- }
- if (mFoundJpeg && mFoundAux) break;
- }
- if (!mFoundJpeg || !mFoundAux) {
- ALOGE("%s: Unable to find buffers for JPEG source/destination",
- __FUNCTION__);
- cleanUp();
- return false;
- }
-
- // Set up error management
-
- mJpegErrorInfo = NULL;
- JpegError error;
- error.parent = this;
-
- mCInfo.err = jpeg_std_error(&error);
- mCInfo.err->error_exit = jpegErrorHandler;
-
- jpeg_create_compress(&mCInfo);
- if (checkError("Error initializing compression")) return false;
-
- // Route compressed data straight to output stream buffer
-
- JpegDestination jpegDestMgr;
- jpegDestMgr.parent = this;
- jpegDestMgr.init_destination = jpegInitDestination;
- jpegDestMgr.empty_output_buffer = jpegEmptyOutputBuffer;
- jpegDestMgr.term_destination = jpegTermDestination;
-
- mCInfo.dest = &jpegDestMgr;
-
- // Set up compression parameters
-
- mCInfo.image_width = mAuxBuffer.width;
- mCInfo.image_height = mAuxBuffer.height;
- mCInfo.input_components = 3;
- mCInfo.in_color_space = JCS_RGB;
-
- jpeg_set_defaults(&mCInfo);
- if (checkError("Error configuring defaults")) return false;
-
- // Do compression
-
- jpeg_start_compress(&mCInfo, TRUE);
- if (checkError("Error starting compression")) return false;
-
- size_t rowStride = mAuxBuffer.stride * 3;
- const size_t kChunkSize = 32;
- while (mCInfo.next_scanline < mCInfo.image_height) {
- JSAMPROW chunk[kChunkSize];
- for (size_t i = 0 ; i < kChunkSize; i++) {
- chunk[i] = (JSAMPROW)
- (mAuxBuffer.img + (i + mCInfo.next_scanline) * rowStride);
- }
- jpeg_write_scanlines(&mCInfo, chunk, kChunkSize);
- if (checkError("Error while compressing")) return false;
- if (exitPending()) {
- ALOGV("%s: Cancel called, exiting early", __FUNCTION__);
- cleanUp();
- return false;
- }
- }
-
- jpeg_finish_compress(&mCInfo);
- if (checkError("Error while finishing compression")) return false;
-
- // Write to JPEG output stream
-
- ALOGV("%s: Compression complete, pushing to stream %d", __FUNCTION__,
- mJpegBuffer.streamId);
-
- GraphicBufferMapper::get().unlock(*(mJpegBuffer.buffer));
- status_t res;
- const Stream &s = mParent->getStreamInfo(mJpegBuffer.streamId);
- res = s.ops->enqueue_buffer(s.ops, mCaptureTime, mJpegBuffer.buffer);
- if (res != OK) {
- ALOGE("%s: Error queueing compressed image buffer %p: %s (%d)",
- __FUNCTION__, mJpegBuffer.buffer, strerror(-res), res);
- mParent->signalError();
- }
-
- // All done
-
- cleanUp();
-
- return false;
-}
-
-bool JpegCompressor::isBusy() {
- Mutex::Autolock busyLock(mBusyMutex);
- return mIsBusy;
-}
-
-bool JpegCompressor::isStreamInUse(uint32_t id) {
- Mutex::Autolock lock(mBusyMutex);
-
- if (mBuffers && mIsBusy) {
- for (size_t i = 0; i < mBuffers->size(); i++) {
- if ( (*mBuffers)[i].streamId == (int)id ) return true;
- }
- }
- return false;
-}
-
-bool JpegCompressor::waitForDone(nsecs_t timeout) {
- Mutex::Autolock lock(mBusyMutex);
- status_t res = OK;
- if (mIsBusy) {
- res = mDone.waitRelative(mBusyMutex, timeout);
- }
- return (res == OK);
-}
-
-bool JpegCompressor::checkError(const char *msg) {
- if (mJpegErrorInfo) {
- char errBuffer[JMSG_LENGTH_MAX];
- mJpegErrorInfo->err->format_message(mJpegErrorInfo, errBuffer);
- ALOGE("%s: %s: %s",
- __FUNCTION__, msg, errBuffer);
- cleanUp();
- mJpegErrorInfo = NULL;
- return true;
- }
- return false;
-}
-
-void JpegCompressor::cleanUp() {
- status_t res;
- jpeg_destroy_compress(&mCInfo);
- Mutex::Autolock lock(mBusyMutex);
-
- if (mFoundAux) {
- if (mAuxBuffer.streamId == 0) {
- delete[] mAuxBuffer.img;
- } else {
- GraphicBufferMapper::get().unlock(*(mAuxBuffer.buffer));
- const ReprocessStream &s =
- mParent->getReprocessStreamInfo(-mAuxBuffer.streamId);
- res = s.ops->release_buffer(s.ops, mAuxBuffer.buffer);
- if (res != OK) {
- ALOGE("Error releasing reprocess buffer %p: %s (%d)",
- mAuxBuffer.buffer, strerror(-res), res);
- mParent->signalError();
- }
- }
- }
- delete mBuffers;
- mBuffers = NULL;
-
- mIsBusy = false;
- mDone.signal();
-}
-
-void JpegCompressor::jpegErrorHandler(j_common_ptr cinfo) {
- JpegError *error = static_cast<JpegError*>(cinfo->err);
- error->parent->mJpegErrorInfo = cinfo;
-}
-
-void JpegCompressor::jpegInitDestination(j_compress_ptr cinfo) {
- JpegDestination *dest= static_cast<JpegDestination*>(cinfo->dest);
- ALOGV("%s: Setting destination to %p, size %d",
- __FUNCTION__, dest->parent->mJpegBuffer.img, kMaxJpegSize);
- dest->next_output_byte = (JOCTET*)(dest->parent->mJpegBuffer.img);
- dest->free_in_buffer = kMaxJpegSize;
-}
-
-boolean JpegCompressor::jpegEmptyOutputBuffer(j_compress_ptr cinfo) {
- ALOGE("%s: JPEG destination buffer overflow!",
- __FUNCTION__);
- return true;
-}
-
-void JpegCompressor::jpegTermDestination(j_compress_ptr cinfo) {
- ALOGV("%s: Done writing JPEG data. %d bytes left in buffer",
- __FUNCTION__, cinfo->dest->free_in_buffer);
-}
-
-} // namespace android
diff --git a/tools/emulator/system/camera/fake-pipeline2/JpegCompressor.h b/tools/emulator/system/camera/fake-pipeline2/JpegCompressor.h
deleted file mode 100644
index ea2a84f01..000000000
--- a/tools/emulator/system/camera/fake-pipeline2/JpegCompressor.h
+++ /dev/null
@@ -1,109 +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.
- */
-
-
-/**
- * This class simulates a hardware JPEG compressor. It receives image buffers
- * in RGBA_8888 format, processes them in a worker thread, and then pushes them
- * out to their destination stream.
- */
-
-#ifndef HW_EMULATOR_CAMERA2_JPEG_H
-#define HW_EMULATOR_CAMERA2_JPEG_H
-
-#include "utils/Thread.h"
-#include "utils/Mutex.h"
-#include "utils/Timers.h"
-
-#include "Base.h"
-
-#include <stdio.h>
-
-extern "C" {
-#include <jpeglib.h>
-}
-
-namespace android {
-
-class EmulatedFakeCamera2;
-
-class JpegCompressor: private Thread, public virtual RefBase {
- public:
-
- JpegCompressor(EmulatedFakeCamera2 *parent);
- ~JpegCompressor();
-
- // Start compressing COMPRESSED format buffers; JpegCompressor takes
- // ownership of the Buffers vector.
- status_t start(Buffers *buffers,
- nsecs_t captureTime);
-
- status_t cancel();
-
- bool isBusy();
- bool isStreamInUse(uint32_t id);
-
- bool waitForDone(nsecs_t timeout);
-
- // TODO: Measure this
- static const size_t kMaxJpegSize = 300000;
-
- private:
- Mutex mBusyMutex;
- bool mIsBusy;
- Condition mDone;
-
- Mutex mMutex;
-
- EmulatedFakeCamera2 *mParent;
-
- Buffers *mBuffers;
- nsecs_t mCaptureTime;
-
- StreamBuffer mJpegBuffer, mAuxBuffer;
- bool mFoundJpeg, mFoundAux;
-
- jpeg_compress_struct mCInfo;
-
- struct JpegError : public jpeg_error_mgr {
- JpegCompressor *parent;
- };
- j_common_ptr mJpegErrorInfo;
-
- struct JpegDestination : public jpeg_destination_mgr {
- JpegCompressor *parent;
- };
-
- static void jpegErrorHandler(j_common_ptr cinfo);
-
- static void jpegInitDestination(j_compress_ptr cinfo);
- static boolean jpegEmptyOutputBuffer(j_compress_ptr cinfo);
- static void jpegTermDestination(j_compress_ptr cinfo);
-
- bool checkError(const char *msg);
- void cleanUp();
-
- /**
- * Inherited Thread virtual overrides
- */
- private:
- virtual status_t readyToRun();
- virtual bool threadLoop();
-};
-
-} // namespace android
-
-#endif
diff --git a/tools/emulator/system/camera/fake-pipeline2/Scene.cpp b/tools/emulator/system/camera/fake-pipeline2/Scene.cpp
deleted file mode 100644
index ca503503b..000000000
--- a/tools/emulator/system/camera/fake-pipeline2/Scene.cpp
+++ /dev/null
@@ -1,459 +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.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "EmulatedCamera_Scene"
-#include <utils/Log.h>
-#include <stdlib.h>
-
-#include "Scene.h"
-
-// TODO: This should probably be done host-side in OpenGL for speed and better
-// quality
-
-namespace android {
-
-// Define single-letter shortcuts for scene definition, for directly indexing
-// mCurrentColors
-#define G (Scene::GRASS * Scene::NUM_CHANNELS)
-#define S (Scene::GRASS_SHADOW * Scene::NUM_CHANNELS)
-#define H (Scene::HILL * Scene::NUM_CHANNELS)
-#define W (Scene::WALL * Scene::NUM_CHANNELS)
-#define R (Scene::ROOF * Scene::NUM_CHANNELS)
-#define D (Scene::DOOR * Scene::NUM_CHANNELS)
-#define C (Scene::CHIMNEY * Scene::NUM_CHANNELS)
-#define I (Scene::WINDOW * Scene::NUM_CHANNELS)
-#define U (Scene::SUN * Scene::NUM_CHANNELS)
-#define K (Scene::SKY * Scene::NUM_CHANNELS)
-#define M (Scene::MOON * Scene::NUM_CHANNELS)
-
-const int Scene::kSceneWidth = 20;
-const int Scene::kSceneHeight = 20;
-
-const uint8_t Scene::kScene[Scene::kSceneWidth * Scene::kSceneHeight] = {
- // 5 10 15 20
- K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,
- K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,
- K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,
- K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,
- K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K, // 5
- K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,
- K,K,K,K,K,K,K,K,H,H,H,H,H,H,H,H,H,H,H,H,
- K,K,K,K,K,K,K,K,H,H,H,H,H,H,H,C,C,H,H,H,
- K,K,K,K,K,K,H,H,H,H,H,H,H,H,H,C,C,H,H,H,
- H,K,K,K,K,K,H,R,R,R,R,R,R,R,R,R,R,R,R,H, // 10
- H,K,K,K,K,H,H,R,R,R,R,R,R,R,R,R,R,R,R,H,
- H,H,H,K,K,H,H,R,R,R,R,R,R,R,R,R,R,R,R,H,
- H,H,H,K,K,H,H,H,W,W,W,W,W,W,W,W,W,W,H,H,
- S,S,S,G,G,S,S,S,W,W,W,W,W,W,W,W,W,W,S,S,
- S,G,G,G,G,S,S,S,W,I,I,W,D,D,W,I,I,W,S,S, // 15
- G,G,G,G,G,G,S,S,W,I,I,W,D,D,W,I,I,W,S,S,
- G,G,G,G,G,G,G,G,W,W,W,W,D,D,W,W,W,W,G,G,
- G,G,G,G,G,G,G,G,W,W,W,W,D,D,W,W,W,W,G,G,
- G,G,G,G,G,G,G,G,S,S,S,S,S,S,S,S,S,S,G,G,
- G,G,G,G,G,G,G,G,S,S,S,S,S,S,S,S,S,S,G,G, // 20
- // 5 10 15 20
-};
-
-#undef G
-#undef S
-#undef H
-#undef W
-#undef R
-#undef D
-#undef C
-#undef I
-#undef U
-#undef K
-#undef M
-
-Scene::Scene(
- int sensorWidthPx,
- int sensorHeightPx,
- float sensorSensitivity):
- mSensorWidth(sensorWidthPx),
- mSensorHeight(sensorHeightPx),
- mHour(12),
- mExposureDuration(0.033f),
- mSensorSensitivity(sensorSensitivity)
-{
- // Map scene to sensor pixels
- if (mSensorWidth > mSensorHeight) {
- mMapDiv = (mSensorWidth / (kSceneWidth + 1) ) + 1;
- } else {
- mMapDiv = (mSensorHeight / (kSceneHeight + 1) ) + 1;
- }
- mOffsetX = (kSceneWidth * mMapDiv - mSensorWidth) / 2;
- mOffsetY = (kSceneHeight * mMapDiv - mSensorHeight) / 2;
-
- // Assume that sensor filters are sRGB primaries to start
- mFilterR[0] = 3.2406f; mFilterR[1] = -1.5372f; mFilterR[2] = -0.4986f;
- mFilterGr[0] = -0.9689f; mFilterGr[1] = 1.8758f; mFilterGr[2] = 0.0415f;
- mFilterGb[0] = -0.9689f; mFilterGb[1] = 1.8758f; mFilterGb[2] = 0.0415f;
- mFilterB[0] = 0.0557f; mFilterB[1] = -0.2040f; mFilterB[2] = 1.0570f;
-
-
-}
-
-Scene::~Scene() {
-}
-
-void Scene::setColorFilterXYZ(
- float rX, float rY, float rZ,
- float grX, float grY, float grZ,
- float gbX, float gbY, float gbZ,
- float bX, float bY, float bZ) {
- mFilterR[0] = rX; mFilterR[1] = rY; mFilterR[2] = rZ;
- mFilterGr[0] = grX; mFilterGr[1] = grY; mFilterGr[2] = grZ;
- mFilterGb[0] = gbX; mFilterGb[1] = gbY; mFilterGb[2] = gbZ;
- mFilterB[0] = bX; mFilterB[1] = bY; mFilterB[2] = bZ;
-}
-
-void Scene::setHour(int hour) {
- ALOGV("Hour set to: %d", hour);
- mHour = hour % 24;
-}
-
-int Scene::getHour() {
- return mHour;
-}
-
-void Scene::setExposureDuration(float seconds) {
- mExposureDuration = seconds;
-}
-
-void Scene::calculateScene(nsecs_t time) {
- // Calculate time fractions for interpolation
- int timeIdx = mHour / kTimeStep;
- int nextTimeIdx = (timeIdx + 1) % (24 / kTimeStep);
- const nsecs_t kOneHourInNsec = 1e9 * 60 * 60;
- nsecs_t timeSinceIdx = (mHour - timeIdx * kTimeStep) * kOneHourInNsec + time;
- float timeFrac = timeSinceIdx / (float)(kOneHourInNsec * kTimeStep);
-
- // Determine overall sunlight levels
- float sunLux =
- kSunlight[timeIdx] * (1 - timeFrac) +
- kSunlight[nextTimeIdx] * timeFrac;
- ALOGV("Sun lux: %f", sunLux);
-
- float sunShadeLux = sunLux * (kDaylightShadeIllum / kDirectSunIllum);
-
- // Determine sun/shade illumination chromaticity
- float currentSunXY[2];
- float currentShadeXY[2];
-
- const float *prevSunXY, *nextSunXY;
- const float *prevShadeXY, *nextShadeXY;
- if (kSunlight[timeIdx] == kSunsetIllum ||
- kSunlight[timeIdx] == kTwilightIllum) {
- prevSunXY = kSunsetXY;
- prevShadeXY = kSunsetXY;
- } else {
- prevSunXY = kDirectSunlightXY;
- prevShadeXY = kDaylightXY;
- }
- if (kSunlight[nextTimeIdx] == kSunsetIllum ||
- kSunlight[nextTimeIdx] == kTwilightIllum) {
- nextSunXY = kSunsetXY;
- nextShadeXY = kSunsetXY;
- } else {
- nextSunXY = kDirectSunlightXY;
- nextShadeXY = kDaylightXY;
- }
- currentSunXY[0] = prevSunXY[0] * (1 - timeFrac) +
- nextSunXY[0] * timeFrac;
- currentSunXY[1] = prevSunXY[1] * (1 - timeFrac) +
- nextSunXY[1] * timeFrac;
-
- currentShadeXY[0] = prevShadeXY[0] * (1 - timeFrac) +
- nextShadeXY[0] * timeFrac;
- currentShadeXY[1] = prevShadeXY[1] * (1 - timeFrac) +
- nextShadeXY[1] * timeFrac;
-
- ALOGV("Sun XY: %f, %f, Shade XY: %f, %f",
- currentSunXY[0], currentSunXY[1],
- currentShadeXY[0], currentShadeXY[1]);
-
- // Converting for xyY to XYZ:
- // X = Y / y * x
- // Y = Y
- // Z = Y / y * (1 - x - y);
- float sunXYZ[3] = {
- sunLux / currentSunXY[1] * currentSunXY[0],
- sunLux,
- sunLux / currentSunXY[1] *
- (1 - currentSunXY[0] - currentSunXY[1])
- };
- float sunShadeXYZ[3] = {
- sunShadeLux / currentShadeXY[1] * currentShadeXY[0],
- sunShadeLux,
- sunShadeLux / currentShadeXY[1] *
- (1 - currentShadeXY[0] - currentShadeXY[1])
- };
- ALOGV("Sun XYZ: %f, %f, %f",
- sunXYZ[0], sunXYZ[1], sunXYZ[2]);
- ALOGV("Sun shade XYZ: %f, %f, %f",
- sunShadeXYZ[0], sunShadeXYZ[1], sunShadeXYZ[2]);
-
- // Determine moonlight levels
- float moonLux =
- kMoonlight[timeIdx] * (1 - timeFrac) +
- kMoonlight[nextTimeIdx] * timeFrac;
- float moonShadeLux = moonLux * (kDaylightShadeIllum / kDirectSunIllum);
-
- float moonXYZ[3] = {
- moonLux / kMoonlightXY[1] * kMoonlightXY[0],
- moonLux,
- moonLux / kMoonlightXY[1] *
- (1 - kMoonlightXY[0] - kMoonlightXY[1])
- };
- float moonShadeXYZ[3] = {
- moonShadeLux / kMoonlightXY[1] * kMoonlightXY[0],
- moonShadeLux,
- moonShadeLux / kMoonlightXY[1] *
- (1 - kMoonlightXY[0] - kMoonlightXY[1])
- };
-
- // Determine starlight level
- const float kClearNightXYZ[3] = {
- kClearNightIllum / kMoonlightXY[1] * kMoonlightXY[0],
- kClearNightIllum,
- kClearNightIllum / kMoonlightXY[1] *
- (1 - kMoonlightXY[0] - kMoonlightXY[1])
- };
-
- // Calculate direct and shaded light
- float directIllumXYZ[3] = {
- sunXYZ[0] + moonXYZ[0] + kClearNightXYZ[0],
- sunXYZ[1] + moonXYZ[1] + kClearNightXYZ[1],
- sunXYZ[2] + moonXYZ[2] + kClearNightXYZ[2],
- };
-
- float shadeIllumXYZ[3] = {
- kClearNightXYZ[0],
- kClearNightXYZ[1],
- kClearNightXYZ[2]
- };
-
- shadeIllumXYZ[0] += (mHour < kSunOverhead) ? sunXYZ[0] : sunShadeXYZ[0];
- shadeIllumXYZ[1] += (mHour < kSunOverhead) ? sunXYZ[1] : sunShadeXYZ[1];
- shadeIllumXYZ[2] += (mHour < kSunOverhead) ? sunXYZ[2] : sunShadeXYZ[2];
-
- // Moon up period covers 23->0 transition, shift for simplicity
- int adjHour = (mHour + 12) % 24;
- int adjMoonOverhead = (kMoonOverhead + 12 ) % 24;
- shadeIllumXYZ[0] += (adjHour < adjMoonOverhead) ?
- moonXYZ[0] : moonShadeXYZ[0];
- shadeIllumXYZ[1] += (adjHour < adjMoonOverhead) ?
- moonXYZ[1] : moonShadeXYZ[1];
- shadeIllumXYZ[2] += (adjHour < adjMoonOverhead) ?
- moonXYZ[2] : moonShadeXYZ[2];
-
- ALOGV("Direct XYZ: %f, %f, %f",
- directIllumXYZ[0],directIllumXYZ[1],directIllumXYZ[2]);
- ALOGV("Shade XYZ: %f, %f, %f",
- shadeIllumXYZ[0], shadeIllumXYZ[1], shadeIllumXYZ[2]);
-
- for (int i = 0; i < NUM_MATERIALS; i++) {
- // Converting for xyY to XYZ:
- // X = Y / y * x
- // Y = Y
- // Z = Y / y * (1 - x - y);
- float matXYZ[3] = {
- kMaterials_xyY[i][2] / kMaterials_xyY[i][1] *
- kMaterials_xyY[i][0],
- kMaterials_xyY[i][2],
- kMaterials_xyY[i][2] / kMaterials_xyY[i][1] *
- (1 - kMaterials_xyY[i][0] - kMaterials_xyY[i][1])
- };
-
- if (kMaterialsFlags[i] == 0 || kMaterialsFlags[i] & kSky) {
- matXYZ[0] *= directIllumXYZ[0];
- matXYZ[1] *= directIllumXYZ[1];
- matXYZ[2] *= directIllumXYZ[2];
- } else if (kMaterialsFlags[i] & kShadowed) {
- matXYZ[0] *= shadeIllumXYZ[0];
- matXYZ[1] *= shadeIllumXYZ[1];
- matXYZ[2] *= shadeIllumXYZ[2];
- } // else if (kMaterialsFlags[i] * kSelfLit), do nothing
-
- ALOGV("Mat %d XYZ: %f, %f, %f", i, matXYZ[0], matXYZ[1], matXYZ[2]);
- float luxToElectrons = mSensorSensitivity * mExposureDuration /
- (kAperture * kAperture);
- mCurrentColors[i*NUM_CHANNELS + 0] =
- (mFilterR[0] * matXYZ[0] +
- mFilterR[1] * matXYZ[1] +
- mFilterR[2] * matXYZ[2])
- * luxToElectrons;
- mCurrentColors[i*NUM_CHANNELS + 1] =
- (mFilterGr[0] * matXYZ[0] +
- mFilterGr[1] * matXYZ[1] +
- mFilterGr[2] * matXYZ[2])
- * luxToElectrons;
- mCurrentColors[i*NUM_CHANNELS + 2] =
- (mFilterGb[0] * matXYZ[0] +
- mFilterGb[1] * matXYZ[1] +
- mFilterGb[2] * matXYZ[2])
- * luxToElectrons;
- mCurrentColors[i*NUM_CHANNELS + 3] =
- (mFilterB[0] * matXYZ[0] +
- mFilterB[1] * matXYZ[1] +
- mFilterB[2] * matXYZ[2])
- * luxToElectrons;
-
- ALOGV("Color %d RGGB: %d, %d, %d, %d", i,
- mCurrentColors[i*NUM_CHANNELS + 0],
- mCurrentColors[i*NUM_CHANNELS + 1],
- mCurrentColors[i*NUM_CHANNELS + 2],
- mCurrentColors[i*NUM_CHANNELS + 3]);
- }
- // Shake viewpoint
- mHandshakeX = rand() % mMapDiv/4 - mMapDiv/8;
- mHandshakeY = rand() % mMapDiv/4 - mMapDiv/8;
- // Set starting pixel
- setReadoutPixel(0,0);
-}
-
-void Scene::setReadoutPixel(int x, int y) {
- mCurrentX = x;
- mCurrentY = y;
- mSubX = (x + mOffsetX + mHandshakeX) % mMapDiv;
- mSubY = (y + mOffsetY + mHandshakeY) % mMapDiv;
- mSceneX = (x + mOffsetX + mHandshakeX) / mMapDiv;
- mSceneY = (y + mOffsetY + mHandshakeY) / mMapDiv;
- mSceneIdx = mSceneY * kSceneWidth + mSceneX;
- mCurrentSceneMaterial = &(mCurrentColors[kScene[mSceneIdx]]);
-}
-
-const uint32_t* Scene::getPixelElectrons() {
- const uint32_t *pixel = mCurrentSceneMaterial;
- mCurrentX++;
- mSubX++;
- if (mCurrentX >= mSensorWidth) {
- mCurrentX = 0;
- mCurrentY++;
- if (mCurrentY >= mSensorHeight) mCurrentY = 0;
- setReadoutPixel(mCurrentX, mCurrentY);
- } else if (mSubX > mMapDiv) {
- mSceneIdx++;
- mSceneX++;
- mCurrentSceneMaterial = &(mCurrentColors[kScene[mSceneIdx]]);
- mSubX = 0;
- }
- return pixel;
-}
-
-// RGB->YUV, Jpeg standard
-const float Scene::kRgb2Yuv[12] = {
- 0.299f, 0.587f, 0.114f, 0.f,
- -0.16874f, -0.33126f, 0.5f, -128.f,
- 0.5f, -0.41869f, -0.08131f, -128.f,
-};
-
-// Aperture of imaging lens
-const float Scene::kAperture = 2.8;
-
-// Sun illumination levels through the day
-const float Scene::kSunlight[24/kTimeStep] =
-{
- 0, // 00:00
- 0,
- 0,
- kTwilightIllum, // 06:00
- kDirectSunIllum,
- kDirectSunIllum,
- kDirectSunIllum, // 12:00
- kDirectSunIllum,
- kDirectSunIllum,
- kSunsetIllum, // 18:00
- kTwilightIllum,
- 0
-};
-
-// Moon illumination levels through the day
-const float Scene::kMoonlight[24/kTimeStep] =
-{
- kFullMoonIllum, // 00:00
- kFullMoonIllum,
- 0,
- 0, // 06:00
- 0,
- 0,
- 0, // 12:00
- 0,
- 0,
- 0, // 18:00
- 0,
- kFullMoonIllum
-};
-
-const int Scene::kSunOverhead = 12;
-const int Scene::kMoonOverhead = 0;
-
-// Used for sun illumination levels
-const float Scene::kDirectSunIllum = 100000;
-const float Scene::kSunsetIllum = 400;
-const float Scene::kTwilightIllum = 4;
-// Used for moon illumination levels
-const float Scene::kFullMoonIllum = 1;
-// Other illumination levels
-const float Scene::kDaylightShadeIllum = 20000;
-const float Scene::kClearNightIllum = 2e-3;
-const float Scene::kStarIllum = 2e-6;
-const float Scene::kLivingRoomIllum = 50;
-
-const float Scene::kIncandescentXY[2] = { 0.44757f, 0.40745f};
-const float Scene::kDirectSunlightXY[2] = { 0.34842f, 0.35161f};
-const float Scene::kDaylightXY[2] = { 0.31271f, 0.32902f};
-const float Scene::kNoonSkyXY[2] = { 0.346f, 0.359f};
-const float Scene::kMoonlightXY[2] = { 0.34842f, 0.35161f};
-const float Scene::kSunsetXY[2] = { 0.527f, 0.413f};
-
-const uint8_t Scene::kSelfLit = 0x01;
-const uint8_t Scene::kShadowed = 0x02;
-const uint8_t Scene::kSky = 0x04;
-
-// For non-self-lit materials, the Y component is normalized with 1=full
-// reflectance; for self-lit materials, it's the constant illuminance in lux.
-const float Scene::kMaterials_xyY[Scene::NUM_MATERIALS][3] = {
- { 0.3688f, 0.4501f, .1329f }, // GRASS
- { 0.3688f, 0.4501f, .1329f }, // GRASS_SHADOW
- { 0.3986f, 0.5002f, .4440f }, // HILL
- { 0.3262f, 0.5040f, .2297f }, // WALL
- { 0.4336f, 0.3787f, .1029f }, // ROOF
- { 0.3316f, 0.2544f, .0639f }, // DOOR
- { 0.3425f, 0.3577f, .0887f }, // CHIMNEY
- { kIncandescentXY[0], kIncandescentXY[1], kLivingRoomIllum }, // WINDOW
- { kDirectSunlightXY[0], kDirectSunlightXY[1], kDirectSunIllum }, // SUN
- { kNoonSkyXY[0], kNoonSkyXY[1], kDaylightShadeIllum / kDirectSunIllum }, // SKY
- { kMoonlightXY[0], kMoonlightXY[1], kFullMoonIllum } // MOON
-};
-
-const uint8_t Scene::kMaterialsFlags[Scene::NUM_MATERIALS] = {
- 0,
- kShadowed,
- kShadowed,
- kShadowed,
- kShadowed,
- kShadowed,
- kShadowed,
- kSelfLit,
- kSelfLit,
- kSky,
- kSelfLit,
-};
-
-} // namespace android
diff --git a/tools/emulator/system/camera/fake-pipeline2/Scene.h b/tools/emulator/system/camera/fake-pipeline2/Scene.h
deleted file mode 100644
index 687e427e6..000000000
--- a/tools/emulator/system/camera/fake-pipeline2/Scene.h
+++ /dev/null
@@ -1,180 +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.
- */
-
-/**
- * The Scene class implements a simple physical simulation of a scene, using the
- * CIE 1931 colorspace to represent light in physical units (lux).
- *
- * It's fairly approximate, but does provide a scene with realistic widely
- * variable illumination levels and colors over time.
- *
- */
-
-#ifndef HW_EMULATOR_CAMERA2_SCENE_H
-#define HW_EMULATOR_CAMERA2_SCENE_H
-
-#include "utils/Timers.h"
-
-namespace android {
-
-class Scene {
- public:
- Scene(int sensorWidthPx,
- int sensorHeightPx,
- float sensorSensitivity);
- ~Scene();
-
- // Set the filter coefficients for the red, green, and blue filters on the
- // sensor. Used as an optimization to pre-calculate various illuminance
- // values. Two different green filters can be provided, to account for
- // possible cross-talk on a Bayer sensor. Must be called before
- // calculateScene.
- void setColorFilterXYZ(
- float rX, float rY, float rZ,
- float grX, float grY, float grZ,
- float gbX, float gbY, float gbZ,
- float bX, float bY, float bZ);
-
- // Set time of day (24-hour clock). This controls the general light levels
- // in the scene. Must be called before calculateScene
- void setHour(int hour);
- // Get current hour
- int getHour();
-
- // Set the duration of exposure for determining luminous exposure.
- // Must be called before calculateScene
- void setExposureDuration(float seconds);
-
- // Calculate scene information for current hour and the time offset since
- // the hour. Must be called at least once before calling getLuminousExposure.
- // Resets pixel readout location to 0,0
- void calculateScene(nsecs_t time);
-
- // Set sensor pixel readout location.
- void setReadoutPixel(int x, int y);
-
- // Get sensor response in physical units (electrons) for light hitting the
- // current readout pixel, after passing through color filters. The readout
- // pixel will be auto-incremented. The returned array can be indexed with
- // ColorChannels.
- const uint32_t* getPixelElectrons();
-
- enum ColorChannels {
- R = 0,
- Gr,
- Gb,
- B,
- Y,
- Cb,
- Cr,
- NUM_CHANNELS
- };
-
- private:
- // Sensor color filtering coefficients in XYZ
- float mFilterR[3];
- float mFilterGr[3];
- float mFilterGb[3];
- float mFilterB[3];
-
- int mOffsetX, mOffsetY;
- int mMapDiv;
-
- int mHandshakeX, mHandshakeY;
-
- int mSensorWidth;
- int mSensorHeight;
- int mCurrentX;
- int mCurrentY;
- int mSubX;
- int mSubY;
- int mSceneX;
- int mSceneY;
- int mSceneIdx;
- uint32_t *mCurrentSceneMaterial;
-
- int mHour;
- float mExposureDuration;
- float mSensorSensitivity;
-
- enum Materials {
- GRASS = 0,
- GRASS_SHADOW,
- HILL,
- WALL,
- ROOF,
- DOOR,
- CHIMNEY,
- WINDOW,
- SUN,
- SKY,
- MOON,
- NUM_MATERIALS
- };
-
- uint32_t mCurrentColors[NUM_MATERIALS*NUM_CHANNELS];
-
- /**
- * Constants for scene definition. These are various degrees of approximate.
- */
-
- // RGB->YUV conversion
- static const float kRgb2Yuv[12];
-
- // Aperture of imaging lens
- static const float kAperture;
-
- // Sun, moon illuminance levels in 2-hour increments. These don't match any
- // real day anywhere.
- static const uint32_t kTimeStep = 2;
- static const float kSunlight[];
- static const float kMoonlight[];
- static const int kSunOverhead;
- static const int kMoonOverhead;
-
- // Illumination levels for various conditions, in lux
- static const float kDirectSunIllum;
- static const float kDaylightShadeIllum;
- static const float kSunsetIllum;
- static const float kTwilightIllum;
- static const float kFullMoonIllum;
- static const float kClearNightIllum;
- static const float kStarIllum;
- static const float kLivingRoomIllum;
-
- // Chromaticity of various illumination sources
- static const float kIncandescentXY[2];
- static const float kDirectSunlightXY[2];
- static const float kDaylightXY[2];
- static const float kNoonSkyXY[2];
- static const float kMoonlightXY[2];
- static const float kSunsetXY[2];
-
- static const uint8_t kSelfLit;
- static const uint8_t kShadowed;
- static const uint8_t kSky;
-
- static const float kMaterials_xyY[NUM_MATERIALS][3];
- static const uint8_t kMaterialsFlags[NUM_MATERIALS];
-
- static const int kSceneWidth;
- static const int kSceneHeight;
- static const uint8_t kScene[];
-};
-
-}
-
-#endif // HW_EMULATOR_CAMERA2_SCENE_H
diff --git a/tools/emulator/system/camera/fake-pipeline2/Sensor.cpp b/tools/emulator/system/camera/fake-pipeline2/Sensor.cpp
deleted file mode 100644
index 73f1fb56f..000000000
--- a/tools/emulator/system/camera/fake-pipeline2/Sensor.cpp
+++ /dev/null
@@ -1,500 +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.
- */
-
-//#define LOG_NDEBUG 0
-//#define LOG_NNDEBUG 0
-#define LOG_TAG "EmulatedCamera2_Sensor"
-
-#ifdef LOG_NNDEBUG
-#define ALOGVV(...) ALOGV(__VA_ARGS__)
-#else
-#define ALOGVV(...) ((void)0)
-#endif
-
-#include <utils/Log.h>
-
-#include "../EmulatedFakeCamera2.h"
-#include "Sensor.h"
-#include <cmath>
-#include <cstdlib>
-#include "system/camera_metadata.h"
-
-namespace android {
-
-const unsigned int Sensor::kResolution[2] = {640, 480};
-
-const nsecs_t Sensor::kExposureTimeRange[2] =
- {1000L, 30000000000L} ; // 1 us - 30 sec
-const nsecs_t Sensor::kFrameDurationRange[2] =
- {33331760L, 30000000000L}; // ~1/30 s - 30 sec
-const nsecs_t Sensor::kMinVerticalBlank = 10000L;
-
-const uint8_t Sensor::kColorFilterArrangement = ANDROID_SENSOR_RGGB;
-
-// Output image data characteristics
-const uint32_t Sensor::kMaxRawValue = 4000;
-const uint32_t Sensor::kBlackLevel = 1000;
-
-// Sensor sensitivity
-const float Sensor::kSaturationVoltage = 0.520f;
-const uint32_t Sensor::kSaturationElectrons = 2000;
-const float Sensor::kVoltsPerLuxSecond = 0.100f;
-
-const float Sensor::kElectronsPerLuxSecond =
- Sensor::kSaturationElectrons / Sensor::kSaturationVoltage
- * Sensor::kVoltsPerLuxSecond;
-
-const float Sensor::kBaseGainFactor = (float)Sensor::kMaxRawValue /
- Sensor::kSaturationElectrons;
-
-const float Sensor::kReadNoiseStddevBeforeGain = 1.177; // in electrons
-const float Sensor::kReadNoiseStddevAfterGain = 2.100; // in digital counts
-const float Sensor::kReadNoiseVarBeforeGain =
- Sensor::kReadNoiseStddevBeforeGain *
- Sensor::kReadNoiseStddevBeforeGain;
-const float Sensor::kReadNoiseVarAfterGain =
- Sensor::kReadNoiseStddevAfterGain *
- Sensor::kReadNoiseStddevAfterGain;
-
-// While each row has to read out, reset, and then expose, the (reset +
-// expose) sequence can be overlapped by other row readouts, so the final
-// minimum frame duration is purely a function of row readout time, at least
-// if there's a reasonable number of rows.
-const nsecs_t Sensor::kRowReadoutTime =
- Sensor::kFrameDurationRange[0] / Sensor::kResolution[1];
-
-const uint32_t Sensor::kAvailableSensitivities[5] =
- {100, 200, 400, 800, 1600};
-const uint32_t Sensor::kDefaultSensitivity = 100;
-
-/** A few utility functions for math, normal distributions */
-
-// Take advantage of IEEE floating-point format to calculate an approximate
-// square root. Accurate to within +-3.6%
-float sqrtf_approx(float r) {
- // Modifier is based on IEEE floating-point representation; the
- // manipulations boil down to finding approximate log2, dividing by two, and
- // then inverting the log2. A bias is added to make the relative error
- // symmetric about the real answer.
- const int32_t modifier = 0x1FBB4000;
-
- int32_t r_i = *(int32_t*)(&r);
- r_i = (r_i >> 1) + modifier;
-
- return *(float*)(&r_i);
-}
-
-
-
-Sensor::Sensor(EmulatedFakeCamera2 *parent):
- Thread(false),
- mParent(parent),
- mGotVSync(false),
- mExposureTime(kFrameDurationRange[0]-kMinVerticalBlank),
- mFrameDuration(kFrameDurationRange[0]),
- mGainFactor(kDefaultSensitivity),
- mNextBuffers(NULL),
- mCapturedBuffers(NULL),
- mScene(kResolution[0], kResolution[1], kElectronsPerLuxSecond)
-{
-
-}
-
-Sensor::~Sensor() {
- shutDown();
-}
-
-status_t Sensor::startUp() {
- ALOGV("%s: E", __FUNCTION__);
-
- int res;
- mCapturedBuffers = NULL;
- res = run("EmulatedFakeCamera2::Sensor",
- ANDROID_PRIORITY_URGENT_DISPLAY);
-
- if (res != OK) {
- ALOGE("Unable to start up sensor capture thread: %d", res);
- }
- return res;
-}
-
-status_t Sensor::shutDown() {
- ALOGV("%s: E", __FUNCTION__);
-
- int res;
- res = requestExitAndWait();
- if (res != OK) {
- ALOGE("Unable to shut down sensor capture thread: %d", res);
- }
- return res;
-}
-
-Scene &Sensor::getScene() {
- return mScene;
-}
-
-void Sensor::setExposureTime(uint64_t ns) {
- Mutex::Autolock lock(mControlMutex);
- ALOGVV("Exposure set to %f", ns/1000000.f);
- mExposureTime = ns;
-}
-
-void Sensor::setFrameDuration(uint64_t ns) {
- Mutex::Autolock lock(mControlMutex);
- ALOGVV("Frame duration set to %f", ns/1000000.f);
- mFrameDuration = ns;
-}
-
-void Sensor::setSensitivity(uint32_t gain) {
- Mutex::Autolock lock(mControlMutex);
- ALOGVV("Gain set to %d", gain);
- mGainFactor = gain;
-}
-
-void Sensor::setDestinationBuffers(Buffers *buffers) {
- Mutex::Autolock lock(mControlMutex);
- mNextBuffers = buffers;
-}
-
-bool Sensor::waitForVSync(nsecs_t reltime) {
- int res;
- Mutex::Autolock lock(mControlMutex);
-
- mGotVSync = false;
- res = mVSync.waitRelative(mControlMutex, reltime);
- if (res != OK && res != TIMED_OUT) {
- ALOGE("%s: Error waiting for VSync signal: %d", __FUNCTION__, res);
- return false;
- }
- return mGotVSync;
-}
-
-bool Sensor::waitForNewFrame(nsecs_t reltime,
- nsecs_t *captureTime) {
- Mutex::Autolock lock(mReadoutMutex);
- uint8_t *ret;
- if (mCapturedBuffers == NULL) {
- int res;
- res = mReadoutAvailable.waitRelative(mReadoutMutex, reltime);
- if (res == TIMED_OUT) {
- return false;
- } else if (res != OK || mCapturedBuffers == NULL) {
- ALOGE("Error waiting for sensor readout signal: %d", res);
- return false;
- }
- } else {
- mReadoutComplete.signal();
- }
-
- *captureTime = mCaptureTime;
- mCapturedBuffers = NULL;
- return true;
-}
-
-status_t Sensor::readyToRun() {
- ALOGV("Starting up sensor thread");
- mStartupTime = systemTime();
- mNextCaptureTime = 0;
- mNextCapturedBuffers = NULL;
- return OK;
-}
-
-bool Sensor::threadLoop() {
- /**
- * Sensor capture operation main loop.
- *
- * Stages are out-of-order relative to a single frame's processing, but
- * in-order in time.
- */
-
- /**
- * Stage 1: Read in latest control parameters
- */
- uint64_t exposureDuration;
- uint64_t frameDuration;
- uint32_t gain;
- Buffers *nextBuffers;
- {
- Mutex::Autolock lock(mControlMutex);
- exposureDuration = mExposureTime;
- frameDuration = mFrameDuration;
- gain = mGainFactor;
- nextBuffers = mNextBuffers;
- // Don't reuse a buffer set
- mNextBuffers = NULL;
-
- // Signal VSync for start of readout
- ALOGVV("Sensor VSync");
- mGotVSync = true;
- mVSync.signal();
- }
-
- /**
- * Stage 3: Read out latest captured image
- */
-
- Buffers *capturedBuffers = NULL;
- nsecs_t captureTime = 0;
-
- nsecs_t startRealTime = systemTime();
- // Stagefright cares about system time for timestamps, so base simulated
- // time on that.
- nsecs_t simulatedTime = startRealTime;
- nsecs_t frameEndRealTime = startRealTime + frameDuration;
- nsecs_t frameReadoutEndRealTime = startRealTime +
- kRowReadoutTime * kResolution[1];
-
- if (mNextCapturedBuffers != NULL) {
- ALOGVV("Sensor starting readout");
- // Pretend we're doing readout now; will signal once enough time has elapsed
- capturedBuffers = mNextCapturedBuffers;
- captureTime = mNextCaptureTime;
- }
- simulatedTime += kRowReadoutTime + kMinVerticalBlank;
-
- // TODO: Move this signal to another thread to simulate readout
- // time properly
- if (capturedBuffers != NULL) {
- ALOGVV("Sensor readout complete");
- Mutex::Autolock lock(mReadoutMutex);
- if (mCapturedBuffers != NULL) {
- ALOGV("Waiting for readout thread to catch up!");
- mReadoutComplete.wait(mReadoutMutex);
- }
-
- mCapturedBuffers = capturedBuffers;
- mCaptureTime = captureTime;
- mReadoutAvailable.signal();
- capturedBuffers = NULL;
- }
-
- /**
- * Stage 2: Capture new image
- */
-
- mNextCaptureTime = simulatedTime;
- mNextCapturedBuffers = nextBuffers;
-
- if (mNextCapturedBuffers != NULL) {
- ALOGVV("Starting next capture: Exposure: %f ms, gain: %d",
- (float)exposureDuration/1e6, gain);
- mScene.setExposureDuration((float)exposureDuration/1e9);
- mScene.calculateScene(mNextCaptureTime);
-
- // Might be adding more buffers, so size isn't constant
- for (size_t i = 0; i < mNextCapturedBuffers->size(); i++) {
- const StreamBuffer &b = (*mNextCapturedBuffers)[i];
- ALOGVV("Sensor capturing buffer %d: stream %d,"
- " %d x %d, format %x, stride %d, buf %p, img %p",
- i, b.streamId, b.width, b.height, b.format, b.stride,
- b.buffer, b.img);
- switch(b.format) {
- case HAL_PIXEL_FORMAT_RAW_SENSOR:
- captureRaw(b.img, gain, b.stride);
- break;
- case HAL_PIXEL_FORMAT_RGB_888:
- captureRGB(b.img, gain, b.stride);
- break;
- case HAL_PIXEL_FORMAT_RGBA_8888:
- captureRGBA(b.img, gain, b.stride);
- break;
- case HAL_PIXEL_FORMAT_BLOB:
- // Add auxillary buffer of the right size
- // Assumes only one BLOB (JPEG) buffer in
- // mNextCapturedBuffers
- StreamBuffer bAux;
- bAux.streamId = 0;
- bAux.width = b.width;
- bAux.height = b.height;
- bAux.format = HAL_PIXEL_FORMAT_RGB_888;
- bAux.stride = b.width;
- bAux.buffer = NULL;
- // TODO: Reuse these
- bAux.img = new uint8_t[b.width * b.height * 3];
- mNextCapturedBuffers->push_back(bAux);
- break;
- case HAL_PIXEL_FORMAT_YCrCb_420_SP:
- captureNV21(b.img, gain, b.stride);
- break;
- case HAL_PIXEL_FORMAT_YV12:
- // TODO:
- ALOGE("%s: Format %x is TODO", __FUNCTION__, b.format);
- break;
- default:
- ALOGE("%s: Unknown format %x, no output", __FUNCTION__,
- b.format);
- break;
- }
- }
- }
-
- ALOGVV("Sensor vertical blanking interval");
- nsecs_t workDoneRealTime = systemTime();
- const nsecs_t timeAccuracy = 2e6; // 2 ms of imprecision is ok
- if (workDoneRealTime < frameEndRealTime - timeAccuracy) {
- timespec t;
- t.tv_sec = (frameEndRealTime - workDoneRealTime) / 1000000000L;
- t.tv_nsec = (frameEndRealTime - workDoneRealTime) % 1000000000L;
-
- int ret;
- do {
- ret = nanosleep(&t, &t);
- } while (ret != 0);
- }
- nsecs_t endRealTime = systemTime();
- ALOGVV("Frame cycle took %d ms, target %d ms",
- (int)((endRealTime - startRealTime)/1000000),
- (int)(frameDuration / 1000000));
- return true;
-};
-
-void Sensor::captureRaw(uint8_t *img, uint32_t gain, uint32_t stride) {
- float totalGain = gain/100.0 * kBaseGainFactor;
- float noiseVarGain = totalGain * totalGain;
- float readNoiseVar = kReadNoiseVarBeforeGain * noiseVarGain
- + kReadNoiseVarAfterGain;
-
- int bayerSelect[4] = {Scene::R, Scene::Gr, Scene::Gb, Scene::B}; // RGGB
- mScene.setReadoutPixel(0,0);
- for (unsigned int y = 0; y < kResolution[1]; y++ ) {
- int *bayerRow = bayerSelect + (y & 0x1) * 2;
- uint16_t *px = (uint16_t*)img + y * stride;
- for (unsigned int x = 0; x < kResolution[0]; x++) {
- uint32_t electronCount;
- electronCount = mScene.getPixelElectrons()[bayerRow[x & 0x1]];
-
- // TODO: Better pixel saturation curve?
- electronCount = (electronCount < kSaturationElectrons) ?
- electronCount : kSaturationElectrons;
-
- // TODO: Better A/D saturation curve?
- uint16_t rawCount = electronCount * totalGain;
- rawCount = (rawCount < kMaxRawValue) ? rawCount : kMaxRawValue;
-
- // Calculate noise value
- // TODO: Use more-correct Gaussian instead of uniform noise
- float photonNoiseVar = electronCount * noiseVarGain;
- float noiseStddev = sqrtf_approx(readNoiseVar + photonNoiseVar);
- // Scaled to roughly match gaussian/uniform noise stddev
- float noiseSample = std::rand() * (2.5 / (1.0 + RAND_MAX)) - 1.25;
-
- rawCount += kBlackLevel;
- rawCount += noiseStddev * noiseSample;
-
- *px++ = rawCount;
- }
- // TODO: Handle this better
- //simulatedTime += kRowReadoutTime;
- }
- ALOGVV("Raw sensor image captured");
-}
-
-void Sensor::captureRGBA(uint8_t *img, uint32_t gain, uint32_t stride) {
- float totalGain = gain/100.0 * kBaseGainFactor;
- // In fixed-point math, calculate total scaling from electrons to 8bpp
- int scale64x = 64 * totalGain * 255 / kMaxRawValue;
- uint32_t inc = kResolution[0] / stride;
-
- for (unsigned int y = 0, outY = 0; y < kResolution[1]; y+=inc, outY++ ) {
- uint8_t *px = img + outY * stride * 4;
- mScene.setReadoutPixel(0, y);
- for (unsigned int x = 0; x < kResolution[0]; x+=inc) {
- uint32_t rCount, gCount, bCount;
- // TODO: Perfect demosaicing is a cheat
- const uint32_t *pixel = mScene.getPixelElectrons();
- rCount = pixel[Scene::R] * scale64x;
- gCount = pixel[Scene::Gr] * scale64x;
- bCount = pixel[Scene::B] * scale64x;
-
- *px++ = rCount < 255*64 ? rCount / 64 : 255;
- *px++ = gCount < 255*64 ? gCount / 64 : 255;
- *px++ = bCount < 255*64 ? bCount / 64 : 255;
- *px++ = 255;
- for (unsigned int j = 1; j < inc; j++)
- mScene.getPixelElectrons();
- }
- // TODO: Handle this better
- //simulatedTime += kRowReadoutTime;
- }
- ALOGVV("RGBA sensor image captured");
-}
-
-void Sensor::captureRGB(uint8_t *img, uint32_t gain, uint32_t stride) {
- float totalGain = gain/100.0 * kBaseGainFactor;
- // In fixed-point math, calculate total scaling from electrons to 8bpp
- int scale64x = 64 * totalGain * 255 / kMaxRawValue;
- uint32_t inc = kResolution[0] / stride;
-
- for (unsigned int y = 0, outY = 0; y < kResolution[1]; y += inc, outY++ ) {
- mScene.setReadoutPixel(0, y);
- uint8_t *px = img + outY * stride * 3;
- for (unsigned int x = 0; x < kResolution[0]; x += inc) {
- uint32_t rCount, gCount, bCount;
- // TODO: Perfect demosaicing is a cheat
- const uint32_t *pixel = mScene.getPixelElectrons();
- rCount = pixel[Scene::R] * scale64x;
- gCount = pixel[Scene::Gr] * scale64x;
- bCount = pixel[Scene::B] * scale64x;
-
- *px++ = rCount < 255*64 ? rCount / 64 : 255;
- *px++ = gCount < 255*64 ? gCount / 64 : 255;
- *px++ = bCount < 255*64 ? bCount / 64 : 255;
- for (unsigned int j = 1; j < inc; j++)
- mScene.getPixelElectrons();
- }
- // TODO: Handle this better
- //simulatedTime += kRowReadoutTime;
- }
- ALOGVV("RGB sensor image captured");
-}
-
-void Sensor::captureNV21(uint8_t *img, uint32_t gain, uint32_t stride) {
- float totalGain = gain/100.0 * kBaseGainFactor;
- // In fixed-point math, calculate total scaling from electrons to 8bpp
- int scale64x = 64 * totalGain * 255 / kMaxRawValue;
-
- // TODO: Make full-color
- uint32_t inc = kResolution[0] / stride;
- uint32_t outH = kResolution[1] / inc;
- for (unsigned int y = 0, outY = 0, outUV = outH;
- y < kResolution[1]; y+=inc, outY++, outUV ) {
- uint8_t *pxY = img + outY * stride;
- mScene.setReadoutPixel(0,y);
- for (unsigned int x = 0; x < kResolution[0]; x+=inc) {
- uint32_t rCount, gCount, bCount;
- // TODO: Perfect demosaicing is a cheat
- const uint32_t *pixel = mScene.getPixelElectrons();
- rCount = pixel[Scene::R] * scale64x;
- gCount = pixel[Scene::Gr] * scale64x;
- bCount = pixel[Scene::B] * scale64x;
- uint32_t avg = (rCount + gCount + bCount) / 3;
- *pxY++ = avg < 255*64 ? avg / 64 : 255;
- for (unsigned int j = 1; j < inc; j++)
- mScene.getPixelElectrons();
- }
- }
- for (unsigned int y = 0, outY = outH; y < kResolution[1]/2; y+=inc, outY++) {
- uint8_t *px = img + outY * stride;
- for (unsigned int x = 0; x < kResolution[0]; x+=inc) {
- // UV to neutral
- *px++ = 128;
- *px++ = 128;
- }
- }
- ALOGVV("NV21 sensor image captured");
-}
-
-} // namespace android
diff --git a/tools/emulator/system/camera/fake-pipeline2/Sensor.h b/tools/emulator/system/camera/fake-pipeline2/Sensor.h
deleted file mode 100644
index ce7b4ade4..000000000
--- a/tools/emulator/system/camera/fake-pipeline2/Sensor.h
+++ /dev/null
@@ -1,221 +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.
- */
-
-/**
- * This class is a simple simulation of a typical CMOS cellphone imager chip,
- * which outputs 12-bit Bayer-mosaic raw images.
- *
- * The sensor is abstracted as operating as a pipeline 3 stages deep;
- * conceptually, each frame to be captured goes through these three stages. The
- * processing step for the sensor is marked off by vertical sync signals, which
- * indicate the start of readout of the oldest frame. The interval between
- * processing steps depends on the frame duration of the frame currently being
- * captured. The stages are 1) configure, 2) capture, and 3) readout. During
- * configuration, the sensor's registers for settings such as exposure time,
- * frame duration, and gain are set for the next frame to be captured. In stage
- * 2, the image data for the frame is actually captured by the sensor. Finally,
- * in stage 3, the just-captured data is read out and sent to the rest of the
- * system.
- *
- * The sensor is assumed to be rolling-shutter, so low-numbered rows of the
- * sensor are exposed earlier in time than larger-numbered rows, with the time
- * offset between each row being equal to the row readout time.
- *
- * The characteristics of this sensor don't correspond to any actual sensor,
- * but are not far off typical sensors.
- *
- * Example timing diagram, with three frames:
- * Frame 0-1: Frame duration 50 ms, exposure time 20 ms.
- * Frame 2: Frame duration 75 ms, exposure time 65 ms.
- * Legend:
- * C = update sensor registers for frame
- * v = row in reset (vertical blanking interval)
- * E = row capturing image data
- * R = row being read out
- * | = vertical sync signal
- *time(ms)| 0 55 105 155 230 270
- * Frame 0| :configure : capture : readout : : :
- * Row # | ..|CCCC______|_________|_________| : :
- * 0 | :\ \vvvvvEEEER \ : :
- * 500 | : \ \vvvvvEEEER \ : :
- * 1000 | : \ \vvvvvEEEER \ : :
- * 1500 | : \ \vvvvvEEEER \ : :
- * 2000 | : \__________\vvvvvEEEER_________\ : :
- * Frame 1| : configure capture readout : :
- * Row # | : |CCCC_____|_________|______________| :
- * 0 | : :\ \vvvvvEEEER \ :
- * 500 | : : \ \vvvvvEEEER \ :
- * 1000 | : : \ \vvvvvEEEER \ :
- * 1500 | : : \ \vvvvvEEEER \ :
- * 2000 | : : \_________\vvvvvEEEER______________\ :
- * Frame 2| : : configure capture readout:
- * Row # | : : |CCCC_____|______________|_______|...
- * 0 | : : :\ \vEEEEEEEEEEEEER \
- * 500 | : : : \ \vEEEEEEEEEEEEER \
- * 1000 | : : : \ \vEEEEEEEEEEEEER \
- * 1500 | : : : \ \vEEEEEEEEEEEEER \
- * 2000 | : : : \_________\vEEEEEEEEEEEEER_______\
- */
-
-#ifndef HW_EMULATOR_CAMERA2_SENSOR_H
-#define HW_EMULATOR_CAMERA2_SENSOR_H
-
-#include "utils/Thread.h"
-#include "utils/Mutex.h"
-#include "utils/Timers.h"
-
-#include "Scene.h"
-#include "Base.h"
-
-namespace android {
-
-class EmulatedFakeCamera2;
-
-class Sensor: private Thread, public virtual RefBase {
- public:
-
- Sensor(EmulatedFakeCamera2 *parent);
- ~Sensor();
-
- /*
- * Power control
- */
-
- status_t startUp();
- status_t shutDown();
-
- /*
- * Access to scene
- */
- Scene &getScene();
-
- /*
- * Controls that can be updated every frame
- */
-
- void setExposureTime(uint64_t ns);
- void setFrameDuration(uint64_t ns);
- void setSensitivity(uint32_t gain);
- // Buffer must be at least stride*height*2 bytes in size
- void setDestinationBuffers(Buffers *buffers);
-
- /*
- * Controls that cause reconfiguration delay
- */
-
- void setBinning(int horizontalFactor, int verticalFactor);
-
- /*
- * Synchronizing with sensor operation (vertical sync)
- */
-
- // Wait until the sensor outputs its next vertical sync signal, meaning it
- // is starting readout of its latest frame of data. Returns true if vertical
- // sync is signaled, false if the wait timed out.
- bool waitForVSync(nsecs_t reltime);
-
- // Wait until a new frame has been read out, and then return the time
- // capture started. May return immediately if a new frame has been pushed
- // since the last wait for a new frame. Returns true if new frame is
- // returned, false if timed out.
- bool waitForNewFrame(nsecs_t reltime,
- nsecs_t *captureTime);
-
- /**
- * Static sensor characteristics
- */
- static const unsigned int kResolution[2];
-
- static const nsecs_t kExposureTimeRange[2];
- static const nsecs_t kFrameDurationRange[2];
- static const nsecs_t kMinVerticalBlank;
-
- static const uint8_t kColorFilterArrangement;
-
- // Output image data characteristics
- static const uint32_t kMaxRawValue;
- static const uint32_t kBlackLevel;
- // Sensor sensitivity, approximate
-
- static const float kSaturationVoltage;
- static const uint32_t kSaturationElectrons;
- static const float kVoltsPerLuxSecond;
- static const float kElectronsPerLuxSecond;
-
- static const float kBaseGainFactor;
-
- static const float kReadNoiseStddevBeforeGain; // In electrons
- static const float kReadNoiseStddevAfterGain; // In raw digital units
- static const float kReadNoiseVarBeforeGain;
- static const float kReadNoiseVarAfterGain;
-
- // While each row has to read out, reset, and then expose, the (reset +
- // expose) sequence can be overlapped by other row readouts, so the final
- // minimum frame duration is purely a function of row readout time, at least
- // if there's a reasonable number of rows.
- static const nsecs_t kRowReadoutTime;
-
- static const uint32_t kAvailableSensitivities[5];
- static const uint32_t kDefaultSensitivity;
-
- private:
- EmulatedFakeCamera2 *mParent;
-
- Mutex mControlMutex; // Lock before accessing control parameters
- // Start of control parameters
- Condition mVSync;
- bool mGotVSync;
- uint64_t mExposureTime;
- uint64_t mFrameDuration;
- uint32_t mGainFactor;
- Buffers *mNextBuffers;
-
- // End of control parameters
-
- Mutex mReadoutMutex; // Lock before accessing readout variables
- // Start of readout variables
- Condition mReadoutAvailable;
- Condition mReadoutComplete;
- Buffers *mCapturedBuffers;
- nsecs_t mCaptureTime;
- // End of readout variables
-
- // Time of sensor startup, used for simulation zero-time point
- nsecs_t mStartupTime;
-
- /**
- * Inherited Thread virtual overrides, and members only used by the
- * processing thread
- */
- private:
- virtual status_t readyToRun();
-
- virtual bool threadLoop();
-
- nsecs_t mNextCaptureTime;
- Buffers *mNextCapturedBuffers;
-
- Scene mScene;
-
- void captureRaw(uint8_t *img, uint32_t gain, uint32_t stride);
- void captureRGBA(uint8_t *img, uint32_t gain, uint32_t stride);
- void captureRGB(uint8_t *img, uint32_t gain, uint32_t stride);
- void captureNV21(uint8_t *img, uint32_t gain, uint32_t stride);
-};
-
-}
-
-#endif // HW_EMULATOR_CAMERA2_SENSOR_H
diff --git a/tools/emulator/system/camera/media_codecs.xml b/tools/emulator/system/camera/media_codecs.xml
deleted file mode 100644
index dcd8ce10f..000000000
--- a/tools/emulator/system/camera/media_codecs.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!-- 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.
--->
-
-<!--
-<!DOCTYPE MediaCodecs [
-<!ELEMENT MediaCodecs (Decoders,Encoders)>
-<!ELEMENT Decoders (MediaCodec*)>
-<!ELEMENT Encoders (MediaCodec*)>
-<!ELEMENT MediaCodec (Type*,Quirk*)>
-<!ATTLIST MediaCodec name CDATA #REQUIRED>
-<!ATTLIST MediaCodec type CDATA>
-<!ELEMENT Type EMPTY>
-<!ATTLIST Type name CDATA #REQUIRED>
-<!ELEMENT Quirk EMPTY>
-<!ATTLIST Quirk name CDATA #REQUIRED>
-]>
-
-There's a simple and a complex syntax to declare the availability of a
-media codec:
-
-A codec that properly follows the OpenMax spec and therefore doesn't have any
-quirks and that only supports a single content type can be declared like so:
-
- <MediaCodec name="OMX.foo.bar" type="something/interesting" />
-
-If a codec has quirks OR supports multiple content types, the following syntax
-can be used:
-
- <MediaCodec name="OMX.foo.bar" >
- <Type name="something/interesting" />
- <Type name="something/else" />
- ...
- <Quirk name="requires-allocate-on-input-ports" />
- <Quirk name="requires-allocate-on-output-ports" />
- <Quirk name="output-buffers-are-unreadable" />
- </MediaCodec>
-
-Only the three quirks included above are recognized at this point:
-
-"requires-allocate-on-input-ports"
- must be advertised if the component does not properly support specification
- of input buffers using the OMX_UseBuffer(...) API but instead requires
- OMX_AllocateBuffer to be used.
-
-"requires-allocate-on-output-ports"
- must be advertised if the component does not properly support specification
- of output buffers using the OMX_UseBuffer(...) API but instead requires
- OMX_AllocateBuffer to be used.
-
-"output-buffers-are-unreadable"
- must be advertised if the emitted output buffers of a decoder component
- are not readable, i.e. use a custom format even though abusing one of
- the official OMX colorspace constants.
- Clients of such decoders will not be able to access the decoded data,
- naturally making the component much less useful. The only use for
- a component with this quirk is to render the output to the screen.
- Audio decoders MUST NOT advertise this quirk.
- Video decoders that advertise this quirk must be accompanied by a
- corresponding color space converter for thumbnail extraction,
- matching surfaceflinger support that can render the custom format to
- a texture and possibly other code, so just DON'T USE THIS QUIRK.
-
--->
-
-<MediaCodecs>
- <Decoders>
- <MediaCodec name="OMX.google.mp3.decoder" type="audio/mpeg" />
- <MediaCodec name="OMX.google.amrnb.decoder" type="audio/3gpp" />
- <MediaCodec name="OMX.google.amrwb.decoder" type="audio/amr-wb" />
- <MediaCodec name="OMX.google.aac.decoder" type="audio/mp4a-latm" />
- <MediaCodec name="OMX.google.g711.alaw.decoder" type="audio/g711-alaw" />
- <MediaCodec name="OMX.google.g711.mlaw.decoder" type="audio/g711-mlaw" />
- <MediaCodec name="OMX.google.vorbis.decoder" type="audio/vorbis" />
-
- <MediaCodec name="OMX.google.mpeg4.decoder" type="video/mp4v-es" />
- <MediaCodec name="OMX.google.h263.decoder" type="video/3gpp" />
- <MediaCodec name="OMX.google.h264.decoder" type="video/avc" />
- <MediaCodec name="OMX.google.vpx.decoder" type="video/x-vnd.on2.vp8" />
- </Decoders>
-
- <Encoders>
- <MediaCodec name="OMX.google.aac.encoder" type="audio/mp4a-latm" />
- <MediaCodec name="OMX.google.amrnb.encoder" type="audio/3gpp" />
- <MediaCodec name="OMX.google.amrwb.encoder" type="audio/amr-wb" />
- <MediaCodec name="OMX.google.h263.encoder" type="video/3gpp" />
- <MediaCodec name="OMX.google.h264.encoder" type="video/avc" />
- <MediaCodec name="OMX.google.mpeg4.encoder" type="video/mp4v-es" />
- <MediaCodec name="OMX.google.flac.encoder" type="audio/flac" />
- </Encoders>
-</MediaCodecs>
diff --git a/tools/emulator/system/camera/media_profiles.xml b/tools/emulator/system/camera/media_profiles.xml
deleted file mode 100644
index 42ceb8d11..000000000
--- a/tools/emulator/system/camera/media_profiles.xml
+++ /dev/null
@@ -1,414 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-<!DOCTYPE MediaSettings [
-<!ELEMENT MediaSettings (CamcorderProfiles,
- EncoderOutputFileFormat+,
- VideoEncoderCap+,
- AudioEncoderCap+,
- VideoDecoderCap,
- AudioDecoderCap)>
-<!ELEMENT CamcorderProfiles (EncoderProfile+, ImageEncoding+, ImageDecoding, Camera)>
-<!ELEMENT EncoderProfile (Video, Audio)>
-<!ATTLIST EncoderProfile quality (high|low) #REQUIRED>
-<!ATTLIST EncoderProfile fileFormat (mp4|3gp) #REQUIRED>
-<!ATTLIST EncoderProfile duration (30|60) #REQUIRED>
-<!ATTLIST EncoderProfile cameraId (0|1) #REQUIRED>
-<!ELEMENT Video EMPTY>
-<!ATTLIST Video codec (h264|h263|m4v) #REQUIRED>
-<!ATTLIST Video bitRate CDATA #REQUIRED>
-<!ATTLIST Video width CDATA #REQUIRED>
-<!ATTLIST Video height CDATA #REQUIRED>
-<!ATTLIST Video frameRate CDATA #REQUIRED>
-<!ELEMENT Audio EMPTY>
-<!ATTLIST Audio codec (amrnb|amrwb|aac) #REQUIRED>
-<!ATTLIST Audio bitRate CDATA #REQUIRED>
-<!ATTLIST Audio sampleRate CDATA #REQUIRED>
-<!ATTLIST Audio channels (1|2) #REQUIRED>
-<!ELEMENT ImageEncoding EMPTY>
-<!ATTLIST ImageEncoding quality (90|80|70|60|50|40) #REQUIRED>
-<!ELEMENT ImageDecoding EMPTY>
-<!ATTLIST ImageDecoding memCap CDATA #REQUIRED>
-<!ELEMENT Camera EMPTY>
-<!ELEMENT EncoderOutputFileFormat EMPTY>
-<!ATTLIST EncoderOutputFileFormat name (mp4|3gp) #REQUIRED>
-<!ELEMENT VideoEncoderCap EMPTY>
-<!ATTLIST VideoEncoderCap name (h264|h263|m4v|wmv) #REQUIRED>
-<!ATTLIST VideoEncoderCap enabled (true|false) #REQUIRED>
-<!ATTLIST VideoEncoderCap minBitRate CDATA #REQUIRED>
-<!ATTLIST VideoEncoderCap maxBitRate CDATA #REQUIRED>
-<!ATTLIST VideoEncoderCap minFrameWidth CDATA #REQUIRED>
-<!ATTLIST VideoEncoderCap maxFrameWidth CDATA #REQUIRED>
-<!ATTLIST VideoEncoderCap minFrameHeight CDATA #REQUIRED>
-<!ATTLIST VideoEncoderCap maxFrameHeight CDATA #REQUIRED>
-<!ATTLIST VideoEncoderCap minFrameRate CDATA #REQUIRED>
-<!ATTLIST VideoEncoderCap maxFrameRate CDATA #REQUIRED>
-<!ELEMENT AudioEncoderCap EMPTY>
-<!ATTLIST AudioEncoderCap name (amrnb|amrwb|aac|wma) #REQUIRED>
-<!ATTLIST AudioEncoderCap enabled (true|false) #REQUIRED>
-<!ATTLIST AudioEncoderCap minBitRate CDATA #REQUIRED>
-<!ATTLIST AudioEncoderCap maxBitRate CDATA #REQUIRED>
-<!ATTLIST AudioEncoderCap minSampleRate CDATA #REQUIRED>
-<!ATTLIST AudioEncoderCap maxSampleRate CDATA #REQUIRED>
-<!ATTLIST AudioEncoderCap minChannels (1|2) #REQUIRED>
-<!ATTLIST AudioEncoderCap maxChannels (1|2) #REQUIRED>
-<!ELEMENT VideoDecoderCap EMPTY>
-<!ATTLIST VideoDecoderCap name (wmv) #REQUIRED>
-<!ATTLIST VideoDecoderCap enabled (true|false) #REQUIRED>
-<!ELEMENT AudioDecoderCap EMPTY>
-<!ATTLIST AudioDecoderCap name (wma) #REQUIRED>
-<!ATTLIST AudioDecoderCap enabled (true|false) #REQUIRED>
-<!ELEMENT VideoEditorCap EMPTY>
-<!ATTLIST VideoEditorCap maxInputFrameWidth CDATA #REQUIRED>
-<!ATTLIST VideoEditorCap maxInputFrameHeight CDATA #REQUIRED>
-<!ATTLIST VideoEditorCap maxOutputFrameWidth CDATA #REQUIRED>
-<!ATTLIST VideoEditorCap maxOutputFrameHeight CDATA #REQUIRED>
-<!ATTLIST VideoEditorCap maxPrefetchYUVFrames CDATA #REQUIRED>
-<!ELEMENT ExportVideoProfile EMPTY>
-<!ATTLIST ExportVideoProfile name (h264|h263|m4v) #REQUIRED>
-<!ATTLIST ExportVideoProfile profile CDATA #REQUIRED>
-<!ATTLIST ExportVideoProfile level CDATA #REQUIRED>
-]>
-<!--
- This file is used to declare the multimedia profiles and capabilities
- on an android-powered device.
--->
-<MediaSettings>
- <!-- Each camcorder profile defines a set of predefined configuration parameters -->
- <CamcorderProfiles cameraId="0">
-
- <EncoderProfile quality="qvga" fileFormat="mp4" duration="60">
- <Video codec="m4v"
- bitRate="128000"
- width="320"
- height="240"
- frameRate="15" />
- <Audio codec="amrnb"
- bitRate="12200"
- sampleRate="8000"
- channels="1" />
- </EncoderProfile>
-
- <EncoderProfile quality="timelapseqcif" fileFormat="mp4" duration="30">
- <Video codec="h264"
- bitRate="192000"
- width="176"
- height="144"
- frameRate="30" />
- <!-- audio setting is ignored -->
- <Audio codec="amrnb"
- bitRate="12200"
- sampleRate="8000"
- channels="1" />
- </EncoderProfile>
-
- <ImageEncoding quality="95" />
- <ImageEncoding quality="80" />
- <ImageEncoding quality="70" />
- <ImageDecoding memCap="20000000" />
-
- </CamcorderProfiles>
-
- <CamcorderProfiles cameraId="1">
-
- <EncoderProfile quality="qvga" fileFormat="mp4" duration="60">
- <Video codec="m4v"
- bitRate="128000"
- width="320"
- height="240"
- frameRate="15" />
- <Audio codec="amrnb"
- bitRate="12200"
- sampleRate="8000"
- channels="1" />
- </EncoderProfile>
-
- <EncoderProfile quality="timelapseqcif" fileFormat="mp4" duration="30">
- <Video codec="h264"
- bitRate="192000"
- width="176"
- height="144"
- frameRate="30" />
- <!-- audio setting is ignored -->
- <Audio codec="amrnb"
- bitRate="12200"
- sampleRate="8000"
- channels="1" />
- </EncoderProfile>
-
- <ImageEncoding quality="95" />
- <ImageEncoding quality="80" />
- <ImageEncoding quality="70" />
- <ImageDecoding memCap="20000000" />
-
- </CamcorderProfiles>
-
- <CamcorderProfiles cameraId="2">
-
- <EncoderProfile quality="qvga" fileFormat="mp4" duration="60">
- <Video codec="m4v"
- bitRate="128000"
- width="320"
- height="240"
- frameRate="15" />
- <Audio codec="amrnb"
- bitRate="12200"
- sampleRate="8000"
- channels="1" />
- </EncoderProfile>
-
- <EncoderProfile quality="timelapseqcif" fileFormat="mp4" duration="30">
- <Video codec="h264"
- bitRate="192000"
- width="176"
- height="144"
- frameRate="30" />
- <!-- audio setting is ignored -->
- <Audio codec="amrnb"
- bitRate="12200"
- sampleRate="8000"
- channels="1" />
- </EncoderProfile>
-
- <ImageEncoding quality="95" />
- <ImageEncoding quality="80" />
- <ImageEncoding quality="70" />
- <ImageDecoding memCap="20000000" />
-
- </CamcorderProfiles>
-
- <CamcorderProfiles cameraId="3">
-
- <EncoderProfile quality="qvga" fileFormat="mp4" duration="60">
- <Video codec="m4v"
- bitRate="128000"
- width="320"
- height="240"
- frameRate="15" />
- <Audio codec="amrnb"
- bitRate="12200"
- sampleRate="8000"
- channels="1" />
- </EncoderProfile>
-
- <EncoderProfile quality="timelapseqcif" fileFormat="mp4" duration="30">
- <Video codec="h264"
- bitRate="192000"
- width="176"
- height="144"
- frameRate="30" />
- <!-- audio setting is ignored -->
- <Audio codec="amrnb"
- bitRate="12200"
- sampleRate="8000"
- channels="1" />
- </EncoderProfile>
-
- <ImageEncoding quality="95" />
- <ImageEncoding quality="80" />
- <ImageEncoding quality="70" />
- <ImageDecoding memCap="20000000" />
-
- </CamcorderProfiles>
-
- <CamcorderProfiles cameraId="4">
-
- <EncoderProfile quality="qvga" fileFormat="mp4" duration="60">
- <Video codec="m4v"
- bitRate="128000"
- width="320"
- height="240"
- frameRate="15" />
- <Audio codec="amrnb"
- bitRate="12200"
- sampleRate="8000"
- channels="1" />
- </EncoderProfile>
-
- <EncoderProfile quality="timelapseqcif" fileFormat="mp4" duration="30">
- <Video codec="h264"
- bitRate="192000"
- width="176"
- height="144"
- frameRate="30" />
- <!-- audio setting is ignored -->
- <Audio codec="amrnb"
- bitRate="12200"
- sampleRate="8000"
- channels="1" />
- </EncoderProfile>
-
- <ImageEncoding quality="95" />
- <ImageEncoding quality="80" />
- <ImageEncoding quality="70" />
- <ImageDecoding memCap="20000000" />
-
- </CamcorderProfiles>
-
- <CamcorderProfiles cameraId="5">
-
- <EncoderProfile quality="qvga" fileFormat="mp4" duration="60">
- <Video codec="m4v"
- bitRate="128000"
- width="320"
- height="240"
- frameRate="15" />
- <Audio codec="amrnb"
- bitRate="12200"
- sampleRate="8000"
- channels="1" />
- </EncoderProfile>
-
- <EncoderProfile quality="timelapseqcif" fileFormat="mp4" duration="30">
- <Video codec="h264"
- bitRate="192000"
- width="176"
- height="144"
- frameRate="30" />
- <!-- audio setting is ignored -->
- <Audio codec="amrnb"
- bitRate="12200"
- sampleRate="8000"
- channels="1" />
- </EncoderProfile>
-
- <ImageEncoding quality="95" />
- <ImageEncoding quality="80" />
- <ImageEncoding quality="70" />
- <ImageDecoding memCap="20000000" />
-
- </CamcorderProfiles>
-
- <CamcorderProfiles cameraId="6">
-
- <EncoderProfile quality="qvga" fileFormat="mp4" duration="60">
- <Video codec="m4v"
- bitRate="128000"
- width="320"
- height="240"
- frameRate="15" />
- <Audio codec="amrnb"
- bitRate="12200"
- sampleRate="8000"
- channels="1" />
- </EncoderProfile>
-
- <EncoderProfile quality="timelapseqcif" fileFormat="mp4" duration="30">
- <Video codec="h264"
- bitRate="192000"
- width="176"
- height="144"
- frameRate="30" />
- <!-- audio setting is ignored -->
- <Audio codec="amrnb"
- bitRate="12200"
- sampleRate="8000"
- channels="1" />
- </EncoderProfile>
-
- <ImageEncoding quality="95" />
- <ImageEncoding quality="80" />
- <ImageEncoding quality="70" />
- <ImageDecoding memCap="20000000" />
-
- </CamcorderProfiles>
-
- <EncoderOutputFileFormat name="3gp" />
- <EncoderOutputFileFormat name="mp4" />
-
- <!--
- If a codec is not enabled, it is invisible to the applications
- In other words, the applications won't be able to use the codec
- or query the capabilities of the codec at all if it is disabled
- -->
- <VideoEncoderCap name="h264" enabled="true"
- minBitRate="64000" maxBitRate="192000"
- minFrameWidth="176" maxFrameWidth="320"
- minFrameHeight="144" maxFrameHeight="240"
- minFrameRate="15" maxFrameRate="30" />
-
- <VideoEncoderCap name="h263" enabled="true"
- minBitRate="64000" maxBitRate="192000"
- minFrameWidth="176" maxFrameWidth="320"
- minFrameHeight="144" maxFrameHeight="240"
- minFrameRate="15" maxFrameRate="30" />
-
- <VideoEncoderCap name="m4v" enabled="true"
- minBitRate="64000" maxBitRate="192000"
- minFrameWidth="176" maxFrameWidth="320"
- minFrameHeight="144" maxFrameHeight="240"
- minFrameRate="15" maxFrameRate="30" />
-
- <AudioEncoderCap name="aac" enabled="true"
- minBitRate="8000" maxBitRate="96000"
- minSampleRate="8000" maxSampleRate="48000"
- minChannels="1" maxChannels="1" />
-
- <AudioEncoderCap name="amrwb" enabled="true"
- minBitRate="6600" maxBitRate="23050"
- minSampleRate="16000" maxSampleRate="16000"
- minChannels="1" maxChannels="1" />
-
- <AudioEncoderCap name="amrnb" enabled="true"
- minBitRate="5525" maxBitRate="12200"
- minSampleRate="8000" maxSampleRate="8000"
- minChannels="1" maxChannels="1" />
-
- <!--
- FIXME:
- We do not check decoder capabilities at present
- At present, we only check whether windows media is visible
- for TEST applications. For other applications, we do
- not perform any checks at all.
- -->
- <VideoDecoderCap name="wmv" enabled="false"/>
- <AudioDecoderCap name="wma" enabled="false"/>
-
- <!--
- The VideoEditor Capability configuration:
- - maxInputFrameWidth: maximum video width of imported video clip.
- - maxInputFrameHeight: maximum video height of imported video clip.
- - maxOutputFrameWidth: maximum video width of exported video clip.
- - maxOutputFrameHeight: maximum video height of exported video clip.
- - maxPrefetchYUVFrames: maximum prefetch YUV frames for encoder,
- used to limit the amount of memory for prefetched YUV frames.
- For this platform, it allows maximum ~1MB(~0.1MB per QVGA frame x 10
- frames) memory.
- -->
-
- <VideoEditorCap maxInputFrameWidth="320"
- maxInputFrameHeight="240" maxOutputFrameWidth="320"
- maxOutputFrameHeight="240" maxPrefetchYUVFrames="10" />
- <!--
- The VideoEditor Export codec profile and level values
- correspond to the values in OMX_Video.h.
- E.g. for h264, profile value 1 means OMX_VIDEO_AVCProfileBaseline
- and level 4096 means OMX_VIDEO_AVCLevel41.
- Please note that the values are in decimal.
- These values are for video encoder.
- -->
- <!--
- Codec = h.264, Baseline profile, level 4.1
- -->
- <ExportVideoProfile name="h264" profile= "1" level="512"/>
- <!--
- Codec = h.263, Baseline profile, level 0
- -->
- <ExportVideoProfile name="h263" profile= "1" level="1"/>
- <!--
- Codec = mpeg4, Simple profile, level 3
- -->
- <ExportVideoProfile name="m4v" profile= "1" level="16"/>
-</MediaSettings>
diff --git a/tools/emulator/system/gps/Android.mk b/tools/emulator/system/gps/Android.mk
deleted file mode 100644
index 6840f8459..000000000
--- a/tools/emulator/system/gps/Android.mk
+++ /dev/null
@@ -1,36 +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.
-
-
-# We're moving the emulator-specific platform libs to
-# development.git/tools/emulator/. The following test is to ensure
-# smooth builds even if the tree contains both versions.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-# HAL module implemenation stored in
-# hw/<GPS_HARDWARE_MODULE_ID>.<ro.hardware>.so
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
-LOCAL_CFLAGS += -DQEMU_HARDWARE
-LOCAL_SHARED_LIBRARIES := liblog libcutils libhardware
-LOCAL_SRC_FILES := gps_qemu.c
-ifeq ($(TARGET_PRODUCT),vbox_x86)
-LOCAL_MODULE := gps.vbox_x86
-else
-LOCAL_MODULE := gps.goldfish
-endif
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tools/emulator/system/gps/gps_qemu.c b/tools/emulator/system/gps/gps_qemu.c
deleted file mode 100644
index 8f3d6e9ce..000000000
--- a/tools/emulator/system/gps/gps_qemu.c
+++ /dev/null
@@ -1,955 +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.
- */
-
-/* this implements a GPS hardware library for the Android emulator.
- * the following code should be built as a shared library that will be
- * placed into /system/lib/hw/gps.goldfish.so
- *
- * it will be loaded by the code in hardware/libhardware/hardware.c
- * which is itself called from android_location_GpsLocationProvider.cpp
- */
-
-
-#include <errno.h>
-#include <pthread.h>
-#include <fcntl.h>
-#include <sys/epoll.h>
-#include <math.h>
-#include <time.h>
-
-#define LOG_TAG "gps_qemu"
-#include <cutils/log.h>
-#include <cutils/sockets.h>
-#include <hardware/gps.h>
-#include <hardware/qemud.h>
-
-/* the name of the qemud-controlled socket */
-#define QEMU_CHANNEL_NAME "gps"
-
-#define GPS_DEBUG 0
-
-#if GPS_DEBUG
-# define D(...) ALOGD(__VA_ARGS__)
-#else
-# define D(...) ((void)0)
-#endif
-
-/*****************************************************************/
-/*****************************************************************/
-/***** *****/
-/***** N M E A T O K E N I Z E R *****/
-/***** *****/
-/*****************************************************************/
-/*****************************************************************/
-
-typedef struct {
- const char* p;
- const char* end;
-} Token;
-
-#define MAX_NMEA_TOKENS 16
-
-typedef struct {
- int count;
- Token tokens[ MAX_NMEA_TOKENS ];
-} NmeaTokenizer;
-
-static int
-nmea_tokenizer_init( NmeaTokenizer* t, const char* p, const char* end )
-{
- int count = 0;
- char* q;
-
- // the initial '$' is optional
- if (p < end && p[0] == '$')
- p += 1;
-
- // remove trailing newline
- if (end > p && end[-1] == '\n') {
- end -= 1;
- if (end > p && end[-1] == '\r')
- end -= 1;
- }
-
- // get rid of checksum at the end of the sentecne
- if (end >= p+3 && end[-3] == '*') {
- end -= 3;
- }
-
- while (p < end) {
- const char* q = p;
-
- q = memchr(p, ',', end-p);
- if (q == NULL)
- q = end;
-
- if (q > p) {
- if (count < MAX_NMEA_TOKENS) {
- t->tokens[count].p = p;
- t->tokens[count].end = q;
- count += 1;
- }
- }
- if (q < end)
- q += 1;
-
- p = q;
- }
-
- t->count = count;
- return count;
-}
-
-static Token
-nmea_tokenizer_get( NmeaTokenizer* t, int index )
-{
- Token tok;
- static const char* dummy = "";
-
- if (index < 0 || index >= t->count) {
- tok.p = tok.end = dummy;
- } else
- tok = t->tokens[index];
-
- return tok;
-}
-
-
-static int
-str2int( const char* p, const char* end )
-{
- int result = 0;
- int len = end - p;
-
- for ( ; len > 0; len--, p++ )
- {
- int c;
-
- if (p >= end)
- goto Fail;
-
- c = *p - '0';
- if ((unsigned)c >= 10)
- goto Fail;
-
- result = result*10 + c;
- }
- return result;
-
-Fail:
- return -1;
-}
-
-static double
-str2float( const char* p, const char* end )
-{
- int result = 0;
- int len = end - p;
- char temp[16];
-
- if (len >= (int)sizeof(temp))
- return 0.;
-
- memcpy( temp, p, len );
- temp[len] = 0;
- return strtod( temp, NULL );
-}
-
-/*****************************************************************/
-/*****************************************************************/
-/***** *****/
-/***** N M E A P A R S E R *****/
-/***** *****/
-/*****************************************************************/
-/*****************************************************************/
-
-#define NMEA_MAX_SIZE 83
-
-typedef struct {
- int pos;
- int overflow;
- int utc_year;
- int utc_mon;
- int utc_day;
- int utc_diff;
- GpsLocation fix;
- gps_location_callback callback;
- char in[ NMEA_MAX_SIZE+1 ];
-} NmeaReader;
-
-
-static void
-nmea_reader_update_utc_diff( NmeaReader* r )
-{
- time_t now = time(NULL);
- struct tm tm_local;
- struct tm tm_utc;
- long time_local, time_utc;
-
- gmtime_r( &now, &tm_utc );
- localtime_r( &now, &tm_local );
-
- time_local = tm_local.tm_sec +
- 60*(tm_local.tm_min +
- 60*(tm_local.tm_hour +
- 24*(tm_local.tm_yday +
- 365*tm_local.tm_year)));
-
- time_utc = tm_utc.tm_sec +
- 60*(tm_utc.tm_min +
- 60*(tm_utc.tm_hour +
- 24*(tm_utc.tm_yday +
- 365*tm_utc.tm_year)));
-
- r->utc_diff = time_utc - time_local;
-}
-
-
-static void
-nmea_reader_init( NmeaReader* r )
-{
- memset( r, 0, sizeof(*r) );
-
- r->pos = 0;
- r->overflow = 0;
- r->utc_year = -1;
- r->utc_mon = -1;
- r->utc_day = -1;
- r->callback = NULL;
- r->fix.size = sizeof(r->fix);
-
- nmea_reader_update_utc_diff( r );
-}
-
-
-static void
-nmea_reader_set_callback( NmeaReader* r, gps_location_callback cb )
-{
- r->callback = cb;
- if (cb != NULL && r->fix.flags != 0) {
- D("%s: sending latest fix to new callback", __FUNCTION__);
- r->callback( &r->fix );
- r->fix.flags = 0;
- }
-}
-
-
-static int
-nmea_reader_update_time( NmeaReader* r, Token tok )
-{
- int hour, minute;
- double seconds;
- struct tm tm;
- time_t fix_time;
-
- if (tok.p + 6 > tok.end)
- return -1;
-
- if (r->utc_year < 0) {
- // no date yet, get current one
- time_t now = time(NULL);
- gmtime_r( &now, &tm );
- r->utc_year = tm.tm_year + 1900;
- r->utc_mon = tm.tm_mon + 1;
- r->utc_day = tm.tm_mday;
- }
-
- hour = str2int(tok.p, tok.p+2);
- minute = str2int(tok.p+2, tok.p+4);
- seconds = str2float(tok.p+4, tok.end);
-
- tm.tm_hour = hour;
- tm.tm_min = minute;
- tm.tm_sec = (int) seconds;
- tm.tm_year = r->utc_year - 1900;
- tm.tm_mon = r->utc_mon - 1;
- tm.tm_mday = r->utc_day;
- tm.tm_isdst = -1;
-
- fix_time = mktime( &tm ) + r->utc_diff;
- r->fix.timestamp = (long long)fix_time * 1000;
- return 0;
-}
-
-static int
-nmea_reader_update_date( NmeaReader* r, Token date, Token time )
-{
- Token tok = date;
- int day, mon, year;
-
- if (tok.p + 6 != tok.end) {
- D("date not properly formatted: '%.*s'", tok.end-tok.p, tok.p);
- return -1;
- }
- day = str2int(tok.p, tok.p+2);
- mon = str2int(tok.p+2, tok.p+4);
- year = str2int(tok.p+4, tok.p+6) + 2000;
-
- if ((day|mon|year) < 0) {
- D("date not properly formatted: '%.*s'", tok.end-tok.p, tok.p);
- return -1;
- }
-
- r->utc_year = year;
- r->utc_mon = mon;
- r->utc_day = day;
-
- return nmea_reader_update_time( r, time );
-}
-
-
-static double
-convert_from_hhmm( Token tok )
-{
- double val = str2float(tok.p, tok.end);
- int degrees = (int)(floor(val) / 100);
- double minutes = val - degrees*100.;
- double dcoord = degrees + minutes / 60.0;
- return dcoord;
-}
-
-
-static int
-nmea_reader_update_latlong( NmeaReader* r,
- Token latitude,
- char latitudeHemi,
- Token longitude,
- char longitudeHemi )
-{
- double lat, lon;
- Token tok;
-
- tok = latitude;
- if (tok.p + 6 > tok.end) {
- D("latitude is too short: '%.*s'", tok.end-tok.p, tok.p);
- return -1;
- }
- lat = convert_from_hhmm(tok);
- if (latitudeHemi == 'S')
- lat = -lat;
-
- tok = longitude;
- if (tok.p + 6 > tok.end) {
- D("longitude is too short: '%.*s'", tok.end-tok.p, tok.p);
- return -1;
- }
- lon = convert_from_hhmm(tok);
- if (longitudeHemi == 'W')
- lon = -lon;
-
- r->fix.flags |= GPS_LOCATION_HAS_LAT_LONG;
- r->fix.latitude = lat;
- r->fix.longitude = lon;
- return 0;
-}
-
-
-static int
-nmea_reader_update_altitude( NmeaReader* r,
- Token altitude,
- Token units )
-{
- double alt;
- Token tok = altitude;
-
- if (tok.p >= tok.end)
- return -1;
-
- r->fix.flags |= GPS_LOCATION_HAS_ALTITUDE;
- r->fix.altitude = str2float(tok.p, tok.end);
- return 0;
-}
-
-
-static int
-nmea_reader_update_bearing( NmeaReader* r,
- Token bearing )
-{
- double alt;
- Token tok = bearing;
-
- if (tok.p >= tok.end)
- return -1;
-
- r->fix.flags |= GPS_LOCATION_HAS_BEARING;
- r->fix.bearing = str2float(tok.p, tok.end);
- return 0;
-}
-
-
-static int
-nmea_reader_update_speed( NmeaReader* r,
- Token speed )
-{
- double alt;
- Token tok = speed;
-
- if (tok.p >= tok.end)
- return -1;
-
- r->fix.flags |= GPS_LOCATION_HAS_SPEED;
- r->fix.speed = str2float(tok.p, tok.end);
- return 0;
-}
-
-static int
-nmea_reader_update_accuracy( NmeaReader* r )
-{
- // Always return 20m accuracy.
- // Possibly parse it from the NMEA sentence in the future.
- r->fix.flags |= GPS_LOCATION_HAS_ACCURACY;
- r->fix.accuracy = 20;
- return 0;
-}
-
-
-static void
-nmea_reader_parse( NmeaReader* r )
-{
- /* we received a complete sentence, now parse it to generate
- * a new GPS fix...
- */
- NmeaTokenizer tzer[1];
- Token tok;
-
- D("Received: '%.*s'", r->pos, r->in);
- if (r->pos < 9) {
- D("Too short. discarded.");
- return;
- }
-
- nmea_tokenizer_init(tzer, r->in, r->in + r->pos);
-#if GPS_DEBUG
- {
- int n;
- D("Found %d tokens", tzer->count);
- for (n = 0; n < tzer->count; n++) {
- Token tok = nmea_tokenizer_get(tzer,n);
- D("%2d: '%.*s'", n, tok.end-tok.p, tok.p);
- }
- }
-#endif
-
- tok = nmea_tokenizer_get(tzer, 0);
- if (tok.p + 5 > tok.end) {
- D("sentence id '%.*s' too short, ignored.", tok.end-tok.p, tok.p);
- return;
- }
-
- // ignore first two characters.
- tok.p += 2;
- if ( !memcmp(tok.p, "GGA", 3) ) {
- // GPS fix
- Token tok_time = nmea_tokenizer_get(tzer,1);
- Token tok_latitude = nmea_tokenizer_get(tzer,2);
- Token tok_latitudeHemi = nmea_tokenizer_get(tzer,3);
- Token tok_longitude = nmea_tokenizer_get(tzer,4);
- Token tok_longitudeHemi = nmea_tokenizer_get(tzer,5);
- Token tok_altitude = nmea_tokenizer_get(tzer,9);
- Token tok_altitudeUnits = nmea_tokenizer_get(tzer,10);
-
- nmea_reader_update_time(r, tok_time);
- nmea_reader_update_latlong(r, tok_latitude,
- tok_latitudeHemi.p[0],
- tok_longitude,
- tok_longitudeHemi.p[0]);
- nmea_reader_update_altitude(r, tok_altitude, tok_altitudeUnits);
-
- } else if ( !memcmp(tok.p, "GSA", 3) ) {
- // do something ?
- } else if ( !memcmp(tok.p, "RMC", 3) ) {
- Token tok_time = nmea_tokenizer_get(tzer,1);
- Token tok_fixStatus = nmea_tokenizer_get(tzer,2);
- Token tok_latitude = nmea_tokenizer_get(tzer,3);
- Token tok_latitudeHemi = nmea_tokenizer_get(tzer,4);
- Token tok_longitude = nmea_tokenizer_get(tzer,5);
- Token tok_longitudeHemi = nmea_tokenizer_get(tzer,6);
- Token tok_speed = nmea_tokenizer_get(tzer,7);
- Token tok_bearing = nmea_tokenizer_get(tzer,8);
- Token tok_date = nmea_tokenizer_get(tzer,9);
-
- D("in RMC, fixStatus=%c", tok_fixStatus.p[0]);
- if (tok_fixStatus.p[0] == 'A')
- {
- nmea_reader_update_date( r, tok_date, tok_time );
-
- nmea_reader_update_latlong( r, tok_latitude,
- tok_latitudeHemi.p[0],
- tok_longitude,
- tok_longitudeHemi.p[0] );
-
- nmea_reader_update_bearing( r, tok_bearing );
- nmea_reader_update_speed ( r, tok_speed );
- }
- } else {
- tok.p -= 2;
- D("unknown sentence '%.*s", tok.end-tok.p, tok.p);
- }
-
- // Always update accuracy
- nmea_reader_update_accuracy( r );
-
- if (r->fix.flags != 0) {
-#if GPS_DEBUG
- char temp[256];
- char* p = temp;
- char* end = p + sizeof(temp);
- struct tm utc;
-
- p += snprintf( p, end-p, "sending fix" );
- if (r->fix.flags & GPS_LOCATION_HAS_LAT_LONG) {
- p += snprintf(p, end-p, " lat=%g lon=%g", r->fix.latitude, r->fix.longitude);
- }
- if (r->fix.flags & GPS_LOCATION_HAS_ALTITUDE) {
- p += snprintf(p, end-p, " altitude=%g", r->fix.altitude);
- }
- if (r->fix.flags & GPS_LOCATION_HAS_SPEED) {
- p += snprintf(p, end-p, " speed=%g", r->fix.speed);
- }
- if (r->fix.flags & GPS_LOCATION_HAS_BEARING) {
- p += snprintf(p, end-p, " bearing=%g", r->fix.bearing);
- }
- if (r->fix.flags & GPS_LOCATION_HAS_ACCURACY) {
- p += snprintf(p,end-p, " accuracy=%g", r->fix.accuracy);
- }
- gmtime_r( (time_t*) &r->fix.timestamp, &utc );
- p += snprintf(p, end-p, " time=%s", asctime( &utc ) );
- D(temp);
-#endif
- if (r->callback) {
- r->callback( &r->fix );
- r->fix.flags = 0;
- }
- else {
- D("no callback, keeping data until needed !");
- }
- }
-}
-
-
-static void
-nmea_reader_addc( NmeaReader* r, int c )
-{
- if (r->overflow) {
- r->overflow = (c != '\n');
- return;
- }
-
- if (r->pos >= (int) sizeof(r->in)-1 ) {
- r->overflow = 1;
- r->pos = 0;
- return;
- }
-
- r->in[r->pos] = (char)c;
- r->pos += 1;
-
- if (c == '\n') {
- nmea_reader_parse( r );
- r->pos = 0;
- }
-}
-
-
-/*****************************************************************/
-/*****************************************************************/
-/***** *****/
-/***** C O N N E C T I O N S T A T E *****/
-/***** *****/
-/*****************************************************************/
-/*****************************************************************/
-
-/* commands sent to the gps thread */
-enum {
- CMD_QUIT = 0,
- CMD_START = 1,
- CMD_STOP = 2
-};
-
-
-/* this is the state of our connection to the qemu_gpsd daemon */
-typedef struct {
- int init;
- int fd;
- GpsCallbacks callbacks;
- pthread_t thread;
- int control[2];
-} GpsState;
-
-static GpsState _gps_state[1];
-
-
-static void
-gps_state_done( GpsState* s )
-{
- // tell the thread to quit, and wait for it
- char cmd = CMD_QUIT;
- void* dummy;
- write( s->control[0], &cmd, 1 );
- pthread_join(s->thread, &dummy);
-
- // close the control socket pair
- close( s->control[0] ); s->control[0] = -1;
- close( s->control[1] ); s->control[1] = -1;
-
- // close connection to the QEMU GPS daemon
- close( s->fd ); s->fd = -1;
- s->init = 0;
-}
-
-
-static void
-gps_state_start( GpsState* s )
-{
- char cmd = CMD_START;
- int ret;
-
- do { ret=write( s->control[0], &cmd, 1 ); }
- while (ret < 0 && errno == EINTR);
-
- if (ret != 1)
- D("%s: could not send CMD_START command: ret=%d: %s",
- __FUNCTION__, ret, strerror(errno));
-}
-
-
-static void
-gps_state_stop( GpsState* s )
-{
- char cmd = CMD_STOP;
- int ret;
-
- do { ret=write( s->control[0], &cmd, 1 ); }
- while (ret < 0 && errno == EINTR);
-
- if (ret != 1)
- D("%s: could not send CMD_STOP command: ret=%d: %s",
- __FUNCTION__, ret, strerror(errno));
-}
-
-
-static int
-epoll_register( int epoll_fd, int fd )
-{
- struct epoll_event ev;
- int ret, flags;
-
- /* important: make the fd non-blocking */
- flags = fcntl(fd, F_GETFL);
- fcntl(fd, F_SETFL, flags | O_NONBLOCK);
-
- ev.events = EPOLLIN;
- ev.data.fd = fd;
- do {
- ret = epoll_ctl( epoll_fd, EPOLL_CTL_ADD, fd, &ev );
- } while (ret < 0 && errno == EINTR);
- return ret;
-}
-
-
-static int
-epoll_deregister( int epoll_fd, int fd )
-{
- int ret;
- do {
- ret = epoll_ctl( epoll_fd, EPOLL_CTL_DEL, fd, NULL );
- } while (ret < 0 && errno == EINTR);
- return ret;
-}
-
-/* this is the main thread, it waits for commands from gps_state_start/stop and,
- * when started, messages from the QEMU GPS daemon. these are simple NMEA sentences
- * that must be parsed to be converted into GPS fixes sent to the framework
- */
-static void
-gps_state_thread( void* arg )
-{
- GpsState* state = (GpsState*) arg;
- NmeaReader reader[1];
- int epoll_fd = epoll_create(2);
- int started = 0;
- int gps_fd = state->fd;
- int control_fd = state->control[1];
-
- nmea_reader_init( reader );
-
- // register control file descriptors for polling
- epoll_register( epoll_fd, control_fd );
- epoll_register( epoll_fd, gps_fd );
-
- D("gps thread running");
-
- // now loop
- for (;;) {
- struct epoll_event events[2];
- int ne, nevents;
-
- nevents = epoll_wait( epoll_fd, events, 2, -1 );
- if (nevents < 0) {
- if (errno != EINTR)
- ALOGE("epoll_wait() unexpected error: %s", strerror(errno));
- continue;
- }
- D("gps thread received %d events", nevents);
- for (ne = 0; ne < nevents; ne++) {
- if ((events[ne].events & (EPOLLERR|EPOLLHUP)) != 0) {
- ALOGE("EPOLLERR or EPOLLHUP after epoll_wait() !?");
- return;
- }
- if ((events[ne].events & EPOLLIN) != 0) {
- int fd = events[ne].data.fd;
-
- if (fd == control_fd)
- {
- char cmd = 255;
- int ret;
- D("gps control fd event");
- do {
- ret = read( fd, &cmd, 1 );
- } while (ret < 0 && errno == EINTR);
-
- if (cmd == CMD_QUIT) {
- D("gps thread quitting on demand");
- return;
- }
- else if (cmd == CMD_START) {
- if (!started) {
- D("gps thread starting location_cb=%p", state->callbacks.location_cb);
- started = 1;
- nmea_reader_set_callback( reader, state->callbacks.location_cb );
- }
- }
- else if (cmd == CMD_STOP) {
- if (started) {
- D("gps thread stopping");
- started = 0;
- nmea_reader_set_callback( reader, NULL );
- }
- }
- }
- else if (fd == gps_fd)
- {
- char buff[32];
- D("gps fd event");
- for (;;) {
- int nn, ret;
-
- ret = read( fd, buff, sizeof(buff) );
- if (ret < 0) {
- if (errno == EINTR)
- continue;
- if (errno != EWOULDBLOCK)
- ALOGE("error while reading from gps daemon socket: %s:", strerror(errno));
- break;
- }
- D("received %d bytes: %.*s", ret, ret, buff);
- for (nn = 0; nn < ret; nn++)
- nmea_reader_addc( reader, buff[nn] );
- }
- D("gps fd event end");
- }
- else
- {
- ALOGE("epoll_wait() returned unkown fd %d ?", fd);
- }
- }
- }
- }
-}
-
-
-static void
-gps_state_init( GpsState* state, GpsCallbacks* callbacks )
-{
- state->init = 1;
- state->control[0] = -1;
- state->control[1] = -1;
- state->fd = -1;
-
- state->fd = qemud_channel_open(QEMU_CHANNEL_NAME);
-
- if (state->fd < 0) {
- D("no gps emulation detected");
- return;
- }
-
- D("gps emulation will read from '%s' qemud channel", QEMU_CHANNEL_NAME );
-
- if ( socketpair( AF_LOCAL, SOCK_STREAM, 0, state->control ) < 0 ) {
- ALOGE("could not create thread control socket pair: %s", strerror(errno));
- goto Fail;
- }
-
- state->thread = callbacks->create_thread_cb( "gps_state_thread", gps_state_thread, state );
-
- if ( !state->thread ) {
- ALOGE("could not create gps thread: %s", strerror(errno));
- goto Fail;
- }
-
- state->callbacks = *callbacks;
-
- D("gps state initialized");
- return;
-
-Fail:
- gps_state_done( state );
-}
-
-
-/*****************************************************************/
-/*****************************************************************/
-/***** *****/
-/***** I N T E R F A C E *****/
-/***** *****/
-/*****************************************************************/
-/*****************************************************************/
-
-
-static int
-qemu_gps_init(GpsCallbacks* callbacks)
-{
- GpsState* s = _gps_state;
-
- if (!s->init)
- gps_state_init(s, callbacks);
-
- if (s->fd < 0)
- return -1;
-
- return 0;
-}
-
-static void
-qemu_gps_cleanup(void)
-{
- GpsState* s = _gps_state;
-
- if (s->init)
- gps_state_done(s);
-}
-
-
-static int
-qemu_gps_start()
-{
- GpsState* s = _gps_state;
-
- if (!s->init) {
- D("%s: called with uninitialized state !!", __FUNCTION__);
- return -1;
- }
-
- D("%s: called", __FUNCTION__);
- gps_state_start(s);
- return 0;
-}
-
-
-static int
-qemu_gps_stop()
-{
- GpsState* s = _gps_state;
-
- if (!s->init) {
- D("%s: called with uninitialized state !!", __FUNCTION__);
- return -1;
- }
-
- D("%s: called", __FUNCTION__);
- gps_state_stop(s);
- return 0;
-}
-
-
-static int
-qemu_gps_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty)
-{
- return 0;
-}
-
-static int
-qemu_gps_inject_location(double latitude, double longitude, float accuracy)
-{
- return 0;
-}
-
-static void
-qemu_gps_delete_aiding_data(GpsAidingData flags)
-{
-}
-
-static int qemu_gps_set_position_mode(GpsPositionMode mode, int fix_frequency)
-{
- // FIXME - support fix_frequency
- return 0;
-}
-
-static const void*
-qemu_gps_get_extension(const char* name)
-{
- // no extensions supported
- return NULL;
-}
-
-static const GpsInterface qemuGpsInterface = {
- sizeof(GpsInterface),
- qemu_gps_init,
- qemu_gps_start,
- qemu_gps_stop,
- qemu_gps_cleanup,
- qemu_gps_inject_time,
- qemu_gps_inject_location,
- qemu_gps_delete_aiding_data,
- qemu_gps_set_position_mode,
- qemu_gps_get_extension,
-};
-
-const GpsInterface* gps__get_gps_interface(struct gps_device_t* dev)
-{
- return &qemuGpsInterface;
-}
-
-static int open_gps(const struct hw_module_t* module, char const* name,
- struct hw_device_t** device)
-{
- struct gps_device_t *dev = malloc(sizeof(struct gps_device_t));
- memset(dev, 0, sizeof(*dev));
-
- dev->common.tag = HARDWARE_DEVICE_TAG;
- dev->common.version = 0;
- dev->common.module = (struct hw_module_t*)module;
-// dev->common.close = (int (*)(struct hw_device_t*))close_lights;
- dev->get_gps_interface = gps__get_gps_interface;
-
- *device = (struct hw_device_t*)dev;
- return 0;
-}
-
-
-static struct hw_module_methods_t gps_module_methods = {
- .open = open_gps
-};
-
-struct hw_module_t HAL_MODULE_INFO_SYM = {
- .tag = HARDWARE_MODULE_TAG,
- .version_major = 1,
- .version_minor = 0,
- .id = GPS_HARDWARE_MODULE_ID,
- .name = "Goldfish GPS Module",
- .author = "The Android Open Source Project",
- .methods = &gps_module_methods,
-};
diff --git a/tools/emulator/system/libqemu/test_guest_1.c b/tools/emulator/system/libqemu/test_guest_1.c
deleted file mode 100644
index 1a8100053..000000000
--- a/tools/emulator/system/libqemu/test_guest_1.c
+++ /dev/null
@@ -1,105 +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.
- */
-
-/* This program uses a QEMUD pipe to exchange data with a test
- * server. It's very simple:
- *
- * for count in range(0,100):
- * msg = "Hello Word " + count
- * qemud_pipe_send(msg)
- * qemud_pipe_recv(msg2)
- * if (msg != msg2):
- * error()
- *
- *
- * See test_host_1.c for the corresponding server code, which simply
- * sends back anything it receives from the client.
- */
-#include "test_util.h"
-#include <errno.h>
-#include <string.h>
-#include <stddef.h>
-#include <stdio.h>
-
-#define PIPE_NAME "pingpong"
-
-
-int main(void)
-{
- Pipe pipe[1];
- const int maxCount = 100;
- int port = 8012;
-
-#if 0
- if (pipe_openSocket(pipe, port) < 0) {
- fprintf(stderr, "Could not open tcp socket!\n");
- return 1;
- }
- printf("Connected to tcp:host:%d\n", port);
-#else
- if (pipe_openQemuPipe(pipe, PIPE_NAME) < 0) {
- fprintf(stderr, "Could not open '%s' pipe: %s\n", PIPE_NAME, strerror(errno));
- return 1;
- }
- printf("Connected to '%s' pipe\n", PIPE_NAME);
-#endif
-
- char buff[64];
- char buff2[64];
- int count;
- double time0 = now_secs();
- size_t total = 0;
-
- for (count = 0; count < maxCount; count++) {
- /* First, send a small message */
- int len = snprintf(buff, sizeof(buff), "Hello World %d\n", count);
- printf("%4d: Sending %d bytes\n", count, len);
- int ret = pipe_send(pipe, buff, len);
- if (ret < 0) {
- fprintf(stderr,"Sending %d bytes failed: %s\n", len, strerror(errno));
- return 1;
- }
-
- total += len;
-
- /* The server is supposed to send the message back */
- ret = pipe_recv(pipe, buff2, len);
- if (ret < 0) {
- fprintf(stderr, "Receiving failed (ret=%d): %s\n", ret, strerror(errno));
- return 3;
- }
- printf("%4d: Received %d bytes\n", count, ret);
- /* Check the message's content */
- if (ret != len) {
- fprintf(stderr, "Message size mismatch sent=%d received=%d\n", len, ret);
- return 5;
- }
- if (memcmp(buff, buff2, len) != 0) {
- fprintf(stderr, "Message content mismatch!\n");
- return 6;
- }
- }
-
- double time1 = now_secs();
-
- printf("Closing pipe\n");
- pipe_close(pipe);
-
- printf("Bandwidth: %g MB/s, %g bytes in %g seconds.\n",
- total*1.0 / (1024.*1024.*(time1-time0)), 1.0*total, time1-time0);
-
- return 0;
-}
diff --git a/tools/emulator/system/libqemu/test_guest_2.c b/tools/emulator/system/libqemu/test_guest_2.c
deleted file mode 100644
index c834098fb..000000000
--- a/tools/emulator/system/libqemu/test_guest_2.c
+++ /dev/null
@@ -1,240 +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.
- */
-
-/* This program benchmarks a QEMUD pipe to exchange data with a test
- * server.
- *
- * See test_host_1.c for the corresponding server code, which simply
- * sends back anything it receives from the client.
- */
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include "test_util.h"
-
-#define PIPE_NAME "pingpong"
-
-char* progname;
-
-static void usage(int code)
-{
- printf("Usage: %s [options]\n\n", progname);
- printf(
- "Valid options are:\n\n"
- " -? -h --help Print this message\n"
- " -pipe <name> Use pipe name (default: " PIPE_NAME ")\n"
- " -tcp <port> Use local tcp port\n"
- " -size <size> Specify packet size\n"
- "\n"
- );
- exit(code);
-}
-
-int main(int argc, char** argv)
-{
- Pipe pipe[1];
- const char* tcpPort = NULL;
- int localPort = 0;
- const char* pipeName = NULL;
- const char* packetSize = NULL;
- int port = 8012;
- int maxCount = 1000;
- int bufferSize = 16384;
- uint8_t* buffer;
- uint8_t* buffer2;
- int nn, count;
- double time0, time1;
-
- /* Extract program name */
- {
- char* p = strrchr(argv[0], '/');
- if (p == NULL)
- progname = argv[0];
- else
- progname = p+1;
- }
-
- /* Parse options */
- while (argc > 1 && argv[1][0] == '-') {
- char* arg = argv[1];
- if (!strcmp(arg, "-?") || !strcmp(arg, "-h") || !strcmp(arg, "--help")) {
- usage(0);
- } else if (!strcmp(arg, "-pipe")) {
- if (argc < 3) {
- fprintf(stderr, "-pipe option needs an argument! See --help for details.\n");
- exit(1);
- }
- argc--;
- argv++;
- pipeName = argv[1];
- } else if (!strcmp(arg, "-tcp")) {
- if (argc < 3) {
- fprintf(stderr, "-tcp option needs an argument! See --help for details.\n");
- exit(1);
- }
- argc--;
- argv++;
- tcpPort = argv[1];
- } else if (!strcmp(arg, "-size")) {
- if (argc < 3) {
- fprintf(stderr, "-tcp option needs an argument! See --help for details.\n");
- exit(1);
- }
- argc--;
- argv++;
- packetSize = argv[1];
- } else {
- fprintf(stderr, "UNKNOWN OPTION: %s\n\n", arg);
- usage(1);
- }
- argc--;
- argv++;
- }
-
- /* Check arguments */
- if (tcpPort && pipeName) {
- fprintf(stderr, "You can't use both -pipe and -tcp at the same time\n");
- exit(2);
- }
-
- if (tcpPort != NULL) {
- localPort = atoi(tcpPort);
- if (localPort <= 0 || localPort > 65535) {
- fprintf(stderr, "Invalid port number: %s\n", tcpPort);
- exit(2);
- }
- } else if (pipeName == NULL) {
- /* Use default pipe name */
- pipeName = PIPE_NAME;
- }
-
- if (packetSize != NULL) {
- int size = atoi(packetSize);
- if (size <= 0) {
- fprintf(stderr, "Invalid byte size: %s\n", packetSize);
- exit(3);
- }
- bufferSize = size;
- }
-
- /* Open the pipe */
- if (tcpPort != NULL) {
- if (pipe_openSocket(pipe, localPort) < 0) {
- fprintf(stderr, "Could not open tcp socket!\n");
- return 1;
- }
- printf("Connected to tcp:localhost:%d\n", port);
- }
- else {
- if (pipe_openQemuPipe(pipe, pipeName) < 0) {
- fprintf(stderr, "Could not open '%s' pipe: %s\n", pipeName, strerror(errno));
- return 1;
- }
- printf("Connected to '%s' pipe\n", pipeName);
- }
-
- /* Allocate buffers, setup their data */
- buffer = malloc(bufferSize);
- buffer2 = malloc(bufferSize);
-
- for (nn = 0; nn < bufferSize; nn++) {
- buffer[nn] = (uint8_t)nn;
- }
-
- /* Do the work! */
- time0 = now_secs();
-
- for (count = 0; count < maxCount; count++) {
- int ret = pipe_send(pipe, buffer, bufferSize);
- int pos, len;
-
- if (ret < 0) {
- fprintf(stderr,"%d: Sending %d bytes failed: %s\n", count, bufferSize, strerror(errno));
- return 1;
- }
-
-#if 1
- /* The server is supposed to send the message back */
- pos = 0;
- len = bufferSize;
- while (len > 0) {
- ret = pipe_recv(pipe, buffer2 + pos, len);
- if (ret < 0) {
- fprintf(stderr, "Receiving failed (ret=%d): %s\n", ret, strerror(errno));
- return 3;
- }
- if (ret == 0) {
- fprintf(stderr, "Disconnection while receiving!\n");
- return 4;
- }
- pos += ret;
- len -= ret;
- }
-
- if (memcmp(buffer, buffer2, bufferSize) != 0) {
- fprintf(stderr, "Message content mismatch!\n");
- const int maxAvail = 16;
- const int maxLines = 12;
- int numLines = 0;
- for (nn = 0; nn < bufferSize; ) {
- int avail = bufferSize - nn;
- int mm;
- if (avail > maxAvail)
- avail = maxAvail;
-
- if (memcmp(buffer+nn, buffer2+nn, avail) != 0) {
- if (++numLines >= maxLines) {
- printf(".... to be continued ...\n");
- break;
- }
- printf("%04x:", nn);
-
- for (mm = 0; mm < avail; mm++)
- printf(" %02x", buffer[nn+mm]);
- for ( ; mm < maxAvail; mm++ )
- printf(" ");
-
- printf( " -- " );
-
- for (mm = 0; mm < avail; mm++)
- printf(" %02x", buffer2[nn+mm]);
-
- printf ("\n");
- }
- nn += avail;
- }
- return 6;
- }
-
-#endif
-
- if (count > 0 && (count % 200) == 0) {
- printf("... %d\n", count);
- }
- }
-
- time1 = now_secs();
-
- printf("Closing pipe\n");
- pipe_close(pipe);
-
- printf("Total time: %g seconds\n", time1 - time0);
- printf("Total bytes: %g bytes\n", 1.0*maxCount*bufferSize);
- printf("Bandwidth: %g MB/s\n", (maxCount*bufferSize/(1024.0*1024.0))/(time1 - time0) );
- return 0;
-}
diff --git a/tools/emulator/system/libqemu/test_host_1.c b/tools/emulator/system/libqemu/test_host_1.c
deleted file mode 100644
index 8e32bf23e..000000000
--- a/tools/emulator/system/libqemu/test_host_1.c
+++ /dev/null
@@ -1,244 +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.
- */
-
-/* This program is used to test the QEMUD fast pipes.
- * See external/qemu/docs/ANDROID-QEMUD-PIPES.TXT for details.
- *
- * The program acts as a simple TCP server that accepts data and sends
- * them back to the client as is.
- */
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/un.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-/* Default port number */
-#define DEFAULT_PORT 8012
-#define DEFAULT_PATH "/tmp/libqemu-socket"
-
-/* Try to execute x, looping around EINTR errors. */
-#undef TEMP_FAILURE_RETRY
-#define TEMP_FAILURE_RETRY(exp) ({ \
- typeof (exp) _rc; \
- do { \
- _rc = (exp); \
- } while (_rc == -1 && errno == EINTR); \
- _rc; })
-
-#define TFR TEMP_FAILURE_RETRY
-
-/* Close a socket, preserving the value of errno */
-static void
-socket_close(int sock)
-{
- int old_errno = errno;
- close(sock);
- errno = old_errno;
-}
-
-/* Create a server socket bound to a loopback port */
-static int
-socket_loopback_server( int port, int type )
-{
- struct sockaddr_in addr;
-
- int sock = socket(AF_INET, type, 0);
- if (sock < 0) {
- return -1;
- }
-
- memset(&addr, 0, sizeof(addr));
- addr.sin_family = AF_INET;
- addr.sin_port = htons(port);
- addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-
- int n = 1;
- setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &n, sizeof(n));
-
- if (TFR(bind(sock, (struct sockaddr*)&addr, sizeof(addr))) < 0) {
- socket_close(sock);
- return -1;
- }
-
- if (type == SOCK_STREAM) {
- if (TFR(listen(sock, 4)) < 0) {
- socket_close(sock);
- return -1;
- }
- }
-
- return sock;
-}
-
-static int
-socket_unix_server( const char* path, int type )
-{
- struct sockaddr_un addr;
-
- int sock = socket(AF_UNIX, type, 0);
- if (sock < 0) {
- return -1;
- }
-
- memset(&addr, 0, sizeof(addr));
- addr.sun_family = AF_UNIX;
- snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", path);
-
- unlink(addr.sun_path);
-
- printf("Unix path: '%s'\n", addr.sun_path);
-
- int n = 1;
- setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &n, sizeof(n));
-
- if (TFR(bind(sock, (struct sockaddr*)&addr, sizeof(addr))) < 0) {
- socket_close(sock);
- return -1;
- }
-
- if (type == SOCK_STREAM) {
- if (TFR(listen(sock, 4)) < 0) {
- socket_close(sock);
- return -1;
- }
- }
-
- return sock;
-}
-
-char* progname;
-
-static void usage(int code)
-{
- printf("Usage: %s [options]\n\n", progname);
- printf(
- "Valid options are:\n\n"
- " -? -h --help Print this message\n"
- " -unix <path> Use unix server socket\n"
- " -tcp <port> Use local tcp port (default %d)\n"
- "\n", DEFAULT_PORT
- );
- exit(code);
-}
-
-/* Main program */
-int main(int argc, char** argv)
-{
- int sock, client;
- int port = DEFAULT_PORT;
- const char* path = NULL;
- const char* tcpPort = NULL;
-
- /* Extract program name */
- {
- char* p = strrchr(argv[0], '/');
- if (p == NULL)
- progname = argv[0];
- else
- progname = p+1;
- }
-
- /* Parse options */
- while (argc > 1 && argv[1][0] == '-') {
- char* arg = argv[1];
- if (!strcmp(arg, "-?") || !strcmp(arg, "-h") || !strcmp(arg, "--help")) {
- usage(0);
- } else if (!strcmp(arg, "-unix")) {
- if (argc < 3) {
- fprintf(stderr, "-unix option needs an argument! See --help for details.\n");
- exit(1);
- }
- argc--;
- argv++;
- path = argv[1];
- } else if (!strcmp(arg, "-tcp")) {
- if (argc < 3) {
- fprintf(stderr, "-tcp option needs an argument! See --help for details.\n");
- exit(1);
- }
- argc--;
- argv++;
- tcpPort = argv[1];
- } else {
- fprintf(stderr, "UNKNOWN OPTION: %s\n\n", arg);
- usage(1);
- }
- argc--;
- argv++;
- }
-
- if (path != NULL) {
- printf("Starting pipe test server on unix path: %s\n", path);
- sock = socket_unix_server( path, SOCK_STREAM );
- } else {
- printf("Starting pipe test server on local port %d\n", port);
- sock = socket_loopback_server( port, SOCK_STREAM );
- }
- if (sock < 0) {
- fprintf(stderr, "Could not start server: %s\n", strerror(errno));
- return 1;
- }
- printf("Server ready!\n");
-
-RESTART:
- client = TFR(accept(sock, NULL, NULL));
- if (client < 0) {
- fprintf(stderr, "Server error: %s\n", strerror(errno));
- return 2;
- }
- printf("Client connected!\n");
-
- /* Now, accept any incoming data, and send it back */
- for (;;) {
- char buff[32768], *p;
- int ret, count;
-
- ret = TFR(read(client, buff, sizeof(buff)));
- if (ret < 0) {
- fprintf(stderr, "Client read error: %s\n", strerror(errno));
- socket_close(client);
- return 3;
- }
- if (ret == 0) {
- break;
- }
- count = ret;
- p = buff;
- //printf(" received: %d bytes\n", count);
-
- while (count > 0) {
- ret = TFR(write(client, p, count));
- if (ret < 0) {
- fprintf(stderr, "Client write error: %s\n", strerror(errno));
- socket_close(client);
- return 4;
- }
- //printf(" sent: %d bytes\n", ret);
-
- p += ret;
- count -= ret;
- }
- }
- printf("Client closed connection\n");
- socket_close(client);
- goto RESTART;
-
- return 0;
-}
diff --git a/tools/emulator/system/libqemu/test_host_2.c b/tools/emulator/system/libqemu/test_host_2.c
deleted file mode 100644
index 46a9e8dfb..000000000
--- a/tools/emulator/system/libqemu/test_host_2.c
+++ /dev/null
@@ -1,129 +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.
- */
-
-/* This program is used to test the QEMUD fast pipes.
- * See external/qemu/docs/ANDROID-QEMUD-PIPES.TXT for details.
- *
- * The program acts as a simple TCP server that accepts any data and
- * discards it immediately.
- */
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-/* Default port number */
-#define DEFAULT_PORT 8012
-
-/* Try to execute x, looping around EINTR errors. */
-#undef TEMP_FAILURE_RETRY
-#define TEMP_FAILURE_RETRY(exp) ({ \
- typeof (exp) _rc; \
- do { \
- _rc = (exp); \
- } while (_rc == -1 && errno == EINTR); \
- _rc; })
-
-#define TFR TEMP_FAILURE_RETRY
-
-/* Close a socket, preserving the value of errno */
-static void
-socket_close(int sock)
-{
- int old_errno = errno;
- close(sock);
- errno = old_errno;
-}
-
-/* Create a server socket bound to a loopback port */
-static int
-socket_loopback_server( int port, int type )
-{
- struct sockaddr_in addr;
-
- int sock = socket(AF_INET, type, 0);
- if (sock < 0) {
- return -1;
- }
-
- memset(&addr, 0, sizeof(addr));
- addr.sin_family = AF_INET;
- addr.sin_port = htons(port);
- addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-
- int n = 1;
- setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &n, sizeof(n));
-
- if (TFR(bind(sock, (struct sockaddr*)&addr, sizeof(addr))) < 0) {
- socket_close(sock);
- return -1;
- }
-
- if (type == SOCK_STREAM) {
- if (TFR(listen(sock, 4)) < 0) {
- socket_close(sock);
- return -1;
- }
- }
-
- return sock;
-}
-
-/* Main program */
-int main(void)
-{
- int sock, client;
- int port = DEFAULT_PORT;
-
- printf("Starting pipe test server on local port %d\n", port);
- sock = socket_loopback_server( port, SOCK_STREAM );
- if (sock < 0) {
- fprintf(stderr, "Could not start server: %s\n", strerror(errno));
- return 1;
- }
-
-RESTART:
- client = TFR(accept(sock, NULL, NULL));
- if (client < 0) {
- fprintf(stderr, "Server error: %s\n", strerror(errno));
- return 2;
- }
- printf("Client connected!\n");
-
- /* Now, accept any incoming data, and send it back */
- for (;;) {
- char buff[8192], *p;
- int ret, count;
-
- ret = TFR(read(client, buff, sizeof(buff)));
- if (ret < 0) {
- fprintf(stderr, "Client read error: %s\n", strerror(errno));
- socket_close(client);
- return 3;
- }
- if (ret == 0) {
- break;
- }
- }
- printf("Client closed connection\n");
- socket_close(client);
- goto RESTART;
-
- return 0;
-}
diff --git a/tools/emulator/system/libqemu/test_util.c b/tools/emulator/system/libqemu/test_util.c
deleted file mode 100644
index 169679626..000000000
--- a/tools/emulator/system/libqemu/test_util.c
+++ /dev/null
@@ -1,137 +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.
- */
-
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <stddef.h>
-#include <stdio.h>
-#include "test_util.h"
-
-#ifdef __linux__
-#include <time.h>
-double now_secs(void)
-{
- struct timespec tm;
- clock_gettime(CLOCK_MONOTONIC, &tm);
- return (double)tm.tv_sec + (double)tm.tv_nsec/1e9;
-}
-#else
-#include <sys/time.h>
-double now_secs(void)
-{
- struct timeval tv;
- gettimeofday(&tv, NULL);
- return tv.sec + (double)tv.usec/1e6;
-}
-#endif
-
-int
-pipe_openSocket( Pipe* pipe, int port )
-{
- static int fd;
- struct sockaddr_in addr;
-
- pipe->socket = -1;
-
- fd = socket( AF_INET, SOCK_STREAM, 0 );
- if (fd < 0) {
- fprintf(stderr, "%s: Can't create socket!!\n", __FUNCTION__);
- return -1;
- }
-
- memset(&addr, 0, sizeof(addr));
- addr.sin_family = AF_INET;
- addr.sin_port = htons(port);
- addr.sin_addr.s_addr = htonl(0x0a000202);
-
- if ( connect(fd, (struct sockaddr*)&addr, sizeof(addr)) < 0 ) {
- fprintf(stderr, "%s: Can't connect to tcp:local:%d: %s\n",
- __FUNCTION__, port, strerror(errno));
- close(fd);
- return -1;
- }
-
- pipe->socket = fd;
- return 0;
-}
-
-int
-pipe_openQemuPipe( Pipe* pipe, const char* pipename )
-{
- pipe->socket = qemu_pipe_open(pipename);
- if (pipe->socket < 0) {
- fprintf(stderr, "%s: Could not open '%s' pipe: %s\n", __FUNCTION__, pipename, strerror(errno));
- return -1;
- }
- return 0;
-}
-
-int
-pipe_send( Pipe* pipe, const void* buff, size_t bufflen )
-{
- int ret;
- const uint8_t* ptr = buff;
- while (bufflen > 0) {
- ret = write(pipe->socket, ptr, bufflen);
- if (ret < 0) {
- if (errno == EINTR)
- continue;
- fprintf(stderr, "%s: error: %s\n", __FUNCTION__, strerror(errno));
- return -1;
- }
- if (ret == 0) {
- fprintf(stderr, "%s: disconnection!\n", __FUNCTION__);
- return -1;
- }
- ptr += ret;
- bufflen -= ret;
- }
- return 0;
-}
-
-int
-pipe_recv( Pipe* pipe, void* buff, size_t bufflen )
-{
- int ret;
-
- for (;;) {
- ret = read(pipe->socket, buff, bufflen);
- if (ret < 0) {
- if (errno == EINTR)
- continue;
- fprintf(stderr, "%s: error: %s\n", __FUNCTION__, strerror(errno));
- return -1;
- }
- if (ret == 0) {
- fprintf(stderr, "%s: disconnection!\n", __FUNCTION__);
- return -1;
- }
- break;
- }
- return ret;
-}
-
-void
-pipe_close( Pipe* pipe )
-{
- if (pipe->socket >= 0) {
- close(pipe->socket);
- pipe->socket = -1;
- }
-}
diff --git a/tools/emulator/system/libqemu/tests.mk b/tools/emulator/system/libqemu/tests.mk
deleted file mode 100644
index 886973fbf..000000000
--- a/tools/emulator/system/libqemu/tests.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# Build libqemu tests, included from main Android.mk
-
-# The first test program is a simple TCP server that will send back
-# anything it receives from the client.
-#
-include $(CLEAR_VARS)
-LOCAL_MODULE := test-libqemu-1
-LOCAL_SRC_FILES := test_host_1.c
-LOCAL_MODULE_TAGS := tests
-include $(BUILD_HOST_EXECUTABLE)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := test-libqemu-2
-LOCAL_SRC_FILES := test_host_2.c
-LOCAL_MODULE_TAGS := tests
-include $(BUILD_HOST_EXECUTABLE)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := test-libqemu-1
-LOCAL_SRC_FILES := test_guest_1.c test_util.c
-LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_LIBRARIES := libcutils
-include $(BUILD_EXECUTABLE)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := test-libqemu-2
-LOCAL_SRC_FILES := test_guest_2.c test_util.c
-LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_LIBRARIES := libcutils
-include $(BUILD_EXECUTABLE)
diff --git a/tools/emulator/system/lights/Android.mk b/tools/emulator/system/lights/Android.mk
deleted file mode 100644
index 3fa04ed08..000000000
--- a/tools/emulator/system/lights/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (C) 2011 The Android Open Source Project.
-#
-# Original code licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this software 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.
-
-LOCAL_PATH := $(call my-dir)
-
-# HAL module implemenation, not prelinked and stored in
-# hw/<LIGHTS_HARDWARE_MODULE_ID>.<ro.hardware>.so
-include $(CLEAR_VARS)
-LOCAL_PRELINK_MODULE := false
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_SRC_FILES := lights_qemu.c
-LOCAL_MODULE := lights.goldfish
-LOCAL_CFLAGS += -DLIGHT_BACKLIGHT
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tools/emulator/system/lights/lights_qemu.c b/tools/emulator/system/lights/lights_qemu.c
deleted file mode 100644
index 94fe8ccb4..000000000
--- a/tools/emulator/system/lights/lights_qemu.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/* Copyright (C) 2011 The Android Open Source Project
- *
- * Original code licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this software 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.
- *
- * This implements a lights hardware library for the Android emulator.
- * the following code should be built as a shared library that will be
- * placed into /system/lib/hw/lights.goldfish.so
- *
- * It will be loaded by the code in hardware/libhardware/hardware.c
- * which is itself called from
- * ./frameworks/base/services/jni/com_android_server_HardwareService.cpp
- */
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#define LOG_TAG "Lights"
-#endif
-
-/* we connect with the emulator through the "hw-control" qemud service */
-#define LIGHTS_SERVICE_NAME "hw-control"
-
-#include <cutils/log.h>
-#include <stdint.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <hardware/lights.h>
-#include <hardware/qemud.h>
-
-/* Set to 1 to enable debug messages to the log */
-#define DEBUG 0
-#if DEBUG
-# define D(...) ALOGD(__VA_ARGS__)
-#else
-# define D(...) do{}while(0)
-#endif
-
-#define E(...) ALOGE(__VA_ARGS__)
-
-/* Get brightness(0~255) from state. */
-static int
-rgb_to_brightness( struct light_state_t const* state )
-{
- int color = state->color & 0x00ffffff;
- return ((77 * ((color >> 16) & 0x00ff))
- + (150 * ((color >> 8) & 0x00ff)) + (29 * (color & 0x00ff))) >> 8;
-}
-
-/* set backlight brightness by LIGHTS_SERVICE_NAME service. */
-static int
-set_light_backlight( struct light_device_t* dev, struct light_state_t const* state )
-{
- /* Get Lights service. */
- int fd = qemud_channel_open( LIGHTS_SERVICE_NAME );
-
- if (fd < 0) {
- E( "%s: no qemud connection", __FUNCTION__ );
- return -1;
- }
-
- D( "%s: On/Off %d/%d flashMode %d brightnessMode %d"
- " RGB = 0x%08x", __func__,
- state->flashOnMS,
- state->flashOffMS,
- state->flashMode,
- state->brightnessMode,
- state->color );
-
- int brightness = rgb_to_brightness( state );
-
- char buffer[64];
- snprintf( buffer, sizeof(buffer), "power:light:brightness:lcd_backlight:%d", brightness );
- D( "%s: lcd_backlight command: %s", __FUNCTION__, buffer );
-
- /* send backlight command to perform the backlight setting. */
- if (qemud_channel_send( fd, buffer, -1 ) < 0) {
- E( "%s: could not query lcd_backlight: %s", __FUNCTION__, strerror(errno) );
- close( fd );
- return -1;
- }
-
- close( fd );
- return 0;
-}
-
-static int
-set_light_buttons( struct light_device_t* dev, struct light_state_t const* state )
-{
- /* @Waiting for later implementation. */
- D( "%s: Not implemented.", __FUNCTION__ );
-
- return 0;
-}
-
-static int
-set_light_battery( struct light_device_t* dev, struct light_state_t const* state )
-{
- /* @Waiting for later implementation. */
- D( "%s: Not implemented.", __FUNCTION__ );
-
- return 0;
-}
-
-static int
-set_light_keyboard( struct light_device_t* dev, struct light_state_t const* state )
-{
- /* @Waiting for later implementation. */
- D( "%s: Not implemented.", __FUNCTION__ );
-
- return 0;
-}
-
-static int
-set_light_notifications( struct light_device_t* dev, struct light_state_t const* state )
-{
- /* @Waiting for later implementation. */
- D( "%s: Not implemented.", __FUNCTION__ );
-
- return 0;
-}
-
-static int
-set_light_attention( struct light_device_t* dev, struct light_state_t const* state )
-{
- /* @Waiting for later implementation. */
- D( "%s: Not implemented.", __FUNCTION__ );
-
- return 0;
-}
-
-/** Close the lights device */
-static int
-close_lights( struct light_device_t *dev )
-{
- free( dev );
-
- return 0;
-}
-
-/**
- * module methods
- */
-
-/** Open a new instance of a lights device using name */
-static int
-open_lights( const struct hw_module_t* module, char const *name,
- struct hw_device_t **device )
-{
- void* set_light;
-
- if (0 == strcmp( LIGHT_ID_BACKLIGHT, name )) {
- set_light = set_light_backlight;
- } else if (0 == strcmp( LIGHT_ID_KEYBOARD, name )) {
- set_light = set_light_keyboard;
- } else if (0 == strcmp( LIGHT_ID_BUTTONS, name )) {
- set_light = set_light_buttons;
- } else if (0 == strcmp( LIGHT_ID_BATTERY, name )) {
- set_light = set_light_battery;
- } else if (0 == strcmp( LIGHT_ID_NOTIFICATIONS, name )) {
- set_light = set_light_notifications;
- } else if (0 == strcmp( LIGHT_ID_ATTENTION, name )) {
- set_light = set_light_attention;
- } else {
- D( "%s: %s light isn't supported yet.", __FUNCTION__, name );
- return -EINVAL;
- }
-
- struct light_device_t *dev = malloc( sizeof(struct light_device_t) );
- if (dev == NULL) {
- return -EINVAL;
- }
- memset( dev, 0, sizeof(*dev) );
-
- dev->common.tag = HARDWARE_DEVICE_TAG;
- dev->common.version = 0;
- dev->common.module = (struct hw_module_t*)module;
- dev->common.close = (int (*)(struct hw_device_t*))close_lights;
- dev->set_light = set_light;
-
- *device = (struct hw_device_t*)dev;
- return 0;
-}
-
-static struct hw_module_methods_t lights_module_methods = {
- .open = open_lights,
-};
-
-/*
- * The emulator lights Module
- */
-struct hw_module_t HAL_MODULE_INFO_SYM = {
- .tag = HARDWARE_MODULE_TAG,
- .version_major = 1,
- .version_minor = 0,
- .id = LIGHTS_HARDWARE_MODULE_ID,
- .name = "Goldfish lights Module",
- .author = "The Android Open Source Project",
- .methods = &lights_module_methods,
-};
diff --git a/tools/emulator/system/qemu-props/qemu-props.c b/tools/emulator/system/qemu-props/qemu-props.c
deleted file mode 100644
index 56d510f9a..000000000
--- a/tools/emulator/system/qemu-props/qemu-props.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-/* this program is used to read a set of system properties and their values
- * from the emulator program and set them in the currently-running emulated
- * system. It does so by connecting to the 'boot-properties' qemud service.
- *
- * This program should be run as root and called from
- * /system/etc/init.goldfish.rc exclusively.
- */
-
-#define LOG_TAG "qemu-props"
-
-#define DEBUG 1
-
-#if DEBUG
-# include <cutils/log.h>
-# define DD(...) ALOGI(__VA_ARGS__)
-#else
-# define DD(...) ((void)0)
-#endif
-
-#include <cutils/properties.h>
-#include <unistd.h>
-#include <hardware/qemud.h>
-
-/* Name of the qemud service we want to connect to.
- */
-#define QEMUD_SERVICE "boot-properties"
-
-#define MAX_TRIES 5
-
-int main(void)
-{
- int qemud_fd, count = 0;
-
- /* try to connect to the qemud service */
- {
- int tries = MAX_TRIES;
-
- while (1) {
- qemud_fd = qemud_channel_open( "boot-properties" );
- if (qemud_fd >= 0)
- break;
-
- if (--tries <= 0) {
- DD("Could not connect after too many tries. Aborting");
- return 1;
- }
-
- DD("waiting 1s to wait for qemud.");
- sleep(1);
- }
- }
-
- DD("connected to '%s' qemud service.", QEMUD_SERVICE);
-
- /* send the 'list' command to the service */
- if (qemud_channel_send(qemud_fd, "list", -1) < 0) {
- DD("could not send command to '%s' service", QEMUD_SERVICE);
- return 1;
- }
-
- /* read each system property as a single line from the service,
- * until exhaustion.
- */
- for (;;)
- {
-#define BUFF_SIZE (PROPERTY_KEY_MAX + PROPERTY_VALUE_MAX + 2)
- DD("receiving..");
- char* q;
- char temp[BUFF_SIZE];
- int len = qemud_channel_recv(qemud_fd, temp, sizeof temp - 1);
-
- /* lone NUL-byte signals end of properties */
- if (len < 0 || len > BUFF_SIZE-1 || temp[0] == '\0')
- break;
-
- temp[len] = '\0'; /* zero-terminate string */
-
- DD("received: %.*s", len, temp);
-
- /* separate propery name from value */
- q = strchr(temp, '=');
- if (q == NULL) {
- DD("invalid format, ignored.");
- continue;
- }
- *q++ = '\0';
-
- if (property_set(temp, q) < 0) {
- DD("could not set property '%s' to '%s'", temp, q);
- } else {
- count += 1;
- }
- }
-
-
- /* finally, close the channel and exit */
- close(qemud_fd);
- DD("exiting (%d properties set).", count);
- return 0;
-}
diff --git a/tools/emulator/system/qemud/Android.mk b/tools/emulator/system/qemud/Android.mk
deleted file mode 100644
index 237572c38..000000000
--- a/tools/emulator/system/qemud/Android.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright 2008 The Android Open Source Project
-
-# We're moving the emulator-specific platform libs to
-# development.git/tools/emulator/. The following test is to ensure
-# smooth builds even if the tree contains both versions.
-#
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- qemud.c
-
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
-
-LOCAL_MODULE:= qemud
-
-include $(BUILD_EXECUTABLE)
diff --git a/tools/emulator/system/qemud/qemud.c b/tools/emulator/system/qemud/qemud.c
deleted file mode 100644
index e8363765f..000000000
--- a/tools/emulator/system/qemud/qemud.c
+++ /dev/null
@@ -1,1719 +0,0 @@
-#include <stdint.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <termios.h>
-#include <cutils/sockets.h>
-
-/*
- * the qemud daemon program is only used within Android as a bridge
- * between the emulator program and the emulated system. it really works as
- * a simple stream multiplexer that works as follows:
- *
- * - qemud is started by init following instructions in
- * /system/etc/init.goldfish.rc (i.e. it is never started on real devices)
- *
- * - qemud communicates with the emulator program through a single serial
- * port, whose name is passed through a kernel boot parameter
- * (e.g. android.qemud=ttyS1)
- *
- * - qemud binds one unix local stream socket (/dev/socket/qemud, created
- * by init through /system/etc/init.goldfish.rc).
- *
- *
- * emulator <==serial==> qemud <---> /dev/socket/qemud <-+--> client1
- * |
- * +--> client2
- *
- * - the special channel index 0 is used by the emulator and qemud only.
- * other channel numbers correspond to clients. More specifically,
- * connection are created like this:
- *
- * * the client connects to /dev/socket/qemud
- *
- * * the client sends the service name through the socket, as
- * <service-name>
- *
- * * qemud creates a "Client" object internally, assigns it an
- * internal unique channel number > 0, then sends a connection
- * initiation request to the emulator (i.e. through channel 0):
- *
- * connect:<id>:<name>
- *
- * where <name> is the service name, and <id> is a 2-hexchar
- * number corresponding to the channel number.
- *
- * * in case of success, the emulator responds through channel 0
- * with:
- *
- * ok:connect:<id>
- *
- * after this, all messages between the client and the emulator
- * are passed in pass-through mode.
- *
- * * if the emulator refuses the service connection, it will
- * send the following through channel 0:
- *
- * ko:connect:<id>:reason-for-failure
- *
- * * If the client closes the connection, qemud sends the following
- * to the emulator:
- *
- * disconnect:<id>
- *
- * The same message is the opposite direction if the emulator
- * chooses to close the connection.
- *
- * * any command sent through channel 0 to the emulator that is
- * not properly recognized will be answered by:
- *
- * ko:unknown command
- *
- *
- * Internally, the daemon maintains a "Client" object for each client
- * connection (i.e. accepting socket connection).
- */
-
-/* name of the single control socket used by the daemon */
-#define CONTROL_SOCKET_NAME "qemud"
-
-#define DEBUG 0
-#define T_ACTIVE 0 /* set to 1 to dump traffic */
-
-#if DEBUG
-# define LOG_TAG "qemud"
-# include <cutils/log.h>
-# define D(...) ALOGD(__VA_ARGS__)
-#else
-# define D(...) ((void)0)
-# define T(...) ((void)0)
-#endif
-
-#if T_ACTIVE
-# define T(...) D(__VA_ARGS__)
-#else
-# define T(...) ((void)0)
-#endif
-
-/** UTILITIES
- **/
-
-static void
-fatal( const char* fmt, ... )
-{
- va_list args;
- va_start(args, fmt);
- fprintf(stderr, "PANIC: ");
- vfprintf(stderr, fmt, args);
- fprintf(stderr, "\n" );
- va_end(args);
- exit(1);
-}
-
-static void*
-xalloc( size_t sz )
-{
- void* p;
-
- if (sz == 0)
- return NULL;
-
- p = malloc(sz);
- if (p == NULL)
- fatal( "not enough memory" );
-
- return p;
-}
-
-#define xnew(p) (p) = xalloc(sizeof(*(p)))
-
-static void*
-xalloc0( size_t sz )
-{
- void* p = xalloc(sz);
- memset( p, 0, sz );
- return p;
-}
-
-#define xnew0(p) (p) = xalloc0(sizeof(*(p)))
-
-#define xfree(p) (free((p)), (p) = NULL)
-
-static void*
-xrealloc( void* block, size_t size )
-{
- void* p = realloc( block, size );
-
- if (p == NULL && size > 0)
- fatal( "not enough memory" );
-
- return p;
-}
-
-#define xrenew(p,count) (p) = xrealloc((p),sizeof(*(p))*(count))
-
-static int
-hex2int( const uint8_t* data, int len )
-{
- int result = 0;
- while (len > 0) {
- int c = *data++;
- unsigned d;
-
- result <<= 4;
- do {
- d = (unsigned)(c - '0');
- if (d < 10)
- break;
-
- d = (unsigned)(c - 'a');
- if (d < 6) {
- d += 10;
- break;
- }
-
- d = (unsigned)(c - 'A');
- if (d < 6) {
- d += 10;
- break;
- }
-
- return -1;
- }
- while (0);
-
- result |= d;
- len -= 1;
- }
- return result;
-}
-
-
-static void
-int2hex( int value, uint8_t* to, int width )
-{
- int nn = 0;
- static const char hexchars[16] = "0123456789abcdef";
-
- for ( --width; width >= 0; width--, nn++ ) {
- to[nn] = hexchars[(value >> (width*4)) & 15];
- }
-}
-
-static int
-fd_read(int fd, void* to, int len)
-{
- int ret;
-
- do {
- ret = read(fd, to, len);
- } while (ret < 0 && errno == EINTR);
-
- return ret;
-}
-
-static int
-fd_write(int fd, const void* from, int len)
-{
- int ret;
-
- do {
- ret = write(fd, from, len);
- } while (ret < 0 && errno == EINTR);
-
- return ret;
-}
-
-static void
-fd_setnonblock(int fd)
-{
- int ret, flags;
-
- do {
- flags = fcntl(fd, F_GETFD);
- } while (flags < 0 && errno == EINTR);
-
- if (flags < 0) {
- fatal( "%s: could not get flags for fd %d: %s",
- __FUNCTION__, fd, strerror(errno) );
- }
-
- do {
- ret = fcntl(fd, F_SETFD, flags | O_NONBLOCK);
- } while (ret < 0 && errno == EINTR);
-
- if (ret < 0) {
- fatal( "%s: could not set fd %d to non-blocking: %s",
- __FUNCTION__, fd, strerror(errno) );
- }
-}
-
-
-static int
-fd_accept(int fd)
-{
- struct sockaddr from;
- socklen_t fromlen = sizeof(from);
- int ret;
-
- do {
- ret = accept(fd, &from, &fromlen);
- } while (ret < 0 && errno == EINTR);
-
- return ret;
-}
-
-/** FD EVENT LOOP
- **/
-
-/* A Looper object is used to monitor activity on one or more
- * file descriptors (e.g sockets).
- *
- * - call looper_add() to register a function that will be
- * called when events happen on the file descriptor.
- *
- * - call looper_enable() or looper_disable() to enable/disable
- * the set of monitored events for a given file descriptor.
- *
- * - call looper_del() to unregister a file descriptor.
- * this does *not* close the file descriptor.
- *
- * Note that you can only provide a single function to handle
- * all events related to a given file descriptor.
-
- * You can call looper_enable/_disable/_del within a function
- * callback.
- */
-
-/* the current implementation uses Linux's epoll facility
- * the event mask we use are simply combinations of EPOLLIN
- * EPOLLOUT, EPOLLHUP and EPOLLERR
- */
-#include <sys/epoll.h>
-
-#define MAX_CHANNELS 16
-#define MAX_EVENTS (MAX_CHANNELS+1) /* each channel + the serial fd */
-
-/* the event handler function type, 'user' is a user-specific
- * opaque pointer passed to looper_add().
- */
-typedef void (*EventFunc)( void* user, int events );
-
-/* bit flags for the LoopHook structure.
- *
- * HOOK_PENDING means that an event happened on the
- * corresponding file descriptor.
- *
- * HOOK_CLOSING is used to delay-close monitored
- * file descriptors.
- */
-enum {
- HOOK_PENDING = (1 << 0),
- HOOK_CLOSING = (1 << 1),
-};
-
-/* A LoopHook structure is used to monitor a given
- * file descriptor and record its event handler.
- */
-typedef struct {
- int fd;
- int wanted; /* events we are monitoring */
- int events; /* events that occured */
- int state; /* see HOOK_XXX constants */
- void* ev_user; /* user-provided handler parameter */
- EventFunc ev_func; /* event handler callback */
-} LoopHook;
-
-/* Looper is the main object modeling a looper object
- */
-typedef struct {
- int epoll_fd;
- int num_fds;
- int max_fds;
- struct epoll_event* events;
- LoopHook* hooks;
-} Looper;
-
-/* initialize a looper object */
-static void
-looper_init( Looper* l )
-{
- l->epoll_fd = epoll_create(4);
- l->num_fds = 0;
- l->max_fds = 0;
- l->events = NULL;
- l->hooks = NULL;
-}
-
-/* finalize a looper object */
-static void
-looper_done( Looper* l )
-{
- xfree(l->events);
- xfree(l->hooks);
- l->max_fds = 0;
- l->num_fds = 0;
-
- close(l->epoll_fd);
- l->epoll_fd = -1;
-}
-
-/* return the LoopHook corresponding to a given
- * monitored file descriptor, or NULL if not found
- */
-static LoopHook*
-looper_find( Looper* l, int fd )
-{
- LoopHook* hook = l->hooks;
- LoopHook* end = hook + l->num_fds;
-
- for ( ; hook < end; hook++ ) {
- if (hook->fd == fd)
- return hook;
- }
- return NULL;
-}
-
-/* grow the arrays in the looper object */
-static void
-looper_grow( Looper* l )
-{
- int old_max = l->max_fds;
- int new_max = old_max + (old_max >> 1) + 4;
- int n;
-
- xrenew( l->events, new_max );
- xrenew( l->hooks, new_max );
- l->max_fds = new_max;
-
- /* now change the handles to all events */
- for (n = 0; n < l->num_fds; n++) {
- struct epoll_event ev;
- LoopHook* hook = l->hooks + n;
-
- ev.events = hook->wanted;
- ev.data.ptr = hook;
- epoll_ctl( l->epoll_fd, EPOLL_CTL_MOD, hook->fd, &ev );
- }
-}
-
-/* register a file descriptor and its event handler.
- * no event mask will be enabled
- */
-static void
-looper_add( Looper* l, int fd, EventFunc func, void* user )
-{
- struct epoll_event ev;
- LoopHook* hook;
-
- if (l->num_fds >= l->max_fds)
- looper_grow(l);
-
- hook = l->hooks + l->num_fds;
-
- hook->fd = fd;
- hook->ev_user = user;
- hook->ev_func = func;
- hook->state = 0;
- hook->wanted = 0;
- hook->events = 0;
-
- fd_setnonblock(fd);
-
- ev.events = 0;
- ev.data.ptr = hook;
- epoll_ctl( l->epoll_fd, EPOLL_CTL_ADD, fd, &ev );
-
- l->num_fds += 1;
-}
-
-/* unregister a file descriptor and its event handler
- */
-static void
-looper_del( Looper* l, int fd )
-{
- LoopHook* hook = looper_find( l, fd );
-
- if (!hook) {
- D( "%s: invalid fd: %d", __FUNCTION__, fd );
- return;
- }
- /* don't remove the hook yet */
- hook->state |= HOOK_CLOSING;
-
- epoll_ctl( l->epoll_fd, EPOLL_CTL_DEL, fd, NULL );
-}
-
-/* enable monitoring of certain events for a file
- * descriptor. This adds 'events' to the current
- * event mask
- */
-static void
-looper_enable( Looper* l, int fd, int events )
-{
- LoopHook* hook = looper_find( l, fd );
-
- if (!hook) {
- D("%s: invalid fd: %d", __FUNCTION__, fd );
- return;
- }
-
- if (events & ~hook->wanted) {
- struct epoll_event ev;
-
- hook->wanted |= events;
- ev.events = hook->wanted;
- ev.data.ptr = hook;
-
- epoll_ctl( l->epoll_fd, EPOLL_CTL_MOD, fd, &ev );
- }
-}
-
-/* disable monitoring of certain events for a file
- * descriptor. This ignores events that are not
- * currently enabled.
- */
-static void
-looper_disable( Looper* l, int fd, int events )
-{
- LoopHook* hook = looper_find( l, fd );
-
- if (!hook) {
- D("%s: invalid fd: %d", __FUNCTION__, fd );
- return;
- }
-
- if (events & hook->wanted) {
- struct epoll_event ev;
-
- hook->wanted &= ~events;
- ev.events = hook->wanted;
- ev.data.ptr = hook;
-
- epoll_ctl( l->epoll_fd, EPOLL_CTL_MOD, fd, &ev );
- }
-}
-
-/* wait until an event occurs on one of the registered file
- * descriptors. Only returns in case of error !!
- */
-static void
-looper_loop( Looper* l )
-{
- for (;;) {
- int n, count;
-
- do {
- count = epoll_wait( l->epoll_fd, l->events, l->num_fds, -1 );
- } while (count < 0 && errno == EINTR);
-
- if (count < 0) {
- D("%s: error: %s", __FUNCTION__, strerror(errno) );
- return;
- }
-
- if (count == 0) {
- D("%s: huh ? epoll returned count=0", __FUNCTION__);
- continue;
- }
-
- /* mark all pending hooks */
- for (n = 0; n < count; n++) {
- LoopHook* hook = l->events[n].data.ptr;
- hook->state = HOOK_PENDING;
- hook->events = l->events[n].events;
- }
-
- /* execute hook callbacks. this may change the 'hooks'
- * and 'events' array, as well as l->num_fds, so be careful */
- for (n = 0; n < l->num_fds; n++) {
- LoopHook* hook = l->hooks + n;
- if (hook->state & HOOK_PENDING) {
- hook->state &= ~HOOK_PENDING;
- hook->ev_func( hook->ev_user, hook->events );
- }
- }
-
- /* now remove all the hooks that were closed by
- * the callbacks */
- for (n = 0; n < l->num_fds;) {
- struct epoll_event ev;
- LoopHook* hook = l->hooks + n;
-
- if (!(hook->state & HOOK_CLOSING)) {
- n++;
- continue;
- }
-
- hook[0] = l->hooks[l->num_fds-1];
- l->num_fds -= 1;
- ev.events = hook->wanted;
- ev.data.ptr = hook;
- epoll_ctl( l->epoll_fd, EPOLL_CTL_MOD, hook->fd, &ev );
- }
- }
-}
-
-#if T_ACTIVE
-char*
-quote( const void* data, int len )
-{
- const char* p = data;
- const char* end = p + len;
- int count = 0;
- int phase = 0;
- static char* buff = NULL;
-
- for (phase = 0; phase < 2; phase++) {
- if (phase != 0) {
- xfree(buff);
- buff = xalloc(count+1);
- }
- count = 0;
- for (p = data; p < end; p++) {
- int c = *p;
-
- if (c == '\\') {
- if (phase != 0) {
- buff[count] = buff[count+1] = '\\';
- }
- count += 2;
- continue;
- }
-
- if (c >= 32 && c < 127) {
- if (phase != 0)
- buff[count] = c;
- count += 1;
- continue;
- }
-
-
- if (c == '\t') {
- if (phase != 0) {
- memcpy(buff+count, "<TAB>", 5);
- }
- count += 5;
- continue;
- }
- if (c == '\n') {
- if (phase != 0) {
- memcpy(buff+count, "<LN>", 4);
- }
- count += 4;
- continue;
- }
- if (c == '\r') {
- if (phase != 0) {
- memcpy(buff+count, "<CR>", 4);
- }
- count += 4;
- continue;
- }
-
- if (phase != 0) {
- buff[count+0] = '\\';
- buff[count+1] = 'x';
- buff[count+2] = "0123456789abcdef"[(c >> 4) & 15];
- buff[count+3] = "0123456789abcdef"[ (c) & 15];
- }
- count += 4;
- }
- }
- buff[count] = 0;
- return buff;
-}
-#endif /* T_ACTIVE */
-
-/** PACKETS
- **
- ** We need a way to buffer data before it can be sent to the
- ** corresponding file descriptor. We use linked list of Packet
- ** objects to do this.
- **/
-
-typedef struct Packet Packet;
-
-#define MAX_PAYLOAD 4000
-
-struct Packet {
- Packet* next;
- int len;
- int channel;
- uint8_t data[ MAX_PAYLOAD ];
-};
-
-/* we expect to alloc/free a lot of packets during
- * operations so use a single linked list of free packets
- * to keep things speedy and simple.
- */
-static Packet* _free_packets;
-
-/* Allocate a packet */
-static Packet*
-packet_alloc(void)
-{
- Packet* p = _free_packets;
- if (p != NULL) {
- _free_packets = p->next;
- } else {
- xnew(p);
- }
- p->next = NULL;
- p->len = 0;
- p->channel = -1;
- return p;
-}
-
-/* Release a packet. This takes the address of a packet
- * pointer that will be set to NULL on exit (avoids
- * referencing dangling pointers in case of bugs)
- */
-static void
-packet_free( Packet* *ppacket )
-{
- Packet* p = *ppacket;
- if (p) {
- p->next = _free_packets;
- _free_packets = p;
- *ppacket = NULL;
- }
-}
-
-/** PACKET RECEIVER
- **
- ** Simple abstraction for something that can receive a packet
- ** from a FDHandler (see below) or something else.
- **
- ** Send a packet to it with 'receiver_post'
- **
- ** Call 'receiver_close' to indicate that the corresponding
- ** packet source was closed.
- **/
-
-typedef void (*PostFunc) ( void* user, Packet* p );
-typedef void (*CloseFunc)( void* user );
-
-typedef struct {
- PostFunc post;
- CloseFunc close;
- void* user;
-} Receiver;
-
-/* post a packet to a receiver. Note that this transfers
- * ownership of the packet to the receiver.
- */
-static __inline__ void
-receiver_post( Receiver* r, Packet* p )
-{
- if (r->post)
- r->post( r->user, p );
- else
- packet_free(&p);
-}
-
-/* tell a receiver the packet source was closed.
- * this will also prevent further posting to the
- * receiver.
- */
-static __inline__ void
-receiver_close( Receiver* r )
-{
- if (r->close) {
- r->close( r->user );
- r->close = NULL;
- }
- r->post = NULL;
-}
-
-
-/** FD HANDLERS
- **
- ** these are smart listeners that send incoming packets to a receiver
- ** and can queue one or more outgoing packets and send them when
- ** possible to the FD.
- **
- ** note that we support clean shutdown of file descriptors,
- ** i.e. we try to send all outgoing packets before destroying
- ** the FDHandler.
- **/
-
-typedef struct FDHandler FDHandler;
-typedef struct FDHandlerList FDHandlerList;
-
-struct FDHandler {
- int fd;
- FDHandlerList* list;
- char closing;
- Receiver receiver[1];
-
- /* queue of outgoing packets */
- int out_pos;
- Packet* out_first;
- Packet** out_ptail;
-
- FDHandler* next;
- FDHandler** pref;
-
-};
-
-struct FDHandlerList {
- /* the looper that manages the fds */
- Looper* looper;
-
- /* list of active FDHandler objects */
- FDHandler* active;
-
- /* list of closing FDHandler objects.
- * these are waiting to push their
- * queued packets to the fd before
- * freeing themselves.
- */
- FDHandler* closing;
-
-};
-
-/* remove a FDHandler from its current list */
-static void
-fdhandler_remove( FDHandler* f )
-{
- f->pref[0] = f->next;
- if (f->next)
- f->next->pref = f->pref;
-}
-
-/* add a FDHandler to a given list */
-static void
-fdhandler_prepend( FDHandler* f, FDHandler** list )
-{
- f->next = list[0];
- f->pref = list;
- list[0] = f;
- if (f->next)
- f->next->pref = &f->next;
-}
-
-/* initialize a FDHandler list */
-static void
-fdhandler_list_init( FDHandlerList* list, Looper* looper )
-{
- list->looper = looper;
- list->active = NULL;
- list->closing = NULL;
-}
-
-
-/* close a FDHandler (and free it). Note that this will not
- * perform a graceful shutdown, i.e. all packets in the
- * outgoing queue will be immediately free.
- *
- * this *will* notify the receiver that the file descriptor
- * was closed.
- *
- * you should call fdhandler_shutdown() if you want to
- * notify the FDHandler that its packet source is closed.
- */
-static void
-fdhandler_close( FDHandler* f )
-{
- /* notify receiver */
- receiver_close(f->receiver);
-
- /* remove the handler from its list */
- fdhandler_remove(f);
-
- /* get rid of outgoing packet queue */
- if (f->out_first != NULL) {
- Packet* p;
- while ((p = f->out_first) != NULL) {
- f->out_first = p->next;
- packet_free(&p);
- }
- }
-
- /* get rid of file descriptor */
- if (f->fd >= 0) {
- looper_del( f->list->looper, f->fd );
- close(f->fd);
- f->fd = -1;
- }
-
- f->list = NULL;
- xfree(f);
-}
-
-/* Ask the FDHandler to cleanly shutdown the connection,
- * i.e. send any pending outgoing packets then auto-free
- * itself.
- */
-static void
-fdhandler_shutdown( FDHandler* f )
-{
- /* prevent later fdhandler_close() to
- * call the receiver's close.
- */
- f->receiver->close = NULL;
-
- if (f->out_first != NULL && !f->closing)
- {
- /* move the handler to the 'closing' list */
- f->closing = 1;
- fdhandler_remove(f);
- fdhandler_prepend(f, &f->list->closing);
- return;
- }
-
- fdhandler_close(f);
-}
-
-/* Enqueue a new packet that the FDHandler will
- * send through its file descriptor.
- */
-static void
-fdhandler_enqueue( FDHandler* f, Packet* p )
-{
- Packet* first = f->out_first;
-
- p->next = NULL;
- f->out_ptail[0] = p;
- f->out_ptail = &p->next;
-
- if (first == NULL) {
- f->out_pos = 0;
- looper_enable( f->list->looper, f->fd, EPOLLOUT );
- }
-}
-
-
-/* FDHandler file descriptor event callback for read/write ops */
-static void
-fdhandler_event( FDHandler* f, int events )
-{
- int len;
-
- /* in certain cases, it's possible to have both EPOLLIN and
- * EPOLLHUP at the same time. This indicates that there is incoming
- * data to read, but that the connection was nonetheless closed
- * by the sender. Be sure to read the data before closing
- * the receiver to avoid packet loss.
- */
-
- if (events & EPOLLIN) {
- Packet* p = packet_alloc();
- int len;
-
- if ((len = fd_read(f->fd, p->data, MAX_PAYLOAD)) < 0) {
- D("%s: can't recv: %s", __FUNCTION__, strerror(errno));
- packet_free(&p);
- } else if (len > 0) {
- p->len = len;
- p->channel = -101; /* special debug value, not used */
- receiver_post( f->receiver, p );
- }
- }
-
- if (events & (EPOLLHUP|EPOLLERR)) {
- /* disconnection */
- D("%s: disconnect on fd %d", __FUNCTION__, f->fd);
- fdhandler_close(f);
- return;
- }
-
- if (events & EPOLLOUT && f->out_first) {
- Packet* p = f->out_first;
- int avail, len;
-
- avail = p->len - f->out_pos;
- if ((len = fd_write(f->fd, p->data + f->out_pos, avail)) < 0) {
- D("%s: can't send: %s", __FUNCTION__, strerror(errno));
- } else {
- f->out_pos += len;
- if (f->out_pos >= p->len) {
- f->out_pos = 0;
- f->out_first = p->next;
- packet_free(&p);
- if (f->out_first == NULL) {
- f->out_ptail = &f->out_first;
- looper_disable( f->list->looper, f->fd, EPOLLOUT );
- }
- }
- }
- }
-}
-
-
-/* Create a new FDHandler that monitors read/writes */
-static FDHandler*
-fdhandler_new( int fd,
- FDHandlerList* list,
- Receiver* receiver )
-{
- FDHandler* f = xalloc0(sizeof(*f));
-
- f->fd = fd;
- f->list = list;
- f->receiver[0] = receiver[0];
- f->out_first = NULL;
- f->out_ptail = &f->out_first;
- f->out_pos = 0;
-
- fdhandler_prepend(f, &list->active);
-
- looper_add( list->looper, fd, (EventFunc) fdhandler_event, f );
- looper_enable( list->looper, fd, EPOLLIN );
-
- return f;
-}
-
-
-/* event callback function to monitor accepts() on server sockets.
- * the convention used here is that the receiver will receive a
- * dummy packet with the new client socket in p->channel
- */
-static void
-fdhandler_accept_event( FDHandler* f, int events )
-{
- if (events & EPOLLIN) {
- /* this is an accept - send a dummy packet to the receiver */
- Packet* p = packet_alloc();
-
- D("%s: accepting on fd %d", __FUNCTION__, f->fd);
- p->data[0] = 1;
- p->len = 1;
- p->channel = fd_accept(f->fd);
- if (p->channel < 0) {
- D("%s: accept failed ?: %s", __FUNCTION__, strerror(errno));
- packet_free(&p);
- return;
- }
- receiver_post( f->receiver, p );
- }
-
- if (events & (EPOLLHUP|EPOLLERR)) {
- /* disconnecting !! */
- D("%s: closing accept fd %d", __FUNCTION__, f->fd);
- fdhandler_close(f);
- return;
- }
-}
-
-
-/* Create a new FDHandler used to monitor new connections on a
- * server socket. The receiver must expect the new connection
- * fd in the 'channel' field of a dummy packet.
- */
-static FDHandler*
-fdhandler_new_accept( int fd,
- FDHandlerList* list,
- Receiver* receiver )
-{
- FDHandler* f = xalloc0(sizeof(*f));
-
- f->fd = fd;
- f->list = list;
- f->receiver[0] = receiver[0];
-
- fdhandler_prepend(f, &list->active);
-
- looper_add( list->looper, fd, (EventFunc) fdhandler_accept_event, f );
- looper_enable( list->looper, fd, EPOLLIN );
- listen( fd, 5 );
-
- return f;
-}
-
-/** SERIAL CONNECTION STATE
- **
- ** The following is used to handle the framing protocol
- ** used on the serial port connection.
- **/
-
-/* each packet is made of a 6 byte header followed by a payload
- * the header looks like:
- *
- * offset size description
- * 0 2 a 2-byte hex string for the channel number
- * 4 4 a 4-char hex string for the size of the payload
- * 6 n the payload itself
- */
-#define HEADER_SIZE 6
-#define CHANNEL_OFFSET 0
-#define LENGTH_OFFSET 2
-#define CHANNEL_SIZE 2
-#define LENGTH_SIZE 4
-
-#define CHANNEL_CONTROL 0
-
-/* The Serial object receives data from the serial port,
- * extracts the payload size and channel index, then sends
- * the resulting messages as a packet to a generic receiver.
- *
- * You can also use serial_send to send a packet through
- * the serial port.
- */
-typedef struct Serial {
- FDHandler* fdhandler; /* used to monitor serial port fd */
- Receiver receiver[1]; /* send payload there */
- int in_len; /* current bytes in input packet */
- int in_datalen; /* payload size, or 0 when reading header */
- int in_channel; /* extracted channel number */
- Packet* in_packet; /* used to read incoming packets */
-} Serial;
-
-
-/* a callback called when the serial port's fd is closed */
-static void
-serial_fd_close( Serial* s )
-{
- fatal("unexpected serial port close !!");
-}
-
-static void
-serial_dump( Packet* p, const char* funcname )
-{
- T("%s: %03d bytes: '%s'",
- funcname, p->len, quote(p->data, p->len));
-}
-
-/* a callback called when a packet arrives from the serial port's FDHandler.
- *
- * This will essentially parse the header, extract the channel number and
- * the payload size and store them in 'in_datalen' and 'in_channel'.
- *
- * After that, the payload is sent to the receiver once completed.
- */
-static void
-serial_fd_receive( Serial* s, Packet* p )
-{
- int rpos = 0, rcount = p->len;
- Packet* inp = s->in_packet;
- int inpos = s->in_len;
-
- serial_dump( p, __FUNCTION__ );
-
- while (rpos < rcount)
- {
- int avail = rcount - rpos;
-
- /* first, try to read the header */
- if (s->in_datalen == 0) {
- int wanted = HEADER_SIZE - inpos;
- if (avail > wanted)
- avail = wanted;
-
- memcpy( inp->data + inpos, p->data + rpos, avail );
- inpos += avail;
- rpos += avail;
-
- if (inpos == HEADER_SIZE) {
- s->in_datalen = hex2int( inp->data + LENGTH_OFFSET, LENGTH_SIZE );
- s->in_channel = hex2int( inp->data + CHANNEL_OFFSET, CHANNEL_SIZE );
-
- if (s->in_datalen <= 0) {
- D("ignoring %s packet from serial port",
- s->in_datalen ? "empty" : "malformed");
- s->in_datalen = 0;
- }
-
- //D("received %d bytes packet for channel %d", s->in_datalen, s->in_channel);
- inpos = 0;
- }
- }
- else /* then, populate the packet itself */
- {
- int wanted = s->in_datalen - inpos;
-
- if (avail > wanted)
- avail = wanted;
-
- memcpy( inp->data + inpos, p->data + rpos, avail );
- inpos += avail;
- rpos += avail;
-
- if (inpos == s->in_datalen) {
- if (s->in_channel < 0) {
- D("ignoring %d bytes addressed to channel %d",
- inpos, s->in_channel);
- } else {
- inp->len = inpos;
- inp->channel = s->in_channel;
- receiver_post( s->receiver, inp );
- s->in_packet = inp = packet_alloc();
- }
- s->in_datalen = 0;
- inpos = 0;
- }
- }
- }
- s->in_len = inpos;
- packet_free(&p);
-}
-
-
-/* send a packet to the serial port.
- * this assumes that p->len and p->channel contain the payload's
- * size and channel and will add the appropriate header.
- */
-static void
-serial_send( Serial* s, Packet* p )
-{
- Packet* h = packet_alloc();
-
- //D("sending to serial %d bytes from channel %d: '%.*s'", p->len, p->channel, p->len, p->data);
-
- /* insert a small header before this packet */
- h->len = HEADER_SIZE;
- int2hex( p->len, h->data + LENGTH_OFFSET, LENGTH_SIZE );
- int2hex( p->channel, h->data + CHANNEL_OFFSET, CHANNEL_SIZE );
-
- serial_dump( h, __FUNCTION__ );
- serial_dump( p, __FUNCTION__ );
-
- fdhandler_enqueue( s->fdhandler, h );
- fdhandler_enqueue( s->fdhandler, p );
-}
-
-
-/* initialize serial reader */
-static void
-serial_init( Serial* s,
- int fd,
- FDHandlerList* list,
- Receiver* receiver )
-{
- Receiver recv;
-
- recv.user = s;
- recv.post = (PostFunc) serial_fd_receive;
- recv.close = (CloseFunc) serial_fd_close;
-
- s->receiver[0] = receiver[0];
-
- s->fdhandler = fdhandler_new( fd, list, &recv );
- s->in_len = 0;
- s->in_datalen = 0;
- s->in_channel = 0;
- s->in_packet = packet_alloc();
-}
-
-
-/** CLIENTS
- **/
-
-typedef struct Client Client;
-typedef struct Multiplexer Multiplexer;
-
-/* A Client object models a single qemud client socket
- * connection in the emulated system.
- *
- * the client first sends the name of the system service
- * it wants to contact (no framing), then waits for a 2
- * byte answer from qemud.
- *
- * the answer is either "OK" or "KO" to indicate
- * success or failure.
- *
- * In case of success, the client can send messages
- * to the service.
- *
- * In case of failure, it can disconnect or try sending
- * the name of another service.
- */
-struct Client {
- Client* next;
- Client** pref;
- int channel;
- char registered;
- FDHandler* fdhandler;
- Multiplexer* multiplexer;
-};
-
-struct Multiplexer {
- Client* clients;
- int last_channel;
- Serial serial[1];
- Looper looper[1];
- FDHandlerList fdhandlers[1];
-};
-
-
-static int multiplexer_open_channel( Multiplexer* mult, Packet* p );
-static void multiplexer_close_channel( Multiplexer* mult, int channel );
-static void multiplexer_serial_send( Multiplexer* mult, int channel, Packet* p );
-
-static void
-client_dump( Client* c, Packet* p, const char* funcname )
-{
- T("%s: client %p (%d): %3d bytes: '%s'",
- funcname, c, c->fdhandler->fd,
- p->len, quote(p->data, p->len));
-}
-
-/* destroy a client */
-static void
-client_free( Client* c )
-{
- /* remove from list */
- c->pref[0] = c->next;
- if (c->next)
- c->next->pref = c->pref;
-
- c->channel = -1;
- c->registered = 0;
-
- /* gently ask the FDHandler to shutdown to
- * avoid losing queued outgoing packets */
- if (c->fdhandler != NULL) {
- fdhandler_shutdown(c->fdhandler);
- c->fdhandler = NULL;
- }
-
- xfree(c);
-}
-
-
-/* a function called when a client socket receives data */
-static void
-client_fd_receive( Client* c, Packet* p )
-{
- client_dump(c, p, __FUNCTION__);
-
- if (c->registered) {
- /* the client is registered, just send the
- * data through the serial port
- */
- multiplexer_serial_send(c->multiplexer, c->channel, p);
- return;
- }
-
- if (c->channel > 0) {
- /* the client is waiting registration results.
- * this should not happen because the client
- * should wait for our 'ok' or 'ko'.
- * close the connection.
- */
- D("%s: bad client sending data before end of registration",
- __FUNCTION__);
- BAD_CLIENT:
- packet_free(&p);
- client_free(c);
- return;
- }
-
- /* the client hasn't registered a service yet,
- * so this must be the name of a service, call
- * the multiplexer to start registration for
- * it.
- */
- D("%s: attempting registration for service '%.*s'",
- __FUNCTION__, p->len, p->data);
- c->channel = multiplexer_open_channel(c->multiplexer, p);
- if (c->channel < 0) {
- D("%s: service name too long", __FUNCTION__);
- goto BAD_CLIENT;
- }
- D("%s: -> received channel id %d", __FUNCTION__, c->channel);
- packet_free(&p);
-}
-
-
-/* a function called when the client socket is closed. */
-static void
-client_fd_close( Client* c )
-{
- T("%s: client %p (%d)", __FUNCTION__, c, c->fdhandler->fd);
-
- /* no need to shutdown the FDHandler */
- c->fdhandler = NULL;
-
- /* tell the emulator we're out */
- if (c->channel > 0)
- multiplexer_close_channel(c->multiplexer, c->channel);
-
- /* free the client */
- client_free(c);
-}
-
-/* a function called when the multiplexer received a registration
- * response from the emulator for a given client.
- */
-static void
-client_registration( Client* c, int registered )
-{
- Packet* p = packet_alloc();
-
- /* sends registration status to client */
- if (!registered) {
- D("%s: registration failed for client %d", __FUNCTION__, c->channel);
- memcpy( p->data, "KO", 2 );
- p->len = 2;
- } else {
- D("%s: registration succeeded for client %d", __FUNCTION__, c->channel);
- memcpy( p->data, "OK", 2 );
- p->len = 2;
- }
- client_dump(c, p, __FUNCTION__);
- fdhandler_enqueue(c->fdhandler, p);
-
- /* now save registration state
- */
- c->registered = registered;
- if (!registered) {
- /* allow the client to try registering another service */
- c->channel = -1;
- }
-}
-
-/* send data to a client */
-static void
-client_send( Client* c, Packet* p )
-{
- client_dump(c, p, __FUNCTION__);
- fdhandler_enqueue(c->fdhandler, p);
-}
-
-
-/* Create new client socket handler */
-static Client*
-client_new( Multiplexer* mult,
- int fd,
- FDHandlerList* pfdhandlers,
- Client** pclients )
-{
- Client* c;
- Receiver recv;
-
- xnew(c);
-
- c->multiplexer = mult;
- c->next = NULL;
- c->pref = &c->next;
- c->channel = -1;
- c->registered = 0;
-
- recv.user = c;
- recv.post = (PostFunc) client_fd_receive;
- recv.close = (CloseFunc) client_fd_close;
-
- c->fdhandler = fdhandler_new( fd, pfdhandlers, &recv );
-
- /* add to client list */
- c->next = *pclients;
- c->pref = pclients;
- *pclients = c;
- if (c->next)
- c->next->pref = &c->next;
-
- return c;
-}
-
-/** GLOBAL MULTIPLEXER
- **/
-
-/* find a client by its channel */
-static Client*
-multiplexer_find_client( Multiplexer* mult, int channel )
-{
- Client* c = mult->clients;
-
- for ( ; c != NULL; c = c->next ) {
- if (c->channel == channel)
- return c;
- }
- return NULL;
-}
-
-/* handle control messages coming from the serial port
- * on CONTROL_CHANNEL.
- */
-static void
-multiplexer_handle_control( Multiplexer* mult, Packet* p )
-{
- /* connection registration success */
- if (p->len == 13 && !memcmp(p->data, "ok:connect:", 11)) {
- int channel = hex2int(p->data+11, 2);
- Client* client = multiplexer_find_client(mult, channel);
-
- /* note that 'client' can be NULL if the corresponding
- * socket was closed before the emulator response arrived.
- */
- if (client != NULL) {
- client_registration(client, 1);
- } else {
- D("%s: NULL client: '%.*s'", __FUNCTION__, p->len, p->data+11);
- }
- goto EXIT;
- }
-
- /* connection registration failure */
- if (p->len == 13 && !memcmp(p->data, "ko:connect:",11)) {
- int channel = hex2int(p->data+11, 2);
- Client* client = multiplexer_find_client(mult, channel);
-
- if (client != NULL)
- client_registration(client, 0);
-
- goto EXIT;
- }
-
- /* emulator-induced client disconnection */
- if (p->len == 13 && !memcmp(p->data, "disconnect:",11)) {
- int channel = hex2int(p->data+11, 2);
- Client* client = multiplexer_find_client(mult, channel);
-
- if (client != NULL)
- client_free(client);
-
- goto EXIT;
- }
-
- /* A message that begins with "X00" is a probe sent by
- * the emulator used to detect which version of qemud it runs
- * against (in order to detect 1.0/1.1 system images. Just
- * silently ignore it there instead of printing an error
- * message.
- */
- if (p->len >= 3 && !memcmp(p->data,"X00",3)) {
- goto EXIT;
- }
-
- D("%s: unknown control message (%d bytes): '%.*s'",
- __FUNCTION__, p->len, p->len, p->data);
-
-EXIT:
- packet_free(&p);
-}
-
-/* a function called when an incoming packet comes from the serial port */
-static void
-multiplexer_serial_receive( Multiplexer* mult, Packet* p )
-{
- Client* client;
-
- T("%s: channel=%d '%.*s'", __FUNCTION__, p->channel, p->len, p->data);
-
- if (p->channel == CHANNEL_CONTROL) {
- multiplexer_handle_control(mult, p);
- return;
- }
-
- client = multiplexer_find_client(mult, p->channel);
- if (client != NULL) {
- client_send(client, p);
- return;
- }
-
- D("%s: discarding packet for unknown channel %d", __FUNCTION__, p->channel);
- packet_free(&p);
-}
-
-/* a function called when the serial reader closes */
-static void
-multiplexer_serial_close( Multiplexer* mult )
-{
- fatal("unexpected close of serial reader");
-}
-
-/* a function called to send a packet to the serial port */
-static void
-multiplexer_serial_send( Multiplexer* mult, int channel, Packet* p )
-{
- p->channel = channel;
- serial_send( mult->serial, p );
-}
-
-
-
-/* a function used by a client to allocate a new channel id and
- * ask the emulator to open it. 'service' must be a packet containing
- * the name of the service in its payload.
- *
- * returns -1 if the service name is too long.
- *
- * notice that client_registration() will be called later when
- * the answer arrives.
- */
-static int
-multiplexer_open_channel( Multiplexer* mult, Packet* service )
-{
- Packet* p = packet_alloc();
- int len, channel;
-
- /* find a free channel number, assume we don't have many
- * clients here. */
- {
- Client* c;
- TRY_AGAIN:
- channel = (++mult->last_channel) & 0xff;
-
- for (c = mult->clients; c != NULL; c = c->next)
- if (c->channel == channel)
- goto TRY_AGAIN;
- }
-
- len = snprintf((char*)p->data, sizeof p->data, "connect:%.*s:%02x", service->len, service->data, channel);
- if (len >= (int)sizeof(p->data)) {
- D("%s: weird, service name too long (%d > %d)", __FUNCTION__, len, sizeof(p->data));
- packet_free(&p);
- return -1;
- }
- p->channel = CHANNEL_CONTROL;
- p->len = len;
-
- serial_send(mult->serial, p);
- return channel;
-}
-
-/* used to tell the emulator a channel was closed by a client */
-static void
-multiplexer_close_channel( Multiplexer* mult, int channel )
-{
- Packet* p = packet_alloc();
- int len = snprintf((char*)p->data, sizeof(p->data), "disconnect:%02x", channel);
-
- if (len > (int)sizeof(p->data)) {
- /* should not happen */
- return;
- }
-
- p->channel = CHANNEL_CONTROL;
- p->len = len;
-
- serial_send(mult->serial, p);
-}
-
-/* this function is used when a new connection happens on the control
- * socket.
- */
-static void
-multiplexer_control_accept( Multiplexer* m, Packet* p )
-{
- /* the file descriptor for the new socket connection is
- * in p->channel. See fdhandler_accept_event() */
- int fd = p->channel;
- Client* client = client_new( m, fd, m->fdhandlers, &m->clients );
-
- D("created client %p listening on fd %d", client, fd);
-
- /* free dummy packet */
- packet_free(&p);
-}
-
-static void
-multiplexer_control_close( Multiplexer* m )
-{
- fatal("unexpected multiplexer control close");
-}
-
-static void
-multiplexer_init( Multiplexer* m, const char* serial_dev )
-{
- int fd, control_fd;
- Receiver recv;
-
- /* initialize looper and fdhandlers list */
- looper_init( m->looper );
- fdhandler_list_init( m->fdhandlers, m->looper );
-
- /* open the serial port */
- do {
- fd = open(serial_dev, O_RDWR);
- } while (fd < 0 && errno == EINTR);
-
- if (fd < 0) {
- fatal( "%s: could not open '%s': %s", __FUNCTION__, serial_dev,
- strerror(errno) );
- }
- // disable echo on serial lines
- if ( !memcmp( serial_dev, "/dev/ttyS", 9 ) ) {
- struct termios ios;
- tcgetattr( fd, &ios );
- ios.c_lflag = 0; /* disable ECHO, ICANON, etc... */
- tcsetattr( fd, TCSANOW, &ios );
- }
-
- /* initialize the serial reader/writer */
- recv.user = m;
- recv.post = (PostFunc) multiplexer_serial_receive;
- recv.close = (CloseFunc) multiplexer_serial_close;
-
- serial_init( m->serial, fd, m->fdhandlers, &recv );
-
- /* open the qemud control socket */
- recv.user = m;
- recv.post = (PostFunc) multiplexer_control_accept;
- recv.close = (CloseFunc) multiplexer_control_close;
-
- fd = android_get_control_socket(CONTROL_SOCKET_NAME);
- if (fd < 0) {
- fatal("couldn't get fd for control socket '%s'", CONTROL_SOCKET_NAME);
- }
-
- fdhandler_new_accept( fd, m->fdhandlers, &recv );
-
- /* initialize clients list */
- m->clients = NULL;
-}
-
-/** MAIN LOOP
- **/
-
-static Multiplexer _multiplexer[1];
-
-int main( void )
-{
- Multiplexer* m = _multiplexer;
-
- /* extract the name of our serial device from the kernel
- * boot options that are stored in /proc/cmdline
- */
-#define KERNEL_OPTION "android.qemud="
-
- {
- char buff[1024];
- int fd, len;
- char* p;
- char* q;
-
- fd = open( "/proc/cmdline", O_RDONLY );
- if (fd < 0) {
- D("%s: can't open /proc/cmdline !!: %s", __FUNCTION__,
- strerror(errno));
- exit(1);
- }
-
- len = fd_read( fd, buff, sizeof(buff)-1 );
- close(fd);
- if (len < 0) {
- D("%s: can't read /proc/cmdline: %s", __FUNCTION__,
- strerror(errno));
- exit(1);
- }
- buff[len] = 0;
-
- p = strstr( buff, KERNEL_OPTION );
- if (p == NULL) {
- D("%s: can't find '%s' in /proc/cmdline",
- __FUNCTION__, KERNEL_OPTION );
- exit(1);
- }
-
- p += sizeof(KERNEL_OPTION)-1; /* skip option */
- q = p;
- while ( *q && *q != ' ' && *q != '\t' )
- q += 1;
-
- snprintf( buff, sizeof(buff), "/dev/%.*s", q-p, p );
-
- multiplexer_init( m, buff );
- }
-
- D( "entering main loop");
- looper_loop( m->looper );
- D( "unexpected termination !!" );
- return 0;
-}
diff --git a/tools/emulator/system/sensors/sensors_qemu.c b/tools/emulator/system/sensors/sensors_qemu.c
deleted file mode 100644
index d2c5aa565..000000000
--- a/tools/emulator/system/sensors/sensors_qemu.c
+++ /dev/null
@@ -1,637 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-/* this implements a sensors hardware library for the Android emulator.
- * the following code should be built as a shared library that will be
- * placed into /system/lib/hw/sensors.goldfish.so
- *
- * it will be loaded by the code in hardware/libhardware/hardware.c
- * which is itself called from com_android_server_SensorService.cpp
- */
-
-
-/* we connect with the emulator through the "sensors" qemud service
- */
-#define SENSORS_SERVICE_NAME "sensors"
-
-#define LOG_TAG "QemuSensors"
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <cutils/log.h>
-#include <cutils/native_handle.h>
-#include <cutils/sockets.h>
-#include <hardware/sensors.h>
-
-#if 0
-#define D(...) ALOGD(__VA_ARGS__)
-#else
-#define D(...) ((void)0)
-#endif
-
-#define E(...) ALOGE(__VA_ARGS__)
-
-#include <hardware/qemud.h>
-
-/** SENSOR IDS AND NAMES
- **/
-
-#define MAX_NUM_SENSORS 5
-
-#define SUPPORTED_SENSORS ((1<<MAX_NUM_SENSORS)-1)
-
-#define ID_BASE SENSORS_HANDLE_BASE
-#define ID_ACCELERATION (ID_BASE+0)
-#define ID_MAGNETIC_FIELD (ID_BASE+1)
-#define ID_ORIENTATION (ID_BASE+2)
-#define ID_TEMPERATURE (ID_BASE+3)
-#define ID_PROXIMITY (ID_BASE+4)
-
-#define SENSORS_ACCELERATION (1 << ID_ACCELERATION)
-#define SENSORS_MAGNETIC_FIELD (1 << ID_MAGNETIC_FIELD)
-#define SENSORS_ORIENTATION (1 << ID_ORIENTATION)
-#define SENSORS_TEMPERATURE (1 << ID_TEMPERATURE)
-#define SENSORS_PROXIMITY (1 << ID_PROXIMITY)
-
-#define ID_CHECK(x) ((unsigned)((x)-ID_BASE) < MAX_NUM_SENSORS)
-
-#define SENSORS_LIST \
- SENSOR_(ACCELERATION,"acceleration") \
- SENSOR_(MAGNETIC_FIELD,"magnetic-field") \
- SENSOR_(ORIENTATION,"orientation") \
- SENSOR_(TEMPERATURE,"temperature") \
- SENSOR_(PROXIMITY,"proximity") \
-
-static const struct {
- const char* name;
- int id; } _sensorIds[MAX_NUM_SENSORS] =
-{
-#define SENSOR_(x,y) { y, ID_##x },
- SENSORS_LIST
-#undef SENSOR_
-};
-
-static const char*
-_sensorIdToName( int id )
-{
- int nn;
- for (nn = 0; nn < MAX_NUM_SENSORS; nn++)
- if (id == _sensorIds[nn].id)
- return _sensorIds[nn].name;
- return "<UNKNOWN>";
-}
-
-static int
-_sensorIdFromName( const char* name )
-{
- int nn;
-
- if (name == NULL)
- return -1;
-
- for (nn = 0; nn < MAX_NUM_SENSORS; nn++)
- if (!strcmp(name, _sensorIds[nn].name))
- return _sensorIds[nn].id;
-
- return -1;
-}
-
-/** SENSORS POLL DEVICE
- **
- ** This one is used to read sensor data from the hardware.
- ** We implement this by simply reading the data from the
- ** emulator through the QEMUD channel.
- **/
-
-typedef struct SensorPoll {
- struct sensors_poll_device_t device;
- sensors_event_t sensors[MAX_NUM_SENSORS];
- int events_fd;
- uint32_t pendingSensors;
- int64_t timeStart;
- int64_t timeOffset;
- int fd;
- uint32_t active_sensors;
-} SensorPoll;
-
-/* this must return a file descriptor that will be used to read
- * the sensors data (it is passed to data__data_open() below
- */
-static native_handle_t*
-control__open_data_source(struct sensors_poll_device_t *dev)
-{
- SensorPoll* ctl = (void*)dev;
- native_handle_t* handle;
-
- if (ctl->fd < 0) {
- ctl->fd = qemud_channel_open(SENSORS_SERVICE_NAME);
- }
- D("%s: fd=%d", __FUNCTION__, ctl->fd);
- handle = native_handle_create(1, 0);
- handle->data[0] = dup(ctl->fd);
- return handle;
-}
-
-static int
-control__activate(struct sensors_poll_device_t *dev,
- int handle,
- int enabled)
-{
- SensorPoll* ctl = (void*)dev;
- uint32_t mask, sensors, active, new_sensors, changed;
- char command[128];
- int ret;
-
- D("%s: handle=%s (%d) fd=%d enabled=%d", __FUNCTION__,
- _sensorIdToName(handle), handle, ctl->fd, enabled);
-
- if (!ID_CHECK(handle)) {
- E("%s: bad handle ID", __FUNCTION__);
- return -1;
- }
-
- mask = (1<<handle);
- sensors = enabled ? mask : 0;
-
- active = ctl->active_sensors;
- new_sensors = (active & ~mask) | (sensors & mask);
- changed = active ^ new_sensors;
-
- if (!changed)
- return 0;
-
- snprintf(command, sizeof command, "set:%s:%d",
- _sensorIdToName(handle), enabled != 0);
-
- if (ctl->fd < 0) {
- ctl->fd = qemud_channel_open(SENSORS_SERVICE_NAME);
- }
-
- ret = qemud_channel_send(ctl->fd, command, -1);
- if (ret < 0) {
- E("%s: when sending command errno=%d: %s", __FUNCTION__, errno, strerror(errno));
- return -1;
- }
- ctl->active_sensors = new_sensors;
-
- return 0;
-}
-
-static int
-control__set_delay(struct sensors_poll_device_t *dev, int32_t ms)
-{
- SensorPoll* ctl = (void*)dev;
- char command[128];
-
- D("%s: dev=%p delay-ms=%d", __FUNCTION__, dev, ms);
-
- snprintf(command, sizeof command, "set-delay:%d", ms);
-
- return qemud_channel_send(ctl->fd, command, -1);
-}
-
-static int
-control__close(struct hw_device_t *dev)
-{
- SensorPoll* ctl = (void*)dev;
- close(ctl->fd);
- free(ctl);
- return 0;
-}
-
-/* return the current time in nanoseconds */
-static int64_t
-data__now_ns(void)
-{
- struct timespec ts;
-
- clock_gettime(CLOCK_MONOTONIC, &ts);
-
- return (int64_t)ts.tv_sec * 1000000000 + ts.tv_nsec;
-}
-
-static int
-data__data_open(struct sensors_poll_device_t *dev, native_handle_t* handle)
-{
- SensorPoll* data = (void*)dev;
- int i;
- D("%s: dev=%p fd=%d", __FUNCTION__, dev, handle->data[0]);
- memset(&data->sensors, 0, sizeof(data->sensors));
-
- for (i=0 ; i<MAX_NUM_SENSORS ; i++) {
- data->sensors[i].acceleration.status = SENSOR_STATUS_ACCURACY_HIGH;
- }
- data->pendingSensors = 0;
- data->timeStart = 0;
- data->timeOffset = 0;
-
- data->events_fd = dup(handle->data[0]);
- D("%s: dev=%p fd=%d (was %d)", __FUNCTION__, dev, data->events_fd, handle->data[0]);
- native_handle_close(handle);
- native_handle_delete(handle);
- return 0;
-}
-
-static int
-data__data_close(struct sensors_poll_device_t *dev)
-{
- SensorPoll* data = (void*)dev;
- D("%s: dev=%p", __FUNCTION__, dev);
- if (data->events_fd >= 0) {
- close(data->events_fd);
- data->events_fd = -1;
- }
- return 0;
-}
-
-static int
-pick_sensor(SensorPoll* data,
- sensors_event_t* values)
-{
- uint32_t mask = SUPPORTED_SENSORS;
- while (mask) {
- uint32_t i = 31 - __builtin_clz(mask);
- mask &= ~(1<<i);
- if (data->pendingSensors & (1<<i)) {
- data->pendingSensors &= ~(1<<i);
- *values = data->sensors[i];
- values->sensor = i;
- values->version = sizeof(*values);
-
- D("%s: %d [%f, %f, %f]", __FUNCTION__,
- i,
- values->data[0],
- values->data[1],
- values->data[2]);
- return i;
- }
- }
- ALOGE("No sensor to return!!! pendingSensors=%08x", data->pendingSensors);
- // we may end-up in a busy loop, slow things down, just in case.
- usleep(100000);
- return -EINVAL;
-}
-
-static int
-data__poll(struct sensors_poll_device_t *dev, sensors_event_t* values)
-{
- SensorPoll* data = (void*)dev;
- int fd = data->events_fd;
-
- D("%s: data=%p", __FUNCTION__, dev);
-
- // there are pending sensors, returns them now...
- if (data->pendingSensors) {
- return pick_sensor(data, values);
- }
-
- // wait until we get a complete event for an enabled sensor
- uint32_t new_sensors = 0;
-
- while (1) {
- /* read the next event */
- char buff[256];
- int len = qemud_channel_recv(data->events_fd, buff, sizeof buff-1);
- float params[3];
- int64_t event_time;
-
- if (len < 0) {
- E("%s: len=%d, errno=%d: %s", __FUNCTION__, len, errno, strerror(errno));
- return -errno;
- }
-
- buff[len] = 0;
-
- /* "wake" is sent from the emulator to exit this loop. */
- if (!strcmp((const char*)data, "wake")) {
- return 0x7FFFFFFF;
- }
-
- /* "acceleration:<x>:<y>:<z>" corresponds to an acceleration event */
- if (sscanf(buff, "acceleration:%g:%g:%g", params+0, params+1, params+2) == 3) {
- new_sensors |= SENSORS_ACCELERATION;
- data->sensors[ID_ACCELERATION].acceleration.x = params[0];
- data->sensors[ID_ACCELERATION].acceleration.y = params[1];
- data->sensors[ID_ACCELERATION].acceleration.z = params[2];
- continue;
- }
-
- /* "orientation:<azimuth>:<pitch>:<roll>" is sent when orientation changes */
- if (sscanf(buff, "orientation:%g:%g:%g", params+0, params+1, params+2) == 3) {
- new_sensors |= SENSORS_ORIENTATION;
- data->sensors[ID_ORIENTATION].orientation.azimuth = params[0];
- data->sensors[ID_ORIENTATION].orientation.pitch = params[1];
- data->sensors[ID_ORIENTATION].orientation.roll = params[2];
- continue;
- }
-
- /* "magnetic:<x>:<y>:<z>" is sent for the params of the magnetic field */
- if (sscanf(buff, "magnetic:%g:%g:%g", params+0, params+1, params+2) == 3) {
- new_sensors |= SENSORS_MAGNETIC_FIELD;
- data->sensors[ID_MAGNETIC_FIELD].magnetic.x = params[0];
- data->sensors[ID_MAGNETIC_FIELD].magnetic.y = params[1];
- data->sensors[ID_MAGNETIC_FIELD].magnetic.z = params[2];
- continue;
- }
-
- /* "temperature:<celsius>" */
- if (sscanf(buff, "temperature:%g", params+0) == 1) {
- new_sensors |= SENSORS_TEMPERATURE;
- data->sensors[ID_TEMPERATURE].temperature = params[0];
- continue;
- }
-
- /* "proximity:<value>" */
- if (sscanf(buff, "proximity:%g", params+0) == 1) {
- new_sensors |= SENSORS_PROXIMITY;
- data->sensors[ID_PROXIMITY].distance = params[0];
- continue;
- }
-
- /* "sync:<time>" is sent after a series of sensor events.
- * where 'time' is expressed in micro-seconds and corresponds
- * to the VM time when the real poll occured.
- */
- if (sscanf(buff, "sync:%lld", &event_time) == 1) {
- if (new_sensors) {
- data->pendingSensors = new_sensors;
- int64_t t = event_time * 1000LL; /* convert to nano-seconds */
-
- /* use the time at the first sync: as the base for later
- * time values */
- if (data->timeStart == 0) {
- data->timeStart = data__now_ns();
- data->timeOffset = data->timeStart - t;
- }
- t += data->timeOffset;
-
- while (new_sensors) {
- uint32_t i = 31 - __builtin_clz(new_sensors);
- new_sensors &= ~(1<<i);
- data->sensors[i].timestamp = t;
- }
- return pick_sensor(data, values);
- } else {
- D("huh ? sync without any sensor data ?");
- }
- continue;
- }
- D("huh ? unsupported command");
- }
- return -1;
-}
-
-static int
-data__close(struct hw_device_t *dev)
-{
- SensorPoll* data = (SensorPoll*)dev;
- if (data) {
- if (data->events_fd >= 0) {
- //ALOGD("(device close) about to close fd=%d", data->events_fd);
- close(data->events_fd);
- }
- free(data);
- }
- return 0;
-}
-
-/** SENSORS POLL DEVICE FUNCTIONS **/
-
-static int poll__close(struct hw_device_t* dev)
-{
- SensorPoll* ctl = (void*)dev;
- close(ctl->fd);
- if (ctl->fd >= 0) {
- close(ctl->fd);
- }
- if (ctl->events_fd >= 0) {
- close(ctl->events_fd);
- }
- free(ctl);
- return 0;
-}
-
-static int poll__poll(struct sensors_poll_device_t *dev,
- sensors_event_t* data, int count)
-{
- SensorPoll* datadev = (void*)dev;
- int ret;
- int i;
- D("%s: dev=%p data=%p count=%d ", __FUNCTION__, dev, data, count);
-
- for (i = 0; i < count; i++) {
- ret = data__poll(dev, data);
- data++;
- if (ret > MAX_NUM_SENSORS || ret < 0) {
- return i;
- }
- if (!datadev->pendingSensors) {
- return i + 1;
- }
- }
- return count;
-}
-
-static int poll__activate(struct sensors_poll_device_t *dev,
- int handle, int enabled)
-{
- int ret;
- native_handle_t* hdl;
- SensorPoll* ctl = (void*)dev;
- D("%s: dev=%p handle=%x enable=%d ", __FUNCTION__, dev, handle, enabled);
- if (ctl->fd < 0) {
- D("%s: OPEN CTRL and DATA ", __FUNCTION__);
- hdl = control__open_data_source(dev);
- ret = data__data_open(dev,hdl);
- }
- ret = control__activate(dev, handle, enabled);
- return ret;
-}
-
-static int poll__setDelay(struct sensors_poll_device_t *dev,
- int handle, int64_t ns)
-{
- // TODO
- return 0;
-}
-
-/** MODULE REGISTRATION SUPPORT
- **
- ** This is required so that hardware/libhardware/hardware.c
- ** will dlopen() this library appropriately.
- **/
-
-/*
- * the following is the list of all supported sensors.
- * this table is used to build sSensorList declared below
- * according to which hardware sensors are reported as
- * available from the emulator (see get_sensors_list below)
- *
- * note: numerical values for maxRange/resolution/power were
- * taken from the reference AK8976A implementation
- */
-static const struct sensor_t sSensorListInit[] = {
- { .name = "Goldfish 3-axis Accelerometer",
- .vendor = "The Android Open Source Project",
- .version = 1,
- .handle = ID_ACCELERATION,
- .type = SENSOR_TYPE_ACCELEROMETER,
- .maxRange = 2.8f,
- .resolution = 1.0f/4032.0f,
- .power = 3.0f,
- .reserved = {}
- },
-
- { .name = "Goldfish 3-axis Magnetic field sensor",
- .vendor = "The Android Open Source Project",
- .version = 1,
- .handle = ID_MAGNETIC_FIELD,
- .type = SENSOR_TYPE_MAGNETIC_FIELD,
- .maxRange = 2000.0f,
- .resolution = 1.0f,
- .power = 6.7f,
- .reserved = {}
- },
-
- { .name = "Goldfish Orientation sensor",
- .vendor = "The Android Open Source Project",
- .version = 1,
- .handle = ID_ORIENTATION,
- .type = SENSOR_TYPE_ORIENTATION,
- .maxRange = 360.0f,
- .resolution = 1.0f,
- .power = 9.7f,
- .reserved = {}
- },
-
- { .name = "Goldfish Temperature sensor",
- .vendor = "The Android Open Source Project",
- .version = 1,
- .handle = ID_TEMPERATURE,
- .type = SENSOR_TYPE_TEMPERATURE,
- .maxRange = 80.0f,
- .resolution = 1.0f,
- .power = 0.0f,
- .reserved = {}
- },
-
- { .name = "Goldfish Proximity sensor",
- .vendor = "The Android Open Source Project",
- .version = 1,
- .handle = ID_PROXIMITY,
- .type = SENSOR_TYPE_PROXIMITY,
- .maxRange = 1.0f,
- .resolution = 1.0f,
- .power = 20.0f,
- .reserved = {}
- },
-};
-
-static struct sensor_t sSensorList[MAX_NUM_SENSORS];
-
-static int sensors__get_sensors_list(struct sensors_module_t* module,
- struct sensor_t const** list)
-{
- int fd = qemud_channel_open(SENSORS_SERVICE_NAME);
- char buffer[12];
- int mask, nn, count;
-
- int ret;
- if (fd < 0) {
- E("%s: no qemud connection", __FUNCTION__);
- return 0;
- }
- ret = qemud_channel_send(fd, "list-sensors", -1);
- if (ret < 0) {
- E("%s: could not query sensor list: %s", __FUNCTION__,
- strerror(errno));
- close(fd);
- return 0;
- }
- ret = qemud_channel_recv(fd, buffer, sizeof buffer-1);
- if (ret < 0) {
- E("%s: could not receive sensor list: %s", __FUNCTION__,
- strerror(errno));
- close(fd);
- return 0;
- }
- buffer[ret] = 0;
- close(fd);
-
- /* the result is a integer used as a mask for available sensors */
- mask = atoi(buffer);
- count = 0;
- for (nn = 0; nn < MAX_NUM_SENSORS; nn++) {
- if (((1 << nn) & mask) == 0)
- continue;
-
- sSensorList[count++] = sSensorListInit[nn];
- }
- D("%s: returned %d sensors (mask=%d)", __FUNCTION__, count, mask);
- *list = sSensorList;
- return count;
-}
-
-
-static int
-open_sensors(const struct hw_module_t* module,
- const char* name,
- struct hw_device_t* *device)
-{
- int status = -EINVAL;
-
- D("%s: name=%s", __FUNCTION__, name);
-
- if (!strcmp(name, SENSORS_HARDWARE_POLL)) {
- SensorPoll *dev = malloc(sizeof(*dev));
-
- memset(dev, 0, sizeof(*dev));
-
- dev->device.common.tag = HARDWARE_DEVICE_TAG;
- dev->device.common.version = 0;
- dev->device.common.module = (struct hw_module_t*) module;
- dev->device.common.close = poll__close;
- dev->device.poll = poll__poll;
- dev->device.activate = poll__activate;
- dev->device.setDelay = poll__setDelay;
- dev->events_fd = -1;
- dev->fd = -1;
-
- *device = &dev->device.common;
- status = 0;
- }
- return status;
-}
-
-
-static struct hw_module_methods_t sensors_module_methods = {
- .open = open_sensors
-};
-
-struct sensors_module_t HAL_MODULE_INFO_SYM = {
- .common = {
- .tag = HARDWARE_MODULE_TAG,
- .version_major = 1,
- .version_minor = 0,
- .id = SENSORS_HARDWARE_MODULE_ID,
- .name = "Goldfish SENSORS Module",
- .author = "The Android Open Source Project",
- .methods = &sensors_module_methods,
- },
- .get_sensors_list = sensors__get_sensors_list
-};
diff --git a/tools/idegen/Android.mk b/tools/idegen/Android.mk
index e76e5b483..d424ab6be 100644
--- a/tools/idegen/Android.mk
+++ b/tools/idegen/Android.mk
@@ -2,6 +2,9 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ guavalib \
+
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_MODULE:= idegen
diff --git a/tools/idegen/index-gen.sh b/tools/idegen/index-gen.sh
new file mode 100755
index 000000000..eadaa98e5
--- /dev/null
+++ b/tools/idegen/index-gen.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+#
+# 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.
+#
+# Generates a module index file by searching through android source tree for make files. The
+# intellij-gen.sh script automatically calls this script the first time or if you delete the
+# generated indexed file. The only time you need to run this manually is if modules are added or
+# deleted.
+#
+# To use:
+# index-gen.sh
+#
+# Only tested on linux. Should work for macs but have not tried.
+#
+set -e
+
+script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+root_dir=`readlink -f -n $script_dir/../../..`
+tmp_file=tmp.txt
+dest_file=module-index.txt
+
+echo "Generating index file $dest_file..."
+start=$(($(date +%s%N) / 1000000))
+find $root_dir -name '*.mk' \( ! -path "$root_dir/build*" -prune \) \
+ \( -exec grep -H '^LOCAL_PACKAGE_NAME ' {} \; \
+ -false -o -exec grep -H '^LOCAL_MODULE ' {} \; \) \
+ > $tmp_file
+sed -e 's/LOCAL_PACKAGE_NAME *:= *//g' -e 's/LOCAL_MODULE *:= *//g' -e 's/\^M*$//g' < $tmp_file > $dest_file
+
+mv $dest_file $tmp_file
+# Exclude specific directories from index here.
+# TODO: make excludes more generic and configurable
+grep -v "^$root_dir/vendor/google" $tmp_file > $dest_file
+
+rm $tmp_file
+end=$(($(date +%s%N) / 1000000))
+elapse=$(($end - $start))
+echo "Took ${elapse}ms"
diff --git a/tools/idegen/intellij-gen.sh b/tools/idegen/intellij-gen.sh
new file mode 100755
index 000000000..7f00eba06
--- /dev/null
+++ b/tools/idegen/intellij-gen.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+#
+# 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.
+#
+# To use:
+# intellij-gen.sh <module name>
+#
+# where module name is the LOCAL_PACKAGE_NAME in Android.mk for the project.
+#
+# For example, to generate a project for Contacts, use:
+# intellij-gen.sh Contacts
+#
+# The project directory (.idea) will be put in the root directory of the module. Sharable iml
+# files will be put into each respective module directory.
+#
+# Only tested on linux. Should work for macs but have not tried.
+#
+set -e
+
+script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+root_dir=`readlink -f -n $script_dir/../../..`
+index_file=$script_dir/module-index.txt
+idegenjar=$root_dir/out/host/common/obj/JAVA_LIBRARIES/idegen_intermediates/javalib.jar
+
+progname=`basename $0`
+if [ $# -ne 1 ]
+then
+ echo "Usage: $progname <module_name>"
+ exit 1
+fi
+
+module_name=$1
+
+if [ ! -e "$index_file" ]; then
+ echo "Module index file missing; generating this is only done the first time."
+ echo "If any dependencies change, you should generate a new index file by running index-gen.sh."
+ $script_dir/index-gen.sh
+fi
+
+echo "Checking for $idegenjar"
+if [ -e "$idegenjar" ]; then
+ echo "Generating project files for $module_name"
+ cmd="java -cp $idegenjar com.android.idegen.IntellijProject $index_file $module_name"
+ echo $cmd
+ $cmd
+else
+ echo "Couldn't find idegen.jar. Please run make first."
+fi
diff --git a/tools/idegen/src/com/android/idegen/AggregatedModule.java b/tools/idegen/src/com/android/idegen/AggregatedModule.java
new file mode 100644
index 000000000..1497da711
--- /dev/null
+++ b/tools/idegen/src/com/android/idegen/AggregatedModule.java
@@ -0,0 +1,132 @@
+/*
+ * 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.idegen;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Logger;
+
+/**
+ * Module while is a composition of many other modules.
+ * <p>
+ * This is needed since intellij does not allow two modules to share the same content root.
+ */
+public class AggregatedModule extends Module {
+
+ private static final Logger logger = Logger.getLogger(AggregatedModule.class.getName());
+
+ private String aggregatedModuleName;
+ private Set<Module> modules;
+ private HashSet<String> directDependencies = Sets.newHashSet();
+
+ public AggregatedModule(String aggregatedName, Set<Module> modules) {
+ this.aggregatedModuleName = Preconditions.checkNotNull(aggregatedName);
+ this.modules = Preconditions.checkNotNull(modules);
+ }
+
+ public void build() throws IOException {
+ // Create an iml file that contains all the srcs of modules.
+ buildDependentModules();
+ buildDirectDependencies();
+ //buildImlFile();
+ }
+
+ @Override
+ protected File getDir() {
+ // All modules should be in the same directory so just pull the first.
+ return modules.iterator().next().getDir();
+ }
+
+ @Override
+ protected boolean isAndroidModule() {
+ for (Module module : modules) {
+ if (module.isAndroidModule()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected List<File> getIntermediatesDirs() {
+ List<File> result = Lists.newArrayList();
+ for (Module module : modules) {
+ Iterables.addAll(result, module.getIntermediatesDirs());
+ }
+ return result;
+ }
+
+ public void buildDirectDependencies() {
+ for (Module module : modules) {
+ Set<String> deps = module.getDirectDependencies();
+ directDependencies.addAll(deps);
+ }
+ }
+
+ @Override
+ public Set<String> getDirectDependencies() {
+ return directDependencies;
+ }
+
+ @Override
+ protected ImmutableList<File> getSourceDirs() {
+ ImmutableList.Builder<File> builder = ImmutableList.builder();
+ for (Module module : modules) {
+ builder.addAll(module.getSourceDirs());
+ }
+ return builder.build();
+ }
+
+
+ @Override
+ protected ImmutableList<File> getExcludeDirs() {
+ ImmutableList.Builder<File> builder = ImmutableList.builder();
+ for (Module module : modules) {
+ builder.addAll(module.getExcludeDirs());
+ }
+ return builder.build();
+ }
+
+ @Override
+ public Set<File> getAllDependentImlFiles() {
+ Set<File> result = Sets.newHashSet();
+ for (Module module : modules) {
+ result.addAll(module.getAllDependentImlFiles());
+ }
+ return result;
+ }
+
+ @Override
+ public File getRepoRoot() {
+ return modules.iterator().next().getRepoRoot();
+ }
+
+ @Override
+ public String getName() {
+ return aggregatedModuleName;
+ }
+
+}
diff --git a/tools/idegen/src/com/android/idegen/Constants.java b/tools/idegen/src/com/android/idegen/Constants.java
new file mode 100644
index 000000000..f541dd48d
--- /dev/null
+++ b/tools/idegen/src/com/android/idegen/Constants.java
@@ -0,0 +1,46 @@
+/*
+ * 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.idegen;
+
+import java.nio.charset.Charset;
+
+/**
+ * Constants
+ */
+public class Constants {
+
+ public static final Charset CHARSET = Charset.forName("UTF-8");
+
+ public static final String REL_TEMPLATE_DIR = "development/tools/idegen/templates";
+ public static final String REL_MODULES_TEMPLATE = REL_TEMPLATE_DIR + "/idea/modules.xml";
+ public static final String REL_VCS_TEMPLATE = REL_TEMPLATE_DIR + "/idea/vcs.xml";
+ public static final String REL_IML_TEMPLATE = REL_TEMPLATE_DIR + "/module-template.iml";
+
+ public static final String REL_OUT_APP_DIR = "out/target/common/obj/APPS";
+
+ public static final String FRAMEWORK_MODULE = "framework";
+ public static final String[] AUTO_DEPENDENCIES = new String[]{
+ FRAMEWORK_MODULE, "libcore"
+ };
+ public static final String[] DIRS_WITH_AUTO_DEPENDENCIES = new String[] {
+ "packages", "vendor", "frameworks/ex", "frameworks/opt", "frameworks/support"
+ };
+
+ // Framework needs a special constant for it's intermediates because it does not follow
+ // normal conventions.
+ public static final String FRAMEWORK_INTERMEDIATES = "framework-res_intermediates";
+}
diff --git a/tools/idegen/src/com/android/idegen/DirectorySearch.java b/tools/idegen/src/com/android/idegen/DirectorySearch.java
new file mode 100644
index 000000000..1bbf99ff8
--- /dev/null
+++ b/tools/idegen/src/com/android/idegen/DirectorySearch.java
@@ -0,0 +1,141 @@
+/*
+ * 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.idegen;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Sets;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.HashSet;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Find directories utility.
+ */
+public class DirectorySearch {
+
+ private static final HashSet<String> SOURCE_DIRS = Sets.newHashSet();
+ static {
+ SOURCE_DIRS.add("src");
+ SOURCE_DIRS.add("java");
+ }
+
+ private static final Pattern EXCLUDE_PATTERN = Pattern.compile("values-..(-.*)*");
+
+ private static File repoRoot = null;
+
+ /**
+ * Find the repo root. This is the root branch directory of a full repo checkout.
+ *
+ * @param file any file inside the root.
+ * @return the root directory.
+ */
+ public static File findRepoRoot(File file) {
+ Preconditions.checkNotNull(file);
+ if (repoRoot != null) {
+ return repoRoot;
+ }
+
+ if (file.isDirectory()) {
+ File[] files = file.listFiles(new FilenameFilter() {
+ @Override
+ public boolean accept(File dir, String name) {
+ if (".repo".equals(name)) {
+ return true;
+ }
+ return false;
+ }
+ });
+ if (files.length > 0) {
+ repoRoot = file;
+ return file;
+ }
+ }
+ File parent = file.getParentFile();
+ if (parent == null) {
+ return null;
+ }
+ return findRepoRoot(parent);
+ }
+
+ /**
+ * Find all source directories from a given root file.
+ *
+ * If the root file is a file, the directory of that file will be used as the starting
+ * location.
+ *
+ * @param file The starting location. Can be a file or directory.
+ * @return List of
+ */
+ public static ImmutableList<File> findSourceDirs(File file) {
+ Preconditions.checkNotNull(file);
+ if (!file.exists()) {
+ return ImmutableList.of();
+ }
+ if (!file.isDirectory()) {
+ file = file.getParentFile();
+ }
+ ImmutableList.Builder<File> builder = ImmutableList.builder();
+ File[] children = file.listFiles();
+ for (File child : children) {
+ if (child.isDirectory()) {
+ if (SOURCE_DIRS.contains(child.getName())) {
+ builder.add(child);
+ } else {
+ ImmutableList<File> dirs = findSourceDirs(child);
+ builder.addAll(dirs);
+ }
+ }
+ }
+
+ return builder.build();
+ }
+
+ public static ImmutableList<File> findExcludeDirs(File file) {
+ Preconditions.checkNotNull(file);
+ if (!file.exists()) {
+ return ImmutableList.of();
+ }
+ if (!file.isDirectory()) {
+ file = file.getParentFile();
+ }
+ ImmutableList.Builder<File> builder = ImmutableList.builder();
+ // Go into the res folder
+ File resFile = new File(file, "res");
+ if (resFile.exists()) {
+
+ File[] children = resFile.listFiles();
+ for (File child : children) {
+ if (child.isDirectory()) {
+ Matcher matcher = EXCLUDE_PATTERN.matcher(child.getName());
+ if (matcher.matches()) {
+ // Exclude internationalization language folders.
+ // ex: values-zh
+ // But don't exclude values-land. Assume all language folders are two
+ // letters.
+ builder.add(child);
+ }
+ }
+ }
+ }
+
+ return builder.build();
+ }
+}
diff --git a/tools/idegen/src/com/android/idegen/FrameworkModule.java b/tools/idegen/src/com/android/idegen/FrameworkModule.java
new file mode 100644
index 000000000..bfcd1fab3
--- /dev/null
+++ b/tools/idegen/src/com/android/idegen/FrameworkModule.java
@@ -0,0 +1,46 @@
+/*
+ * 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.idegen;
+
+import com.google.common.collect.ImmutableList;
+
+import java.io.File;
+
+/**
+ * Special module used for framework to build one off resource directory.
+ */
+public class FrameworkModule extends StandardModule {
+
+ public FrameworkModule(String moduleName, String makeFile) {
+ super(Constants.FRAMEWORK_MODULE, makeFile, true);
+ }
+
+ @Override
+ protected String buildIntermediates() {
+ StringBuilder sb = new StringBuilder();
+ File intermediates = new File(repoRoot,
+ Constants.REL_OUT_APP_DIR + File.separator + Constants.FRAMEWORK_INTERMEDIATES);
+ ImmutableList<File> intermediateSrcDirs = DirectorySearch.findSourceDirs(intermediates);
+ sb.append(" <content url=\"file://").append(intermediates).append("\">\n");
+ for (File src : intermediateSrcDirs) {
+ sb.append(" <sourceFolder url=\"file://")
+ .append(src.getAbsolutePath()).append("\" isTestSource=\"false\" />\n");
+ }
+ sb.append(" </content>\n");
+ return sb.toString();
+ }
+}
diff --git a/tools/idegen/src/com/android/idegen/IntellijProject.java b/tools/idegen/src/com/android/idegen/IntellijProject.java
new file mode 100644
index 000000000..d5564d599
--- /dev/null
+++ b/tools/idegen/src/com/android/idegen/IntellijProject.java
@@ -0,0 +1,195 @@
+/*
+ * 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.idegen;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Sets;
+import com.google.common.io.Files;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Set;
+import java.util.logging.Logger;
+
+/**
+ * Build Intellij projects.
+ */
+public class IntellijProject {
+
+ private static final Logger logger = Logger.getLogger(IntellijProject.class.getName());
+
+ ModuleCache cache = ModuleCache.getInstance();
+ File indexFile;
+ File repoRoot;
+ File projectIdeaDir;
+ String moduleName;
+
+ public IntellijProject(String indexFile, String moduleName) {
+ this.indexFile = new File(Preconditions.checkNotNull(indexFile));
+ this.moduleName = Preconditions.checkNotNull(moduleName);
+ }
+
+ private void init() throws IOException {
+ repoRoot = DirectorySearch.findRepoRoot(indexFile);
+ cache.init(indexFile);
+ }
+
+ public void build() throws IOException {
+ init();
+ buildFrameWorkModule();
+
+ // First pass, find all dependencies and cache them.
+ Module module = cache.getAndCache(moduleName);
+ projectIdeaDir = new File(module.getDir(), ".idea");
+ projectIdeaDir.mkdir();
+ copyTemplates();
+
+ // Second phase, build aggregate modules.
+ Set<String> deps = module.getAllDependencies();
+ for (String dep : deps) {
+ cache.buildAndCacheAggregatedModule(dep);
+ }
+
+ // Third phase, replace individual modules with aggregated modules
+ Iterable<Module> modules = cache.getModules();
+ for (Module mod : modules) {
+ replaceWithAggregate(mod);
+ }
+
+ // Finally create iml files for dependencies
+ for (Module mod : modules) {
+ mod.buildImlFile();
+ }
+
+ createModulesFile(module);
+ createVcsFile(module);
+ createNameFile(moduleName);
+ }
+
+ private void replaceWithAggregate(Module module) {
+ replaceWithAggregate(module.getDirectDependencies(), module.getName());
+ replaceWithAggregate(module.getAllDependencies(), module.getName());
+
+ }
+
+ private void replaceWithAggregate(Set<String> deps, String moduleName) {
+ for (String dep : Sets.newHashSet(deps)) {
+ String replacement = cache.getAggregateReplacementName(dep);
+ if (replacement != null) {
+
+ deps.remove(dep);
+ // There could be dependencies on self due to aggregation.
+ // Only add if the replacement is not self.
+ if (!replacement.equals(moduleName)) {
+ deps.add(replacement);
+ }
+ }
+ }
+ }
+
+ /**
+ * Framework module needs special handling due to one off resource path:
+ * frameworks/base/Android.mk
+ */
+ private void buildFrameWorkModule() throws IOException {
+ String makeFile = cache.getMakeFile(Constants.FRAMEWORK_MODULE);
+ logger.info("makefile: " + makeFile);
+ StandardModule frameworkModule = new FrameworkModule(Constants.FRAMEWORK_MODULE, makeFile);
+ frameworkModule.build();
+ cache.put(frameworkModule);
+ }
+
+ private void createModulesFile(Module module) throws IOException {
+ String modulesContent = Files.toString(new File(repoRoot, Constants.REL_MODULES_TEMPLATE),
+ Constants.CHARSET);
+ StringBuilder sb = new StringBuilder();
+ File moduleIml = module.getImlFile();
+ sb.append(" <module fileurl=\"file://").append(moduleIml.getAbsolutePath())
+ .append("\" filepath=\"").append(moduleIml.getAbsolutePath()).append("\" />\n");
+ for (String name : module.getAllDependencies()) {
+ Module mod = cache.getAndCache(name);
+ File iml = mod.getImlFile();
+ sb.append(" <module fileurl=\"file://").append(iml.getAbsolutePath())
+ .append("\" filepath=\"").append(iml.getAbsolutePath()).append("\" />\n");
+ }
+ modulesContent = modulesContent.replace("@MODULES@", sb.toString());
+
+ File out = new File(projectIdeaDir, "modules.xml");
+ logger.info("Creating " + out.getAbsolutePath());
+ Files.write(modulesContent, out, Constants.CHARSET);
+ }
+
+ private void createVcsFile(Module module) throws IOException {
+ String vcsTemplate = Files.toString(new File(module.getRepoRoot(),
+ Constants.REL_VCS_TEMPLATE), Constants.CHARSET);
+
+ StringBuilder sb = new StringBuilder();
+ for (String name : module.getAllDependencies()) {
+ Module mod = cache.getAndCache(name);
+ File dir = mod.getDir();
+ File gitRoot = new File(dir, ".git");
+ if (gitRoot.exists()) {
+ sb.append(" <mapping directory=\"").append(dir.getAbsolutePath())
+ .append("\" vcs=\"Git\" />\n");
+ }
+ }
+ vcsTemplate = vcsTemplate.replace("@VCS@", sb.toString());
+ Files.write(vcsTemplate, new File(projectIdeaDir, "vcs.xml"), Constants.CHARSET);
+ }
+
+ private void createNameFile(String name) throws IOException {
+ File out = new File(projectIdeaDir, ".name");
+ Files.write(name, out, Constants.CHARSET);
+ }
+
+ private void copyTemplates() throws IOException {
+ File templateDir = new File(repoRoot,
+ Constants.REL_TEMPLATE_DIR + File.separatorChar + "idea");
+ copyTemplates(templateDir, projectIdeaDir);
+ }
+
+ private void copyTemplates(File fromDir, File toDir) throws IOException {
+ toDir.mkdir();
+ File[] files = fromDir.listFiles();
+ for (File file : files) {
+ if (file.isDirectory()) {
+ File destDir = new File(toDir, file.getName());
+ copyTemplates(file, destDir);
+ } else {
+ File toFile = new File(toDir, file.getName());
+ logger.info("copying " + file.getAbsolutePath() + " to " +
+ toFile.getAbsolutePath());
+ Files.copy(file, toFile);
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ logger.info("Args: " + Arrays.toString(args));
+
+ String indexFile = args[0];
+ String module = args[1];
+
+ IntellijProject intellij = new IntellijProject(indexFile, module);
+ try {
+ intellij.build();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/tools/idegen/src/com/android/idegen/MakeFileParser.java b/tools/idegen/src/com/android/idegen/MakeFileParser.java
new file mode 100644
index 000000000..3594d5020
--- /dev/null
+++ b/tools/idegen/src/com/android/idegen/MakeFileParser.java
@@ -0,0 +1,233 @@
+/*
+ * 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.idegen;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Splitter;
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.io.Files;
+import com.google.common.io.LineProcessor;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.logging.Logger;
+
+/**
+ * Parses the make files and finds the appropriate section a given module.
+ */
+public class MakeFileParser {
+
+ private static final Logger logger = Logger.getLogger(MakeFileParser.class.getName());
+ public static final String VALUE_DELIMITER = "|";
+
+ private enum State {
+ NEW, CONTINUE
+ }
+ private enum ModuleNameKey {
+ LOCAL_PACKAGE_NAME,
+ LOCAL_MODULE
+ };
+
+ private File makeFile;
+ private String moduleName;
+ private HashMap<String, String> values;
+
+ /**
+ * Create a parser for a given make file and module name.
+ * <p>
+ * A make file may contain multiple modules.
+ *
+ * @param makeFile The make file to parse.
+ * @param moduleName The module to extract.
+ */
+ public MakeFileParser(File makeFile, String moduleName) {
+ this.makeFile = Preconditions.checkNotNull(makeFile);
+ this.moduleName = Preconditions.checkNotNull(moduleName);
+ }
+
+ public Iterable<String> getValues(String key) {
+ String str = values.get(key);
+ if (str == null) {
+ return null;
+ }
+ return Splitter.on(VALUE_DELIMITER)
+ .trimResults()
+ .omitEmptyStrings()
+ .split(str);
+ }
+
+ /**
+ * Extracts the relevant portion of the make file and converts into key value pairs.
+ * <p>
+ * Since each make file may contain multiple build targets (modules), this method will determine
+ * which part is the correct portion for the given module name.
+ *
+ * @throws IOException
+ */
+ public void parse() throws IOException {
+ values = Maps.newHashMap();
+ logger.info("Parsing " + makeFile.getAbsolutePath() + " for module " + moduleName);
+
+ Files.readLines(makeFile, Charset.forName("UTF-8"), new LineProcessor<Object>() {
+
+ private String key;
+
+ private State state = State.NEW;
+
+ @Override
+ public boolean processLine(String line) throws IOException {
+ String trimmed = line.trim();
+ if (Strings.isNullOrEmpty(trimmed)) {
+ state = State.NEW;
+ return true;
+ }
+ if (trimmed.equals("include $(CLEAR_VARS)")) {
+ // See if we are in the right module.
+ if (moduleName.equals(getModuleName())) {
+ return false;
+ } else {
+ values.clear();
+ }
+ } else {
+ switch (state) {
+ case NEW:
+ trimmed = checkContinue(trimmed);
+ if (trimmed.contains("=")) {
+ String[] arr;
+ if (trimmed.contains(":")) {
+ arr = trimmed.split(":=");
+ } else {
+ arr = trimmed.split("\\+=");
+ }
+ if (arr.length > 2) {
+ logger.info("Malformed line " + line);
+ } else {
+ // Store the key in case the line continues
+ this.key = arr[0].trim();
+ if (arr.length == 2) {
+ // There may be multiple values on one line.
+ List<String> valuesArr = tokenizeValue(arr[1].trim());
+ for (String value : valuesArr) {
+ appendValue(this.key, value);
+ }
+
+ }
+ }
+ } else {
+ //logger.info("Skipping line " + line);
+ }
+ break;
+ case CONTINUE:
+ // append
+ trimmed = checkContinue(trimmed);
+ appendValue(key, trimmed);
+ break;
+ default:
+
+ }
+ }
+ return true;
+ }
+
+ private List<String> tokenizeValue(String value) {
+ // Value may contain function calls such as "$(call all-java-files-under)".
+ // Tokens are separated by spaces unless it's between parens.
+ StringBuilder token = new StringBuilder();
+ ArrayList<String> tokens = Lists.newArrayList();
+ int parenCount = 0;
+ for (int i = 0; i < value.length(); i++) {
+ char ch = value.charAt(i);
+ if (parenCount == 0 && ch == ' ') {
+ // Not in a paren and delimiter encountered.
+ // end token
+ if (token.length() > 0) {
+ tokens.add(token.toString());
+ token = new StringBuilder();
+ }
+ } else {
+ token.append(ch);
+ }
+ if (ch == '(') {
+ parenCount++;
+ } else if (ch == ')') {
+ parenCount--;
+ }
+ }
+ // end of line check
+ if (token.length() > 0) {
+ tokens.add(token.toString());
+ }
+ return tokens;
+ }
+
+ private String getModuleName() {
+ for (ModuleNameKey key : ModuleNameKey.values()) {
+ String name = values.get(key.name());
+ if (name != null) {
+ return name;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Object getResult() {
+ return null;
+ }
+
+ private String checkContinue(String value) {
+ // Check for continuation character
+ if (value.charAt(value.length() - 1) == '\\') {
+ state = State.CONTINUE;
+ return value.substring(0, value.length() - 1);
+ }
+ state = State.NEW;
+ return value;
+ }
+
+ /**
+ * Add a value to the hash map. If the key already exists, will append instead of
+ * over-writing the existing value.
+ *
+ * @param key The hashmap key
+ * @param newValue The value to append.
+ */
+ private void appendValue(String key, String newValue) {
+ String value = values.get(key);
+ if (value == null) {
+ values.put(key, newValue);
+ } else {
+ values.put(key, value + VALUE_DELIMITER + newValue);
+ }
+ }
+ });
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("values", values)
+ .toString();
+ }
+}
diff --git a/tools/idegen/src/com/android/idegen/Module.java b/tools/idegen/src/com/android/idegen/Module.java
new file mode 100644
index 000000000..7ba42a3f4
--- /dev/null
+++ b/tools/idegen/src/com/android/idegen/Module.java
@@ -0,0 +1,198 @@
+/*
+ * 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.idegen;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Sets;
+import com.google.common.io.Files;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Logger;
+
+/**
+ * Super class for all modules.
+ */
+public abstract class Module {
+
+ private static final Logger logger = Logger.getLogger(Module.class.getName());
+
+ /**
+ * All possible attributes for the make file.
+ */
+ protected enum Key {
+ LOCAL_STATIC_JAVA_LIBRARIES,
+ LOCAL_JAVA_LIBRARIES,
+ LOCAL_SRC_FILES
+ }
+
+ ModuleCache moduleCache = ModuleCache.getInstance();
+ private File imlFile;
+ private Set<String> allDependencies = Sets.newHashSet(); // direct + indirect
+ private Set<File> allDependentImlFiles = Sets.newHashSet();
+
+ protected abstract void build() throws IOException;
+ protected abstract String getName();
+ protected abstract File getDir();
+ protected abstract boolean isAndroidModule();
+ protected abstract List<File> getIntermediatesDirs();
+ public abstract Set<String> getDirectDependencies();
+ protected abstract ImmutableList<File> getSourceDirs();
+ protected abstract ImmutableList<File> getExcludeDirs();
+ public abstract File getRepoRoot();
+
+ public void buildImlFile() throws IOException {
+ String imlTemplate = Files.toString(new File(getRepoRoot(), Constants.REL_IML_TEMPLATE),
+ Constants.CHARSET);
+
+ String facetXml = "";
+ if (isAndroidModule()) {
+ facetXml = buildAndroidFacet();
+ }
+ imlTemplate = imlTemplate.replace("@FACETS@", facetXml);
+
+ String moduleDir = getDir().getAbsolutePath();
+
+ StringBuilder sourceDirectories = new StringBuilder();
+ sourceDirectories.append(" <content url=\"file://$MODULE_DIR$\">\n");
+ ImmutableList<File> srcDirs = getSourceDirs();
+ for (File src : srcDirs) {
+ String relative = src.getAbsolutePath().substring(moduleDir.length());
+ sourceDirectories.append(" <sourceFolder url=\"file://$MODULE_DIR$")
+ .append(relative).append("\" isTestSource=\"false\" />\n");
+ }
+ ImmutableList<File> excludeDirs = getExcludeDirs();
+ for (File src : excludeDirs) {
+ String relative = src.getAbsolutePath().substring(moduleDir.length());
+ sourceDirectories.append(" <excludeFolder url=\"file://$MODULE_DIR$")
+ .append(relative).append("\"/>\n");
+ }
+ sourceDirectories.append(" </content>\n");
+
+ // Intermediates.
+ sourceDirectories.append(buildIntermediates());
+
+ imlTemplate = imlTemplate.replace("@SOURCES@", sourceDirectories.toString());
+
+ StringBuilder moduleDependencies = new StringBuilder();
+ for (String dependency : getDirectDependencies()) {
+ moduleDependencies.append(" <orderEntry type=\"module\" module-name=\"")
+ .append(dependency).append("\" />\n");
+ }
+ imlTemplate = imlTemplate.replace("@MODULE_DEPENDENCIES@", moduleDependencies.toString());
+
+ imlFile = new File(moduleDir, getName() + ".iml");
+ logger.info("Creating " + imlFile.getAbsolutePath());
+ Files.write(imlTemplate, imlFile, Constants.CHARSET);
+ }
+
+ protected String buildIntermediates() {
+ StringBuilder sb = new StringBuilder();
+ for (File intermediatesDir : getIntermediatesDirs()) {
+ sb.append(" <content url=\"file://").append(intermediatesDir).append("\">\n");
+ sb.append(" <sourceFolder url=\"file://")
+ .append(intermediatesDir.getAbsolutePath())
+ .append("\" isTestSource=\"false\" />\n");
+ sb.append(" </content>\n");
+ }
+ return sb.toString();
+ }
+
+ protected void buildDependentModules() throws IOException {
+ Set<String> directDependencies = getDirectDependencies();
+ String[] copy = directDependencies.toArray(new String[directDependencies.size()]);
+ for (String dependency : copy) {
+
+ Module child = moduleCache.getAndCache(dependency);
+ if (child == null) {
+ directDependencies.remove(dependency);
+ } else {
+ addAllDependencies(dependency);
+ addAllDependencies(child.getAllDependencies());
+ //logger.info("Adding iml " + child.getName() + " " + child.getImlFile());
+ allDependentImlFiles.add(child.getImlFile());
+ allDependentImlFiles.addAll(child.getAllDependentImlFiles());
+ }
+ }
+ }
+
+ public File getImlFile() {
+ return imlFile;
+ }
+
+ public Set<String> getAllDependencies() {
+ return allDependencies;
+ }
+
+ public void addAllDependencies(String dependency) {
+ this.allDependencies.add(dependency);
+ }
+
+ public void addAllDependencies(Set<String> dependencies) {
+ this.allDependencies.addAll(dependencies);
+ }
+
+ public Set<File> getAllDependentImlFiles() {
+ return allDependentImlFiles;
+ }
+
+ private String buildAndroidFacet() {
+ // Not sure how to handle android facet for multi-module since there could be more than
+ // one intermediates directory.
+ String dir = getIntermediatesDirs().get(0).getAbsolutePath();
+ String xml = ""
+ + " <component name=\"FacetManager\">\n"
+ + " <facet type=\"android\" name=\"Android\">\n"
+ + " <configuration>\n"
+ + " <option name=\"GEN_FOLDER_RELATIVE_PATH_APT\" value=\"" + dir + "\" />\n"
+ + " <option name=\"GEN_FOLDER_RELATIVE_PATH_AIDL\" value=\"" + dir
+ + "\" />\n"
+ + " <option name=\"MANIFEST_FILE_RELATIVE_PATH\" value=\""
+ + "/AndroidManifest.xml\" />\n"
+ + " <option name=\"RES_FOLDER_RELATIVE_PATH\" value=\"/res\" />\n"
+ + " <option name=\"ASSETS_FOLDER_RELATIVE_PATH\" value=\"/assets\" />\n"
+ + " <option name=\"LIBS_FOLDER_RELATIVE_PATH\" value=\"/libs\" />\n"
+ + " <option name=\"REGENERATE_R_JAVA\" value=\"true\" />\n"
+ + " <option name=\"REGENERATE_JAVA_BY_AIDL\" value=\"true\" />\n"
+ + " <option name=\"USE_CUSTOM_APK_RESOURCE_FOLDER\" value=\"false\" />\n"
+ + " <option name=\"CUSTOM_APK_RESOURCE_FOLDER\" value=\"\" />\n"
+ + " <option name=\"USE_CUSTOM_COMPILER_MANIFEST\" value=\"false\" />\n"
+ + " <option name=\"CUSTOM_COMPILER_MANIFEST\" value=\"\" />\n"
+ + " <option name=\"APK_PATH\" value=\"\" />\n"
+ + " <option name=\"LIBRARY_PROJECT\" value=\"false\" />\n"
+ + " <option name=\"RUN_PROCESS_RESOURCES_MAVEN_TASK\" value=\"true\" />\n"
+ + " <option name=\"GENERATE_UNSIGNED_APK\" value=\"false\" />\n"
+ + " </configuration>\n"
+ + " </facet>\n"
+ + " </component>\n";
+ return xml;
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(Module.class)
+ .add("name", getName())
+ .add("allDependencies", allDependencies)
+ .add("iml files", allDependentImlFiles)
+ .add("imlFile", imlFile)
+ .toString();
+ }
+}
+
diff --git a/tools/idegen/src/com/android/idegen/ModuleCache.java b/tools/idegen/src/com/android/idegen/ModuleCache.java
new file mode 100644
index 000000000..093242a02
--- /dev/null
+++ b/tools/idegen/src/com/android/idegen/ModuleCache.java
@@ -0,0 +1,107 @@
+/*
+ * 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.idegen;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.logging.Logger;
+
+/**
+ * Cache to hold built modules.
+ */
+public class ModuleCache {
+
+ private static final Logger logger = Logger.getLogger(ModuleCache.class.getName());
+
+ private static ModuleCache cache = new ModuleCache();
+
+ ModuleIndexes indexes;
+
+ HashMap<String, Module> modulesByName = Maps.newHashMap();
+
+ private ModuleCache() {
+ }
+
+ public static ModuleCache getInstance() {
+ return cache;
+ }
+
+ public void init(File indexFile) throws IOException {
+ indexes = new ModuleIndexes(indexFile);
+ indexes.build();
+ }
+
+ public Module getAndCache(String moduleName) throws IOException {
+ Preconditions.checkState(indexes != null, "You must call init() first.");
+
+ Module module = modulesByName.get(moduleName);
+ if (module == null) {
+ String makeFile = indexes.getMakeFile(moduleName);
+ if (makeFile == null) {
+ logger.warning("Unable to find make file for module: " + moduleName);
+ } else {
+ module = new StandardModule(moduleName, makeFile);
+ module.build();
+ modulesByName.put(moduleName, module);
+ }
+ }
+ return module;
+ }
+
+ public void buildAndCacheAggregatedModule(String moduleName) throws IOException {
+ if (indexes.isPartOfAggregatedModule(moduleName)) {
+ Set<String> moduleNames = indexes.getAggregatedModules(moduleName);
+ Set<Module> modules = Sets.newHashSet();
+ for (String name : moduleNames) {
+ Module m = modulesByName.get(name);
+ if (m != null) {
+ modules.add(m);
+ }
+ }
+ String aggregatedName = indexes.getAggregateName(moduleName);
+ AggregatedModule module = new AggregatedModule(aggregatedName, modules);
+ module.build();
+ modulesByName.put(aggregatedName, module);
+ }
+ }
+
+ public Iterable<Module> getModules() {
+ return modulesByName.values();
+ }
+
+ public String getMakeFile(String moduleName) {
+ return indexes.getMakeFile(moduleName);
+ }
+
+ public void put(StandardModule module) {
+ Preconditions.checkNotNull(module);
+ modulesByName.put(module.getName(), module);
+ }
+
+ public String getAggregateReplacementName(String moduleName) {
+ if (indexes.isPartOfAggregatedModule(moduleName)) {
+ return indexes.getAggregateName(moduleName);
+ }
+ return null;
+ }
+}
diff --git a/tools/idegen/src/com/android/idegen/ModuleIndexes.java b/tools/idegen/src/com/android/idegen/ModuleIndexes.java
new file mode 100644
index 000000000..890389f26
--- /dev/null
+++ b/tools/idegen/src/com/android/idegen/ModuleIndexes.java
@@ -0,0 +1,122 @@
+/*
+ * 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.idegen;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+import com.google.common.io.Files;
+import com.google.common.io.LineProcessor;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Mapping of module names to make files.
+ */
+public class ModuleIndexes {
+
+ private static final Logger logger = Logger.getLogger(ModuleIndexes.class.getName());
+
+ private File indexFile;
+ private HashMap<String, String> moduleNameToMakeFileMap;
+ private HashMap<String, Set<String>> makeFileToModuleNamesMap;
+
+ public ModuleIndexes(File indexFile) {
+ this.indexFile = indexFile;
+ }
+
+ public void build() throws IOException {
+
+ moduleNameToMakeFileMap = Maps.newHashMap();
+ makeFileToModuleNamesMap = Maps.newHashMap();
+ logger.info("Building index from " + indexFile.getAbsolutePath());
+ Files.readLines(indexFile, Charset.forName("UTF-8"),
+ new LineProcessor<Object>() {
+ int count = 0;
+
+ @Override
+ public boolean processLine(String line) throws IOException {
+ count++;
+ String[] arr = line.split(":");
+ if (arr.length < 2) {
+ logger.log(Level.WARNING,
+ "Ignoring index line " + count + ". Bad format: " + line);
+ } else {
+ String makeFile = arr[0];
+ String moduleName = arr[1];
+ moduleNameToMakeFileMap.put(moduleName, makeFile);
+ append(makeFile, moduleName);
+ }
+ return true;
+ }
+
+ @Override
+ public Object getResult() {
+ return null;
+ }
+ });
+ }
+
+ private void append(String makeFile, String moduleName) {
+ Set<String> moduleNames = makeFileToModuleNamesMap.get(makeFile);
+ if (moduleNames == null) {
+ moduleNames = Sets.newHashSet();
+ makeFileToModuleNamesMap.put(makeFile, moduleNames);
+ } else {
+ // Create a aggregate module place holder.
+ //moduleNameToMakeFileMap.put(getAggregateName(moduleName), makeFile);
+ }
+ moduleNames.add(moduleName);
+ }
+
+ public String getMakeFile(String moduleName) {
+ Preconditions.checkState(moduleNameToMakeFileMap != null,
+ "Index not built. Call build() first.");
+ return moduleNameToMakeFileMap.get(moduleName);
+ }
+
+ public Set<String> getAggregatedModules(String moduleName) {
+ Preconditions.checkState(makeFileToModuleNamesMap != null,
+ "Index not built. Call build() first.");
+ String makeFile = getMakeFile(moduleName);
+ return makeFileToModuleNamesMap.get(makeFile);
+ }
+
+ public boolean isPartOfAggregatedModule(String moduleName) {
+ String makeFile = getMakeFile(moduleName);
+ if (makeFile == null) {
+ return false;
+ }
+ Set<String> moduleNames = makeFileToModuleNamesMap.get(makeFile);
+ if (moduleNames == null) {
+ return false;
+ }
+ return moduleNames.size() > 1;
+ }
+
+ public String getAggregateName(String moduleName) {
+ String fileName = getMakeFile(moduleName);
+ File file = new File(fileName);
+ return file.getParentFile().getName() + "-aggregate";
+ }
+}
diff --git a/tools/idegen/src/com/android/idegen/StandardModule.java b/tools/idegen/src/com/android/idegen/StandardModule.java
new file mode 100644
index 000000000..dffb95e01
--- /dev/null
+++ b/tools/idegen/src/com/android/idegen/StandardModule.java
@@ -0,0 +1,215 @@
+/*
+ * 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.idegen;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Module constructed from a make file.
+ *
+ * TODO: read the make file and understand included source dirs in addition to searching
+ * sub-directories. Make files can include sources that are not sub-directories. For example,
+ * the framework module includes sources from:
+ *
+ * external/libphonenumber/java/src
+ *
+ * to provide:
+ *
+ * com.android.i18n.phonenumbers.PhoneNumberUtil;
+ */
+public class StandardModule extends Module {
+
+ private static final Logger logger = Logger.getLogger(StandardModule.class.getName());
+
+ private static final Pattern SRC_PATTERN = Pattern.compile(
+ ".*\\(call all-java-files-under, (.*)\\)");
+
+ String moduleName;
+ File makeFile;
+ File moduleRoot;
+ File repoRoot;
+
+ Set<String> directDependencies = Sets.newHashSet();
+
+ File intermediatesDir;
+ MakeFileParser makeFileParser;
+ boolean searchForSrc;
+
+ public StandardModule(String moduleName, String makeFile) {
+ this(moduleName, new File(makeFile), false);
+ }
+
+ public StandardModule(String moduleName, String makeFile, boolean searchForSrc) {
+ this(moduleName, new File(makeFile), searchForSrc);
+ }
+
+ public StandardModule(String moduleName, File makeFile, boolean searchForSrc) {
+ this.moduleName = moduleName;
+ this.makeFile = makeFile;
+ this.moduleRoot = makeFile.getParentFile();
+ this.repoRoot = DirectorySearch.findRepoRoot(makeFile);
+ this.intermediatesDir = new File(repoRoot.getAbsolutePath() + File.separator +
+ Constants.REL_OUT_APP_DIR + File.separator + getName() + "_intermediates" +
+ File.separator + "src");
+ this.searchForSrc = searchForSrc;
+
+ // TODO: auto-detect when framework dependency is needed instead of using coded list.
+ for (String dir : Constants.DIRS_WITH_AUTO_DEPENDENCIES) {
+ // length + 2 to account for slash
+ boolean isDir = makeFile.getAbsolutePath().startsWith(repoRoot + "/" + dir);
+ if (isDir) {
+ for (String dependency : Constants.AUTO_DEPENDENCIES) {
+ this.directDependencies.add(dependency);
+ }
+ }
+ }
+
+ makeFileParser = new MakeFileParser(makeFile, moduleName);
+ }
+
+ protected void build() throws IOException {
+ makeFileParser.parse();
+ buildDependencyList();
+ buildDependentModules();
+ //buildImlFile();
+ logger.info("Done building module " + moduleName);
+ logger.info(toString());
+ }
+
+ @Override
+ protected File getDir() {
+ return moduleRoot;
+ }
+
+ @Override
+ protected String getName() {
+ return moduleName;
+ }
+
+ @Override
+ protected List<File> getIntermediatesDirs() {
+ return Lists.newArrayList(intermediatesDir);
+ }
+
+ @Override
+ public File getRepoRoot() {
+ return this.repoRoot;
+ }
+
+ public Set<String> getDirectDependencies() {
+ return this.directDependencies;
+ }
+
+ @Override
+ protected ImmutableList<File> getSourceDirs() {
+ ImmutableList<File> srcDirs;
+ if (searchForSrc) {
+ srcDirs = DirectorySearch.findSourceDirs(makeFile);
+ } else {
+ srcDirs = parseSourceFiles(makeFile);
+ }
+ return srcDirs;
+ }
+
+ @Override
+ protected ImmutableList<File> getExcludeDirs() {
+ return DirectorySearch.findExcludeDirs(makeFile);
+ }
+
+ @Override
+ protected boolean isAndroidModule() {
+ File manifest = new File(moduleRoot, "AndroidManifest.xml");
+ return manifest.exists();
+ }
+
+ private ImmutableList<File> parseSourceFiles(File root) {
+ ImmutableList.Builder<File> builder = ImmutableList.builder();
+ File rootDir;
+ if (root.isFile()) {
+ rootDir = root.getParentFile();
+ } else {
+ rootDir = root;
+ }
+
+ Iterable<String> values = makeFileParser.getValues(Key.LOCAL_SRC_FILES.name());
+ if (values != null) {
+ for (String value : values) {
+ Matcher matcher = SRC_PATTERN.matcher(value);
+ if (matcher.matches()) {
+ String dir = matcher.group(1);
+ builder.add(new File(rootDir, dir));
+ } else if (value.contains("/")) {
+ // Treat as individual file.
+ builder.add(new File(rootDir, value));
+ }
+ }
+ }
+ return builder.build();
+ }
+
+ private void buildDependencyList() {
+ parseDirectDependencies(Key.LOCAL_STATIC_JAVA_LIBRARIES);
+ parseDirectDependencies(Key.LOCAL_JAVA_LIBRARIES);
+ }
+
+ private void parseDirectDependencies(Key key) {
+ Iterable<String> names = makeFileParser.getValues(key.name());
+ if (names != null) {
+ for (String dependency : names) {
+ directDependencies.add(dependency);
+ }
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(getName());
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+ StandardModule other = (StandardModule) obj;
+ return Objects.equal(getName(), other.getName());
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("super", super.toString())
+ .add("makeFileParser", makeFileParser)
+ .add("directDependencies", Iterables.toString(directDependencies))
+ .toString();
+ }
+}
diff --git a/tools/idegen/templates/idea/compiler.xml b/tools/idegen/templates/idea/compiler.xml
new file mode 100644
index 000000000..9d29283f0
--- /dev/null
+++ b/tools/idegen/templates/idea/compiler.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="CompilerConfiguration">
+ <option name="DEFAULT_COMPILER" value="Javac" />
+ <resourceExtensions />
+ <wildcardResourcePatterns>
+ <entry name="?*.properties" />
+ <entry name="?*.xml" />
+ <entry name="?*.gif" />
+ <entry name="?*.png" />
+ <entry name="?*.jpeg" />
+ <entry name="?*.jpg" />
+ <entry name="?*.html" />
+ <entry name="?*.dtd" />
+ <entry name="?*.tld" />
+ <entry name="?*.ftl" />
+ </wildcardResourcePatterns>
+ <annotationProcessing enabled="false" useClasspath="true" />
+ </component>
+ <component name="JavacSettings">
+ <option name="MAXIMUM_HEAP_SIZE" value="1024" />
+ </component>
+</project>
diff --git a/tools/idegen/templates/idea/copyright/Apache_2.xml b/tools/idegen/templates/idea/copyright/Apache_2.xml
new file mode 100644
index 000000000..fd0c79bd2
--- /dev/null
+++ b/tools/idegen/templates/idea/copyright/Apache_2.xml
@@ -0,0 +1,9 @@
+<component name="CopyrightManager">
+ <copyright>
+ <option name="notice" value="Copyright (C) &amp;#36;today.year The Android Open Source Project&#10;&#10;Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&#10;you may not use this file except in compliance with the License.&#10;You may obtain a copy of the License at&#10;&#10; http://www.apache.org/licenses/LICENSE-2.0&#10;&#10;Unless required by applicable law or agreed to in writing, software&#10;distributed under the License is distributed on an &quot;AS IS&quot; BASIS,&#10;WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&#10;See the License for the specific language governing permissions and&#10;limitations under the License" />
+ <option name="keyword" value="Copyright" />
+ <option name="allowReplaceKeyword" value="" />
+ <option name="myName" value="Apache 2" />
+ <option name="myLocal" value="true" />
+ </copyright>
+</component> \ No newline at end of file
diff --git a/tools/idegen/templates/idea/copyright/profiles_settings.xml b/tools/idegen/templates/idea/copyright/profiles_settings.xml
new file mode 100644
index 000000000..7a6be8d0c
--- /dev/null
+++ b/tools/idegen/templates/idea/copyright/profiles_settings.xml
@@ -0,0 +1,7 @@
+<component name="CopyrightManager">
+ <settings default="">
+ <module2copyright>
+ <element module="Project Files" copyright="Apache 2" />
+ </module2copyright>
+ </settings>
+</component> \ No newline at end of file
diff --git a/tools/idegen/templates/idea/misc.xml b/tools/idegen/templates/idea/misc.xml
new file mode 100644
index 000000000..d3edec05e
--- /dev/null
+++ b/tools/idegen/templates/idea/misc.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ConfigCheckProjectState">
+ <option name="disabledCheckers">
+ <list>
+ <option value="com.google.devtools.intellig.configcheck.JavacHeapChecker" />
+ <option value="com.google.devtools.intellig.configcheck.VcsMappingsChecker" />
+ </list>
+ </option>
+ </component>
+ <component name="ContinuousBuildConfigurationComponent">
+ <builds>
+ <build intervalToCheckBuild="1" buildKey="" buildLabel="" enabled="false" tapBuild="false" />
+ </builds>
+ </component>
+ <component name="DependencyValidationManager">
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </component>
+ <component name="EntryPointsManager">
+ <entry_points version="2.0" />
+ </component>
+ <component name="JavadocGenerationManager">
+ <option name="OUTPUT_DIRECTORY" />
+ <option name="OPTION_SCOPE" value="protected" />
+ <option name="OPTION_HIERARCHY" value="true" />
+ <option name="OPTION_NAVIGATOR" value="true" />
+ <option name="OPTION_INDEX" value="true" />
+ <option name="OPTION_SEPARATE_INDEX" value="true" />
+ <option name="OPTION_DOCUMENT_TAG_USE" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
+ <option name="OPTION_DEPRECATED_LIST" value="true" />
+ <option name="OTHER_OPTIONS" value="" />
+ <option name="HEAP_SIZE" />
+ <option name="LOCALE" />
+ <option name="OPEN_IN_BROWSER" value="true" />
+ </component>
+ <component name="Mach LOCAL_PREFIX stripper" stripping="true" />
+ <component name="ProjectResources">
+ <default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
+ </component>
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK" />
+ <component name="WebServicesPlugin" addRequiredLibraries="true" />
+</project>
+
diff --git a/tools/idegen/templates/idea/modules.xml b/tools/idegen/templates/idea/modules.xml
new file mode 100644
index 000000000..588cc09da
--- /dev/null
+++ b/tools/idegen/templates/idea/modules.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectModuleManager">
+ <modules>
+@MODULES@
+ </modules>
+ </component>
+</project>
+
diff --git a/tools/idegen/templates/idea/vcs.xml b/tools/idegen/templates/idea/vcs.xml
new file mode 100644
index 000000000..176af35f3
--- /dev/null
+++ b/tools/idegen/templates/idea/vcs.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="Git" />
+@VCS@
+ </component>
+</project>
diff --git a/tools/idegen/templates/module-template.iml b/tools/idegen/templates/module-template.iml
new file mode 100644
index 000000000..02301f742
--- /dev/null
+++ b/tools/idegen/templates/module-template.iml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+@FACETS@
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+@SOURCES@
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+@MODULE_DEPENDENCIES@
+ </component>
+</module>
+