Changes in Samsung Android APIs

[Android] Sep 20, 2011

 

About This Article

This article provides information about the changes made in the Samsung Android API’s. All the changes made in the Samsung Android API’s are explained in detail with sample code snippets. Android application developers can use this article as reference for implementing the new changes in the Samsung Android API’s.

Scope

This article is intended for Android developers wishing to develop mobile applications. It assumes basic knowledge of Android and Java programming languages. This article provides information about the changes made in the Samsung Android API’s.

Introduction

This article provides information about the changes made in the Samsung Android API’s. All the changes made in the Samsung Android API’s are explained in detail with sample code snippets. Android application developers can use this article as reference for implementing the new changes in the Samsung Android API’s.

Android API Differences Report

There are some new functionalities and improvements delivered with the Samsung Galaxy S II Android API. One of them is a new package:

android.os.storage. It provides functionalities related to the system storage service. It comes with two new classes: StorageManager and OnObbStateChangeListener. The first one is an interface to handle storage-related items like Opaque Binary Blobs (OBB). The second one is listener for receiving notifications from StorageManager about OBB file states.

More information related to android.os.storage is available on the following website:

http://developer.android.com/reference/android/os/storage/StorageManager.html

New Android APIs come with some deprecations in class structures.

Deprecation of New Android APIs in class structures
Class Deprecated field/function name
android.Manifest.permission PERSISTENT_ACTIVITY
android.R.drawable stat_sys_phone_call
android.R.drawable stat_sys_phone_call_forward
android.R.drawable stat_sys_phone_call_on_hold
android.R.drawable stat_sys_vp_phone_call
android.R.drawable stat_sys_vp_phone_call_on_hold
android.app.Activity setPersistent()
android.content.AbstractThreadedSyncAdapter LOG_SYNC_DETAILS
android.hardware.Camera.Parameters getPreviewFrameRate()
android.hardware.Camera.Parameters getSupportedPreviewFrameRates()
android.hardware.Camera.Parameters setPreviewFrameRate()
android.provider.ContactsContract.CommonDataKinds.Nickname TYPE_MAINDEN_NAME
android.text.format.DateUtils FORMAT_UTC
android.webkit.WebSettings getPluginsPath()
android.webkit.WebSettings setPluginsPath()
java.io.File toURL()
java.util.logging.Logger global

More information related to class structure changes are available on the following website:

http://developer.android.com/sdk/api_diff/9/changes.html

New API version provides also many gaming improvements. New Dalvik garbage collector, faster event distribution and new versions of third-party video drivers increase performance of applications. Input and sensors events can now be passed directly to application native code, which also significantly increases efficiency. Some new sensors i.e. gyroscope are now supported. Khronos OpenSL ES (audio) and Khronos EGL (graphics) libraries were implemented. There is also new type of Activity class, called NativeActivity. Applications can now use Asset Manager. There is also Android NDK 2.3 release, designed for native code developers. VP8 and WebM formats support, AAC and AMR encoding are now offered.

More information related to API level 9 highlights is available on the following website:

http://developer.android.com/sdk/android-2.3-highlights.html

Issues on various hardware, software differences

Table 1: OpenGL ES 2.0 Extensions list:
OpenGL ES2.0 API version Galaxy S Galaxy S II
API v8 Android 2.2 GL_OES_rgb8_rgba8
GL_OES_depth24
GL_OES_vertex_half_float
GL_OES_texture_float
GL_OES_texture_half_float
GL_OES_element_index_uint
GL_OES_mapbuffer
GL_OES_fragment_precision_high
GL_OES_compressed_ETC1_RGB8_texture
GL_OES_EGL_image
GL_OES_required_internalformat
GL_OES_depth_texture
GL_OES_get_program_binary
GL_OES_packed_depth_stencil
GL_OES_standard_derivatives
GL_OES_vertex_array_object
GL_EXT_multi_draw_arrays
GL_EXT_texture_format_BGRA8888
GL_EXT_discard_framebuffer
GL_IMG_shader_binary
GL_IMG_texture_compression_pvrtc
GL_IMG_texture_stream2
GL_IMG_texture_npot
GL_IMG_texture_format_BGRA8888
GL_IMG_read_format
GL_IMG_program_binary
X
API v10 Android 2.3.3 GL_OES_rgb8_rgba8
GL_OES_depth24
GL_OES_vertex_half_float
GL_OES_texture_float
GL_OES_texture_half_float
GL_OES_element_index_uint
GL_OES_mapbuffer
GL_OES_fragment_precision_high
GL_OES_compressed_ETC1_RGB8_texture
GL_OES_EGL_image
GL_OES_required_internalformat
GL_OES_depth_texture
GL_OES_get_program_binary
GL_OES_packed_depth_stencil
GL_OES_standard_derivatives
GL_OES_vertex_array_object
GL_OES_egl_sync
GL_EXT_multi_draw_arrays
GL_EXT_texture_format_BGRA8888
GL_EXT_discard_framebuffer
GL_EXT_shader_texture_lod
GL_IMG_shader_binary
GL_IMG_texture_compression_pvrtc
GL_IMG_texture_stream2
GL_IMG_texture_npot
GL_IMG_texture_format_BGRA8888
GL_IMG_read_format
GL_IMG_program_binary
GL_IMG_multisampled_render_to_texture
GL_OES_texture_npot
GL_OES_compressed_ETC1_RGB8_texture
GL_OES_standard_derivatives
GL_OES_EGL_image
GL_OES_depth24
GL_ARM_rgba8
GL_ARM_mali_shader_binary
GL_OES_depth_texture
GL_OES_packed_depth_stencil

Table 1: OpenGL ES 2.0 Extensions list:

The Samsung Galaxy S II hardware supports only some of the extensions mentioned in table 1.

Given below are the supported extensions.

Common extensions that can be used in API 8/10 and Samsung Galaxy S/S II.

GL_OES_rgb8_rgba8,GL_OES_depth24,GL_OES_compressed_ETC1_RGB8_texture,GL_OES_EGL_image,GL_OES_depth_texture,GL_OES_packed_depth_stencil,GL_OES_standard_derivatives,GL_IMG_texture_npot,GL_OES_texture_npot,GL_OES_compressed_ETC1_RGB8_texture,GL_OES_standard_derivatives,GL_OES_EGL_image,GL_OES_depth24,GL_ARM_rgba8, GL_OES_depth_texture, GL_OES_packed_depth_stencil

Texture format extensions that are not supported on the Samsung Galaxy S II.

GL_IMG_texture_compression_pvrtc,GL_IMG_texture_stream2,GL_IMG_texture_format_BGRA8888

New Android 2.3.3 OpenGL extensions, that are not supported on the Samsung Galaxy S.

GL_OES_egl_sync,GL_EXT_shader_texture_lod,GL_IMG_multisampled_render_to_texture

GL_ARM_rgba8 extension enables a RGBA8 renderbuffer storage format. It is similar to OES_rgb8_rgba8, but only exposes RGBA8:

http://www.khronos.org/registry/gles/extensions/ARM/ARM_rgba8.txt

It’s possible to use GL_IMG_TEXTURE_NPOT extension as a fall-back for the functionally equivalent GL_OES_TEXTURE_NPOT one.

GL_ARM_mali_shader_binary extension works only on Samsung Galaxy S II GPU hardware. This extension enables OpenGL ES 2.0 applications running on ARM Mali graphics cores to use shaders precompiled with the Mali ESSL shader compiler.

http://www.khronos.org/registry/gles/extensions/ARM/ARM_mali_shader_binary.txt

Hardware codec supporting issue

Support for given audio codecs in audio files on Galaxy devices and tablets:

Support for given audio codecs in audio files on Galaxy devices and tablets:
Audio codec Device AAC AC3 Ogg/vorbis
Galaxy S (Android Platform 2.2) Yes No Yes*
Galaxy S (Android Platform 2.3.3) Yes No Yes*
Galaxy S II (Android Platform 2.3.3) Yes No Yes*
Tablet GT-P1000 (Android Platform 2.2) Yes No Yes*
Tablet GT-P1010 (Android Platform 2.2.1) Yes No Yes*
Tablet GT-P7300 (Android Platform 3.1) Yes No Yes*

*File was played via DicePlayer. Default player couldn't play given file

Support for MKV files with different audio codecs (AAC, AC3, MP3 and Vorbis) on Galaxy devices and tablets:

Support for MKV files with different audio codecs (AAC, AC3, MP3 and Vorbis) on Galaxy devices and tablets:
Audio codec Device AAC AC3 MP3 Vorbis
Galaxy S (Android Platform 2.2) Yes No No No
Galaxy S (Android Platform 2.3.3) Yes No Yes No
Galaxy S II (Android Platform 2.3.3) Yes No Yes No
Tablet GT-P1000 (Android Platform 2.2) No No No No
Tablet GT-P1010 (Android Platform 2.2.1) Yes Yes Yes No
Tablet GT-P7300 (Android Platform 3.1) Yes No Yes No

Media Engine changes

Multimedia Framework has changed from OpenCORE to StageFright in Gingerbread version.

To get information about media framework you can read the file /system/build.prop in your device. In file there are media.stagefright parameters. In each case if parameter is set to true, then StageFright is active, otherwise your device is using OpenCORE.

Android 2.2 Platform Highlights

Introduced new media framework - StageFright. It supports local file playback and HTTP progressive streaming. Continued support for OpenCore in Android 2.2.

Android 2.3 Platform Highlights

New media framework fully replaces OpenCore, maintaining all previous codec/container support for encoding and decoding. Integrated support for the VP8 open video compression format and the WebM open container format Adds AAC encoding and AMR wideband encoding. There is no difference between using OpenCORE and StageFright.

Changes of SD card path

For the Android external storage directory use the Environment.getExternalStorageDirectory() method.

Do not hardcode the path in your application because it may change between different Android releases. See table below for previous paths of the sdcard.

previous paths of the sdcard
API level Android version External sdcard path
7 Android 2.1-update1 /sdcard
8 Android 2.2 /mnt/sdcard
9 Android 2.3.3 /mnt/sdcard

Code:

package com.samsung.readtxtfile;

		import java.io.File;
		import java.io.FileNotFoundException;
		import java.io.FileReader;
		import java.io.IOException;

		import android.app.Activity;
		import android.os.Bundle;
		import android.os.Environment;
		import android.util.Log;

		public class ReadTxtFileActivity extends Activity {

			static final String mFileName = "file.txt";
			static final String mFileDirectory =
		Environment.getExternalStorageDirectory().getPath();

			/** Called when the activity is first created. */
			@Override
			public void onCreate(Bundle savedInstanceState) {
				super.onCreate(savedInstanceState);
				setContentView(R.layout.main);

				try {
					File file = new File(mFileDirectory, mFileName);
					FileReader reader = new FileReader(file);
					// do something with file
					reader.close();
				} catch (FileNotFoundException ex) {
					Log.i("ReadTxtFileActivity", ex.toString());
				} catch (IOException ex) {
					Log.i("ReadTxtFileActivity", ex.toString());
				}
			}
		}

Additional links:

http://developer.android.com/reference/android/os/Environment.html
http://android-developers.blogspot.com/

COPY URL twitter facebook