Merge "Revert "Revamp of the NumberPicker widget.""
diff --git a/api/current.txt b/api/current.txt
index 29f093a..505ee68 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -75,6 +75,7 @@
field public static final deprecated java.lang.String PERSISTENT_ACTIVITY = "android.permission.PERSISTENT_ACTIVITY";
field public static final java.lang.String PROCESS_OUTGOING_CALLS = "android.permission.PROCESS_OUTGOING_CALLS";
field public static final java.lang.String READ_CALENDAR = "android.permission.READ_CALENDAR";
+ field public static final java.lang.String READ_CALL_LOG = "android.permission.READ_CALL_LOG";
field public static final java.lang.String READ_CONTACTS = "android.permission.READ_CONTACTS";
field public static final java.lang.String READ_EXTERNAL_STORAGE = "android.permission.READ_EXTERNAL_STORAGE";
field public static final java.lang.String READ_FRAME_BUFFER = "android.permission.READ_FRAME_BUFFER";
@@ -121,6 +122,7 @@
field public static final java.lang.String WAKE_LOCK = "android.permission.WAKE_LOCK";
field public static final java.lang.String WRITE_APN_SETTINGS = "android.permission.WRITE_APN_SETTINGS";
field public static final java.lang.String WRITE_CALENDAR = "android.permission.WRITE_CALENDAR";
+ field public static final java.lang.String WRITE_CALL_LOG = "android.permission.WRITE_CALL_LOG";
field public static final java.lang.String WRITE_CONTACTS = "android.permission.WRITE_CONTACTS";
field public static final java.lang.String WRITE_EXTERNAL_STORAGE = "android.permission.WRITE_EXTERNAL_STORAGE";
field public static final java.lang.String WRITE_GSERVICES = "android.permission.WRITE_GSERVICES";
@@ -2686,13 +2688,20 @@
method public final deprecated boolean showDialog(int, android.os.Bundle);
method public android.view.ActionMode startActionMode(android.view.ActionMode.Callback);
method public void startActivityForResult(android.content.Intent, int);
+ method public void startActivityForResult(android.content.Intent, int, android.os.Bundle);
method public void startActivityFromChild(android.app.Activity, android.content.Intent, int);
+ method public void startActivityFromChild(android.app.Activity, android.content.Intent, int, android.os.Bundle);
method public void startActivityFromFragment(android.app.Fragment, android.content.Intent, int);
+ method public void startActivityFromFragment(android.app.Fragment, android.content.Intent, int, android.os.Bundle);
method public boolean startActivityIfNeeded(android.content.Intent, int);
+ method public boolean startActivityIfNeeded(android.content.Intent, int, android.os.Bundle);
method public void startIntentSenderForResult(android.content.IntentSender, int, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
+ method public void startIntentSenderForResult(android.content.IntentSender, int, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
method public void startIntentSenderFromChild(android.app.Activity, android.content.IntentSender, int, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
+ method public void startIntentSenderFromChild(android.app.Activity, android.content.IntentSender, int, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
method public deprecated void startManagingCursor(android.database.Cursor);
method public boolean startNextMatchingActivity(android.content.Intent);
+ method public boolean startNextMatchingActivity(android.content.Intent, android.os.Bundle);
method public void startSearch(java.lang.String, boolean, android.os.Bundle, boolean);
method public deprecated void stopManagingCursor(android.database.Cursor);
method public void takeKeyEvents(boolean);
@@ -2855,6 +2864,12 @@
field public android.content.ComponentName topActivity;
}
+ public class ActivityOptions {
+ method public void join(android.app.ActivityOptions);
+ method public static android.app.ActivityOptions makeCustomAnimation(android.content.Context, int, int);
+ method public android.os.Bundle toBundle();
+ }
+
public class AlarmManager {
method public void cancel(android.app.PendingIntent);
method public void set(int, long, android.app.PendingIntent);
@@ -3318,7 +3333,9 @@
method public void setTargetFragment(android.app.Fragment, int);
method public void setUserVisibleHint(boolean);
method public void startActivity(android.content.Intent);
+ method public void startActivity(android.content.Intent, android.os.Bundle);
method public void startActivityForResult(android.content.Intent, int);
+ method public void startActivityForResult(android.content.Intent, int, android.os.Bundle);
method public void unregisterForContextMenu(android.view.View);
}
@@ -3717,7 +3734,9 @@
method public void cancel();
method public int describeContents();
method public static android.app.PendingIntent getActivities(android.content.Context, int, android.content.Intent[], int);
+ method public static android.app.PendingIntent getActivities(android.content.Context, int, android.content.Intent[], int, android.os.Bundle);
method public static android.app.PendingIntent getActivity(android.content.Context, int, android.content.Intent, int);
+ method public static android.app.PendingIntent getActivity(android.content.Context, int, android.content.Intent, int, android.os.Bundle);
method public static android.app.PendingIntent getBroadcast(android.content.Context, int, android.content.Intent, int);
method public android.content.IntentSender getIntentSender();
method public static android.app.PendingIntent getService(android.content.Context, int, android.content.Intent, int);
@@ -5147,9 +5166,12 @@
method public abstract deprecated void setWallpaper(android.graphics.Bitmap) throws java.io.IOException;
method public abstract deprecated void setWallpaper(java.io.InputStream) throws java.io.IOException;
method public abstract void startActivities(android.content.Intent[]);
+ method public abstract void startActivities(android.content.Intent[], android.os.Bundle);
method public abstract void startActivity(android.content.Intent);
+ method public abstract void startActivity(android.content.Intent, android.os.Bundle);
method public abstract boolean startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle);
method public abstract void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
+ method public abstract void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
method public abstract android.content.ComponentName startService(android.content.Intent);
method public abstract boolean stopService(android.content.Intent);
method public abstract void unbindService(android.content.ServiceConnection);
@@ -5272,9 +5294,12 @@
method public void setWallpaper(android.graphics.Bitmap) throws java.io.IOException;
method public void setWallpaper(java.io.InputStream) throws java.io.IOException;
method public void startActivities(android.content.Intent[]);
+ method public void startActivities(android.content.Intent[], android.os.Bundle);
method public void startActivity(android.content.Intent);
+ method public void startActivity(android.content.Intent, android.os.Bundle);
method public boolean startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle);
method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
+ method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
method public android.content.ComponentName startService(android.content.Intent);
method public boolean stopService(android.content.Intent);
method public void unbindService(android.content.ServiceConnection);
@@ -7209,6 +7234,7 @@
public class SQLException extends java.lang.RuntimeException {
ctor public SQLException();
ctor public SQLException(java.lang.String);
+ ctor public SQLException(java.lang.String, java.lang.Throwable);
}
public class StaleDataException extends java.lang.RuntimeException {
@@ -7386,6 +7412,7 @@
public class SQLiteException extends android.database.SQLException {
ctor public SQLiteException();
ctor public SQLiteException(java.lang.String);
+ ctor public SQLiteException(java.lang.String, java.lang.Throwable);
}
public class SQLiteFullException extends android.database.sqlite.SQLiteException {
@@ -10874,6 +10901,7 @@
method public void setDataSource(java.io.FileDescriptor, long, long) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException;
method public void setDisplay(android.view.SurfaceHolder);
method public void setLooping(boolean);
+ method public void setNextMediaPlayer(android.media.MediaPlayer);
method public void setOnBufferingUpdateListener(android.media.MediaPlayer.OnBufferingUpdateListener);
method public void setOnCompletionListener(android.media.MediaPlayer.OnCompletionListener);
method public void setOnErrorListener(android.media.MediaPlayer.OnErrorListener);
@@ -18835,6 +18863,7 @@
method public static android.content.Intent createInstallIntent();
method public static java.security.cert.X509Certificate[] getCertificateChain(android.content.Context, java.lang.String) throws java.lang.InterruptedException, android.security.KeyChainException;
method public static java.security.PrivateKey getPrivateKey(android.content.Context, java.lang.String) throws java.lang.InterruptedException, android.security.KeyChainException;
+ field public static final java.lang.String ACTION_STORAGE_CHANGED = "android.security.STORAGE_CHANGED";
field public static final java.lang.String EXTRA_CERTIFICATE = "CERT";
field public static final java.lang.String EXTRA_NAME = "name";
field public static final java.lang.String EXTRA_PKCS12 = "PKCS12";
@@ -19924,9 +19953,12 @@
method public void setWallpaper(android.graphics.Bitmap) throws java.io.IOException;
method public void setWallpaper(java.io.InputStream) throws java.io.IOException;
method public void startActivities(android.content.Intent[]);
+ method public void startActivities(android.content.Intent[], android.os.Bundle);
method public void startActivity(android.content.Intent);
+ method public void startActivity(android.content.Intent, android.os.Bundle);
method public boolean startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle);
method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
+ method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
method public android.content.ComponentName startService(android.content.Intent);
method public boolean stopService(android.content.Intent);
method public void unbindService(android.content.ServiceConnection);
@@ -26487,6 +26519,7 @@
ctor public FrameLayout(android.content.Context, android.util.AttributeSet, int);
method public deprecated boolean getConsiderGoneChildrenWhenMeasuring();
method public android.graphics.drawable.Drawable getForeground();
+ method public int getForegroundGravity();
method public boolean getMeasureAllChildren();
method protected void onLayout(boolean, int, int, int, int);
method public void setForeground(android.graphics.drawable.Drawable);
@@ -26715,6 +26748,7 @@
ctor public LinearLayout(android.content.Context, android.util.AttributeSet);
ctor public LinearLayout(android.content.Context, android.util.AttributeSet, int);
method public int getBaselineAlignedChildIndex();
+ method public android.graphics.drawable.Drawable getDividerDrawable();
method public int getDividerPadding();
method public int getOrientation();
method public int getShowDividers();
@@ -27139,6 +27173,7 @@
ctor public RelativeLayout(android.content.Context);
ctor public RelativeLayout(android.content.Context, android.util.AttributeSet);
ctor public RelativeLayout(android.content.Context, android.util.AttributeSet, int);
+ method public int getGravity();
method protected void onLayout(boolean, int, int, int, int);
method public void setGravity(int);
method public void setHorizontalGravity(int);
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index da38df1..c15c49f 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -57,16 +57,13 @@
private int mNextArg;
private String mCurArgData;
- private boolean mDebugOption = false;
+ private int mStartFlags = 0;
private boolean mWaitOption = false;
private boolean mStopOption = false;
- private boolean mOpenglTraceOption = false;
-
private int mRepeat = 0;
private String mProfileFile;
- private boolean mProfileAutoStop;
// These are magic strings understood by the Eclipse plugin.
private static final String FATAL_ERROR_CODE = "Error type 1";
@@ -150,10 +147,9 @@
Intent baseIntent = intent;
boolean hasIntentInfo = false;
- mDebugOption = false;
+ mStartFlags = 0;
mWaitOption = false;
mStopOption = false;
- mOpenglTraceOption = false;
mRepeat = 0;
mProfileFile = null;
Uri data = null;
@@ -297,21 +293,21 @@
intent.setDataAndType(data, type);
intent = new Intent();
} else if (opt.equals("-D")) {
- mDebugOption = true;
+ mStartFlags |= ActivityManager.START_FLAG_DEBUG;
} else if (opt.equals("-W")) {
mWaitOption = true;
} else if (opt.equals("-P")) {
mProfileFile = nextArgRequired();
- mProfileAutoStop = true;
+ mStartFlags |= ActivityManager.START_FLAG_AUTO_STOP_PROFILER;
} else if (opt.equals("--start-profiler")) {
mProfileFile = nextArgRequired();
- mProfileAutoStop = false;
+ mStartFlags &= ~ActivityManager.START_FLAG_AUTO_STOP_PROFILER;
} else if (opt.equals("-R")) {
mRepeat = Integer.parseInt(nextArgRequired());
} else if (opt.equals("-S")) {
mStopOption = true;
} else if (opt.equals("--opengl-trace")) {
- mOpenglTraceOption = true;
+ mStartFlags |= ActivityManager.START_FLAG_OPENGL_TRACES;
} else {
System.err.println("Error: Unknown option: " + opt);
showUsage();
@@ -450,64 +446,60 @@
int res;
if (mWaitOption) {
result = mAm.startActivityAndWait(null, intent, mimeType,
- null, 0, null, null, 0, false,
- mDebugOption, mOpenglTraceOption,
- mProfileFile, fd, mProfileAutoStop);
+ null, null, 0, mStartFlags, mProfileFile, fd, null);
res = result.result;
} else {
res = mAm.startActivity(null, intent, mimeType,
- null, 0, null, null, 0, false,
- mDebugOption, mOpenglTraceOption,
- mProfileFile, fd, mProfileAutoStop);
+ null, null, 0, mStartFlags, mProfileFile, fd, null);
}
PrintStream out = mWaitOption ? System.out : System.err;
boolean launched = false;
switch (res) {
- case IActivityManager.START_SUCCESS:
+ case ActivityManager.START_SUCCESS:
launched = true;
break;
- case IActivityManager.START_SWITCHES_CANCELED:
+ case ActivityManager.START_SWITCHES_CANCELED:
launched = true;
out.println(
"Warning: Activity not started because the "
+ " current activity is being kept for the user.");
break;
- case IActivityManager.START_DELIVERED_TO_TOP:
+ case ActivityManager.START_DELIVERED_TO_TOP:
launched = true;
out.println(
"Warning: Activity not started, intent has "
+ "been delivered to currently running "
+ "top-most instance.");
break;
- case IActivityManager.START_RETURN_INTENT_TO_CALLER:
+ case ActivityManager.START_RETURN_INTENT_TO_CALLER:
launched = true;
out.println(
"Warning: Activity not started because intent "
+ "should be handled by the caller");
break;
- case IActivityManager.START_TASK_TO_FRONT:
+ case ActivityManager.START_TASK_TO_FRONT:
launched = true;
out.println(
"Warning: Activity not started, its current "
+ "task has been brought to the front");
break;
- case IActivityManager.START_INTENT_NOT_RESOLVED:
+ case ActivityManager.START_INTENT_NOT_RESOLVED:
out.println(
"Error: Activity not started, unable to "
+ "resolve " + intent.toString());
break;
- case IActivityManager.START_CLASS_NOT_FOUND:
+ case ActivityManager.START_CLASS_NOT_FOUND:
out.println(NO_CLASS_ERROR_CODE);
out.println("Error: Activity class " +
intent.getComponent().toShortString()
+ " does not exist.");
break;
- case IActivityManager.START_FORWARD_AND_REQUEST_CONFLICT:
+ case ActivityManager.START_FORWARD_AND_REQUEST_CONFLICT:
out.println(
"Error: Activity not started, you requested to "
+ "both forward and receive its result");
break;
- case IActivityManager.START_PERMISSION_DENIED:
+ case ActivityManager.START_PERMISSION_DENIED:
out.println(
"Error: Activity not started, you do not "
+ "have permission to access it.");
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index ba79c9f..aa95b354 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -124,6 +124,24 @@
dump_file("VM TRACES AT LAST ANR", anr_traces_path);
}
+ /* slow traces for slow operations */
+ if (anr_traces_path[0] != 0) {
+ int tail = strlen(anr_traces_path)-1;
+ while (tail > 0 && anr_traces_path[tail] != '/') {
+ tail--;
+ }
+ int i = 0;
+ while (1) {
+ sprintf(anr_traces_path+tail+1, "slow%02d.txt", i);
+ if (stat(anr_traces_path, &st)) {
+ // No traces file at this index, done with the files.
+ break;
+ }
+ dump_file("VM TRACES WHEN SLOW", anr_traces_path);
+ i++;
+ }
+ }
+
dump_file("NETWORK DEV INFO", "/proc/net/dev");
dump_file("QTAGUID NETWORK INTERFACES INFO", "/proc/net/xt_qtaguid/iface_stat_all");
dump_file("QTAGUID CTRL INFO", "/proc/net/xt_qtaguid/ctrl");
diff --git a/cmds/stagefright/Android.mk b/cmds/stagefright/Android.mk
index f26747b..30be7fa 100644
--- a/cmds/stagefright/Android.mk
+++ b/cmds/stagefright/Android.mk
@@ -7,16 +7,16 @@
SineSource.cpp
LOCAL_SHARED_LIBRARIES := \
- libstagefright libmedia libutils libbinder libstagefright_foundation \
+ libstagefright libmedia libmedia_native libutils libbinder libstagefright_foundation \
libskia libgui
LOCAL_C_INCLUDES:= \
$(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
frameworks/base/media/libstagefright/include \
- $(TOP)/frameworks/base/include/media/stagefright/openmax \
- external/skia/include/core \
- external/skia/include/images \
+ $(TOP)/frameworks/native/include/media/openmax \
+ external/skia/include/core \
+ external/skia/include/images \
LOCAL_CFLAGS += -Wno-multichar
@@ -40,7 +40,7 @@
LOCAL_C_INCLUDES:= \
$(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
- $(TOP)/frameworks/base/include/media/stagefright/openmax
+ $(TOP)/frameworks/native/include/media/openmax
LOCAL_CFLAGS += -Wno-multichar
@@ -64,7 +64,7 @@
LOCAL_C_INCLUDES:= \
$(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
- $(TOP)/frameworks/base/include/media/stagefright/openmax
+ $(TOP)/frameworks/native/include/media/openmax
LOCAL_CFLAGS += -Wno-multichar
@@ -89,7 +89,7 @@
LOCAL_C_INCLUDES:= \
$(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
- $(TOP)/frameworks/base/include/media/stagefright/openmax
+ $(TOP)/frameworks/native/include/media/openmax
LOCAL_CFLAGS += -Wno-multichar
@@ -108,12 +108,12 @@
LOCAL_SHARED_LIBRARIES := \
libstagefright liblog libutils libbinder libgui \
- libstagefright_foundation libmedia
+ libstagefright_foundation libmedia libmedia_native
LOCAL_C_INCLUDES:= \
$(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
- $(TOP)/frameworks/base/include/media/stagefright/openmax
+ $(TOP)/frameworks/native/include/media/openmax
LOCAL_CFLAGS += -Wno-multichar
@@ -132,12 +132,12 @@
LOCAL_SHARED_LIBRARIES := \
libstagefright liblog libutils libbinder libstagefright_foundation \
- libmedia libgui libcutils libui
+ libmedia libmedia_native libgui libcutils libui
LOCAL_C_INCLUDES:= \
$(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
- $(TOP)/frameworks/base/include/media/stagefright/openmax
+ $(TOP)/frameworks/native/include/media/openmax
LOCAL_CFLAGS += -Wno-multichar
@@ -157,12 +157,12 @@
LOCAL_SHARED_LIBRARIES := \
libstagefright liblog libutils libbinder libstagefright_foundation \
- libmedia libgui libcutils libui
+ libmedia libmedia_native libgui libcutils libui
LOCAL_C_INCLUDES:= \
$(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
- $(TOP)/frameworks/base/include/media/stagefright/openmax
+ $(TOP)/frameworks/native/include/media/openmax
LOCAL_CFLAGS += -Wno-multichar
diff --git a/cmds/stagefright/SimplePlayer.cpp b/cmds/stagefright/SimplePlayer.cpp
index fac3a8c6..0cfeb3e 100644
--- a/cmds/stagefright/SimplePlayer.cpp
+++ b/cmds/stagefright/SimplePlayer.cpp
@@ -583,8 +583,7 @@
AUDIO_STREAM_MUSIC,
sampleRate,
AUDIO_FORMAT_PCM_16_BIT,
- (channelCount == 1)
- ? AUDIO_CHANNEL_OUT_MONO : AUDIO_CHANNEL_OUT_STEREO,
+ audio_channel_out_mask_from_count(channelCount),
0);
state->mNumFramesWritten = 0;
diff --git a/cmds/stagefright/audioloop.cpp b/cmds/stagefright/audioloop.cpp
index a6362a4..ed7d6cb 100644
--- a/cmds/stagefright/audioloop.cpp
+++ b/cmds/stagefright/audioloop.cpp
@@ -32,9 +32,7 @@
sp<MediaSource> source = new AudioSource(
AUDIO_SOURCE_DEFAULT,
kSampleRate,
- kNumChannels == 1
- ? AUDIO_CHANNEL_IN_MONO
- : AUDIO_CHANNEL_IN_STEREO);
+ audio_channel_in_mask_from_count(kNumChannels));
#endif
sp<MetaData> meta = new MetaData;
diff --git a/cmds/stagefright/sf2.cpp b/cmds/stagefright/sf2.cpp
index 1d28793..e47cdc0 100644
--- a/cmds/stagefright/sf2.cpp
+++ b/cmds/stagefright/sf2.cpp
@@ -14,6 +14,10 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "sf2"
+#include <utils/Log.h>
+
#include <binder/ProcessState.h>
#include <media/stagefright/foundation/hexdump.h>
@@ -205,6 +209,12 @@
}
looper()->stop();
+ } else if (what == ACodec::kWhatError) {
+ ALOGE("something went wrong, codec reported an error.");
+
+ printf("E\n");
+
+ (new AMessage(kWhatStop, id()))->post();
}
break;
}
diff --git a/cmds/system_server/library/Android.mk b/cmds/system_server/library/Android.mk
index 7d08a8c..9f92330 100644
--- a/cmds/system_server/library/Android.mk
+++ b/cmds/system_server/library/Android.mk
@@ -8,10 +8,7 @@
native = $(LOCAL_PATH)/../../../../native
LOCAL_C_INCLUDES := \
- $(base)/services/camera/libcameraservice \
- $(base)/services/audioflinger \
$(base)/services/sensorservice \
- $(base)/media/libmediaplayerservice \
$(native)/services/surfaceflinger \
$(JNI_H_INCLUDE)
@@ -19,9 +16,6 @@
libandroid_runtime \
libsensorservice \
libsurfaceflinger \
- libaudioflinger \
- libcameraservice \
- libmediaplayerservice \
libinput \
libutils \
libbinder \
diff --git a/cmds/system_server/library/system_init.cpp b/cmds/system_server/library/system_init.cpp
index bfbc138..745c34a 100644
--- a/cmds/system_server/library/system_init.cpp
+++ b/cmds/system_server/library/system_init.cpp
@@ -15,10 +15,6 @@
#include <utils/Log.h>
#include <SurfaceFlinger.h>
-#include <AudioFlinger.h>
-#include <CameraService.h>
-#include <AudioPolicyService.h>
-#include <MediaPlayerService.h>
#include <SensorService.h>
#include <android_runtime/AndroidRuntime.h>
diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java
index adc7d35..cf1e8f3 100644
--- a/core/java/android/accounts/AccountManagerService.java
+++ b/core/java/android/accounts/AccountManagerService.java
@@ -1780,7 +1780,7 @@
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "performing bindService to " + authenticatorInfo.componentName);
}
- if (!mContext.bindService(intent, this, Context.BIND_AUTO_CREATE)) {
+ if (!mContext.bindService(intent, this, Context.BIND_AUTO_CREATE, mAccounts.userId)) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "bindService to " + authenticatorInfo.componentName + " failed");
}
@@ -1817,7 +1817,16 @@
// Migrate old file, if it exists, to the new location
File oldFile = new File(systemDir, DATABASE_NAME);
if (oldFile.exists()) {
- oldFile.renameTo(databaseFile);
+ // Check for use directory; create if it doesn't exist, else renameTo will fail
+ File userDir = new File(systemDir, "users/" + userId);
+ if (!userDir.exists()) {
+ if (!userDir.mkdirs()) {
+ throw new IllegalStateException("User dir cannot be created: " + userDir);
+ }
+ }
+ if (!oldFile.renameTo(databaseFile)) {
+ throw new IllegalStateException("User dir cannot be migrated: " + databaseFile);
+ }
}
}
return databaseFile.getPath();
diff --git a/core/java/android/animation/ValueAnimator.java b/core/java/android/animation/ValueAnimator.java
index f69120a..e2b8ce4 100755
--- a/core/java/android/animation/ValueAnimator.java
+++ b/core/java/android/animation/ValueAnimator.java
@@ -557,12 +557,22 @@
public void handleMessage(Message msg) {
switch (msg.what) {
case ANIMATION_START:
- doAnimationStart();
+ // If there are already active animations, or if another ANIMATION_START
+ // message was processed during this frame, then the pending list may already
+ // have been cleared. If that's the case, we've already processed the
+ // active animations for this frame - don't do it again.
+ if (mPendingAnimations.size() > 0) {
+ doAnimationFrame();
+ }
break;
}
}
- private void doAnimationStart() {
+ private void doAnimationFrame() {
+ // currentTime holds the common time for all animations processed
+ // during this frame
+ long currentTime = AnimationUtils.currentAnimationTimeMillis();
+
// mPendingAnimations holds any animations that have requested to be started
// We're going to clear mPendingAnimations, but starting animation may
// cause more to be added to the pending list (for example, if one animation
@@ -583,15 +593,7 @@
}
}
}
- doAnimationFrame();
- }
-
- private void doAnimationFrame() {
- // currentTime holds the common time for all animations processed
- // during this frame
- long currentTime = AnimationUtils.currentAnimationTimeMillis();
-
- // First, process animations currently sitting on the delayed queue, adding
+ // Next, process animations currently sitting on the delayed queue, adding
// them to the active animations if they are ready
int numDelayedAnims = mDelayedAnims.size();
for (int i = 0; i < numDelayedAnims; ++i) {
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 0f2aa46..ea32745 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -32,7 +32,6 @@
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
-import android.content.res.Resources.Theme;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@@ -55,7 +54,6 @@
import android.util.EventLog;
import android.util.Log;
import android.util.SparseArray;
-import android.util.TypedValue;
import android.view.ActionMode;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
@@ -3166,42 +3164,61 @@
}
/**
+ * Same as calling {@link #startActivityForResult(Intent, int, Bundle)}
+ * with no options.
+ *
+ * @param intent The intent to start.
+ * @param requestCode If >= 0, this code will be returned in
+ * onActivityResult() when the activity exits.
+ *
+ * @throws android.content.ActivityNotFoundException
+ *
+ * @see #startActivity
+ */
+ public void startActivityForResult(Intent intent, int requestCode) {
+ startActivityForResult(intent, requestCode, null);
+ }
+
+ /**
* Launch an activity for which you would like a result when it finished.
* When this activity exits, your
* onActivityResult() method will be called with the given requestCode.
* Using a negative requestCode is the same as calling
* {@link #startActivity} (the activity is not launched as a sub-activity).
- *
+ *
* <p>Note that this method should only be used with Intent protocols
* that are defined to return a result. In other protocols (such as
* {@link Intent#ACTION_MAIN} or {@link Intent#ACTION_VIEW}), you may
* not get the result when you expect. For example, if the activity you
* are launching uses the singleTask launch mode, it will not run in your
* task and thus you will immediately receive a cancel result.
- *
+ *
* <p>As a special case, if you call startActivityForResult() with a requestCode
* >= 0 during the initial onCreate(Bundle savedInstanceState)/onResume() of your
* activity, then your window will not be displayed until a result is
* returned back from the started activity. This is to avoid visible
* flickering when redirecting to another activity.
- *
+ *
* <p>This method throws {@link android.content.ActivityNotFoundException}
* if there was no Activity found to run the given Intent.
- *
+ *
* @param intent The intent to start.
* @param requestCode If >= 0, this code will be returned in
* onActivityResult() when the activity exits.
- *
+ * @param options Additional options for how the Activity should be started.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details.
+ *
* @throws android.content.ActivityNotFoundException
- *
+ *
* @see #startActivity
*/
- public void startActivityForResult(Intent intent, int requestCode) {
+ public void startActivityForResult(Intent intent, int requestCode, Bundle options) {
if (mParent == null) {
Instrumentation.ActivityResult ar =
mInstrumentation.execStartActivity(
this, mMainThread.getApplicationThread(), mToken, this,
- intent, requestCode);
+ intent, requestCode, options);
if (ar != null) {
mMainThread.sendActivityResult(
mToken, mEmbeddedID, requestCode, ar.getResultCode(),
@@ -3218,11 +3235,39 @@
mStartedActivity = true;
}
} else {
- mParent.startActivityFromChild(this, intent, requestCode);
+ if (options != null) {
+ mParent.startActivityFromChild(this, intent, requestCode, options);
+ } else {
+ // Note we want to go through this method for compatibility with
+ // existing applications that may have overridden it.
+ mParent.startActivityFromChild(this, intent, requestCode);
+ }
}
}
/**
+ * Same as calling {@link #startIntentSenderForResult(IntentSender, int,
+ * Intent, int, int, int, Bundle)} with no options.
+ *
+ * @param intent The IntentSender to launch.
+ * @param requestCode If >= 0, this code will be returned in
+ * onActivityResult() when the activity exits.
+ * @param fillInIntent If non-null, this will be provided as the
+ * intent parameter to {@link IntentSender#sendIntent}.
+ * @param flagsMask Intent flags in the original IntentSender that you
+ * would like to change.
+ * @param flagsValues Desired values for any bits set in
+ * <var>flagsMask</var>
+ * @param extraFlags Always set to 0.
+ */
+ public void startIntentSenderForResult(IntentSender intent, int requestCode,
+ Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
+ throws IntentSender.SendIntentException {
+ startIntentSenderForResult(intent, requestCode, fillInIntent, flagsMask,
+ flagsValues, extraFlags, null);
+ }
+
+ /**
* Like {@link #startActivityForResult(Intent, int)}, but allowing you
* to use a IntentSender to describe the activity to be started. If
* the IntentSender is for an activity, that activity will be started
@@ -3241,21 +3286,32 @@
* @param flagsValues Desired values for any bits set in
* <var>flagsMask</var>
* @param extraFlags Always set to 0.
+ * @param options Additional options for how the Activity should be started.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details. If options
+ * have also been supplied by the IntentSender, options given here will
+ * override any that conflict with those given by the IntentSender.
*/
public void startIntentSenderForResult(IntentSender intent, int requestCode,
- Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
- throws IntentSender.SendIntentException {
+ Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags,
+ Bundle options) throws IntentSender.SendIntentException {
if (mParent == null) {
startIntentSenderForResultInner(intent, requestCode, fillInIntent,
- flagsMask, flagsValues, this);
+ flagsMask, flagsValues, this, options);
+ } else if (options != null) {
+ mParent.startIntentSenderFromChild(this, intent, requestCode,
+ fillInIntent, flagsMask, flagsValues, extraFlags, options);
} else {
+ // Note we want to go through this call for compatibility with
+ // existing applications that may have overridden the method.
mParent.startIntentSenderFromChild(this, intent, requestCode,
fillInIntent, flagsMask, flagsValues, extraFlags);
}
}
private void startIntentSenderForResultInner(IntentSender intent, int requestCode,
- Intent fillInIntent, int flagsMask, int flagsValues, Activity activity)
+ Intent fillInIntent, int flagsMask, int flagsValues, Activity activity,
+ Bundle options)
throws IntentSender.SendIntentException {
try {
String resolvedType = null;
@@ -3266,8 +3322,8 @@
int result = ActivityManagerNative.getDefault()
.startActivityIntentSender(mMainThread.getApplicationThread(), intent,
fillInIntent, resolvedType, mToken, activity.mEmbeddedID,
- requestCode, flagsMask, flagsValues);
- if (result == IActivityManager.START_CANCELED) {
+ requestCode, flagsMask, flagsValues, options);
+ if (result == ActivityManager.START_CANCELED) {
throw new IntentSender.SendIntentException();
}
Instrumentation.checkStartActivityResult(result, null);
@@ -3286,6 +3342,22 @@
}
/**
+ * Same as {@link #startActivity(Intent, Bundle)} with no options
+ * specified.
+ *
+ * @param intent The intent to start.
+ *
+ * @throws android.content.ActivityNotFoundException
+ *
+ * @see {@link #startActivity(Intent, Bundle)}
+ * @see #startActivityForResult
+ */
+ @Override
+ public void startActivity(Intent intent) {
+ startActivity(intent, null);
+ }
+
+ /**
* Launch a new activity. You will not receive any information about when
* the activity exits. This implementation overrides the base version,
* providing information about
@@ -3298,14 +3370,40 @@
* if there was no Activity found to run the given Intent.
*
* @param intent The intent to start.
+ * @param options Additional options for how the Activity should be started.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details.
*
* @throws android.content.ActivityNotFoundException
- *
+ *
+ * @see {@link #startActivity(Intent)}
* @see #startActivityForResult
*/
@Override
- public void startActivity(Intent intent) {
- startActivityForResult(intent, -1);
+ public void startActivity(Intent intent, Bundle options) {
+ if (options != null) {
+ startActivityForResult(intent, -1, options);
+ } else {
+ // Note we want to go through this call for compatibility with
+ // applications that may have overridden the method.
+ startActivityForResult(intent, -1);
+ }
+ }
+
+ /**
+ * Same as {@link #startActivities(Intent[], Bundle)} with no options
+ * specified.
+ *
+ * @param intents The intents to start.
+ *
+ * @throws android.content.ActivityNotFoundException
+ *
+ * @see {@link #startActivities(Intent[], Bundle)}
+ * @see #startActivityForResult
+ */
+ @Override
+ public void startActivities(Intent[] intents) {
+ startActivities(intents, null);
}
/**
@@ -3321,22 +3419,24 @@
* if there was no Activity found to run the given Intent.
*
* @param intents The intents to start.
+ * @param options Additional options for how the Activity should be started.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details.
*
* @throws android.content.ActivityNotFoundException
*
+ * @see {@link #startActivities(Intent[])}
* @see #startActivityForResult
*/
@Override
- public void startActivities(Intent[] intents) {
+ public void startActivities(Intent[] intents, Bundle options) {
mInstrumentation.execStartActivities(this, mMainThread.getApplicationThread(),
- mToken, this, intents);
+ mToken, this, intents, options);
}
/**
- * Like {@link #startActivity(Intent)}, but taking a IntentSender
- * to start; see
- * {@link #startIntentSenderForResult(IntentSender, int, Intent, int, int, int)}
- * for more information.
+ * Same as calling {@link #startIntentSender(IntentSender, Intent, int, int, int, Bundle)}
+ * with no options.
*
* @param intent The IntentSender to launch.
* @param fillInIntent If non-null, this will be provided as the
@@ -3350,8 +3450,61 @@
public void startIntentSender(IntentSender intent,
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
throws IntentSender.SendIntentException {
- startIntentSenderForResult(intent, -1, fillInIntent, flagsMask,
- flagsValues, extraFlags);
+ startIntentSender(intent, fillInIntent, flagsMask, flagsValues,
+ extraFlags, null);
+ }
+
+ /**
+ * Like {@link #startActivity(Intent, Bundle)}, but taking a IntentSender
+ * to start; see
+ * {@link #startIntentSenderForResult(IntentSender, int, Intent, int, int, int, Bundle)}
+ * for more information.
+ *
+ * @param intent The IntentSender to launch.
+ * @param fillInIntent If non-null, this will be provided as the
+ * intent parameter to {@link IntentSender#sendIntent}.
+ * @param flagsMask Intent flags in the original IntentSender that you
+ * would like to change.
+ * @param flagsValues Desired values for any bits set in
+ * <var>flagsMask</var>
+ * @param extraFlags Always set to 0.
+ * @param options Additional options for how the Activity should be started.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details. If options
+ * have also been supplied by the IntentSender, options given here will
+ * override any that conflict with those given by the IntentSender.
+ */
+ public void startIntentSender(IntentSender intent,
+ Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags,
+ Bundle options) throws IntentSender.SendIntentException {
+ if (options != null) {
+ startIntentSenderForResult(intent, -1, fillInIntent, flagsMask,
+ flagsValues, extraFlags, options);
+ } else {
+ // Note we want to go through this call for compatibility with
+ // applications that may have overridden the method.
+ startIntentSenderForResult(intent, -1, fillInIntent, flagsMask,
+ flagsValues, extraFlags);
+ }
+ }
+
+ /**
+ * Same as calling {@link #startActivityIfNeeded(Intent, int, Bundle)}
+ * with no options.
+ *
+ * @param intent The intent to start.
+ * @param requestCode If >= 0, this code will be returned in
+ * onActivityResult() when the activity exits, as described in
+ * {@link #startActivityForResult}.
+ *
+ * @return If a new activity was launched then true is returned; otherwise
+ * false is returned and you must handle the Intent yourself.
+ *
+ * @see #startActivity
+ * @see #startActivityForResult
+ */
+ public boolean startActivityIfNeeded(Intent intent, int requestCode) {
+ return startActivityIfNeeded(intent, requestCode, null);
}
/**
@@ -3374,6 +3527,9 @@
* @param requestCode If >= 0, this code will be returned in
* onActivityResult() when the activity exits, as described in
* {@link #startActivityForResult}.
+ * @param options Additional options for how the Activity should be started.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details.
*
* @return If a new activity was launched then true is returned; otherwise
* false is returned and you must handle the Intent yourself.
@@ -3381,17 +3537,17 @@
* @see #startActivity
* @see #startActivityForResult
*/
- public boolean startActivityIfNeeded(Intent intent, int requestCode) {
+ public boolean startActivityIfNeeded(Intent intent, int requestCode, Bundle options) {
if (mParent == null) {
- int result = IActivityManager.START_RETURN_INTENT_TO_CALLER;
+ int result = ActivityManager.START_RETURN_INTENT_TO_CALLER;
try {
intent.setAllowFds(false);
result = ActivityManagerNative.getDefault()
.startActivity(mMainThread.getApplicationThread(),
intent, intent.resolveTypeIfNeeded(getContentResolver()),
- null, 0,
- mToken, mEmbeddedID, requestCode, true /* onlyIfNeeded */,
- false, false, null, null, false);
+ mToken, mEmbeddedID, requestCode,
+ ActivityManager.START_FLAG_ONLY_IF_NEEDED, null, null,
+ options);
} catch (RemoteException e) {
// Empty
}
@@ -3408,7 +3564,7 @@
// activity is finished, no matter what happens to it.
mStartedActivity = true;
}
- return result != IActivityManager.START_RETURN_INTENT_TO_CALLER;
+ return result != ActivityManager.START_RETURN_INTENT_TO_CALLER;
}
throw new UnsupportedOperationException(
@@ -3416,6 +3572,24 @@
}
/**
+ * Same as calling {@link #startNextMatchingActivity(Intent, Bundle)} with
+ * no options.
+ *
+ * @param intent The intent to dispatch to the next activity. For
+ * correct behavior, this must be the same as the Intent that started
+ * your own activity; the only changes you can make are to the extras
+ * inside of it.
+ *
+ * @return Returns a boolean indicating whether there was another Activity
+ * to start: true if there was a next activity to start, false if there
+ * wasn't. In general, if true is returned you will then want to call
+ * finish() on yourself.
+ */
+ public boolean startNextMatchingActivity(Intent intent) {
+ return startNextMatchingActivity(intent, null);
+ }
+
+ /**
* Special version of starting an activity, for use when you are replacing
* other activity components. You can use this to hand the Intent off
* to the next Activity that can handle it. You typically call this in
@@ -3425,18 +3599,21 @@
* correct behavior, this must be the same as the Intent that started
* your own activity; the only changes you can make are to the extras
* inside of it.
+ * @param options Additional options for how the Activity should be started.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details.
*
* @return Returns a boolean indicating whether there was another Activity
* to start: true if there was a next activity to start, false if there
* wasn't. In general, if true is returned you will then want to call
* finish() on yourself.
*/
- public boolean startNextMatchingActivity(Intent intent) {
+ public boolean startNextMatchingActivity(Intent intent, Bundle options) {
if (mParent == null) {
try {
intent.setAllowFds(false);
return ActivityManagerNative.getDefault()
- .startNextMatchingActivity(mToken, intent);
+ .startNextMatchingActivity(mToken, intent, options);
} catch (RemoteException e) {
// Empty
}
@@ -3446,7 +3623,25 @@
throw new UnsupportedOperationException(
"startNextMatchingActivity can only be called from a top-level activity");
}
-
+
+ /**
+ * Same as calling {@link #startActivityFromChild(Activity, Intent, int, Bundle)}
+ * with no options.
+ *
+ * @param child The activity making the call.
+ * @param intent The intent to start.
+ * @param requestCode Reply request code. < 0 if reply is not requested.
+ *
+ * @throws android.content.ActivityNotFoundException
+ *
+ * @see #startActivity
+ * @see #startActivityForResult
+ */
+ public void startActivityFromChild(Activity child, Intent intent,
+ int requestCode) {
+ startActivityFromChild(child, intent, requestCode);
+ }
+
/**
* This is called when a child activity of this one calls its
* {@link #startActivity} or {@link #startActivityForResult} method.
@@ -3456,7 +3651,10 @@
*
* @param child The activity making the call.
* @param intent The intent to start.
- * @param requestCode Reply request code. < 0 if reply is not requested.
+ * @param requestCode Reply request code. < 0 if reply is not requested.
+ * @param options Additional options for how the Activity should be started.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details.
*
* @throws android.content.ActivityNotFoundException
*
@@ -3464,11 +3662,11 @@
* @see #startActivityForResult
*/
public void startActivityFromChild(Activity child, Intent intent,
- int requestCode) {
+ int requestCode, Bundle options) {
Instrumentation.ActivityResult ar =
mInstrumentation.execStartActivity(
this, mMainThread.getApplicationThread(), mToken, child,
- intent, requestCode);
+ intent, requestCode, options);
if (ar != null) {
mMainThread.sendActivityResult(
mToken, child.mEmbeddedID, requestCode,
@@ -3477,6 +3675,24 @@
}
/**
+ * Same as calling {@link #startActivityFromFragment(Fragment, Intent, int, Bundle)}
+ * with no options.
+ *
+ * @param fragment The fragment making the call.
+ * @param intent The intent to start.
+ * @param requestCode Reply request code. < 0 if reply is not requested.
+ *
+ * @throws android.content.ActivityNotFoundException
+ *
+ * @see Fragment#startActivity
+ * @see Fragment#startActivityForResult
+ */
+ public void startActivityFromFragment(Fragment fragment, Intent intent,
+ int requestCode) {
+ startActivityFromFragment(fragment, intent, requestCode, null);
+ }
+
+ /**
* This is called when a Fragment in this activity calls its
* {@link Fragment#startActivity} or {@link Fragment#startActivityForResult}
* method.
@@ -3487,6 +3703,9 @@
* @param fragment The fragment making the call.
* @param intent The intent to start.
* @param requestCode Reply request code. < 0 if reply is not requested.
+ * @param options Additional options for how the Activity should be started.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details.
*
* @throws android.content.ActivityNotFoundException
*
@@ -3494,11 +3713,11 @@
* @see Fragment#startActivityForResult
*/
public void startActivityFromFragment(Fragment fragment, Intent intent,
- int requestCode) {
+ int requestCode, Bundle options) {
Instrumentation.ActivityResult ar =
mInstrumentation.execStartActivity(
this, mMainThread.getApplicationThread(), mToken, fragment,
- intent, requestCode);
+ intent, requestCode, options);
if (ar != null) {
mMainThread.sendActivityResult(
mToken, fragment.mWho, requestCode,
@@ -3507,6 +3726,18 @@
}
/**
+ * Same as calling {@link #startIntentSenderFromChild(Activity, IntentSender,
+ * int, Intent, int, int, int, Bundle)} with no options.
+ */
+ public void startIntentSenderFromChild(Activity child, IntentSender intent,
+ int requestCode, Intent fillInIntent, int flagsMask, int flagsValues,
+ int extraFlags)
+ throws IntentSender.SendIntentException {
+ startIntentSenderFromChild(child, intent, requestCode, fillInIntent,
+ flagsMask, flagsValues, extraFlags, null);
+ }
+
+ /**
* Like {@link #startActivityFromChild(Activity, Intent, int)}, but
* taking a IntentSender; see
* {@link #startIntentSenderForResult(IntentSender, int, Intent, int, int, int)}
@@ -3514,16 +3745,24 @@
*/
public void startIntentSenderFromChild(Activity child, IntentSender intent,
int requestCode, Intent fillInIntent, int flagsMask, int flagsValues,
- int extraFlags)
+ int extraFlags, Bundle options)
throws IntentSender.SendIntentException {
startIntentSenderForResultInner(intent, requestCode, fillInIntent,
- flagsMask, flagsValues, child);
+ flagsMask, flagsValues, child, options);
}
/**
* Call immediately after one of the flavors of {@link #startActivity(Intent)}
* or {@link #finish} to specify an explicit transition animation to
* perform next.
+ *
+ * <p>As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN} an alternative
+ * to using this with starting activities is to supply the desired animation
+ * information through a {@link ActivityOptions} bundle to
+ * {@link #startActivity(Intent, Bundle) or a related function. This allows
+ * you to specify a custom animation even when starting an activity from
+ * outside the context of the current top activity.
+ *
* @param enterAnim A resource ID of the animation resource to use for
* the incoming activity. Use 0 for no animation.
* @param exitAnim A resource ID of the animation resource to use for
@@ -3843,9 +4082,9 @@
data.setAllowFds(false);
IIntentSender target =
ActivityManagerNative.getDefault().getIntentSender(
- IActivityManager.INTENT_SENDER_ACTIVITY_RESULT, packageName,
+ ActivityManager.INTENT_SENDER_ACTIVITY_RESULT, packageName,
mParent == null ? mToken : mParent.mToken,
- mEmbeddedID, requestCode, new Intent[] { data }, null, flags);
+ mEmbeddedID, requestCode, new Intent[] { data }, null, flags, null);
return target != null ? new PendingIntent(target) : null;
} catch (RemoteException e) {
// Empty
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 59c803e..d056b17 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -59,6 +59,154 @@
private final Context mContext;
private final Handler mHandler;
+ /**
+ * Result for IActivityManager.startActivity: an error where the
+ * start had to be canceled.
+ * @hide
+ */
+ public static final int START_CANCELED = -6;
+
+ /**
+ * Result for IActivityManager.startActivity: an error where the
+ * thing being started is not an activity.
+ * @hide
+ */
+ public static final int START_NOT_ACTIVITY = -5;
+
+ /**
+ * Result for IActivityManager.startActivity: an error where the
+ * caller does not have permission to start the activity.
+ * @hide
+ */
+ public static final int START_PERMISSION_DENIED = -4;
+
+ /**
+ * Result for IActivityManager.startActivity: an error where the
+ * caller has requested both to forward a result and to receive
+ * a result.
+ * @hide
+ */
+ public static final int START_FORWARD_AND_REQUEST_CONFLICT = -3;
+
+ /**
+ * Result for IActivityManager.startActivity: an error where the
+ * requested class is not found.
+ * @hide
+ */
+ public static final int START_CLASS_NOT_FOUND = -2;
+
+ /**
+ * Result for IActivityManager.startActivity: an error where the
+ * given Intent could not be resolved to an activity.
+ * @hide
+ */
+ public static final int START_INTENT_NOT_RESOLVED = -1;
+
+ /**
+ * Result for IActivityManaqer.startActivity: the activity was started
+ * successfully as normal.
+ * @hide
+ */
+ public static final int START_SUCCESS = 0;
+
+ /**
+ * Result for IActivityManaqer.startActivity: the caller asked that the Intent not
+ * be executed if it is the recipient, and that is indeed the case.
+ * @hide
+ */
+ public static final int START_RETURN_INTENT_TO_CALLER = 1;
+
+ /**
+ * Result for IActivityManaqer.startActivity: activity wasn't really started, but
+ * a task was simply brought to the foreground.
+ * @hide
+ */
+ public static final int START_TASK_TO_FRONT = 2;
+
+ /**
+ * Result for IActivityManaqer.startActivity: activity wasn't really started, but
+ * the given Intent was given to the existing top activity.
+ * @hide
+ */
+ public static final int START_DELIVERED_TO_TOP = 3;
+
+ /**
+ * Result for IActivityManaqer.startActivity: request was canceled because
+ * app switches are temporarily canceled to ensure the user's last request
+ * (such as pressing home) is performed.
+ * @hide
+ */
+ public static final int START_SWITCHES_CANCELED = 4;
+
+ /**
+ * Flag for IActivityManaqer.startActivity: do special start mode where
+ * a new activity is launched only if it is needed.
+ * @hide
+ */
+ public static final int START_FLAG_ONLY_IF_NEEDED = 1<<0;
+
+ /**
+ * Flag for IActivityManaqer.startActivity: launch the app for
+ * debugging.
+ * @hide
+ */
+ public static final int START_FLAG_DEBUG = 1<<1;
+
+ /**
+ * Flag for IActivityManaqer.startActivity: launch the app for
+ * OpenGL tracing.
+ * @hide
+ */
+ public static final int START_FLAG_OPENGL_TRACES = 1<<2;
+
+ /**
+ * Flag for IActivityManaqer.startActivity: if the app is being
+ * launched for profiling, automatically stop the profiler once done.
+ * @hide
+ */
+ public static final int START_FLAG_AUTO_STOP_PROFILER = 1<<3;
+
+ /**
+ * Result for IActivityManaqer.broadcastIntent: success!
+ * @hide
+ */
+ public static final int BROADCAST_SUCCESS = 0;
+
+ /**
+ * Result for IActivityManaqer.broadcastIntent: attempt to broadcast
+ * a sticky intent without appropriate permission.
+ * @hide
+ */
+ public static final int BROADCAST_STICKY_CANT_HAVE_PERMISSION = -1;
+
+ /**
+ * Type for IActivityManaqer.getIntentSender: this PendingIntent is
+ * for a sendBroadcast operation.
+ * @hide
+ */
+ public static final int INTENT_SENDER_BROADCAST = 1;
+
+ /**
+ * Type for IActivityManaqer.getIntentSender: this PendingIntent is
+ * for a startActivity operation.
+ * @hide
+ */
+ public static final int INTENT_SENDER_ACTIVITY = 2;
+
+ /**
+ * Type for IActivityManaqer.getIntentSender: this PendingIntent is
+ * for an activity result operation.
+ * @hide
+ */
+ public static final int INTENT_SENDER_ACTIVITY_RESULT = 3;
+
+ /**
+ * Type for IActivityManaqer.getIntentSender: this PendingIntent is
+ * for a startService operation.
+ * @hide
+ */
+ public static final int INTENT_SENDER_SERVICE = 4;
+
/*package*/ ActivityManager(Context context, Handler handler) {
mContext = context;
mHandler = handler;
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 7daaf7d..a3cc352 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -117,22 +117,18 @@
IApplicationThread app = ApplicationThreadNative.asInterface(b);
Intent intent = Intent.CREATOR.createFromParcel(data);
String resolvedType = data.readString();
- Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
- int grantedMode = data.readInt();
IBinder resultTo = data.readStrongBinder();
String resultWho = data.readString();
int requestCode = data.readInt();
- boolean onlyIfNeeded = data.readInt() != 0;
- boolean debug = data.readInt() != 0;
- boolean openglTrace = data.readInt() != 0;
+ int startFlags = data.readInt();
String profileFile = data.readString();
ParcelFileDescriptor profileFd = data.readInt() != 0
? data.readFileDescriptor() : null;
- boolean autoStopProfiler = data.readInt() != 0;
+ Bundle options = data.readInt() != 0
+ ? Bundle.CREATOR.createFromParcel(data) : null;
int result = startActivity(app, intent, resolvedType,
- grantedUriPermissions, grantedMode, resultTo, resultWho,
- requestCode, onlyIfNeeded, debug, openglTrace,
- profileFile, profileFd, autoStopProfiler);
+ resultTo, resultWho, requestCode, startFlags,
+ profileFile, profileFd, options);
reply.writeNoException();
reply.writeInt(result);
return true;
@@ -145,22 +141,18 @@
IApplicationThread app = ApplicationThreadNative.asInterface(b);
Intent intent = Intent.CREATOR.createFromParcel(data);
String resolvedType = data.readString();
- Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
- int grantedMode = data.readInt();
IBinder resultTo = data.readStrongBinder();
String resultWho = data.readString();
int requestCode = data.readInt();
- boolean onlyIfNeeded = data.readInt() != 0;
- boolean debug = data.readInt() != 0;
- boolean openglTrace = data.readInt() != 0;
+ int startFlags = data.readInt();
String profileFile = data.readString();
ParcelFileDescriptor profileFd = data.readInt() != 0
? data.readFileDescriptor() : null;
- boolean autoStopProfiler = data.readInt() != 0;
+ Bundle options = data.readInt() != 0
+ ? Bundle.CREATOR.createFromParcel(data) : null;
WaitResult result = startActivityAndWait(app, intent, resolvedType,
- grantedUriPermissions, grantedMode, resultTo, resultWho,
- requestCode, onlyIfNeeded, debug, openglTrace,
- profileFile, profileFd, autoStopProfiler);
+ resultTo, resultWho, requestCode, startFlags,
+ profileFile, profileFd, options);
reply.writeNoException();
result.writeToParcel(reply, 0);
return true;
@@ -173,17 +165,15 @@
IApplicationThread app = ApplicationThreadNative.asInterface(b);
Intent intent = Intent.CREATOR.createFromParcel(data);
String resolvedType = data.readString();
- Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
- int grantedMode = data.readInt();
IBinder resultTo = data.readStrongBinder();
String resultWho = data.readString();
int requestCode = data.readInt();
- boolean onlyIfNeeded = data.readInt() != 0;
- boolean debug = data.readInt() != 0;
+ int startFlags = data.readInt();
Configuration config = Configuration.CREATOR.createFromParcel(data);
+ Bundle options = data.readInt() != 0
+ ? Bundle.CREATOR.createFromParcel(data) : null;
int result = startActivityWithConfig(app, intent, resolvedType,
- grantedUriPermissions, grantedMode, resultTo, resultWho,
- requestCode, onlyIfNeeded, debug, config);
+ resultTo, resultWho, requestCode, startFlags, config, options);
reply.writeNoException();
reply.writeInt(result);
return true;
@@ -205,9 +195,11 @@
int requestCode = data.readInt();
int flagsMask = data.readInt();
int flagsValues = data.readInt();
+ Bundle options = data.readInt() != 0
+ ? Bundle.CREATOR.createFromParcel(data) : null;
int result = startActivityIntentSender(app, intent,
fillInIntent, resolvedType, resultTo, resultWho,
- requestCode, flagsMask, flagsValues);
+ requestCode, flagsMask, flagsValues, options);
reply.writeNoException();
reply.writeInt(result);
return true;
@@ -218,7 +210,9 @@
data.enforceInterface(IActivityManager.descriptor);
IBinder callingActivity = data.readStrongBinder();
Intent intent = Intent.CREATOR.createFromParcel(data);
- boolean result = startNextMatchingActivity(callingActivity, intent);
+ Bundle options = data.readInt() != 0
+ ? Bundle.CREATOR.createFromParcel(data) : null;
+ boolean result = startNextMatchingActivity(callingActivity, intent, options);
reply.writeNoException();
reply.writeInt(result ? 1 : 0);
return true;
@@ -841,9 +835,11 @@
requestResolvedTypes = null;
}
int fl = data.readInt();
+ Bundle options = data.readInt() != 0
+ ? Bundle.CREATOR.createFromParcel(data) : null;
IIntentSender res = getIntentSender(type, packageName, token,
resultWho, requestCode, requestIntents,
- requestResolvedTypes, fl);
+ requestResolvedTypes, fl, options);
reply.writeNoException();
reply.writeStrongBinder(res != null ? res.asBinder() : null);
return true;
@@ -1231,9 +1227,11 @@
IBinder resultTo = data.readStrongBinder();
String resultWho = data.readString();
int requestCode = data.readInt();
- boolean onlyIfNeeded = data.readInt() != 0;
+ int startFlags = data.readInt();
+ Bundle options = data.readInt() != 0
+ ? Bundle.CREATOR.createFromParcel(data) : null;
int result = startActivityInPackage(uid, intent, resolvedType,
- resultTo, resultWho, requestCode, onlyIfNeeded);
+ resultTo, resultWho, requestCode, startFlags, options);
reply.writeNoException();
reply.writeInt(result);
return true;
@@ -1412,7 +1410,10 @@
Intent[] intents = data.createTypedArray(Intent.CREATOR);
String[] resolvedTypes = data.createStringArray();
IBinder resultTo = data.readStrongBinder();
- int result = startActivitiesInPackage(uid, intents, resolvedTypes, resultTo);
+ Bundle options = data.readInt() != 0
+ ? Bundle.CREATOR.createFromParcel(data) : null;
+ int result = startActivitiesInPackage(uid, intents, resolvedTypes,
+ resultTo, options);
reply.writeNoException();
reply.writeInt(result);
return true;
@@ -1426,7 +1427,10 @@
Intent[] intents = data.createTypedArray(Intent.CREATOR);
String[] resolvedTypes = data.createStringArray();
IBinder resultTo = data.readStrongBinder();
- int result = startActivities(app, intents, resolvedTypes, resultTo);
+ Bundle options = data.readInt() != 0
+ ? Bundle.CREATOR.createFromParcel(data) : null;
+ int result = startActivities(app, intents, resolvedTypes, resultTo,
+ options);
reply.writeNoException();
reply.writeInt(result);
return true;
@@ -1618,25 +1622,19 @@
}
public int startActivity(IApplicationThread caller, Intent intent,
- String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
- IBinder resultTo, String resultWho,
- int requestCode, boolean onlyIfNeeded,
- boolean debug, boolean openglTrace, String profileFile, ParcelFileDescriptor profileFd,
- boolean autoStopProfiler) throws RemoteException {
+ String resolvedType, IBinder resultTo, String resultWho, int requestCode,
+ int startFlags, String profileFile,
+ ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
data.writeStrongBinder(caller != null ? caller.asBinder() : null);
intent.writeToParcel(data, 0);
data.writeString(resolvedType);
- data.writeTypedArray(grantedUriPermissions, 0);
- data.writeInt(grantedMode);
data.writeStrongBinder(resultTo);
data.writeString(resultWho);
data.writeInt(requestCode);
- data.writeInt(onlyIfNeeded ? 1 : 0);
- data.writeInt(debug ? 1 : 0);
- data.writeInt(openglTrace ? 1 : 0);
+ data.writeInt(startFlags);
data.writeString(profileFile);
if (profileFd != null) {
data.writeInt(1);
@@ -1644,7 +1642,12 @@
} else {
data.writeInt(0);
}
- data.writeInt(autoStopProfiler ? 1 : 0);
+ if (options != null) {
+ data.writeInt(1);
+ options.writeToParcel(data, 0);
+ } else {
+ data.writeInt(0);
+ }
mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
reply.readException();
int result = reply.readInt();
@@ -1653,25 +1656,19 @@
return result;
}
public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
- String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
- IBinder resultTo, String resultWho,
- int requestCode, boolean onlyIfNeeded,
- boolean debug, boolean openglTrace, String profileFile, ParcelFileDescriptor profileFd,
- boolean autoStopProfiler) throws RemoteException {
+ String resolvedType, IBinder resultTo, String resultWho,
+ int requestCode, int startFlags, String profileFile,
+ ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
data.writeStrongBinder(caller != null ? caller.asBinder() : null);
intent.writeToParcel(data, 0);
data.writeString(resolvedType);
- data.writeTypedArray(grantedUriPermissions, 0);
- data.writeInt(grantedMode);
data.writeStrongBinder(resultTo);
data.writeString(resultWho);
data.writeInt(requestCode);
- data.writeInt(onlyIfNeeded ? 1 : 0);
- data.writeInt(debug ? 1 : 0);
- data.writeInt(openglTrace ? 1 : 0);
+ data.writeInt(startFlags);
data.writeString(profileFile);
if (profileFd != null) {
data.writeInt(1);
@@ -1679,7 +1676,12 @@
} else {
data.writeInt(0);
}
- data.writeInt(autoStopProfiler ? 1 : 0);
+ if (options != null) {
+ data.writeInt(1);
+ options.writeToParcel(data, 0);
+ } else {
+ data.writeInt(0);
+ }
mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
reply.readException();
WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
@@ -1688,24 +1690,26 @@
return result;
}
public int startActivityWithConfig(IApplicationThread caller, Intent intent,
- String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
- IBinder resultTo, String resultWho,
- int requestCode, boolean onlyIfNeeded,
- boolean debug, Configuration config) throws RemoteException {
+ String resolvedType, IBinder resultTo, String resultWho,
+ int requestCode, int startFlags, Configuration config,
+ Bundle options) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
data.writeStrongBinder(caller != null ? caller.asBinder() : null);
intent.writeToParcel(data, 0);
data.writeString(resolvedType);
- data.writeTypedArray(grantedUriPermissions, 0);
- data.writeInt(grantedMode);
data.writeStrongBinder(resultTo);
data.writeString(resultWho);
data.writeInt(requestCode);
- data.writeInt(onlyIfNeeded ? 1 : 0);
- data.writeInt(debug ? 1 : 0);
+ data.writeInt(startFlags);
config.writeToParcel(data, 0);
+ if (options != null) {
+ data.writeInt(1);
+ options.writeToParcel(data, 0);
+ } else {
+ data.writeInt(0);
+ }
mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
reply.readException();
int result = reply.readInt();
@@ -1716,7 +1720,7 @@
public int startActivityIntentSender(IApplicationThread caller,
IntentSender intent, Intent fillInIntent, String resolvedType,
IBinder resultTo, String resultWho, int requestCode,
- int flagsMask, int flagsValues) throws RemoteException {
+ int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
@@ -1734,6 +1738,12 @@
data.writeInt(requestCode);
data.writeInt(flagsMask);
data.writeInt(flagsValues);
+ if (options != null) {
+ data.writeInt(1);
+ options.writeToParcel(data, 0);
+ } else {
+ data.writeInt(0);
+ }
mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
reply.readException();
int result = reply.readInt();
@@ -1742,12 +1752,18 @@
return result;
}
public boolean startNextMatchingActivity(IBinder callingActivity,
- Intent intent) throws RemoteException {
+ Intent intent, Bundle options) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
data.writeStrongBinder(callingActivity);
intent.writeToParcel(data, 0);
+ if (options != null) {
+ data.writeInt(1);
+ options.writeToParcel(data, 0);
+ } else {
+ data.writeInt(0);
+ }
mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
reply.readException();
int result = reply.readInt();
@@ -2593,8 +2609,8 @@
}
public IIntentSender getIntentSender(int type,
String packageName, IBinder token, String resultWho,
- int requestCode, Intent[] intents, String[] resolvedTypes, int flags)
- throws RemoteException {
+ int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
+ Bundle options) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
@@ -2611,6 +2627,12 @@
data.writeInt(0);
}
data.writeInt(flags);
+ if (options != null) {
+ data.writeInt(1);
+ options.writeToParcel(data, 0);
+ } else {
+ data.writeInt(0);
+ }
mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
reply.readException();
IIntentSender res = IIntentSender.Stub.asInterface(
@@ -3075,7 +3097,7 @@
public int startActivityInPackage(int uid,
Intent intent, String resolvedType, IBinder resultTo,
- String resultWho, int requestCode, boolean onlyIfNeeded)
+ String resultWho, int requestCode, int startFlags, Bundle options)
throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
@@ -3086,7 +3108,13 @@
data.writeStrongBinder(resultTo);
data.writeString(resultWho);
data.writeInt(requestCode);
- data.writeInt(onlyIfNeeded ? 1 : 0);
+ data.writeInt(startFlags);
+ if (options != null) {
+ data.writeInt(1);
+ options.writeToParcel(data, 0);
+ } else {
+ data.writeInt(0);
+ }
mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
reply.readException();
int result = reply.readInt();
@@ -3339,7 +3367,8 @@
}
public int startActivities(IApplicationThread caller,
- Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException {
+ Intent[] intents, String[] resolvedTypes, IBinder resultTo,
+ Bundle options) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
@@ -3347,6 +3376,12 @@
data.writeTypedArray(intents, 0);
data.writeStringArray(resolvedTypes);
data.writeStrongBinder(resultTo);
+ if (options != null) {
+ data.writeInt(1);
+ options.writeToParcel(data, 0);
+ } else {
+ data.writeInt(0);
+ }
mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
reply.readException();
int result = reply.readInt();
@@ -3356,7 +3391,8 @@
}
public int startActivitiesInPackage(int uid,
- Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException {
+ Intent[] intents, String[] resolvedTypes, IBinder resultTo,
+ Bundle options) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
@@ -3364,6 +3400,12 @@
data.writeTypedArray(intents, 0);
data.writeStringArray(resolvedTypes);
data.writeStrongBinder(resultTo);
+ if (options != null) {
+ data.writeInt(1);
+ options.writeToParcel(data, 0);
+ } else {
+ data.writeInt(0);
+ }
mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0);
reply.readException();
int result = reply.readInt();
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java
new file mode 100644
index 0000000..03bc338
--- /dev/null
+++ b/core/java/android/app/ActivityOptions.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 android.app;
+
+import android.content.Context;
+import android.os.Bundle;
+
+/**
+ * Helper class for building an options Bundle that can be used with
+ * {@link android.content.Context#startActivity(android.content.Intent, android.os.Bundle)
+ * Context.startActivity(Intent, Bundle)} and related methods.
+ */
+public class ActivityOptions {
+ /**
+ * The package name that created the options.
+ * @hide
+ */
+ public static final String KEY_PACKAGE_NAME = "android:packageName";
+
+ /**
+ * Custom enter animation resource ID.
+ * @hide
+ */
+ public static final String KEY_ANIM_ENTER_RES_ID = "android:animEnterRes";
+
+ /**
+ * Custom exit animation resource ID.
+ * @hide
+ */
+ public static final String KEY_ANIM_EXIT_RES_ID = "android:animExitRes";
+
+ private String mPackageName;
+ private boolean mIsCustomAnimation;
+ private int mCustomEnterResId;
+ private int mCustomExitResId;
+
+ /**
+ * Create an ActivityOptions specifying a custom animation to run when
+ * the activity is displayed.
+ *
+ * @param context Who is defining this. This is the application that the
+ * animation resources will be loaded from.
+ * @param enterResId A resource ID of the animation resource to use for
+ * the incoming activity. Use 0 for no animation.
+ * @param exitResId A resource ID of the animation resource to use for
+ * the outgoing activity. Use 0 for no animation.
+ * @return Returns a new ActivityOptions object that you can use to
+ * supply these options as the options Bundle when starting an activity.
+ */
+ public static ActivityOptions makeCustomAnimation(Context context,
+ int enterResId, int exitResId) {
+ ActivityOptions opts = new ActivityOptions();
+ opts.mPackageName = context.getPackageName();
+ opts.mIsCustomAnimation = true;
+ opts.mCustomEnterResId = enterResId;
+ opts.mCustomExitResId = exitResId;
+ return opts;
+ }
+
+ private ActivityOptions() {
+ }
+
+ /** @hide */
+ public ActivityOptions(Bundle opts) {
+ mPackageName = opts.getString(KEY_PACKAGE_NAME);
+ if (opts.containsKey(KEY_ANIM_ENTER_RES_ID)) {
+ mIsCustomAnimation = true;
+ mCustomEnterResId = opts.getInt(KEY_ANIM_ENTER_RES_ID, 0);
+ mCustomExitResId = opts.getInt(KEY_ANIM_EXIT_RES_ID, 0);
+ }
+ }
+
+ /** @hide */
+ public String getPackageName() {
+ return mPackageName;
+ }
+
+ /** @hide */
+ public boolean isCustomAnimation() {
+ return mIsCustomAnimation;
+ }
+
+ /** @hide */
+ public int getCustomEnterResId() {
+ return mCustomEnterResId;
+ }
+
+ /** @hide */
+ public int getCustomExitResId() {
+ return mCustomExitResId;
+ }
+
+ /**
+ * Join the values in <var>otherOptions</var> in to this one. Any values
+ * defined in <var>otherOptions</var> replace those in the base options.
+ */
+ public void join(ActivityOptions otherOptions) {
+ if (otherOptions.mPackageName != null) {
+ mPackageName = otherOptions.mPackageName;
+ }
+ if (otherOptions.mIsCustomAnimation) {
+ mIsCustomAnimation = true;
+ mCustomEnterResId = otherOptions.mCustomEnterResId;
+ mCustomExitResId = otherOptions.mCustomExitResId;
+ }
+ }
+
+ /**
+ * Returns the created options as a Bundle, which can be passed to
+ * {@link android.content.Context#startActivity(android.content.Intent, android.os.Bundle)
+ * Context.startActivity(Intent, Bundle)} and related methods.
+ * Note that the returned Bundle is still owned by the ActivityOptions
+ * object; you must not modify it, but can supply it to the startActivity
+ * methods that take an options Bundle.
+ */
+ public Bundle toBundle() {
+ Bundle b = new Bundle();
+ if (mPackageName != null) {
+ b.putString(KEY_PACKAGE_NAME, mPackageName);
+ }
+ if (mIsCustomAnimation) {
+ b.putInt(KEY_ANIM_ENTER_RES_ID, mCustomEnterResId);
+ b.putInt(KEY_ANIM_EXIT_RES_ID, mCustomExitResId);
+ }
+ return b;
+ }
+}
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 2610d87..2a3e213 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -1802,7 +1802,7 @@
if (aInfo == null) {
// Throw an exception.
Instrumentation.checkStartActivityResult(
- IActivityManager.START_CLASS_NOT_FOUND, intent);
+ ActivityManager.START_CLASS_NOT_FOUND, intent);
}
return aInfo;
}
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index e348b87..7043a73 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -852,6 +852,11 @@
@Override
public void startActivity(Intent intent) {
+ startActivity(intent, null);
+ }
+
+ @Override
+ public void startActivity(Intent intent, Bundle options) {
if ((intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
throw new AndroidRuntimeException(
"Calling startActivity() from outside of an Activity "
@@ -860,11 +865,16 @@
}
mMainThread.getInstrumentation().execStartActivity(
getOuterContext(), mMainThread.getApplicationThread(), null,
- (Activity)null, intent, -1);
+ (Activity)null, intent, -1, options);
}
@Override
public void startActivities(Intent[] intents) {
+ startActivities(intents, null);
+ }
+
+ @Override
+ public void startActivities(Intent[] intents, Bundle options) {
if ((intents[0].getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
throw new AndroidRuntimeException(
"Calling startActivities() from outside of an Activity "
@@ -873,13 +883,20 @@
}
mMainThread.getInstrumentation().execStartActivities(
getOuterContext(), mMainThread.getApplicationThread(), null,
- (Activity)null, intents);
+ (Activity)null, intents, options);
}
@Override
public void startIntentSender(IntentSender intent,
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
throws IntentSender.SendIntentException {
+ startIntentSender(intent, fillInIntent, flagsMask, flagsValues, extraFlags, null);
+ }
+
+ @Override
+ public void startIntentSender(IntentSender intent, Intent fillInIntent,
+ int flagsMask, int flagsValues, int extraFlags, Bundle options)
+ throws IntentSender.SendIntentException {
try {
String resolvedType = null;
if (fillInIntent != null) {
@@ -889,8 +906,8 @@
int result = ActivityManagerNative.getDefault()
.startActivityIntentSender(mMainThread.getApplicationThread(), intent,
fillInIntent, resolvedType, null, null,
- 0, flagsMask, flagsValues);
- if (result == IActivityManager.START_CANCELED) {
+ 0, flagsMask, flagsValues, options);
+ if (result == ActivityManager.START_CANCELED) {
throw new IntentSender.SendIntentException();
}
Instrumentation.checkStartActivityResult(result, null);
diff --git a/core/java/android/app/Fragment.java b/core/java/android/app/Fragment.java
index 492fcc7..c493f0f 100644
--- a/core/java/android/app/Fragment.java
+++ b/core/java/android/app/Fragment.java
@@ -961,27 +961,62 @@
mLoaderManager = mActivity.getLoaderManager(mIndex, mLoadersStarted, true);
return mLoaderManager;
}
-
+
/**
* Call {@link Activity#startActivity(Intent)} on the fragment's
* containing Activity.
+ *
+ * @param intent The intent to start.
*/
public void startActivity(Intent intent) {
+ startActivity(intent, null);
+ }
+
+ /**
+ * Call {@link Activity#startActivity(Intent, Bundle)} on the fragment's
+ * containing Activity.
+ *
+ * @param intent The intent to start.
+ * @param options Additional options for how the Activity should be started.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details.
+ */
+ public void startActivity(Intent intent, Bundle options) {
if (mActivity == null) {
throw new IllegalStateException("Fragment " + this + " not attached to Activity");
}
- mActivity.startActivityFromFragment(this, intent, -1);
+ if (options != null) {
+ mActivity.startActivityFromFragment(this, intent, -1, options);
+ } else {
+ // Note we want to go through this call for compatibility with
+ // applications that may have overridden the method.
+ mActivity.startActivityFromFragment(this, intent, -1);
+ }
}
-
+
/**
* Call {@link Activity#startActivityForResult(Intent, int)} on the fragment's
* containing Activity.
*/
public void startActivityForResult(Intent intent, int requestCode) {
+ startActivityForResult(intent, requestCode, null);
+ }
+
+ /**
+ * Call {@link Activity#startActivityForResult(Intent, int, Bundle)} on the fragment's
+ * containing Activity.
+ */
+ public void startActivityForResult(Intent intent, int requestCode, Bundle options) {
if (mActivity == null) {
throw new IllegalStateException("Fragment " + this + " not attached to Activity");
}
- mActivity.startActivityFromFragment(this, intent, requestCode);
+ if (options != null) {
+ mActivity.startActivityFromFragment(this, intent, requestCode, options);
+ } else {
+ // Note we want to go through this call for compatibility with
+ // applications that may have overridden the method.
+ mActivity.startActivityFromFragment(this, intent, requestCode, options);
+ }
}
/**
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index acebf58..31066b5 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -50,57 +50,24 @@
* {@hide}
*/
public interface IActivityManager extends IInterface {
- /**
- * Returned by startActivity() if the start request was canceled because
- * app switches are temporarily canceled to ensure the user's last request
- * (such as pressing home) is performed.
- */
- public static final int START_SWITCHES_CANCELED = 4;
- /**
- * Returned by startActivity() if an activity wasn't really started, but
- * the given Intent was given to the existing top activity.
- */
- public static final int START_DELIVERED_TO_TOP = 3;
- /**
- * Returned by startActivity() if an activity wasn't really started, but
- * a task was simply brought to the foreground.
- */
- public static final int START_TASK_TO_FRONT = 2;
- /**
- * Returned by startActivity() if the caller asked that the Intent not
- * be executed if it is the recipient, and that is indeed the case.
- */
- public static final int START_RETURN_INTENT_TO_CALLER = 1;
- /**
- * Activity was started successfully as normal.
- */
- public static final int START_SUCCESS = 0;
- public static final int START_INTENT_NOT_RESOLVED = -1;
- public static final int START_CLASS_NOT_FOUND = -2;
- public static final int START_FORWARD_AND_REQUEST_CONFLICT = -3;
- public static final int START_PERMISSION_DENIED = -4;
- public static final int START_NOT_ACTIVITY = -5;
- public static final int START_CANCELED = -6;
public int startActivity(IApplicationThread caller,
- Intent intent, String resolvedType, Uri[] grantedUriPermissions,
- int grantedMode, IBinder resultTo, String resultWho, int requestCode,
- boolean onlyIfNeeded, boolean debug, boolean openglTrace, String profileFile,
- ParcelFileDescriptor profileFd, boolean autoStopProfiler) throws RemoteException;
+ Intent intent, String resolvedType, IBinder resultTo, String resultWho,
+ int requestCode, int flags, String profileFile,
+ ParcelFileDescriptor profileFd, Bundle options) throws RemoteException;
public WaitResult startActivityAndWait(IApplicationThread caller,
- Intent intent, String resolvedType, Uri[] grantedUriPermissions,
- int grantedMode, IBinder resultTo, String resultWho, int requestCode,
- boolean onlyIfNeeded, boolean debug, boolean openglTrace, String profileFile,
- ParcelFileDescriptor profileFd, boolean autoStopProfiler) throws RemoteException;
+ Intent intent, String resolvedType, IBinder resultTo, String resultWho,
+ int requestCode, int flags, String profileFile,
+ ParcelFileDescriptor profileFd, Bundle options) throws RemoteException;
public int startActivityWithConfig(IApplicationThread caller,
- Intent intent, String resolvedType, Uri[] grantedUriPermissions,
- int grantedMode, IBinder resultTo, String resultWho, int requestCode,
- boolean onlyIfNeeded, boolean debug, Configuration newConfig) throws RemoteException;
+ Intent intent, String resolvedType, IBinder resultTo, String resultWho,
+ int requestCode, int startFlags, Configuration newConfig,
+ Bundle options) throws RemoteException;
public int startActivityIntentSender(IApplicationThread caller,
IntentSender intent, Intent fillInIntent, String resolvedType,
IBinder resultTo, String resultWho, int requestCode,
- int flagsMask, int flagsValues) throws RemoteException;
+ int flagsMask, int flagsValues, Bundle options) throws RemoteException;
public boolean startNextMatchingActivity(IBinder callingActivity,
- Intent intent) throws RemoteException;
+ Intent intent, Bundle options) throws RemoteException;
public boolean finishActivity(IBinder token, int code, Intent data)
throws RemoteException;
public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException;
@@ -109,8 +76,6 @@
IIntentReceiver receiver, IntentFilter filter,
String requiredPermission) throws RemoteException;
public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException;
- public static final int BROADCAST_SUCCESS = 0;
- public static final int BROADCAST_STICKY_CANT_HAVE_PERMISSION = -1;
public int broadcastIntent(IApplicationThread caller, Intent intent,
String resolvedType, IIntentReceiver resultTo, int resultCode,
String resultData, Bundle map, String requiredPermission,
@@ -201,14 +166,10 @@
public ComponentName getActivityClassForToken(IBinder token) throws RemoteException;
public String getPackageForToken(IBinder token) throws RemoteException;
- public static final int INTENT_SENDER_BROADCAST = 1;
- public static final int INTENT_SENDER_ACTIVITY = 2;
- public static final int INTENT_SENDER_ACTIVITY_RESULT = 3;
- public static final int INTENT_SENDER_SERVICE = 4;
public IIntentSender getIntentSender(int type,
String packageName, IBinder token, String resultWho,
int requestCode, Intent[] intents, String[] resolvedTypes,
- int flags) throws RemoteException;
+ int flags, Bundle options) throws RemoteException;
public void cancelIntentSender(IIntentSender sender) throws RemoteException;
public boolean clearApplicationUserData(final String packageName,
final IPackageDataObserver observer, int userId) throws RemoteException;
@@ -302,7 +263,7 @@
public int startActivityInPackage(int uid,
Intent intent, String resolvedType, IBinder resultTo,
- String resultWho, int requestCode, boolean onlyIfNeeded)
+ String resultWho, int requestCode, int startFlags, Bundle options)
throws RemoteException;
public void killApplicationWithUid(String pkg, int uid) throws RemoteException;
@@ -342,9 +303,11 @@
ParcelFileDescriptor fd) throws RemoteException;
public int startActivities(IApplicationThread caller,
- Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException;
+ Intent[] intents, String[] resolvedTypes, IBinder resultTo,
+ Bundle options) throws RemoteException;
public int startActivitiesInPackage(int uid,
- Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException;
+ Intent[] intents, String[] resolvedTypes, IBinder resultTo,
+ Bundle options) throws RemoteException;
public int getFrontActivityScreenCompatMode() throws RemoteException;
public void setFrontActivityScreenCompatMode(int mode) throws RemoteException;
diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java
index a34e1d3..16299de 100644
--- a/core/java/android/app/Instrumentation.java
+++ b/core/java/android/app/Instrumentation.java
@@ -1346,6 +1346,7 @@
* @param intent The actual Intent to start.
* @param requestCode Identifier for this request's result; less than zero
* if the caller is not expecting a result.
+ * @param options Addition options.
*
* @return To force the return of a particular result, return an
* ActivityResult object containing the desired data; otherwise
@@ -1361,7 +1362,7 @@
*/
public ActivityResult execStartActivity(
Context who, IBinder contextThread, IBinder token, Activity target,
- Intent intent, int requestCode) {
+ Intent intent, int requestCode, Bundle options) {
IApplicationThread whoThread = (IApplicationThread) contextThread;
if (mActivityMonitors != null) {
synchronized (mSync) {
@@ -1383,8 +1384,8 @@
int result = ActivityManagerNative.getDefault()
.startActivity(whoThread, intent,
intent.resolveTypeIfNeeded(who.getContentResolver()),
- null, 0, token, target != null ? target.mEmbeddedID : null,
- requestCode, false, false, false, null, null, false);
+ token, target != null ? target.mEmbeddedID : null,
+ requestCode, 0, null, null, options);
checkStartActivityResult(result, intent);
} catch (RemoteException e) {
}
@@ -1400,7 +1401,7 @@
* {@hide}
*/
public void execStartActivities(Context who, IBinder contextThread,
- IBinder token, Activity target, Intent[] intents) {
+ IBinder token, Activity target, Intent[] intents, Bundle options) {
IApplicationThread whoThread = (IApplicationThread) contextThread;
if (mActivityMonitors != null) {
synchronized (mSync) {
@@ -1424,7 +1425,7 @@
resolvedTypes[i] = intents[i].resolveTypeIfNeeded(who.getContentResolver());
}
int result = ActivityManagerNative.getDefault()
- .startActivities(whoThread, intents, resolvedTypes, token);
+ .startActivities(whoThread, intents, resolvedTypes, token, options);
checkStartActivityResult(result, intents[0]);
} catch (RemoteException e) {
}
@@ -1459,7 +1460,7 @@
*/
public ActivityResult execStartActivity(
Context who, IBinder contextThread, IBinder token, Fragment target,
- Intent intent, int requestCode) {
+ Intent intent, int requestCode, Bundle options) {
IApplicationThread whoThread = (IApplicationThread) contextThread;
if (mActivityMonitors != null) {
synchronized (mSync) {
@@ -1481,9 +1482,8 @@
int result = ActivityManagerNative.getDefault()
.startActivity(whoThread, intent,
intent.resolveTypeIfNeeded(who.getContentResolver()),
- null, 0, token, target != null ? target.mWho : null,
- requestCode, false, false /* debug */, false /* openglTrace */,
- null, null, false);
+ token, target != null ? target.mWho : null,
+ requestCode, 0, null, null, options);
checkStartActivityResult(result, intent);
} catch (RemoteException e) {
}
@@ -1502,13 +1502,13 @@
}
/*package*/ static void checkStartActivityResult(int res, Object intent) {
- if (res >= IActivityManager.START_SUCCESS) {
+ if (res >= ActivityManager.START_SUCCESS) {
return;
}
switch (res) {
- case IActivityManager.START_INTENT_NOT_RESOLVED:
- case IActivityManager.START_CLASS_NOT_FOUND:
+ case ActivityManager.START_INTENT_NOT_RESOLVED:
+ case ActivityManager.START_CLASS_NOT_FOUND:
if (intent instanceof Intent && ((Intent)intent).getComponent() != null)
throw new ActivityNotFoundException(
"Unable to find explicit activity class "
@@ -1516,13 +1516,13 @@
+ "; have you declared this activity in your AndroidManifest.xml?");
throw new ActivityNotFoundException(
"No Activity found to handle " + intent);
- case IActivityManager.START_PERMISSION_DENIED:
+ case ActivityManager.START_PERMISSION_DENIED:
throw new SecurityException("Not allowed to start activity "
+ intent);
- case IActivityManager.START_FORWARD_AND_REQUEST_CONFLICT:
+ case ActivityManager.START_FORWARD_AND_REQUEST_CONFLICT:
throw new AndroidRuntimeException(
"FORWARD_RESULT_FLAG used while also requesting a result");
- case IActivityManager.START_NOT_ACTIVITY:
+ case ActivityManager.START_NOT_ACTIVITY:
throw new IllegalArgumentException(
"PendingIntent is not an activity");
default:
diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java
index c95066c..aa366b6 100644
--- a/core/java/android/app/PendingIntent.java
+++ b/core/java/android/app/PendingIntent.java
@@ -188,6 +188,35 @@
*/
public static PendingIntent getActivity(Context context, int requestCode,
Intent intent, int flags) {
+ return getActivity(context, requestCode, intent, flags, null);
+ }
+
+ /**
+ * Retrieve a PendingIntent that will start a new activity, like calling
+ * {@link Context#startActivity(Intent) Context.startActivity(Intent)}.
+ * Note that the activity will be started outside of the context of an
+ * existing activity, so you must use the {@link Intent#FLAG_ACTIVITY_NEW_TASK
+ * Intent.FLAG_ACTIVITY_NEW_TASK} launch flag in the Intent.
+ *
+ * @param context The Context in which this PendingIntent should start
+ * the activity.
+ * @param requestCode Private request code for the sender (currently
+ * not used).
+ * @param intent Intent of the activity to be launched.
+ * @param flags May be {@link #FLAG_ONE_SHOT}, {@link #FLAG_NO_CREATE},
+ * {@link #FLAG_CANCEL_CURRENT}, {@link #FLAG_UPDATE_CURRENT},
+ * or any of the flags as supported by
+ * {@link Intent#fillIn Intent.fillIn()} to control which unspecified parts
+ * of the intent that can be supplied when the actual send happens.
+ * @param options Additional options for how the Activity should be started.
+ * May be null if there are no options.
+ *
+ * @return Returns an existing or new PendingIntent matching the given
+ * parameters. May return null only if {@link #FLAG_NO_CREATE} has been
+ * supplied.
+ */
+ public static PendingIntent getActivity(Context context, int requestCode,
+ Intent intent, int flags, Bundle options) {
String packageName = context.getPackageName();
String resolvedType = intent != null ? intent.resolveTypeIfNeeded(
context.getContentResolver()) : null;
@@ -195,9 +224,10 @@
intent.setAllowFds(false);
IIntentSender target =
ActivityManagerNative.getDefault().getIntentSender(
- IActivityManager.INTENT_SENDER_ACTIVITY, packageName,
+ ActivityManager.INTENT_SENDER_ACTIVITY, packageName,
null, null, requestCode, new Intent[] { intent },
- resolvedType != null ? new String[] { resolvedType } : null, flags);
+ resolvedType != null ? new String[] { resolvedType } : null,
+ flags, options);
return target != null ? new PendingIntent(target) : null;
} catch (RemoteException e) {
}
@@ -247,6 +277,52 @@
*/
public static PendingIntent getActivities(Context context, int requestCode,
Intent[] intents, int flags) {
+ return getActivities(context, requestCode, intents, flags, null);
+ }
+
+ /**
+ * Like {@link #getActivity(Context, int, Intent, int)}, but allows an
+ * array of Intents to be supplied. The first Intent in the array is
+ * taken as the primary key for the PendingIntent, like the single Intent
+ * given to {@link #getActivity(Context, int, Intent, int)}. Upon sending
+ * the resulting PendingIntent, all of the Intents are started in the same
+ * way as they would be by passing them to {@link Context#startActivities(Intent[])}.
+ *
+ * <p class="note">
+ * The <em>first</em> intent in the array will be started outside of the context of an
+ * existing activity, so you must use the {@link Intent#FLAG_ACTIVITY_NEW_TASK
+ * Intent.FLAG_ACTIVITY_NEW_TASK} launch flag in the Intent. (Activities after
+ * the first in the array are started in the context of the previous activity
+ * in the array, so FLAG_ACTIVITY_NEW_TASK is not needed nor desired for them.)
+ * </p>
+ *
+ * <p class="note">
+ * The <em>last</em> intent in the array represents the key for the
+ * PendingIntent. In other words, it is the significant element for matching
+ * (as done with the single intent given to {@link #getActivity(Context, int, Intent, int)},
+ * its content will be the subject of replacement by
+ * {@link #send(Context, int, Intent)} and {@link #FLAG_UPDATE_CURRENT}, etc.
+ * This is because it is the most specific of the supplied intents, and the
+ * UI the user actually sees when the intents are started.
+ * </p>
+ *
+ * @param context The Context in which this PendingIntent should start
+ * the activity.
+ * @param requestCode Private request code for the sender (currently
+ * not used).
+ * @param intents Array of Intents of the activities to be launched.
+ * @param flags May be {@link #FLAG_ONE_SHOT}, {@link #FLAG_NO_CREATE},
+ * {@link #FLAG_CANCEL_CURRENT}, {@link #FLAG_UPDATE_CURRENT},
+ * or any of the flags as supported by
+ * {@link Intent#fillIn Intent.fillIn()} to control which unspecified parts
+ * of the intent that can be supplied when the actual send happens.
+ *
+ * @return Returns an existing or new PendingIntent matching the given
+ * parameters. May return null only if {@link #FLAG_NO_CREATE} has been
+ * supplied.
+ */
+ public static PendingIntent getActivities(Context context, int requestCode,
+ Intent[] intents, int flags, Bundle options) {
String packageName = context.getPackageName();
String[] resolvedTypes = new String[intents.length];
for (int i=0; i<intents.length; i++) {
@@ -256,8 +332,8 @@
try {
IIntentSender target =
ActivityManagerNative.getDefault().getIntentSender(
- IActivityManager.INTENT_SENDER_ACTIVITY, packageName,
- null, null, requestCode, intents, resolvedTypes, flags);
+ ActivityManager.INTENT_SENDER_ACTIVITY, packageName,
+ null, null, requestCode, intents, resolvedTypes, flags, options);
return target != null ? new PendingIntent(target) : null;
} catch (RemoteException e) {
}
@@ -292,9 +368,10 @@
intent.setAllowFds(false);
IIntentSender target =
ActivityManagerNative.getDefault().getIntentSender(
- IActivityManager.INTENT_SENDER_BROADCAST, packageName,
+ ActivityManager.INTENT_SENDER_BROADCAST, packageName,
null, null, requestCode, new Intent[] { intent },
- resolvedType != null ? new String[] { resolvedType } : null, flags);
+ resolvedType != null ? new String[] { resolvedType } : null,
+ flags, null);
return target != null ? new PendingIntent(target) : null;
} catch (RemoteException e) {
}
@@ -330,9 +407,10 @@
intent.setAllowFds(false);
IIntentSender target =
ActivityManagerNative.getDefault().getIntentSender(
- IActivityManager.INTENT_SENDER_SERVICE, packageName,
+ ActivityManager.INTENT_SENDER_SERVICE, packageName,
null, null, requestCode, new Intent[] { intent },
- resolvedType != null ? new String[] { resolvedType } : null, flags);
+ resolvedType != null ? new String[] { resolvedType } : null,
+ flags, null);
return target != null ? new PendingIntent(target) : null;
} catch (RemoteException e) {
}
diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java
index ec67d8c..05ef194 100644
--- a/core/java/android/content/ContentProvider.java
+++ b/core/java/android/content/ContentProvider.java
@@ -270,19 +270,24 @@
return CancellationSignal.createTransport();
}
- private boolean hasReadPermission(Uri uri) {
+ private void enforceReadPermission(Uri uri) throws SecurityException {
final Context context = getContext();
final int pid = Binder.getCallingPid();
final int uid = Binder.getCallingUid();
+ String missingPerm = null;
if (uid == mMyUid) {
- return true;
+ return;
+ }
- } else if (mExported) {
+ if (mExported) {
final String componentPerm = getReadPermission();
- if (componentPerm != null
- && (context.checkPermission(componentPerm, pid, uid) == PERMISSION_GRANTED)) {
- return true;
+ if (componentPerm != null) {
+ if (context.checkPermission(componentPerm, pid, uid) == PERMISSION_GRANTED) {
+ return;
+ } else {
+ missingPerm = componentPerm;
+ }
}
// track if unprotected read is allowed; any denied
@@ -296,11 +301,12 @@
final String pathPerm = pp.getReadPermission();
if (pathPerm != null && pp.match(path)) {
if (context.checkPermission(pathPerm, pid, uid) == PERMISSION_GRANTED) {
- return true;
+ return;
} else {
// any denied <path-permission> means we lose
// default <provider> access.
allowDefaultRead = false;
+ missingPerm = pathPerm;
}
}
}
@@ -308,44 +314,41 @@
// if we passed <path-permission> checks above, and no default
// <provider> permission, then allow access.
- if (allowDefaultRead) return true;
+ if (allowDefaultRead) return;
}
// last chance, check against any uri grants
if (context.checkUriPermission(uri, pid, uid, Intent.FLAG_GRANT_READ_URI_PERMISSION)
== PERMISSION_GRANTED) {
- return true;
- }
-
- return false;
- }
-
- private void enforceReadPermission(Uri uri) {
- if (hasReadPermission(uri)) {
return;
}
- String msg = "Permission Denial: reading "
- + ContentProvider.this.getClass().getName()
- + " uri " + uri + " from pid=" + Binder.getCallingPid()
- + ", uid=" + Binder.getCallingUid()
- + " requires " + getReadPermission();
- throw new SecurityException(msg);
+ final String failReason = mExported
+ ? " requires " + missingPerm + ", or grantUriPermission()"
+ : " requires the provider be exported, or grantUriPermission()";
+ throw new SecurityException("Permission Denial: reading "
+ + ContentProvider.this.getClass().getName() + " uri " + uri + " from pid=" + pid
+ + ", uid=" + uid + failReason);
}
- private boolean hasWritePermission(Uri uri) {
+ private void enforceWritePermission(Uri uri) throws SecurityException {
final Context context = getContext();
final int pid = Binder.getCallingPid();
final int uid = Binder.getCallingUid();
+ String missingPerm = null;
if (uid == mMyUid) {
- return true;
+ return;
+ }
- } else if (mExported) {
+ if (mExported) {
final String componentPerm = getWritePermission();
- if (componentPerm != null
- && (context.checkPermission(componentPerm, pid, uid) == PERMISSION_GRANTED)) {
- return true;
+ if (componentPerm != null) {
+ if (context.checkPermission(componentPerm, pid, uid) == PERMISSION_GRANTED) {
+ return;
+ } else {
+ missingPerm = componentPerm;
+ }
}
// track if unprotected write is allowed; any denied
@@ -359,11 +362,12 @@
final String pathPerm = pp.getWritePermission();
if (pathPerm != null && pp.match(path)) {
if (context.checkPermission(pathPerm, pid, uid) == PERMISSION_GRANTED) {
- return true;
+ return;
} else {
// any denied <path-permission> means we lose
// default <provider> access.
allowDefaultWrite = false;
+ missingPerm = pathPerm;
}
}
}
@@ -371,33 +375,24 @@
// if we passed <path-permission> checks above, and no default
// <provider> permission, then allow access.
- if (allowDefaultWrite) return true;
+ if (allowDefaultWrite) return;
}
// last chance, check against any uri grants
if (context.checkUriPermission(uri, pid, uid, Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
== PERMISSION_GRANTED) {
- return true;
- }
-
- return false;
- }
-
- private void enforceWritePermission(Uri uri) {
- if (hasWritePermission(uri)) {
return;
}
-
- String msg = "Permission Denial: writing "
- + ContentProvider.this.getClass().getName()
- + " uri " + uri + " from pid=" + Binder.getCallingPid()
- + ", uid=" + Binder.getCallingUid()
- + " requires " + getWritePermission();
- throw new SecurityException(msg);
+
+ final String failReason = mExported
+ ? " requires " + missingPerm + ", or grantUriPermission()"
+ : " requires the provider be exported, or grantUriPermission()";
+ throw new SecurityException("Permission Denial: writing "
+ + ContentProvider.this.getClass().getName() + " uri " + uri + " from pid=" + pid
+ + ", uid=" + uid + failReason);
}
}
-
/**
* Retrieves the Context this provider is running in. Only available once
* {@link #onCreate} has been called -- this will return null in the
diff --git a/core/java/android/content/ContentProviderNative.java b/core/java/android/content/ContentProviderNative.java
index eb83dbc..4b31552 100644
--- a/core/java/android/content/ContentProviderNative.java
+++ b/core/java/android/content/ContentProviderNative.java
@@ -17,6 +17,7 @@
package android.content;
import android.content.res.AssetFileDescriptor;
+import android.database.BulkCursorDescriptor;
import android.database.BulkCursorNative;
import android.database.BulkCursorToCursorAdaptor;
import android.database.Cursor;
@@ -113,20 +114,14 @@
if (cursor != null) {
CursorToBulkCursorAdaptor adaptor = new CursorToBulkCursorAdaptor(
cursor, observer, getProviderName());
- final IBinder binder = adaptor.asBinder();
- final int count = adaptor.count();
- final int index = BulkCursorToCursorAdaptor.findRowIdColumnIndex(
- adaptor.getColumnNames());
- final boolean wantsAllOnMoveCalls = adaptor.getWantsAllOnMoveCalls();
+ BulkCursorDescriptor d = adaptor.getBulkCursorDescriptor();
reply.writeNoException();
- reply.writeStrongBinder(binder);
- reply.writeInt(count);
- reply.writeInt(index);
- reply.writeInt(wantsAllOnMoveCalls ? 1 : 0);
+ reply.writeInt(1);
+ d.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
} else {
reply.writeNoException();
- reply.writeStrongBinder(null);
+ reply.writeInt(0);
}
return true;
@@ -369,12 +364,9 @@
DatabaseUtils.readExceptionFromParcel(reply);
- IBulkCursor bulkCursor = BulkCursorNative.asInterface(reply.readStrongBinder());
- if (bulkCursor != null) {
- int rowCount = reply.readInt();
- int idColumnPosition = reply.readInt();
- boolean wantsAllOnMoveCalls = reply.readInt() != 0;
- adaptor.initialize(bulkCursor, rowCount, idColumnPosition, wantsAllOnMoveCalls);
+ if (reply.readInt() != 0) {
+ BulkCursorDescriptor d = BulkCursorDescriptor.CREATOR.createFromParcel(reply);
+ adaptor.initialize(d);
} else {
adaptor.close();
adaptor = null;
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 0e9e256..741a6e9 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -818,6 +818,19 @@
public abstract void clearWallpaper() throws IOException;
/**
+ * Same as {@link #startActivity(Intent, Bundle)} with no options
+ * specified.
+ *
+ * @param intent The description of the activity to start.
+ *
+ * @throws ActivityNotFoundException
+ *
+ * @see {@link #startActivity(Intent, Bundle)}
+ * @see PackageManager#resolveActivity
+ */
+ public abstract void startActivity(Intent intent);
+
+ /**
* Launch a new activity. You will not receive any information about when
* the activity exits.
*
@@ -832,12 +845,30 @@
* if there was no Activity found to run the given Intent.
*
* @param intent The description of the activity to start.
+ * @param options Additional options for how the Activity should be started.
+ * May be null if there are no options. See {@link android.app.ActivityOptions}
+ * for how to build the Bundle supplied here; there are no supported definitions
+ * for building it manually.
*
* @throws ActivityNotFoundException
*
+ * @see {@link #startActivity(Intent)}
* @see PackageManager#resolveActivity
*/
- public abstract void startActivity(Intent intent);
+ public abstract void startActivity(Intent intent, Bundle options);
+
+ /**
+ * Same as {@link #startActivities(Intent[], Bundle)} with no options
+ * specified.
+ *
+ * @param intents An array of Intents to be started.
+ *
+ * @throws ActivityNotFoundException
+ *
+ * @see {@link #startActivities(Intent[], Bundle)}
+ * @see PackageManager#resolveActivity
+ */
+ public abstract void startActivities(Intent[] intents);
/**
* Launch multiple new activities. This is generally the same as calling
@@ -854,15 +885,39 @@
* list may be on it, some not), so you probably want to avoid such situations.
*
* @param intents An array of Intents to be started.
+ * @param options Additional options for how the Activity should be started.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details.
*
* @throws ActivityNotFoundException
*
+ * @see {@link #startActivities(Intent[])}
* @see PackageManager#resolveActivity
*/
- public abstract void startActivities(Intent[] intents);
+ public abstract void startActivities(Intent[] intents, Bundle options);
/**
- * Like {@link #startActivity(Intent)}, but taking a IntentSender
+ * Same as {@link #startIntentSender(IntentSender, Intent, int, int, int, Bundle)}
+ * with no options specified.
+ *
+ * @param intent The IntentSender to launch.
+ * @param fillInIntent If non-null, this will be provided as the
+ * intent parameter to {@link IntentSender#sendIntent}.
+ * @param flagsMask Intent flags in the original IntentSender that you
+ * would like to change.
+ * @param flagsValues Desired values for any bits set in
+ * <var>flagsMask</var>
+ * @param extraFlags Always set to 0.
+ *
+ * @see #startActivity(Intent)
+ * @see #startIntentSender(IntentSender, Intent, int, int, int, Bundle)
+ */
+ public abstract void startIntentSender(IntentSender intent,
+ Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
+ throws IntentSender.SendIntentException;
+
+ /**
+ * Like {@link #startActivity(Intent, Bundle)}, but taking a IntentSender
* to start. If the IntentSender is for an activity, that activity will be started
* as if you had called the regular {@link #startActivity(Intent)}
* here; otherwise, its associated action will be executed (such as
@@ -877,10 +932,18 @@
* @param flagsValues Desired values for any bits set in
* <var>flagsMask</var>
* @param extraFlags Always set to 0.
+ * @param options Additional options for how the Activity should be started.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details. If options
+ * have also been supplied by the IntentSender, options given here will
+ * override any that conflict with those given by the IntentSender.
+ *
+ * @see #startActivity(Intent, Bundle)
+ * @see #startIntentSender(IntentSender, Intent, int, int, int)
*/
public abstract void startIntentSender(IntentSender intent,
- Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
- throws IntentSender.SendIntentException;
+ Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags,
+ Bundle options) throws IntentSender.SendIntentException;
/**
* Broadcast the given intent to all interested BroadcastReceivers. This
diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java
index 5ba9dcc..6b950e0 100644
--- a/core/java/android/content/ContextWrapper.java
+++ b/core/java/android/content/ContextWrapper.java
@@ -277,17 +277,35 @@
}
@Override
+ public void startActivity(Intent intent, Bundle options) {
+ mBase.startActivity(intent, options);
+ }
+
+ @Override
public void startActivities(Intent[] intents) {
mBase.startActivities(intents);
}
@Override
+ public void startActivities(Intent[] intents, Bundle options) {
+ mBase.startActivities(intents, options);
+ }
+
+ @Override
public void startIntentSender(IntentSender intent,
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
throws IntentSender.SendIntentException {
mBase.startIntentSender(intent, fillInIntent, flagsMask,
flagsValues, extraFlags);
}
+
+ @Override
+ public void startIntentSender(IntentSender intent,
+ Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags,
+ Bundle options) throws IntentSender.SendIntentException {
+ mBase.startIntentSender(intent, fillInIntent, flagsMask,
+ flagsValues, extraFlags, options);
+ }
@Override
public void sendBroadcast(Intent intent) {
diff --git a/core/java/android/content/SyncStorageEngine.java b/core/java/android/content/SyncStorageEngine.java
index 7bb9866..9c81c9e 100644
--- a/core/java/android/content/SyncStorageEngine.java
+++ b/core/java/android/content/SyncStorageEngine.java
@@ -1171,7 +1171,7 @@
syncs = new ArrayList<SyncInfo>();
mCurrentSyncs.put(userId, syncs);
}
- return new ArrayList<SyncInfo>(syncs);
+ return syncs;
}
}
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 95b6fee..9bd1940 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -370,4 +370,7 @@
boolean isFirstBoot();
List<UserInfo> getUsers();
+
+ void setPermissionEnforcement(String permission, int enforcement);
+ int getPermissionEnforcement(String permission);
}
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 544bd9c..55426b8 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -1090,6 +1090,11 @@
public static final String EXTRA_VERIFICATION_INSTALL_FLAGS
= "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS";
+ /** {@hide} */
+ public static final int ENFORCEMENT_DEFAULT = 0;
+ /** {@hide} */
+ public static final int ENFORCEMENT_YES = 1;
+
/**
* Retrieve overall information about an application package that is
* installed on the system.
diff --git a/core/java/android/database/AbstractCursor.java b/core/java/android/database/AbstractCursor.java
index b28ed8d..dd6692c 100644
--- a/core/java/android/database/AbstractCursor.java
+++ b/core/java/android/database/AbstractCursor.java
@@ -33,10 +33,39 @@
public abstract class AbstractCursor implements CrossProcessCursor {
private static final String TAG = "Cursor";
- DataSetObservable mDataSetObservable = new DataSetObservable();
- ContentObservable mContentObservable = new ContentObservable();
+ /**
+ * @deprecated This is never updated by this class and should not be used
+ */
+ @Deprecated
+ protected HashMap<Long, Map<String, Object>> mUpdatedRows;
- Bundle mExtras = Bundle.EMPTY;
+ protected int mPos;
+
+ /**
+ * This must be set to the index of the row ID column by any
+ * subclass that wishes to support updates.
+ */
+ protected int mRowIdColumnIndex;
+
+ /**
+ * If {@link #mRowIdColumnIndex} is not -1 this contains contains the value of
+ * the column at {@link #mRowIdColumnIndex} for the current row this cursor is
+ * pointing at.
+ */
+ protected Long mCurrentRowID;
+
+ protected boolean mClosed;
+ protected ContentResolver mContentResolver;
+ private Uri mNotifyUri;
+
+ private final Object mSelfObserverLock = new Object();
+ private ContentObserver mSelfObserver;
+ private boolean mSelfObserverRegistered;
+
+ private DataSetObservable mDataSetObservable = new DataSetObservable();
+ private ContentObservable mContentObservable = new ContentObservable();
+
+ private Bundle mExtras = Bundle.EMPTY;
/* -------------------------------------------------------- */
/* These need to be implemented by subclasses */
@@ -415,30 +444,4 @@
}
}
}
-
- /**
- * @deprecated This is never updated by this class and should not be used
- */
- @Deprecated
- protected HashMap<Long, Map<String, Object>> mUpdatedRows;
-
- /**
- * This must be set to the index of the row ID column by any
- * subclass that wishes to support updates.
- */
- protected int mRowIdColumnIndex;
-
- protected int mPos;
- /**
- * If {@link #mRowIdColumnIndex} is not -1 this contains contains the value of
- * the column at {@link #mRowIdColumnIndex} for the current row this cursor is
- * pointing at.
- */
- protected Long mCurrentRowID;
- protected ContentResolver mContentResolver;
- protected boolean mClosed = false;
- private Uri mNotifyUri;
- private ContentObserver mSelfObserver;
- final private Object mSelfObserverLock = new Object();
- private boolean mSelfObserverRegistered;
}
diff --git a/core/java/android/database/BulkCursorDescriptor.java b/core/java/android/database/BulkCursorDescriptor.java
new file mode 100644
index 0000000..c1e5e63
--- /dev/null
+++ b/core/java/android/database/BulkCursorDescriptor.java
@@ -0,0 +1,78 @@
+/*
+ * 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 android.database;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Describes the properties of a {@link CursorToBulkCursorAdaptor} that are
+ * needed to initialize its {@link BulkCursorToCursorAdaptor} counterpart on the client's end.
+ *
+ * {@hide}
+ */
+public final class BulkCursorDescriptor implements Parcelable {
+ public static final Parcelable.Creator<BulkCursorDescriptor> CREATOR =
+ new Parcelable.Creator<BulkCursorDescriptor>() {
+ @Override
+ public BulkCursorDescriptor createFromParcel(Parcel in) {
+ BulkCursorDescriptor d = new BulkCursorDescriptor();
+ d.readFromParcel(in);
+ return d;
+ }
+
+ @Override
+ public BulkCursorDescriptor[] newArray(int size) {
+ return new BulkCursorDescriptor[size];
+ }
+ };
+
+ public IBulkCursor cursor;
+ public String[] columnNames;
+ public boolean wantsAllOnMoveCalls;
+ public int count;
+ public CursorWindow window;
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeStrongBinder(cursor.asBinder());
+ out.writeStringArray(columnNames);
+ out.writeInt(wantsAllOnMoveCalls ? 1 : 0);
+ out.writeInt(count);
+ if (window != null) {
+ out.writeInt(1);
+ window.writeToParcel(out, flags);
+ } else {
+ out.writeInt(0);
+ }
+ }
+
+ public void readFromParcel(Parcel in) {
+ cursor = BulkCursorNative.asInterface(in.readStrongBinder());
+ columnNames = in.readStringArray();
+ wantsAllOnMoveCalls = in.readInt() != 0;
+ count = in.readInt();
+ if (in.readInt() != 0) {
+ window = CursorWindow.CREATOR.createFromParcel(in);
+ }
+ }
+}
diff --git a/core/java/android/database/BulkCursorNative.java b/core/java/android/database/BulkCursorNative.java
index 67cf0f8..d3c11e78 100644
--- a/core/java/android/database/BulkCursorNative.java
+++ b/core/java/android/database/BulkCursorNative.java
@@ -72,26 +72,6 @@
return true;
}
- case COUNT_TRANSACTION: {
- data.enforceInterface(IBulkCursor.descriptor);
- int count = count();
- reply.writeNoException();
- reply.writeInt(count);
- return true;
- }
-
- case GET_COLUMN_NAMES_TRANSACTION: {
- data.enforceInterface(IBulkCursor.descriptor);
- String[] columnNames = getColumnNames();
- reply.writeNoException();
- reply.writeInt(columnNames.length);
- int length = columnNames.length;
- for (int i = 0; i < length; i++) {
- reply.writeString(columnNames[i]);
- }
- return true;
- }
-
case DEACTIVATE_TRANSACTION: {
data.enforceInterface(IBulkCursor.descriptor);
deactivate();
@@ -125,14 +105,6 @@
return true;
}
- case WANTS_ON_MOVE_TRANSACTION: {
- data.enforceInterface(IBulkCursor.descriptor);
- boolean result = getWantsAllOnMoveCalls();
- reply.writeNoException();
- reply.writeInt(result ? 1 : 0);
- return true;
- }
-
case GET_EXTRAS_TRANSACTION: {
data.enforceInterface(IBulkCursor.descriptor);
Bundle extras = getExtras();
@@ -217,52 +189,6 @@
}
}
- public int count() throws RemoteException
- {
- Parcel data = Parcel.obtain();
- Parcel reply = Parcel.obtain();
- try {
- data.writeInterfaceToken(IBulkCursor.descriptor);
-
- boolean result = mRemote.transact(COUNT_TRANSACTION, data, reply, 0);
- DatabaseUtils.readExceptionFromParcel(reply);
-
- int count;
- if (result == false) {
- count = -1;
- } else {
- count = reply.readInt();
- }
- return count;
- } finally {
- data.recycle();
- reply.recycle();
- }
- }
-
- public String[] getColumnNames() throws RemoteException
- {
- Parcel data = Parcel.obtain();
- Parcel reply = Parcel.obtain();
- try {
- data.writeInterfaceToken(IBulkCursor.descriptor);
-
- mRemote.transact(GET_COLUMN_NAMES_TRANSACTION, data, reply, 0);
- DatabaseUtils.readExceptionFromParcel(reply);
-
- String[] columnNames = null;
- int numColumns = reply.readInt();
- columnNames = new String[numColumns];
- for (int i = 0; i < numColumns; i++) {
- columnNames[i] = reply.readString();
- }
- return columnNames;
- } finally {
- data.recycle();
- reply.recycle();
- }
- }
-
public void deactivate() throws RemoteException
{
Parcel data = Parcel.obtain();
@@ -317,23 +243,6 @@
}
}
- public boolean getWantsAllOnMoveCalls() throws RemoteException {
- Parcel data = Parcel.obtain();
- Parcel reply = Parcel.obtain();
- try {
- data.writeInterfaceToken(IBulkCursor.descriptor);
-
- mRemote.transact(WANTS_ON_MOVE_TRANSACTION, data, reply, 0);
- DatabaseUtils.readExceptionFromParcel(reply);
-
- int result = reply.readInt();
- return result != 0;
- } finally {
- data.recycle();
- reply.recycle();
- }
- }
-
public Bundle getExtras() throws RemoteException {
if (mExtras == null) {
Parcel data = Parcel.obtain();
diff --git a/core/java/android/database/BulkCursorToCursorAdaptor.java b/core/java/android/database/BulkCursorToCursorAdaptor.java
index 885046b..98c7043 100644
--- a/core/java/android/database/BulkCursorToCursorAdaptor.java
+++ b/core/java/android/database/BulkCursorToCursorAdaptor.java
@@ -30,34 +30,23 @@
private SelfContentObserver mObserverBridge = new SelfContentObserver(this);
private IBulkCursor mBulkCursor;
- private int mCount;
private String[] mColumns;
private boolean mWantsAllOnMoveCalls;
+ private int mCount;
/**
* Initializes the adaptor.
* Must be called before first use.
*/
- public void initialize(IBulkCursor bulkCursor, int count, int idIndex,
- boolean wantsAllOnMoveCalls) {
- mBulkCursor = bulkCursor;
- mColumns = null; // lazily retrieved
- mCount = count;
- mRowIdColumnIndex = idIndex;
- mWantsAllOnMoveCalls = wantsAllOnMoveCalls;
- }
-
- /**
- * Returns column index of "_id" column, or -1 if not found.
- */
- public static int findRowIdColumnIndex(String[] columnNames) {
- int length = columnNames.length;
- for (int i = 0; i < length; i++) {
- if (columnNames[i].equals("_id")) {
- return i;
- }
+ public void initialize(BulkCursorDescriptor d) {
+ mBulkCursor = d.cursor;
+ mColumns = d.columnNames;
+ mRowIdColumnIndex = DatabaseUtils.findRowIdColumnIndex(mColumns);
+ mWantsAllOnMoveCalls = d.wantsAllOnMoveCalls;
+ mCount = d.count;
+ if (d.window != null) {
+ setWindow(d.window);
}
- return -1;
}
/**
@@ -169,14 +158,6 @@
public String[] getColumnNames() {
throwIfCursorIsClosed();
- if (mColumns == null) {
- try {
- mColumns = mBulkCursor.getColumnNames();
- } catch (RemoteException ex) {
- Log.e(TAG, "Unable to fetch column names because the remote process is dead");
- return null;
- }
- }
return mColumns;
}
diff --git a/core/java/android/database/CursorToBulkCursorAdaptor.java b/core/java/android/database/CursorToBulkCursorAdaptor.java
index 167278a..525be96 100644
--- a/core/java/android/database/CursorToBulkCursorAdaptor.java
+++ b/core/java/android/database/CursorToBulkCursorAdaptor.java
@@ -132,6 +132,25 @@
}
}
+ public BulkCursorDescriptor getBulkCursorDescriptor() {
+ synchronized (mLock) {
+ throwIfCursorIsClosed();
+
+ BulkCursorDescriptor d = new BulkCursorDescriptor();
+ d.cursor = this;
+ d.columnNames = mCursor.getColumnNames();
+ d.wantsAllOnMoveCalls = mCursor.getWantsAllOnMoveCalls();
+ d.count = mCursor.getCount();
+ d.window = mCursor.getWindow();
+ if (d.window != null) {
+ // Acquire a reference to the window because its reference count will be
+ // decremented when it is returned as part of the binder call reply parcel.
+ d.window.acquireReference();
+ }
+ return d;
+ }
+ }
+
@Override
public CursorWindow getWindow(int position) {
synchronized (mLock) {
@@ -157,10 +176,9 @@
mCursor.fillWindow(position, window);
}
- // Acquire a reference before returning from this RPC.
- // The Binder proxy will decrement the reference count again as part of writing
- // the CursorWindow to the reply parcel as a return value.
if (window != null) {
+ // Acquire a reference to the window because its reference count will be
+ // decremented when it is returned as part of the binder call reply parcel.
window.acquireReference();
}
return window;
@@ -177,24 +195,6 @@
}
@Override
- public int count() {
- synchronized (mLock) {
- throwIfCursorIsClosed();
-
- return mCursor.getCount();
- }
- }
-
- @Override
- public String[] getColumnNames() {
- synchronized (mLock) {
- throwIfCursorIsClosed();
-
- return mCursor.getColumnNames();
- }
- }
-
- @Override
public void deactivate() {
synchronized (mLock) {
if (mCursor != null) {
@@ -237,15 +237,6 @@
}
}
- @Override
- public boolean getWantsAllOnMoveCalls() {
- synchronized (mLock) {
- throwIfCursorIsClosed();
-
- return mCursor.getWantsAllOnMoveCalls();
- }
- }
-
/**
* Create a ContentObserver from the observer and register it as an observer on the
* underlying cursor.
diff --git a/core/java/android/database/DatabaseUtils.java b/core/java/android/database/DatabaseUtils.java
index 99d260e..40a54cf 100644
--- a/core/java/android/database/DatabaseUtils.java
+++ b/core/java/android/database/DatabaseUtils.java
@@ -1386,4 +1386,18 @@
System.arraycopy(newValues, 0, result, originalValues.length, newValues.length);
return result;
}
+
+ /**
+ * Returns column index of "_id" column, or -1 if not found.
+ * @hide
+ */
+ public static int findRowIdColumnIndex(String[] columnNames) {
+ int length = columnNames.length;
+ for (int i = 0; i < length; i++) {
+ if (columnNames[i].equals("_id")) {
+ return i;
+ }
+ }
+ return -1;
+ }
}
diff --git a/core/java/android/database/IBulkCursor.java b/core/java/android/database/IBulkCursor.java
index 0f4500a..b551116 100644
--- a/core/java/android/database/IBulkCursor.java
+++ b/core/java/android/database/IBulkCursor.java
@@ -43,29 +43,12 @@
*/
public void onMove(int position) throws RemoteException;
- /**
- * Returns the number of rows in the cursor.
- *
- * @return the number of rows in the cursor.
- */
- public int count() throws RemoteException;
-
- /**
- * Returns a string array holding the names of all of the columns in the
- * cursor in the order in which they were listed in the result.
- *
- * @return the names of the columns returned in this query.
- */
- public String[] getColumnNames() throws RemoteException;
-
public void deactivate() throws RemoteException;
public void close() throws RemoteException;
public int requery(IContentObserver observer) throws RemoteException;
- boolean getWantsAllOnMoveCalls() throws RemoteException;
-
Bundle getExtras() throws RemoteException;
Bundle respond(Bundle extras) throws RemoteException;
@@ -74,13 +57,10 @@
static final String descriptor = "android.content.IBulkCursor";
static final int GET_CURSOR_WINDOW_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION;
- static final int COUNT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 1;
- static final int GET_COLUMN_NAMES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 2;
- static final int DEACTIVATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 5;
- static final int REQUERY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 6;
- static final int ON_MOVE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 7;
- static final int WANTS_ON_MOVE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 8;
- static final int GET_EXTRAS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 9;
- static final int RESPOND_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 10;
- static final int CLOSE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 11;
+ static final int DEACTIVATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 1;
+ static final int REQUERY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 2;
+ static final int ON_MOVE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 3;
+ static final int GET_EXTRAS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 4;
+ static final int RESPOND_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 5;
+ static final int CLOSE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 6;
}
diff --git a/core/java/android/database/SQLException.java b/core/java/android/database/SQLException.java
index 0386af0..3402026 100644
--- a/core/java/android/database/SQLException.java
+++ b/core/java/android/database/SQLException.java
@@ -19,12 +19,15 @@
/**
* An exception that indicates there was an error with SQL parsing or execution.
*/
-public class SQLException extends RuntimeException
-{
- public SQLException() {}
+public class SQLException extends RuntimeException {
+ public SQLException() {
+ }
- public SQLException(String error)
- {
+ public SQLException(String error) {
super(error);
}
+
+ public SQLException(String error, Throwable cause) {
+ super(error, cause);
+ }
}
diff --git a/core/java/android/database/sqlite/SQLiteConnection.java b/core/java/android/database/sqlite/SQLiteConnection.java
index 0db3e4f..e2c222b 100644
--- a/core/java/android/database/sqlite/SQLiteConnection.java
+++ b/core/java/android/database/sqlite/SQLiteConnection.java
@@ -99,6 +99,7 @@
private final SQLiteDatabaseConfiguration mConfiguration;
private final int mConnectionId;
private final boolean mIsPrimaryConnection;
+ private final boolean mIsReadOnlyConnection;
private final PreparedStatementCache mPreparedStatementCache;
private PreparedStatement mPreparedStatementPool;
@@ -111,7 +112,7 @@
private boolean mOnlyAllowReadOnlyOperations;
// The number of times attachCancellationSignal has been called.
- // Because SQLite statement execution can be re-entrant, we keep track of how many
+ // Because SQLite statement execution can be reentrant, we keep track of how many
// times we have attempted to attach a cancellation signal to the connection so that
// we can ensure that we detach the signal at the right time.
private int mCancellationSignalAttachCount;
@@ -121,7 +122,7 @@
private static native void nativeClose(int connectionPtr);
private static native void nativeRegisterCustomFunction(int connectionPtr,
SQLiteCustomFunction function);
- private static native void nativeSetLocale(int connectionPtr, String locale);
+ private static native void nativeRegisterLocalizedCollators(int connectionPtr, String locale);
private static native int nativePrepareStatement(int connectionPtr, String sql);
private static native void nativeFinalizeStatement(int connectionPtr, int statementPtr);
private static native int nativeGetParameterCount(int connectionPtr, int statementPtr);
@@ -163,6 +164,7 @@
mConfiguration = new SQLiteDatabaseConfiguration(configuration);
mConnectionId = connectionId;
mIsPrimaryConnection = primaryConnection;
+ mIsReadOnlyConnection = (configuration.openFlags & SQLiteDatabase.OPEN_READONLY) != 0;
mPreparedStatementCache = new PreparedStatementCache(
mConfiguration.maxSqlCacheSize);
mCloseGuard.open("close");
@@ -237,45 +239,102 @@
}
private void setPageSize() {
- if (!mConfiguration.isInMemoryDb()) {
- execute("PRAGMA page_size=" + SQLiteGlobal.getDefaultPageSize(), null, null);
+ if (!mConfiguration.isInMemoryDb() && !mIsReadOnlyConnection) {
+ final long newValue = SQLiteGlobal.getDefaultPageSize();
+ long value = executeForLong("PRAGMA page_size", null, null);
+ if (value != newValue) {
+ execute("PRAGMA page_size=" + newValue, null, null);
+ }
}
}
private void setAutoCheckpointInterval() {
- if (!mConfiguration.isInMemoryDb()) {
- executeForLong("PRAGMA wal_autocheckpoint=" + SQLiteGlobal.getWALAutoCheckpoint(),
- null, null);
+ if (!mConfiguration.isInMemoryDb() && !mIsReadOnlyConnection) {
+ final long newValue = SQLiteGlobal.getWALAutoCheckpoint();
+ long value = executeForLong("PRAGMA wal_autocheckpoint", null, null);
+ if (value != newValue) {
+ executeForLong("PRAGMA wal_autocheckpoint=" + newValue, null, null);
+ }
}
}
private void setJournalSizeLimit() {
- if (!mConfiguration.isInMemoryDb()) {
- executeForLong("PRAGMA journal_size_limit=" + SQLiteGlobal.getJournalSizeLimit(),
- null, null);
+ if (!mConfiguration.isInMemoryDb() && !mIsReadOnlyConnection) {
+ final long newValue = SQLiteGlobal.getJournalSizeLimit();
+ long value = executeForLong("PRAGMA journal_size_limit", null, null);
+ if (value != newValue) {
+ executeForLong("PRAGMA journal_size_limit=" + newValue, null, null);
+ }
}
}
private void setSyncModeFromConfiguration() {
- if (!mConfiguration.isInMemoryDb()) {
- execute("PRAGMA synchronous=" + mConfiguration.syncMode, null, null);
+ if (!mConfiguration.isInMemoryDb() && !mIsReadOnlyConnection) {
+ final String newValue = mConfiguration.syncMode;
+ String value = executeForString("PRAGMA synchronous", null, null);
+ if (!value.equalsIgnoreCase(newValue)) {
+ execute("PRAGMA synchronous=" + newValue, null, null);
+ }
}
}
private void setJournalModeFromConfiguration() {
- if (!mConfiguration.isInMemoryDb()) {
- String result = executeForString("PRAGMA journal_mode=" + mConfiguration.journalMode,
- null, null);
- if (!result.equalsIgnoreCase(mConfiguration.journalMode)) {
- Log.e(TAG, "setting journal_mode to " + mConfiguration.journalMode
- + " failed for db: " + mConfiguration.label
- + " (on pragma set journal_mode, sqlite returned:" + result);
+ if (!mConfiguration.isInMemoryDb() && !mIsReadOnlyConnection) {
+ final String newValue = mConfiguration.journalMode;
+ String value = executeForString("PRAGMA journal_mode", null, null);
+ if (!value.equalsIgnoreCase(newValue)) {
+ value = executeForString("PRAGMA journal_mode=" + newValue, null, null);
+ if (!value.equalsIgnoreCase(newValue)) {
+ Log.e(TAG, "setting journal_mode to " + newValue
+ + " failed for db: " + mConfiguration.label
+ + " (on pragma set journal_mode, sqlite returned:" + value);
+ }
}
}
}
private void setLocaleFromConfiguration() {
- nativeSetLocale(mConnectionPtr, mConfiguration.locale.toString());
+ if ((mConfiguration.openFlags & SQLiteDatabase.NO_LOCALIZED_COLLATORS) != 0) {
+ return;
+ }
+
+ // Register the localized collators.
+ final String newLocale = mConfiguration.locale.toString();
+ nativeRegisterLocalizedCollators(mConnectionPtr, newLocale);
+
+ // If the database is read-only, we cannot modify the android metadata table
+ // or existing indexes.
+ if (mIsReadOnlyConnection) {
+ return;
+ }
+
+ try {
+ // Ensure the android metadata table exists.
+ execute("CREATE TABLE IF NOT EXISTS android_metadata (locale TEXT)", null, null);
+
+ // Check whether the locale was actually changed.
+ final String oldLocale = executeForString("SELECT locale FROM android_metadata "
+ + "UNION SELECT NULL ORDER BY locale DESC LIMIT 1", null, null);
+ if (oldLocale != null && oldLocale.equals(newLocale)) {
+ return;
+ }
+
+ // Go ahead and update the indexes using the new locale.
+ execute("BEGIN", null, null);
+ boolean success = false;
+ try {
+ execute("DELETE FROM android_metadata", null, null);
+ execute("INSERT INTO android_metadata (locale) VALUES(?)",
+ new Object[] { newLocale }, null);
+ execute("REINDEX LOCALIZED", null, null);
+ success = true;
+ } finally {
+ execute(success ? "COMMIT" : "ROLLBACK", null, null);
+ }
+ } catch (RuntimeException ex) {
+ throw new SQLiteException("Failed to change locale for db '" + mConfiguration.label
+ + "' to '" + newLocale + "'.", ex);
+ }
}
// Called by SQLiteConnectionPool only.
diff --git a/core/java/android/database/sqlite/SQLiteCursor.java b/core/java/android/database/sqlite/SQLiteCursor.java
index 82bb23e..b29897e 100644
--- a/core/java/android/database/sqlite/SQLiteCursor.java
+++ b/core/java/android/database/sqlite/SQLiteCursor.java
@@ -105,12 +105,7 @@
mQuery = query;
mColumns = query.getColumnNames();
- for (int i = 0; i < mColumns.length; i++) {
- // Make note of the row ID column index for quick access to it
- if ("_id".equals(mColumns[i])) {
- mRowIdColumnIndex = i;
- }
- }
+ mRowIdColumnIndex = DatabaseUtils.findRowIdColumnIndex(mColumns);
}
/**
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index d41b484..bf32ea7 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -1718,7 +1718,7 @@
/**
* Sets the locale for this database. Does nothing if this database has
- * the NO_LOCALIZED_COLLATORS flag set or was opened read only.
+ * the {@link #NO_LOCALIZED_COLLATORS} flag set or was opened read only.
*
* @param locale The new locale.
*
diff --git a/core/java/android/database/sqlite/SQLiteException.java b/core/java/android/database/sqlite/SQLiteException.java
index 3a97bfb..a1d9c9f 100644
--- a/core/java/android/database/sqlite/SQLiteException.java
+++ b/core/java/android/database/sqlite/SQLiteException.java
@@ -22,9 +22,14 @@
* A SQLite exception that indicates there was an error with SQL parsing or execution.
*/
public class SQLiteException extends SQLException {
- public SQLiteException() {}
+ public SQLiteException() {
+ }
public SQLiteException(String error) {
super(error);
}
+
+ public SQLiteException(String error, Throwable cause) {
+ super(error, cause);
+ }
}
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index 2775c7b..83b6986 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -236,6 +236,50 @@
/**
* Creates a new Camera object to access a particular hardware camera.
*
+ * <p>When <code>force</code> is set to false, this will throw an exception
+ * if the same camera is already opened by other clients. If true, the other
+ * client will be disconnected from the camera they opened. If the device
+ * can only support one camera running at a time, all camera-using clients
+ * will be disconnected from their cameras.
+ *
+ * <p>A camera being held by an application can be taken away by other
+ * applications at any time. Before the camera is taken, applications will
+ * get {@link #CAMERA_ERROR_RELEASED} and have some time to clean up. Apps
+ * receiving this callback must immediately stop video recording and then
+ * call {@link #release()} on their camera object. Otherwise, it will be
+ * released by the frameworks in a short time. After receiving
+ * CAMERA_ERROR_RELEASED, apps should not call any method except <code>
+ * release</code> and {@link #isReleased()}. After a camera is taken away,
+ * all methods will throw exceptions except <code>isReleased</code> and
+ * <code>release</code>. Apps can use <code>isReleased</code> to see if the
+ * camera has been taken away. If the camera is taken away, the apps can
+ * silently finish themselves or show a dialog.
+ *
+ * <p>Applications with android.permission.KEEP_CAMERA can request to keep
+ * the camera. That is, the camera will not be taken by other applications
+ * while it is opened. The permission can only be obtained by trusted
+ * platform applications, such as those implementing lock screen security
+ * features.
+ *
+ * @param cameraId the hardware camera to access, between 0 and
+ * {@link #getNumberOfCameras()}-1.
+ * @param force true to take the ownership from the existing client if the
+ * camera has been opened by other clients.
+ * @param keep true if the applications do not want other apps to take the
+ * camera. Only the apps with android.permission.KEEP_CAMERA can keep
+ * the camera.
+ * @return a new Camera object, connected, locked and ready for use.
+ * @hide
+ */
+ public static Camera open(int cameraId, boolean force, boolean keep) {
+ return new Camera(cameraId, force, keep);
+ }
+
+ /**
+ * Creates a new Camera object to access a particular hardware camera. If
+ * the same camera is opened by other applications, this will throw a
+ * RuntimeException.
+ *
* <p>You must call {@link #release()} when you are done using the camera,
* otherwise it will remain locked and be unavailable to other applications.
*
@@ -255,13 +299,13 @@
* @param cameraId the hardware camera to access, between 0 and
* {@link #getNumberOfCameras()}-1.
* @return a new Camera object, connected, locked and ready for use.
- * @throws RuntimeException if connection to the camera service fails (for
- * example, if the camera is in use by another process or device policy
- * manager has disabled the camera).
+ * @throws RuntimeException if opening the camera fails (for example, if the
+ * camera is in use by another process or device policy manager has
+ * disabled the camera).
* @see android.app.admin.DevicePolicyManager#getCameraDisabled(android.content.ComponentName)
*/
public static Camera open(int cameraId) {
- return new Camera(cameraId);
+ return new Camera(cameraId, false, false);
}
/**
@@ -276,13 +320,13 @@
for (int i = 0; i < numberOfCameras; i++) {
getCameraInfo(i, cameraInfo);
if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
- return new Camera(i);
+ return new Camera(i, false, false);
}
}
return null;
}
- Camera(int cameraId) {
+ Camera(int cameraId, boolean force, boolean keep) {
mShutterCallback = null;
mRawImageCallback = null;
mJpegCallback = null;
@@ -299,7 +343,7 @@
mEventHandler = null;
}
- native_setup(new WeakReference<Camera>(this), cameraId);
+ native_setup(new WeakReference<Camera>(this), cameraId, force, keep);
}
/**
@@ -312,7 +356,8 @@
release();
}
- private native final void native_setup(Object camera_this, int cameraId);
+ private native final void native_setup(Object camera_this, int cameraId,
+ boolean force, boolean keep);
private native final void native_release();
@@ -327,6 +372,18 @@
}
/**
+ * Whether the camera is released. When any camera method throws an
+ * exception, applications can use this to check whether the camera has been
+ * taken by other clients. If true, it means other clients have taken the
+ * camera. The applications can silently finish themselves or show a dialog.
+ *
+ * @return whether the camera is released.
+ * @see #open(int, boolean, boolean)
+ * @hide
+ */
+ public native final boolean isReleased();
+
+ /**
* Unlocks the camera to allow another process to access it.
* Normally, the camera is locked to the process with an active Camera
* object until {@link #release()} is called. To allow rapid handoff
@@ -437,6 +494,13 @@
* instances of the same camera, or across multiple runs of the same
* program.
*
+ * <p>If you are using the preview data to create video or still images,
+ * strongly consider using {@link android.media.MediaActionSound} to
+ * properly indicate image capture or recording start/stop to the user.</p>
+ *
+ * @see android.media.MediaActionSound
+ * @see android.graphics.SurfaceTexture
+ * @see android.view.TextureView
* @param surfaceTexture the {@link SurfaceTexture} to which the preview
* images are to be sent or null to remove the current preview surface
* texture
@@ -512,13 +576,19 @@
public native final boolean previewEnabled();
/**
- * Installs a callback to be invoked for every preview frame in addition
+ * <p>Installs a callback to be invoked for every preview frame in addition
* to displaying them on the screen. The callback will be repeatedly called
* for as long as preview is active. This method can be called at any time,
- * even while preview is live. Any other preview callbacks are overridden.
+ * even while preview is live. Any other preview callbacks are
+ * overridden.</p>
+ *
+ * <p>If you are using the preview data to create video or still images,
+ * strongly consider using {@link android.media.MediaActionSound} to
+ * properly indicate image capture or recording start/stop to the user.</p>
*
* @param cb a callback object that receives a copy of each preview frame,
* or null to stop receiving callbacks.
+ * @see android.media.MediaActionSound
*/
public final void setPreviewCallback(PreviewCallback cb) {
mPreviewCallback = cb;
@@ -530,13 +600,18 @@
}
/**
- * Installs a callback to be invoked for the next preview frame in addition
- * to displaying it on the screen. After one invocation, the callback is
- * cleared. This method can be called any time, even when preview is live.
- * Any other preview callbacks are overridden.
+ * <p>Installs a callback to be invoked for the next preview frame in
+ * addition to displaying it on the screen. After one invocation, the
+ * callback is cleared. This method can be called any time, even when
+ * preview is live. Any other preview callbacks are overridden.</p>
+ *
+ * <p>If you are using the preview data to create video or still images,
+ * strongly consider using {@link android.media.MediaActionSound} to
+ * properly indicate image capture or recording start/stop to the user.</p>
*
* @param cb a callback object that receives a copy of the next preview frame,
* or null to stop receiving callbacks.
+ * @see android.media.MediaActionSound
*/
public final void setOneShotPreviewCallback(PreviewCallback cb) {
mPreviewCallback = cb;
@@ -548,24 +623,30 @@
private native final void setHasPreviewCallback(boolean installed, boolean manualBuffer);
/**
- * Installs a callback to be invoked for every preview frame, using buffers
- * supplied with {@link #addCallbackBuffer(byte[])}, in addition to
+ * <p>Installs a callback to be invoked for every preview frame, using
+ * buffers supplied with {@link #addCallbackBuffer(byte[])}, in addition to
* displaying them on the screen. The callback will be repeatedly called
- * for as long as preview is active and buffers are available.
- * Any other preview callbacks are overridden.
+ * for as long as preview is active and buffers are available. Any other
+ * preview callbacks are overridden.</p>
*
* <p>The purpose of this method is to improve preview efficiency and frame
* rate by allowing preview frame memory reuse. You must call
* {@link #addCallbackBuffer(byte[])} at some point -- before or after
- * calling this method -- or no callbacks will received.
+ * calling this method -- or no callbacks will received.</p>
*
- * The buffer queue will be cleared if this method is called with a null
+ * <p>The buffer queue will be cleared if this method is called with a null
* callback, {@link #setPreviewCallback(Camera.PreviewCallback)} is called,
- * or {@link #setOneShotPreviewCallback(Camera.PreviewCallback)} is called.
+ * or {@link #setOneShotPreviewCallback(Camera.PreviewCallback)} is
+ * called.</p>
+ *
+ * <p>If you are using the preview data to create video or still images,
+ * strongly consider using {@link android.media.MediaActionSound} to
+ * properly indicate image capture or recording start/stop to the user.</p>
*
* @param cb a callback object that receives a copy of the preview frame,
* or null to stop receiving callbacks and clear the buffer queue.
* @see #addCallbackBuffer(byte[])
+ * @see android.media.MediaActionSound
*/
public final void setPreviewCallbackWithBuffer(PreviewCallback cb) {
mPreviewCallback = cb;
@@ -834,10 +915,15 @@
* the focus position. Applications must call cancelAutoFocus to reset the
* focus.</p>
*
+ * <p>If autofocus is successful, consider using
+ * {@link android.media.MediaActionSound} to properly play back an autofocus
+ * success sound to the user.</p>
+ *
* @param cb the callback to run
* @see #cancelAutoFocus()
* @see android.hardware.Camera.Parameters#setAutoExposureLock(boolean)
* @see android.hardware.Camera.Parameters#setAutoWhiteBalanceLock(boolean)
+ * @see android.media.MediaActionSound
*/
public final void autoFocus(AutoFocusCallback cb)
{
@@ -1293,6 +1379,17 @@
public static final int CAMERA_ERROR_UNKNOWN = 1;
/**
+ * Camera was released because another client has opened the camera. The
+ * application should call {@link #release()} after getting this. The apps
+ * should not call any method except <code>release</code> and {@link #isReleased()}
+ * after this.
+ *
+ * @see Camera.ErrorCallback
+ * @hide
+ */
+ public static final int CAMERA_ERROR_RELEASED = 2;
+
+ /**
* Media server died. In this case, the application must release the
* Camera object and instantiate a new one.
* @see Camera.ErrorCallback
@@ -1907,12 +2004,12 @@
* @param value the String value of the parameter
*/
public void set(String key, String value) {
- if (key.indexOf('=') != -1 || key.indexOf(';') != -1) {
- Log.e(TAG, "Key \"" + key + "\" contains invalid character (= or ;)");
+ if (key.indexOf('=') != -1 || key.indexOf(';') != -1 || key.indexOf(0) != -1) {
+ Log.e(TAG, "Key \"" + key + "\" contains invalid character (= or ; or \\0)");
return;
}
- if (value.indexOf('=') != -1 || value.indexOf(';') != -1) {
- Log.e(TAG, "Value \"" + value + "\" contains invalid character (= or ;)");
+ if (value.indexOf('=') != -1 || value.indexOf(';') != -1 || value.indexOf(0) != -1) {
+ Log.e(TAG, "Value \"" + value + "\" contains invalid character (= or ; or \\0)");
return;
}
diff --git a/core/java/android/hardware/GeomagneticField.java b/core/java/android/hardware/GeomagneticField.java
index 96fbe77..0369825 100644
--- a/core/java/android/hardware/GeomagneticField.java
+++ b/core/java/android/hardware/GeomagneticField.java
@@ -19,7 +19,7 @@
import java.util.GregorianCalendar;
/**
- * This class is used to estimated estimate magnetic field at a given point on
+ * Estimates magnetic field at a given point on
* Earth, and in particular, to compute the magnetic declination from true
* north.
*
diff --git a/core/java/android/net/NetworkIdentity.java b/core/java/android/net/NetworkIdentity.java
index 1a74abf..ee12989 100644
--- a/core/java/android/net/NetworkIdentity.java
+++ b/core/java/android/net/NetworkIdentity.java
@@ -31,6 +31,14 @@
* @hide
*/
public class NetworkIdentity {
+ /**
+ * When enabled, combine all {@link #mSubType} together under
+ * {@link #SUBTYPE_COMBINED}.
+ */
+ public static final boolean COMBINE_SUBTYPE_ENABLED = true;
+
+ public static final int SUBTYPE_COMBINED = -1;
+
final int mType;
final int mSubType;
final String mSubscriberId;
@@ -38,7 +46,7 @@
public NetworkIdentity(int type, int subType, String subscriberId, boolean roaming) {
this.mType = type;
- this.mSubType = subType;
+ this.mSubType = COMBINE_SUBTYPE_ENABLED ? SUBTYPE_COMBINED : subType;
this.mSubscriberId = subscriberId;
this.mRoaming = roaming;
}
@@ -52,9 +60,8 @@
public boolean equals(Object obj) {
if (obj instanceof NetworkIdentity) {
final NetworkIdentity ident = (NetworkIdentity) obj;
- return mType == ident.mType && mSubType == ident.mSubType
- && Objects.equal(mSubscriberId, ident.mSubscriberId)
- && mRoaming == ident.mRoaming;
+ return mType == ident.mType && mSubType == ident.mSubType && mRoaming == ident.mRoaming
+ && Objects.equal(mSubscriberId, ident.mSubscriberId);
}
return false;
}
@@ -63,7 +70,9 @@
public String toString() {
final String typeName = ConnectivityManager.getNetworkTypeName(mType);
final String subTypeName;
- if (ConnectivityManager.isNetworkTypeMobile(mType)) {
+ if (COMBINE_SUBTYPE_ENABLED) {
+ subTypeName = "COMBINED";
+ } else if (ConnectivityManager.isNetworkTypeMobile(mType)) {
subTypeName = TelephonyManager.getNetworkTypeName(mSubType);
} else {
subTypeName = Integer.toString(mSubType);
@@ -130,5 +139,4 @@
}
return new NetworkIdentity(type, subType, subscriberId, roaming);
}
-
}
diff --git a/core/java/android/net/NetworkTemplate.java b/core/java/android/net/NetworkTemplate.java
index 8ebfd8d..e1fbdcc 100644
--- a/core/java/android/net/NetworkTemplate.java
+++ b/core/java/android/net/NetworkTemplate.java
@@ -20,6 +20,7 @@
import static android.net.ConnectivityManager.TYPE_WIFI;
import static android.net.ConnectivityManager.TYPE_WIFI_P2P;
import static android.net.ConnectivityManager.TYPE_WIMAX;
+import static android.net.NetworkIdentity.COMBINE_SUBTYPE_ENABLED;
import static android.net.NetworkIdentity.scrubSubscriberId;
import static android.telephony.TelephonyManager.NETWORK_CLASS_2_G;
import static android.telephony.TelephonyManager.NETWORK_CLASS_3_G;
@@ -199,6 +200,7 @@
* Check if mobile network classified 3G or lower with matching IMSI.
*/
private boolean matchesMobile3gLower(NetworkIdentity ident) {
+ ensureSubtypeAvailable();
if (ident.mType == TYPE_WIMAX) {
return false;
} else if (matchesMobile(ident)) {
@@ -216,6 +218,7 @@
* Check if mobile network classified 4G with matching IMSI.
*/
private boolean matchesMobile4g(NetworkIdentity ident) {
+ ensureSubtypeAvailable();
if (ident.mType == TYPE_WIMAX) {
// TODO: consider matching against WiMAX subscriber identity
return true;
@@ -268,6 +271,13 @@
}
}
+ private static void ensureSubtypeAvailable() {
+ if (COMBINE_SUBTYPE_ENABLED) {
+ throw new IllegalArgumentException(
+ "Unable to enforce 3G_LOWER template on combined data.");
+ }
+ }
+
public static final Creator<NetworkTemplate> CREATOR = new Creator<NetworkTemplate>() {
public NetworkTemplate createFromParcel(Parcel in) {
return new NetworkTemplate(in);
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index 6139296..770bf1c 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -98,6 +98,12 @@
public static final int SDCARD_RW_GID = 1015;
/**
+ * Defines the UID/GID for the group that controls VPN services.
+ * @hide
+ */
+ public static final int VPN_UID = 1016;
+
+ /**
* Defines the UID/GID for the NFC service process.
* @hide
*/
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java
index 759be91..ce213fb 100644
--- a/core/java/android/os/StrictMode.java
+++ b/core/java/android/os/StrictMode.java
@@ -1201,7 +1201,7 @@
// throttled back to 60fps via SurfaceFlinger/View
// invalidates, _not_ by posting frame updates every 16
// milliseconds.
- threadHandler.get().post(new Runnable() {
+ threadHandler.get().postAtFrontOfQueue(new Runnable() {
public void run() {
long loopFinishTime = SystemClock.uptimeMillis();
diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java
index 0e6d07d..9612151 100755
--- a/core/java/android/provider/Telephony.java
+++ b/core/java/android/provider/Telephony.java
@@ -596,8 +596,8 @@
* values:</p>
*
* <ul>
- * <li><em>pdus</em> - An Object[] of byte[]s containing the PDUs
- * that make up the message.</li>
+ * <li><em>message</em> - An SmsCbMessage object containing the broadcast message
+ * data. This is not an emergency alert, so ETWS and CMAS data will be null.</li>
* </ul>
*
* <p>The extra values can be extracted using
@@ -616,8 +616,8 @@
* values:</p>
*
* <ul>
- * <li><em>pdus</em> - An Object[] of byte[]s containing the PDUs
- * that make up the message.</li>
+ * <li><em>message</em> - An SmsCbMessage object containing the broadcast message
+ * data, including ETWS or CMAS warning notification info if present.</li>
* </ul>
*
* <p>The extra values can be extracted using
@@ -631,6 +631,26 @@
"android.provider.Telephony.SMS_EMERGENCY_CB_RECEIVED";
/**
+ * Broadcast Action: A new CDMA SMS has been received containing Service Category
+ * Program Data (updates the list of enabled broadcast channels). The intent will
+ * have the following extra values:</p>
+ *
+ * <ul>
+ * <li><em>operations</em> - An array of CdmaSmsCbProgramData objects containing
+ * the service category operations (add/delete/clear) to perform.</li>
+ * </ul>
+ *
+ * <p>The extra values can be extracted using
+ * {@link #getMessagesFromIntent(Intent)}.</p>
+ *
+ * <p>If a BroadcastReceiver encounters an error while processing
+ * this intent it should set the result code appropriately.</p>
+ */
+ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+ public static final String SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED_ACTION =
+ "android.provider.Telephony.SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED";
+
+ /**
* Broadcast Action: The SIM storage for SMS messages is full. If
* space is not freed, messages targeted for the SIM (class 2) may
* not be saved.
diff --git a/core/java/android/text/DynamicLayout.java b/core/java/android/text/DynamicLayout.java
index 026af34..5f2d642 100644
--- a/core/java/android/text/DynamicLayout.java
+++ b/core/java/android/text/DynamicLayout.java
@@ -20,6 +20,8 @@
import android.text.style.UpdateLayout;
import android.text.style.WrapTogetherSpan;
+import com.android.internal.util.ArrayUtils;
+
import java.lang.ref.WeakReference;
/**
@@ -30,8 +32,7 @@
* {@link android.graphics.Canvas#drawText(java.lang.CharSequence, int, int, float, float, android.graphics.Paint)
* Canvas.drawText()} directly.</p>
*/
-public class DynamicLayout
-extends Layout
+public class DynamicLayout extends Layout
{
private static final int PRIORITY = 128;
@@ -116,6 +117,10 @@
mObjects = new PackedObjectVector<Directions>(1);
+ mBlockEnds = new int[] { 0 };
+ mBlockIndices = new int[] { INVALID_BLOCK_INDEX };
+ mNumberOfBlocks = 1;
+
mIncludePad = includepad;
/*
@@ -295,9 +300,9 @@
n--;
// remove affected lines from old layout
-
mInts.deleteAt(startline, endline - startline);
mObjects.deleteAt(startline, endline - startline);
+ updateBlocks(startline, endline - 1, n);
// adjust offsets in layout for new height and offsets
@@ -363,6 +368,124 @@
}
}
+ /**
+ * This method is called every time the layout is reflowed after an edition.
+ * It updates the internal block data structure. The text is split in blocks
+ * of contiguous lines, with at least one block for the entire text.
+ * When a range of lines is edited, new blocks (from 0 to 3 depending on the
+ * overlap structure) will replace the set of overlapping blocks.
+ * Blocks are listed in order and are represented by their ending line number.
+ * An index is associated to each block (which will be used by display lists),
+ * this class simply invalidates the index of blocks overlapping a modification.
+ *
+ * @param startLine the first line of the range of modified lines
+ * @param endLine the last line of the range, possibly equal to startLine, lower
+ * than getLineCount()
+ * @param newLineCount the number of lines that will replace the range, possibly 0
+ */
+ private void updateBlocks(int startLine, int endLine, int newLineCount) {
+ int firstBlock = -1;
+ int lastBlock = -1;
+ for (int i = 0; i < mNumberOfBlocks; i++) {
+ if (mBlockEnds[i] >= startLine) {
+ firstBlock = i;
+ break;
+ }
+ }
+ for (int i = firstBlock; i < mNumberOfBlocks; i++) {
+ if (mBlockEnds[i] >= endLine) {
+ lastBlock = i;
+ break;
+ }
+ }
+ final int lastBlockEndLine = mBlockEnds[lastBlock];
+
+ boolean createBlockBefore = startLine > (firstBlock == 0 ? 0 :
+ mBlockEnds[firstBlock - 1] + 1);
+ boolean createBlock = newLineCount > 0;
+ boolean createBlockAfter = endLine < mBlockEnds[lastBlock];
+
+ int numAddedBlocks = 0;
+ if (createBlockBefore) numAddedBlocks++;
+ if (createBlock) numAddedBlocks++;
+ if (createBlockAfter) numAddedBlocks++;
+
+ final int numRemovedBlocks = lastBlock - firstBlock + 1;
+ final int newNumberOfBlocks = mNumberOfBlocks + numAddedBlocks - numRemovedBlocks;
+
+ if (newNumberOfBlocks == 0) {
+ // Even when text is empty, there is actually one line and hence one block
+ mBlockEnds[0] = 0;
+ mBlockIndices[0] = INVALID_BLOCK_INDEX;
+ mNumberOfBlocks = 1;
+ return;
+ }
+
+ if (newNumberOfBlocks > mBlockEnds.length) {
+ final int newSize = ArrayUtils.idealIntArraySize(newNumberOfBlocks);
+ int[] blockEnds = new int[newSize];
+ int[] blockIndices = new int[newSize];
+ System.arraycopy(mBlockEnds, 0, blockEnds, 0, firstBlock);
+ System.arraycopy(mBlockIndices, 0, blockIndices, 0, firstBlock);
+ System.arraycopy(mBlockEnds, lastBlock + 1,
+ blockEnds, firstBlock + numAddedBlocks, mNumberOfBlocks - lastBlock - 1);
+ System.arraycopy(mBlockIndices, lastBlock + 1,
+ blockIndices, firstBlock + numAddedBlocks, mNumberOfBlocks - lastBlock - 1);
+ mBlockEnds = blockEnds;
+ mBlockIndices = blockIndices;
+ } else {
+ System.arraycopy(mBlockEnds, lastBlock + 1,
+ mBlockEnds, firstBlock + numAddedBlocks, mNumberOfBlocks - lastBlock - 1);
+ System.arraycopy(mBlockIndices, lastBlock + 1,
+ mBlockIndices, firstBlock + numAddedBlocks, mNumberOfBlocks - lastBlock - 1);
+ }
+
+ mNumberOfBlocks = newNumberOfBlocks;
+ final int deltaLines = newLineCount - (endLine - startLine + 1);
+ for (int i = firstBlock + numAddedBlocks; i < mNumberOfBlocks; i++) {
+ mBlockEnds[i] += deltaLines;
+ }
+
+ int blockIndex = firstBlock;
+ if (createBlockBefore) {
+ mBlockEnds[blockIndex] = startLine - 1;
+ mBlockIndices[blockIndex] = INVALID_BLOCK_INDEX;
+ blockIndex++;
+ }
+
+ if (createBlock) {
+ mBlockEnds[blockIndex] = startLine + newLineCount - 1;
+ mBlockIndices[blockIndex] = INVALID_BLOCK_INDEX;
+ blockIndex++;
+ }
+
+ if (createBlockAfter) {
+ mBlockEnds[blockIndex] = lastBlockEndLine + deltaLines;
+ mBlockIndices[blockIndex] = INVALID_BLOCK_INDEX;
+ }
+ }
+
+ /**
+ * @hide
+ */
+ public int[] getBlockEnds() {
+ return mBlockEnds;
+ }
+
+ /**
+ * @hide
+ */
+ public int[] getBlockIndices() {
+ return mBlockIndices;
+ }
+
+ /**
+ * @hide
+ */
+ public int getNumberOfBlocks() {
+ return mNumberOfBlocks;
+ }
+
@Override
public int getLineCount() {
return mInts.size() - 1;
@@ -428,6 +551,7 @@
}
public void beforeTextChanged(CharSequence s, int where, int before, int after) {
+ // Intentionally empty
}
public void onTextChanged(CharSequence s, int where, int before, int after) {
@@ -435,6 +559,7 @@
}
public void afterTextChanged(Editable s) {
+ // Intentionally empty
}
public void onSpanAdded(Spannable s, Object o, int start, int end) {
@@ -486,6 +611,20 @@
private PackedIntVector mInts;
private PackedObjectVector<Directions> mObjects;
+ /**
+ * Value used in mBlockIndices when a block has been created or recycled and indicating that its
+ * display list needs to be re-created.
+ * @hide
+ */
+ public static final int INVALID_BLOCK_INDEX = -1;
+ // Stores the line numbers of the last line of each block
+ private int[] mBlockEnds;
+ // The indices of this block's display list in TextView's internal display list array or
+ // INVALID_BLOCK_INDEX if this block has been invalidated during an edition
+ private int[] mBlockIndices;
+ // Number of items actually currently being used in the above 2 arrays
+ private int mNumberOfBlocks;
+
private int mTopPadding, mBottomPadding;
private static StaticLayout sStaticLayout = new StaticLayout(null);
diff --git a/core/java/android/text/Layout.java b/core/java/android/text/Layout.java
index 516ce2a..2dcea80 100644
--- a/core/java/android/text/Layout.java
+++ b/core/java/android/text/Layout.java
@@ -1,4 +1,4 @@
- /*
+/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -363,40 +363,67 @@
// direction of the layout or line. XXX: Should they?
// They are evaluated at each line.
if (mSpannedText) {
- int previousLineBottom = getLineTop(firstLine);
- int previousLineEnd = getLineStart(firstLine);
- ParagraphStyle[] spans = NO_PARA_SPANS;
- TextPaint paint = mPaint;
- CharSequence buf = mText;
- int spanEnd = 0;
- final int width = mWidth;
- Spanned sp = (Spanned) buf;
- int textLength = buf.length();
- for (int i = firstLine; i <= lastLine; i++) {
- int start = previousLineEnd;
- int end = getLineStart(i + 1);
- previousLineEnd = end;
+ if (lineBackgroundSpans == null) {
+ lineBackgroundSpans = new SpanSet<LineBackgroundSpan>(LineBackgroundSpan.class);
+ }
- int ltop = previousLineBottom;
- int lbottom = getLineTop(i + 1);
- previousLineBottom = lbottom;
- int lbaseline = lbottom - getLineDescent(i);
+ Spanned buffer = (Spanned) mText;
+ int textLength = buffer.length();
+ lineBackgroundSpans.init(buffer, 0, textLength);
- if (start >= spanEnd) {
- // These should be infrequent, so we'll use this so that
- // we don't have to check as often.
- spanEnd = sp.nextSpanTransition(start, textLength, LineBackgroundSpan.class);
- // All LineBackgroundSpans on a line contribute to its background.
- spans = getParagraphSpans(sp, start, end, LineBackgroundSpan.class);
- }
+ if (lineBackgroundSpans.numberOfSpans > 0) {
+ int previousLineBottom = getLineTop(firstLine);
+ int previousLineEnd = getLineStart(firstLine);
+ ParagraphStyle[] spans = NO_PARA_SPANS;
+ int spansLength = 0;
+ TextPaint paint = mPaint;
+ int spanEnd = 0;
+ final int width = mWidth;
+ for (int i = firstLine; i <= lastLine; i++) {
+ int start = previousLineEnd;
+ int end = getLineStart(i + 1);
+ previousLineEnd = end;
- for (int n = 0; n < spans.length; n++) {
- LineBackgroundSpan back = (LineBackgroundSpan) spans[n];
- back.drawBackground(canvas, paint, 0, width,
- ltop, lbaseline, lbottom,
- buf, start, end, i);
+ int ltop = previousLineBottom;
+ int lbottom = getLineTop(i + 1);
+ previousLineBottom = lbottom;
+ int lbaseline = lbottom - getLineDescent(i);
+
+ if (start >= spanEnd) {
+ // These should be infrequent, so we'll use this so that
+ // we don't have to check as often.
+ spanEnd = lineBackgroundSpans.getNextTransition(start, textLength);
+ // All LineBackgroundSpans on a line contribute to its background.
+ spansLength = 0;
+ // Duplication of the logic of getParagraphSpans
+ if (start != end || start == 0) {
+ // Equivalent to a getSpans(start, end), but filling the 'spans' local
+ // array instead to reduce memory allocation
+ for (int j = 0; j < lineBackgroundSpans.numberOfSpans; j++) {
+ // equal test is valid since both intervals are not empty by construction
+ if (lineBackgroundSpans.spanStarts[j] >= end ||
+ lineBackgroundSpans.spanEnds[j] <= start) continue;
+ if (spansLength == spans.length) {
+ // The spans array needs to be expanded
+ int newSize = ArrayUtils.idealObjectArraySize(2 * spansLength);
+ ParagraphStyle[] newSpans = new ParagraphStyle[newSize];
+ System.arraycopy(spans, 0, newSpans, 0, spansLength);
+ spans = newSpans;
+ }
+ spans[spansLength++] = lineBackgroundSpans.spans[j];
+ }
+ }
+ }
+
+ for (int n = 0; n < spansLength; n++) {
+ LineBackgroundSpan lineBackgroundSpan = (LineBackgroundSpan) spans[n];
+ lineBackgroundSpan.drawBackground(canvas, paint, 0, width,
+ ltop, lbaseline, lbottom,
+ buffer, start, end, i);
+ }
}
}
+ lineBackgroundSpans.recycle();
}
// There can be a highlight even without spans if we are drawing
@@ -1830,6 +1857,7 @@
private static final Rect sTempRect = new Rect();
private boolean mSpannedText;
private TextDirectionHeuristic mTextDir;
+ private SpanSet<LineBackgroundSpan> lineBackgroundSpans;
public static final int DIR_LEFT_TO_RIGHT = 1;
public static final int DIR_RIGHT_TO_LEFT = -1;
diff --git a/core/java/android/text/SpanSet.java b/core/java/android/text/SpanSet.java
new file mode 100644
index 0000000..3ca6033
--- /dev/null
+++ b/core/java/android/text/SpanSet.java
@@ -0,0 +1,111 @@
+/*
+ * 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 android.text;
+
+import java.lang.reflect.Array;
+
+/**
+ * A cached set of spans. Caches the result of {@link Spanned#getSpans(int, int, Class)} and then
+ * provides faster access to {@link Spanned#nextSpanTransition(int, int, Class)}.
+ *
+ * Fields are left public for a convenient direct access.
+ *
+ * Note that empty spans are ignored by this class.
+ * @hide
+ */
+public class SpanSet<E> {
+ private final Class<? extends E> classType;
+
+ int numberOfSpans;
+ E[] spans;
+ int[] spanStarts;
+ int[] spanEnds;
+ int[] spanFlags;
+
+ SpanSet(Class<? extends E> type) {
+ classType = type;
+ numberOfSpans = 0;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void init(Spanned spanned, int start, int limit) {
+ final E[] allSpans = spanned.getSpans(start, limit, classType);
+ final int length = allSpans.length;
+
+ if (length > 0 && (spans == null || spans.length < length)) {
+ // These arrays may end up being too large because of the discarded empty spans
+ spans = (E[]) Array.newInstance(classType, length);
+ spanStarts = new int[length];
+ spanEnds = new int[length];
+ spanFlags = new int[length];
+ }
+
+ numberOfSpans = 0;
+ for (int i = 0; i < length; i++) {
+ final E span = allSpans[i];
+
+ final int spanStart = spanned.getSpanStart(span);
+ final int spanEnd = spanned.getSpanEnd(span);
+ if (spanStart == spanEnd) continue;
+
+ final int spanFlag = spanned.getSpanFlags(span);
+
+ spans[numberOfSpans] = span;
+ spanStarts[numberOfSpans] = spanStart;
+ spanEnds[numberOfSpans] = spanEnd;
+ spanFlags[numberOfSpans] = spanFlag;
+
+ numberOfSpans++;
+ }
+ }
+
+ /**
+ * Returns true if there are spans intersecting the given interval.
+ * @param end must be strictly greater than start
+ */
+ public boolean hasSpansIntersecting(int start, int end) {
+ for (int i = 0; i < numberOfSpans; i++) {
+ // equal test is valid since both intervals are not empty by construction
+ if (spanStarts[i] >= end || spanEnds[i] <= start) continue;
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Similar to {@link Spanned#nextSpanTransition(int, int, Class)}
+ */
+ int getNextTransition(int start, int limit) {
+ for (int i = 0; i < numberOfSpans; i++) {
+ final int spanStart = spanStarts[i];
+ final int spanEnd = spanEnds[i];
+ if (spanStart > start && spanStart < limit) limit = spanStart;
+ if (spanEnd > start && spanEnd < limit) limit = spanEnd;
+ }
+ return limit;
+ }
+
+ /**
+ * Removes all internal references to the spans to avoid memory leaks.
+ */
+ public void recycle() {
+ // The spans array is guaranteed to be not null when numberOfSpans is > 0
+ for (int i = 0; i < numberOfSpans; i++) {
+ spans[i] = null; // prevent a leak: no reference kept when TextLine is recycled
+ }
+ }
+}
diff --git a/core/java/android/text/TextLine.java b/core/java/android/text/TextLine.java
index 1e8a2f7..0d2835a 100644
--- a/core/java/android/text/TextLine.java
+++ b/core/java/android/text/TextLine.java
@@ -30,8 +30,6 @@
import com.android.internal.util.ArrayUtils;
-import java.lang.reflect.Array;
-
/**
* Represents a line of styled text, for measuring in visual order and
* for rendering.
@@ -860,78 +858,6 @@
return runIsRtl ? -ret : ret;
}
- private static class SpanSet<E> {
- int numberOfSpans;
- E[] spans;
- int[] spanStarts;
- int[] spanEnds;
- int[] spanFlags;
- final Class<? extends E> classType;
-
- SpanSet(Class<? extends E> type) {
- classType = type;
- numberOfSpans = 0;
- }
-
- @SuppressWarnings("unchecked")
- public void init(Spanned spanned, int start, int limit) {
- final E[] allSpans = spanned.getSpans(start, limit, classType);
- final int length = allSpans.length;
-
- if (length > 0 && (spans == null || spans.length < length)) {
- // These arrays may end up being too large because of empty spans
- spans = (E[]) Array.newInstance(classType, length);
- spanStarts = new int[length];
- spanEnds = new int[length];
- spanFlags = new int[length];
- }
-
- numberOfSpans = 0;
- for (int i = 0; i < length; i++) {
- final E span = allSpans[i];
-
- final int spanStart = spanned.getSpanStart(span);
- final int spanEnd = spanned.getSpanEnd(span);
- if (spanStart == spanEnd) continue;
-
- final int spanFlag = spanned.getSpanFlags(span);
-
- spans[numberOfSpans] = span;
- spanStarts[numberOfSpans] = spanStart;
- spanEnds[numberOfSpans] = spanEnd;
- spanFlags[numberOfSpans] = spanFlag;
-
- numberOfSpans++;
- }
- }
-
- public boolean hasSpansIntersecting(int start, int end) {
- for (int i = 0; i < numberOfSpans; i++) {
- // equal test is valid since both intervals are not empty by construction
- if (spanStarts[i] >= end || spanEnds[i] <= start) continue;
- return true;
- }
- return false;
- }
-
- int getNextTransition(int start, int limit) {
- for (int i = 0; i < numberOfSpans; i++) {
- final int spanStart = spanStarts[i];
- final int spanEnd = spanEnds[i];
- if (spanStart > start && spanStart < limit) limit = spanStart;
- if (spanEnd > start && spanEnd < limit) limit = spanEnd;
- }
- return limit;
- }
-
- public void recycle() {
- // The spans array is guaranteed to be not null when numberOfSpans is > 0
- for (int i = 0; i < numberOfSpans; i++) {
- spans[i] = null; // prevent a leak: no reference kept when TextLine is recycled
- }
- }
- }
-
/**
* Utility function for handling a unidirectional run. The run must not
* contain tabs or emoji but can contain styles.
diff --git a/core/java/android/view/DisplayList.java b/core/java/android/view/DisplayList.java
index a50f09f..1dabad2 100644
--- a/core/java/android/view/DisplayList.java
+++ b/core/java/android/view/DisplayList.java
@@ -16,6 +16,8 @@
package android.view;
+import android.os.Handler;
+
/**
* A display lists records a series of graphics related operation and can replay
* them later. Display lists are usually built by recording operations on a
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index bf91700..d08a61f 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -960,6 +960,11 @@
Log.d(ViewDebug.DEBUG_LATENCY_TAG, "- getDisplayList() took " +
total + "ms");
}
+ if (View.USE_DISPLAY_LIST_PROPERTIES) {
+ Log.d("DLProperties", "getDisplayList():\t" +
+ mProfileData[mProfileCurrentFrame]);
+ }
+
}
if (displayList != null) {
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index bf48ff2..fdf3a814 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -1503,7 +1503,7 @@
* apps.
* @hide
*/
- protected static final boolean USE_DISPLAY_LIST_PROPERTIES = false;
+ public static final boolean USE_DISPLAY_LIST_PROPERTIES = true;
/**
* Map used to store views' tags.
@@ -7349,8 +7349,7 @@
* @see #setRotationY(float)
*/
public void setCameraDistance(float distance) {
- invalidateParentCaches();
- invalidate(false);
+ invalidateViewProperty(true, false);
ensureTransformationInfo();
final float dpi = mResources.getDisplayMetrics().densityDpi;
@@ -7363,7 +7362,7 @@
info.mCamera.setLocation(0.0f, 0.0f, -Math.abs(distance) / dpi);
info.mMatrixDirty = true;
- invalidate(false);
+ invalidateViewProperty(false, false);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setCameraDistance(distance);
}
@@ -7401,13 +7400,11 @@
ensureTransformationInfo();
final TransformationInfo info = mTransformationInfo;
if (info.mRotation != rotation) {
- invalidateParentCaches();
// Double-invalidation is necessary to capture view's old and new areas
- invalidate(false);
+ invalidateViewProperty(true, false);
info.mRotation = rotation;
info.mMatrixDirty = true;
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
+ invalidateViewProperty(false, true);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setRotation(rotation);
}
@@ -7451,13 +7448,10 @@
ensureTransformationInfo();
final TransformationInfo info = mTransformationInfo;
if (info.mRotationY != rotationY) {
- invalidateParentCaches();
- // Double-invalidation is necessary to capture view's old and new areas
- invalidate(false);
+ invalidateViewProperty(true, false);
info.mRotationY = rotationY;
info.mMatrixDirty = true;
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
+ invalidateViewProperty(false, true);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setRotationY(rotationY);
}
@@ -7501,13 +7495,10 @@
ensureTransformationInfo();
final TransformationInfo info = mTransformationInfo;
if (info.mRotationX != rotationX) {
- invalidateParentCaches();
- // Double-invalidation is necessary to capture view's old and new areas
- invalidate(false);
+ invalidateViewProperty(true, false);
info.mRotationX = rotationX;
info.mMatrixDirty = true;
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
+ invalidateViewProperty(false, true);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setRotationX(rotationX);
}
@@ -7543,13 +7534,10 @@
ensureTransformationInfo();
final TransformationInfo info = mTransformationInfo;
if (info.mScaleX != scaleX) {
- invalidateParentCaches();
- // Double-invalidation is necessary to capture view's old and new areas
- invalidate(false);
+ invalidateViewProperty(true, false);
info.mScaleX = scaleX;
info.mMatrixDirty = true;
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
+ invalidateViewProperty(false, true);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setScaleX(scaleX);
}
@@ -7585,13 +7573,10 @@
ensureTransformationInfo();
final TransformationInfo info = mTransformationInfo;
if (info.mScaleY != scaleY) {
- invalidateParentCaches();
- // Double-invalidation is necessary to capture view's old and new areas
- invalidate(false);
+ invalidateViewProperty(true, false);
info.mScaleY = scaleY;
info.mMatrixDirty = true;
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
+ invalidateViewProperty(false, true);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setScaleY(scaleY);
}
@@ -7633,13 +7618,10 @@
mPrivateFlags |= PIVOT_EXPLICITLY_SET;
final TransformationInfo info = mTransformationInfo;
if (info.mPivotX != pivotX) {
- invalidateParentCaches();
- // Double-invalidation is necessary to capture view's old and new areas
- invalidate(false);
+ invalidateViewProperty(true, false);
info.mPivotX = pivotX;
info.mMatrixDirty = true;
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
+ invalidateViewProperty(false, true);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setPivotX(pivotX);
}
@@ -7680,13 +7662,10 @@
mPrivateFlags |= PIVOT_EXPLICITLY_SET;
final TransformationInfo info = mTransformationInfo;
if (info.mPivotY != pivotY) {
- invalidateParentCaches();
- // Double-invalidation is necessary to capture view's old and new areas
- invalidate(false);
+ invalidateViewProperty(true, false);
info.mPivotY = pivotY;
info.mMatrixDirty = true;
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
+ invalidateViewProperty(false, true);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setPivotY(pivotY);
}
@@ -7728,14 +7707,14 @@
ensureTransformationInfo();
if (mTransformationInfo.mAlpha != alpha) {
mTransformationInfo.mAlpha = alpha;
- invalidateParentCaches();
if (onSetAlpha((int) (alpha * 255))) {
mPrivateFlags |= ALPHA_SET;
// subclass is handling alpha - don't optimize rendering cache invalidation
+ invalidateParentCaches();
invalidate(true);
} else {
mPrivateFlags &= ~ALPHA_SET;
- invalidate(false);
+ invalidateViewProperty(true, false);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setAlpha(alpha);
}
@@ -8102,13 +8081,11 @@
ensureTransformationInfo();
final TransformationInfo info = mTransformationInfo;
if (info.mTranslationX != translationX) {
- invalidateParentCaches();
// Double-invalidation is necessary to capture view's old and new areas
- invalidate(false);
+ invalidateViewProperty(true, false);
info.mTranslationX = translationX;
info.mMatrixDirty = true;
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
+ invalidateViewProperty(false, true);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setTranslationX(translationX);
}
@@ -8142,13 +8119,10 @@
ensureTransformationInfo();
final TransformationInfo info = mTransformationInfo;
if (info.mTranslationY != translationY) {
- invalidateParentCaches();
- // Double-invalidation is necessary to capture view's old and new areas
- invalidate(false);
+ invalidateViewProperty(true, false);
info.mTranslationY = translationY;
info.mMatrixDirty = true;
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
+ invalidateViewProperty(false, true);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setTranslationY(translationY);
}
@@ -8260,39 +8234,43 @@
final boolean matrixIsIdentity = mTransformationInfo == null
|| mTransformationInfo.mMatrixIsIdentity;
if (matrixIsIdentity) {
- final ViewParent p = mParent;
- if (p != null && mAttachInfo != null) {
- final Rect r = mAttachInfo.mTmpInvalRect;
- int minTop;
- int maxBottom;
- int yLoc;
- if (offset < 0) {
- minTop = mTop + offset;
- maxBottom = mBottom;
- yLoc = offset;
- } else {
- minTop = mTop;
- maxBottom = mBottom + offset;
- yLoc = 0;
+ if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+ invalidateViewProperty(false, false);
+ } else {
+ final ViewParent p = mParent;
+ if (p != null && mAttachInfo != null) {
+ final Rect r = mAttachInfo.mTmpInvalRect;
+ int minTop;
+ int maxBottom;
+ int yLoc;
+ if (offset < 0) {
+ minTop = mTop + offset;
+ maxBottom = mBottom;
+ yLoc = offset;
+ } else {
+ minTop = mTop;
+ maxBottom = mBottom + offset;
+ yLoc = 0;
+ }
+ r.set(0, yLoc, mRight - mLeft, maxBottom - minTop);
+ p.invalidateChild(this, r);
}
- r.set(0, yLoc, mRight - mLeft, maxBottom - minTop);
- p.invalidateChild(this, r);
}
} else {
- invalidate(false);
+ invalidateViewProperty(false, false);
}
mTop += offset;
mBottom += offset;
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.offsetTopBottom(offset);
+ invalidateViewProperty(false, false);
+ } else {
+ if (!matrixIsIdentity) {
+ invalidateViewProperty(false, true);
+ }
+ invalidateParentIfNeeded();
}
-
- if (!matrixIsIdentity) {
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
- }
- invalidateParentIfNeeded();
}
}
@@ -8307,36 +8285,40 @@
final boolean matrixIsIdentity = mTransformationInfo == null
|| mTransformationInfo.mMatrixIsIdentity;
if (matrixIsIdentity) {
- final ViewParent p = mParent;
- if (p != null && mAttachInfo != null) {
- final Rect r = mAttachInfo.mTmpInvalRect;
- int minLeft;
- int maxRight;
- if (offset < 0) {
- minLeft = mLeft + offset;
- maxRight = mRight;
- } else {
- minLeft = mLeft;
- maxRight = mRight + offset;
+ if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+ invalidateViewProperty(false, false);
+ } else {
+ final ViewParent p = mParent;
+ if (p != null && mAttachInfo != null) {
+ final Rect r = mAttachInfo.mTmpInvalRect;
+ int minLeft;
+ int maxRight;
+ if (offset < 0) {
+ minLeft = mLeft + offset;
+ maxRight = mRight;
+ } else {
+ minLeft = mLeft;
+ maxRight = mRight + offset;
+ }
+ r.set(0, 0, maxRight - minLeft, mBottom - mTop);
+ p.invalidateChild(this, r);
}
- r.set(0, 0, maxRight - minLeft, mBottom - mTop);
- p.invalidateChild(this, r);
}
} else {
- invalidate(false);
+ invalidateViewProperty(false, false);
}
mLeft += offset;
mRight += offset;
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.offsetLeftRight(offset);
+ invalidateViewProperty(false, false);
+ } else {
+ if (!matrixIsIdentity) {
+ invalidateViewProperty(false, true);
+ }
+ invalidateParentIfNeeded();
}
-
- if (!matrixIsIdentity) {
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
- }
- invalidateParentIfNeeded();
}
}
@@ -8741,6 +8723,62 @@
}
/**
+ * Quick invalidation for View property changes (alpha, translationXY, etc.). We don't want to
+ * set any flags or handle all of the cases handled by the default invalidation methods.
+ * Instead, we just want to schedule a traversal in ViewRootImpl with the appropriate
+ * dirty rect. This method calls into fast invalidation methods in ViewGroup that
+ * walk up the hierarchy, transforming the dirty rect as necessary.
+ *
+ * The method also handles normal invalidation logic if display list properties are not
+ * being used in this view. The invalidateParent and forceRedraw flags are used by that
+ * backup approach, to handle these cases used in the various property-setting methods.
+ *
+ * @param invalidateParent Force a call to invalidateParentCaches() if display list properties
+ * are not being used in this view
+ * @param forceRedraw Mark the view as DRAWN to force the invalidation to propagate, if display
+ * list properties are not being used in this view
+ */
+ void invalidateViewProperty(boolean invalidateParent, boolean forceRedraw) {
+ if (!USE_DISPLAY_LIST_PROPERTIES || mDisplayList == null ||
+ (mPrivateFlags & DRAW_ANIMATION) == DRAW_ANIMATION) {
+ if (invalidateParent) {
+ invalidateParentCaches();
+ }
+ if (forceRedraw) {
+ mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
+ }
+ invalidate(false);
+ } else {
+ final AttachInfo ai = mAttachInfo;
+ final ViewParent p = mParent;
+ if (p != null && ai != null) {
+ final Rect r = ai.mTmpInvalRect;
+ r.set(0, 0, mRight - mLeft, mBottom - mTop);
+ if (mParent instanceof ViewGroup) {
+ ((ViewGroup) mParent).invalidateChildFast(this, r);
+ } else {
+ mParent.invalidateChild(this, r);
+ }
+ }
+ }
+ }
+
+ /**
+ * Utility method to transform a given Rect by the current matrix of this view.
+ */
+ void transformRect(final Rect rect) {
+ if (!getMatrix().isIdentity()) {
+ RectF boundingRect = mAttachInfo.mTmpTransformRect;
+ boundingRect.set(rect);
+ getMatrix().mapRect(boundingRect);
+ rect.set((int) (boundingRect.left - 0.5f),
+ (int) (boundingRect.top - 0.5f),
+ (int) (boundingRect.right + 0.5f),
+ (int) (boundingRect.bottom + 0.5f));
+ }
+ }
+
+ /**
* Used to indicate that the parent of this view should clear its caches. This functionality
* is used to force the parent to rebuild its display list (when hardware-accelerated),
* which is necessary when various parent-managed properties of the view change, such as
@@ -9974,12 +10012,16 @@
destroyLayer();
- if (mDisplayList != null) {
- mDisplayList.invalidate();
- }
-
if (mAttachInfo != null) {
+ if (mDisplayList != null) {
+ mAttachInfo.mViewRootImpl.invalidateDisplayList(mDisplayList);
+ }
mAttachInfo.mViewRootImpl.cancelInvalidate(this);
+ } else {
+ if (mDisplayList != null) {
+ // Should never happen
+ mDisplayList.invalidate();
+ }
}
mCurrentAnimation = null;
@@ -10456,10 +10498,10 @@
if (mHardwareLayer == null) {
mHardwareLayer = mAttachInfo.mHardwareRenderer.createHardwareLayer(
width, height, isOpaque());
- mLocalDirtyRect.setEmpty();
+ mLocalDirtyRect.set(0, 0, width, height);
} else if (mHardwareLayer.getWidth() != width || mHardwareLayer.getHeight() != height) {
mHardwareLayer.resize(width, height);
- mLocalDirtyRect.setEmpty();
+ mLocalDirtyRect.set(0, 0, width, height);
}
// The layer is not valid if the underlying GPU resources cannot be allocated
@@ -11473,7 +11515,7 @@
if (concatMatrix) {
// Undo the scroll translation, apply the transformation matrix,
// then redo the scroll translate to get the correct result.
- if (!hasDisplayList) {
+ if (!useDisplayListProperties) {
canvas.translate(-transX, -transY);
canvas.concat(transformToApply.getMatrix());
canvas.translate(transX, transY);
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 1993ce6..42426b98 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -3896,6 +3896,72 @@
}
/**
+ * Quick invalidation method called by View.invalidateViewProperty. This doesn't set the
+ * DRAWN flags and doesn't handle the Animation logic that the default invalidation methods
+ * do; all we want to do here is schedule a traversal with the appropriate dirty rect.
+ *
+ * @hide
+ */
+ public void invalidateChildFast(View child, final Rect dirty) {
+ ViewParent parent = this;
+
+ final AttachInfo attachInfo = mAttachInfo;
+ if (attachInfo != null) {
+ if (child.mLayerType != LAYER_TYPE_NONE) {
+ child.mLocalDirtyRect.union(dirty);
+ }
+
+ int left = child.mLeft;
+ int top = child.mTop;
+ if (!child.getMatrix().isIdentity()) {
+ child.transformRect(dirty);
+ }
+
+ do {
+ if (parent instanceof ViewGroup) {
+ ViewGroup parentVG = (ViewGroup) parent;
+ parent = parentVG.invalidateChildInParentFast(left, top, dirty);
+ left = parentVG.mLeft;
+ top = parentVG.mTop;
+ } else {
+ // Reached the top; this calls into the usual invalidate method in
+ // ViewRootImpl, which schedules a traversal
+ final int[] location = attachInfo.mInvalidateChildLocation;
+ location[0] = left;
+ location[1] = top;
+ parent = parent.invalidateChildInParent(location, dirty);
+ }
+ } while (parent != null);
+ }
+ }
+
+ /**
+ * Quick invalidation method that simply transforms the dirty rect into the parent's
+ * coordinate system, pruning the invalidation if the parent has already been invalidated.
+ */
+ private ViewParent invalidateChildInParentFast(int left, int top, final Rect dirty) {
+ if ((mPrivateFlags & DRAWN) == DRAWN ||
+ (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID) {
+ dirty.offset(left - mScrollX, top - mScrollY);
+
+ if ((mGroupFlags & FLAG_CLIP_CHILDREN) == 0 ||
+ dirty.intersect(0, 0, mRight - mLeft, mBottom - mTop)) {
+
+ if (mLayerType != LAYER_TYPE_NONE) {
+ mLocalDirtyRect.union(dirty);
+ }
+ if (!getMatrix().isIdentity()) {
+ transformRect(dirty);
+ }
+
+ return mParent;
+ }
+ }
+
+ return null;
+ }
+
+ /**
* Offset a rectangle that is in a descendant's coordinate
* space into our coordinate space.
* @param descendant A descendant of this view
@@ -3986,6 +4052,7 @@
v.mBottom += offset;
if (USE_DISPLAY_LIST_PROPERTIES && v.mDisplayList != null) {
v.mDisplayList.offsetTopBottom(offset);
+ invalidateViewProperty(false, false);
}
}
}
diff --git a/core/java/android/view/ViewPropertyAnimator.java b/core/java/android/view/ViewPropertyAnimator.java
index fe0e659..623b567 100644
--- a/core/java/android/view/ViewPropertyAnimator.java
+++ b/core/java/android/view/ViewPropertyAnimator.java
@@ -986,17 +986,22 @@
// Shouldn't happen, but just to play it safe
return;
}
+ boolean useDisplayListProperties = View.USE_DISPLAY_LIST_PROPERTIES &&
+ mView.mDisplayList != null;
+
// alpha requires slightly different treatment than the other (transform) properties.
// The logic in setAlpha() is not simply setting mAlpha, plus the invalidation
// logic is dependent on how the view handles an internal call to onSetAlpha().
// We track what kinds of properties are set, and how alpha is handled when it is
// set, and perform the invalidation steps appropriately.
boolean alphaHandled = false;
- mView.invalidateParentCaches();
+ if (!useDisplayListProperties) {
+ mView.invalidateParentCaches();
+ }
float fraction = animation.getAnimatedFraction();
int propertyMask = propertyBundle.mPropertyMask;
if ((propertyMask & TRANSFORM_MASK) != 0) {
- mView.invalidate(false);
+ mView.invalidateViewProperty(false, false);
}
ArrayList<NameValuesHolder> valueList = propertyBundle.mNameValuesHolder;
if (valueList != null) {
@@ -1013,11 +1018,17 @@
}
if ((propertyMask & TRANSFORM_MASK) != 0) {
mView.mTransformationInfo.mMatrixDirty = true;
- mView.mPrivateFlags |= View.DRAWN; // force another invalidation
+ if (!useDisplayListProperties) {
+ mView.mPrivateFlags |= View.DRAWN; // force another invalidation
+ }
}
// invalidate(false) in all cases except if alphaHandled gets set to true
// via the call to setAlphaNoInvalidation(), above
- mView.invalidate(alphaHandled);
+ if (alphaHandled) {
+ mView.invalidate(true);
+ } else {
+ mView.invalidateViewProperty(false, false);
+ }
}
}
}
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 4472f8c..4eb70ab 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -117,6 +117,8 @@
private static final boolean DEBUG_CONFIGURATION = false || LOCAL_LOGV;
private static final boolean DEBUG_FPS = false;
+ private static final boolean USE_RENDER_THREAD = false;
+
/**
* Set this system property to true to force the view hierarchy to render
* at 60 Hz. This can be used to measure the potential framerate.
@@ -300,6 +302,8 @@
private long mFpsPrevTime = -1;
private int mFpsNumFrames;
+ private final ArrayList<DisplayList> mDisplayLists = new ArrayList<DisplayList>(24);
+
/**
* see {@link #playSoundEffect(int)}
*/
@@ -402,23 +406,27 @@
* false otherwise
*/
private static boolean isRenderThreadRequested(Context context) {
- synchronized (sRenderThreadQueryLock) {
- if (!sRenderThreadQueried) {
- final PackageManager packageManager = context.getPackageManager();
- final String packageName = context.getApplicationInfo().packageName;
- try {
- ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName,
- PackageManager.GET_META_DATA);
- if (applicationInfo.metaData != null) {
- sUseRenderThread = applicationInfo.metaData.getBoolean(
- "android.graphics.renderThread", false);
+ if (USE_RENDER_THREAD) {
+ synchronized (sRenderThreadQueryLock) {
+ if (!sRenderThreadQueried) {
+ final PackageManager packageManager = context.getPackageManager();
+ final String packageName = context.getApplicationInfo().packageName;
+ try {
+ ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName,
+ PackageManager.GET_META_DATA);
+ if (applicationInfo.metaData != null) {
+ sUseRenderThread = applicationInfo.metaData.getBoolean(
+ "android.graphics.renderThread", false);
+ }
+ } catch (PackageManager.NameNotFoundException e) {
+ } finally {
+ sRenderThreadQueried = true;
}
- } catch (PackageManager.NameNotFoundException e) {
- } finally {
- sRenderThreadQueried = true;
}
+ return sUseRenderThread;
}
- return sUseRenderThread;
+ } else {
+ return false;
}
}
@@ -690,7 +698,7 @@
return;
}
- boolean renderThread = isRenderThreadRequested(context);
+ final boolean renderThread = isRenderThreadRequested(context);
if (renderThread) {
Log.i(HardwareRenderer.LOG_TAG, "Render threat initiated");
}
@@ -833,7 +841,9 @@
localDirty.union(dirty.left, dirty.top, dirty.right, dirty.bottom);
// Intersect with the bounds of the window to skip
// updates that lie outside of the visible region
- localDirty.intersect(0, 0, mWidth, mHeight);
+ final float appScale = mAttachInfo.mApplicationScale;
+ localDirty.intersect(0, 0,
+ (int) (mWidth * appScale + 0.5f), (int) (mHeight * appScale + 0.5f));
if (!mWillDrawSoon) {
scheduleTraversals();
@@ -2210,6 +2220,17 @@
}
}
+ void invalidateDisplayLists() {
+ final ArrayList<DisplayList> displayLists = mDisplayLists;
+ final int count = displayLists.size();
+
+ for (int i = 0; i < count; i++) {
+ displayLists.get(i).invalidate();
+ }
+
+ displayLists.clear();
+ }
+
boolean scrollToRectOrFocus(Rect rectangle, boolean immediate) {
final View.AttachInfo attachInfo = mAttachInfo;
final Rect ci = attachInfo.mContentInsets;
@@ -2516,6 +2537,7 @@
private final static int MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_TEXT = 22;
private final static int MSG_PROCESS_INPUT_EVENTS = 23;
private final static int MSG_DISPATCH_SCREEN_STATE = 24;
+ private final static int MSG_INVALIDATE_DISPLAY_LIST = 25;
final class ViewRootHandler extends Handler {
@Override
@@ -2567,6 +2589,10 @@
return "MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_TEXT";
case MSG_PROCESS_INPUT_EVENTS:
return "MSG_PROCESS_INPUT_EVENTS";
+ case MSG_DISPATCH_SCREEN_STATE:
+ return "MSG_DISPATCH_SCREEN_STATE";
+ case MSG_INVALIDATE_DISPLAY_LIST:
+ return "MSG_INVALIDATE_DISPLAY_LIST";
}
return super.getMessageName(message);
}
@@ -2777,9 +2803,13 @@
handleScreenStateChange(msg.arg1 == 1);
}
} break;
+ case MSG_INVALIDATE_DISPLAY_LIST: {
+ invalidateDisplayLists();
+ } break;
}
}
}
+
final ViewRootHandler mHandler = new ViewRootHandler();
/**
@@ -4136,6 +4166,14 @@
mInvalidateOnAnimationRunnable.addViewRect(info);
}
+ public void invalidateDisplayList(DisplayList displayList) {
+ mDisplayLists.add(displayList);
+
+ mHandler.removeMessages(MSG_INVALIDATE_DISPLAY_LIST);
+ Message msg = mHandler.obtainMessage(MSG_INVALIDATE_DISPLAY_LIST);
+ mHandler.sendMessage(msg);
+ }
+
public void cancelInvalidate(View view) {
mHandler.removeMessages(MSG_INVALIDATE, view);
// fixme: might leak the AttachInfo.InvalidateInfo objects instead of returning
diff --git a/core/java/android/webkit/AutoCompletePopup.java b/core/java/android/webkit/AutoCompletePopup.java
index 674428a..b26156c 100644
--- a/core/java/android/webkit/AutoCompletePopup.java
+++ b/core/java/android/webkit/AutoCompletePopup.java
@@ -16,7 +16,6 @@
package android.webkit;
import android.content.Context;
-import android.graphics.Rect;
import android.os.Handler;
import android.os.Message;
import android.text.Editable;
@@ -41,13 +40,10 @@
private boolean mIsAutoFillProfileSet;
private Handler mHandler;
private int mQueryId;
- private Rect mNodeBounds = new Rect();
- private int mNodeLayerId;
private ListPopupWindow mPopup;
private Filter mFilter;
private CharSequence mText;
private ListAdapter mAdapter;
- private boolean mIsFocused;
private View mAnchor;
private WebViewClassic.WebViewInputConnection mInputConnection;
private WebViewClassic mWebView;
@@ -102,13 +98,6 @@
return false;
}
- public void setFocused(boolean isFocused) {
- mIsFocused = isFocused;
- if (!mIsFocused) {
- mPopup.dismiss();
- }
- }
-
public void setText(CharSequence text) {
mText = text;
if (mFilter != null) {
@@ -139,20 +128,14 @@
resetRect();
}
- public void setNodeBounds(Rect nodeBounds, int layerId) {
- mNodeBounds.set(nodeBounds);
- mNodeLayerId = layerId;
- resetRect();
- }
-
public void resetRect() {
- int left = mWebView.contentToViewX(mNodeBounds.left);
- int right = mWebView.contentToViewX(mNodeBounds.right);
+ int left = mWebView.contentToViewX(mWebView.mEditTextBounds.left);
+ int right = mWebView.contentToViewX(mWebView.mEditTextBounds.right);
int width = right - left;
mPopup.setWidth(width);
- int bottom = mWebView.contentToViewY(mNodeBounds.bottom);
- int top = mWebView.contentToViewY(mNodeBounds.top);
+ int bottom = mWebView.contentToViewY(mWebView.mEditTextBounds.bottom);
+ int top = mWebView.contentToViewY(mWebView.mEditTextBounds.top);
int height = bottom - top;
AbsoluteLayout.LayoutParams lp =
@@ -178,13 +161,6 @@
}
}
- public void scrollDelta(int layerId, int dx, int dy) {
- if (layerId == mNodeLayerId) {
- mNodeBounds.offset(dx, dy);
- resetRect();
- }
- }
-
// AdapterView.OnItemClickListener implementation
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
@@ -230,11 +206,6 @@
@Override
public void onFilterComplete(int count) {
- if (!mIsFocused) {
- mPopup.dismiss();
- return;
- }
-
boolean showDropDown = (count > 0) &&
(mInputConnection.getIsAutoFillable() || mText.length() > 0);
if (showDropDown) {
diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java
index f09e29d..dbcea71 100644
--- a/core/java/android/webkit/BrowserFrame.java
+++ b/core/java/android/webkit/BrowserFrame.java
@@ -742,7 +742,8 @@
url = url.replaceFirst(ANDROID_ASSET, "");
try {
AssetManager assets = mContext.getAssets();
- return assets.open(url, AssetManager.ACCESS_STREAMING);
+ Uri uri = Uri.parse(url);
+ return assets.open(uri.getPath(), AssetManager.ACCESS_STREAMING);
} catch (IOException e) {
return null;
}
diff --git a/core/java/android/webkit/FindActionModeCallback.java b/core/java/android/webkit/FindActionModeCallback.java
index 964cf3e..6c331ac 100644
--- a/core/java/android/webkit/FindActionModeCallback.java
+++ b/core/java/android/webkit/FindActionModeCallback.java
@@ -45,7 +45,6 @@
private int mNumberOfMatches;
private int mActiveMatchIndex;
private ActionMode mActionMode;
- private String mLastFind;
FindActionModeCallback(Context context) {
mCustomView = LayoutInflater.from(context).inflate(
@@ -134,13 +133,12 @@
mWebView.clearMatches();
mMatches.setVisibility(View.GONE);
mMatchesFound = false;
- mLastFind = null;
+ mWebView.findAll(null);
} else {
mMatchesFound = true;
mMatches.setVisibility(View.INVISIBLE);
mNumberOfMatches = 0;
- mLastFind = find.toString();
- mWebView.findAllAsync(mLastFind);
+ mWebView.findAllAsync(find.toString());
}
}
@@ -150,9 +148,8 @@
mInput.showSoftInput(mEditText, 0);
}
- public void updateMatchCount(int matchIndex, int matchCount,
- String findText) {
- if (mLastFind != null && mLastFind.equals(findText)) {
+ public void updateMatchCount(int matchIndex, int matchCount, boolean isNewFind) {
+ if (!isNewFind) {
mNumberOfMatches = matchCount;
mActiveMatchIndex = matchIndex;
updateMatchesString();
diff --git a/core/java/android/webkit/FindListener.java b/core/java/android/webkit/FindListener.java
new file mode 100644
index 0000000..124f737
--- /dev/null
+++ b/core/java/android/webkit/FindListener.java
@@ -0,0 +1,32 @@
+/*
+ * 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 android.webkit;
+
+/**
+ * @hide
+ */
+public interface FindListener {
+ /**
+ * Notify the host application that a find result is available.
+ *
+ * @param numberOfMatches How many matches have been found
+ * @param activeMatchOrdinal The ordinal of the currently selected match
+ * @param isDoneCounting Whether we have finished counting matches
+ */
+ public void onFindResultReceived(int numberOfMatches,
+ int activeMatchOrdinal, boolean isDoneCounting);
+}
diff --git a/core/java/android/webkit/HTML5VideoFullScreen.java b/core/java/android/webkit/HTML5VideoFullScreen.java
index fac549d..730ad08d 100644
--- a/core/java/android/webkit/HTML5VideoFullScreen.java
+++ b/core/java/android/webkit/HTML5VideoFullScreen.java
@@ -112,6 +112,18 @@
}
};
+ MediaPlayer.OnVideoSizeChangedListener mSizeChangedListener =
+ new MediaPlayer.OnVideoSizeChangedListener() {
+ @Override
+ public void onVideoSizeChanged(MediaPlayer mp, int width, int height) {
+ mVideoWidth = mp.getVideoWidth();
+ mVideoHeight = mp.getVideoHeight();
+ if (mVideoWidth != 0 && mVideoHeight != 0) {
+ mVideoSurfaceView.getHolder().setFixedSize(mVideoWidth, mVideoHeight);
+ }
+ }
+ };
+
private SurfaceView getSurfaceView() {
return mVideoSurfaceView;
}
@@ -150,6 +162,7 @@
mc.setSystemUiVisibility(mLayout.getSystemUiVisibility());
setMediaController(mc);
mPlayer.setScreenOnWhilePlaying(true);
+ mPlayer.setOnVideoSizeChangedListener(mSizeChangedListener);
prepareDataAndDisplayMode(mProxy);
}
diff --git a/core/java/android/webkit/HTML5VideoViewProxy.java b/core/java/android/webkit/HTML5VideoViewProxy.java
index 1644b06..40c3778 100644
--- a/core/java/android/webkit/HTML5VideoViewProxy.java
+++ b/core/java/android/webkit/HTML5VideoViewProxy.java
@@ -146,6 +146,12 @@
// Save the inline video info and inherit it in the full screen
int savePosition = 0;
if (mHTML5VideoView != null) {
+ // We don't allow enter full screen mode while the previous
+ // full screen video hasn't finished yet.
+ if (!mHTML5VideoView.fullScreenExited() && mHTML5VideoView.isFullScreenMode()) {
+ Log.w(LOGTAG, "Try to reenter the full screen mode");
+ return;
+ }
// If we are playing the same video, then it is better to
// save the current position.
if (layerId == mHTML5VideoView.getVideoLayerId()) {
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index a561577..5e09416 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1226,7 +1226,19 @@
}
- /*
+ /**
+ * Register the interface to be used when a find-on-page result has become
+ * available. This will replace the current handler.
+ *
+ * @param listener An implementation of FindListener
+ * @hide
+ */
+ public void setFindListener(FindListener listener) {
+ checkThread();
+ mProvider.setFindListener(listener);
+ }
+
+ /**
* Highlight and scroll to the next occurance of String in findAll.
* Wraps the page infinitely, and scrolls. Must be called after
* calling findAll.
@@ -1238,8 +1250,9 @@
mProvider.findNext(forward);
}
- /*
+ /**
* Find all instances of find on the page and highlight them.
+ *
* @param find String to find.
* @return int The number of occurances of the String "find"
* that were found.
@@ -1250,6 +1263,18 @@
}
/**
+ * Find all instances of find on the page and highlight them,
+ * asynchronously.
+ *
+ * @param find String to find.
+ * @hide
+ */
+ public void findAllAsync(String find) {
+ checkThread();
+ mProvider.findAllAsync(find);
+ }
+
+ /**
* Start an ActionMode for finding text in this WebView. Only works if this
* WebView is attached to the view system.
* @param text If non-null, will be the initial text to search for.
diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java
index 812d89a..e5434ce 100644
--- a/core/java/android/webkit/WebViewClassic.java
+++ b/core/java/android/webkit/WebViewClassic.java
@@ -71,6 +71,8 @@
import android.util.EventLog;
import android.util.Log;
import android.view.Display;
+import android.view.GestureDetector;
+import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
import android.view.HardwareCanvas;
@@ -114,6 +116,7 @@
import android.widget.ListView;
import android.widget.OverScroller;
import android.widget.PopupWindow;
+import android.widget.Scroller;
import android.widget.TextView;
import android.widget.Toast;
@@ -548,9 +551,13 @@
if (!initData.mIsSpellCheckEnabled) {
inputType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
}
- if (WebTextView.TEXT_AREA != type
- && initData.mIsTextFieldNext) {
- imeOptions |= EditorInfo.IME_FLAG_NAVIGATE_NEXT;
+ if (WebTextView.TEXT_AREA != type) {
+ if (initData.mIsTextFieldNext) {
+ imeOptions |= EditorInfo.IME_FLAG_NAVIGATE_NEXT;
+ }
+ if (initData.mIsTextFieldPrev) {
+ imeOptions |= EditorInfo.IME_FLAG_NAVIGATE_PREVIOUS;
+ }
}
switch (type) {
case WebTextView.NORMAL_TEXT_FIELD:
@@ -798,6 +805,51 @@
}
}
+ private class TextScrollListener extends SimpleOnGestureListener {
+ @Override
+ public boolean onFling(MotionEvent e1, MotionEvent e2,
+ float velocityX, float velocityY) {
+ int maxScrollX = mEditTextContent.width() -
+ mEditTextBounds.width();
+ int maxScrollY = mEditTextContent.height() -
+ mEditTextBounds.height();
+
+ int contentVelocityX = viewToContentDimension((int)-velocityX);
+ int contentVelocityY = viewToContentDimension((int)-velocityY);
+ mEditTextScroller.fling(-mEditTextContent.left,
+ -mEditTextContent.top,
+ contentVelocityX, contentVelocityY,
+ 0, maxScrollX, 0, maxScrollY);
+ return true;
+ }
+
+ @Override
+ public boolean onScroll(MotionEvent e1, MotionEvent e2,
+ float distanceX, float distanceY) {
+ // Scrollable edit text. Scroll it.
+ int newScrollX = deltaToTextScroll(
+ -mEditTextContent.left, mEditTextContent.width(),
+ mEditTextBounds.width(),
+ (int) distanceX);
+ int newScrollY = deltaToTextScroll(
+ -mEditTextContent.top, mEditTextContent.height(),
+ mEditTextBounds.height(),
+ (int) distanceY);
+ scrollEditText(newScrollX, newScrollY);
+ return true;
+ }
+
+ private int deltaToTextScroll(int oldScroll, int contentSize,
+ int boundsSize, int delta) {
+ int newScroll = oldScroll +
+ viewToContentDimension(delta);
+ int maxScroll = contentSize - boundsSize;
+ newScroll = Math.min(maxScroll, newScroll);
+ newScroll = Math.max(0, newScroll);
+ return newScroll;
+ }
+ }
+
// The listener to capture global layout change event.
private InnerGlobalLayoutListener mGlobalLayoutListener = null;
@@ -825,7 +877,12 @@
WebViewInputConnection mInputConnection = null;
private int mFieldPointer;
private PastePopupWindow mPasteWindow;
- AutoCompletePopup mAutoCompletePopup;
+ private AutoCompletePopup mAutoCompletePopup;
+ private GestureDetector mGestureDetector;
+ Rect mEditTextBounds = new Rect();
+ Rect mEditTextContent = new Rect();
+ int mEditTextLayerId;
+ boolean mIsEditingText = false;
private static class OnTrimMemoryListener implements ComponentCallbacks2 {
private static OnTrimMemoryListener sInstance = null;
@@ -981,6 +1038,7 @@
// true when the touch movement exceeds the slop
private boolean mConfirmMove;
+ private boolean mTouchInEditText;
// if true, touch events will be first processed by WebCore, if prevent
// default is not set, the UI will continue handle them.
@@ -1029,6 +1087,9 @@
// pages with the space bar, in pixels.
private static final int PAGE_SCROLL_OVERLAP = 24;
+ // Time between successive calls to text scroll fling animation
+ private static final int TEXT_SCROLL_ANIMATION_DELAY_MS = 16;
+
/**
* These prevent calling requestLayout if either dimension is fixed. This
* depends on the layout parameters and the measure specs.
@@ -1062,6 +1123,7 @@
// Used by OverScrollGlow
OverScroller mScroller;
+ Scroller mEditTextScroller;
private boolean mInOverScrollMode = false;
private static Paint mOverScrollBackground;
@@ -1191,6 +1253,8 @@
static final int RELOCATE_AUTO_COMPLETE_POPUP = 146;
static final int FOCUS_NODE_CHANGED = 147;
static final int AUTOFILL_FORM = 148;
+ static final int ANIMATE_TEXT_SCROLL = 149;
+ static final int EDIT_TEXT_SIZE_CHANGED = 150;
private static final int FIRST_PACKAGE_MSG_ID = SCROLL_TO_MSG_ID;
private static final int LAST_PACKAGE_MSG_ID = HIT_TEST_RESULT;
@@ -1376,6 +1440,9 @@
// Used to notify listeners of a new picture.
private PictureListener mPictureListener;
+ // Used to notify listeners about find-on-page results.
+ private FindListener mFindListener;
+
/**
* Refer to {@link WebView#requestFocusNodeHref(Message)} for more information
*/
@@ -1425,6 +1492,8 @@
}
mAutoFillData = new WebViewCore.AutoFillData();
+ mGestureDetector = new GestureDetector(mContext, new TextScrollListener());
+ mEditTextScroller = new Scroller(context);
}
// === START: WebView Proxy binding ===
@@ -3629,6 +3698,17 @@
}
/**
+ * Register the interface to be used when a find-on-page result has become
+ * available. This will replace the current handler.
+ *
+ * @param listener An implementation of FindListener
+ */
+ public void setFindListener(FindListener listener) {
+ checkThread();
+ mFindListener = listener;
+ }
+
+ /**
* See {@link WebView#findNext(boolean)}
*/
@Override
@@ -3657,6 +3737,7 @@
checkThread();
if (0 == mNativeClass) return 0; // client isn't initialized
mLastFind = find;
+ if (find == null) return 0;
mWebViewCore.removeMessages(EventHub.FIND_ALL);
WebViewCore.FindAllRequest request = new
WebViewCore.FindAllRequest(find);
@@ -3911,8 +3992,10 @@
mSelectCursorExtent.offset(dx, dy);
}
}
- if (mAutoCompletePopup != null) {
- mAutoCompletePopup.scrollDelta(mCurrentScrollingLayerId, dx, dy);
+ if (mAutoCompletePopup != null &&
+ mCurrentScrollingLayerId == mEditTextLayerId) {
+ mEditTextBounds.offset(dx, dy);
+ mAutoCompletePopup.resetRect();
}
nativeScrollLayer(mCurrentScrollingLayerId, x, y);
mScrollingLayerRect.left = x;
@@ -4841,11 +4924,9 @@
*/
private void getSelectionHandles(int[] handles) {
handles[0] = mSelectCursorBase.right;
- handles[1] = mSelectCursorBase.bottom -
- (mSelectCursorBase.height() / 4);
+ handles[1] = mSelectCursorBase.bottom;
handles[2] = mSelectCursorExtent.left;
- handles[3] = mSelectCursorExtent.bottom
- - (mSelectCursorExtent.height() / 4);
+ handles[3] = mSelectCursorExtent.bottom;
if (!nativeIsBaseFirst(mNativeClass)) {
int swap = handles[0];
handles[0] = handles[2];
@@ -5939,6 +6020,9 @@
mPreventDefault = PREVENT_DEFAULT_NO;
mConfirmMove = false;
mInitialHitTestResult = null;
+ if (!mEditTextScroller.isFinished()) {
+ mEditTextScroller.abortAnimation();
+ }
if (!mScroller.isFinished()) {
// stop the current scroll animation, but if this is
// the start of a fling, allow it to add to the current
@@ -6076,6 +6160,10 @@
}
}
startTouch(x, y, eventTime);
+ if (mIsEditingText) {
+ mTouchInEditText = mEditTextBounds.contains(contentX, contentY);
+ mGestureDetector.onTouchEvent(ev);
+ }
break;
}
case MotionEvent.ACTION_MOVE: {
@@ -6109,6 +6197,13 @@
invalidate();
}
break;
+ } else if (mConfirmMove && mTouchInEditText) {
+ ViewParent parent = mWebView.getParent();
+ if (parent != null) {
+ parent.requestDisallowInterceptTouchEvent(true);
+ }
+ mGestureDetector.onTouchEvent(ev);
+ break;
}
// pass the touch events from UI thread to WebCore thread
@@ -6278,6 +6373,10 @@
break;
}
case MotionEvent.ACTION_UP: {
+ mGestureDetector.onTouchEvent(ev);
+ if (mTouchInEditText && mConfirmMove) {
+ break; // We've been scrolling the edit text.
+ }
// pass the touch events from UI thread to WebCore thread
if (shouldForwardTouchEvent()) {
TouchEventData ted = new TouchEventData();
@@ -8324,8 +8423,9 @@
break;
case FOCUS_NODE_CHANGED:
- if (mAutoCompletePopup != null) {
- mAutoCompletePopup.setFocused(msg.arg1 == mFieldPointer);
+ mIsEditingText = (msg.arg1 == mFieldPointer);
+ if (mAutoCompletePopup != null && !mIsEditingText) {
+ mAutoCompletePopup.clearAdapter();
}
// fall through to HIT_TEST_RESULT
case HIT_TEST_RESULT:
@@ -8371,11 +8471,12 @@
mFieldPointer = initData.mFieldPointer;
mInputConnection.initEditorInfo(initData);
mInputConnection.setTextAndKeepSelection(initData.mText);
- nativeMapLayerRect(mNativeClass, initData.mNodeLayerId,
- initData.mNodeBounds);
- mAutoCompletePopup.setNodeBounds(initData.mNodeBounds,
- initData.mNodeLayerId);
- mAutoCompletePopup.setText(mInputConnection.getEditable());
+ mEditTextBounds.set(initData.mNodeBounds);
+ mEditTextLayerId = initData.mNodeLayerId;
+ nativeMapLayerRect(mNativeClass, mEditTextLayerId,
+ mEditTextBounds);
+ mEditTextContent.set(initData.mContentRect);
+ relocateAutoCompletePopup();
}
break;
@@ -8390,10 +8491,11 @@
}
case UPDATE_MATCH_COUNT: {
- if (mFindCallback != null) {
- mFindCallback.updateMatchCount(msg.arg1, msg.arg2,
- (String) msg.obj);
- }
+ boolean isNewFind = mLastFind == null || !mLastFind.equals(msg.obj);
+ if (mFindCallback != null)
+ mFindCallback.updateMatchCount(msg.arg1, msg.arg2, isNewFind);
+ if (mFindListener != null)
+ mFindListener.onFindResultReceived(msg.arg1, msg.arg2, true);
break;
}
case CLEAR_CARET_HANDLE:
@@ -8413,6 +8515,16 @@
msg.arg1, /* unused */0);
break;
+ case ANIMATE_TEXT_SCROLL:
+ computeEditTextScroll();
+ break;
+
+ case EDIT_TEXT_SIZE_CHANGED:
+ if (msg.arg1 == mFieldPointer) {
+ mEditTextContent.set((Rect)msg.obj);
+ }
+ break;
+
default:
super.handleMessage(msg);
break;
@@ -8726,6 +8838,25 @@
invalidate();
}
+ private void computeEditTextScroll() {
+ if (mEditTextScroller.computeScrollOffset()) {
+ scrollEditText(mEditTextScroller.getCurrX(),
+ mEditTextScroller.getCurrY());
+ }
+ }
+
+ private void scrollEditText(int scrollX, int scrollY) {
+ // Scrollable edit text. Scroll it.
+ float maxScrollX = (float)(mEditTextContent.width() -
+ mEditTextBounds.width());
+ float scrollPercentX = ((float)scrollX)/maxScrollX;
+ mEditTextContent.offsetTo(-scrollX, -scrollY);
+ mWebViewCore.sendMessageAtFrontOfQueue(EventHub.SCROLL_TEXT_INPUT, 0,
+ scrollY, (Float)scrollPercentX);
+ mPrivateHandler.sendEmptyMessageDelayed(ANIMATE_TEXT_SCROLL,
+ TEXT_SCROLL_ANIMATION_DELAY_MS);
+ }
+
// Class used to use a dropdown for a <select> element
private class InvokeListBox implements Runnable {
// Whether the listbox allows multiple selection.
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 8def74b..d784b08 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -951,34 +951,19 @@
}
static class TextFieldInitData {
- public TextFieldInitData(int fieldPointer,
- String text, int type, boolean isSpellCheckEnabled,
- boolean autoComplete, boolean isTextFieldNext,
- String name, String label, int maxLength,
- Rect nodeBounds, int nodeLayerId) {
- mFieldPointer = fieldPointer;
- mText = text;
- mType = type;
- mIsAutoCompleteEnabled = autoComplete;
- mIsSpellCheckEnabled = isSpellCheckEnabled;
- mIsTextFieldNext = isTextFieldNext;
- mName = name;
- mLabel = label;
- mMaxLength = maxLength;
- mNodeBounds = nodeBounds;
- mNodeLayerId = nodeLayerId;
- }
- int mFieldPointer;
- String mText;
- int mType;
- boolean mIsSpellCheckEnabled;
- boolean mIsTextFieldNext;
- boolean mIsAutoCompleteEnabled;
- String mName;
- String mLabel;
- int mMaxLength;
- Rect mNodeBounds;
- int mNodeLayerId;
+ public int mFieldPointer;
+ public String mText;
+ public int mType;
+ public boolean mIsSpellCheckEnabled;
+ public boolean mIsTextFieldNext;
+ public boolean mIsTextFieldPrev;
+ public boolean mIsAutoCompleteEnabled;
+ public String mName;
+ public String mLabel;
+ public int mMaxLength;
+ public Rect mNodeBounds;
+ public int mNodeLayerId;
+ public Rect mContentRect;
}
// mAction of TouchEventData can be MotionEvent.getAction() which uses the
@@ -1929,6 +1914,11 @@
mEventHub.sendMessage(Message.obtain(null, what));
}
+ void sendMessageAtFrontOfQueue(int what, int arg1, int arg2, Object obj) {
+ mEventHub.sendMessageAtFrontOfQueue(Message.obtain(
+ null, what, arg1, arg2, obj));
+ }
+
void sendMessage(int what, Object obj) {
mEventHub.sendMessage(Message.obtain(null, what, obj));
}
@@ -2789,6 +2779,18 @@
}
// called by JNI
+ private void updateTextSizeAndScroll(int pointer, int width, int height,
+ int scrollX, int scrollY) {
+ if (mWebView != null) {
+ Rect rect = new Rect(-scrollX, -scrollY, width - scrollX,
+ height - scrollY);
+ Message.obtain(mWebView.mPrivateHandler,
+ WebViewClassic.EDIT_TEXT_SIZE_CHANGED, pointer, 0, rect)
+ .sendToTarget();
+ }
+ }
+
+ // called by JNI
private void clearTextEntry() {
if (mWebView == null) return;
Message.obtain(mWebView.mPrivateHandler,
@@ -2796,22 +2798,17 @@
}
// called by JNI
- private void initEditField(int pointer, String text, int inputType,
- boolean isSpellCheckEnabled, boolean isAutoCompleteEnabled,
- boolean nextFieldIsText, String name,
- String label, int start, int end, int selectionPtr, int maxLength,
- Rect nodeRect, int nodeLayer) {
+ private void initEditField(int start, int end, int selectionPtr,
+ TextFieldInitData initData) {
if (mWebView == null) {
return;
}
- TextFieldInitData initData = new TextFieldInitData(pointer,
- text, inputType, isSpellCheckEnabled, isAutoCompleteEnabled,
- nextFieldIsText, name, label, maxLength, nodeRect, nodeLayer);
Message.obtain(mWebView.mPrivateHandler,
WebViewClassic.INIT_EDIT_FIELD, initData).sendToTarget();
Message.obtain(mWebView.mPrivateHandler,
- WebViewClassic.REQUEST_KEYBOARD_WITH_SELECTION_MSG_ID, pointer,
- 0, new TextSelectionData(start, end, selectionPtr))
+ WebViewClassic.REQUEST_KEYBOARD_WITH_SELECTION_MSG_ID,
+ initData.mFieldPointer, 0,
+ new TextSelectionData(start, end, selectionPtr))
.sendToTarget();
}
diff --git a/core/java/android/webkit/WebViewProvider.java b/core/java/android/webkit/WebViewProvider.java
index 2e8ad6d..9016fbc 100644
--- a/core/java/android/webkit/WebViewProvider.java
+++ b/core/java/android/webkit/WebViewProvider.java
@@ -191,10 +191,14 @@
public WebBackForwardList copyBackForwardList();
+ public void setFindListener(FindListener listener);
+
public void findNext(boolean forward);
public int findAll(String find);
+ public void findAllAsync(String find);
+
public boolean showFindDialog(String text, boolean showIme);
public void clearMatches();
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 5774440..057aabe 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -88,6 +88,7 @@
ViewTreeObserver.OnTouchModeChangeListener,
RemoteViewsAdapter.RemoteAdapterConnectionCallback {
+ @SuppressWarnings("UnusedDeclaration")
private static final String TAG = "AbsListView";
/**
@@ -2429,7 +2430,7 @@
final ViewTreeObserver treeObserver = getViewTreeObserver();
treeObserver.removeOnTouchModeChangeListener(this);
if (mTextFilterEnabled && mPopup != null) {
- treeObserver.removeGlobalOnLayoutListener(this);
+ treeObserver.removeOnGlobalLayoutListener(this);
mGlobalLayoutListenerAddedFilter = false;
}
@@ -2947,16 +2948,17 @@
if (!mEdgeGlowBottom.isFinished()) {
mEdgeGlowBottom.onRelease();
}
+ invalidate(mEdgeGlowTop.getBounds(false));
} else if (rawDeltaY < 0) {
mEdgeGlowBottom.onPull((float) overscroll / getHeight());
if (!mEdgeGlowTop.isFinished()) {
mEdgeGlowTop.onRelease();
}
+ invalidate(mEdgeGlowBottom.getBounds(true));
}
}
}
mMotionY = y;
- invalidate();
}
mLastY = y;
}
@@ -2990,26 +2992,26 @@
if (!mEdgeGlowBottom.isFinished()) {
mEdgeGlowBottom.onRelease();
}
+ invalidate(mEdgeGlowTop.getBounds(false));
} else if (rawDeltaY < 0) {
mEdgeGlowBottom.onPull((float) overScrollDistance / getHeight());
if (!mEdgeGlowTop.isFinished()) {
mEdgeGlowTop.onRelease();
}
+ invalidate(mEdgeGlowBottom.getBounds(true));
}
- invalidate();
}
}
if (incrementalDeltaY != 0) {
// Coming back to 'real' list scrolling
- mScrollY = 0;
- invalidateParentIfNeeded();
-
- // No need to do all this work if we're not going to move anyway
- if (incrementalDeltaY != 0) {
- trackMotionScroll(incrementalDeltaY, incrementalDeltaY);
+ if (mScrollY != 0) {
+ mScrollY = 0;
+ invalidateParentIfNeeded();
}
+ trackMotionScroll(incrementalDeltaY, incrementalDeltaY);
+
mTouchMode = TOUCH_MODE_SCROLL;
// We did not scroll the full amount. Treat this essentially like the
@@ -3468,11 +3470,12 @@
final int rightPadding = mListPadding.right + mGlowPaddingRight;
final int width = getWidth() - leftPadding - rightPadding;
- canvas.translate(leftPadding,
- Math.min(0, scrollY + mFirstPositionDistanceGuess));
+ int edgeY = Math.min(0, scrollY + mFirstPositionDistanceGuess);
+ canvas.translate(leftPadding, edgeY);
mEdgeGlowTop.setSize(width, getHeight());
if (mEdgeGlowTop.draw(canvas)) {
- invalidate();
+ mEdgeGlowTop.setPosition(leftPadding, edgeY);
+ invalidate(mEdgeGlowTop.getBounds(false));
}
canvas.restoreToCount(restoreCount);
}
@@ -3483,12 +3486,15 @@
final int width = getWidth() - leftPadding - rightPadding;
final int height = getHeight();
- canvas.translate(-width + leftPadding,
- Math.max(height, scrollY + mLastPositionDistanceGuess));
+ int edgeX = -width + leftPadding;
+ int edgeY = Math.max(height, scrollY + mLastPositionDistanceGuess);
+ canvas.translate(edgeX, edgeY);
canvas.rotate(180, width, 0);
mEdgeGlowBottom.setSize(width, height);
if (mEdgeGlowBottom.draw(canvas)) {
- invalidate();
+ // Account for the rotation
+ mEdgeGlowBottom.setPosition(edgeX + width, edgeY);
+ invalidate(mEdgeGlowBottom.getBounds(true));
}
canvas.restoreToCount(restoreCount);
}
@@ -3874,7 +3880,8 @@
}
// Don't stop just because delta is zero (it could have been rounded)
- final boolean atEnd = trackMotionScroll(delta, delta) && (delta != 0);
+ final boolean atEdge = trackMotionScroll(delta, delta);
+ final boolean atEnd = atEdge && (delta != 0);
if (atEnd) {
if (motionView != null) {
// Tweak the scroll for how far we overshot
@@ -3889,7 +3896,7 @@
}
if (more && !atEnd) {
- invalidate();
+ if (atEdge) invalidate();
mLastFlingY = y;
post(this);
} else {
@@ -4431,7 +4438,7 @@
}
private void createScrollingCache() {
- if (mScrollingCacheEnabled && !mCachingStarted) {
+ if (mScrollingCacheEnabled && !mCachingStarted && !isHardwareAccelerated()) {
setChildrenDrawnWithCacheEnabled(true);
setChildrenDrawingCacheEnabled(true);
mCachingStarted = mCachingActive = true;
@@ -4439,23 +4446,25 @@
}
private void clearScrollingCache() {
- if (mClearScrollingCache == null) {
- mClearScrollingCache = new Runnable() {
- public void run() {
- if (mCachingStarted) {
- mCachingStarted = mCachingActive = false;
- setChildrenDrawnWithCacheEnabled(false);
- if ((mPersistentDrawingCache & PERSISTENT_SCROLLING_CACHE) == 0) {
- setChildrenDrawingCacheEnabled(false);
- }
- if (!isAlwaysDrawnWithCacheEnabled()) {
- invalidate();
+ if (!isHardwareAccelerated()) {
+ if (mClearScrollingCache == null) {
+ mClearScrollingCache = new Runnable() {
+ public void run() {
+ if (mCachingStarted) {
+ mCachingStarted = mCachingActive = false;
+ setChildrenDrawnWithCacheEnabled(false);
+ if ((mPersistentDrawingCache & PERSISTENT_SCROLLING_CACHE) == 0) {
+ setChildrenDrawingCacheEnabled(false);
+ }
+ if (!isAlwaysDrawnWithCacheEnabled()) {
+ invalidate();
+ }
}
}
- }
- };
+ };
+ }
+ post(mClearScrollingCache);
}
- post(mClearScrollingCache);
}
/**
@@ -4599,14 +4608,18 @@
mRecycler.removeSkippedScrap();
}
+ // invalidate before moving the children to avoid unnecessary invalidate
+ // calls to bubble up from the children all the way to the top
+ if (!awakenScrollBars()) {
+ invalidate();
+ }
+
offsetChildrenTopAndBottom(incrementalDeltaY);
if (down) {
mFirstPosition += count;
}
- invalidate();
-
final int absIncrementalDeltaY = Math.abs(incrementalDeltaY);
if (spaceAbove < absIncrementalDeltaY || spaceBelow < absIncrementalDeltaY) {
fillGap(down);
@@ -4629,7 +4642,6 @@
mBlockLayoutRequests = false;
invokeOnItemScrollListener();
- awakenScrollBars();
return false;
}
diff --git a/core/java/android/widget/EdgeEffect.java b/core/java/android/widget/EdgeEffect.java
index 83aa8ba..bb4a4cf 100644
--- a/core/java/android/widget/EdgeEffect.java
+++ b/core/java/android/widget/EdgeEffect.java
@@ -16,6 +16,7 @@
package android.widget;
+import android.graphics.Rect;
import com.android.internal.R;
import android.content.Context;
@@ -45,6 +46,7 @@
* {@link #draw(Canvas)} method.</p>
*/
public class EdgeEffect {
+ @SuppressWarnings("UnusedDeclaration")
private static final String TAG = "EdgeEffect";
// Time it will take the effect to fully recede in ms
@@ -57,10 +59,7 @@
private static final int PULL_DECAY_TIME = 1000;
private static final float MAX_ALPHA = 1.f;
- private static final float HELD_EDGE_ALPHA = 0.7f;
private static final float HELD_EDGE_SCALE_Y = 0.5f;
- private static final float HELD_GLOW_ALPHA = 0.5f;
- private static final float HELD_GLOW_SCALE_Y = 0.5f;
private static final float MAX_GLOW_HEIGHT = 4.f;
@@ -76,7 +75,9 @@
private final Drawable mGlow;
private int mWidth;
private int mHeight;
- private final int MIN_WIDTH = 300;
+ private int mX;
+ private int mY;
+ private static final int MIN_WIDTH = 300;
private final int mMinWidth;
private float mEdgeAlpha;
@@ -119,6 +120,13 @@
private int mState = STATE_IDLE;
private float mPullDistance;
+
+ private final Rect mBounds = new Rect();
+
+ private final int mEdgeHeight;
+ private final int mGlowHeight;
+ private final int mGlowWidth;
+ private final int mMaxEffectHeight;
/**
* Construct a new EdgeEffect with a theme appropriate for the provided context.
@@ -129,6 +137,14 @@
mEdge = res.getDrawable(R.drawable.overscroll_edge);
mGlow = res.getDrawable(R.drawable.overscroll_glow);
+ mEdgeHeight = mEdge.getIntrinsicHeight();
+ mGlowHeight = mGlow.getIntrinsicHeight();
+ mGlowWidth = mGlow.getIntrinsicWidth();
+
+ mMaxEffectHeight = (int) (Math.min(
+ mGlowHeight * MAX_GLOW_HEIGHT * mGlowHeight / mGlowWidth * 0.6f,
+ mGlowHeight * MAX_GLOW_HEIGHT) + 0.5f);
+
mMinWidth = (int) (res.getDisplayMetrics().density * MIN_WIDTH + 0.5f);
mInterpolator = new DecelerateInterpolator();
}
@@ -145,6 +161,18 @@
}
/**
+ * Set the position of this edge effect in pixels. This position is
+ * only used by {@link #getBounds(boolean)}.
+ *
+ * @param x The position of the edge effect on the X axis
+ * @param y The position of the edge effect on the Y axis
+ */
+ void setPosition(int x, int y) {
+ mX = x;
+ mY = y;
+ }
+
+ /**
* Reports if this EdgeEffect's animation is finished. If this method returns false
* after a call to {@link #draw(Canvas)} the host widget should schedule another
* drawing pass to continue the animation.
@@ -300,16 +328,11 @@
public boolean draw(Canvas canvas) {
update();
- final int edgeHeight = mEdge.getIntrinsicHeight();
- final int edgeWidth = mEdge.getIntrinsicWidth();
- final int glowHeight = mGlow.getIntrinsicHeight();
- final int glowWidth = mGlow.getIntrinsicWidth();
-
mGlow.setAlpha((int) (Math.max(0, Math.min(mGlowAlpha, 1)) * 255));
int glowBottom = (int) Math.min(
- glowHeight * mGlowScaleY * glowHeight/ glowWidth * 0.6f,
- glowHeight * MAX_GLOW_HEIGHT);
+ mGlowHeight * mGlowScaleY * mGlowHeight / mGlowWidth * 0.6f,
+ mGlowHeight * MAX_GLOW_HEIGHT);
if (mWidth < mMinWidth) {
// Center the glow and clip it.
int glowLeft = (mWidth - mMinWidth)/2;
@@ -323,7 +346,7 @@
mEdge.setAlpha((int) (Math.max(0, Math.min(mEdgeAlpha, 1)) * 255));
- int edgeBottom = (int) (edgeHeight * mEdgeScaleY);
+ int edgeBottom = (int) (mEdgeHeight * mEdgeScaleY);
if (mWidth < mMinWidth) {
// Center the edge and clip it.
int edgeLeft = (mWidth - mMinWidth)/2;
@@ -334,9 +357,25 @@
}
mEdge.draw(canvas);
+ if (mState == STATE_RECEDE && glowBottom == 0 && edgeBottom == 0) {
+ mState = STATE_IDLE;
+ }
+
return mState != STATE_IDLE;
}
+ /**
+ * Returns the bounds of the edge effect.
+ *
+ * @hide
+ */
+ public Rect getBounds(boolean reverse) {
+ mBounds.set(0, 0, mWidth, mMaxEffectHeight);
+ mBounds.offset(mX, mY - (reverse ? mMaxEffectHeight : 0));
+
+ return mBounds;
+ }
+
private void update() {
final long time = AnimationUtils.currentAnimationTimeMillis();
final float t = Math.min((time - mStartTime) / mDuration, 1.f);
diff --git a/core/java/android/widget/FrameLayout.java b/core/java/android/widget/FrameLayout.java
index da98884..d019d8c7 100644
--- a/core/java/android/widget/FrameLayout.java
+++ b/core/java/android/widget/FrameLayout.java
@@ -122,10 +122,25 @@
}
/**
+ * Describes how the foreground is positioned.
+ *
+ * @return foreground gravity.
+ *
+ * @see #setForegroundGravity(int)
+ *
+ * @attr ref android.R.styleable#FrameLayout_foregroundGravity
+ */
+ public int getForegroundGravity() {
+ return mForegroundGravity;
+ }
+
+ /**
* Describes how the foreground is positioned. Defaults to START and TOP.
*
* @param foregroundGravity See {@link android.view.Gravity}
*
+ * @see #getForegroundGravity()
+ *
* @attr ref android.R.styleable#FrameLayout_foregroundGravity
*/
@android.view.RemotableViewMethod
diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java
index fc08cc5..60dd55c 100644
--- a/core/java/android/widget/GridLayout.java
+++ b/core/java/android/widget/GridLayout.java
@@ -29,8 +29,8 @@
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
-
import com.android.internal.R;
+import android.widget.RemoteViews.RemoteView;
import java.lang.reflect.Array;
import java.util.ArrayList;
@@ -146,6 +146,7 @@
* @attr ref android.R.styleable#GridLayout_rowOrderPreserved
* @attr ref android.R.styleable#GridLayout_columnOrderPreserved
*/
+@RemoteView
public class GridLayout extends ViewGroup {
// Public constants
@@ -234,7 +235,6 @@
final Axis horizontalAxis = new Axis(true);
final Axis verticalAxis = new Axis(false);
- boolean layoutParamsValid = false;
int orientation = DEFAULT_ORIENTATION;
boolean useDefaultMargins = DEFAULT_USE_DEFAULT_MARGINS;
int alignmentMode = DEFAULT_ALIGNMENT_MODE;
@@ -713,12 +713,10 @@
minor = minor + minorSpan;
}
- lastLayoutParamsHashCode = computeLayoutParamsHashCode();
- invalidateStructure();
}
private void invalidateStructure() {
- layoutParamsValid = false;
+ lastLayoutParamsHashCode = UNINITIALIZED_HASH;
horizontalAxis.invalidateStructure();
verticalAxis.invalidateStructure();
// This can end up being done twice. Better twice than not at all.
@@ -742,10 +740,6 @@
}
final LayoutParams getLayoutParams(View c) {
- if (!layoutParamsValid) {
- validateLayoutParams();
- layoutParamsValid = true;
- }
return (LayoutParams) c.getLayoutParams();
}
@@ -874,20 +868,22 @@
return result;
}
- private void checkForLayoutParamsModification() {
- int layoutParamsHashCode = computeLayoutParamsHashCode();
- if (lastLayoutParamsHashCode != UNINITIALIZED_HASH &&
- lastLayoutParamsHashCode != layoutParamsHashCode) {
- invalidateStructure();
+ private void consistencyCheck() {
+ if (lastLayoutParamsHashCode == UNINITIALIZED_HASH) {
+ validateLayoutParams();
+ lastLayoutParamsHashCode = computeLayoutParamsHashCode();
+ } else if (lastLayoutParamsHashCode != computeLayoutParamsHashCode()) {
Log.w(TAG, "The fields of some layout parameters were modified in between layout " +
"operations. Check the javadoc for GridLayout.LayoutParams#rowSpec.");
+ invalidateStructure();
+ consistencyCheck();
}
}
// Measurement
private void measureChildWithMargins2(View child, int parentWidthSpec, int parentHeightSpec,
- int childWidth, int childHeight) {
+ int childWidth, int childHeight) {
int childWidthSpec = getChildMeasureSpec(parentWidthSpec,
mPaddingLeft + mPaddingRight + getTotalMargin(child, true), childWidth);
int childHeightSpec = getChildMeasureSpec(parentHeightSpec,
@@ -923,7 +919,7 @@
@Override
protected void onMeasure(int widthSpec, int heightSpec) {
- checkForLayoutParamsModification();
+ consistencyCheck();
/** If we have been called by {@link View#measure(int, int)}, one of width or height
* is likely to have changed. We must invalidate if so. */
@@ -993,7 +989,7 @@
*/
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- checkForLayoutParamsModification();
+ consistencyCheck();
int targetWidth = right - left;
int targetHeight = bottom - top;
@@ -1250,7 +1246,7 @@
}
private void include(List<Arc> arcs, Interval key, MutableInt size,
- boolean ignoreIfAlreadyPresent) {
+ boolean ignoreIfAlreadyPresent) {
/*
Remove self referential links.
These appear:
@@ -1429,8 +1425,8 @@
int dst = arc.span.max;
int value = arc.value.value;
result.append((src < dst) ?
- var + dst + " - " + var + src + " > " + value :
- var + src + " - " + var + dst + " < " + -value);
+ var + dst + "-" + var + src + ">=" + value :
+ var + src + "-" + var + dst + "<=" + -value);
}
return result.toString();
diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java
index a1bea43..5ed005f 100644
--- a/core/java/android/widget/LinearLayout.java
+++ b/core/java/android/widget/LinearLayout.java
@@ -235,9 +235,24 @@
}
/**
+ * @return the divider Drawable that will divide each item.
+ *
+ * @see #setDividerDrawable(Drawable)
+ *
+ * @attr ref android.R.styleable#LinearLayout_divider
+ */
+ public Drawable getDividerDrawable() {
+ return mDivider;
+ }
+
+ /**
* Set a drawable to be used as a divider between items.
+ *
* @param divider Drawable that will divide each item.
+ *
* @see #setShowDividers(int)
+ *
+ * @attr ref android.R.styleable#LinearLayout_divider
*/
public void setDividerDrawable(Drawable divider) {
if (divider == mDivider) {
@@ -398,6 +413,8 @@
*
* @return True to measure children with a weight using the minimum
* size of the largest child, false otherwise.
+ *
+ * @attr ref android.R.styleable#LinearLayout_measureWithLargestChild
*/
public boolean isMeasureWithLargestChildEnabled() {
return mUseLargestChild;
@@ -412,6 +429,8 @@
*
* @param enabled True to measure children with a weight using the
* minimum size of the largest child, false otherwise.
+ *
+ * @attr ref android.R.styleable#LinearLayout_measureWithLargestChild
*/
@android.view.RemotableViewMethod
public void setMeasureWithLargestChildEnabled(boolean enabled) {
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java
index e4b8f34..29cf000 100644
--- a/core/java/android/widget/RelativeLayout.java
+++ b/core/java/android/widget/RelativeLayout.java
@@ -219,6 +219,20 @@
}
/**
+ * Describes how the child views are positioned.
+ *
+ * @return the gravity.
+ *
+ * @see #setGravity(int)
+ * @see android.view.Gravity
+ *
+ * @attr ref android.R.styleable#RelativeLayout_gravity
+ */
+ public int getGravity() {
+ return mGravity;
+ }
+
+ /**
* Describes how the child views are positioned. Defaults to
* <code>Gravity.LEFT | Gravity.TOP</code>.
*
diff --git a/core/java/android/widget/TableLayout.java b/core/java/android/widget/TableLayout.java
index b870cee..6331b6d 100644
--- a/core/java/android/widget/TableLayout.java
+++ b/core/java/android/widget/TableLayout.java
@@ -232,6 +232,8 @@
* <p>Indicates whether all columns are shrinkable or not.</p>
*
* @return true if all columns are shrinkable, false otherwise
+ *
+ * @attr ref android.R.styleable#TableLayout_shrinkColumns
*/
public boolean isShrinkAllColumns() {
return mShrinkAllColumns;
@@ -252,6 +254,8 @@
* <p>Indicates whether all columns are stretchable or not.</p>
*
* @return true if all columns are stretchable, false otherwise
+ *
+ * @attr ref android.R.styleable#TableLayout_stretchColumns
*/
public boolean isStretchAllColumns() {
return mStretchAllColumns;
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index e535170..9941c95 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -139,6 +139,7 @@
import android.widget.AdapterView.OnItemClickListener;
import android.widget.RemoteViews.RemoteView;
+import com.android.internal.util.ArrayUtils;
import com.android.internal.util.FastMath;
import com.android.internal.widget.EditableInputConnection;
@@ -1214,6 +1215,7 @@
if (imm != null) imm.restartInput(this);
}
+ // Will change text color
if (mEditor != null) getEditor().invalidateTextDisplayList();
prepareCursorControllers();
@@ -2328,7 +2330,6 @@
public void setHighlightColor(int color) {
if (mHighlightColor != color) {
mHighlightColor = color;
- if (mEditor != null) getEditor().invalidateTextDisplayList();
invalidate();
}
}
@@ -2349,6 +2350,7 @@
mShadowDx = dx;
mShadowDy = dy;
+ // Will change text clip region
if (mEditor != null) getEditor().invalidateTextDisplayList();
invalidate();
}
@@ -2841,6 +2843,7 @@
}
}
if (inval) {
+ // Text needs to be redrawn with the new color
if (mEditor != null) getEditor().invalidateTextDisplayList();
invalidate();
}
@@ -3332,7 +3335,7 @@
invalidate();
}
- // Invalidate display list if hint will be used
+ // Invalidate display list if hint is currently used
if (mEditor != null && mText.length() == 0 && mHint != null) {
getEditor().invalidateTextDisplayList();
}
@@ -8274,6 +8277,7 @@
if (getEditor().mPositionListener != null) {
getEditor().mPositionListener.onScrollChanged();
}
+ // Internal scroll affects the clip boundaries
getEditor().invalidateTextDisplayList();
}
}
@@ -11299,7 +11303,7 @@
InputContentType mInputContentType;
InputMethodState mInputMethodState;
- DisplayList mTextDisplayList;
+ DisplayList[] mTextDisplayLists;
boolean mFrozenWithFocus;
boolean mSelectionMoved;
@@ -11545,7 +11549,6 @@
void sendOnTextChanged(int start, int after) {
updateSpellCheckSpans(start, start + after, false);
- invalidateTextDisplayList();
// Hide the controllers as soon as text is modified (typing, procedural...)
// We do not hide the span controllers, since they can be added when a new text is
@@ -11702,36 +11705,91 @@
layout.drawBackground(canvas, highlight, mHighlightPaint, cursorOffsetVertical,
firstLine, lastLine);
- if (mTextDisplayList == null || !mTextDisplayList.isValid()) {
- boolean displayListCreated = false;
- if (mTextDisplayList == null) {
- mTextDisplayList = getHardwareRenderer().createDisplayList("Text");
- displayListCreated = true;
+ if (mTextDisplayLists == null) {
+ mTextDisplayLists = new DisplayList[ArrayUtils.idealObjectArraySize(0)];
+ }
+ if (! (layout instanceof DynamicLayout)) {
+ Log.e(LOG_TAG, "Editable TextView is not using a DynamicLayout");
+ return;
+ }
+
+ DynamicLayout dynamicLayout = (DynamicLayout) layout;
+ int[] blockEnds = dynamicLayout.getBlockEnds();
+ int[] blockIndices = dynamicLayout.getBlockIndices();
+ final int numberOfBlocks = dynamicLayout.getNumberOfBlocks();
+
+ canvas.translate(mScrollX, mScrollY);
+ int endOfPreviousBlock = -1;
+ int searchStartIndex = 0;
+ for (int i = 0; i < numberOfBlocks; i++) {
+ int blockEnd = blockEnds[i];
+ int blockIndex = blockIndices[i];
+
+ final boolean blockIsInvalid = blockIndex == DynamicLayout.INVALID_BLOCK_INDEX;
+ if (blockIsInvalid) {
+ blockIndex = getAvailableDisplayListIndex(blockIndices, numberOfBlocks,
+ searchStartIndex);
+ // Dynamic layout internal block indices structure is updated from Editor
+ blockIndices[i] = blockIndex;
+ searchStartIndex = blockIndex + 1;
}
- final HardwareCanvas hardwareCanvas = mTextDisplayList.start();
- try {
- hardwareCanvas.setViewport(width, height);
- // The dirty rect should always be null for a display list
- hardwareCanvas.onPreDraw(null);
- hardwareCanvas.translate(-mScrollX, -mScrollY);
- layout.drawText(hardwareCanvas, firstLine, lastLine);
- //layout.draw(hardwareCanvas, highlight, mHighlightPaint, cursorOffsetVertical);
- hardwareCanvas.translate(mScrollX, mScrollY);
- } finally {
- hardwareCanvas.onPostDraw();
- mTextDisplayList.end();
- if (displayListCreated && USE_DISPLAY_LIST_PROPERTIES) {
- mTextDisplayList.setLeftTopRightBottom(mLeft, mTop, mRight, mBottom);
+ DisplayList blockDisplayList = mTextDisplayLists[blockIndex];
+ if (blockDisplayList == null) {
+ blockDisplayList = mTextDisplayLists[blockIndex] =
+ getHardwareRenderer().createDisplayList("Text " + blockIndex);
+ } else {
+ if (blockIsInvalid) blockDisplayList.invalidate();
+ }
+
+ if (!blockDisplayList.isValid()) {
+ final HardwareCanvas hardwareCanvas = blockDisplayList.start();
+ try {
+ hardwareCanvas.setViewport(width, height);
+ // The dirty rect should always be null for a display list
+ hardwareCanvas.onPreDraw(null);
+ hardwareCanvas.translate(-mScrollX, -mScrollY);
+ layout.drawText(hardwareCanvas, endOfPreviousBlock + 1, blockEnd);
+ hardwareCanvas.translate(mScrollX, mScrollY);
+ } finally {
+ hardwareCanvas.onPostDraw();
+ blockDisplayList.end();
+ if (USE_DISPLAY_LIST_PROPERTIES) {
+ blockDisplayList.setLeftTopRightBottom(mLeft, mTop, mRight, mBottom);
+ }
}
}
+
+ ((HardwareCanvas) canvas).drawDisplayList(blockDisplayList, width, height, null,
+ DisplayList.FLAG_CLIP_CHILDREN);
+ endOfPreviousBlock = blockEnd;
}
- canvas.translate(mScrollX, mScrollY);
- ((HardwareCanvas) canvas).drawDisplayList(mTextDisplayList, width, height, null,
- DisplayList.FLAG_CLIP_CHILDREN);
canvas.translate(-mScrollX, -mScrollY);
}
+ private int getAvailableDisplayListIndex(int[] blockIndices, int numberOfBlocks,
+ int searchStartIndex) {
+ int length = mTextDisplayLists.length;
+ for (int i = searchStartIndex; i < length; i++) {
+ boolean blockIndexFound = false;
+ for (int j = 0; j < numberOfBlocks; j++) {
+ if (blockIndices[j] == i) {
+ blockIndexFound = true;
+ break;
+ }
+ }
+ if (blockIndexFound) continue;
+ return i;
+ }
+
+ // No available index found, the pool has to grow
+ int newSize = ArrayUtils.idealIntArraySize(length + 1);
+ DisplayList[] displayLists = new DisplayList[newSize];
+ System.arraycopy(mTextDisplayLists, 0, displayLists, 0, length);
+ mTextDisplayLists = displayLists;
+ return length;
+ }
+
private void drawCursor(Canvas canvas, int cursorOffsetVertical) {
final boolean translate = cursorOffsetVertical != 0;
if (translate) canvas.translate(0, cursorOffsetVertical);
@@ -11742,7 +11800,11 @@
}
private void invalidateTextDisplayList() {
- if (mTextDisplayList != null) mTextDisplayList.invalidate();
+ if (mTextDisplayLists != null) {
+ for (int i = 0; i < mTextDisplayLists.length; i++) {
+ if (mTextDisplayLists[i] != null) mTextDisplayLists[i].invalidate();
+ }
+ }
}
private void updateCursorsPositions() {
diff --git a/core/java/com/android/internal/os/RuntimeInit.java b/core/java/com/android/internal/os/RuntimeInit.java
index 53516c0..cdd2ad1 100644
--- a/core/java/com/android/internal/os/RuntimeInit.java
+++ b/core/java/com/android/internal/os/RuntimeInit.java
@@ -50,6 +50,10 @@
private static volatile boolean mCrashing = false;
+ private static final native void nativeZygoteInit();
+ private static final native void nativeFinishInit();
+ private static final native void nativeSetExitWithoutCleanup(boolean exitWithoutCleanup);
+
/**
* Use this to log a message when a thread exits due to an uncaught
* exception. The framework catches these for the main threads, so
@@ -91,13 +95,6 @@
/* set default handler; this applies to all threads in the VM */
Thread.setDefaultUncaughtExceptionHandler(new UncaughtHandler());
- int hasQwerty = getQwertyKeyboard();
-
- if (DEBUG) Slog.d(TAG, ">>>>> qwerty keyboard = " + hasQwerty);
- if (hasQwerty == 1) {
- System.setProperty("qwerty", "1");
- }
-
/*
* Install a TimezoneGetter subclass for ZoneInfo.db
*/
@@ -235,16 +232,14 @@
* Now that we're running in interpreted code, call back into native code
* to run the system.
*/
- finishInit();
+ nativeFinishInit();
if (DEBUG) Slog.d(TAG, "Leaving RuntimeInit!");
}
- public static final native void finishInit();
-
/**
* The main function called when started through the zygote process. This
- * could be unified with main(), if the native code in finishInit()
+ * could be unified with main(), if the native code in nativeFinishInit()
* were rationalized with Zygote startup.<p>
*
* Current recognized args:
@@ -262,7 +257,7 @@
redirectLogStreams();
commonInit();
- zygoteInitNative();
+ nativeZygoteInit();
applicationInit(targetSdkVersion, argv);
}
@@ -287,6 +282,13 @@
private static void applicationInit(int targetSdkVersion, String[] argv)
throws ZygoteInit.MethodAndArgsCaller {
+ // If the application calls System.exit(), terminate the process
+ // immediately without running any shutdown hooks. It is not possible to
+ // shutdown an Android application gracefully. Among other things, the
+ // Android runtime shutdown hooks close the Binder driver, which can cause
+ // leftover running threads to crash before the process actually exits.
+ nativeSetExitWithoutCleanup(true);
+
// We want to be fairly aggressive about heap utilization, to avoid
// holding on to a lot of memory that isn't needed.
VMRuntime.getRuntime().setTargetHeapUtilization(0.75f);
@@ -315,24 +317,6 @@
System.setErr(new AndroidPrintStream(Log.WARN, "System.err"));
}
- public static final native void zygoteInitNative();
-
- /**
- * Returns 1 if the computer is on. If the computer isn't on, the value returned by this method is undefined.
- */
- public static final native int isComputerOn();
-
- /**
- * Turns the computer on if the computer is off. If the computer is on, the behavior of this method is undefined.
- */
- public static final native void turnComputerOn();
-
- /**
- *
- * @return 1 if the device has a qwerty keyboard
- */
- public static native int getQwertyKeyboard();
-
/**
* Report a serious error in the current process. May or may not cause
* the process to terminate (depends on system settings).
diff --git a/core/java/com/android/internal/util/BitwiseOutputStream.java b/core/java/com/android/internal/util/BitwiseOutputStream.java
index 70c0be8..ddecbed 100644
--- a/core/java/com/android/internal/util/BitwiseOutputStream.java
+++ b/core/java/com/android/internal/util/BitwiseOutputStream.java
@@ -77,6 +77,7 @@
byte[] newBuf = new byte[(mPos + bits) >>> 2];
System.arraycopy(mBuf, 0, newBuf, 0, mEnd >>> 3);
mBuf = newBuf;
+ mEnd = newBuf.length << 3;
}
/**
diff --git a/core/java/com/android/internal/view/menu/MenuItemImpl.java b/core/java/com/android/internal/view/menu/MenuItemImpl.java
index 04147ab..2564921 100644
--- a/core/java/com/android/internal/view/menu/MenuItemImpl.java
+++ b/core/java/com/android/internal/view/menu/MenuItemImpl.java
@@ -382,7 +382,10 @@
}
if (mIconResId != NO_ICON) {
- return mMenu.getResources().getDrawable(mIconResId);
+ Drawable icon = mMenu.getResources().getDrawable(mIconResId);
+ mIconResId = NO_ICON;
+ mIconDrawable = icon;
+ return icon;
}
return null;
diff --git a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
index d51ced11..f2b6e45 100644
--- a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
+++ b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
@@ -164,9 +164,10 @@
mFeedbackCount = a.getInt(R.styleable.MultiWaveView_feedbackCount,
mFeedbackCount);
mHandleDrawable = new TargetDrawable(res,
- a.getDrawable(R.styleable.MultiWaveView_handleDrawable));
+ a.peekValue(R.styleable.MultiWaveView_handleDrawable).resourceId);
mTapRadius = mHandleDrawable.getWidth()/2;
- mOuterRing = new TargetDrawable(res, a.getDrawable(R.styleable.MultiWaveView_waveDrawable));
+ mOuterRing = new TargetDrawable(res,
+ a.peekValue(R.styleable.MultiWaveView_waveDrawable).resourceId);
// Read chevron animation drawables
final int chevrons[] = { R.styleable.MultiWaveView_leftChevronDrawable,
@@ -174,11 +175,12 @@
R.styleable.MultiWaveView_topChevronDrawable,
R.styleable.MultiWaveView_bottomChevronDrawable
};
+
for (int chevron : chevrons) {
- Drawable chevronDrawable = a.getDrawable(chevron);
+ TypedValue typedValue = a.peekValue(chevron);
for (int i = 0; i < mFeedbackCount; i++) {
mChevronDrawables.add(
- chevronDrawable != null ? new TargetDrawable(res, chevronDrawable) : null);
+ typedValue != null ? new TargetDrawable(res, typedValue.resourceId) : null);
}
}
@@ -519,8 +521,8 @@
int count = array.length();
ArrayList<TargetDrawable> targetDrawables = new ArrayList<TargetDrawable>(count);
for (int i = 0; i < count; i++) {
- Drawable drawable = array.getDrawable(i);
- targetDrawables.add(new TargetDrawable(res, drawable));
+ TypedValue value = array.peekValue(i);
+ targetDrawables.add(new TargetDrawable(res, value != null ? value.resourceId : 0));
}
array.recycle();
mTargetResourceId = resourceId;
@@ -679,7 +681,7 @@
if (DEBUG && mDragging) Log.v(TAG, "** Handle RELEASE");
switchToState(STATE_FINISH, event.getX(), event.getY());
}
-
+
private void handleCancel(MotionEvent event) {
if (DEBUG && mDragging) Log.v(TAG, "** Handle CANCEL");
mActiveTarget = -1; // Drop the active target if canceled.
@@ -723,7 +725,7 @@
float dx = limitX - target.getX();
float dy = limitY - target.getY();
float dist2 = dx*dx + dy*dy;
- if (target.isValid() && dist2 < hitRadius2 && dist2 < best) {
+ if (target.isEnabled() && dist2 < hitRadius2 && dist2 < best) {
activeTarget = i;
best = dist2;
}
@@ -968,4 +970,34 @@
array.recycle();
return targetContentDescriptions;
}
+
+ public int getResourceIdForTarget(int index) {
+ final TargetDrawable drawable = mTargetDrawables.get(index);
+ return drawable == null ? 0 : drawable.getResourceId();
+ }
+
+ public void setEnableTarget(int resourceId, boolean enabled) {
+ for (int i = 0; i < mTargetDrawables.size(); i++) {
+ final TargetDrawable target = mTargetDrawables.get(i);
+ if (target.getResourceId() == resourceId) {
+ target.setEnabled(enabled);
+ break; // should never be more than one match
+ }
+ }
+ }
+
+ /**
+ * Gets the position of a target in the array that matches the given resource.
+ * @param resourceId
+ * @return the index or -1 if not found
+ */
+ public int getTargetPosition(int resourceId) {
+ for (int i = 0; i < mTargetDrawables.size(); i++) {
+ final TargetDrawable target = mTargetDrawables.get(i);
+ if (target.getResourceId() == resourceId) {
+ return i; // should never be more than one match
+ }
+ }
+ return -1;
+ }
}
diff --git a/core/java/com/android/internal/widget/multiwaveview/TargetDrawable.java b/core/java/com/android/internal/widget/multiwaveview/TargetDrawable.java
index aa9fa45..ec2c945 100644
--- a/core/java/com/android/internal/widget/multiwaveview/TargetDrawable.java
+++ b/core/java/com/android/internal/widget/multiwaveview/TargetDrawable.java
@@ -40,6 +40,8 @@
private float mScaleY = 1.0f;
private float mAlpha = 1.0f;
private Drawable mDrawable;
+ private boolean mEnabled = true;
+ private int mResourceId;
/* package */ static class DrawableWithAlpha extends Drawable {
private float mAlpha = 1.0f;
@@ -72,10 +74,8 @@
}
public TargetDrawable(Resources res, int resId) {
- this(res, resId == 0 ? null : res.getDrawable(resId));
- }
-
- public TargetDrawable(Resources res, Drawable drawable) {
+ mResourceId = resId;
+ Drawable drawable = resId == 0 ? null : res.getDrawable(resId);
// Mutate the drawable so we can animate shared drawable properties.
mDrawable = drawable != null ? drawable.mutate() : null;
resizeDrawables();
@@ -122,8 +122,8 @@
*
* @return
*/
- public boolean isValid() {
- return mDrawable != null;
+ public boolean isEnabled() {
+ return mDrawable != null && mEnabled;
}
/**
@@ -205,7 +205,7 @@
}
public void draw(Canvas canvas) {
- if (mDrawable == null) {
+ if (mDrawable == null || !mEnabled) {
return;
}
canvas.save(Canvas.MATRIX_SAVE_FLAG);
@@ -216,4 +216,12 @@
mDrawable.draw(canvas);
canvas.restore();
}
+
+ public void setEnabled(boolean enabled) {
+ mEnabled = enabled;
+ }
+
+ public int getResourceId() {
+ return mResourceId;
+ }
}
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 92b07b3..5650d68 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -211,6 +211,7 @@
libicuuc \
libicui18n \
libmedia \
+ libmedia_native \
libwpa_client \
libjpeg \
libusbhost \
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 92ff8da..e705c47 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -189,49 +189,32 @@
/*
* Code written in the Java Programming Language calls here from main().
*/
-static void com_android_internal_os_RuntimeInit_finishInit(JNIEnv* env, jobject clazz)
+static void com_android_internal_os_RuntimeInit_nativeFinishInit(JNIEnv* env, jobject clazz)
{
gCurRuntime->onStarted();
}
-static void com_android_internal_os_RuntimeInit_zygoteInit(JNIEnv* env, jobject clazz)
+static void com_android_internal_os_RuntimeInit_nativeZygoteInit(JNIEnv* env, jobject clazz)
{
gCurRuntime->onZygoteInit();
}
-static jint com_android_internal_os_RuntimeInit_isComputerOn(JNIEnv* env, jobject clazz)
+static void com_android_internal_os_RuntimeInit_nativeSetExitWithoutCleanup(JNIEnv* env,
+ jobject clazz, jboolean exitWithoutCleanup)
{
- return 1;
-}
-
-static void com_android_internal_os_RuntimeInit_turnComputerOn(JNIEnv* env, jobject clazz)
-{
-}
-
-static jint com_android_internal_os_RuntimeInit_getQwertyKeyboard(JNIEnv* env, jobject clazz)
-{
- char* value = getenv("qwerty");
- if (value != NULL && strcmp(value, "true") == 0) {
- return 1;
- }
-
- return 0;
+ gCurRuntime->setExitWithoutCleanup(exitWithoutCleanup);
}
/*
* JNI registration.
*/
static JNINativeMethod gMethods[] = {
- { "finishInit", "()V",
- (void*) com_android_internal_os_RuntimeInit_finishInit },
- { "zygoteInitNative", "()V",
- (void*) com_android_internal_os_RuntimeInit_zygoteInit },
- { "isComputerOn", "()I",
- (void*) com_android_internal_os_RuntimeInit_isComputerOn },
- { "turnComputerOn", "()V",
- (void*) com_android_internal_os_RuntimeInit_turnComputerOn },
- { "getQwertyKeyboard", "()I",
- (void*) com_android_internal_os_RuntimeInit_getQwertyKeyboard },
+ { "nativeFinishInit", "()V",
+ (void*) com_android_internal_os_RuntimeInit_nativeFinishInit },
+ { "nativeZygoteInit", "()V",
+ (void*) com_android_internal_os_RuntimeInit_nativeZygoteInit },
+ { "nativeSetExitWithoutCleanup", "(Z)V",
+ (void*) com_android_internal_os_RuntimeInit_nativeSetExitWithoutCleanup },
};
int register_com_android_internal_os_RuntimeInit(JNIEnv* env)
@@ -245,7 +228,8 @@
/*static*/ JavaVM* AndroidRuntime::mJavaVM = NULL;
-AndroidRuntime::AndroidRuntime()
+AndroidRuntime::AndroidRuntime() :
+ mExitWithoutCleanup(false)
{
SkGraphics::Init();
// this sets our preference for 16bit images during decode
@@ -323,8 +307,7 @@
*/
static void runtime_exit(int code)
{
- gCurRuntime->onExit(code);
- exit(code);
+ gCurRuntime->exit(code);
}
/*
@@ -895,10 +878,16 @@
ALOGW("Warning: VM did not shut down cleanly\n");
}
-void AndroidRuntime::onExit(int code)
+void AndroidRuntime::exit(int code)
{
- ALOGV("AndroidRuntime onExit calling exit(%d)", code);
- exit(code);
+ if (mExitWithoutCleanup) {
+ ALOGI("VM exiting with result code %d, cleanup skipped.", code);
+ ::_exit(code);
+ } else {
+ ALOGI("VM exiting with result code %d.", code);
+ onExit(code);
+ ::exit(code);
+ }
}
void AndroidRuntime::onVmCreated(JNIEnv* env)
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp
index 4b64bf3..dcd1d28 100644
--- a/core/jni/android/graphics/BitmapFactory.cpp
+++ b/core/jni/android/graphics/BitmapFactory.cpp
@@ -79,22 +79,65 @@
}
static bool optionsPurgeable(JNIEnv* env, jobject options) {
- return options != NULL &&
- env->GetBooleanField(options, gOptions_purgeableFieldID);
+ return options != NULL && env->GetBooleanField(options, gOptions_purgeableFieldID);
}
static bool optionsShareable(JNIEnv* env, jobject options) {
- return options != NULL &&
- env->GetBooleanField(options, gOptions_shareableFieldID);
+ return options != NULL && env->GetBooleanField(options, gOptions_shareableFieldID);
}
static bool optionsJustBounds(JNIEnv* env, jobject options) {
- return options != NULL &&
- env->GetBooleanField(options, gOptions_justBoundsFieldID);
+ return options != NULL && env->GetBooleanField(options, gOptions_justBoundsFieldID);
+}
+
+static void scaleNinePatchChunk(android::Res_png_9patch* chunk, float scale) {
+ chunk->paddingLeft = int(chunk->paddingLeft * scale + 0.5f);
+ chunk->paddingTop = int(chunk->paddingTop * scale + 0.5f);
+ chunk->paddingRight = int(chunk->paddingRight * scale + 0.5f);
+ chunk->paddingBottom = int(chunk->paddingBottom * scale + 0.5f);
+
+ for (int i = 0; i < chunk->numXDivs; i++) {
+ chunk->xDivs[i] = int(chunk->xDivs[i] * scale + 0.5f);
+ if (i > 0 && chunk->xDivs[i] == chunk->xDivs[i - 1]) {
+ chunk->xDivs[i]++;
+ }
+ }
+
+ for (int i = 0; i < chunk->numYDivs; i++) {
+ chunk->yDivs[i] = int(chunk->yDivs[i] * scale + 0.5f);
+ if (i > 0 && chunk->yDivs[i] == chunk->yDivs[i - 1]) {
+ chunk->yDivs[i]++;
+ }
+ }
+}
+
+static jbyteArray nativeScaleNinePatch(JNIEnv* env, jobject, jbyteArray chunkObject, jfloat scale,
+ jobject padding) {
+
+ jbyte* array = env->GetByteArrayElements(chunkObject, 0);
+ if (array != NULL) {
+ size_t chunkSize = env->GetArrayLength(chunkObject);
+ void* storage = alloca(chunkSize);
+ android::Res_png_9patch* chunk = static_cast<android::Res_png_9patch*>(storage);
+ memcpy(chunk, array, chunkSize);
+ android::Res_png_9patch::deserialize(chunk);
+
+ scaleNinePatchChunk(chunk, scale);
+ memcpy(array, chunk, chunkSize);
+
+ if (padding) {
+ GraphicsJNI::set_jrect(env, padding, chunk->paddingLeft, chunk->paddingTop,
+ chunk->paddingRight, chunk->paddingBottom);
+ }
+
+ env->ReleaseByteArrayElements(chunkObject, array, 0);
+ }
+ return chunkObject;
}
static SkPixelRef* installPixelRef(SkBitmap* bitmap, SkStream* stream,
- int sampleSize, bool ditherImage) {
+ int sampleSize, bool ditherImage) {
+
SkImageRef* pr;
// only use ashmem for large images, since mmaps come at a price
if (bitmap->getSize() >= 32 * 1024) {
@@ -112,23 +155,29 @@
// i.e. dynamically allocated, since its lifetime may exceed the current stack
// frame.
static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding,
- jobject options, bool allowPurgeable,
- bool forcePurgeable = false) {
+ jobject options, bool allowPurgeable, bool forcePurgeable = false,
+ bool applyScale = false, float scale = 1.0f) {
+
int sampleSize = 1;
+
SkImageDecoder::Mode mode = SkImageDecoder::kDecodePixels_Mode;
SkBitmap::Config prefConfig = SkBitmap::kARGB_8888_Config;
+
bool doDither = true;
bool isMutable = false;
- bool isPurgeable = forcePurgeable ||
- (allowPurgeable && optionsPurgeable(env, options));
+ bool willScale = applyScale && scale != 1.0f;
+ bool isPurgeable = !willScale &&
+ (forcePurgeable || (allowPurgeable && optionsPurgeable(env, options)));
bool preferQualityOverSpeed = false;
+
jobject javaBitmap = NULL;
- if (NULL != options) {
+ if (options != NULL) {
sampleSize = env->GetIntField(options, gOptions_sampleSizeFieldID);
if (optionsJustBounds(env, options)) {
mode = SkImageDecoder::kDecodeBounds_Mode;
}
+
// initialize these, in case we fail later on
env->SetIntField(options, gOptions_widthFieldID, -1);
env->SetIntField(options, gOptions_heightFieldID, -1);
@@ -143,8 +192,12 @@
javaBitmap = env->GetObjectField(options, gOptions_bitmapFieldID);
}
+ if (willScale && javaBitmap != NULL) {
+ return nullObjectReturn("Cannot pre-scale a reused bitmap");
+ }
+
SkImageDecoder* decoder = SkImageDecoder::Factory(stream);
- if (NULL == decoder) {
+ if (decoder == NULL) {
return nullObjectReturn("SkImageDecoder::Factory returned null");
}
@@ -152,35 +205,35 @@
decoder->setDitherImage(doDither);
decoder->setPreferQualityOverSpeed(preferQualityOverSpeed);
- NinePatchPeeker peeker(decoder);
- JavaPixelAllocator javaAllocator(env);
- SkBitmap* bitmap;
+ NinePatchPeeker peeker(decoder);
+ JavaPixelAllocator javaAllocator(env);
+
+ SkBitmap* bitmap;
if (javaBitmap == NULL) {
bitmap = new SkBitmap;
} else {
if (sampleSize != 1) {
return nullObjectReturn("SkImageDecoder: Cannot reuse bitmap with sampleSize != 1");
}
- bitmap = (SkBitmap *) env->GetIntField(javaBitmap, gBitmap_nativeBitmapFieldID);
+ bitmap = (SkBitmap*) env->GetIntField(javaBitmap, gBitmap_nativeBitmapFieldID);
// config of supplied bitmap overrules config set in options
prefConfig = bitmap->getConfig();
}
- Res_png_9patch dummy9Patch;
- SkAutoTDelete<SkImageDecoder> add(decoder);
- SkAutoTDelete<SkBitmap> adb(bitmap, (javaBitmap == NULL));
+ SkAutoTDelete<SkImageDecoder> add(decoder);
+ SkAutoTDelete<SkBitmap> adb(bitmap, javaBitmap == NULL);
decoder->setPeeker(&peeker);
if (!isPurgeable) {
decoder->setAllocator(&javaAllocator);
}
- AutoDecoderCancel adc(options, decoder);
+ AutoDecoderCancel adc(options, decoder);
// To fix the race condition in case "requestCancelDecode"
// happens earlier than AutoDecoderCancel object is added
// to the gAutoDecoderCancelMutex linked list.
- if (NULL != options && env->GetBooleanField(options, gOptions_mCancelID)) {
+ if (options != NULL && env->GetBooleanField(options, gOptions_mCancelID)) {
return nullObjectReturn("gOptions_mCancelID");
}
@@ -188,38 +241,57 @@
if (isPurgeable) {
decodeMode = SkImageDecoder::kDecodeBounds_Mode;
}
- if (!decoder->decode(stream, bitmap, prefConfig, decodeMode, javaBitmap != NULL)) {
+
+ SkBitmap* decoded;
+ if (willScale) {
+ decoded = new SkBitmap;
+ } else {
+ decoded = bitmap;
+ }
+ SkAutoTDelete<SkBitmap> adb2(willScale ? decoded : NULL);
+
+ if (!decoder->decode(stream, decoded, prefConfig, decodeMode, javaBitmap != NULL)) {
return nullObjectReturn("decoder->decode returned false");
}
+ int scaledWidth = decoded->width();
+ int scaledHeight = decoded->height();
+
+ if (willScale && mode != SkImageDecoder::kDecodeBounds_Mode) {
+ scaledWidth = int(scaledWidth * scale + 0.5f);
+ scaledHeight = int(scaledHeight * scale + 0.5f);
+ }
+
// update options (if any)
- if (NULL != options) {
- env->SetIntField(options, gOptions_widthFieldID, bitmap->width());
- env->SetIntField(options, gOptions_heightFieldID, bitmap->height());
- // TODO: set the mimeType field with the data from the codec.
- // but how to reuse a set of strings, rather than allocating new one
- // each time?
+ if (options != NULL) {
+ env->SetIntField(options, gOptions_widthFieldID, scaledWidth);
+ env->SetIntField(options, gOptions_heightFieldID, scaledHeight);
env->SetObjectField(options, gOptions_mimeFieldID,
- getMimeTypeString(env, decoder->getFormat()));
+ getMimeTypeString(env, decoder->getFormat()));
}
// if we're in justBounds mode, return now (skip the java bitmap)
- if (SkImageDecoder::kDecodeBounds_Mode == mode) {
+ if (mode == SkImageDecoder::kDecodeBounds_Mode) {
return NULL;
}
jbyteArray ninePatchChunk = NULL;
if (peeker.fPatchIsValid) {
+ if (willScale) {
+ scaleNinePatchChunk(peeker.fPatch, scale);
+ }
+
size_t ninePatchArraySize = peeker.fPatch->serializedSize();
ninePatchChunk = env->NewByteArray(ninePatchArraySize);
- if (NULL == ninePatchChunk) {
+ if (ninePatchChunk == NULL) {
return nullObjectReturn("ninePatchChunk == null");
}
- jbyte* array = (jbyte*)env->GetPrimitiveArrayCritical(ninePatchChunk,
- NULL);
- if (NULL == array) {
+
+ jbyte* array = (jbyte*) env->GetPrimitiveArrayCritical(ninePatchChunk, NULL);
+ if (array == NULL) {
return nullObjectReturn("primitive array == null");
}
+
peeker.fPatch->serialize(array);
env->ReleasePrimitiveArrayCritical(ninePatchChunk, array, 0);
}
@@ -227,13 +299,32 @@
// detach bitmap from its autodeleter, since we want to own it now
adb.detach();
+ if (willScale) {
+ // This is weird so let me explain: we could use the scale parameter
+ // directly, but for historical reasons this is how the corresponding
+ // Dalvik code has always behaved. We simply recreate the behavior here.
+ // The result is slightly different from simply using scale because of
+ // the 0.5f rounding bias applied when computing the target image size
+ const float sx = scaledWidth / float(decoded->width());
+ const float sy = scaledHeight / float(decoded->height());
+
+ bitmap->setConfig(decoded->getConfig(), scaledWidth, scaledHeight);
+ bitmap->allocPixels(&javaAllocator, NULL);
+ bitmap->eraseColor(0);
+
+ SkPaint paint;
+ paint.setFilterBitmap(true);
+
+ SkCanvas canvas(*bitmap);
+ canvas.scale(sx, sy);
+ canvas.drawBitmap(*decoded, 0.0f, 0.0f, &paint);
+ }
+
if (padding) {
if (peeker.fPatchIsValid) {
GraphicsJNI::set_jrect(env, padding,
- peeker.fPatch->paddingLeft,
- peeker.fPatch->paddingTop,
- peeker.fPatch->paddingRight,
- peeker.fPatch->paddingBottom);
+ peeker.fPatch->paddingLeft, peeker.fPatch->paddingTop,
+ peeker.fPatch->paddingRight, peeker.fPatch->paddingBottom);
} else {
GraphicsJNI::set_jrect(env, padding, -1, -1, -1, -1);
}
@@ -262,22 +353,26 @@
isMutable, ninePatchChunk);
}
-static jobject nativeDecodeStream(JNIEnv* env, jobject clazz,
- jobject is, // InputStream
- jbyteArray storage, // byte[]
- jobject padding,
- jobject options) { // BitmapFactory$Options
+static jobject nativeDecodeStreamScaled(JNIEnv* env, jobject clazz, jobject is, jbyteArray storage,
+ jobject padding, jobject options, jboolean applyScale, jfloat scale) {
+
jobject bitmap = NULL;
SkStream* stream = CreateJavaInputStreamAdaptor(env, is, storage, 0);
if (stream) {
// for now we don't allow purgeable with java inputstreams
- bitmap = doDecode(env, stream, padding, options, false);
+ bitmap = doDecode(env, stream, padding, options, false, false, applyScale, scale);
stream->unref();
}
return bitmap;
}
+static jobject nativeDecodeStream(JNIEnv* env, jobject clazz, jobject is, jbyteArray storage,
+ jobject padding, jobject options) {
+
+ return nativeDecodeStreamScaled(env, clazz, is, storage, padding, options, false, 1.0f);
+}
+
static ssize_t getFDSize(int fd) {
off64_t curr = ::lseek64(fd, 0, SEEK_CUR);
if (curr < 0) {
@@ -288,10 +383,9 @@
return size;
}
-static jobject nativeDecodeFileDescriptor(JNIEnv* env, jobject clazz,
- jobject fileDescriptor,
- jobject padding,
- jobject bitmapFactoryOptions) {
+static jobject nativeDecodeFileDescriptor(JNIEnv* env, jobject clazz, jobject fileDescriptor,
+ jobject padding, jobject bitmapFactoryOptions) {
+
NPE_CHECK_RETURN_ZERO(env, fileDescriptor);
jint descriptor = jniGetFDFromFileDescriptor(env, fileDescriptor);
@@ -353,10 +447,9 @@
return stream;
}
-static jobject nativeDecodeAsset(JNIEnv* env, jobject clazz,
- jint native_asset, // Asset
- jobject padding, // Rect
- jobject options) { // BitmapFactory$Options
+static jobject nativeDecodeAssetScaled(JNIEnv* env, jobject clazz, jint native_asset,
+ jobject padding, jobject options, jboolean applyScale, jfloat scale) {
+
SkStream* stream;
Asset* asset = reinterpret_cast<Asset*>(native_asset);
bool forcePurgeable = optionsPurgeable(env, options);
@@ -364,7 +457,7 @@
// if we could "ref/reopen" the asset, we may not need to copy it here
// and we could assume optionsShareable, since assets are always RO
stream = copyAssetToStream(asset);
- if (NULL == stream) {
+ if (stream == NULL) {
return NULL;
}
} else {
@@ -373,18 +466,24 @@
stream = new AssetStreamAdaptor(asset);
}
SkAutoUnref aur(stream);
- return doDecode(env, stream, padding, options, true, forcePurgeable);
+ return doDecode(env, stream, padding, options, true, forcePurgeable, applyScale, scale);
+}
+
+static jobject nativeDecodeAsset(JNIEnv* env, jobject clazz, jint native_asset,
+ jobject padding, jobject options) {
+
+ return nativeDecodeAssetScaled(env, clazz, native_asset, padding, options, false, 1.0f);
}
static jobject nativeDecodeByteArray(JNIEnv* env, jobject, jbyteArray byteArray,
- int offset, int length, jobject options) {
+ int offset, int length, jobject options) {
+
/* If optionsShareable() we could decide to just wrap the java array and
share it, but that means adding a globalref to the java array object
and managing its lifetime. For now we just always copy the array's data
if optionsPurgeable(), unless we're just decoding bounds.
*/
- bool purgeable = optionsPurgeable(env, options)
- && !optionsJustBounds(env, options);
+ bool purgeable = optionsPurgeable(env, options) && !optionsJustBounds(env, options);
AutoJavaByteArray ar(env, byteArray);
SkStream* stream = new SkMemoryStream(ar.ptr() + offset, length, purgeable);
SkAutoUnref aur(stream);
@@ -395,65 +494,6 @@
(void)AutoDecoderCancel::RequestCancel(joptions);
}
-static jbyteArray nativeScaleNinePatch(JNIEnv* env, jobject, jbyteArray chunkObject, jfloat scale,
- jobject padding) {
-
- jbyte* array = env->GetByteArrayElements(chunkObject, 0);
- if (array != NULL) {
- size_t chunkSize = env->GetArrayLength(chunkObject);
- void* storage = alloca(chunkSize);
- android::Res_png_9patch* chunk = static_cast<android::Res_png_9patch*>(storage);
- memcpy(chunk, array, chunkSize);
- android::Res_png_9patch::deserialize(chunk);
-
- chunk->paddingLeft = int(chunk->paddingLeft * scale + 0.5f);
- chunk->paddingTop = int(chunk->paddingTop * scale + 0.5f);
- chunk->paddingRight = int(chunk->paddingRight * scale + 0.5f);
- chunk->paddingBottom = int(chunk->paddingBottom * scale + 0.5f);
-
- for (int i = 0; i < chunk->numXDivs; i++) {
- chunk->xDivs[i] = int(chunk->xDivs[i] * scale + 0.5f);
- if (i > 0 && chunk->xDivs[i] == chunk->xDivs[i - 1]) {
- chunk->xDivs[i]++;
- }
- }
-
- for (int i = 0; i < chunk->numYDivs; i++) {
- chunk->yDivs[i] = int(chunk->yDivs[i] * scale + 0.5f);
- if (i > 0 && chunk->yDivs[i] == chunk->yDivs[i - 1]) {
- chunk->yDivs[i]++;
- }
- }
-
- memcpy(array, chunk, chunkSize);
-
- if (padding) {
- GraphicsJNI::set_jrect(env, padding, chunk->paddingLeft, chunk->paddingTop,
- chunk->paddingRight, chunk->paddingBottom);
- }
-
- env->ReleaseByteArrayElements(chunkObject, array, 0);
- }
- return chunkObject;
-}
-
-static void nativeSetDefaultConfig(JNIEnv* env, jobject, int nativeConfig) {
- SkBitmap::Config config = static_cast<SkBitmap::Config>(nativeConfig);
-
- // these are the only default configs that make sense for codecs right now
- static const SkBitmap::Config gValidDefConfig[] = {
- SkBitmap::kRGB_565_Config,
- SkBitmap::kARGB_8888_Config,
- };
-
- for (size_t i = 0; i < SK_ARRAY_COUNT(gValidDefConfig); i++) {
- if (config == gValidDefConfig[i]) {
- SkImageDecoder::SetDeviceConfig(config);
- break;
- }
- }
-}
-
static jboolean nativeIsSeekable(JNIEnv* env, jobject, jobject fileDescriptor) {
jint descriptor = jniGetFDFromFileDescriptor(env, fileDescriptor);
return ::lseek64(descriptor, 0, SEEK_CUR) != -1 ? JNI_TRUE : JNI_FALSE;
@@ -466,6 +506,10 @@
"(Ljava/io/InputStream;[BLandroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;",
(void*)nativeDecodeStream
},
+ { "nativeDecodeStream",
+ "(Ljava/io/InputStream;[BLandroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;ZF)Landroid/graphics/Bitmap;",
+ (void*)nativeDecodeStreamScaled
+ },
{ "nativeDecodeFileDescriptor",
"(Ljava/io/FileDescriptor;Landroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;",
@@ -477,6 +521,11 @@
(void*)nativeDecodeAsset
},
+ { "nativeDecodeAsset",
+ "(ILandroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;ZF)Landroid/graphics/Bitmap;",
+ (void*)nativeDecodeAssetScaled
+ },
+
{ "nativeDecodeByteArray",
"([BIILandroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;",
(void*)nativeDecodeByteArray
@@ -487,8 +536,6 @@
(void*)nativeScaleNinePatch
},
- { "nativeSetDefaultConfig", "(I)V", (void*)nativeSetDefaultConfig },
-
{ "nativeIsSeekable",
"(Ljava/io/FileDescriptor;)Z",
(void*)nativeIsSeekable
diff --git a/core/jni/android_app_NativeActivity.cpp b/core/jni/android_app_NativeActivity.cpp
index 088062a..655a834 100644
--- a/core/jni/android_app_NativeActivity.cpp
+++ b/core/jni/android_app_NativeActivity.cpp
@@ -162,12 +162,12 @@
int32_t AInputQueue::getEvent(AInputEvent** outEvent) {
*outEvent = NULL;
- bool finishNow = false;
-
char byteread;
ssize_t nRead = read(mDispatchKeyRead, &byteread, 1);
+
+ Mutex::Autolock _l(mLock);
+
if (nRead == 1) {
- mLock.lock();
if (mDispatchingKeys.size() > 0) {
KeyEvent* kevent = mDispatchingKeys[0];
*outEvent = kevent;
@@ -178,6 +178,8 @@
inflight.finishSeq = 0;
mInFlightEvents.push(inflight);
}
+
+ bool finishNow = false;
if (mFinishPreDispatches.size() > 0) {
finish_pre_dispatch finish(mFinishPreDispatches[0]);
mFinishPreDispatches.removeAt(0);
@@ -193,7 +195,6 @@
ALOGW("getEvent couldn't find inflight for seq %d", finish.seq);
}
}
- mLock.unlock();
if (finishNow) {
finishEvent(*outEvent, true, false);
@@ -206,7 +207,8 @@
uint32_t consumerSeq;
InputEvent* myEvent = NULL;
- status_t res = mConsumer.consume(this, true /*consumeBatches*/, &consumerSeq, &myEvent);
+ status_t res = mConsumer.consume(&mPooledInputEventFactory, true /*consumeBatches*/,
+ &consumerSeq, &myEvent);
if (res != android::OK) {
if (res != android::WOULD_BLOCK) {
ALOGW("channel '%s' ~ Failed to consume input event. status=%d",
@@ -215,6 +217,10 @@
return -1;
}
+ if (mConsumer.hasDeferredEvent()) {
+ wakeupDispatchLocked();
+ }
+
in_flight_event inflight;
inflight.event = myEvent;
inflight.seq = -1;
@@ -255,7 +261,8 @@
return;
}
- mLock.lock();
+ Mutex::Autolock _l(mLock);
+
const size_t N = mInFlightEvents.size();
for (size_t i=0; i<N; i++) {
const in_flight_event& inflight(mInFlightEvents[i]);
@@ -267,111 +274,82 @@
mConsumer.getChannel()->getName().string(), res);
}
}
- if (static_cast<InputEvent*>(event)->getType() == AINPUT_EVENT_TYPE_KEY) {
- mAvailKeyEvents.push(static_cast<KeyEvent*>(event));
- } else {
- mAvailMotionEvents.push(static_cast<MotionEvent*>(event));
- }
+ mPooledInputEventFactory.recycle(static_cast<InputEvent*>(event));
mInFlightEvents.removeAt(i);
- mLock.unlock();
return;
}
}
- mLock.unlock();
-
+
ALOGW("finishEvent called for unknown event: %p", event);
}
void AInputQueue::dispatchEvent(android::KeyEvent* event) {
- mLock.lock();
+ Mutex::Autolock _l(mLock);
+
LOG_TRACE("dispatchEvent: dispatching=%d write=%d\n", mDispatchingKeys.size(),
mDispatchKeyWrite);
mDispatchingKeys.add(event);
- wakeupDispatch();
- mLock.unlock();
+ wakeupDispatchLocked();
}
void AInputQueue::finishPreDispatch(int seq, bool handled) {
- mLock.lock();
+ Mutex::Autolock _l(mLock);
+
LOG_TRACE("finishPreDispatch: seq=%d handled=%d\n", seq, handled ? 1 : 0);
finish_pre_dispatch finish;
finish.seq = seq;
finish.handled = handled;
mFinishPreDispatches.add(finish);
- wakeupDispatch();
- mLock.unlock();
+ wakeupDispatchLocked();
}
KeyEvent* AInputQueue::consumeUnhandledEvent() {
- KeyEvent* event = NULL;
+ Mutex::Autolock _l(mLock);
- mLock.lock();
+ KeyEvent* event = NULL;
if (mUnhandledKeys.size() > 0) {
event = mUnhandledKeys[0];
mUnhandledKeys.removeAt(0);
}
- mLock.unlock();
LOG_TRACE("consumeUnhandledEvent: KeyEvent=%p", event);
-
return event;
}
KeyEvent* AInputQueue::consumePreDispatchingEvent(int* outSeq) {
- KeyEvent* event = NULL;
+ Mutex::Autolock _l(mLock);
- mLock.lock();
+ KeyEvent* event = NULL;
if (mPreDispatchingKeys.size() > 0) {
const in_flight_event& inflight(mPreDispatchingKeys[0]);
event = static_cast<KeyEvent*>(inflight.event);
*outSeq = inflight.seq;
mPreDispatchingKeys.removeAt(0);
}
- mLock.unlock();
LOG_TRACE("consumePreDispatchingEvent: KeyEvent=%p", event);
-
return event;
}
KeyEvent* AInputQueue::createKeyEvent() {
- mLock.lock();
- KeyEvent* event;
- if (mAvailKeyEvents.size() <= 0) {
- event = new KeyEvent();
- } else {
- event = mAvailKeyEvents.top();
- mAvailKeyEvents.pop();
- }
- mLock.unlock();
- return event;
-}
+ Mutex::Autolock _l(mLock);
-MotionEvent* AInputQueue::createMotionEvent() {
- mLock.lock();
- MotionEvent* event;
- if (mAvailMotionEvents.size() <= 0) {
- event = new MotionEvent();
- } else {
- event = mAvailMotionEvents.top();
- mAvailMotionEvents.pop();
- }
- mLock.unlock();
- return event;
+ return mPooledInputEventFactory.createKeyEvent();
}
void AInputQueue::doUnhandledKey(KeyEvent* keyEvent) {
- mLock.lock();
+ Mutex::Autolock _l(mLock);
+
LOG_TRACE("Unhandled key: pending=%d write=%d\n", mUnhandledKeys.size(), mWorkWrite);
if (mUnhandledKeys.size() <= 0 && mWorkWrite >= 0) {
write_work(mWorkWrite, CMD_DEF_KEY);
}
mUnhandledKeys.add(keyEvent);
- mLock.unlock();
}
bool AInputQueue::preDispatchKey(KeyEvent* keyEvent) {
- mLock.lock();
+ Mutex::Autolock _l(mLock);
+
LOG_TRACE("preDispatch key: pending=%d write=%d\n", mPreDispatchingKeys.size(), mWorkWrite);
const size_t N = mInFlightEvents.size();
for (size_t i=0; i<N; i++) {
@@ -380,7 +358,6 @@
if (inflight.seq >= 0) {
// This event has already been pre-dispatched!
LOG_TRACE("Event already pre-dispatched!");
- mLock.unlock();
return false;
}
mSeq++;
@@ -391,7 +368,6 @@
write_work(mWorkWrite, CMD_DEF_KEY);
}
mPreDispatchingKeys.add(inflight);
- mLock.unlock();
return true;
}
}
@@ -400,7 +376,7 @@
return false;
}
-void AInputQueue::wakeupDispatch() {
+void AInputQueue::wakeupDispatchLocked() {
restart:
char dummy = 0;
int res = write(mDispatchKeyWrite, &dummy, sizeof(dummy));
diff --git a/core/jni/android_bluetooth_BluetoothAudioGateway.cpp b/core/jni/android_bluetooth_BluetoothAudioGateway.cpp
index 3b8fb79..294c626 100644
--- a/core/jni/android_bluetooth_BluetoothAudioGateway.cpp
+++ b/core/jni/android_bluetooth_BluetoothAudioGateway.cpp
@@ -196,7 +196,7 @@
struct sockaddr_rc raddr;
int alen = sizeof(raddr);
- int nsk = accept(ag_fd, (struct sockaddr *) &raddr, &alen);
+ int nsk = TEMP_FAILURE_RETRY(accept(ag_fd, (struct sockaddr *) &raddr, &alen));
if (nsk < 0) {
ALOGE("Error on accept from socket fd %d: %s (%d).",
ag_fd,
@@ -331,12 +331,12 @@
to.tv_sec = timeout_ms / 1000;
to.tv_usec = 1000 * (timeout_ms % 1000);
}
- n = select(MAX(nat->hf_ag_rfcomm_sock,
- nat->hs_ag_rfcomm_sock) + 1,
+ n = TEMP_FAILURE_RETRY(select(
+ MAX(nat->hf_ag_rfcomm_sock, nat->hs_ag_rfcomm_sock) + 1,
&rset,
NULL,
NULL,
- (timeout_ms < 0 ? NULL : &to));
+ (timeout_ms < 0 ? NULL : &to)));
if (timeout_ms > 0) {
jint remaining = to.tv_sec*1000 + to.tv_usec/1000;
ALOGI("Remaining time %ldms", (long)remaining);
@@ -391,7 +391,7 @@
ALOGE("Neither HF nor HS listening sockets are open!");
return JNI_FALSE;
}
- n = poll(fds, cnt, timeout_ms);
+ n = TEMP_FAILURE_RETRY(poll(fds, cnt, timeout_ms));
if (n <= 0) {
if (n < 0) {
ALOGE("listening poll() on RFCOMM sockets: %s (%d)",
diff --git a/core/jni/android_database_SQLiteConnection.cpp b/core/jni/android_database_SQLiteConnection.cpp
index c8f911f..fca5f20 100644
--- a/core/jni/android_database_SQLiteConnection.cpp
+++ b/core/jni/android_database_SQLiteConnection.cpp
@@ -36,8 +36,8 @@
#include "android_database_SQLiteCommon.h"
+// Set to 1 to use UTF16 storage for localized indexes.
#define UTF16_STORAGE 0
-#define ANDROID_TABLE "android_metadata"
namespace android {
@@ -245,139 +245,16 @@
}
}
-// Set locale in the android_metadata table, install localized collators, and rebuild indexes
-static void nativeSetLocale(JNIEnv* env, jclass clazz, jint connectionPtr, jstring localeStr) {
+static void nativeRegisterLocalizedCollators(JNIEnv* env, jclass clazz, jint connectionPtr,
+ jstring localeStr) {
SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);
- if (connection->openFlags & SQLiteConnection::NO_LOCALIZED_COLLATORS) {
- // We should probably throw IllegalStateException but the contract for
- // setLocale says that we just do nothing. Oh well.
- return;
- }
+ const char* locale = env->GetStringUTFChars(localeStr, NULL);
+ int err = register_localized_collators(connection->db, locale, UTF16_STORAGE);
+ env->ReleaseStringUTFChars(localeStr, locale);
- int err;
- char const* locale = env->GetStringUTFChars(localeStr, NULL);
- sqlite3_stmt* stmt = NULL;
- char** meta = NULL;
- int rowCount, colCount;
- char* dbLocale = NULL;
-
- // create the table, if necessary and possible
- if (!(connection->openFlags & SQLiteConnection::OPEN_READONLY)) {
- err = sqlite3_exec(connection->db,
- "CREATE TABLE IF NOT EXISTS " ANDROID_TABLE " (locale TEXT)",
- NULL, NULL, NULL);
- if (err != SQLITE_OK) {
- ALOGE("CREATE TABLE " ANDROID_TABLE " failed");
- throw_sqlite3_exception(env, connection->db);
- goto done;
- }
- }
-
- // try to read from the table
- err = sqlite3_get_table(connection->db,
- "SELECT locale FROM " ANDROID_TABLE " LIMIT 1",
- &meta, &rowCount, &colCount, NULL);
if (err != SQLITE_OK) {
- ALOGE("SELECT locale FROM " ANDROID_TABLE " failed");
throw_sqlite3_exception(env, connection->db);
- goto done;
- }
-
- dbLocale = (rowCount >= 1) ? meta[colCount] : NULL;
-
- if (dbLocale != NULL && !strcmp(dbLocale, locale)) {
- // database locale is the same as the desired locale; set up the collators and go
- err = register_localized_collators(connection->db, locale, UTF16_STORAGE);
- if (err != SQLITE_OK) {
- throw_sqlite3_exception(env, connection->db);
- }
- goto done; // no database changes needed
- }
-
- if (connection->openFlags & SQLiteConnection::OPEN_READONLY) {
- // read-only database, so we're going to have to put up with whatever we got
- // For registering new index. Not for modifing the read-only database.
- err = register_localized_collators(connection->db, locale, UTF16_STORAGE);
- if (err != SQLITE_OK) {
- throw_sqlite3_exception(env, connection->db);
- }
- goto done;
- }
-
- // need to update android_metadata and indexes atomically, so use a transaction...
- err = sqlite3_exec(connection->db, "BEGIN TRANSACTION", NULL, NULL, NULL);
- if (err != SQLITE_OK) {
- ALOGE("BEGIN TRANSACTION failed setting locale");
- throw_sqlite3_exception(env, connection->db);
- goto done;
- }
-
- err = register_localized_collators(connection->db, locale, UTF16_STORAGE);
- if (err != SQLITE_OK) {
- ALOGE("register_localized_collators() failed setting locale");
- throw_sqlite3_exception(env, connection->db);
- goto rollback;
- }
-
- err = sqlite3_exec(connection->db, "DELETE FROM " ANDROID_TABLE, NULL, NULL, NULL);
- if (err != SQLITE_OK) {
- ALOGE("DELETE failed setting locale");
- throw_sqlite3_exception(env, connection->db);
- goto rollback;
- }
-
- static const char *sql = "INSERT INTO " ANDROID_TABLE " (locale) VALUES(?);";
- err = sqlite3_prepare_v2(connection->db, sql, -1, &stmt, NULL);
- if (err != SQLITE_OK) {
- ALOGE("sqlite3_prepare_v2(\"%s\") failed", sql);
- throw_sqlite3_exception(env, connection->db);
- goto rollback;
- }
-
- err = sqlite3_bind_text(stmt, 1, locale, -1, SQLITE_TRANSIENT);
- if (err != SQLITE_OK) {
- ALOGE("sqlite3_bind_text() failed setting locale");
- throw_sqlite3_exception(env, connection->db);
- goto rollback;
- }
-
- err = sqlite3_step(stmt);
- if (err != SQLITE_OK && err != SQLITE_DONE) {
- ALOGE("sqlite3_step(\"%s\") failed setting locale", sql);
- throw_sqlite3_exception(env, connection->db);
- goto rollback;
- }
-
- err = sqlite3_exec(connection->db, "REINDEX LOCALIZED", NULL, NULL, NULL);
- if (err != SQLITE_OK) {
- ALOGE("REINDEX LOCALIZED failed");
- throw_sqlite3_exception(env, connection->db);
- goto rollback;
- }
-
- // all done, yay!
- err = sqlite3_exec(connection->db, "COMMIT TRANSACTION", NULL, NULL, NULL);
- if (err != SQLITE_OK) {
- ALOGE("COMMIT TRANSACTION failed setting locale");
- throw_sqlite3_exception(env, connection->db);
- goto done;
- }
-
-rollback:
- if (err != SQLITE_OK) {
- sqlite3_exec(connection->db, "ROLLBACK TRANSACTION", NULL, NULL, NULL);
- }
-
-done:
- if (stmt) {
- sqlite3_finalize(stmt);
- }
- if (meta) {
- sqlite3_free_table(meta);
- }
- if (locale) {
- env->ReleaseStringUTFChars(localeStr, locale);
}
}
@@ -898,8 +775,8 @@
(void*)nativeClose },
{ "nativeRegisterCustomFunction", "(ILandroid/database/sqlite/SQLiteCustomFunction;)V",
(void*)nativeRegisterCustomFunction },
- { "nativeSetLocale", "(ILjava/lang/String;)V",
- (void*)nativeSetLocale },
+ { "nativeRegisterLocalizedCollators", "(ILjava/lang/String;)V",
+ (void*)nativeRegisterLocalizedCollators },
{ "nativePrepareStatement", "(ILjava/lang/String;)I",
(void*)nativePrepareStatement },
{ "nativeFinalizeStatement", "(II)V",
diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp
index 599211e..36b4b45 100644
--- a/core/jni/android_hardware_Camera.cpp
+++ b/core/jni/android_hardware_Camera.cpp
@@ -457,9 +457,9 @@
// connect to camera service
static void android_hardware_Camera_native_setup(JNIEnv *env, jobject thiz,
- jobject weak_this, jint cameraId)
+ jobject weak_this, jint cameraId, jboolean force, jboolean keep)
{
- sp<Camera> camera = Camera::connect(cameraId);
+ sp<Camera> camera = Camera::connect(cameraId, force, keep);
if (camera == NULL) {
jniThrowRuntimeException(env, "Fail to connect to camera service");
@@ -545,12 +545,22 @@
sp<Camera> camera = get_native_camera(env, thiz, NULL);
if (camera == 0) return;
- sp<SurfaceTexture> surfaceTexture = NULL;
+ sp<BufferQueue> bufferQueue = NULL;
if (jSurfaceTexture != NULL) {
- surfaceTexture = reinterpret_cast<SurfaceTexture*>(env->GetIntField(
+ sp<SurfaceTexture> surfaceTexture = reinterpret_cast<SurfaceTexture*>(env->GetIntField(
jSurfaceTexture, fields.surfaceTexture));
+ if (surfaceTexture != NULL) {
+ bufferQueue = surfaceTexture->getBufferQueue();
+ }
+ else {
+ jniThrowException(env, "java/lang/IllegalArgumentException",
+ "SurfaceTexture already released in setPreviewTexture");
+ return;
+ }
+
}
- if (camera->setPreviewTexture(surfaceTexture) != NO_ERROR) {
+
+ if (camera->setPreviewTexture(bufferQueue) != NO_ERROR) {
jniThrowException(env, "java/io/IOException",
"setPreviewTexture failed");
}
@@ -690,7 +700,12 @@
sp<Camera> camera = get_native_camera(env, thiz, NULL);
if (camera == 0) return 0;
- return env->NewStringUTF(camera->getParameters().string());
+ String8 params8 = camera->getParameters();
+ if (params8.isEmpty()) {
+ jniThrowRuntimeException(env, "getParameters failed (empty parameters)");
+ return 0;
+ }
+ return env->NewStringUTF(params8.string());
}
static void android_hardware_Camera_reconnect(JNIEnv *env, jobject thiz)
@@ -806,6 +821,15 @@
}
}
+static bool android_hardware_Camera_isReleased(JNIEnv *env, jobject thiz)
+{
+ ALOGV("isReleased");
+ sp<Camera> camera = get_native_camera(env, thiz, NULL);
+ if (camera == 0) return true;
+
+ return (camera->sendCommand(CAMERA_CMD_PING, 0, 0) != NO_ERROR);
+}
+
//-------------------------------------------------
static JNINativeMethod camMethods[] = {
@@ -816,7 +840,7 @@
"(ILandroid/hardware/Camera$CameraInfo;)V",
(void*)android_hardware_Camera_getCameraInfo },
{ "native_setup",
- "(Ljava/lang/Object;I)V",
+ "(Ljava/lang/Object;IZZ)V",
(void*)android_hardware_Camera_native_setup },
{ "native_release",
"()V",
@@ -884,6 +908,9 @@
{ "enableFocusMoveCallback",
"(I)V",
(void *)android_hardware_Camera_enableFocusMoveCallback},
+ { "isReleased",
+ "()Z",
+ (void *)android_hardware_Camera_isReleased},
};
struct field {
diff --git a/core/jni/android_media_AudioRecord.cpp b/core/jni/android_media_AudioRecord.cpp
index b34dbce..480c3a6 100644
--- a/core/jni/android_media_AudioRecord.cpp
+++ b/core/jni/android_media_AudioRecord.cpp
@@ -23,13 +23,13 @@
#include <fcntl.h>
#include <math.h>
-#include "jni.h"
-#include "JNIHelp.h"
-#include "android_runtime/AndroidRuntime.h"
+#include <jni.h>
+#include <JNIHelp.h>
+#include <android_runtime/AndroidRuntime.h>
-#include "utils/Log.h"
-#include "media/AudioRecord.h"
-#include "media/mediarecorder.h"
+#include <utils/Log.h>
+#include <media/AudioRecord.h>
+#include <media/mediarecorder.h>
#include <cutils/bitops.h>
@@ -72,7 +72,7 @@
#define AUDIORECORD_ERROR_SETUP_NATIVEINITFAILED -20
jint android_media_translateRecorderErrorCode(int code) {
- switch(code) {
+ switch (code) {
case NO_ERROR:
return AUDIORECORD_SUCCESS;
case BAD_VALUE:
@@ -81,7 +81,7 @@
return AUDIORECORD_ERROR_INVALID_OPERATION;
default:
return AUDIORECORD_ERROR;
- }
+ }
}
@@ -90,14 +90,14 @@
if (event == AudioRecord::EVENT_MORE_DATA) {
// set size to 0 to signal we're not using the callback to read more data
AudioRecord::Buffer* pBuff = (AudioRecord::Buffer*)info;
- pBuff->size = 0;
-
+ pBuff->size = 0;
+
} else if (event == AudioRecord::EVENT_MARKER) {
audiorecord_callback_cookie *callbackInfo = (audiorecord_callback_cookie *)user;
JNIEnv *env = AndroidRuntime::getJNIEnv();
if (user && env) {
env->CallStaticVoidMethod(
- callbackInfo->audioRecord_class,
+ callbackInfo->audioRecord_class,
javaAudioRecordFields.postNativeEventInJava,
callbackInfo->audioRecord_ref, event, 0,0, NULL);
if (env->ExceptionCheck()) {
@@ -111,7 +111,7 @@
JNIEnv *env = AndroidRuntime::getJNIEnv();
if (user && env) {
env->CallStaticVoidMethod(
- callbackInfo->audioRecord_class,
+ callbackInfo->audioRecord_class,
javaAudioRecordFields.postNativeEventInJava,
callbackInfo->audioRecord_ref, event, 0,0, NULL);
if (env->ExceptionCheck()) {
@@ -140,7 +140,7 @@
uint32_t nbChannels = popcount(channels);
// compare the format against the Java constants
- if ((audioFormat != javaAudioRecordFields.PCM16)
+ if ((audioFormat != javaAudioRecordFields.PCM16)
&& (audioFormat != javaAudioRecordFields.PCM8)) {
ALOGE("Error creating AudioRecord: unsupported audio format.");
return AUDIORECORD_ERROR_SETUP_INVALIDFORMAT;
@@ -156,7 +156,7 @@
}
int frameSize = nbChannels * bytesPerSample;
size_t frameCount = buffSizeInBytes / frameSize;
-
+
if (uint32_t(source) >= AUDIO_SOURCE_CNT) {
ALOGE("Error creating AudioRecord: unknown source.");
return AUDIORECORD_ERROR_SETUP_INVALIDSOURCE;
@@ -181,11 +181,11 @@
// create an uninitialized AudioRecord object
lpRecorder = new AudioRecord();
- if(lpRecorder == NULL) {
+ if (lpRecorder == NULL) {
ALOGE("Error creating AudioRecord instance.");
return AUDIORECORD_ERROR_SETUP_NATIVEINITFAILED;
}
-
+
// create the callback information:
// this data will be passed with every AudioRecord callback
jclass clazz = env->GetObjectClass(thiz);
@@ -197,7 +197,7 @@
lpCallbackData->audioRecord_class = (jclass)env->NewGlobalRef(clazz);
// we use a weak reference so the AudioRecord object can be garbage collected.
lpCallbackData->audioRecord_ref = env->NewGlobalRef(weak_this);
-
+
lpRecorder->set((audio_source_t) source,
sampleRateInHertz,
format, // word length, PCM
@@ -210,7 +210,7 @@
true, // threadCanCallJava)
sessionId);
- if(lpRecorder->initCheck() != NO_ERROR) {
+ if (lpRecorder->initCheck() != NO_ERROR) {
ALOGE("Error creating AudioRecord instance: initialization check failed.");
goto native_init_failure;
}
@@ -225,16 +225,16 @@
env->ReleasePrimitiveArrayCritical(jSession, nSession, 0);
nSession = NULL;
- // save our newly created C++ AudioRecord in the "nativeRecorderInJavaObj" field
+ // save our newly created C++ AudioRecord in the "nativeRecorderInJavaObj" field
// of the Java object
env->SetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj, (int)lpRecorder);
-
+
// save our newly created callback information in the "nativeCallbackCookie" field
// of the Java object (in mNativeCallbackCookie) so we can free the memory in finalize()
env->SetIntField(thiz, javaAudioRecordFields.nativeCallbackCookie, (int)lpCallbackData);
-
+
return AUDIORECORD_SUCCESS;
-
+
// failure:
native_init_failure:
env->DeleteGlobalRef(lpCallbackData->audioRecord_class);
@@ -246,7 +246,7 @@
env->SetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj, 0);
env->SetIntField(thiz, javaAudioRecordFields.nativeCallbackCookie, 0);
-
+
return AUDIORECORD_ERROR_SETUP_NATIVEINITFAILED;
}
@@ -256,13 +256,13 @@
static int
android_media_AudioRecord_start(JNIEnv *env, jobject thiz)
{
- AudioRecord *lpRecorder =
+ AudioRecord *lpRecorder =
(AudioRecord *)env->GetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
if (lpRecorder == NULL ) {
jniThrowException(env, "java/lang/IllegalStateException", NULL);
return AUDIORECORD_ERROR;
}
-
+
return android_media_translateRecorderErrorCode(lpRecorder->start());
}
@@ -271,7 +271,7 @@
static void
android_media_AudioRecord_stop(JNIEnv *env, jobject thiz)
{
- AudioRecord *lpRecorder =
+ AudioRecord *lpRecorder =
(AudioRecord *)env->GetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
if (lpRecorder == NULL ) {
jniThrowException(env, "java/lang/IllegalStateException", NULL);
@@ -288,7 +288,7 @@
// serialize access. Ugly, but functional.
Mutex::Autolock lock(&sLock);
- AudioRecord *lpRecorder =
+ AudioRecord *lpRecorder =
(AudioRecord *)env->GetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
audiorecord_callback_cookie *lpCookie = (audiorecord_callback_cookie *)env->GetIntField(
thiz, javaAudioRecordFields.nativeCallbackCookie);
@@ -304,7 +304,7 @@
lpRecorder->stop();
delete lpRecorder;
}
-
+
// delete the callback information
if (lpCookie) {
ALOGV("deleting lpCookie: %x\n", (int)lpCookie);
@@ -329,7 +329,7 @@
AudioRecord *lpRecorder = NULL;
// get the audio recorder from which we'll read new audio samples
- lpRecorder =
+ lpRecorder =
(AudioRecord *)env->GetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
if (lpRecorder == NULL) {
ALOGE("Unable to retrieve AudioRecord object, can't record");
@@ -355,8 +355,8 @@
// read the new audio data from the native AudioRecord object
ssize_t recorderBuffSize = lpRecorder->frameCount()*lpRecorder->frameSize();
- ssize_t readSize = lpRecorder->read(recordBuff + offsetInBytes,
- sizeInBytes > (jint)recorderBuffSize ?
+ ssize_t readSize = lpRecorder->read(recordBuff + offsetInBytes,
+ sizeInBytes > (jint)recorderBuffSize ?
(jint)recorderBuffSize : sizeInBytes );
env->ReleaseByteArrayElements(javaAudioData, recordBuff, 0);
@@ -381,41 +381,41 @@
//ALOGV("Entering android_media_AudioRecord_readInBuffer");
// get the audio recorder from which we'll read new audio samples
- lpRecorder =
+ lpRecorder =
(AudioRecord *)env->GetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
- if(lpRecorder==NULL)
+ if (lpRecorder==NULL)
return 0;
// direct buffer and direct access supported?
long capacity = env->GetDirectBufferCapacity(jBuffer);
- if(capacity == -1) {
+ if (capacity == -1) {
// buffer direct access is not supported
ALOGE("Buffer direct access is not supported, can't record");
return 0;
}
//ALOGV("capacity = %ld", capacity);
jbyte* nativeFromJavaBuf = (jbyte*) env->GetDirectBufferAddress(jBuffer);
- if(nativeFromJavaBuf==NULL) {
+ if (nativeFromJavaBuf==NULL) {
ALOGE("Buffer direct access is not supported, can't record");
return 0;
- }
+ }
// read new data from the recorder
- return (jint) lpRecorder->read(nativeFromJavaBuf,
+ return (jint) lpRecorder->read(nativeFromJavaBuf,
capacity < sizeInBytes ? capacity : sizeInBytes);
}
// ----------------------------------------------------------------------------
-static jint android_media_AudioRecord_set_marker_pos(JNIEnv *env, jobject thiz,
+static jint android_media_AudioRecord_set_marker_pos(JNIEnv *env, jobject thiz,
jint markerPos) {
-
+
AudioRecord *lpRecorder = (AudioRecord *)env->GetIntField(
thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
-
+
if (lpRecorder) {
- return
- android_media_translateRecorderErrorCode( lpRecorder->setMarkerPosition(markerPos) );
+ return
+ android_media_translateRecorderErrorCode( lpRecorder->setMarkerPosition(markerPos) );
} else {
jniThrowException(env, "java/lang/IllegalStateException",
"Unable to retrieve AudioRecord pointer for setMarkerPosition()");
@@ -426,11 +426,11 @@
// ----------------------------------------------------------------------------
static jint android_media_AudioRecord_get_marker_pos(JNIEnv *env, jobject thiz) {
-
+
AudioRecord *lpRecorder = (AudioRecord *)env->GetIntField(
thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
uint32_t markerPos = 0;
-
+
if (lpRecorder) {
lpRecorder->getMarkerPosition(&markerPos);
return (jint)markerPos;
@@ -445,28 +445,28 @@
// ----------------------------------------------------------------------------
static jint android_media_AudioRecord_set_pos_update_period(JNIEnv *env, jobject thiz,
jint period) {
-
+
AudioRecord *lpRecorder = (AudioRecord *)env->GetIntField(
thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
-
+
if (lpRecorder) {
- return
- android_media_translateRecorderErrorCode( lpRecorder->setPositionUpdatePeriod(period) );
+ return
+ android_media_translateRecorderErrorCode( lpRecorder->setPositionUpdatePeriod(period) );
} else {
jniThrowException(env, "java/lang/IllegalStateException",
"Unable to retrieve AudioRecord pointer for setPositionUpdatePeriod()");
return AUDIORECORD_ERROR;
- }
+ }
}
// ----------------------------------------------------------------------------
static jint android_media_AudioRecord_get_pos_update_period(JNIEnv *env, jobject thiz) {
-
+
AudioRecord *lpRecorder = (AudioRecord *)env->GetIntField(
thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
uint32_t period = 0;
-
+
if (lpRecorder) {
lpRecorder->getPositionUpdatePeriod(&period);
return (jint)period;
@@ -514,7 +514,7 @@
(void *)android_media_AudioRecord_setup},
{"native_finalize", "()V", (void *)android_media_AudioRecord_finalize},
{"native_release", "()V", (void *)android_media_AudioRecord_release},
- {"native_read_in_byte_array",
+ {"native_read_in_byte_array",
"([BII)I", (void *)android_media_AudioRecord_readInByteArray},
{"native_read_in_short_array",
"([SII)I", (void *)android_media_AudioRecord_readInShortArray},
@@ -541,7 +541,7 @@
// ----------------------------------------------------------------------------
-extern bool android_media_getIntConstantFromClass(JNIEnv* pEnv,
+extern bool android_media_getIntConstantFromClass(JNIEnv* pEnv,
jclass theClass, const char* className, const char* constName, int* constVal);
// ----------------------------------------------------------------------------
@@ -550,7 +550,7 @@
javaAudioRecordFields.postNativeEventInJava = NULL;
javaAudioRecordFields.nativeRecorderInJavaObj = NULL;
javaAudioRecordFields.nativeCallbackCookie = NULL;
-
+
// Get the AudioRecord class
jclass audioRecordClass = env->FindClass(kClassPathName);
@@ -569,7 +569,7 @@
// Get the variables
// mNativeRecorderInJavaObj
- javaAudioRecordFields.nativeRecorderInJavaObj =
+ javaAudioRecordFields.nativeRecorderInJavaObj =
env->GetFieldID(audioRecordClass,
JAVA_NATIVERECORDERINJAVAOBJ_FIELD_NAME, "I");
if (javaAudioRecordFields.nativeRecorderInJavaObj == NULL) {
@@ -592,13 +592,13 @@
ALOGE("Can't find %s", JAVA_AUDIOFORMAT_CLASS_NAME);
return -1;
}
- if ( !android_media_getIntConstantFromClass(env, audioFormatClass,
- JAVA_AUDIOFORMAT_CLASS_NAME,
+ if ( !android_media_getIntConstantFromClass(env, audioFormatClass,
+ JAVA_AUDIOFORMAT_CLASS_NAME,
JAVA_CONST_PCM16_NAME, &(javaAudioRecordFields.PCM16))
- || !android_media_getIntConstantFromClass(env, audioFormatClass,
- JAVA_AUDIOFORMAT_CLASS_NAME,
+ || !android_media_getIntConstantFromClass(env, audioFormatClass,
+ JAVA_AUDIOFORMAT_CLASS_NAME,
JAVA_CONST_PCM8_NAME, &(javaAudioRecordFields.PCM8)) ) {
- // error log performed in getIntConstantFromClass()
+ // error log performed in getIntConstantFromClass()
return -1;
}
diff --git a/core/jni/android_media_AudioSystem.cpp b/core/jni/android_media_AudioSystem.cpp
index ee5eb7e..f522a9a 100644
--- a/core/jni/android_media_AudioSystem.cpp
+++ b/core/jni/android_media_AudioSystem.cpp
@@ -16,16 +16,16 @@
*/
#define LOG_TAG "AudioSystem"
-#include "utils/Log.h"
+#include <utils/Log.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <math.h>
-#include "jni.h"
-#include "JNIHelp.h"
-#include "android_runtime/AndroidRuntime.h"
+#include <jni.h>
+#include <JNIHelp.h>
+#include <android_runtime/AndroidRuntime.h>
#include <media/AudioSystem.h>
@@ -268,7 +268,7 @@
int register_android_media_AudioSystem(JNIEnv *env)
{
AudioSystem::setErrorCallback(android_media_AudioSystem_error_callback);
-
+
return AndroidRuntime::registerNativeMethods(env,
kClassPathName, gMethods, NELEM(gMethods));
}
diff --git a/core/jni/android_media_AudioTrack.cpp b/core/jni/android_media_AudioTrack.cpp
index 57f5d3d..9fbc477 100644
--- a/core/jni/android_media_AudioTrack.cpp
+++ b/core/jni/android_media_AudioTrack.cpp
@@ -22,13 +22,13 @@
#include <fcntl.h>
#include <math.h>
-#include "jni.h"
-#include "JNIHelp.h"
-#include "android_runtime/AndroidRuntime.h"
+#include <jni.h>
+#include <JNIHelp.h>
+#include <android_runtime/AndroidRuntime.h>
-#include "utils/Log.h"
-#include "media/AudioSystem.h"
-#include "media/AudioTrack.h"
+#include <utils/Log.h>
+#include <media/AudioSystem.h>
+#include <media/AudioTrack.h>
#include <binder/MemoryHeapBase.h>
#include <binder/MemoryBase.h>
@@ -105,7 +105,7 @@
jint android_media_translateErrorCode(int code) {
- switch(code) {
+ switch (code) {
case NO_ERROR:
return AUDIOTRACK_SUCCESS;
case BAD_VALUE:
@@ -114,7 +114,7 @@
return AUDIOTRACK_ERROR_INVALID_OPERATION;
default:
return AUDIOTRACK_ERROR;
- }
+ }
}
@@ -123,14 +123,14 @@
if (event == AudioTrack::EVENT_MORE_DATA) {
// set size to 0 to signal we're not using the callback to write more data
AudioTrack::Buffer* pBuff = (AudioTrack::Buffer*)info;
- pBuff->size = 0;
-
+ pBuff->size = 0;
+
} else if (event == AudioTrack::EVENT_MARKER) {
audiotrack_callback_cookie *callbackInfo = (audiotrack_callback_cookie *)user;
JNIEnv *env = AndroidRuntime::getJNIEnv();
if (user && env) {
env->CallStaticVoidMethod(
- callbackInfo->audioTrack_class,
+ callbackInfo->audioTrack_class,
javaAudioTrackFields.postNativeEventInJava,
callbackInfo->audioTrack_ref, event, 0,0, NULL);
if (env->ExceptionCheck()) {
@@ -144,7 +144,7 @@
JNIEnv *env = AndroidRuntime::getJNIEnv();
if (user && env) {
env->CallStaticVoidMethod(
- callbackInfo->audioTrack_class,
+ callbackInfo->audioTrack_class,
javaAudioTrackFields.postNativeEventInJava,
callbackInfo->audioTrack_ref, event, 0,0, NULL);
if (env->ExceptionCheck()) {
@@ -186,7 +186,7 @@
}
int nbChannels = popcount(nativeChannelMask);
-
+
// check the stream type
audio_stream_type_t atStreamType;
switch (streamType) {
@@ -215,7 +215,7 @@
// for the moment 8bitPCM in MODE_STATIC is not supported natively in the AudioTrack C++ class
// so we declare everything as 16bitPCM, the 8->16bit conversion for MODE_STATIC will be handled
// in android_media_AudioTrack_native_write_byte()
- if ((audioFormat == javaAudioTrackFields.PCM8)
+ if ((audioFormat == javaAudioTrackFields.PCM8)
&& (memoryMode == javaAudioTrackFields.MODE_STATIC)) {
ALOGV("android_media_AudioTrack_native_setup(): requesting MODE_STATIC for 8bit \
buff size of %dbytes, switching to 16bit, buff size of %dbytes",
@@ -230,9 +230,9 @@
audio_format_t format = audioFormat == javaAudioTrackFields.PCM16 ?
AUDIO_FORMAT_PCM_16_BIT : AUDIO_FORMAT_PCM_8_BIT;
int frameCount = buffSizeInBytes / (nbChannels * bytesPerSample);
-
+
AudioTrackJniStorage* lpJniStorage = new AudioTrackJniStorage();
-
+
// initialize the callback information:
// this data will be passed with every AudioTrack callback
jclass clazz = env->GetObjectClass(thiz);
@@ -244,7 +244,7 @@
lpJniStorage->mCallbackData.audioTrack_class = (jclass)env->NewGlobalRef(clazz);
// we use a weak reference so the AudioTrack object can be garbage collected.
lpJniStorage->mCallbackData.audioTrack_ref = env->NewGlobalRef(weak_this);
-
+
lpJniStorage->mStreamType = atStreamType;
if (jSession == NULL) {
@@ -269,7 +269,7 @@
ALOGE("Error creating uninitialized AudioTrack");
goto native_track_failure;
}
-
+
// initialize the native AudioTrack object
if (memoryMode == javaAudioTrackFields.MODE_STREAM) {
@@ -285,15 +285,15 @@
0,// shared mem
true,// thread can call Java
sessionId);// audio session ID
-
+
} else if (memoryMode == javaAudioTrackFields.MODE_STATIC) {
// AudioTrack is using shared memory
-
+
if (!lpJniStorage->allocSharedMem(buffSizeInBytes)) {
ALOGE("Error creating AudioTrack in static mode: error creating mem heap base");
goto native_init_failure;
}
-
+
lpTrack->set(
atStreamType,// stream type
sampleRateInHertz,
@@ -302,7 +302,7 @@
frameCount,
AUDIO_POLICY_OUTPUT_FLAG_NONE,
audioCallback, &(lpJniStorage->mCallbackData),//callback, callback data (user));
- 0,// notificationFrames == 0 since not using EVENT_MORE_DATA to feed the AudioTrack
+ 0,// notificationFrames == 0 since not using EVENT_MORE_DATA to feed the AudioTrack
lpJniStorage->mMemBase,// shared mem
true,// thread can call Java
sessionId);// audio session ID
@@ -323,21 +323,21 @@
env->ReleasePrimitiveArrayCritical(jSession, nSession, 0);
nSession = NULL;
- // save our newly created C++ AudioTrack in the "nativeTrackInJavaObj" field
+ // save our newly created C++ AudioTrack in the "nativeTrackInJavaObj" field
// of the Java object (in mNativeTrackInJavaObj)
env->SetIntField(thiz, javaAudioTrackFields.nativeTrackInJavaObj, (int)lpTrack);
-
+
// save the JNI resources so we can free them later
//ALOGV("storing lpJniStorage: %x\n", (int)lpJniStorage);
env->SetIntField(thiz, javaAudioTrackFields.jniData, (int)lpJniStorage);
return AUDIOTRACK_SUCCESS;
-
+
// failures:
native_init_failure:
delete lpTrack;
env->SetIntField(thiz, javaAudioTrackFields.nativeTrackInJavaObj, 0);
-
+
native_track_failure:
if (nSession != NULL) {
env->ReleasePrimitiveArrayCritical(jSession, nSession, 0);
@@ -347,7 +347,7 @@
delete lpJniStorage;
env->SetIntField(thiz, javaAudioTrackFields.jniData, 0);
return AUDIOTRACK_ERROR_SETUP_NATIVEINITFAILED;
-
+
}
@@ -432,7 +432,7 @@
// ----------------------------------------------------------------------------
static void android_media_AudioTrack_native_finalize(JNIEnv *env, jobject thiz) {
//ALOGV("android_media_AudioTrack_native_finalize jobject: %x\n", (int)thiz);
-
+
// delete the AudioTrack object
AudioTrack *lpTrack = (AudioTrack *)env->GetIntField(
thiz, javaAudioTrackFields.nativeTrackInJavaObj);
@@ -441,7 +441,7 @@
lpTrack->stop();
delete lpTrack;
}
-
+
// delete the JNI data
AudioTrackJniStorage* pJniStorage = (AudioTrackJniStorage *)env->GetIntField(
thiz, javaAudioTrackFields.jniData);
@@ -456,7 +456,7 @@
// ----------------------------------------------------------------------------
static void android_media_AudioTrack_native_release(JNIEnv *env, jobject thiz) {
-
+
// do everything a call to finalize would
android_media_AudioTrack_native_finalize(env, thiz);
// + reset the native resources in the Java object so any attempt to access
@@ -493,7 +493,7 @@
int count = sizeInBytes;
int16_t *dst = (int16_t *)pTrack->sharedBuffer()->pointer();
const int8_t *src = (const int8_t *)(data + offsetInBytes);
- while(count--) {
+ while (count--) {
*dst++ = (int16_t)(*src++^0x80) << 8;
}
// even though we wrote 2*sizeInBytes, we only report sizeInBytes as written to hide
@@ -514,7 +514,7 @@
AudioTrack *lpTrack = NULL;
//ALOGV("android_media_AudioTrack_native_write_byte(offset=%d, sizeInBytes=%d) called",
// offsetInBytes, sizeInBytes);
-
+
// get the audio track to load with samples
lpTrack = (AudioTrack *)env->GetIntField(thiz, javaAudioTrackFields.nativeTrackInJavaObj);
if (lpTrack == NULL) {
@@ -599,7 +599,7 @@
thiz, javaAudioTrackFields.nativeTrackInJavaObj);
if (lpTrack) {
- return (jint) lpTrack->getSampleRate();
+ return (jint) lpTrack->getSampleRate();
} else {
jniThrowException(env, "java/lang/IllegalStateException",
"Unable to retrieve AudioTrack pointer for getSampleRate()");
@@ -609,14 +609,14 @@
// ----------------------------------------------------------------------------
-static jint android_media_AudioTrack_set_marker_pos(JNIEnv *env, jobject thiz,
+static jint android_media_AudioTrack_set_marker_pos(JNIEnv *env, jobject thiz,
jint markerPos) {
-
+
AudioTrack *lpTrack = (AudioTrack *)env->GetIntField(
thiz, javaAudioTrackFields.nativeTrackInJavaObj);
-
+
if (lpTrack) {
- return android_media_translateErrorCode( lpTrack->setMarkerPosition(markerPos) );
+ return android_media_translateErrorCode( lpTrack->setMarkerPosition(markerPos) );
} else {
jniThrowException(env, "java/lang/IllegalStateException",
"Unable to retrieve AudioTrack pointer for setMarkerPosition()");
@@ -627,11 +627,11 @@
// ----------------------------------------------------------------------------
static jint android_media_AudioTrack_get_marker_pos(JNIEnv *env, jobject thiz) {
-
+
AudioTrack *lpTrack = (AudioTrack *)env->GetIntField(
thiz, javaAudioTrackFields.nativeTrackInJavaObj);
uint32_t markerPos = 0;
-
+
if (lpTrack) {
lpTrack->getMarkerPosition(&markerPos);
return (jint)markerPos;
@@ -646,27 +646,27 @@
// ----------------------------------------------------------------------------
static jint android_media_AudioTrack_set_pos_update_period(JNIEnv *env, jobject thiz,
jint period) {
-
+
AudioTrack *lpTrack = (AudioTrack *)env->GetIntField(
thiz, javaAudioTrackFields.nativeTrackInJavaObj);
-
+
if (lpTrack) {
- return android_media_translateErrorCode( lpTrack->setPositionUpdatePeriod(period) );
+ return android_media_translateErrorCode( lpTrack->setPositionUpdatePeriod(period) );
} else {
jniThrowException(env, "java/lang/IllegalStateException",
"Unable to retrieve AudioTrack pointer for setPositionUpdatePeriod()");
return AUDIOTRACK_ERROR;
- }
+ }
}
// ----------------------------------------------------------------------------
static jint android_media_AudioTrack_get_pos_update_period(JNIEnv *env, jobject thiz) {
-
+
AudioTrack *lpTrack = (AudioTrack *)env->GetIntField(
thiz, javaAudioTrackFields.nativeTrackInJavaObj);
uint32_t period = 0;
-
+
if (lpTrack) {
lpTrack->getPositionUpdatePeriod(&period);
return (jint)period;
@@ -679,12 +679,12 @@
// ----------------------------------------------------------------------------
-static jint android_media_AudioTrack_set_position(JNIEnv *env, jobject thiz,
+static jint android_media_AudioTrack_set_position(JNIEnv *env, jobject thiz,
jint position) {
-
+
AudioTrack *lpTrack = (AudioTrack *)env->GetIntField(
thiz, javaAudioTrackFields.nativeTrackInJavaObj);
-
+
if (lpTrack) {
return android_media_translateErrorCode( lpTrack->setPosition(position) );
} else {
@@ -697,11 +697,11 @@
// ----------------------------------------------------------------------------
static jint android_media_AudioTrack_get_position(JNIEnv *env, jobject thiz) {
-
+
AudioTrack *lpTrack = (AudioTrack *)env->GetIntField(
thiz, javaAudioTrackFields.nativeTrackInJavaObj);
uint32_t position = 0;
-
+
if (lpTrack) {
lpTrack->getPosition(&position);
return (jint)position;
@@ -944,12 +944,12 @@
// Get the memory mode constants
if ( !android_media_getIntConstantFromClass(env, audioTrackClass,
- kClassPathName,
+ kClassPathName,
JAVA_CONST_MODE_STATIC_NAME, &(javaAudioTrackFields.MODE_STATIC))
|| !android_media_getIntConstantFromClass(env, audioTrackClass,
- kClassPathName,
+ kClassPathName,
JAVA_CONST_MODE_STREAM_NAME, &(javaAudioTrackFields.MODE_STREAM)) ) {
- // error log performed in android_media_getIntConstantFromClass()
+ // error log performed in android_media_getIntConstantFromClass()
return -1;
}
@@ -960,16 +960,16 @@
ALOGE("Can't find %s", JAVA_AUDIOFORMAT_CLASS_NAME);
return -1;
}
- if ( !android_media_getIntConstantFromClass(env, audioFormatClass,
- JAVA_AUDIOFORMAT_CLASS_NAME,
+ if ( !android_media_getIntConstantFromClass(env, audioFormatClass,
+ JAVA_AUDIOFORMAT_CLASS_NAME,
JAVA_CONST_PCM16_NAME, &(javaAudioTrackFields.PCM16))
- || !android_media_getIntConstantFromClass(env, audioFormatClass,
- JAVA_AUDIOFORMAT_CLASS_NAME,
+ || !android_media_getIntConstantFromClass(env, audioFormatClass,
+ JAVA_AUDIOFORMAT_CLASS_NAME,
JAVA_CONST_PCM8_NAME, &(javaAudioTrackFields.PCM8)) ) {
- // error log performed in android_media_getIntConstantFromClass()
+ // error log performed in android_media_getIntConstantFromClass()
return -1;
}
-
+
return AndroidRuntime::registerNativeMethods(env, kClassPathName, gMethods, NELEM(gMethods));
}
diff --git a/core/jni/android_media_JetPlayer.cpp b/core/jni/android_media_JetPlayer.cpp
index 9f9bedb..a785f52 100644
--- a/core/jni/android_media_JetPlayer.cpp
+++ b/core/jni/android_media_JetPlayer.cpp
@@ -22,12 +22,12 @@
#include <unistd.h>
#include <fcntl.h>
-#include "jni.h"
-#include "JNIHelp.h"
-#include "android_runtime/AndroidRuntime.h"
+#include <jni.h>
+#include <JNIHelp.h>
+#include <android_runtime/AndroidRuntime.h>
-#include "utils/Log.h"
-#include "media/JetPlayer.h"
+#include <utils/Log.h>
+#include <media/JetPlayer.h>
using namespace android;
@@ -56,7 +56,7 @@
jetPlayerEventCallback(int what, int arg1=0, int arg2=0, void* javaTarget = NULL)
{
JNIEnv *env = AndroidRuntime::getJNIEnv();
- if(env) {
+ if (env) {
env->CallStaticVoidMethod(
javaJetPlayerFields.jetClass, javaJetPlayerFields.postNativeEventInJava,
javaTarget,
@@ -84,7 +84,7 @@
EAS_RESULT result = lpJet->init();
- if(result==EAS_SUCCESS) {
+ if (result==EAS_SUCCESS) {
// save our newly created C++ JetPlayer in the "nativePlayerInJavaObj" field
// of the Java object (in mNativePlayerInJavaObj)
env->SetIntField(thiz, javaJetPlayerFields.nativePlayerInJavaObj, (int)lpJet);
@@ -105,7 +105,7 @@
ALOGV("android_media_JetPlayer_finalize(): entering.");
JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
thiz, javaJetPlayerFields.nativePlayerInJavaObj);
- if(lpJet != NULL) {
+ if (lpJet != NULL) {
lpJet->release();
delete lpJet;
}
@@ -148,7 +148,7 @@
EAS_RESULT result = lpJet->loadFromFile(pathStr);
env->ReleaseStringUTFChars(path, pathStr);
- if(result==EAS_SUCCESS) {
+ if (result==EAS_SUCCESS) {
//ALOGV("android_media_JetPlayer_openFile(): file successfully opened");
return JNI_TRUE;
} else {
@@ -178,7 +178,7 @@
EAS_RESULT result = lpJet->loadFromFD(jniGetFDFromFileDescriptor(env, fileDescriptor),
(long long)offset, (long long)length); // cast params to types used by EAS_FILE
- if(result==EAS_SUCCESS) {
+ if (result==EAS_SUCCESS) {
ALOGV("android_media_JetPlayer_openFileDescr(): file successfully opened");
return JNI_TRUE;
} else {
@@ -200,7 +200,7 @@
"Unable to retrieve JetPlayer pointer for closeFile()");
}
- if( lpJet->closeFile()==EAS_SUCCESS) {
+ if (lpJet->closeFile()==EAS_SUCCESS) {
//ALOGV("android_media_JetPlayer_closeFile(): file successfully closed");
return JNI_TRUE;
} else {
@@ -222,7 +222,7 @@
}
EAS_RESULT result = lpJet->play();
- if( result==EAS_SUCCESS) {
+ if (result==EAS_SUCCESS) {
//ALOGV("android_media_JetPlayer_play(): play successful");
return JNI_TRUE;
} else {
@@ -245,11 +245,11 @@
}
EAS_RESULT result = lpJet->pause();
- if( result==EAS_SUCCESS) {
+ if (result==EAS_SUCCESS) {
//ALOGV("android_media_JetPlayer_pause(): pause successful");
return JNI_TRUE;
} else {
- if(result==EAS_ERROR_QUEUE_IS_EMPTY) {
+ if (result==EAS_ERROR_QUEUE_IS_EMPTY) {
ALOGV("android_media_JetPlayer_pause(): paused with an empty queue");
return JNI_TRUE;
} else
@@ -275,7 +275,7 @@
EAS_RESULT result
= lpJet->queueSegment(segmentNum, libNum, repeatCount, transpose, muteFlags, userID);
- if(result==EAS_SUCCESS) {
+ if (result==EAS_SUCCESS) {
//ALOGV("android_media_JetPlayer_queueSegment(): segment successfully queued");
return JNI_TRUE;
} else {
@@ -311,7 +311,7 @@
EAS_U32 muteMask=0;
int maxTracks = lpJet->getMaxTracks();
for (jint trackIndex=0; trackIndex<maxTracks; trackIndex++) {
- if(muteTracks[maxTracks-1-trackIndex]==JNI_TRUE)
+ if (muteTracks[maxTracks-1-trackIndex]==JNI_TRUE)
muteMask = (muteMask << 1) | 0x00000001;
else
muteMask = muteMask << 1;
@@ -321,7 +321,7 @@
result = lpJet->queueSegment(segmentNum, libNum, repeatCount, transpose, muteMask, userID);
env->ReleaseBooleanArrayElements(muteArray, muteTracks, 0);
- if(result==EAS_SUCCESS) {
+ if (result==EAS_SUCCESS) {
//ALOGV("android_media_JetPlayer_queueSegmentMuteArray(): segment successfully queued");
return JNI_TRUE;
} else {
@@ -346,7 +346,7 @@
EAS_RESULT result;
result = lpJet->setMuteFlags(muteFlags, bSync==JNI_TRUE ? true : false);
- if(result==EAS_SUCCESS) {
+ if (result==EAS_SUCCESS) {
//ALOGV("android_media_JetPlayer_setMuteFlags(): mute flags successfully updated");
return JNI_TRUE;
} else {
@@ -380,7 +380,7 @@
EAS_U32 muteMask=0;
int maxTracks = lpJet->getMaxTracks();
for (jint trackIndex=0; trackIndex<maxTracks; trackIndex++) {
- if(muteTracks[maxTracks-1-trackIndex]==JNI_TRUE)
+ if (muteTracks[maxTracks-1-trackIndex]==JNI_TRUE)
muteMask = (muteMask << 1) | 0x00000001;
else
muteMask = muteMask << 1;
@@ -390,7 +390,7 @@
result = lpJet->setMuteFlags(muteMask, bSync==JNI_TRUE ? true : false);
env->ReleaseBooleanArrayElements(muteArray, muteTracks, 0);
- if(result==EAS_SUCCESS) {
+ if (result==EAS_SUCCESS) {
//ALOGV("android_media_JetPlayer_setMuteArray(): mute flags successfully updated");
return JNI_TRUE;
} else {
@@ -416,7 +416,7 @@
EAS_RESULT result;
result = lpJet->setMuteFlag(trackId,
muteFlag==JNI_TRUE ? true : false, bSync==JNI_TRUE ? true : false);
- if(result==EAS_SUCCESS) {
+ if (result==EAS_SUCCESS) {
//ALOGV("android_media_JetPlayer_setMuteFlag(): mute flag successfully updated for track %d", trackId);
return JNI_TRUE;
} else {
@@ -440,7 +440,7 @@
EAS_RESULT result;
result = lpJet->triggerClip(clipId);
- if(result==EAS_SUCCESS) {
+ if (result==EAS_SUCCESS) {
//ALOGV("android_media_JetPlayer_triggerClip(): triggerClip successful for clip %d", clipId);
return JNI_TRUE;
} else {
@@ -463,7 +463,7 @@
}
EAS_RESULT result = lpJet->clearQueue();
- if(result==EAS_SUCCESS) {
+ if (result==EAS_SUCCESS) {
//ALOGV("android_media_JetPlayer_clearQueue(): clearQueue successful");
return JNI_TRUE;
} else {
diff --git a/core/jni/android_media_ToneGenerator.cpp b/core/jni/android_media_ToneGenerator.cpp
index 544b4c0..31151a6 100644
--- a/core/jni/android_media_ToneGenerator.cpp
+++ b/core/jni/android_media_ToneGenerator.cpp
@@ -21,13 +21,13 @@
#include <unistd.h>
#include <fcntl.h>
-#include "jni.h"
-#include "JNIHelp.h"
-#include "android_runtime/AndroidRuntime.h"
+#include <jni.h>
+#include <JNIHelp.h>
+#include <android_runtime/AndroidRuntime.h>
-#include "utils/Log.h"
-#include "media/AudioSystem.h"
-#include "media/ToneGenerator.h"
+#include <utils/Log.h>
+#include <media/AudioSystem.h>
+#include <media/ToneGenerator.h>
// ----------------------------------------------------------------------------
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index 30d4e20..ce2cdee 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -251,8 +251,16 @@
static void Surface_initFromSurfaceTexture(
JNIEnv* env, jobject clazz, jobject jst)
{
- sp<ISurfaceTexture> st(SurfaceTexture_getSurfaceTexture(env, jst));
- sp<Surface> surface(new Surface(st));
+ sp<SurfaceTexture> st(SurfaceTexture_getSurfaceTexture(env, jst));
+
+ if (st == NULL) {
+ jniThrowException(env, "java/lang/IllegalArgumentException",
+ "SurfaceTexture has already been released");
+ return;
+ }
+ sp<ISurfaceTexture> bq = st->getBufferQueue();
+
+ sp<Surface> surface(new Surface(bq));
if (surface == NULL) {
jniThrowException(env, OutOfResourcesException, NULL);
return;
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 8f03fe0..d1e3642 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -248,6 +248,21 @@
android:label="@string/permlab_writeContacts"
android:description="@string/permdesc_writeContacts" />
+ <!-- Allows an application to read the user's call log. -->
+ <permission android:name="android.permission.READ_CALL_LOG"
+ android:permissionGroup="android.permission-group.PERSONAL_INFO"
+ android:protectionLevel="dangerous"
+ android:label="@string/permlab_readCallLog"
+ android:description="@string/permdesc_readCallLog" />
+
+ <!-- Allows an application to write (but not read) the user's
+ contacts data. -->
+ <permission android:name="android.permission.WRITE_CALL_LOG"
+ android:permissionGroup="android.permission-group.PERSONAL_INFO"
+ android:protectionLevel="dangerous"
+ android:label="@string/permlab_writeCallLog"
+ android:description="@string/permdesc_writeCallLog" />
+
<!-- Allows an application to read the user's personal profile data. -->
<permission android:name="android.permission.READ_PROFILE"
diff --git a/core/res/res/anim/screen_rotate_finish_exit.xml b/core/res/res/anim/screen_rotate_finish_exit.xml
index 3d9c569..003940e 100644
--- a/core/res/res/anim/screen_rotate_finish_exit.xml
+++ b/core/res/res/anim/screen_rotate_finish_exit.xml
@@ -24,12 +24,14 @@
android:pivotX="50%" android:pivotY="50%"
android:interpolator="@interpolator/accelerate_decelerate"
android:fillEnabled="true"
- android:fillBefore="false" android:fillAfter="true"
+ android:fillBefore="true" android:fillAfter="true"
android:duration="@android:integer/config_shortAnimTime"/>
<scale android:fromXScale="100%" android:toXScale="100%p"
android:fromYScale="100%" android:toYScale="100%p"
android:pivotX="50%" android:pivotY="50%"
android:interpolator="@interpolator/accelerate_decelerate"
+ android:fillEnabled="true"
+ android:fillBefore="true" android:fillAfter="true"
android:duration="@android:integer/config_mediumAnimTime" />
<alpha android:fromAlpha="1.0" android:toAlpha="0"
android:interpolator="@interpolator/accelerate_decelerate"
diff --git a/core/res/res/drawable/activated_background.xml b/core/res/res/drawable/activated_background.xml
index 1047e5b..d92fba1 100644
--- a/core/res/res/drawable/activated_background.xml
+++ b/core/res/res/drawable/activated_background.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true" android:drawable="@android:drawable/list_selector_background_selected" />
<item android:drawable="@color/transparent" />
</selector>
diff --git a/core/res/res/drawable/activated_background_holo_dark.xml b/core/res/res/drawable/activated_background_holo_dark.xml
index a29bcb9..febf2c4 100644
--- a/core/res/res/drawable/activated_background_holo_dark.xml
+++ b/core/res/res/drawable/activated_background_holo_dark.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true" android:drawable="@android:drawable/list_activated_holo" />
<item android:drawable="@color/transparent" />
</selector>
diff --git a/core/res/res/drawable/activated_background_holo_light.xml b/core/res/res/drawable/activated_background_holo_light.xml
index a29bcb9..febf2c4 100644
--- a/core/res/res/drawable/activated_background_holo_light.xml
+++ b/core/res/res/drawable/activated_background_holo_light.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true" android:drawable="@android:drawable/list_activated_holo" />
<item android:drawable="@color/transparent" />
</selector>
diff --git a/core/res/res/drawable/activated_background_light.xml b/core/res/res/drawable/activated_background_light.xml
index 7d737db..5d5681d 100644
--- a/core/res/res/drawable/activated_background_light.xml
+++ b/core/res/res/drawable/activated_background_light.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true" android:drawable="@drawable/list_selector_background_selected_light" />
<item android:drawable="@color/transparent" />
</selector>
diff --git a/core/res/res/drawable/btn_cab_done_holo_dark.xml b/core/res/res/drawable/btn_cab_done_holo_dark.xml
index 65d3496..fe42951 100644
--- a/core/res/res/drawable/btn_cab_done_holo_dark.xml
+++ b/core/res/res/drawable/btn_cab_done_holo_dark.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/btn_cab_done_pressed_holo_dark" />
<item android:state_focused="true" android:state_enabled="true"
diff --git a/core/res/res/drawable/btn_cab_done_holo_light.xml b/core/res/res/drawable/btn_cab_done_holo_light.xml
index f6a63f4..f362774 100644
--- a/core/res/res/drawable/btn_cab_done_holo_light.xml
+++ b/core/res/res/drawable/btn_cab_done_holo_light.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/btn_cab_done_pressed_holo_light" />
<item android:state_focused="true" android:state_enabled="true"
diff --git a/core/res/res/drawable/item_background.xml b/core/res/res/drawable/item_background.xml
index f7fef82..a1c9ff8 100644
--- a/core/res/res/drawable/item_background.xml
+++ b/core/res/res/drawable/item_background.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:drawable="@color/transparent" />
diff --git a/core/res/res/drawable/item_background_holo_dark.xml b/core/res/res/drawable/item_background_holo_dark.xml
index f188df7..7c8590c 100644
--- a/core/res/res/drawable/item_background_holo_dark.xml
+++ b/core/res/res/drawable/item_background_holo_dark.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_disabled_holo_dark" />
diff --git a/core/res/res/drawable/item_background_holo_light.xml b/core/res/res/drawable/item_background_holo_light.xml
index ee3f4d8..99b5ac2 100644
--- a/core/res/res/drawable/item_background_holo_light.xml
+++ b/core/res/res/drawable/item_background_holo_light.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_disabled_holo_light" />
diff --git a/core/res/res/drawable/list_selector_background.xml b/core/res/res/drawable/list_selector_background.xml
index 1222155..eaf86ca 100644
--- a/core/res/res/drawable/list_selector_background.xml
+++ b/core/res/res/drawable/list_selector_background.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:drawable="@color/transparent" />
diff --git a/core/res/res/drawable/list_selector_background_light.xml b/core/res/res/drawable/list_selector_background_light.xml
index 50a821b..4da7e21 100644
--- a/core/res/res/drawable/list_selector_background_light.xml
+++ b/core/res/res/drawable/list_selector_background_light.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:drawable="@color/transparent" />
diff --git a/core/res/res/drawable/list_selector_holo_dark.xml b/core/res/res/drawable/list_selector_holo_dark.xml
index 9a6cb89..e4c5c524 100644
--- a/core/res/res/drawable/list_selector_holo_dark.xml
+++ b/core/res/res/drawable/list_selector_holo_dark.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:drawable="@color/transparent" />
diff --git a/core/res/res/drawable/list_selector_holo_light.xml b/core/res/res/drawable/list_selector_holo_light.xml
index 844259e..17631bd 100644
--- a/core/res/res/drawable/list_selector_holo_light.xml
+++ b/core/res/res/drawable/list_selector_holo_light.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:drawable="@color/transparent" />
diff --git a/core/res/res/values-af-rZA/arrays.xml b/core/res/res/values-af-rZA/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-af-rZA/arrays.xml
rename to core/res/res/values-af-rZA/donottranslate-maps.xml
diff --git a/core/res/res/values-af/strings.xml b/core/res/res/values-af/strings.xml
index 48f4606..fd9eff3 100644
--- a/core/res/res/values-af/strings.xml
+++ b/core/res/res/values-af/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"skryf kontakdata"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Laat die program toe om die kontakdata (adresse) wat op jou tablet gestoor is, te verander. Kwaadwillige programme kan dit dalk gebruik om jou kontakdata uit te vee of te verander."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Laat die program toe om die kontakdata (adresse) wat op jou foon gestoor is, te verander. Kwaadwillige programme kan dit dalk gebruik om jou kontakdata uit te vee of te verander."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"Lees oproeprekord"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Laat die program toe om jou tablet se oproeprekord, insluitende data oor inkomende en uitgaande oproepe, te lees. Kwaadwillige programme kan dit gebruik om jou data na ander mense te stuur."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Laat die program toe om jou foon se oproeprekord, insluitende data oor inkomende en uitgaande oproepe, te lees. Kwaadwillige programme kan dit gebruik om jou data na ander mense te stuur."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"skryf oproeprekord"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Laat die program toe om jou tablet se oproeprekord, insluitende data oor inkomende en uitgaande oproepe, te verander. Kwaadwillige programme kan dit gebruik om jou oproeprekord uit te vee of te verander."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Laat die program toe om jou foon se oproeprekord, insluitende data oor inkomende en uitgaande oproepe, te verander. Kwaadwillige programme kan dit gebruik om jou oproeprekord uit te vee of te verander."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"lees jou profieldata"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Laat die program toe om persoonlike profielinligting te lees wat op jou toestel gestoor is, soos jou naam en kontakbesonderhede. Dit beteken dat die program jou kan identifiseer en jou profielinligting aan ander mense kan stuur."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"skryf na jou profieldata"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Laat die program toe om enige private woorde, name en frases te lees wat die gebruiker in die gebruikerwoordeboek gestoor het."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"skryf na gebruikergedefinieerde woordeboek"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Laat die program toe om nuwe woorde in die gebruikerwoordeboek te skryf."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"lees USB-geheue se inhoud"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"lees SD-kaart se inhoud"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Laat die program toe om die USB-geheue se inhoud te lees."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Laat die program toe om die SD-kaart se inhoud te lees."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"verander/vee uit USB-berging se inhoud"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"wysig/vee uit SD-kaart se inhoud"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Laat die program toe om die USB-geheue te skryf."</string>
diff --git a/core/res/res/values-am-rET/arrays.xml b/core/res/res/values-am-rET/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-am-rET/arrays.xml
rename to core/res/res/values-am-rET/donottranslate-maps.xml
diff --git a/core/res/res/values-am/strings.xml b/core/res/res/values-am/strings.xml
index b055634..f1379f7 100644
--- a/core/res/res/values-am/strings.xml
+++ b/core/res/res/values-am/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"የእውቂያ ውሂብ ፃፍ"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"በጡባዊ ተኮህ ላይ የተከማቹ የእውቂያ(አድራሻ) ውሂብ ለመቀየር ለመተግበሪያው ይፈቅዳሉ፡፡ የእውቅያ ውሂብህን ለመደምሰስ ወይም ለመቀየር ተንኮል አዘል መተግበሪያዎች ሊጠቀሙት ይችላሉ፡፡"</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"በስልክህ ላይ የተከማቹ የእውቂያ(አድራሻ) ውሂብ ለመቀየር ለመተግበሪያው ይፈቅዳሉ፡፡ የእውቅያ ውሂብህን ለመደምሰስ ወይም ለመቀየር ተንኮል አዘል መተግበሪያዎች ሊጠቀሙት ይችላሉ፡፡"</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"የጥሪ ምዝግብ ማስታወሻን አንብብ"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"ስለ ገቢ እና ወጪ ጥሪዎችን ውሂብ ጨምሮ፣ የጡባዊ ተኮህን ምዝግብ ማስታወሻ እንዲያነብ ለመተግበሪያው ይፈቅዳል። ይሄንን ተንኮል አዘል መተግበሪያዎች ለሌሎች ሰዎች ውሂብህን ለመላክ ሊጠቀሙበት ይችላሉ።"</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"ስለ ገቢ እና ወጪ ጥሪዎችን ውሂብ ጨምሮ፣ የስልክ ጥሪህን ምዝግብ ማስታወሻ እንዲያነብ ለመተግበሪያው ይፈቅዳል። ይሄንን ተንኮል አዘል መተግበሪያዎች ለሌሎች ሰዎች ውሂብህን ለመላክ ሊጠቀሙበት ይችላሉ።"</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"የጥሪ ምዝግብ ማስታወሻን ፃፍ"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"ስለ ገቢ እና ወጪ ጥሪዎችን ውሂብ ጨምሮ፣ የጡባዊተኮህን ምዝግብ ማስታወሻ ለመቀየር ለመተግበሪያው ይፈቅዳል። ይሄንን ተንኮል አዘል መተግበሪያዎች የስልክህን ምዝግብ ማስታወሻ ለመሰረዝ ወይም ለመለወጥ ሊጠቀሙበት ይችላሉ።"</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"ስለ ገቢ እና ወጪ ጥሪዎችን ውሂብ ጨምሮ፣ የስልክህን ምዝግብ ማስታወሻ ለመቀየር ለመተግበሪያው ይፈቅዳል። ይሄንን ተንኮል አዘል መተግበሪያዎች የስልክህን ምዝግብ ማስታወሻ ለመሰረዝ ወይም ለመለወጥ ሊጠቀሙበት ይችላሉ።"</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"የመገለጫ ውሂብዎን ያንብቡ"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"ልክ እንደ አንተ ስም እና የዕውቂያ መረጃ ፣ ባንተ መሳሪያ ወስጥ የተከማቹ የግል መገለጫ መረጃ ለማንበብ ለመተግበሪያው ይፈቅዳሉ፡፡ይሄም ማለት ሌሎች መተግበሪያዎች ሊለዩህ ይችላሉ እና ለሌሎች የመገለጫ መረጃህን ይልካሉ፡፡"</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"የአርስዎ መገለጫ ውሂብ ላይ ይፃፉ"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">" ተጠቃሚው በተጠቃሚ መዝገበ ቃላት ሊያከማች የቻለውን ማንኛውም የግል ቃላት፣ ስሞች፣እና ሀረጎች ለማንበብ ለመተግበሪያው ይፈቅዳሉ፡፡"</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"በተጠቃሚ በተወሰነ መዝገበ ቃላት ፃፍ"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"በተጠቃሚ መዝገበ ቃላት ውስጥ አዲስ ቃል እንዲጽፍ ለመተግበሪያው ይፈቅዳሉ፡፡"</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"የUSB ካርድ ይዘቶችን አንብብ"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"የSD ካርድ ይዘቶችን አንብብ"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"መተግበሪያው ከUSB ካርድ ላይ ያሉ ይዘቶችን እንዲያነብ ይፈቅድለታል።"</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"መተግበሪያው ከSD ካርድ ላይ ያሉ ይዘቶችን እንዲያነብ ይፈቅድለታል።"</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"የUSB ማከማቻ ይዘቶችን ቀይር/ሰርዝ"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"የSD ካርድ ይዘትንቀይር/ሰርዝ"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"ወደ USB ማህደረ ትውስታው ለመፃፍ ለመተግበሪያው ይፈቅዳሉ፡፡"</string>
diff --git a/core/res/res/values-ar-rEG/arrays.xml b/core/res/res/values-ar-rEG/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-ar-rEG/arrays.xml
rename to core/res/res/values-ar-rEG/donottranslate-maps.xml
diff --git a/core/res/res/values-ar-rIL/arrays.xml b/core/res/res/values-ar-rIL/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-ar-rIL/arrays.xml
rename to core/res/res/values-ar-rIL/donottranslate-maps.xml
diff --git a/core/res/res/values-ar/strings.xml b/core/res/res/values-ar/strings.xml
index 193157b..a156e64 100644
--- a/core/res/res/values-ar/strings.xml
+++ b/core/res/res/values-ar/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"كتابة بيانات جهة الاتصال"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"للسماح للتطبيق بتعديل بيانات (عنوان) جهة الاتصال المخزّنة على الجهاز اللوحي. يمكن أن تستخدم التطبيقات الضارة ذلك لمسح بيانات جهات الاتصال أو تعديلها."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"للسماح للتطبيق بتعديل بيانات (عنوان) جهة الاتصال المخزّنة على هاتفك. يمكن أن تستخدم التطبيقات الضارة ذلك لمسح بيانات جهات الاتصال أو تعديلها."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"قراءة سجل المكالمات"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"للسماح للتطبيق بقراءة سجل المكالمات، بما في ذلك البيانات عن المكالمات الواردة والصادرة. وربما تستخدم التطبيقات الضارة هذا لإرسال بياناتك إلى أشخاص آخرين."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"للسماح للتطبيق بقراءة سجل مكالمات الهاتف، بما في ذلك البيانات عن المكالمات الواردة والصادرة. وربما تستخدم التطبيقات الضارة هذا لإرسال بياناتك إلى أشخاص آخرين."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"كتابة سجل المكالمات"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"للسماح للتطبيق بتعديل سجل مكالمات الجهاز اللوحي، بما في ذلك البيانات عن المكالمات الواردة والصادرة. وربما تستخدم التطبيقات الضارة هذا لمسح سجل المكالمات أو تعديله."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"للسماح للتطبيق بتعديل سجل مكالمات الهاتف، بما في ذلك البيانات عن المكالمات الواردة والصادرة. وربما تستخدم التطبيقات الضارة هذا لمحو سجل المكالمات أو تعديله."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"قراءة بيانات ملفك الشخصي"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"للسماح للتطبيق بقراءة معلومات الملف الشخصي الشخصية المخزنة على الجهاز، مثل اسمك ومعلومات جهات الاتصال. يعني ذلك أنه يمكن للتطبيق التعرف عليك وإرسال معلومات ملفك الشخصي إلى الآخرين."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"الكتابة إلى بيانات ملفك الشخصي"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"للسماح للتطبيق بقراءة أي كلمات وأسماء وعبارات خاصة ربما خزنها المستخدم في قاموس المستخدم."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"كتابة إلى القاموس المعرّف بواسطة المستخدم"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"للسماح للتطبيق بكتابة كلمات جديدة في قاموس المستخدم."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"قراءة محتويات وحدة تخزين USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"قراءة محتويات بطاقة SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"للسماح للتطبيق بقراءة محتويات وحدة تخزين USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"للسماح للتطبيق بقراءة محتويات بطاقة SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"تعديل/حذف محتويات وحدة تخزين USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"تعديل/حذف محتويات بطاقة SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"للسماح للتطبيق بالكتابة إلى وحدة تخزين USB."</string>
diff --git a/core/res/res/values-be/strings.xml b/core/res/res/values-be/strings.xml
index a37e231..0178764 100644
--- a/core/res/res/values-be/strings.xml
+++ b/core/res/res/values-be/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"запісваць кантактныя дадзеныя"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Дазваляе прыкладанням змяняць кантакты (адрасы), якія захоўваюцца на планшэце. Шкоднасныя прыкладанні могуць выкарыстоўваць гэтую магчымасць для выдалення або змены кантактных дадзеных."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Дазваляе прыкладанням змяняць кантакты (адрасы), якія захоўваюцца на вашым тэлефоне. Шкоднасныя прыкладанні могуць выкарыстоўваць гэту магчымасць для выдалення або змены кантактных дадзеных."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"чытанне гiсторыi выклікаў"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Дазваляе прыкладанню чытаць гiсторыю выклiкаў планшэту, у тым лiку дадзеныя пра ўваходныя і зыходныя выклiкi. Шкоднасныя прыкладаннi могуць выкарыстоўваць гэта, каб адпраўляць вашы дадзеныя іншым людзям."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Дазваляе прыкладанню чытаць гiсторыю выклiкаў, у тым лiку ўваходныя і зыходныя выклiкi. Шкоднасныя праграмы могуць выкарыстоўваць гэта, каб адпраўляць вашы дадзеныя іншым людзям."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"запіс гiсторыi выклікаў"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Дазваляе прыкладанню змяняць гiсторыю выклiкаў планшэта, у тым лiку дадзеныя пра ўваходныя i зыходныя выклiкi. Шкоднасныя прыкладаннi могуць выкарыстоўваць гэта, каб выдаляць або змяняць гiсторыю выклікаў."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Дазваляе прыкладанням змяняць гiсторыю выклiкаў тэлефону, у тым лiку дадзеныя пра ўваходныя і зыходныя выклiкi. Шкоднасныя прыкладаннi могуць выкарыстоўваць гэта, каб выдаляць або змяняць гiсторыю выклікаў."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"чытаць дадзеныя вашага профілю"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Дазваляе прыкладанням счытваць асабістую інфармацыю ў профілях, якая захоўваецца на вашай прыладзе, напрыклад, ваша імя і кантактную інфармацыю. Гэта азначае, што прыкладанне можа ідэнтыфікаваць вас і адправіць інфармацыю вашага профілю трэцім асобам."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"увядзіце дадзеныя вашага профілю"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Дазваляе прыкладанню счытваць любыя прыватныя словы, імёны і фразы, якія карыстальнік можа захоўваць у карыстальніцкім слоўніку."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"запісаць у карыстальніцкі слоўнік"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Дазваляе прыкладанням запісваць новыя словы ў карыстальніцкі слоўнік."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"чытанне змесціва USB-назапашвальнiка"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"чытанне змесціва SD-карты"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Дазваляе прыкладаню счытваць змесцiва USB-назапашвальніка."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Дазваляе прыкладанню счытваць змесціва SD-карты."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"змяніць/выдаліць змесціва USB-назапашвальнiка"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"змяняць/выдаляць змесціва SD-карты"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Дазваляе прыкладаням выконваць запіс ва USB-назапашвальнік."</string>
diff --git a/core/res/res/values-bg-rBG/arrays.xml b/core/res/res/values-bg-rBG/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-bg-rBG/arrays.xml
rename to core/res/res/values-bg-rBG/donottranslate-maps.xml
diff --git a/core/res/res/values-bg/strings.xml b/core/res/res/values-bg/strings.xml
index c277ee9..479e118 100644
--- a/core/res/res/values-bg/strings.xml
+++ b/core/res/res/values-bg/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"запис на данни за контактите"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Разрешава на приложението да променя данните за контактите (за адрес), съхранени в таблета ви. Злонамерените приложения могат да използват това, за да изтрият или променят тези данни."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Разрешава на приложението да променя данните за контактите (за адрес), съхранени в телефона ви. Злонамерените приложения могат да използват това, за да изтрият или променят тези данни."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"четене на списъка с обаждания"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Разрешава на приложението да чете списъка с обаждания на таблета ви, включително данните за входящите и изходящите обаждания. Злонамерените приложения могат да използват това, за да изпращат информацията ви на други хора."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Разрешава на приложението да чете списъка с обаждания на телефона ви, включително данните за входящите и изходящите обаждания. Злонамерените приложения могат да използват това, за да изпращат информацията ви на други хора."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"запис на списъка с обаждания"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Разрешава на приложението да променя списъка с обаждания на таблета ви, включително данните за входящите и изходящите обаждания. Злонамерените приложения могат да използват това, за да изтрият или променят този списък."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Разрешава на приложението да променя списъка с обаждания на телефона ви, включително данните за входящите и изходящите обаждания. Злонамерените приложения могат да използват това, за да изтрият или променят този списък."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"четене на данните в профила ви"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Разрешава на приложението да чете информацията от личния потребителски профил, съхранена на устройството ви, например вашето име и данни за връзка. Това означава, че приложението може да ви идентифицира и да изпраща информацията за потребителския ви профил на други хора."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"запис в потр. ви профил"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Разрешава на приложението да чете частни думи, имена и фрази, които потребителят може да е съхранил в потребителския речник."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"запис в дефинирания от потребителя речник"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Разрешава на приложението да записва нови думи в потребителския речник."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"четене на съдържанието на USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"четене на съдържанието на SD картата"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Разрешава на прил. да чете съдърж. на USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Разрешава на приложението да чете съдържанието на SD картата."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"промяна/изтриване на съдържанието в USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"промяна/изтриване на съдържанието на SD картата"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Разрешава на приложението да записва в USB."</string>
diff --git a/core/res/res/values-ca-rES/arrays.xml b/core/res/res/values-ca-rES/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-ca-rES/arrays.xml
rename to core/res/res/values-ca-rES/donottranslate-maps.xml
diff --git a/core/res/res/values-ca/strings.xml b/core/res/res/values-ca/strings.xml
index 189225e..64d0f87 100644
--- a/core/res/res/values-ca/strings.xml
+++ b/core/res/res/values-ca/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"escriure dades de contacte"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Permet que l\'aplicació modifiqui les dades de contacte (adreça) emmagatzemades a la tauleta. Les aplicacions malicioses poden utilitzar-ho per esborrar o modificar les dades de contacte."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Permet que l\'aplicació modifiqui les dades de contacte (adreça) emmagatzemades al telèfon. Les aplicacions malicioses poden utilitzar-ho per esborrar o per modificar les dades de contacte."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"lectura del registre de trucades"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Permet que l\'aplicació llegeixi el registre de trucades de la teva tauleta, incloses les dades de les trucades entrants i sortints. És possible que les aplicacions malicioses ho utilitzin per enviar les teves dades a altres persones."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Permet que l\'aplicació llegeixi el registre de trucades del teu telèfon, incloses les dades de les trucades entrants i sortints. És possible que les aplicacions malicioses ho utilitzin per enviar les teves dades a altres persones."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"escriptura del registre de trucades"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Permet que l\'aplicació modifiqui el registre de trucades de la teva tauleta, incloses les dades de les trucades entrants i sortints. És possible que les aplicacions malicioses ho utilitzin per eliminar o per modificar el teu registre de trucades."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Permet que l\'aplicació modifiqui el registre de trucades del teu telèfon, incloses les dades de les trucades entrants i sortints. És possible que les aplicacions malicioses ho utilitzin per eliminar o per modificar el teu registre de trucades."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"lectura de dades del teu perfil"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Permet que l\'aplicació pugui llegir informació del perfil personal emmagatzemada al dispositiu, com ara el teu nom i la teva informació de contacte. Això significa que l\'aplicació et pot identificar i enviar la informació del teu perfil a altres persones."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"escriptura a les teves dades del perfil"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Permet que l\'aplicació llegeixi les paraules, els noms i les frases privats que l\'usuari pot haver emmagatzemat al seu diccionari."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"escriu al diccionari definit per l\'usuari"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Permet que l\'aplicació escrigui paraules noves al diccionari de l\'usuari."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"llegeix el contingut de l\'emmagatzematge USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"llegeix el contingut de la targeta SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Permet que l\'aplicació llegeixi el contingut de l\'emmagatzematge USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Permet que l\'aplicació llegeixi el contingut de la targeta SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"modificar/esborrar contingut USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modificar/esborrar contingut de la targeta SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Permet que l\'aplicació escrigui a l\'emmagatzematge USB."</string>
diff --git a/core/res/res/values-cs-rCZ/arrays.xml b/core/res/res/values-cs-rCZ/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-cs-rCZ/arrays.xml
rename to core/res/res/values-cs-rCZ/donottranslate-maps.xml
diff --git a/core/res/res/values-cs/strings.xml b/core/res/res/values-cs/strings.xml
index 389a672..8125ee3 100644
--- a/core/res/res/values-cs/strings.xml
+++ b/core/res/res/values-cs/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"zapisovat data kontaktů"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Umožňuje aplikaci upravit kontaktní údaje (adresy) uložené v tabletu. Škodlivé aplikace mohou toto oprávnění použít k vymazání nebo úpravě kontaktních údajů."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Umožňuje aplikaci upravit kontaktní údaje uložené v telefonu (adresu). Škodlivé aplikace mohou toto oprávnění použít k vymazání nebo úpravě kontaktních údajů."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"číst seznam hovorů"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Umožňuje aplikaci číst seznam hovorů vašeho tabletu, včetně dat o příchozích a odchozích hovorech. Škodlivé aplikace mohou tato data posílat jiným osobám."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Umožňuje aplikaci číst seznam hovorů vašeho telefonu, včetně dat o příchozích a odchozích hovorech. Škodlivé aplikace mohou tato data posílat jiným osobám."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"zapisovat seznam hovorů"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Umožňuje aplikaci upravovat seznam hovorů vašeho tabletu, včetně dat o příchozích a odchozích hovorech. Škodlivé aplikace to mohou zneužít k vymazání nebo změnám seznamu hovorů."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Umožňuje aplikaci upravovat seznam hovorů vašeho telefonu, včetně dat o příchozích a odchozích hovorech. Škodlivé aplikace to mohou zneužít k vymazání nebo změnám seznamu hovorů."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"čtení údajů o vašem profilu"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Umožňuje aplikaci číst údaje v osobním profilu uložené v zařízení, například jméno nebo kontaktní údaje. Znamená to, že vás ostatní aplikace mohou identifikovat a odeslat údaje z profilu dalším aplikacím."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"zapisovat do údajů o profilu"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Umožní aplikaci číst soukromá slova, jména a fráze, která uživatel mohl uložit do svého slovníku."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"zápis do slovníku definovaného uživatelem"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Umožňuje aplikaci zapisovat nová slova do uživatelského slovníku."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"čtení obsahu USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"čtení obsahu karty SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Umožňuje čtení obsahu USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Umožňuje aplikaci čtení obsahu karty SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"úprava/mazání obsahu úložiště USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"změna/smazání obsahu karty SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Umožňuje aplikaci zapisovat do úložiště USB."</string>
diff --git a/core/res/res/values-da-rDK/arrays.xml b/core/res/res/values-da-rDK/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-da-rDK/arrays.xml
rename to core/res/res/values-da-rDK/donottranslate-maps.xml
diff --git a/core/res/res/values-da/strings.xml b/core/res/res/values-da/strings.xml
index 3ca0534..0b14edb 100644
--- a/core/res/res/values-da/strings.xml
+++ b/core/res/res/values-da/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"skriv kontaktdata"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Tillader, at appen kan ændre data for kontaktpersoner (adresser), der er gemt på din tablet. Ondsindede apps kan bruge dette til at slette eller ændre dine kontaktoplysninger."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Tillader, at appen kan ændre kontaktdata (adresser), der er gemt på din telefon. Ondsindede apps kan bruge dette til at slette eller ændre kontaktdata."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"læs opkaldsliste"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Tillader, at appen læser din tablets opkaldsliste, herunder data om indgående og udgående opkald. Ondsindede apps kan bruge dette til at sende dine data til andre personer."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Tillader, at appen læser telefonens opkaldsliste, herunder data om indgående og udgående opkald. Ondsindede apps kan bruge dette til at sende dine data til andre personer."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"skriv opkaldsliste"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Tillader, at appen ændrer din tablets opkaldsliste, herunder data om indgående og udgående opkald. Ondsindede apps kan bruge dette til at slette eller ændre din opkaldsliste."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Tillader, at appen ændrer telefonens opkaldsliste, herunder data om indgående og udgående opkald. Ondsindede apps kan bruge dette til at slette eller ændre din opkaldsliste."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"læse dine profildata"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Tillader, at appen kan læse personlige profiloplysninger, der er gemt på din enhed, f.eks. dit navn og dine kontaktoplysninger. Det betyder, at appen kan identificere dig og sende dine profiloplysninger til andre."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"skrive til dine profildata"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Tillader, at appen kan læse alle private ord, navne og sætninger, som brugeren kan have gemt i brugerordbogen."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"skrive til brugerordbogen"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Tillader, at appen kan skrive nye ord i brugerordbogen."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"læse USB-lagerets indhold"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"læse indholdet af SD-kortet"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Tillader, at app\'en læser indhold på USB-lager."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Tillader, at app\'en læser indholdet af SD-kortet."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"rette/slette i USB-lager"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"ret/slet indholdet på SD-kortet"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Lader appen skrive til USB."</string>
diff --git a/core/res/res/values-de-rAT/arrays.xml b/core/res/res/values-de-rAT/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-de-rAT/arrays.xml
rename to core/res/res/values-de-rAT/donottranslate-maps.xml
diff --git a/core/res/res/values-de-rCH/arrays.xml b/core/res/res/values-de-rCH/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-de-rCH/arrays.xml
rename to core/res/res/values-de-rCH/donottranslate-maps.xml
diff --git a/core/res/res/values-de-rDE/arrays.xml b/core/res/res/values-de-rDE/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-de-rDE/arrays.xml
rename to core/res/res/values-de-rDE/donottranslate-maps.xml
diff --git a/core/res/res/values-de-rLI/arrays.xml b/core/res/res/values-de-rLI/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-de-rLI/arrays.xml
rename to core/res/res/values-de-rLI/donottranslate-maps.xml
diff --git a/core/res/res/values-de/strings.xml b/core/res/res/values-de/strings.xml
index 72ac55f..baf3e40 100644
--- a/core/res/res/values-de/strings.xml
+++ b/core/res/res/values-de/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"Kontaktdaten schreiben"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Ermöglicht der App, die auf Ihrem Tablet gespeicherten Kontaktdaten (Adressen) zu ändern. Schädliche Apps können so Ihre Kontaktdaten löschen oder ändern."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Ermöglicht der App, die auf Ihrem Telefon gespeicherten Kontaktdaten (Adressen) zu ändern. Schädliche Apps können so Ihre Kontaktdaten löschen oder ändern."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"Anrufprotokoll lesen"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Ermöglicht der App, das Anrufprotokoll Ihres Tablets zu lesen, einschließlich der Daten über ein- und ausgehende Anrufe. Schädliche Apps können so Ihre Daten an Dritte senden."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Ermöglicht der App, das Anrufprotokoll Ihres Telefons zu lesen, einschließlich der Daten über ein- und ausgehende Anrufe. Schädliche Apps können so Ihre Daten an Dritte senden."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"Anrufprotokoll bearbeiten"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Ermöglicht der App, das Anrufprotokoll Ihres Tablets zu ändern, einschließlich der Daten über ein- und ausgehende Anrufe. Schädliche Apps können so Ihr Anrufprotokoll löschen oder ändern."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Ermöglicht der App, das Anrufprotokoll Ihres Telefons zu ändern, einschließlich der Daten über ein- und ausgehende Anrufe. Schädliche Apps können so Ihr Anrufprotokoll löschen oder ändern."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"Ihre Profildaten lesen"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Ermöglicht der App, auf Ihrem Gerät gespeicherte persönliche Profilinformationen zu lesen, darunter Ihren Namen und Ihre Kontaktdaten. Die App kann Sie somit identifizieren und Ihre Profilinformationen an andere senden."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"In Ihre Profildaten schreiben"</string>
@@ -411,8 +417,8 @@
<string name="permdesc_performCdmaProvisioning" msgid="1994193538802314186">"Ermöglicht der App, die CDMA-Bereitstellung zu starten. Schädliche Apps können so die CDMA-Bereitstellung unnötigerweise starten."</string>
<string name="permlab_locationUpdates" msgid="7785408253364335740">"Benachrichtigungen für Standortaktualisierung steuern"</string>
<string name="permdesc_locationUpdates" msgid="1120741557891438876">"Ermöglicht der App, Mobilfunkbenachrichtigungen über Standort-Updates zu aktivieren bzw. zu deaktivieren. Nicht für normale Apps vorgesehen."</string>
- <string name="permlab_checkinProperties" msgid="7855259461268734914">"Auf Check-In-Eigenschaften zugreifen"</string>
- <string name="permdesc_checkinProperties" msgid="4024526968630194128">"Ermöglicht der App Schreib-/Lesezugriff auf vom Check-In-Service hochgeladene Elemente. Nicht für normale Apps vorgesehen."</string>
+ <string name="permlab_checkinProperties" msgid="7855259461268734914">"Auf Check-in-Eigenschaften zugreifen"</string>
+ <string name="permdesc_checkinProperties" msgid="4024526968630194128">"Ermöglicht der App Schreib-/Lesezugriff auf vom Check-in-Service hochgeladene Elemente. Nicht für normale Apps vorgesehen."</string>
<string name="permlab_bindGadget" msgid="776905339015863471">"Widgets auswählen"</string>
<string name="permdesc_bindGadget" msgid="8261326938599049290">"Ermöglicht der App, dem System zu melden, welche Widgets von welcher App verwendet werden können. Mit dieser Berechtigung können Apps anderen Apps Zugriff auf persönliche Daten gewähren. Nicht für normale Apps vorgesehen."</string>
<string name="permlab_modifyPhoneState" msgid="8423923777659292228">"Telefonstatus ändern"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Ermöglicht der App, alle privaten Wörter, Namen und Ausdrücke zu lesen, die ein Nutzer in seinem Wörterbuch gespeichert hat"</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"In benutzerdefiniertes Wörterbuch schreiben"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Ermöglicht der App, dem Nutzerwörterbuch neue Einträge hinzuzufügen"</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"USB-Speicher-Inhalt lesen"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"SD-Karten-Inhalt lesen"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Ermöglicht der App, den USB-Speicher zu lesen"</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Ermöglicht der App, den Inhalt einer SD-Karte zu lesen"</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"USB-Speicherinhalt ändern/löschen"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"SD-Karten-Inhalt ändern/löschen"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Ermöglicht der App, in den USB-Speicher zu schreiben"</string>
@@ -733,8 +743,7 @@
<string name="double_tap_toast" msgid="4595046515400268881">"Tipp: Zum Vergrößern und Verkleinern zweimal tippen"</string>
<string name="autofill_this_form" msgid="4616758841157816676">"AutoFill"</string>
<string name="setup_autofill" msgid="7103495070180590814">"AutoFill konfig."</string>
- <!-- no translation found for autofill_address_name_separator (6350145154779706772) -->
- <skip />
+ <string name="autofill_address_name_separator" msgid="6350145154779706772">" "</string>
<string name="autofill_address_summary_name_format" msgid="3268041054899214945">"$1$2$3"</string>
<string name="autofill_address_summary_separator" msgid="7483307893170324129">", "</string>
<string name="autofill_address_summary_format" msgid="4874459455786827344">"$1$2$3"</string>
diff --git a/core/res/res/values-el-rGR/arrays.xml b/core/res/res/values-el-rGR/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-el-rGR/arrays.xml
rename to core/res/res/values-el-rGR/donottranslate-maps.xml
diff --git a/core/res/res/values-el/strings.xml b/core/res/res/values-el/strings.xml
index 0e5dd10..ad840e3 100644
--- a/core/res/res/values-el/strings.xml
+++ b/core/res/res/values-el/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"εγγραφή δεδομένων επαφής"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Επιτρέπει στην εφαρμογή να τροποποιεί τα δεδομένα επαφής (διεύθυνσης) που είναι αποθηκευμένα στο tablet σας. Κακόβουλες εφαρμογές μπορούν να το χρησιμοποιήσουν για να διαγράψουν ή να τροποποιήσουν τα δεδομένα επαφών σας."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Επιτρέπει στην εφαρμογή να τροποποιεί τα δεδομένα επαφής (διεύθυνσης) που είναι αποθηκευμένα στο τηλέφωνό σας. Κακόβουλες εφαρμογές μπορούν να το χρησιμοποιήσουν για να διαγράψουν ή να τροποποιήσουν τα δεδομένα επαφών σας."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"ανάγνωση αρχείου καταγραφής κλήσεων"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Επιτρέπει στην εφαρμογή να διαβάζει το αρχείο καταγραφής κλήσεων του tablet σας, συμπεριλαμβανομένων των δεδομένων σχετικά με τις εισερχόμενες και τις εξερχόμενες κλήσεις. Οι κακόβουλες εφαρμογές μπορεί να το χρησιμοποιήσουν για να στείλουν τα δεδομένα σας σε άλλα άτομα."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Επιτρέπει στην εφαρμογή να διαβάζει το αρχείο καταγραφής κλήσεων του τηλεφώνου σας, συμπεριλαμβανομένων των δεδομένων σχετικά με τις εισερχόμενες και τις εξερχόμενες κλήσεις. Οι κακόβουλες εφαρμογές μπορεί να το χρησιμοποιήσουν για να στείλουν τα δεδομένα σας σε άλλα άτομα."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"εγγραφή αρχείου καταγραφής κλήσεων"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Επιτρέπει στην εφαρμογή να τροποποιεί το αρχείο καταγραφής κλήσεων του tablet σας, συμπεριλαμβανομένων των δεδομένων σχετικά με τις εισερχόμενες και τις εξερχόμενες κλήσεις. Οι κακόβουλες εφαρμογές μπορεί να το χρησιμοποιήσουν για να διαγράψουν ή να τροποποιήσουν το αρχείο καταγραφής κλήσεων."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Επιτρέπει στην εφαρμογή να τροποποιεί το αρχείο καταγραφής κλήσεων του τηλεφώνου σας, συμπεριλαμβανομένων των δεδομένων σχετικά με τις εισερχόμενες και τις εξερχόμενες κλήσεις. Οι κακόβουλες εφαρμογές μπορεί να το χρησιμοποιήσουν για να διαγράψουν ή να τροποποιήσουν το αρχείο καταγραφής κλήσεων."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"ανάγν. δεδ. προφ."</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Επιτρέπει στην εφαρμογή την ανάγνωση προσωπικών πληροφοριών προφίλ οι οποίες είναι αποθηκευμένες στη συσκευή σας, όπως το όνομα και τα στοιχεία επικοινωνίας σας. Αυτό σημαίνει ότι η εφαρμογή μπορεί να σας αναγνωρίσει και να στείλει τις πληροφορίες σας προφίλ σε άλλους."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"εγγρ. σε δεδ. προφίλ"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Επιτρέπει στην εφαρμογή την ανάγνωση ιδιωτικών λέξεων, ονομάτων και φράσεων, τα οποία ο χρήστης ενδέχεται να έχει αποθηκεύσει στο λεξικό χρήστη."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"εγγραφή σε λεξικό καθορισμένο από τον χρήστη"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Επιτρέπει στην εφαρμογή την εγγραφή νέων λέξεων στο λεξικό χρήστη."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"ανάγν. περιεχ. αποθ. χώρ. USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"ανάγνωση περιεχομένου κάρτας SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Επιτρ. η ανάγν. περιεχ. απ. χώρου USB"</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Επιτρέπει στην εφαρμογή την ανάγνωση περιεχομένου της κάρτας SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"τροπ./διαγρ. περ. απ. χώρ. USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"τροποποίηση/διαγραφή περιεχομένων κάρτας SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Επιτρέπει στην εφαρμογή την εγγραφή στον αποθηκευτικό χώρο USB."</string>
diff --git a/core/res/res/values-en-rAU/arrays.xml b/core/res/res/values-en-rAU/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-en-rAU/arrays.xml
rename to core/res/res/values-en-rAU/donottranslate-maps.xml
diff --git a/core/res/res/values-en-rCA/arrays.xml b/core/res/res/values-en-rCA/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-en-rCA/arrays.xml
rename to core/res/res/values-en-rCA/donottranslate-maps.xml
diff --git a/core/res/res/values-en-rGB/arrays.xml b/core/res/res/values-en-rGB/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-en-rGB/arrays.xml
rename to core/res/res/values-en-rGB/donottranslate-maps.xml
diff --git a/core/res/res/values-en-rGB/strings.xml b/core/res/res/values-en-rGB/strings.xml
index e7ff973..de92665 100644
--- a/core/res/res/values-en-rGB/strings.xml
+++ b/core/res/res/values-en-rGB/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"write contact data"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Allows the app to modify the contact (address) data stored on your tablet. Malicious apps may use this to erase or modify your contact data."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Allows the app to modify the contact (address) data stored on your phone. Malicious apps may use this to erase or modify your contact data."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"read call log"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Allows the app to read your tablet\'s call log, including data about incoming and outgoing calls. Malicious apps may use this to send your data to other people."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Allows the app to read your phone\'s call log, including data about incoming and outgoing calls. Malicious apps may use this to send your data to other people."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"write call log"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Allows the app to modify your tablet\'s call log, including data about incoming and outgoing calls. Malicious apps may use this to erase or modify your call log."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Allows the app to modify your phone\'s call log, including data about incoming and outgoing calls. Malicious apps may use this to erase or modify your call log."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"read your profile data"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Allows the app to read personal profile information stored on your device, such as your name and contact information. This means the app can identify you and send your profile information to others."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"write to your profile data"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Allows the app to read any private words, names and phrases that the user may have stored in the user dictionary."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"write to user-defined dictionary"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Allows the app to write new words into the user dictionary."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"read USB storage contents"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"read SD card contents"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Allows the app to read contents of USB storage."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Allows the app to read contents of SD card."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"modify/delete USB storage contents"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modify/delete SD card contents"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Allows the app to write to the USB storage."</string>
diff --git a/core/res/res/values-en-rIE/arrays.xml b/core/res/res/values-en-rIE/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-en-rIE/arrays.xml
rename to core/res/res/values-en-rIE/donottranslate-maps.xml
diff --git a/core/res/res/values-en-rIN/arrays.xml b/core/res/res/values-en-rIN/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-en-rIN/arrays.xml
rename to core/res/res/values-en-rIN/donottranslate-maps.xml
diff --git a/core/res/res/values-en-rNZ/arrays.xml b/core/res/res/values-en-rNZ/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-en-rNZ/arrays.xml
rename to core/res/res/values-en-rNZ/donottranslate-maps.xml
diff --git a/core/res/res/values-en-rSG/arrays.xml b/core/res/res/values-en-rSG/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-en-rSG/arrays.xml
rename to core/res/res/values-en-rSG/donottranslate-maps.xml
diff --git a/core/res/res/values-en-rZA/arrays.xml b/core/res/res/values-en-rZA/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-en-rZA/arrays.xml
rename to core/res/res/values-en-rZA/donottranslate-maps.xml
diff --git a/core/res/res/values-es-rES/arrays.xml b/core/res/res/values-es-rES/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-es-rES/arrays.xml
rename to core/res/res/values-es-rES/donottranslate-maps.xml
diff --git a/core/res/res/values-es-rUS/strings.xml b/core/res/res/values-es-rUS/strings.xml
index 8e36948..5ef9483a 100644
--- a/core/res/res/values-es-rUS/strings.xml
+++ b/core/res/res/values-es-rUS/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"escribir datos de contacto"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Permite que la aplicación modifique la información de contacto (dirección) almacenada en tu tableta. Las aplicaciones maliciosas pueden utilizar este permiso para borrar o modificar tu información de contacto."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Permite que la aplicación modifique la información de contacto (dirección) almacenada en tu dispositivo. Las aplicaciones maliciosas pueden utilizar este permiso para borrar o modificar tu información de contacto."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"leer el registro de llamadas"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Permite que la aplicación lea el registro de llamadas del tablet, incluidos datos sobre llamadas entrantes y salientes. Las aplicaciones malintencionadas pueden usar este permiso para enviar tus datos a otros usuarios."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Permite que la aplicación lea el registro de llamadas del teléfono, incluidos datos sobre llamadas entrantes y salientes. Las aplicaciones malintencionadas pueden usar este permiso para enviar tus datos a otros usuarios."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"escribir en el registro de llamadas"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Permite que la aplicación modifique el registro de llamadas del tablet, incluidos datos sobre llamadas entrantes y salientes. Las aplicaciones malintencionadas pueden usar este permiso para borrar o modificar el registro de llamadas."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Permite que la aplicación modifique el registro de llamadas del teléfono, incluidos datos sobre llamadas entrantes y salientes. Las aplicaciones malintencionadas pueden usar este permiso para borrar o modificar el registro de llamadas."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"Leer tus datos de perfil"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Permite que la aplicación lea la información de perfil almacenada en tu dispositivo, como tu nombre e información de contacto. Esto significa que la aplicación puede identificarte y enviar tu información de perfil a otros."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"Escrib. en datos de tu perfil"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Permite que la aplicación lea cualquier palabra, nombre o frase de carácter privado que el usuario haya almacenado en su diccionario."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"agregar al diccionario definido por el usuario"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Permite que la aplicación ingrese palabras nuevas en el diccionario del usuario."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"Leer almacenamiento USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"Leer el contenido de la tarjeta SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Permite leer USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Permite a la aplicación leer el contenido de la tarjeta SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"modificar o eliminar el contenido del almacenamiento USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modificar/eliminar el contenido de la tarjeta SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Permite que la aplicación escriba en el almacenamiento USB."</string>
diff --git a/core/res/res/values-es/strings.xml b/core/res/res/values-es/strings.xml
index a4638fa..9ede6a0 100644
--- a/core/res/res/values-es/strings.xml
+++ b/core/res/res/values-es/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"escribir datos de contacto"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Permite que la aplicación lea todos los datos (direcciones) de contactos almacenados en el tablet. Las aplicaciones malintencionadas pueden usar este permiso para borrar o modificar los datos de contactos."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Permite que la aplicación consulte todos los datos (direcciones) de contactos almacenados en el teléfono. Las aplicaciones malintencionadas pueden usar este permiso para borrar o modificar los datos de contactos."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"leer el registro de llamadas"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Permite que la aplicación lea el registro de llamadas del tablet, incluidos datos sobre llamadas entrantes y salientes. Las aplicaciones malintencionadas pueden usar este permiso para enviar tus datos a otros usuarios."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Permite que la aplicación lea el registro de llamadas del teléfono, incluidos datos sobre llamadas entrantes y salientes. Las aplicaciones malintencionadas pueden usar este permiso para enviar tus datos a otros usuarios."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"escribir en el registro de llamadas"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Permite que la aplicación modifique el registro de llamadas del tablet, incluidos datos sobre llamadas entrantes y salientes. Las aplicaciones malintencionadas pueden usar este permiso para borrar o modificar el registro de llamadas."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Permite que la aplicación modifique el registro de llamadas del teléfono, incluidos datos sobre llamadas entrantes y salientes. Las aplicaciones malintencionadas pueden usar este permiso para borrar o modificar el registro de llamadas."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"acceder a datos de tu perfil"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Permite que la aplicación acceda a información del perfil personal almacenada en el dispositivo (como el nombre o la información de contacto), lo que significa que la aplicación puede identificar al usuario y enviar la información de su perfil a otros usuarios."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"escribir en datos de tu perfil"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Permite que la aplicación lea cualquier palabra, nombre o frase de carácter privado que el usuario haya almacenado en su diccionario."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"añadir al diccionario definido por el usuario"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Permite que la aplicación escriba palabras nuevas en el diccionario de usuario."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"leer contenido del almacenamiento USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"leer contenido de la tarjeta SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Permite que la aplicación lea contenido del almacenamiento USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Permite que la aplicación lea contenidos de la tarjeta SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"modificar/borrar contenido USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modificar/eliminar contenido de la tarjeta SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Permite escribir en el almacenamiento USB."</string>
diff --git a/core/res/res/values-et/strings.xml b/core/res/res/values-et/strings.xml
index 697c8f1..b68944e 100644
--- a/core/res/res/values-et/strings.xml
+++ b/core/res/res/values-et/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"kirjuta kontaktandmeid"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Võimaldab rakendusel muuta tahvelarvutisse salvestatud kontaktandmeid (aadresse). Pahatahtlikud rakendused võivad seda kasutada teie kontaktandmete kustutamiseks või muutmiseks."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Võimaldab rakendusel muuta telefoni salvestatud kontaktandmeid (aadresse). Pahatahtlikud rakendused võivad seda kasutada teie kontaktandmete kustutamiseks või muutmiseks."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"kõnelogi lugemine"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Lubab rakendusel lugeda tahvelarvuti kõnelogi, sh teavet sissetulevate ja väljaminevate kõnede kohta. Pahatahtlikud rakendused võivad saata selle abil teie teavet teistele inimestele."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Lubab rakendusel lugeda telefoni kõnelogi, sh teavet sissetulevate ja väljaminevate kõnede kohta. Pahatahtlikud rakendused võivad saata selle abil teie teavet teistele inimestele."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"kõnelogi kirjutamine"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Lubab rakendusel muuta tahvelarvuti kõnelogi, sh sissetulevate ja väljaminevate kõnede andmeid. Pahatahtlikud rakendused võivad kasutada seda kõnelogi kustutamiseks või muutmiseks."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Lubab rakendusel muuta telefoni kõnelogi, sh sissetulevate ja väljaminevate kõnede andmeid. Pahatahtlikud rakendused võivad kasutada seda kõnelogi kustutamiseks või muutmiseks."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"profiili andmete lugemine"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Võimaldab rakendusel lugeda seadmesse salvestatud isiklikku teavet, näiteks teie nime ja kontaktandmeid. See tähendab, et rakendus saab teid tuvastada ja saata teie profiiliteavet teistele."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"andmete kirjutamine profiili"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Võimaldab rakendusel lugeda kõiki privaatseid sõnu, nimesid ja fraase, mille kasutaja võis salvestada kasutajasõnastikku."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"Kasutaja määratud sõnastikku kirjutamine"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Võimaldab rakendusel kirjutada kasutajasõnastikku uusi sõnu."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"USB-salvestusruumi sisu lugem."</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"SD-kaardi sisu lugemine"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Rak. loeb USB-s.-ruumi sisu."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Võimaldab rakendusel lugeda SD-kaardi sisu."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"USB-seadme sisu muutm./kustut."</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"muuda/kustuta SD-kaardi sisu"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Võimaldab rakendusel kirjutada USB-mäluseadmele."</string>
diff --git a/core/res/res/values-fa-rIR/arrays.xml b/core/res/res/values-fa-rIR/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-fa-rIR/arrays.xml
rename to core/res/res/values-fa-rIR/donottranslate-maps.xml
diff --git a/core/res/res/values-fa/strings.xml b/core/res/res/values-fa/strings.xml
index a4a9bff..5a536e6 100644
--- a/core/res/res/values-fa/strings.xml
+++ b/core/res/res/values-fa/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"نوشتن اطلاعات تماس"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"به برنامه اجازه میدهد دادههای مخاطب ذخیره شده در رایانه لوحی را تغییر دهد. برنامههای مخرب میتوانند از آن استفاده کنند تا دادههای تماس شما را تغییر دهند یا پاک کنند."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"به برنامه اجازه میدهد تا دادههای مخاطب (آدرس) را که در تلفن ذخیره شده تغییر دهد. برنامههای مخرب میتوانند از این استفاده کنند تا دادههای تماس شما را پاک کنند یا تغییر دهند."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"خواندن گزارش تماس"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"به برنامه اجازه میدهد گزارشات تماس رایانه لوحی شما، از جمله دادههایی درمورد تماسهای ورودی و خروجی را بخواند. برنامههای مخرب ممکن است از این ویژگی برای ارسال دادههای شما به دیگران استفاده کنند."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"به برنامه اجازه میدهد گزارشات تماس تلفنی شما، از جمله دادههایی درمورد تماسهای ورودی و خروجی را بخواند. برنامههای مخرب ممکن است از این ویژگی برای ارسال دادههای شما به دیگران استفاده کنند."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"نوشتن در گزارش تماس"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"به برنامه اجازه میدهد گزارشات تماس رایانه لوحی شما، از جمله دادههایی درمورد تماسهای ورودی و خروجی را تغییر دهد. برنامههای مخرب ممکن است از این ویژگی برای پاک کردن یا تغییر گزارش تماس شما استفاده کنند."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"به برنامه اجازه میدهد گزارشات تماس تلفنی شما، از جمله دادههایی درمورد تماسهای ورودی و خروجی را تغییر دهد. برنامههای مخرب ممکن است از این ویژگی برای پاک کردن یا تغییر گزارش تماس شما استفاده کنند."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"خواندن دادههای نمایه شما"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"به برنامه اجازه میدهد اطلاعات نمایه شخصی ذخیره شده در دستگاه شما را بخواند. یعنی برنامه میتواند شما را شناسایی کند و اطلاعات نمایه شما را به دیگران ارسال کند."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"نوشتن در دادههای نمایه شما"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"به برنامه اجازه میدهد هر گونه کلمه، نام، عبارت خصوصی را که کاربر در فرهنگ لغت خود ذخیره کرده است بخواند."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"نوشتن در فرهنگ لغت تعریف شده از سوی کاربر"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"به برنامه اجازه میدهد تا کلمات جدید را در فهرست کاربر بنویسد."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"خواندن محتوای حافظه USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"خواندن محتوای کارت SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"به برنامه اجازه خواندن محتوای حافظه USB را میدهد."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"به برنامه اجازه خواندن محتوای کارت SD را میدهد."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"اصلاح/حذف محتواهای حافظه USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"اصلاح کردن/حذف محتویات کارت SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"به برنامه اجازه میدهد تا در حافظه USB بنویسد."</string>
diff --git a/core/res/res/values-fi-rFI/arrays.xml b/core/res/res/values-fi-rFI/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-fi-rFI/arrays.xml
rename to core/res/res/values-fi-rFI/donottranslate-maps.xml
diff --git a/core/res/res/values-fi/strings.xml b/core/res/res/values-fi/strings.xml
index 1b8b18a..b1009a5 100644
--- a/core/res/res/values-fi/strings.xml
+++ b/core/res/res/values-fi/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"kirjoita yhteystietoja"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Antaa sovelluksen muokata tablet-laitteen yhteystietoja (osoitetietoja). Haitalliset sovellukset voivat käyttää tätä yhteystietojen poistamiseen tai muokkaamiseen."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Antaa sovelluksen muokata puhelimen yhteystietoja (osoitetietoja). Haitalliset sovellukset voivat käyttää tätä yhteystietojen poistamiseen tai muokkaamiseen."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"lue puhelulokia"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Antaa sovelluksen lukea tablet-laitteesi puhelulokia, kuten tietoja vastatuista ja soitetuista puheluista. Haitalliset sovellukset voivat lähettää tietojasi muille henkilöille."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Antaa sovelluksen lukea puhelimesi puhelulokia, kuten tietoja vastatuista ja soitetuista puheluista. Haitalliset sovellukset voivat lähettää tietojasi muille henkilöille."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"kirjoita puhelulokiin"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Antaa sovelluksen muokata tablet-laitteesi puhelulokia, kuten tietoja vastatuista ja soitetuista puheluista. Haitalliset sovellukset voivat poistaa puhelulokisi tai muokata sitä."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Antaa sovelluksen muokata puhelimesi puhelulokia, kuten tietoja vastatuista ja soitetuista puheluista. Haitalliset sovellukset voivat poistaa puhelulokisi tai muokata sitä."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"lukea profiilisi tiedot"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Antaa sovelluksen lukea laitteelle tallennettuja henkilökohtaisia tietoja, kuten nimen ja yhteystietoja. Tämä antaa sovelluksen tunnistaa sinut ja lähettää profiilitietojasi muille."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"kirjoittaa profiilin tietoihin"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Antaa sovelluksen lukea yksityisiä sanoja, nimiä tai ilmauksia, joita käyttäjä on voinut tallentaa käyttäjän sanakirjaan."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"käyttäjän määrittelemään sanakirjaan kirjoittaminen"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Antaa sovelluksen kirjoittaa uusia sanoja käyttäjän sanakirjaan."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"lue USB-tallennustilan sisältöä"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"lue SD-kortin sisältöä"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Antaa sovelluksen lukea USB-tallennustilan sisältöä."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Antaa sovelluksen lukea SD-kortin sisältöä."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"muokkaa/poista USB-sisältöä"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"muokkaa/poista SD-kortin sisältöä"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Antaa sovelluksen kirjoittaa USB-tallennustilaan."</string>
diff --git a/core/res/res/values-fr-rBE/arrays.xml b/core/res/res/values-fr-rBE/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-fr-rBE/arrays.xml
rename to core/res/res/values-fr-rBE/donottranslate-maps.xml
diff --git a/core/res/res/values-fr-rCA/arrays.xml b/core/res/res/values-fr-rCA/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-fr-rCA/arrays.xml
rename to core/res/res/values-fr-rCA/donottranslate-maps.xml
diff --git a/core/res/res/values-fr-rCH/arrays.xml b/core/res/res/values-fr-rCH/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-fr-rCH/arrays.xml
rename to core/res/res/values-fr-rCH/donottranslate-maps.xml
diff --git a/core/res/res/values-fr-rFR/arrays.xml b/core/res/res/values-fr-rFR/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-fr-rFR/arrays.xml
rename to core/res/res/values-fr-rFR/donottranslate-maps.xml
diff --git a/core/res/res/values-fr/strings.xml b/core/res/res/values-fr/strings.xml
index b19a7de..88fe721 100644
--- a/core/res/res/values-fr/strings.xml
+++ b/core/res/res/values-fr/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"Édition des données d\'un contact"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Permet à l\'application de modifier les coordonnées (adresses) de vos contacts qui sont stockées sur votre tablette. Des applications malveillantes peuvent exploiter cette fonctionnalité pour effacer ou modifier ces coordonnées."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Permet à l\'application de modifier les coordonnées (adresses) de vos contacts qui sont stockées sur votre téléphone. Des applications malveillantes peuvent exploiter cette fonctionnalité pour effacer ou modifier ces coordonnées."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"lire le journal d\'appels"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Permet à l\'application de lire le journal d\'appels de votre tablette, y compris les données relatives aux appels entrants et sortants. Des applications malveillantes peuvent utiliser cette fonctionnalité pour envoyer vos données à des tiers."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Permet à l\'application de lire le journal d\'appels de votre téléphone, y compris les données relatives aux appels entrants et sortants. Des applications malveillantes peuvent utiliser cette fonctionnalité pour envoyer vos données à des tiers."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"modifier le journal d\'appels"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Permet à l\'application de lire le journal d\'appels de votre tablette, y compris les données relatives aux appels entrants et sortants. Des applications malveillantes peuvent utiliser cette fonctionnalité pour effacer ou modifier votre journal d\'appels."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Permet à l\'application de lire le journal d\'appels de votre téléphone, y compris les données relatives aux appels entrants et sortants. Des applications malveillantes peuvent utiliser cette fonctionnalité pour effacer ou modifier votre journal d\'appels."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"lire vos données de profil"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Permet à l\'application de lire les informations de profil stockées sur votre appareil, telles que votre nom et vos coordonnées, ou d\'en ajouter. D\'autres applications peuvent alors vous identifier et envoyer vos informations de profil à des tiers."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"modifier vos données de profil"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Permet à l\'application de lire tous les mots, noms et expressions privés que l\'utilisateur a pu enregistrer dans son dictionnaire personnel."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"enregistrer dans le dictionnaire défini par l\'utilisateur"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Permet à l\'application d\'enregistrer de nouveaux mots dans le dictionnaire personnel de l\'utilisateur."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"lire contenu de la mémoire USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"lire le contenu de la carte SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Permet à l\'appli de lire contenu mémoire USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Permet à l\'application de lire le contenu de la carte SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"Modifier/Supprimer contenu mémoire USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modifier/supprimer le contenu de la carte SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Permet à l\'application de modifier le contenu de la mémoire de stockage USB."</string>
diff --git a/core/res/res/values-hi-rIN/arrays.xml b/core/res/res/values-hi-rIN/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-hi-rIN/arrays.xml
rename to core/res/res/values-hi-rIN/donottranslate-maps.xml
diff --git a/core/res/res/values-hi/strings.xml b/core/res/res/values-hi/strings.xml
index d4b921f..bd8863f 100644
--- a/core/res/res/values-hi/strings.xml
+++ b/core/res/res/values-hi/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"संपर्क डेटा लिखें"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"एप्लिकेशन को आपके टेबलेट में संग्रहीत संपर्क (पता) डेटा संशोधित करने देता है. दुर्भावनापूर्ण एप्लिकेशन इसका उपयोग आपके संपर्क डेटा को मिटाने या संशोधित करने में कर सकते हैं."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"एप्लिकेशन को आपके फ़ोन में संग्रहीत संपर्क (पता) डेटा संशोधित करने देता है. दुर्भावनापूर्ण एप्लिकेशन इसका उपयोग आपके संपर्क डेटा को मिटाने या संशोधित करने में कर सकते हैं."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"कॉल लॉग पढ़ें"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"एप्लिकेशन को इनकमिंग और आउटगोइंग कॉल के डेटा सहित, आपके टेबलेट का कॉल लॉग पढ़ने देता है. दुर्भावनापूर्ण एप्लिकेशन अन्य लोगों को आपका डेटा भेजने के लिए इसका उपयोग कर सकते हैं."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"एप्लिकेशन को इनकमिंग और आउटगोइंग कॉल के डेटा सहित, आपके फ़ोन का कॉल लॉग पढ़ने देता है. दुर्भावनापूर्ण एप्लिकेशन अन्य लोगों को आपका डेटा भेजने के लिए इसका उपयोग कर सकते हैं."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"कॉल लॉग लिखें"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"एप्लिकेशन को इनकमिंग और आउटगोइंग कॉल के डेटा सहित, आपके टेबलेट का कॉल लॉग संशोधित करने देता है. दुर्भावनापूर्ण एप्लिकेशन आपके कॉल लॉग को मिटाने या संशोधित करने के लिए इसका उपयोग कर सकते हैं."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"एप्लिकेशन को इनकमिंग और आउटगोइंग कॉल के डेटा सहित, आपके फ़ोन का कॉल लॉग संशोधित करने देता है. दुर्भावनापूर्ण एप्लिकेशन आपके कॉल लॉग को मिटाने या संशोधित करने के लिए इसका उपयोग कर सकते हैं."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"अपना प्रोफ़ाइल डेटा पढ़ें"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"एप्लिकेशन को आपके उपकरण में संग्रहीत नाम और संपर्क जानकारी जैसी निजी प्रोफ़ाइल जानकारी पढ़ने देता है. इसका अर्थ है कि एप्लिकेशन आपको पहचान सकता है और आपकी प्रोफ़ाइल की जानकारी अन्य लोगों को भेज सकता है."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"अपने प्रोफ़ाइल डेटा में लिखें"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"एप्लिकेशन को ऐसे निजी शब्दों, नामों और वाक्यांशों को पढ़ने देता है जो संभवत: उपयोगकर्ता द्वारा उपयोगकर्ता डिक्शनरी में संग्रहीत किए गए हों."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"उपयोगकर्ता-निर्धारित डिक्शनरी में लिखें"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"एप्लिकेशन को उपयोगकर्ता डिक्शनरी में नए शब्द लिखने देता है."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"USB संग्रहण की सामग्री पढ़ें"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"SD कार्ड की सामग्री पढ़ें"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"एप्लि. को USB संग्रहण की सामग्री पढ़ने देता है."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"एप्लिकेशन को SD कार्ड की सामग्री पढ़ने देता है."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"USB संग्रहण सामग्रियों को संशोधित करें/हटाएं"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"SD कार्ड सामग्रियां संशोधित करें/हटाएं"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"एप्लि. को USB संग्रहण में लिखने देता है."</string>
diff --git a/core/res/res/values-hr/strings.xml b/core/res/res/values-hr/strings.xml
index fbd3a3d..749012b 100644
--- a/core/res/res/values-hr/strings.xml
+++ b/core/res/res/values-hr/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"pisanje kontaktnih podataka"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Omogućuje aplikaciji da promijeni kontaktne podatke (adrese) pohranjene na tabletnom računalu. Zlonamjerne aplikacije mogu na taj način izbrisati ili promijeniti vaše kontaktne podatke."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Omogućuje aplikaciji da promijeni kontaktne podatke (adrese) pohranjene na telefonu. Zlonamjerne aplikacije mogu na taj način izbrisati ili promijeniti vaše kontaktne podatke."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"čitanje dnevnika poziva"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Aplikaciji omogućuje čitanje dnevnika poziva vašeg tabletnog računala zajedno s podacima o dolaznim i odlaznim pozivima. Zlonamjerne aplikacije to mogu upotrebljavati za slanje vaših podataka drugim osobama."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Aplikaciji omogućuje čitanje dnevnika poziva vašeg telefona zajedno s podacima o dolaznim i odlaznim pozivima. Zlonamjerne aplikacije to mogu upotrebljavati za slanje vaših podataka drugim osobama."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"pisanje u dnevnik poziva"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Aplikaciji omogućuje izmjenu dnevnika poziva vašeg tabletnog računala zajedno s podacima o dolaznim i odlaznim pozivima. Zlonamjerne aplikacije to mogu upotrebljavati za brisanje ili izmjenu vašeg dnevnika poziva."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Aplikaciji omogućuje izmjenu dnevnika poziva vašeg telefona zajedno s podacima o dolaznim i odlaznim pozivima. Zlonamjerne aplikacije to mogu upotrebljavati za brisanje ili izmjenu vašeg dnevnika poziva."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"čitanje podataka vašeg profila"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Omogućuje aplikaciji čitanje osobnih podataka profila pohranjenih na uređaju, kao što su vaše ime ili kontaktni podaci. To znači da vas aplikacija može identificirati i slati informacije s vašeg profila drugima."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"pisanje u podatke profila"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Aplikaciji omogućuje čitanje svih privatnih riječi, imena i izraza koje je korisnik pohranio u korisničkom rječniku."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"pisanje u korisnički definiran rječnik"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Aplikaciji omogućuje pisanje novih riječi u korisnički rječnik."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"čitanje sadržaja USB pohrane"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"čitanje sadržaja SD kartice"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Aplikaciji omog. čitanje sadržaja USB pohrane."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Aplikaciji omogućuje čitanje sadržaja SD kartice."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"izmjeni/briši sadržaje memorije USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"izmjena/brisanje sadržaja SD kartice"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Dopušta pisanje u USB pohranu."</string>
diff --git a/core/res/res/values-hu-rHU/arrays.xml b/core/res/res/values-hu-rHU/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-hu-rHU/arrays.xml
rename to core/res/res/values-hu-rHU/donottranslate-maps.xml
diff --git a/core/res/res/values-hu/strings.xml b/core/res/res/values-hu/strings.xml
index c6190fd..24a70d7 100644
--- a/core/res/res/values-hu/strings.xml
+++ b/core/res/res/values-hu/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"névjegyadatok írása"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Lehetővé teszi az alkalmazás számára, hogy módosítsa a táblagépen tárolt névjegy- (cím-) adatokat. A rosszindulatú alkalmazások felhasználhatják ezt a névjegyadatok törlésére vagy módosítására."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Lehetővé teszi az alkalmazás számára, hogy módosítsa a telefonon tárolt névjegy- (cím-) adatokat. A rosszindulatú alkalmazások felhasználhatják ezt a névjegyadatok törlésére vagy módosítására."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"Híváslista beolvasása"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Lehetővé teszi, hogy az alkalmazás hozzáférjen a táblagép híváslistájához, beleértve a bejövő és kimenő hívások adatait. A rosszindulatú alkalmazások ezt arra használhatják, hogy az adatait elküldjék másoknak."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Lehetővé teszi, hogy az alkalmazás hozzáférjen híváslistájához, beleértve a bejövő és kimenő hívások adatait. A rosszindulatú alkalmazások ezt arra használhatják, hogy az adatait elküldjék másoknak."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"Híváslista készítése"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Lehetővé teszi, hogy az alkalmazás módosítsa a táblagép híváslistáját, beleértve a bejövő és kimenő hívások adatait is. A rosszindulatú alkalmazások ezt arra használhatják, hogy híváslistáját töröljék vagy módosítsák."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Lehetővé teszi, hogy az alkalmazás módosítsa a telefon híváslistáját, beleértve a bejövő és kimenő hívások adatait is. A rosszindulatú alkalmazások ezt arra használhatják, hogy híváslistáját töröljék vagy módosítsák."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"olvassa el profiladatait"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Lehetővé teszi az alkalmazás számára a készüléken tárolt személyes profiladatok, például a név és elérhetőség olvasását. Ez azt jelenti, hogy más alkalmazások is azonosíthatják Önt, és elküldhetik másoknak a profiladatait."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"írás a profiladatokba"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Lehetővé teszi az alkalmazás számára, hogy olvassa a felhasználói szótárban tárolt saját szavakat, neveket és kifejezéseket."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"a felhasználó által definiált szótár írása"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Lehetővé teszi az alkalmazás számára, hogy új szavakat írjon a felhasználói szótárba."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"USB-tár tartalmának beolvasása"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"SD-kártya tartalmának beolvasása"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Beolvashat USB-tartalmakat."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Lehetővé teszi az alkalmazás számára SD-kártyák tartalmának beolvasását."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"USB-tár tartalmának módosítása és törlése"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"az SD-kártya tartalmának módosítása és törlése"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Az alkalmazás USB-tárra írhat."</string>
diff --git a/core/res/res/values-in-rID/arrays.xml b/core/res/res/values-in-rID/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-in-rID/arrays.xml
rename to core/res/res/values-in-rID/donottranslate-maps.xml
diff --git a/core/res/res/values-in/strings.xml b/core/res/res/values-in/strings.xml
index d2d4ece..d2b4f04 100644
--- a/core/res/res/values-in/strings.xml
+++ b/core/res/res/values-in/strings.xml
@@ -63,10 +63,10 @@
<string name="RuacMmi" msgid="7827887459138308886">"Penolakan panggilan yang tidak diinginkan"</string>
<string name="CndMmi" msgid="3116446237081575808">"Pengiriman nomor panggilan"</string>
<string name="DndMmi" msgid="1265478932418334331">"Jangan ganggu"</string>
- <string name="CLIRDefaultOnNextCallOn" msgid="429415409145781923">"Nomor penelepon bawaan \"dibatasi\". Panggilan selanjutnya: Dibatasi"</string>
- <string name="CLIRDefaultOnNextCallOff" msgid="3092918006077864624">"Nomor pengguna bawaan \"dibatasi\". Panggilan selanjutnya: Tidak dibatasi."</string>
- <string name="CLIRDefaultOffNextCallOn" msgid="6179425182856418465">"Nomor penelepon bawaan tidak dibatasi. Panggilan selanjutnya: Dibatasi"</string>
- <string name="CLIRDefaultOffNextCallOff" msgid="2567998633124408552">"Nomor penelepon bawaan tidak dibatasi. Panggilan selanjutnya: Tidak dibatasi"</string>
+ <string name="CLIRDefaultOnNextCallOn" msgid="429415409145781923">"Nomor penelepon default \"dibatasi\". Panggilan selanjutnya: Dibatasi"</string>
+ <string name="CLIRDefaultOnNextCallOff" msgid="3092918006077864624">"Nomor pengguna default \"dibatasi\". Panggilan selanjutnya: Tidak dibatasi."</string>
+ <string name="CLIRDefaultOffNextCallOn" msgid="6179425182856418465">"Nomor penelepon default tidak dibatasi. Panggilan selanjutnya: Dibatasi"</string>
+ <string name="CLIRDefaultOffNextCallOff" msgid="2567998633124408552">"Nomor penelepon default tidak dibatasi. Panggilan selanjutnya: Tidak dibatasi"</string>
<string name="serviceNotProvisioned" msgid="8614830180508686666">"Layanan tidak diperlengkapi."</string>
<string name="CLIRPermanent" msgid="3377371145926835671">"Anda tidak dapat mengubah setelan nomor penelepon."</string>
<string name="RestrictedChangedTitle" msgid="5592189398956187498">"Akses terbatas berubah"</string>
@@ -220,7 +220,7 @@
<string name="permlab_setDebugApp" msgid="3022107198686584052">"mengaktifkan debugging apl"</string>
<string name="permdesc_setDebugApp" msgid="4474512416299013256">"Mengizinkan apl mengaktifkan debugging untuk apl lain. Apl berbahaya dapat menggunakan cara ini untuk menutup apl lain."</string>
<string name="permlab_changeConfiguration" msgid="8214475779521218295">"ubah setelan UI Anda"</string>
- <string name="permdesc_changeConfiguration" msgid="4372223873154296076">"Mengizinkan apl mengubah konfigurasi saat ini, misalnya lokal atau ukuran fon keseluruhan."</string>
+ <string name="permdesc_changeConfiguration" msgid="4372223873154296076">"Mengizinkan apl mengubah konfigurasi saat ini, misalnya lokal atau ukuran font keseluruhan."</string>
<string name="permlab_enableCarMode" msgid="5684504058192921098">"aktifkan mode mobil"</string>
<string name="permdesc_enableCarMode" msgid="4853187425751419467">"Mengizinkan apl mengaktifkan mode mobil."</string>
<string name="permlab_killBackgroundProcesses" msgid="8373714752793061963">"hentikan proses latar belakang"</string>
@@ -277,7 +277,7 @@
<string name="permlab_bindWallpaper" msgid="8716400279937856462">"mengikat ke wallpaper"</string>
<string name="permdesc_bindWallpaper" msgid="7108428692595491668">"Mengizinkan pemegang mengikat antarmuka tingkat tinggi dari suatu wallpaper. Tidak pernah diperlukan oleh apl normal."</string>
<string name="permlab_bindRemoteViews" msgid="5697987759897367099">"mengikat ke layanan widget"</string>
- <string name="permdesc_bindRemoteViews" msgid="4717987810137692572">"Mengizinkan pemegang mengikat antarmuka tingkat tinggi dari suatu layanan gawit. Tidak pernah diperlukan oleh apl normal."</string>
+ <string name="permdesc_bindRemoteViews" msgid="4717987810137692572">"Mengizinkan pemegang mengikat antarmuka tingkat tinggi dari suatu layanan widget. Tidak pernah diperlukan oleh apl normal."</string>
<string name="permlab_bindDeviceAdmin" msgid="8704986163711455010">"berinteraksi dengan admin perangkat"</string>
<string name="permdesc_bindDeviceAdmin" msgid="569715419543907930">"Mengizinkan pemegang mengirimkan tujuan kepada administrator perangkat. Tidak pernah diperlukan oleh apl normal."</string>
<string name="permlab_setOrientation" msgid="3365947717163866844">"ubah orientasi layar"</string>
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"tuliskan data kenalan"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Mengizinkan apl mengubah data (alamat) kenalan yang tersimpan di tablet. Apl berbahaya dapat menggunakan ini untuk menghapus atau mengubah data kenalan Anda."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Mengizinkan apl memodifikasi data (alamat) kenalan yang tersimpan di ponsel Anda. Apl berbahaya dapat menggunakan ini untuk menghapus atau memodifikasi data kenalan Anda."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"membaca log panggilan"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Memungkinkan apl membaca log panggilan tablet Anda, termasuk data tentang panggilan masuk dan keluar. Apl berbahaya dapat menggunakan ini untuk mengirim data ke orang lain."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Memungkinkan apl membaca log panggilan ponsel Anda, termasuk data tentang panggilan masuk dan keluar. Apl berbahaya dapat menggunakan ini untuk mengirim data ke orang lain."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"menulis log panggilan"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Memungkinkan apl memodifikasi log panggilan tablet Anda, termasuk data tentang panggilan masuk dan keluar. Apl berbahaya dapat menggunakan ini untuk menghapus atau memodifikasi log panggilan Anda."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Memungkinkan apl memodifikasi log panggilan ponsel Anda, termasuk data tentang panggilan masuk dan keluar. Apl berbahaya dapat menggunakan ini untuk menghapus atau memodifikasi log panggilan Anda."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"membaca data profil Anda"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Mengizinkan apl membaca informasi profil pribadi yang tersimpan di perangkat Anda, misalnya nama dan informasi kenalan Anda. Ini artinya apl dapat mengenali dan mengirim informasi profil Anda ke orang lain."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"menulis ke data profil Anda"</string>
@@ -414,7 +420,7 @@
<string name="permlab_checkinProperties" msgid="7855259461268734914">"akses properti lapor masuk"</string>
<string name="permdesc_checkinProperties" msgid="4024526968630194128">"Mengizinkan apl membaca/menulis akses ke properti yang diunggah oleh layanan lapor masuk. Tidak untuk digunakan oleh apl normal."</string>
<string name="permlab_bindGadget" msgid="776905339015863471">"pilih widget"</string>
- <string name="permdesc_bindGadget" msgid="8261326938599049290">"Mengizinkan apl memberi tahu sistem tentang gawit mana yang dapat digunakan oleh suatu apl. Apl dengan izin ini dapat memberikan akses ke data pribadi untuk apl lain. Tidak untuk digunakan oleh apl normal."</string>
+ <string name="permdesc_bindGadget" msgid="8261326938599049290">"Mengizinkan apl memberi tahu sistem tentang widget mana yang dapat digunakan oleh suatu apl. Apl dengan izin ini dapat memberikan akses ke data pribadi untuk apl lain. Tidak untuk digunakan oleh apl normal."</string>
<string name="permlab_modifyPhoneState" msgid="8423923777659292228">"ubah kondisi ponsel"</string>
<string name="permdesc_modifyPhoneState" msgid="1029877529007686732">"Mengizinkan apl mengontrol fitur telepon perangkat. Apl dengan izin ini dapat mengalihkan jaringan, menyalakan dan mematikan radio ponsel, dan melakukan hal serupa lainnya tanpa pernah memberi tahu Anda."</string>
<string name="permlab_readPhoneState" msgid="2326172951448691631">"baca kondisi dan identitas ponsel"</string>
@@ -434,7 +440,7 @@
<string name="permdesc_setWallpaper" msgid="7373447920977624745">"Mengizinkan apl menyetel wallpaper sistem."</string>
<string name="permlab_setWallpaperHints" msgid="3600721069353106851">"atur petunjuk ukuran wallpaper"</string>
<string name="permdesc_setWallpaperHints" msgid="8235784384223730091">"Mengizinkan apl menyetel petunjuk ukuran wallpaper sistem."</string>
- <string name="permlab_masterClear" msgid="2315750423139697397">"setel ulang sistem ke setelan bawaan pabrik"</string>
+ <string name="permlab_masterClear" msgid="2315750423139697397">"setel ulang sistem ke setelan default pabrik"</string>
<string name="permdesc_masterClear" msgid="3665380492633910226">"Mengizinkan apl menyetel ulang sistem ke setelan pabrik sepenuhnya, menghapus semua data, konfigurasi, dan apl yang terpasang."</string>
<string name="permlab_setTime" msgid="2021614829591775646">"atur waktu"</string>
<string name="permdesc_setTime" product="tablet" msgid="1896341438151152881">"Mengizinkan apl mengubah waktu pada jam tablet."</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Mengizinkan apl membaca kata, nama, dan frasa pribadi apa pun yang mungkin disimpan oleh pengguna di kamus pengguna."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"menulis ke kamus yang dibuat pengguna"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Mengizinkan apl menulis kata-kata baru ke dalam kamus pengguna."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"membaca konten penyimpanan USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"membaca konten kartu SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Mengizinkan apl membaca konten penyimpanan USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Mengizinkan apl membaca konten kartu SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"ubah/hapus konten penyimpanan USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"ubah/hapus isi kartu SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Mengizinkan apl menulis ke penyimpanan USB."</string>
@@ -695,10 +705,10 @@
<string name="lockscreen_too_many_failed_pin_attempts_dialog_message" msgid="6216672706545696955">"Anda telah <xliff:g id="NUMBER_0">%d</xliff:g> kali salah mengetik PIN. "\n\n"Coba lagi dalam <xliff:g id="NUMBER_1">%d</xliff:g> detik."</string>
<string name="lockscreen_failed_attempts_almost_glogin" product="tablet" msgid="9191611984625460820">"Anda telah <xliff:g id="NUMBER_0">%d</xliff:g> kali salah menggambar pola pembuka kunci. Setelah <xliff:g id="NUMBER_1">%d</xliff:g> lagi upaya gagal, Anda akan diminta membuka kunci tablet menggunakan info masuk Google."\n\n"Coba lagi dalam <xliff:g id="NUMBER_2">%d</xliff:g> detik."</string>
<string name="lockscreen_failed_attempts_almost_glogin" product="default" msgid="2590227559763762751">"Anda telah <xliff:g id="NUMBER_0">%d</xliff:g> kali salah menggambar pola pembuka kunci. Setelah <xliff:g id="NUMBER_1">%d</xliff:g> lagi upaya gagal, Anda akan diminta membuka kunci ponsel menggunakan info masuk Google."\n\n"Coba lagi dalam <xliff:g id="NUMBER_2">%d</xliff:g> detik."</string>
- <string name="lockscreen_failed_attempts_almost_at_wipe" product="tablet" msgid="6128106399745755604">"Anda telah gagal mencoba membuka gembok tablet sebanyak <xliff:g id="NUMBER_0">%d</xliff:g> kali. Setelah <xliff:g id="NUMBER_1">%d</xliff:g> upaya gagal lagi, tablet akan disetel ulang ke setelan bawaan pabrik dan semua data pengguna hilang."</string>
- <string name="lockscreen_failed_attempts_almost_at_wipe" product="default" msgid="8603565142156826565">"Anda telah gagal mencoba membuka gembok ponsel sebanyak <xliff:g id="NUMBER_0">%d</xliff:g> kali. Setelah <xliff:g id="NUMBER_1">%d</xliff:g> upaya gagal lagi, ponsel akan disetel ulang ke setelan bawaan pabrik dan semua data pengguna hilang."</string>
- <string name="lockscreen_failed_attempts_now_wiping" product="tablet" msgid="280873516493934365">"Anda telah gagal mencoba membuka gembok tablet sebanyak <xliff:g id="NUMBER">%d</xliff:g> kali. Kini tablet akan disetel ulang ke setelan bawaan pabrik."</string>
- <string name="lockscreen_failed_attempts_now_wiping" product="default" msgid="3025504721764922246">"Anda telah gagal mencoba membuka gembok ponsel sebanyak <xliff:g id="NUMBER">%d</xliff:g> kali. Kini ponsel akan disetel ulang ke setelan bawaan pabrik."</string>
+ <string name="lockscreen_failed_attempts_almost_at_wipe" product="tablet" msgid="6128106399745755604">"Anda telah gagal mencoba membuka gembok tablet sebanyak <xliff:g id="NUMBER_0">%d</xliff:g> kali. Setelah <xliff:g id="NUMBER_1">%d</xliff:g> upaya gagal lagi, tablet akan disetel ulang ke setelan default pabrik dan semua data pengguna hilang."</string>
+ <string name="lockscreen_failed_attempts_almost_at_wipe" product="default" msgid="8603565142156826565">"Anda telah gagal mencoba membuka gembok ponsel sebanyak <xliff:g id="NUMBER_0">%d</xliff:g> kali. Setelah <xliff:g id="NUMBER_1">%d</xliff:g> upaya gagal lagi, ponsel akan disetel ulang ke setelan default pabrik dan semua data pengguna hilang."</string>
+ <string name="lockscreen_failed_attempts_now_wiping" product="tablet" msgid="280873516493934365">"Anda telah gagal mencoba membuka gembok tablet sebanyak <xliff:g id="NUMBER">%d</xliff:g> kali. Kini tablet akan disetel ulang ke setelan default pabrik."</string>
+ <string name="lockscreen_failed_attempts_now_wiping" product="default" msgid="3025504721764922246">"Anda telah gagal mencoba membuka gembok ponsel sebanyak <xliff:g id="NUMBER">%d</xliff:g> kali. Kini ponsel akan disetel ulang ke setelan default pabrik."</string>
<string name="lockscreen_too_many_failed_attempts_countdown" msgid="6251480343394389665">"Coba lagi dalam <xliff:g id="NUMBER">%d</xliff:g> detik."</string>
<string name="lockscreen_forgot_pattern_button_text" msgid="2626999449610695930">"Lupa pola?"</string>
<string name="lockscreen_glogin_forgot_pattern" msgid="2588521501166032747">"Pembuka kunci akun"</string>
@@ -909,8 +919,8 @@
<string name="capital_on" msgid="1544682755514494298">"HIDUP"</string>
<string name="capital_off" msgid="6815870386972805832">"MATI"</string>
<string name="whichApplication" msgid="4533185947064773386">"Tindakan lengkap menggunakan"</string>
- <string name="alwaysUse" msgid="4583018368000610438">"Gunakan secara bawaan untuk tindakan ini."</string>
- <string name="clearDefaultHintMsg" msgid="3252584689512077257">"Menghapus bawaan di Setelan sistem > Apl > Terunduh."</string>
+ <string name="alwaysUse" msgid="4583018368000610438">"Gunakan secara default untuk tindakan ini."</string>
+ <string name="clearDefaultHintMsg" msgid="3252584689512077257">"Menghapus default di Setelan sistem > Apl > Terunduh."</string>
<string name="chooseActivity" msgid="7486876147751803333">"Pilih tindakan"</string>
<string name="chooseUsbActivity" msgid="6894748416073583509">"Pilih apl untuk perangkat USB"</string>
<string name="noApplications" msgid="2991814273936504689">"Tidak ada apl yang dapat melakukan tindakan ini."</string>
@@ -961,8 +971,8 @@
<string name="volume_icon_description_incall" msgid="8890073218154543397">"Volume panggilan"</string>
<string name="volume_icon_description_media" msgid="4217311719665194215">"Volume media"</string>
<string name="volume_icon_description_notification" msgid="7044986546477282274">"Volume pemberitahuan"</string>
- <string name="ringtone_default" msgid="3789758980357696936">"Nada dering bawaan"</string>
- <string name="ringtone_default_with_actual" msgid="8129563480895990372">"Nada dering bawaan (<xliff:g id="ACTUAL_RINGTONE">%1$s</xliff:g>)"</string>
+ <string name="ringtone_default" msgid="3789758980357696936">"Nada dering default"</string>
+ <string name="ringtone_default_with_actual" msgid="8129563480895990372">"Nada dering default (<xliff:g id="ACTUAL_RINGTONE">%1$s</xliff:g>)"</string>
<string name="ringtone_silent" msgid="4440324407807468713">"Senyap"</string>
<string name="ringtone_picker_title" msgid="3515143939175119094">"Nada dering"</string>
<string name="ringtone_unknown" msgid="5477919988701784788">"Nada dering tidak dikenal"</string>
@@ -1007,7 +1017,7 @@
<string name="time_picker_dialog_title" msgid="8349362623068819295">"Setel waktu"</string>
<string name="date_picker_dialog_title" msgid="5879450659453782278">"Setel tanggal"</string>
<string name="date_time_set" msgid="5777075614321087758">"Setel"</string>
- <string name="default_permission_group" msgid="2690160991405646128">"Bawaan"</string>
+ <string name="default_permission_group" msgid="2690160991405646128">"Default"</string>
<string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"BARU: "</font></string>
<string name="no_permissions" msgid="7283357728219338112">"Tidak perlu izin"</string>
<string name="perms_hide" msgid="7283915391320676226"><b>"Sembunyikan"</b></string>
@@ -1076,9 +1086,9 @@
<string name="permlab_pkgUsageStats" msgid="8787352074326748892">"perbarui statistik penggunaan komponen"</string>
<string name="permdesc_pkgUsageStats" msgid="1106612424254277630">"Mengizinkan apl memodifikasi statistik penggunaan komponen yang dikumpulkan. Tidak untuk digunakan oleh apl normal."</string>
<string name="permlab_copyProtectedData" msgid="4341036311211406692">"menyalin konten"</string>
- <string name="permdesc_copyProtectedData" msgid="4390697124288317831">"Mengizinkan apl menjalankan layanan kontainer bawaan untuk menyalin konten. Tidak untuk digunakan oleh apl normal."</string>
+ <string name="permdesc_copyProtectedData" msgid="4390697124288317831">"Mengizinkan apl menjalankan layanan kontainer default untuk menyalin konten. Tidak untuk digunakan oleh apl normal."</string>
<string name="tutorial_double_tap_to_zoom_message_short" msgid="4070433208160063538">"Sentuh dua kali untuk mengontrol perbesar/perkecil"</string>
- <string name="gadget_host_error_inflating" msgid="4882004314906466162">"Tidak dapat menambahkan gawit."</string>
+ <string name="gadget_host_error_inflating" msgid="4882004314906466162">"Tidak dapat menambahkan widget."</string>
<string name="ime_action_go" msgid="8320845651737369027">"Buka"</string>
<string name="ime_action_search" msgid="658110271822807811">"Telusuri"</string>
<string name="ime_action_send" msgid="2316166556349314424">"Kirimkan"</string>
diff --git a/core/res/res/values-it-rCH/arrays.xml b/core/res/res/values-it-rCH/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-it-rCH/arrays.xml
rename to core/res/res/values-it-rCH/donottranslate-maps.xml
diff --git a/core/res/res/values-it-rIT/arrays.xml b/core/res/res/values-it-rIT/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-it-rIT/arrays.xml
rename to core/res/res/values-it-rIT/donottranslate-maps.xml
diff --git a/core/res/res/values-it/strings.xml b/core/res/res/values-it/strings.xml
index 96c6709..75ed4e8 100644
--- a/core/res/res/values-it/strings.xml
+++ b/core/res/res/values-it/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"scrittura dati di contatto"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Consente all\'applicazione di modificare i dati di contatto (indirizzi) memorizzati sul tablet. Le applicazioni dannose potrebbero farne uso per cancellare o modificare i tuoi dati di contatto."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Consente all\'applicazione di modificare i dati di contatto (indirizzi) memorizzati sul telefono. Le applicazioni dannose potrebbero farne uso per cancellare o modificare i tuoi dati di contatto."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"lettura del registro chiamate"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Consente all\'applicazione di leggere il registro chiamate del tablet, inclusi i dati sulle chiamate in arrivo e in uscita. Le applicazioni dannose potrebbero fare uso di questa funzione per inviare dati ad altre persone."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Consente all\'applicazione di leggere il registro chiamate del telefono, inclusi i dati sulle chiamate in arrivo e in uscita. Le applicazioni dannose potrebbero fare uso di questa funzione per inviare dati ad altre persone."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"scrittura del registro chiamate"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Consente all\'applicazione di modificare il registro chiamate del tablet, inclusi i dati sulle chiamate in arrivo e in uscita. Le applicazioni dannose potrebbero farne uso per cancellare o modificare il registro chiamate."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Consente all\'applicazione di modificare il registro chiamate del telefono, inclusi i dati sulle chiamate in arrivo e in uscita. Le applicazioni dannose potrebbero farne uso per cancellare o modificare il registro chiamate."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"lettura dei tuoi dati profilo"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Consente all\'applicazione di leggere informazioni del profilo personale memorizzate sul dispositivo, come il tuo nome e le tue informazioni di contatto. Ciò significa che l\'applicazione può identificarti e inviare le tue informazioni di profilo ad altri."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"scrittura dati del profilo"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Consente all\'applicazione di leggere parole, frasi e nomi privati che l\'utente potrebbe aver memorizzato nel dizionario utente."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"scrittura nel dizionario definito dall\'utente"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Consente all\'applicazione di scrivere nuove parole nel dizionario utente."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"lettura contenuti archivio USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"lettura dei contenuti della scheda SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Consente di leggere l\'archivio USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Consente all\'applicazione di leggere contenuti della scheda SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"modifica/eliminaz. contenuti archivio USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modificare/eliminare i contenuti della scheda SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Consente all\'applicazione di scrivere nell\'archivio USB."</string>
diff --git a/core/res/res/values-iw-rIL/arrays.xml b/core/res/res/values-iw-rIL/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-iw-rIL/arrays.xml
rename to core/res/res/values-iw-rIL/donottranslate-maps.xml
diff --git a/core/res/res/values-iw/strings.xml b/core/res/res/values-iw/strings.xml
index 485e0b0..40a4d01 100644
--- a/core/res/res/values-iw/strings.xml
+++ b/core/res/res/values-iw/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"כתוב נתונים של אנשי קשר"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"מאפשר ליישום לשנות את פרטי הקשר (כתובת) המאוחסנים בטבלט. יישומים זדוניים עלולים להשתמש בכך כדי למחוק או לשנות את פרטי הקשר שלך."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"מאפשר ליישום לשנות את פרטי הקשר (כתובת) המאוחסנים בטלפון. יישומים זדוניים עלולים להשתמש בכך כדי למחוק או לשנות את פרטי הקשר שלך."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"קריאת יומן שיחות"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"מאפשר ליישום לקרוא את יומן השיחות של הטבלט, כולל נתונים על שיחות נכנסות ויוצאות. יישומים זדוניים עלולים לעשות בכך שימוש כדי לשלוח את הנתונים שלך לאנשים אחרים."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"מאפשר ליישום לקרוא את יומן השיחות של הטלפון, כולל נתונים על שיחות נכנסות ויוצאות. יישומים זדוניים עלולים לעשות בכך שימוש כדי לשלוח את הנתונים שלך לאנשים אחרים."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"כתיבת יומן שיחות"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"מאפשר ליישום לשנות את יומן השיחות של הטבלט, כולל נתונים על שיחות נכנסות ויוצאות. יישומים זדוניים עלולים לעשות בכך שימוש כדי למחוק או לשנות את יומן השיחות שלך."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"מאפשר ליישום לשנות את יומן השיחות של הטלפון, כולל נתונים על שיחות נכנסות ויוצאות. יישומים זדוניים עלולים לעשות בכך שימוש כדי למחוק או לשנות את יומן השיחות שלך."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"קרא את נתוני הפרופיל שלך"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"מאפשר ליישום לקרוא נתונים בפרטי הפרופיל האישי המאוחסנים במכשיר, כגון שמך ופרטי הקשר שלך. משמעות הדבר שהיישום יוכל לזהות אותך ולשלוח את מידע הפרופיל שלך לאנשים אחרים."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"כתוב בנתוני הפרופיל שלך"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"מאפשר ליישום לקרוא מילים, שמות וביטויים פרטיים שהמשתמש אחסן במילון המשתמש."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"כתיבה למילון בהגדרת המשתמש"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"מאפשר ליישום לכתוב מילים חדשות במילון המשתמש."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"קריאת תוכן אחסון USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"קריאת תוכן כרטיס SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"מאפשר ליישום לקרוא את התוכן של אחסון USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"מאפשר ליישום לקרוא את התוכן של כרטיס SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"שנה/מחק תוכן באמצעי אחסון מסוג USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"שנה/מחק תוכן של כרטיס SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"מאפשר ליישום לכתוב להתקן האחסון מסוג USB."</string>
diff --git a/core/res/res/values-ja-rJP/arrays.xml b/core/res/res/values-ja-rJP/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-ja-rJP/arrays.xml
rename to core/res/res/values-ja-rJP/donottranslate-maps.xml
diff --git a/core/res/res/values-ja/strings.xml b/core/res/res/values-ja/strings.xml
index bc9840d..549c1e2 100644
--- a/core/res/res/values-ja/strings.xml
+++ b/core/res/res/values-ja/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"連絡先データの書き込み"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"タブレットに保存されている連絡先(アドレス)データの変更をアプリに許可します。この許可を悪意のあるアプリに利用されると、連絡先データが消去または変更される恐れがあります。"</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"携帯端末に保存されている連絡先(アドレス)データの変更をアプリに許可します。この許可を悪意のあるアプリに利用されると、連絡先データが消去または変更される恐れがあります。"</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"通話履歴の読み取り"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"タブレットの通話履歴(着信や発信のデータなど)の読み取りをアプリに許可します。この許可を悪意のあるアプリに利用されると、データが他のユーザーに送信される恐れがあります。"</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"携帯端末の通話履歴(着信や発信のデータなど)の読み取りをアプリに許可します。この許可を悪意のあるアプリに利用されると、データが他のユーザーに送信される恐れがあります。"</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"通話履歴の書き込み"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"タブレットの通話履歴(着信や発信のデータなど)の変更をアプリに許可します。この許可を悪意のあるアプリに利用されると、通話履歴が消去または変更される恐れがあります。"</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"携帯端末の通話履歴(着信や発信のデータなど)の変更をアプリに許可します。この許可を悪意のあるアプリに利用されると、通話履歴が消去または変更される恐れがあります。"</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"プロフィールデータの読み取り"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"端末に保存されている個人のプロフィール情報(名前、連絡先情報など)を読み取ることをアプリに許可します。許可すると、アプリではユーザーの身元を特定したりプロフィール情報を第三者に転送したりできるようになります。"</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"プロフィールデータに書き込む"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"ユーザーが単語リストに個人情報として登録した可能性のある語句や名前を読み込むことをアプリに許可します。"</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"単語リストへの書き込み"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"単語リストに新しい語句を書き込むことをアプリに許可します。"</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"USBストレージの読み取り"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"SDカードのコンテンツの読み取り"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"USBストレージの読み取りをアプリに許可します。"</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"SDカードのコンテンツの読み取りをアプリに許可します。"</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"USBストレージのコンテンツの変更/削除"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"SDカードのコンテンツを修正/削除する"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"USBストレージへの書き込みをアプリに許可します。"</string>
diff --git a/core/res/res/values-ko-rKR/arrays.xml b/core/res/res/values-ko-rKR/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-ko-rKR/arrays.xml
rename to core/res/res/values-ko-rKR/donottranslate-maps.xml
diff --git a/core/res/res/values-ko/strings.xml b/core/res/res/values-ko/strings.xml
index c9801a3..fc8e7b1 100644
--- a/core/res/res/values-ko/strings.xml
+++ b/core/res/res/values-ko/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"연락처 데이터 작성"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"앱이 태블릿에 저장된 모든 연락처(주소) 데이터를 읽을 수 있도록 허용합니다. 이 경우 악성 앱이 연락처 데이터를 지우거나 수정할 수 있습니다."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"앱이 휴대전화에 저장된 모든 연락처(주소) 데이터를 읽을 수 있도록 허용합니다. 이 경우 악성 앱이 연락처 데이터를 지우거나 수정할 수 있습니다."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"통화 기록 읽기"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"앱에서 수신 및 발신 통화 데이터를 포함하여 태블릿의 통화 기록을 읽을 수 있도록 허용합니다. 이 경우 악성 앱이 데이터를 다른 사용자에게 보낼 수 있습니다."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"앱에서 수신 및 발신 통화 데이터를 포함하여 휴대전화의 통화 기록을 읽을 수 있도록 허용합니다. 이 경우 악성 앱이 데이터를 다른 사용자에게 보낼 수 있습니다."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"통화 기록 쓰기"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"앱에서 수신 및 발신 통화 데이터를 포함하여 태블릿의 통화 기록을 수정할 수 있도록 허용합니다. 이 경우 악성 앱이 통화 기록을 지우거나 수정할 수 있습니다."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"앱에서 수신 및 발신 통화 데이터를 포함하여 휴대전화의 통화 기록을 수정할 수 있도록 허용합니다. 이 경우 악성 앱이 통화 기록을 지우거나 수정할 수 있습니다."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"프로필 데이터 읽기"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"앱이 기기에 저장된 개인 프로필 정보(예: 사용자 이름, 연락처 정보 등)를 읽을 수 있도록 허용합니다. 이는 앱이 사용자를 확인하고 다른 사용자들에게 해당 프로필 정보를 전송할 수 있다는 것을 의미합니다."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"프로필 데이터에 쓰기"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"앱이 사용자 사전에 보관되어 있는 비공개 단어, 이름 및 구문을 읽도록 허용합니다."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"사용자 정의 사전에 작성"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"앱이 사용자 사전에 새 단어를 입력할 수 있도록 허용합니다."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"USB 저장소 콘텐츠 읽기"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"SD 카드 콘텐츠 읽기"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"앱이 USB 콘텐츠를 읽도록 허용"</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"앱이 SD 카드의 콘텐츠를 읽을 수 있도록 허용합니다."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"USB 저장소 콘텐츠 수정/삭제"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"SD 카드 콘텐츠 수정/삭제"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"앱이 USB 저장소에 쓸 수 있도록 허용합니다."</string>
diff --git a/core/res/res/values-lt-rLT/arrays.xml b/core/res/res/values-lt-rLT/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-lt-rLT/arrays.xml
rename to core/res/res/values-lt-rLT/donottranslate-maps.xml
diff --git a/core/res/res/values-lt/strings.xml b/core/res/res/values-lt/strings.xml
index 4424ad5..5e9d3f4 100644
--- a/core/res/res/values-lt/strings.xml
+++ b/core/res/res/values-lt/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"rašyti adresatų duomenis"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Leidžiama programai keisti planšetiniame kompiuteryje saugomus kontaktinius (adreso) duomenis. Kenkėjiškos programos gali tai naudoti, kad ištrintų ar pakeistų jūsų kontaktinius duomenis."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Leidžiama programai keisti telefone saugomus kontaktinius (adreso) duomenis. Kenkėjiškos programos gali tai naudoti, kad ištrintų ar pakeistų jūsų kontaktinius duomenis."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"skaityti skambučių žurnalą"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Programai leidžiama skaityti planšetinio kompiuterio skambučių žurnalą, įskaitant duomenis apie gaunamus ir siunčiamus skambučius. Kenkėjiškos programos tai gali naudoti, kad išsiųstų jūsų duomenis kitiems žmonėms."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Programai leidžiama skaityti telefono skambučių žurnalą, įskaitant duomenis apie gaunamus ir siunčiamus skambučius. Kenkėjiškos programos tai gali naudoti, kad išsiųstų jūsų duomenis kitiems žmonėms."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"rašyti skambučių žurnalą"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Programai leidžiama skaityti planšetinio kompiuterio skambučių žurnalą, įskaitant duomenis apie gaunamus ir siunčiamus skambučius. Kenkėjiškos programos tai gali naudoti, kad ištrintų ar keistų jūsų skambučių žurnalą."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Programai leidžiama skaityti telefono skambučių žurnalą, įskaitant duomenis apie gaunamus ir siunčiamus skambučius. Kenkėjiškos programos tai gali naudoti, kad ištrintų ar keistų jūsų skambučių žurnalą."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"skaityti profilio duomenis"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Leidžiama programai skaityti asmeninę profilio informaciją, saugomą jūsų įrenginyje, pvz., jūsų vardą, pavardę ir kontaktinę informaciją. Tai reiškia, kad programa gali nustatyti jūsų tapatybę ir siųsti profilio informaciją kitiems."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"rašyti kaip profilio duomenis"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Leidžiama programai skaityti privačius žodžius, vardus ir frazes, kuriuos naudotojas išsaugojo naudotojo žodyne."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"rašyti naudotojo nustatytame žodyne"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Leidžiama programai rašyti naujus žodžius į naudotojo žodyną."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"skaityti USB atmint. turinį"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"skaityti SD kortelės turinį"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Leid. progr. skait. USB turin."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Leidžiama programai skaityti SD kortelės turinį."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"keisti / ištrinti USB atmintinės turinį"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"keisti / ištrinti SD kortelės turinį"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Leidž. progr. raš. į USB atm."</string>
diff --git a/core/res/res/values-lv-rLV/arrays.xml b/core/res/res/values-lv-rLV/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-lv-rLV/arrays.xml
rename to core/res/res/values-lv-rLV/donottranslate-maps.xml
diff --git a/core/res/res/values-lv/strings.xml b/core/res/res/values-lv/strings.xml
index 89baaaa..a568c3b 100644
--- a/core/res/res/values-lv/strings.xml
+++ b/core/res/res/values-lv/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"rakstīt kontaktpersonu datus"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Ļauj lietotnei modificēt planšetdatorā saglabātos kontaktpersonu (adrešu) datus. Ļaunprātīgas lietotnes to var izmantot, lai dzēstu vai modificētu kontaktpersonu datus."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Ļauj lietotnei modificēt tālrunī saglabātos kontaktpersonu (adrešu) datus. Ļaunprātīgas lietotnes to var izmantot, lai dzēstu vai modificētu kontaktpersonu datus."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"nolasīt zvanu žurnālu"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Ļauj lietotnei nolasīt planšetdatora zvanu žurnālu, tostarp ienākošo un izejošo zvanu datus. Ļaunprātīgas lietotnes var to izmantot, lai sūtītu jūsu datus citām personām."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Ļauj lietotnei nolasīt tālruņa zvanu žurnālu, tostarp ienākošo un izejošo zvanu datus. Ļaunprātīgas lietotnes var to izmantot, lai sūtītu jūsu datus citām personām."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"rakstīt zvanu žurnālā"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Ļauj lietotnei pārveidot planšetdatora zvanu žurnālu, tostarp ienākošo un izejošo zvanu datus. Ļaunprātīgas lietotnes var to izmantot, lai dzēstu vai pārveidotu savu zvanu žurnālu."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Ļauj lietotnei pārveidot tālruņa zvanu žurnālu, tostarp ienākošo un izejošo zvanu datus. Ļaunprātīgas lietotnes var to izmantot, lai dzēstu vai pārveidotu savu zvanu žurnālu."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"jūsu profila datu lasīšana"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Ļauj lietotnei lasīt ierīcē saglabāto personīgā profila informāciju, piemēram, jūsu vārdu un kontaktinformāciju. Tas nozīmē, ka lietotne var jūs identificēt un sūtīt jūsu profila informāciju citām personām."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"rakstīšana jūsu profila datos"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Ļauj lietotnei lasīt jebkurus privātu vārdus, nosaukumus un frāzes, ko lietotājs saglabājis savā lietotāja vārdnīcā."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"rakstīt lietotāja noteiktā vārdnīcā"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Ļauj lietotnei rakstīt jaunus vārdus lietotāja vārdnīcā."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"lasīt USB atmiņas saturu"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"lasīt SD kartes saturu"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Ļauj liet. lasīt USB atm. sat."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Ļauj lietotnei lasīt SD kartes saturu."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"pārveidot/dzēst USB kr. sat."</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"pārveidot/dzēst SD kartes saturu"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Ļauj lietotnei rakstīt USB atmiņā."</string>
diff --git a/core/res/res/values-mcc204/arrays.xml b/core/res/res/values-mcc204/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-mcc204/arrays.xml
rename to core/res/res/values-mcc204/donottranslate-maps.xml
diff --git a/core/res/res/values-mcc230/arrays.xml b/core/res/res/values-mcc230/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-mcc230/arrays.xml
rename to core/res/res/values-mcc230/donottranslate-maps.xml
diff --git a/core/res/res/values-mcc232/arrays.xml b/core/res/res/values-mcc232/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-mcc232/arrays.xml
rename to core/res/res/values-mcc232/donottranslate-maps.xml
diff --git a/core/res/res/values-mcc260/arrays.xml b/core/res/res/values-mcc260/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-mcc260/arrays.xml
rename to core/res/res/values-mcc260/donottranslate-maps.xml
diff --git a/core/res/res/values-mcc262/arrays.xml b/core/res/res/values-mcc262/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-mcc262/arrays.xml
rename to core/res/res/values-mcc262/donottranslate-maps.xml
diff --git a/core/res/res/values-ms-rMY/arrays.xml b/core/res/res/values-ms-rMY/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-ms-rMY/arrays.xml
rename to core/res/res/values-ms-rMY/donottranslate-maps.xml
diff --git a/core/res/res/values-ms/strings.xml b/core/res/res/values-ms/strings.xml
index 385bebb..87f8f8d 100644
--- a/core/res/res/values-ms/strings.xml
+++ b/core/res/res/values-ms/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"tulis data kenalan"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Membenarkan apl untuk mengubah suai data kenalan (alamat) yang disimpan pada tablet anda. Apl hasad boleh menggunakannya untuk memadam atau mengubah suai data kenalan anda."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Membenarkan apl untuk mengubah suai data kenalan (alamat) yang disimpan pada telefon anda. Apl hasad boleh menggunakannya untuk memadam atau mengubah suai data kenalan anda."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"baca log panggilan"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Membenarkan apl membaca log panggilan tablet anda, termasuk data tentang panggilan masuk dan keluar. Apl hasad boleh menggunakan ini untuk menghantar data anda kepada orang lain."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Membenarkan apl membaca log panggilan telefon anda, termasuk data tentang panggilan masuk dan keluar. Apl hasad boleh menggunakan ini untuk menghantar data anda kepada orang lain."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"tulis log panggilan"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Membenarkan apl untuk mengubah suai panggilan tablet anda, termasuk data tentang panggilan masuk dan keluar. Apl hasad boleh menggunakan ini untuk memadam atau mengubah suai log panggilan anda."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Membenarkan apl untuk mengubah suai panggilan telefon anda, termasuk data tentang panggilan masuk dan keluar. Apl hasad boleh menggunakan ini untuk memadam atau mengubah suai log panggilan anda."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"baca data profil anda"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Membenarkan apl untuk membaca maklumat profil peribadi yang disimpan dalam peranti anda, seperti nama dan maklumat kenalan anda. Ini bermakna apl lain boleh mengenal pasti anda dan menghantar maklumat profil anda kepada orang lain."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"tulis ke data profil anda"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Membenarkan apl membaca sebarang kata-kata peribadi, nama dan frasa yang mungkin telah disimpan oleh pengguna dalam kamus pengguna."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"tulis ke kamus yang ditakrifkan pengguna"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Membenarkan apl menulis perkataan baharu ke dalam kamus pengguna."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"baca kandungan storan USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"baca kandungan kad SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Membenarkan apl membaca kandungan storan USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Membenarkan apl membaca kandungan kad SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"ubah suai/padam kdgn storn USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"ubah suai/padamkan kandungan kad SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Membenarkan apl menulis ke storan USB."</string>
diff --git a/core/res/res/values-nb-rNO/arrays.xml b/core/res/res/values-nb-rNO/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-nb-rNO/arrays.xml
rename to core/res/res/values-nb-rNO/donottranslate-maps.xml
diff --git a/core/res/res/values-nb/strings.xml b/core/res/res/values-nb/strings.xml
index e70a664..fec439d 100644
--- a/core/res/res/values-nb/strings.xml
+++ b/core/res/res/values-nb/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"skrive kontaktinformasjon"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Lar appen lese alle kontaktdataene (adressene) som er lagret på nettbrettet. Ondsinnede apper kan bruke dette til å slette eller endre kontaktdataene dine."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Lar appen lese alle kontaktdataene (adressene) som er lagret på telefonen. Ondsinnede apper kan bruke dette til å slette eller endre kontaktdataene dine."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"lar appen lese anropsloggen"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Lar appen lese nettbrettets samtalelogg, inkludert data om innkommende og utgående anrop. Skadelige apper kan utnytte denne tillatelsen til å sende dataene dine til andre personer."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Lar appen lese telefonens samtalelogg, inkludert data om innkommende og utgående anrop. Skadelige apper kan utnytte denne tillatelsen til å sende dataene dine til andre personer."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"lar appen endre samtaleloggen"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Lar appen endre nettbrettets samtalelogg, inkludert data om innkommende og utgående anrop. Skadelige apper kan utnytte denne tillatelsen til å slette eller endre samtaleloggen din."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Lar appen endre telefonens samtalelogg, inkludert data om innkommende og utgående anrop. Skadelige apper kan utnytte denne tillatelsen til å slette eller endre samtaleloggen din."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"lese profildataene dine"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Lar appen lese personlige profilinformasjon som er lagret på enheten, som for eksempel navn og kontaktinformasjon. Dette betyr at appen kan identifisere deg og sende profilinformasjonen din til andre."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"skriv til profildataene dine"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Lar appen lese eventuelle private ord, navn og uttrykk som brukeren kan ha lagret i brukerordlisten."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"skrive i brukerdefinert ordliste"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Lar appen skrive nye ord i brukerordlisten."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"lese innhold på USB-lagr."</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"lese innhold på SD-kortet"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Lar appen lese innhold på USB-lagringsenheten."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Lar appen lese innhold på SD-kortet."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"endre/slette innh. i USB-lagr."</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"redigere/slette innhold på minnekort"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Gir appen tillatelse til å skrive til USB-lagringen."</string>
diff --git a/core/res/res/values-nl-rBE/arrays.xml b/core/res/res/values-nl-rBE/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-nl-rBE/arrays.xml
rename to core/res/res/values-nl-rBE/donottranslate-maps.xml
diff --git a/core/res/res/values-nl-rNL/arrays.xml b/core/res/res/values-nl-rNL/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-nl-rNL/arrays.xml
rename to core/res/res/values-nl-rNL/donottranslate-maps.xml
diff --git a/core/res/res/values-nl/strings.xml b/core/res/res/values-nl/strings.xml
index 6876c63..030222d 100644
--- a/core/res/res/values-nl/strings.xml
+++ b/core/res/res/values-nl/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"contactgegevens schrijven"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Hiermee kan de app de op uw tablet opgeslagen contactgegevens (adresgegevens) wijzigen. Schadelijke apps kunnen hiermee uw contactgegevens verwijderen of wijzigen."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Hiermee kan de app de op uw telefoon opgeslagen contactgegevens (adresgegevens) wijzigen. Schadelijke apps kunnen hiermee uw contactgegevens verwijderen of wijzigen."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"oproeplogboek lezen"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Toestaan dat de app het oproeplogboek van uw tablet leest, waaronder gegevens over inkomende en uitgaande oproepen. Schadelijke apps kunnen hiermee uw gegevens naar andere personen verzenden."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Toestaan dat de app het oproeplogboek van uw telefoon leest, waaronder gegevens over inkomende en uitgaande oproepen. Schadelijke apps kunnen hiermee uw gegevens naar andere personen verzenden."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"oproeplogboek schrijven"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Toestaan dat de app het oproeplogboek van uw tablet aanpast, waaronder gegevens over inkomende en uitgaande oproepen. Schadelijke apps kunnen hiermee uw oproeplogboek wissen of aanpassen."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Toestaan dat de app het oproeplogboek van uw telefoon aanpast, waaronder gegevens over inkomende en uitgaande oproepen. Schadelijke apps kunnen hiermee uw oproeplogboek wissen of aanpassen."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"uw profielgegevens lezen"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Hiermee kan de app persoonlijke profielgegevens lezen die op uw apparaat zijn opgeslagen, zoals uw naam en contactgegevens. Dit betekent dat de app u kan identificeren en uw profielgegevens naar anderen kan verzenden."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"schrijven naar profielgegevens"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Hiermee kan de app privéwoorden, namen en woordcombinaties lezen die de gebruiker heeft opgeslagen in het gebruikerswoordenboek."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"schrijven naar door gebruiker gedefinieerd woordenboek"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Hiermee kan de app nieuwe woorden schrijven naar het gebruikerswoordenboek."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"inhoud van USB-opslag lezen"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"inhoud van SD-kaart lezen"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"App kan inhoud van USB lezen."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Hiermee kan de app de inhoud van de SD-kaart lezen."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"inhoud van USB-opslag aanpassen/verwijderen"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"inhoud op de SD-kaart aanpassen/verwijderen"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Hiermee kan de app schrijven naar de USB-opslag."</string>
diff --git a/core/res/res/values-pl-rPL/arrays.xml b/core/res/res/values-pl-rPL/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-pl-rPL/arrays.xml
rename to core/res/res/values-pl-rPL/donottranslate-maps.xml
diff --git a/core/res/res/values-pl/strings.xml b/core/res/res/values-pl/strings.xml
index 96dcfa0..9e4cbf3 100644
--- a/core/res/res/values-pl/strings.xml
+++ b/core/res/res/values-pl/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"zapisywanie danych kontaktowych"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Pozwala aplikacji na zmianę danych kontaktowych (adresowych) zapisanych w tablecie. Złośliwe aplikacje mogą to wykorzystać w celu usunięcia lub zmodyfikowania Twoich danych kontaktowych."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Pozwala aplikacji na zmianę danych kontaktowych (adresowych) zapisanych w telefonie. Złośliwe aplikacje mogą to wykorzystać do usunięcia lub zmodyfikowania Twoich danych kontaktowych."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"czytanie rejestru połączeń"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Zezwala aplikacji na odczytywanie rejestru połączeń tabletu, w tym danych o połączeniach przychodzących i wychodzących. Złośliwe aplikacje mogą wykorzystywać tę możliwość, by wysyłać dane do innych osób."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Zezwala aplikacji na odczytywanie rejestru połączeń telefonu, w tym danych o połączeniach przychodzących i wychodzących. Złośliwe aplikacje mogą wykorzystywać tę możliwość, by wysyłać dane do innych osób."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"zapisywanie rejestru połączeń"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Zezwala aplikacji na modyfikowanie rejestru połączeń tabletu, w tym danych o połączeniach przychodzących i wychodzących. Złośliwe aplikacje mogą wykorzystać tę możliwość, by wyczyścić lub zmodyfikować rejestr połączeń."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Zezwala aplikacji na modyfikowanie rejestru połączeń telefonu, w tym danych o połączeniach przychodzących i wychodzących. Złośliwe aplikacje mogą wykorzystać tę możliwość, by wyczyścić lub zmodyfikować rejestr połączeń."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"odczyt danych z Twojego profilu"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Pozwala aplikacji na odczyt informacji, takich jak Twoje nazwisko i informacje kontaktowe, z profilu osobistego przechowywanego na urządzeniu. Oznacza to, że inne aplikacje mogą Cię zidentyfikować i przesłać informacje z Twojego profilu do innych osób."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"zapis danych w Twoim profilu"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Pozwala aplikacji na odczytywanie wszelkich prywatnych słów, nazw i wyrażeń zapisanych w słowniku użytkownika."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"zapisywanie w słowniku zdefiniowanym przez użytkownika"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Pozwala aplikacji na zapisywanie nowych słów do słownika użytkownika."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"odczyt zawartości pamięci USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"odczyt zawartości karty SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Pozwala aplikacji na odczyt pamięci USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Pozwala aplikacji na odczyt karty SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"Modyfikowanie/usuwanie z nośnika USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modyfikowanie/usuwanie zawartości karty SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Pozwala aplikacji na zapis w pamięci USB."</string>
diff --git a/core/res/res/values-pt-rBR/arrays.xml b/core/res/res/values-pt-rBR/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-pt-rBR/arrays.xml
rename to core/res/res/values-pt-rBR/donottranslate-maps.xml
diff --git a/core/res/res/values-pt-rPT/arrays.xml b/core/res/res/values-pt-rPT/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-pt-rPT/arrays.xml
rename to core/res/res/values-pt-rPT/donottranslate-maps.xml
diff --git a/core/res/res/values-pt-rPT/strings.xml b/core/res/res/values-pt-rPT/strings.xml
index 7f031fd..abe1454 100644
--- a/core/res/res/values-pt-rPT/strings.xml
+++ b/core/res/res/values-pt-rPT/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"escrever dados de contacto"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Permite que a aplicação modifique os dados de contacto (endereço) armazenados no tablet. As aplicações maliciosas podem utilizar isto para apagar ou modificar os dados dos seus contactos."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Permite que uma aplicação modifique os dados de contacto (endereço) armazenados no telemóvel. As aplicações maliciosas podem utilizar isto para apagar ou modificar os dados dos seus contactos."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"ler registo de chamadas"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Permite à aplicação ler o registo de chamadas do tablet, incluindo os dados sobre as chamadas recebidas e efetuadas. As aplicações maliciosas podem utilizar esta funcionalidade para enviar os seus dados para outras pessoas."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Permite que a aplicação leia o registo de chamadas do telemóvel, incluindo os dados sobre as chamadas recebidas e efetuadas. As aplicações maliciosas podem utilizar esta funcionalidade para enviar os seus dados para outras pessoas."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"escrever registo de chamadas"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Permite à aplicação modificar o registo de chamadas do tablet, incluindo os dados sobre as chamadas recebidas e efetuadas. As aplicações maliciosas podem utilizar esta funcionalidade para apagar ou modificar o registo de chamadas."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Permite à aplicação modificar o registo de chamadas do telemóvel, incluindo os dados sobre as chamadas recebidas e efetuadas. As aplicações maliciosas podem utilizar esta funcionalidade para apagar ou modificar o seu registo de chamadas."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"ler os dados do perfil"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Permite que a aplicação leia dados de perfil pessoais armazenados no seu aparelho, como o seu nome e dados de contacto. Isto significa que outras aplicações podem identificá-lo e enviar os seus dados de perfil a terceiros."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"escrever nos dados do seu perfil"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Permite à aplicação ler quaisquer palavras, nomes e expressões privadas que o utilizador possa ter armazenado no dicionário do utilizador."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"escrever no dicionário definido pelo utilizador"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Permite à aplicação escrever novas palavras no dicionário do utilizador."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"ler conteúdo da memória USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"ler conteúdo do cartão SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Permite que a aplicação leia conteúdos da memória USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Permite que a aplicação leia conteúdos do cartão SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"mod./elim. conteúdo do armaz. USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modificar/eliminar conteúdo do cartão SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Permite que a aplicação escreva na unidade de armazenamento USB."</string>
diff --git a/core/res/res/values-pt/strings.xml b/core/res/res/values-pt/strings.xml
index fbfe88f..3ae566c 100644
--- a/core/res/res/values-pt/strings.xml
+++ b/core/res/res/values-pt/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"gravar dados de contato"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Permite que o aplicativo modifique os dados de contato (endereço) armazenados em seu tablet. Aplicativos maliciosos podem usar esse recurso para apagar ou modificar seus dados de contato."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Permite que o aplicativo modifique os dados de contato (endereço) armazenados em seu telefone. Aplicativos maliciosos podem usar esse recurso para apagar ou modificar seus dados de contato."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"ler registro de chamadas"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Permite que o aplicativo leia o registro de chamadas de seu tablet, incluindo dados sobre chamadas recebidas e efetuadas. Aplicativos maliciosos podem usar esta permissão para enviar seus dados para outras pessoas."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Permite que o aplicativo leia o registro de chamadas de seu telefone, incluindo dados sobre chamadas recebidas e efetuadas. Aplicativos maliciosos podem usar esta permissão para enviar seus dados para outras pessoas."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"salvar no registo de chamadas"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Permite que o aplicativo modifique o registro de chamadas de seu tablet, incluindo dados sobre chamadas recebidas e efetuadas. Aplicativos maliciosos podem usar esta permissão para apagar ou modificar seu registro de chamadas."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Permite que o aplicativo modifique o registro de chamadas de seu telefone, incluindo dados sobre chamadas recebidas e efetuadas. Aplicativos maliciosos podem usar esta permissão para apagar ou modificar seu registro de chamadas."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"ler dados de seu perfil"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Permite que o aplicativo leia informações de perfil pessoais armazenadas em seu dispositivo, como seu nome e informações de contato. Isso significa que o aplicativo pode identificá-lo e enviar suas informações de perfil para outros aplicativos."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"escrever nos dados do perfil"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Permite que o aplicativo leia palavras, nomes e frases particulares armazenados pelo usuário no dicionário do usuário."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"gravar no dicionário definido pelo usuário"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Permite que o aplicativo grave novas palavras no dicionário do usuário."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"ler conteúdo do armaz. USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"ler conteúdo do cartão SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Permite apl. ler cont. arm USB"</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Permite que o aplicativo leia o conteúdo do cartão SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"modificar/excluir cont. USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modificar/excluir conteúdo do cartão SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Permite gravar no armaz. USB."</string>
diff --git a/core/res/res/values-rm-rCH/arrays.xml b/core/res/res/values-rm-rCH/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-rm-rCH/arrays.xml
rename to core/res/res/values-rm-rCH/donottranslate-maps.xml
diff --git a/core/res/res/values-rm/strings.xml b/core/res/res/values-rm/strings.xml
index ff76f74..fc6a510 100644
--- a/core/res/res/values-rm/strings.xml
+++ b/core/res/res/values-rm/strings.xml
@@ -489,6 +489,18 @@
<skip />
<!-- no translation found for permdesc_writeContacts (5075164818647934067) -->
<skip />
+ <!-- no translation found for permlab_readCallLog (3478133184624102739) -->
+ <skip />
+ <!-- no translation found for permdesc_readCallLog (3995157599976515002) -->
+ <skip />
+ <!-- no translation found for permdesc_readCallLog (3452017559804750758) -->
+ <skip />
+ <!-- no translation found for permlab_writeCallLog (8552045664743499354) -->
+ <skip />
+ <!-- no translation found for permdesc_writeCallLog (6661806062274119245) -->
+ <skip />
+ <!-- no translation found for permdesc_writeCallLog (683941736352787842) -->
+ <skip />
<!-- no translation found for permlab_readProfile (6824681438529842282) -->
<skip />
<!-- no translation found for permdesc_readProfile (94520753797630679) -->
@@ -764,6 +776,14 @@
<skip />
<!-- no translation found for permdesc_writeDictionary (8185385716255065291) -->
<skip />
+ <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
+ <skip />
+ <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
+ <skip />
+ <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
+ <skip />
+ <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
+ <skip />
<!-- no translation found for permlab_sdcardWrite (85430876310764752) -->
<skip />
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modifitgar/stizzar cuntegns da la carta SD"</string>
diff --git a/core/res/res/values-ro-rRO/arrays.xml b/core/res/res/values-ro-rRO/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-ro-rRO/arrays.xml
rename to core/res/res/values-ro-rRO/donottranslate-maps.xml
diff --git a/core/res/res/values-ro/strings.xml b/core/res/res/values-ro/strings.xml
index cac586e..d443d1d 100644
--- a/core/res/res/values-ro/strings.xml
+++ b/core/res/res/values-ro/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"scriere date de contact"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Permite aplicaţiei să modifice datele de contact (adresele) stocate pe tabletă. Aplicaţiile rău intenţionate pot să utilizeze această permisiune pentru a şterge sau a modifica datele dvs. de contact."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Permite aplicaţiei să modifice datele de contact (adresele) stocate pe telefon. Aplicaţiile rău intenţionate pot să utilizeze această permisiune pentru a şterge sau pentru a modifica datele dvs. de contact."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"citeşte jurnalul de apeluri"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Permite aplicaţiei să citească jurnalul de apeluri al tabletei dvs., inclusiv datele despre apelurile primite sau efectuate. Aplicaţiile rău intenţionate pot utiliza această permisiune pentru a trimite datele dvs. altor persoane."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Permite aplicaţiei să citească jurnalul de apeluri al telefonului dvs., inclusiv datele despre apelurile primite sau efectuate. Aplicaţiile rău intenţionate pot utiliza această permisiune pentru a trimite datele dvs. altor persoane."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"scrie jurnalul de apeluri"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Permite aplicaţiei să modifice jurnalul de apeluri al tabletei dvs., inclusiv datele despre apelurile primite sau efectuate. Aplicaţiile rău intenţionate pot utiliza această permisiune pentru a şterge sau pentru a modifica jurnalul dvs. de apeluri."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Permite aplicaţiei să modifice jurnalul de apeluri al telefonului dvs., inclusiv datele despre apelurile primite sau efectuate. Aplicaţiile rău intenţionate pot utiliza această permisiune pentru a şterge sau pentru a modifica jurnalul dvs. de apeluri."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"citire date din profilul dvs."</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Permite aplicaţiei să citească informaţii de profil personal stocate pe dispozitiv, cum ar fi numele şi informaţiile de contact, ceea ce înseamnă că aplicaţia vă poate identifica şi poate trimite informaţiile dvs. de profil altor utilizatori."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"scriere date în profilul dvs."</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Permite aplicaţiei să citească cuvinte, nume şi expresii private stocate de utilizator în dicţionarul său."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"scriere în dicţionarul definit de utilizator"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Permite aplicaţiei să scrie cuvinte noi în dicţionarul utilizatorului."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"citeşte conţinutul stoc. USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"citeşte conţinutul cardului SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Permite aplic. citirea conţinutului stoc. USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Permite aplicaţiei să citească conţinutul cardului SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"modificare/ştergere a conţinutului stocării USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modificare/ştergere conţinut card SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Permite scriere în stoc. USB."</string>
diff --git a/core/res/res/values-ru-rRU/arrays.xml b/core/res/res/values-ru-rRU/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-ru-rRU/arrays.xml
rename to core/res/res/values-ru-rRU/donottranslate-maps.xml
diff --git a/core/res/res/values-ru/strings.xml b/core/res/res/values-ru/strings.xml
index 3a554d6..5ed4c2e 100644
--- a/core/res/res/values-ru/strings.xml
+++ b/core/res/res/values-ru/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"перезаписывать данные контакта"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Приложение сможет изменять адреса, сохраненные на планшетном ПК. Вредоносные программы смогут таким образом удалять и изменять данные ваших контактов."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Приложение сможет изменять адреса, сохраненные на телефоне. Вредоносные программы смогут таким образом удалять и изменять данные ваших контактов."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"чтение журнала вызовов"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Приложение получит доступ к списку вызовов планшетного ПК, включая данные о входящих и исходящих звонках. Вредоносные приложения могут использовать доступ для передачи ваших данных третьим лицам."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Приложение получит доступ к списку вызовов телефона, включая данные о входящих и исходящих звонках. Вредоносные приложения смогут воспользоваться этим, чтобы отправить ваши данные третьим лицам."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"запись журнала вызовов"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Приложение сможет вносить изменения в список вызовов планшетного ПК и данные о входящих и исходящих звонках. Вредоносные приложения смогут воспользоваться этим для удаления или изменения информации о звонках."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Приложение сможет вносить изменения в список вызовов телефона и данные о входящих и исходящих звонках. Вредоносные приложения смогут воспользоваться этим для удаления или изменения информации о звонках."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"просматривать данные профиля"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Приложение сможет считывать информацию личного профиля, сохраненную на устройстве, такую как ваше имя и контактные данные. Это означает, что приложение сможет получить ваши личные данные и отправить их другим пользователям."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"изменение данных профиля"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Приложение получит доступ ко всем словам, именам и фразам, которые хранятся в пользовательском словаре."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"запись данных в пользовательский словарь"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Приложение сможет добавлять слова в пользовательский словарь."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"чтение данных с USB-накопителя"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"чтение данных с SD-карты"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Приложение сможет считывать данные с USB-накопителя."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Приложение сможет считывать данные с SD-карты."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"доступ к USB-накопителю"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"изменять/удалять содержимое SD-карты"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Приложение сможет записывать данные на USB-накопитель."</string>
diff --git a/core/res/res/values-sk-rSK/arrays.xml b/core/res/res/values-sk-rSK/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-sk-rSK/arrays.xml
rename to core/res/res/values-sk-rSK/donottranslate-maps.xml
diff --git a/core/res/res/values-sk/strings.xml b/core/res/res/values-sk/strings.xml
index daa321d..2e97b82 100644
--- a/core/res/res/values-sk/strings.xml
+++ b/core/res/res/values-sk/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"zápis údajov kontaktov"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Umožňuje aplikácii zmeniť všetky kontaktné údaje (adresy) uložené v tablete. Škodlivé aplikácie to môžu využiť a vymazať alebo zmeniť vaše kontaktné údaje."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Umožňuje aplikácii čítať všetky kontaktné údaje (adresy) uložené v telefóne. Škodlivé aplikácie to môžu využiť na odoslanie vašich údajov iným osobám."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"čítať denník hovorov"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Umožňuje aplikácii čítať denník hovorov vo vašom tablete vrátane údajov o prichádzajúcich a odchádzajúcich hovoroch. Škodlivé aplikácie to môžu zneužiť na odosielanie vašich údajov iným osobám."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Umožňuje aplikácii čítať denník hovorov vo vašom telefóne vrátane údajov o prichádzajúcich a odchádzajúcich hovoroch. Škodlivé aplikácie to môžu zneužiť na odosielanie vašich údajov iným osobám."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"zapisovať do denníka hovorov"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Umožňuje aplikácii upravovať denník hovorov vo vašom tablete vrátane údajov o prichádzajúcich a odchádzajúcich hovoroch. Škodlivé aplikácie to môžu zneužiť na vymazanie alebo úpravu vášho denníka hovorov."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Umožňuje aplikácii upravovať denník hovorov vo vašom telefóne vrátane údajov o prichádzajúcich a odchádzajúcich hovoroch. Škodlivé aplikácie to môžu zneužiť na vymazanie alebo úpravu vášho denníka hovorov."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"čítať údaje vášho profilu"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Umožňuje aplikácii čítať informácie v osobnom profile uložené vo vašom zariadení, ako je vaše meno a kontaktné informácie. Znamená to, že ďalšie aplikácie vás môžu identifikovať a poslať ostatným informácie o vašom profile."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"zapisovať do údajov profilu"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Umožňuje aplikácii čítať súkromné slová, názvy a frázy, ktoré mohol používateľ uložiť do slovníka používateľa."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"zapisovať do slovníka definovaného používateľom"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Umožňuje aplikácii zapisovať nové slová do používateľského slovníka."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"čítanie obsahu úložiska USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"čítanie obsahu karty SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Umožňuje apl. čítať obsah USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Umožňuje aplikácii čítať obsah karty SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"upraviť/odstrániť obsah ukl. pr. USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"Zmeniť/odstrániť obsah karty SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Umožňuje aplikácii zápis do ukladacieho priestoru USB."</string>
diff --git a/core/res/res/values-sl-rSI/arrays.xml b/core/res/res/values-sl-rSI/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-sl-rSI/arrays.xml
rename to core/res/res/values-sl-rSI/donottranslate-maps.xml
diff --git a/core/res/res/values-sl/strings.xml b/core/res/res/values-sl/strings.xml
index 20ad59b..f66cabb 100644
--- a/core/res/res/values-sl/strings.xml
+++ b/core/res/res/values-sl/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"pisanje podatkov stika"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Programu omogoča spreminjanje podatkov stikov (naslov), shranjenih v tabličnem računalniku. Zlonamerni programi lahko to uporabijo za brisanje ali spreminjanje podatkov stika."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Programu omogoča spreminjanje podatkov stikov (naslov), shranjenih v telefonu. Zlonamerni programi lahko to uporabijo za brisanje ali spreminjanje podatkov stika."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"branje dnevnika klicev"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Aplikaciji dovoli branje dnevnika klicev v tabličnem računalniku, vključno s podatki o dohodnih in odhodnih klicih. Zlonamerne aplikacije lahko tako pošiljajo vaše podatke drugim."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Aplikaciji dovoli branje dnevnika klicev v telefonu, vključno s podatki o dohodnih in odhodnih klicih. Zlonamerne aplikacije lahko tako pošiljajo vaše podatke drugim."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"pisanje v dnevnik klicev"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Aplikaciji dovoli spreminjanje dnevnika klicev v tabličnem računalniku, vključno s podatki o dohodnih in odhodnih klicih. Zlonamerne aplikacije lahko tako izbrišejo ali spreminjajo vaš dnevnik klicev."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Aplikaciji dovoli spreminjanje dnevnika klicev v telefonu, vključno s podatki o dohodnih in odhodnih klicih. Zlonamerne aplikacije lahko tako izbrišejo ali spreminjajo vaš dnevnik klicev."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"branje podatkov v profilu"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Programu omogoča branje osebnih podatkov v profilu, kot so ime in podatki za stik. To pomeni, da vas lahko program prepozna in vaše podatke o profilu pošlje drugim."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"pisanje v podatke v profilu"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Programu omogoča branje morebitnih zasebnih besed, imen in izrazov, ki jih je uporabnik shranil v uporabniški slovar."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"pisanje v uporabniško določen slovar"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Programu omogoča pisanje nove besede v uporabniški slovar."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"branje vsebine pomnilnika USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"branje vsebine kartice SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Aplikaciji dovoli branje vsebine pomnilnika USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Aplikaciji dovoli branje vsebine kartice SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"spreminjanje vsebine pomnilnika USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"spreminjanje/brisanje vsebine kartice SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Programu omogoča zapisovanje v pomnilnik USB."</string>
diff --git a/core/res/res/values-sr-rRS/arrays.xml b/core/res/res/values-sr-rRS/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-sr-rRS/arrays.xml
rename to core/res/res/values-sr-rRS/donottranslate-maps.xml
diff --git a/core/res/res/values-sr/strings.xml b/core/res/res/values-sr/strings.xml
index 9fb8abf..66c0561 100644
--- a/core/res/res/values-sr/strings.xml
+++ b/core/res/res/values-sr/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"уписивање података о контактима"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Дозвољава апликацији да измени податке о контакту (адреси) сачуване на таблету. Злонамерне апликације могу то да искористе да би избрисале или измениле податке о контакту."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Дозвољава апликацији да измени податке о контакту (адреси) сачуване на телефону. Злонамерне апликације могу то да искористе да би избрисале или измениле податке о контакту."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"читање евиденције позива"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Дозвољава апликацији да чита евиденцију позива на таблету, укључујући податке о долазним и одлазним позивима. Злонамерне апликације могу ово да користе да би слале податке другим људима."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Дозвољава апликацији да чита евиденцију позива на телефону, укључујући податке о долазним и одлазним позивима. Злонамерне апликације могу ово да користе да би слале податке другим људима."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"писање евиденције позива"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Дозвољава апликацији да мења евиденцију позива на таблету, укључујући податке о долазним и одлазним позивима. Злонамерне апликације могу ово да користе да би брисале или мењале евиденцију позива."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Дозвољава апликацији да мења евиденцију позива на телефону, укључујући податке о долазним и одлазним позивима. Злонамерне апликације могу ово да користе да би брисале или мењале евиденцију позива."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"читање података о профилу"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Дозвољава апликацији да чита личне информације са профила сачуване на уређају, као што су име и контакт информације. То значи да друге апликације могу да вас идентификују и да информације о вашем профилу шаљу другима."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"уписивање у податке профила"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Дозвољава апликацији да чита све приватне речи, називе и фразе које је корисник сачувао у корисничком речнику."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"уписивање у речник који је дефинисао корисник"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Дозвољава апликацији да уписује нове речи у кориснички речник."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"читање садржаја USB меморије"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"читање садржаја SD картице"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Дозвољава апл. да чита садржај USB меморије."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Дозвољава апликацији да чита садржај SD картице."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"измена/брисање садржаја USB меморије"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"измена/брисање садржаја SD картице"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Дозвољава апликацији да уписује податке на USB меморију."</string>
diff --git a/core/res/res/values-sv-rSE/arrays.xml b/core/res/res/values-sv-rSE/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-sv-rSE/arrays.xml
rename to core/res/res/values-sv-rSE/donottranslate-maps.xml
diff --git a/core/res/res/values-sv/strings.xml b/core/res/res/values-sv/strings.xml
index 2c4189b..eee0d80 100644
--- a/core/res/res/values-sv/strings.xml
+++ b/core/res/res/values-sv/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"skriva kontaktuppgifter"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Tillåter att appen ändrar kontaktuppgifter (adresser) som lagras på pekdatorn. Skadliga appar kan använda detta för att radera eller ändra kontaktuppgifter."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Tillåter att appen ändrar kontaktuppgifter (adresser) som lagras på mobilen. Skadliga appar kan använda detta för att radera eller ändra kontaktuppgifter."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"läs samtalslogg"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Tillåter att appen läser pekdatorns samtalslista, inklusive uppgifter om inkommande och utgående samtal. Skadliga appar kan använda informationen för att skicka dina data till andra personer."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Tillåter att appen läser mobilens samtalslista, inklusive uppgifter om inkommande och utgående samtal. Skadliga appar kan använda informationen för att skicka dina data till andra personer."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"skriv samtalslogg"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Tillåter att appen gör ändringar i pekdatorns samtalslista, inklusive i uppgifter om inkommande och utgående samtal. Skadliga program kan använda detta för att radera eller ändra din samtalslista."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Tillåter att appen gör ändringar i mobilens samtalslista, inklusive i uppgifter om inkommande och utgående samtal. Skadliga program kan använda detta för att radera eller ändra din samtalslista."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"läser din profilinformation"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Tillåter att appen läser personlig profilinformation som lagras på din enhet, t.ex. ditt namn och kontaktuppgifter. Det innebär att appen kan identifiera dig och skicka profilinformation till andra."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"skriver till data för din profil"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Tillåter att appen läser alla privata ord, namn och fraser som användaren har sparat i ordlistan."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"lägga till i användardefinierad ordlista"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Tillåter att appen anger nya ord i användarordlistan."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"läs innehållet på USB-lagringsenheten"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"läs innehållet på SD-kortet"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Appen får läsa innehåll på USB-enhet."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Tillåter appen att läsa innehållet på SD-kort."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"ändra/ta bort från USB-enhet"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"ändra/ta bort innehåll på SD-kortet"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Gör att app skriver till USB."</string>
diff --git a/core/res/res/values-sw-rTZ/arrays.xml b/core/res/res/values-sw-rTZ/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-sw-rTZ/arrays.xml
rename to core/res/res/values-sw-rTZ/donottranslate-maps.xml
diff --git a/core/res/res/values-sw/strings.xml b/core/res/res/values-sw/strings.xml
index 13053ab..3b870cf 100644
--- a/core/res/res/values-sw/strings.xml
+++ b/core/res/res/values-sw/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"andika data ya anwani"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Inaruhusu programu kurekebisha data ya mwasiliani(anwani) iliyohifadhiwa kwenye kompyuta yako ki. programu hasidi zinaweza tumia hii kufuta au kurekebisha data yako ya mwasiliani."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Inaruhusu programu kurekebisha data ya mwasiliani(anwani) iliyohifadhiwa kwenye simu yako. Programu hasidi zinaweza kutumia hii kufuta au kurekebisha data yako ya mwasiliani."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"soma kumbukumbu ya simu"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Huruhusu programu kusoma kumbukumbu ya kompyuta kibao yako, ikiwa ni pamoja na simu zinazoingia na kutoka. Huenda programu hasidi zikatumia hii ili kutuma data yako kwa watu wengine."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Huruhusu programu kusoma kumbukumbu ya simu yako, ikiwa ni pamoja na simu zinazoingia na kutoka. Huenda programu hasidi zikatumia hii ili kutuma data yako kwa watu wengine."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"andika kumbukumbu ya simu"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Huruhusu programu kusoma kumbukumbu ya kompyuta kibao yako, ikiwa ni pamoja na simu zinazoingia na kutoka. Huenda programu hasidi zikatumia hii ili kufuta au kurekebisha kumbukumbu ya simu yako."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Huruhusu programu kusoma kumbukumbu ya simu yako, ikiwa ni pamoja na simu zinazoingia na kutoka. Huenda programu hasidi zikatumia hii ili kufuta au kurekebisha kumbukumbu ya simu yako."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"soma data ya maelezo yako mafupi"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Inaruhusu programu kusoma maelezo mafupi ya kibinafsi yaliyohifadhiwa kwenye kifaa chako, kama vile jina lako na taarifa ya kuwasiliana. Hii ina maanisha programu inaweza kukutambua na kutuma taarifa yako fupi ya kibinafsi kwa wengine."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"andika kwenye data ya maelezo yako mafupi"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Inaruhusu programu kusoma maneno, majina na vifungu vyovyote vya kibinafsi, ambavyo huenda mtumiaji amehifadhi katika kamusi ya mtumiaji."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"andika kwa kamusi iliyobainishwa na mtumiaji"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Inaruhusu programu kuandika maneno mapya katika kamusi ya mtumiaji."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"soma maudhui ya hifadhi ya USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"soma maudhui ya kadi ya SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Huruhusu programu kusoma maudhui ya hifadhi ya USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Huruhusu programu kusoma maudhui ya kadi ya SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"rekebisha/futa maudhui ya hifadhi ya USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"rekebisha/futa maudhui ya kadi ya SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Inaruhusu programu kuandikia hifadhi ya USB."</string>
diff --git a/core/res/res/values-th-rTH/arrays.xml b/core/res/res/values-th-rTH/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-th-rTH/arrays.xml
rename to core/res/res/values-th-rTH/donottranslate-maps.xml
diff --git a/core/res/res/values-th/strings.xml b/core/res/res/values-th/strings.xml
index a9a196c..0542f8e 100644
--- a/core/res/res/values-th/strings.xml
+++ b/core/res/res/values-th/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"เขียนข้อมูลที่อยู่ติดต่อ"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"อนุญาตให้แอปพลิเคชันแก้ไขข้อมูลการติดต่อ (ที่อยู่) ที่เก็บไว้ในแท็บเล็ตของคุณ แอปพลิเคชันที่เป็นอันตรายอาจใช้การอนุญาตนี้ลบหรือแก้ไขข้อมูลการติดต่อของคุณ"</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"อนุญาตให้แอปพลิเคชันแก้ไขข้อมูลการติดต่อ (ที่อยู่) ที่เก็บไว้ในโทรศัพท์ของคุณ แอปพลิเคชันที่เป็นอันตรายอาจใช้การอนุญาตนี้ลบหรือแก้ไขข้อมูลการติดต่อของคุณ"</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"อ่านประวัติการโทร"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"อนุญาตให้แอปพลิเคชันอ่านประวัติการโทรของแท็บเล็ตของคุณ รวมถึงข้อมูลเกี่ยวกับสายเรียกเข้าและการโทรออก แอปพลิเคชันที่เป็นอันตรายอาจใช้สิ่งนี้เพื่อส่งข้อมูลของคุณให้กับบุคคลอื่น"</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"อนุญาตให้แอปพลิเคชันอ่านประวัติการโทรของโทรศัพท์ของคุณ รวมถึงข้อมูลเกี่ยวกับสายเรียกเข้าและการโทรออก แอปพลิเคชันที่เป็นอันตรายอาจใช้สิ่งนี้เพื่อส่งข้อมูลของคุณให้กับบุคคลอื่น"</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"เขียนประวัติการโทร"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"อนุญาตให้แอปพลิเคชันแก้ไขประวัติการโทรของแท็บเล็ตของคุณ รวมถึงข้อมูลเกี่ยวกับสายเรียกเข้าและการโทรออก แอปพลิเคชันที่เป็นอันตรายอาจใช้สิ่งนี้เพื่อลบหรือแก้ไขประวัติการโทรของคุณ"</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"อนุญาตให้แอปพลิเคชันแก้ไขประวัติการโทรของโทรศัพท์ของคุณ รวมถึงข้อมูลเกี่ยวกับสายเรียกเข้าและการโทรออก แอปพลิเคชันที่เป็นอันตรายอาจใช้สิ่งนี้เพื่อลบหรือแก้ไขประวัติการโทรของคุณ"</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"อ่านข้อมูลโปรไฟล์ของคุณ"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"อนุญาตให้แอปพลิเคชันอ่านข้อมูลโปรไฟล์ส่วนบุคคลที่เก็บไว้บนอุปกรณ์ของคุณ เช่น ชื่อและข้อมูลติดต่อ ซึ่งหมายความว่าแอปพลิเคชันจะสามารถระบุตัวตนของคุณและส่งข้อมูลโปรไฟล์ของคุณแก่ผู้อื่นได้"</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"เขียนลงในข้อมูลโปรไฟล์ของคุณ"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"อนุญาตให้แอปพลิเคชันอ่านคำ ชื่อ และวลีส่วนบุคคลที่ผู้ใช้อาจเก็บไว้ในพจนานุกรมของผู้ใช้"</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"เขียนลงในพจนานุกรมที่ผู้ใช้กำหนด"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"อนุญาตให้แอปพลิเคชันเขียนคำใหม่ลงในพจนานุกรมผู้ใช้"</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"อ่านเนื้อหาที่บันทึกใน USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"อ่านเนื้อหาในการ์ด SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"อนุญาตให้แอปอ่านเนื้อหาใน USB"</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"อนุญาตให้แอปอ่านเนื้อหาในการ์ด SD"</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"แก้ไข/ลบเนื้อหาของที่เก็บข้อมูล USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"แก้ไข/ลบข้อมูลการ์ด SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"อนุญาตให้แอปฯ เขียนลงใน USB"</string>
diff --git a/core/res/res/values-tl-rPH/arrays.xml b/core/res/res/values-tl-rPH/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-tl-rPH/arrays.xml
rename to core/res/res/values-tl-rPH/donottranslate-maps.xml
diff --git a/core/res/res/values-tl/strings.xml b/core/res/res/values-tl/strings.xml
index 2672083..dc22a08 100644
--- a/core/res/res/values-tl/strings.xml
+++ b/core/res/res/values-tl/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"sumulat ng data ng pakikipag-ugnay"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Pinapayagan ang app na baguhin ang data ng contact (address) na nakaimbak sa iyong tablet. Maaari itong gamitin ng nakakahamak na apps upang burahin o baguhin ang iyong data ng contact."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Pinapayagan ang app na baguhin ang data ng contact (address) na nakaimbak sa iyong telepono. Maaari itong gamitin ng nakakahamak na apps upang burahin o baguhin ang iyong data ng contact."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"basahin ang log ng tawag"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Binibigyang-daan ang app na basahin ang log ng tawag ng iyong tablet, kabilang ang data tungkol sa mga paparating at papalabas na tawag. Maaari itong gamitin ng nakakahamak na apps upang ipadala ang iyong data sa ibang mga tao."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Binibigyang-daan ang app na basahin ang log ng tawag ng iyong telepono, kabilang ang data tungkol sa mga paparating at papalabas na tawag. Maaari itong gamitin ng nakakahamak na apps upang ipadala ang iyong data sa ibang mga tao."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"isulat ang log ng tawag"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Binibigyan-daan ang app na baguhin ang log ng tawag ng iyong tablet, kabilang ang data tungkol sa mga paparating at papalabas na tawag. Maaari itong gamitin ng nakakahamak na apps upang burahin o baguhin ang iyong log ng tawag."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Binibigyan-daan ang app na baguhin ang log ng tawag ng iyong telepono, kabilang ang data tungkol sa mga paparating at papalabas na tawag. Maaari itong gamitin ng nakakahamak na apps upang burahin o baguhin ang iyong log ng tawag."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"basahin ang iyong data ng profile"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Pinapayagan ang app na basahin ang personal na impormasyon ng profile na nakaimbak sa iyong device, gaya ng iyong pangalan at impormasyon ng contact. Nangangahulugan ito na makikilala ka ng app at maipapadala nito ang impormasyon ng iyong profile sa iba."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"i-write sa iyong data ng profile"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Pinapayagan ang app na magbasa ng anumang pribadong mga salita, pangalan at parirala na maaaring inimbak ng user sa diksyunaryo ng user."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"magsulat sa diksyunaryong tinukoy ng user"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Pinapayagan ang app na magsulat ng mga bagong salita sa diksyunaryo ng user."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"basahin nilalaman USB storage"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"basahin ang mga nilalaman ng SD card"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Payag app basa laman USB strg."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Binibigyang-daan ang app na basahin ang mga nilalaman ng SD card."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"baguhin/tanggalin laman ng USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"baguhin/tanggalin ang mga nilalaman ng SD card"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Pinapayagan ang app na magsulat sa USB storage."</string>
diff --git a/core/res/res/values-tr-rTR/arrays.xml b/core/res/res/values-tr-rTR/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-tr-rTR/arrays.xml
rename to core/res/res/values-tr-rTR/donottranslate-maps.xml
diff --git a/core/res/res/values-tr/strings.xml b/core/res/res/values-tr/strings.xml
index 059ccea..419ae96 100644
--- a/core/res/res/values-tr/strings.xml
+++ b/core/res/res/values-tr/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"kişi verileri yaz"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Uygulamaya, tabletinizde depolanan kişi (adres) verilerini değiştirme izni verir. Kötü amaçlı uygulamalar kişi verilerinizi silmek veya değiştirmek için bunu kullanabilir."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Uygulamaya, telefonunuzda depolanan kişi (adres) verilerini değiştirme izni verir. Kötü amaçlı uygulamalar kişi verilerinizi silmek veya değiştirmek için bunu kullanabilir."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"çağrı günlüğünü oku"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Uygulamaya tabletinizin çağrı günlüğünü (gelen ve giden çağrılarla ilgili veriler dahil olmak üzere) okuma izni verir. Kötü amaçlı uygulamalar bu izni kullanarak verilerinizi başka kişilere gönderebilir."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Uygulamaya telefonunuzun çağrı günlüğünü (gelen ve giden çağrılarla ilgili veriler dahil olmak üzere) okuma izni verir. Kötü amaçlı uygulamalar bu izni kullanarak verilerinizi başka kişilere gönderebilir."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"çağrı günlüğüne yaz"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Uygulamaya tabletinizin çağrı günlüğünde (gelen ve giden çağrılarla ilgili veriler dahil olmak üzere) değişiklik yapma izni verir. Kötü amaçlı uygulamalar bu izni kullanarak çağrı günlüğünüzü silebilir veya değiştirebilir."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Uygulamaya telefonunuzun çağrı günlüğünde (gelen ve giden çağrılarla ilgili veriler dahil olmak üzere) değişiklik yapma izni verir. Kötü amaçlı uygulamalar bu izni kullanarak çağrı günlüğünüzü silebilir veya değiştirebilir."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"profil verilerimi oku"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Uygulamaya, adınız ve iletişim bilgileriniz gibi cihazınızda saklanan kişisel profil bilgilerini okuma izni verir. Bu izin, uygulamanın sizi tanımlayabileceği ve profil bilgilerinizi başkalarına gönderebileceği anlamına gelir."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"profil verilerime yaz"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Uygulamaya, kullanıcının kullanıcı sözlüğünde depolamış olabileceği kişisel kelimeleri, adları ve kelime öbeklerini okuma izni verir."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"kullanıcı tanımlı sözlüğe yaz"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Uygulamaya, kullanıcı sözlüğüne yeni kelimeler yazma izni verir."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"USB depolama içeriklerini oku"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"SD kart içeriklerini oku"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Uygulamaya USB depolama içeriğini okuma izni verir."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Uygulamaya SD kart içeriğini okuma izni verir."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"USB dep birm içeriğini dğş/sil"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"SD kart içeriklerini değiştir/sil"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Uygulamaya USB depolama birimine yazma izni verir."</string>
diff --git a/core/res/res/values-uk-rUA/arrays.xml b/core/res/res/values-uk-rUA/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-uk-rUA/arrays.xml
rename to core/res/res/values-uk-rUA/donottranslate-maps.xml
diff --git a/core/res/res/values-uk/strings.xml b/core/res/res/values-uk/strings.xml
index 42929ec..13311f1 100644
--- a/core/res/res/values-uk/strings.xml
+++ b/core/res/res/values-uk/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"запис. контактні дані"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Дозволяє програмі змінювати контактні дані (адресу), збережені в планшетному ПК. Шкідливі програми можуть використовувати це для видалення чи зміни ваших контактних даних."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Дозволяє програмі змінювати контактні дані (адресу), збережені в телефоні. Шкідливі програми можуть використовувати це для видалення чи зміни ваших контактних даних."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"читати журнал викликів"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Дозволяє програмі читати журнал викликів вашого планшетного ПК, включно з даними про вхідні та вихідні дзвінки. Шкідливі програми можуть використовувати це для надсилання ваших даних іншим людям."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Дозволяє програмі читати журнал викликів вашого телефону, включно з даними про вхідні та вихідні дзвінки. Шкідливі програми можуть використовувати це для надсилання ваших даних іншим людям."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"записувати в журнал викликів"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Дозволяє програмі змінювати журнал викликів вашого планшетного ПК, включно з даними про вхідні та вихідні дзвінки. Шкідливі програми можуть використовувати це для стирання або зміни вашого журналу викликів."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Дозволяє програмі змінювати журнал викликів вашого телефону, включно з даними про вхідні та вихідні дзвінки. Шкідливі програми можуть використовувати це для стирання або зміни вашого журналу викликів."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"читати дані вашого профілю"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Дозволяє програмі читати особисту інформацію профілю, збережену на вашому пристрої, як-от ваше ім’я та контактну інформацію. Це означає, що інші програми можуть ідентифікувати вашу особу та надсилати дані вашого профілю іншим."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"записувати в дані профілю"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Дозволяє програмі читати будь-які особисті вислови, назви та фрази, які користувач міг зберегти у своєму словнику."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"писати у вказаний користувачем словник"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Дозволяє програмі писати нові слова в словник користувача."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"читати вміст носія USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"читати вміст карти SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Дозволяє програмі читати вміст носія USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Дозволяє програмі читати вміст карти SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"змінювати/видаляти вміст носія USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"змінювати/видал. вміст карти SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Дозволяє програмі писати на носій USB"</string>
diff --git a/core/res/res/values-vi-rVN/arrays.xml b/core/res/res/values-vi-rVN/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-vi-rVN/arrays.xml
rename to core/res/res/values-vi-rVN/donottranslate-maps.xml
diff --git a/core/res/res/values-vi/strings.xml b/core/res/res/values-vi/strings.xml
index 64469ab..b94f104 100644
--- a/core/res/res/values-vi/strings.xml
+++ b/core/res/res/values-vi/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"ghi dữ liệu liên hệ"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Cho phép ứng dụng sửa đổi dữ liệu (địa chỉ) liên hệ được lưu trữ trên máy tính bảng của bạn. Ứng dụng độc hại có thể sử dụng quyền này để xóa hoặc sửa đổi dữ liệu liên hệ của bạn."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Cho phép ứng dụng sửa đổi dữ liệu (địa chỉ) liên hệ được lưu trữ trên điện thoại của bạn. Ứng dụng độc hại có thể sử dụng quyền này để xóa hoặc sửa đổi dữ liệu liên hệ của bạn."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"đọc nhật ký cuộc gọi"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Cho phép ứng dụng đọc nhật ký cuộc gọi trên máy tính bảng của bạn, bao gồm dữ liệu về các cuộc gọi đến và gọi đi. Các ứng dụng độc hại có thể sử dụng quyền này để gửi dữ liệu của bạn cho những người khác."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Cho phép ứng dụng đọc nhật ký cuộc gọi trên điện thoại của bạn, bao gồm dữ liệu về các cuộc gọi đến và gọi đi. Các ứng dụng độc hại có thể sử dụng quyền này để gửi dữ liệu của bạn cho những người khác."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"ghi nhật ký cuộc gọi"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Cho phép ứng dụng sửa đổi nhật ký cuộc gọi trên máy tính bảng của bạn, bao gồm dữ liệu về các cuộc gọi đến và gọi đi. Các ứng dụng độc hại có thể sử dụng quyền này để xóa hoặc sửa đổi nhật ký cuộc gọi của bạn."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Cho phép ứng dụng sửa đổi nhật ký cuộc gọi trên điện thoại của bạn, bao gồm dữ liệu về các cuộc gọi đến và gọi đi. Các ứng dụng độc hại có thể sử dụng quyền này để xóa hoặc sửa đổi nhật ký cuộc gọi của bạn."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"đọc d.liệu t.sử của bạn"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Cho phép ứng dụng đọc thông tin tiểu sử cá nhân được lưu trữ trên thiết bị, chẳng hạn như tên và thông tin liên hệ của bạn. Điều này có nghĩa là ứng dụng có thể xác định danh tính của bạn và gửi thông tin tiểu sử của bạn cho người khác."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"ghi dữ liệu t.sử của bạn"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Cho phép ứng dụng đọc bất kỳ từ, tên và cụm từ riêng nào mà người dùng có thể đã lưu trữ trong từ điển của người dùng."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"ghi vào từ điển do người dùng xác định"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Cho phép ứng dụng ghi từ mới vào từ điển của người dùng."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"đọc nội dung của bộ nhớ USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"đọc nội dung của thẻ SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Cho phép ứng dụng đọc nội dung của bộ lưu trữ USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Cho phép ứng dụng đọc nội dung của thẻ SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"sửa đổi/xóa nội dung bộ nhớ USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"sửa đổi/xóa nội dung thẻ SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Cho phép ứng dụng ghi vào bộ lưu trữ USB."</string>
diff --git a/core/res/res/values-zh-rCN/arrays.xml b/core/res/res/values-zh-rCN/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-zh-rCN/arrays.xml
rename to core/res/res/values-zh-rCN/donottranslate-maps.xml
diff --git a/core/res/res/values-zh-rCN/strings.xml b/core/res/res/values-zh-rCN/strings.xml
index 2664ad3..81d0ec6 100644
--- a/core/res/res/values-zh-rCN/strings.xml
+++ b/core/res/res/values-zh-rCN/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"写入联系数据"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"允许应用程序读取您平板电脑上存储的联系人(地址)数据。恶意应用程序可能借此清除或修改您的联系人数据。"</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"允许应用程序修改您手机上存储的联系人(地址)数据。恶意应用程序可能借此清除或修改您的联系人数据。"</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"读取通话记录"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"允许该应用读取平板电脑的通话记录,包括有关来电和外拨电话的数据。恶意应用可能会借此将您的数据发送给他人。"</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"允许该应用读取手机的通话记录,包括有关来电和外拨电话的数据。恶意应用可能会借此将您的数据发送给他人。"</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"写入通话记录"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"允许该应用修改平板电脑的通话记录,包括有关来电和外拨电话的数据。恶意应用可能会借此清除或修改您的通话记录。"</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"允许该应用修改手机的通话记录,包括有关来电和外拨电话的数据。恶意应用可能会借此清除或修改您的通话记录。"</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"读取您的个人资料数据"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"允许应用程序读取您设备上存储的个人资料信息,例如您的姓名和联系信息。这意味着应用程序可以识别您的身份,并将您的个人资料信息发送给他人。"</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"写入到您的个人资料数据"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"允许应用程序读取用户可能在用户词典中已存储的任意私有字词、名称和短语。"</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"写入用户定义的词典"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"允许应用程序向用户词典中写入新词。"</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"读取 USB 存储设备的内容"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"读取 SD 卡的内容"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"允许应用读取 USB 存储设备的内容。"</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"允许应用读取 SD 卡的内容。"</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"修改/删除 USB 存储设备内容"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"修改/删除 SD 卡中的内容"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"允许应用程序写入 USB 存储设备。"</string>
diff --git a/core/res/res/values-zh-rTW/arrays.xml b/core/res/res/values-zh-rTW/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-zh-rTW/arrays.xml
rename to core/res/res/values-zh-rTW/donottranslate-maps.xml
diff --git a/core/res/res/values-zh-rTW/strings.xml b/core/res/res/values-zh-rTW/strings.xml
index 7c8617e..e81e393 100644
--- a/core/res/res/values-zh-rTW/strings.xml
+++ b/core/res/res/values-zh-rTW/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"輸入聯絡人資料"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"允許應用程式修改平板電腦上儲存的聯絡人 (地址) 資料。請注意,惡意應用程式可能利用此功能清除或修改您的聯絡人資料。"</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"允許應用程式修改手機上儲存的聯絡人 (地址) 資料。請注意,惡意應用程式可能利用此功能清除或修改您的聯絡人資料。"</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"讀取通話紀錄"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"允許應用程式讀取平板電腦的通話紀錄,包括來電和已撥電話相關資料。請注意,惡意應用程式可能利用此功能將您的資料傳送給他人。"</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"允許應用程式讀取手機的通話紀錄,包括來電和已撥電話相關資料。請注意,惡意應用程式可能利用此功能將您的資料傳送給他人。"</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"寫入通話紀錄"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"允許應用程式修改平板電腦的通話紀錄,包括來電和已撥電話相關資料。請注意,惡意應用程式可能利用此功能刪除或修改您的通話記錄。"</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"允許應用程式修改手機的通話紀錄,包括來電和已撥電話相關資料。請注意,惡意應用程式可能利用此功能刪除或修改您的通話記錄。"</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"讀取您的個人資料"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"允許應用程式讀取裝置上儲存的個人資料,例如您的姓名和聯絡資訊。這表示應用程式可以識別您的身分,並將您的個人資料傳送給他人。"</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"寫入您的個人資料"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"允許應用程式讀取使用者儲存在使用者字典內的任何私人字詞、名稱和詞組。"</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"寫入使用者定義的字典"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"允許應用程式將新字詞寫入使用者的字典。"</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"讀取 USB 儲存裝置的內容"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"讀取 SD 卡的內容"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"允許應用程式讀取 USB 儲存裝置的內容。"</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"允許應用程式讀取 SD 卡的內容。"</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"修改/刪除 USB 儲存裝置內容"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"修改/刪除 SD 卡的內容"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"允許應用程式寫入 USB 儲存裝置。"</string>
diff --git a/core/res/res/values-zu-rZA/arrays.xml b/core/res/res/values-zu-rZA/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-zu-rZA/arrays.xml
rename to core/res/res/values-zu-rZA/donottranslate-maps.xml
diff --git a/core/res/res/values-zu/strings.xml b/core/res/res/values-zu/strings.xml
index 09777ab..f43835f 100644
--- a/core/res/res/values-zu/strings.xml
+++ b/core/res/res/values-zu/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"bhala idatha yothintana naye"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Ivumela insiza ukuthi iguqule imininingwane yekheli lokuxhumana eligcinwe ekhompyutheni yakho yepeni. Izinsiza ezinobungozi zingasebenzisa lokhu ukususa noma ziguqule ulwazi lwakho lokuxhuana."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Ivumela insiza ukuthi iguqule imininingwane yekheli lokuxhumana eligcinwe ocingweni lwakho. Izinsiza ezinobungozi zingasebenzisa lokhu ukususa noma ziguqule ulwazi lwakho lokuxhuana."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"funda irekhodi lamakholi"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Ivumela uhlelo lokusebenza ukufunda irekhodi lamakholi lethubhulethi yakho, kufaka phakathi idatha mayelana namakholi angenayo naphumayo. Izinhlelo zikusebenza ezingalungile zingasebenzisa lokhu ukuthumela idatha kwabanye abantu."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Ivumela uhlelo lokusebenza ukufunda irekhodi lamakholi akho, kufaka phakathi idatha mayelana namakholi aphumayo nangenayo. Izinhlelo zokusebenza ezingalungile zingasebenzisa lokhu ukuthumela idatha kwabanye abantu."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"bhala irekhodi lamakholi"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Ivumela uhlelo lokusebenza ukushintsha ilogi yekholi yethebulethi yakho, kufaka phakathi idatha mayelana namakholi angenayo naphumayo. Izinhlelo zikusebenza ezingalungile zingasebenzisa lokhu ukusula noma ukushintsha irekhodi lwamakholi wakho."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Ivumela uhlelo lokusebenza ukushintsha irekhodi lamakholi efoni yakho, kufaka phakathi idatha emayelana namakholi angenayo naphumayo. Izinhlelo zikusebenza ezingalungile zingasebenzisa lokhu ukusula noma ukushintsha irekhodi lwamakholi wakho."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"bhala imininingo yemininingwane yakho"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Ivumela insiza ukuthi ifunde ulwazi lomuntu lwephrofayli olugcinwe edivayisini yakho njengegama lakho kanye nemininingwane yokuxhumana nawe. Lokhu kuchaza ukuthi izinsa ingakuhlonza bese ithumelela abanye imininingwane yephrofayili yakho."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"bhala imininingwane yemininingo yakho"</string>
@@ -499,6 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Ivumela uhlelo lokusebenza ukufunda noma yimaphi amagama ayimfihlo, amagama nemisho leyo umsebenzisi ayigcine kwisichazamazwi somsebenzisi."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"bhala kwisichazamazwi esicacisiwe somsebenzisi"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Ivumela insiza ukuthi ibhale amagama amasha esichazinimazwi."</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"funda okuqukethwe kwesitoreji se-USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"funda okuqukethwe kwekhadi le-SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Ivumela uhlelo lokusebenza ukufunda okuqukethwe kokugciniwe okufinyeleleka nge-USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Ivumela uhlelo lokusebenza ukufunda okuqukethwe kwekhadi le-SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"guqula/susa okuqukethwe isitoreji se-USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"guqula/susa okuqukethwe kwekhadi le-SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Ivumela insiza ukuthi ibhalele ekulondolozweni kwe-USB."</string>
diff --git a/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml
index ce734fc..90ddc4b 100644
--- a/core/res/res/values/arrays.xml
+++ b/core/res/res/values/arrays.xml
@@ -338,16 +338,6 @@
<item>#ffffffff</item>
</array>
- <!-- Do not translate. -->
- <integer-array name="maps_starting_lat_lng">
- <item>36149777</item>
- <item>-95993398</item>
- </integer-array>
- <!-- Do not translate. -->
- <integer-array name="maps_starting_zoom">
- <item>3</item>
- </integer-array>
-
<!-- Used in LocalePicker -->
<string-array translatable="false" name="special_locale_codes">
<item>zh_CN</item>
diff --git a/core/res/res/values/donottranslate-maps.xml b/core/res/res/values/donottranslate-maps.xml
new file mode 100644
index 0000000..ee32f01
--- /dev/null
+++ b/core/res/res/values/donottranslate-maps.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/colors.xml
+**
+** 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.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- Do not translate. -->
+ <integer-array name="maps_starting_lat_lng">
+ <item>36149777</item>
+ <item>-95993398</item>
+ </integer-array>
+ <!-- Do not translate. -->
+ <integer-array name="maps_starting_zoom">
+ <item>3</item>
+ </integer-array>
+
+</resources>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index a089021..ea1a70a 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -974,6 +974,9 @@
<java-symbol type="drawable" name="unlock_halo" />
<java-symbol type="drawable" name="unlock_ring" />
<java-symbol type="drawable" name="unlock_wave" />
+ <java-symbol type="drawable" name="ic_lockscreen_camera" />
+ <java-symbol type="drawable" name="ic_lockscreen_silent" />
+ <java-symbol type="drawable" name="ic_lockscreen_unlock" />
<java-symbol type="layout" name="action_bar_home" />
<java-symbol type="layout" name="action_bar_title_item" />
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 7137b7c..7799f74 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -942,6 +942,26 @@
contact (address) data stored on your phone. Malicious
apps may use this to erase or modify your contact data.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_readCallLog">read call log</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_readCallLog" product="tablet">Allows the app to read your tablet\'s call log, including data about incoming and outgoing calls.
+ Malicious apps may use this to send your data to other people.</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_readCallLog" product="default">Allows the app to read your phone\'s call log, including data about incoming and outgoing calls.
+ Malicious apps may use this to send your data to other people.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_writeCallLog">write call log</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_writeCallLog" product="tablet">Allows the app to modify your tablet\'s call log, including data about incoming and outgoing calls.
+ Malicious apps may use this to erase or modify your call log.</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_writeCallLog" product="default">Allows the app to modify your phone\'s call log, including data about incoming and outgoing calls.
+ Malicious apps may use this to erase or modify your call log.</string>
+
+
<!-- Title of the read profile permission, listed so the user can decide whether to allow the application to read the user's personal profile data. [CHAR LIMIT=30] -->
<string name="permlab_readProfile">read your profile data</string>
<!-- Description of the read profile permission, listed so the user can decide whether to allow the application to read the user's personal profile data. [CHAR LIMIT=NONE] -->
diff --git a/core/tests/coretests/src/android/util/LocaleUtilTest.java b/core/tests/coretests/src/android/util/LocaleUtilTest.java
deleted file mode 100644
index 0ca6043..0000000
--- a/core/tests/coretests/src/android/util/LocaleUtilTest.java
+++ /dev/null
@@ -1,200 +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 android.util;
-
-import java.util.Locale;
-
-import android.test.AndroidTestCase;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-
-import static android.view.View.LAYOUT_DIRECTION_LTR;
-import static android.view.View.LAYOUT_DIRECTION_RTL;
-
-public class LocaleUtilTest extends AndroidTestCase {
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getLayoutDirectionFromLocale",
- args = {Locale.class}
- )
- public void testGetLayoutDirectionFromLocale() {
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(null));
-
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.ENGLISH));
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.CANADA));
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.CANADA_FRENCH));
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.FRANCE));
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.FRENCH));
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.GERMAN));
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.GERMANY));
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.ITALIAN));
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.ITALY));
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.UK));
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.US));
-
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.ROOT));
-
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.CHINA));
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.CHINESE));
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.JAPAN));
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.JAPANESE));
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.KOREA));
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.KOREAN));
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.PRC));
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.SIMPLIFIED_CHINESE));
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.TAIWAN));
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(Locale.TRADITIONAL_CHINESE));
-
- Locale locale = new Locale("ar");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ar", "AE");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ar", "BH");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ar", "DZ");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ar", "EG");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ar", "IQ");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ar", "JO");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ar", "KW");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ar", "LB");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ar", "LY");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ar", "MA");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ar", "OM");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ar", "QA");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ar", "SA");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ar", "SD");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ar", "SY");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ar", "TN");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ar", "YE");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
-
- locale = new Locale("fa");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("fa", "AF");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("fa", "IR");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
-
- locale = new Locale("iw");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("iw", "IL");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("he");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("he", "IL");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
-
- locale = new Locale("pa_Arab");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("pa_Arab", "PK");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
-
- locale = new Locale("ps");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ps", "AF");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
-
- locale = new Locale("ur");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ur", "IN");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("ur", "PK");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
-
- locale = new Locale("uz_Arab");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- locale = new Locale("uz_Arab", "AF");
- assertEquals(LAYOUT_DIRECTION_RTL,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
-
- // Locale without a real language
- locale = new Locale("zz");
- assertEquals(LAYOUT_DIRECTION_LTR,
- LocaleUtil.getLayoutDirectionFromLocale(locale));
- }
-}
diff --git a/core/tests/coretests/src/com/android/internal/util/BitwiseStreamsTest.java b/core/tests/coretests/src/com/android/internal/util/BitwiseStreamsTest.java
index a304b68..306f58f 100644
--- a/core/tests/coretests/src/com/android/internal/util/BitwiseStreamsTest.java
+++ b/core/tests/coretests/src/com/android/internal/util/BitwiseStreamsTest.java
@@ -133,4 +133,25 @@
long end = android.os.SystemClock.elapsedRealtime();
Log.d(LOG_TAG, "repeated encode-decode took " + (end - start) + " ms");
}
+
+ @SmallTest
+ public void testExpandArray() throws Exception {
+ Random random = new Random();
+ int iterations = 10000;
+ int[] sizeArr = new int[iterations];
+ int[] valueArr = new int[iterations];
+ BitwiseOutputStream outStream = new BitwiseOutputStream(8);
+ for (int i = 0; i < iterations; i++) {
+ int x = random.nextInt();
+ int size = (x & 0x07) + 1;
+ int value = x & (-1 >>> (32 - size));
+ sizeArr[i] = size;
+ valueArr[i] = value;
+ outStream.write(size, value);
+ }
+ BitwiseInputStream inStream = new BitwiseInputStream(outStream.toByteArray());
+ for (int i = 0; i < iterations; i++) {
+ assertEquals(valueArr[i], inStream.read(sizeArr[i]));
+ }
+ }
}
diff --git a/data/fonts/fallback_fonts.xml b/data/fonts/fallback_fonts.xml
index 51b07e4..63b3a58 100644
--- a/data/fonts/fallback_fonts.xml
+++ b/data/fonts/fallback_fonts.xml
@@ -21,6 +21,15 @@
fallback fonts. That file can also specify the order in which the fallback fonts should be
searched, to ensure that a vendor-provided font will be used before another fallback font
which happens to handle the same glyph.
+
+ Han languages (Chinese, Japanese, and Korean) share a common range of unicode characters;
+ their ordering in the fallback or vendor files gives priority to the first in the list.
+ Locale-specific ordering can be configured by adding language and region codes to the end
+ of the filename (e.g. /system/etc/fallback_fonts-ja.xml). When no region code is used,
+ as with this example, all regions are matched. Use separate files for each supported locale.
+ The standard fallback file (fallback_fonts.xml) is used when a locale does not have its own
+ file. All fallback files must contain the same complete set of fonts; only their ordering
+ can differ.
-->
<familyset>
<family>
diff --git a/data/fonts/vendor_fonts.xml b/data/fonts/vendor_fonts.xml
index fe51fd27..c1116d0 100644
--- a/data/fonts/vendor_fonts.xml
+++ b/data/fonts/vendor_fonts.xml
@@ -25,6 +25,15 @@
place in the overall fallback fonts. The order of this list determines which fallback font
will be used to support any glyphs that are not handled by the default system fonts.
+ Han languages (Chinese, Japanese, and Korean) share a common range of unicode characters;
+ their ordering in the fallback or vendor files gives priority to the first in the list.
+ Locale-specific ordering can be configured by adding language and region codes to the end
+ of the filename (e.g. /system/etc/fallback_fonts-ja.xml). When no region code is used,
+ as with this example, all regions are matched. Use separate files for each supported locale.
+ The standard fallback file (fallback_fonts.xml) is used when a locale does not have its own
+ file. All fallback files must contain the same complete set of fonts; only their ordering
+ can differ.
+
The sample configuration below is an example of how one might provide two families of fonts
that get inserted at the first and second (0 and 1) position in the overall fallback fonts.
diff --git a/docs/html/guide/developing/device.jd b/docs/html/guide/developing/device.jd
index d22dca1..d91551a 100644
--- a/docs/html/guide/developing/device.jd
+++ b/docs/html/guide/developing/device.jd
@@ -134,11 +134,11 @@
</tr>
<tr>
<td>ASUS</td>
- <td><code>0B05</code></td>
+ <td><code>0b05</code></td>
</tr>
<tr>
<td>Dell</td>
- <td><code>413C</code></td>
+ <td><code>413c</code></td>
</tr>
<tr>
<td>Foxconn</td>
@@ -146,35 +146,35 @@
</tr>
<tr>
<td>Fujitsu</td>
- <td><code>04C5</code></td>
+ <td><code>04c5</code></td>
</tr>
<tr>
<td>Fujitsu Toshiba</td>
- <td><code>04C5</code></td>
+ <td><code>04c5</code></td>
</tr>
<tr>
<td>Garmin-Asus</td>
- <td><code>091E</code></td>
+ <td><code>091e</code></td>
</tr>
<tr>
<td>Google</td>
- <td><code>18D1</code></td>
+ <td><code>18d1</code></td>
</tr>
<tr>
<td>Hisense</td>
- <td><code>109B</code></td>
+ <td><code>109b</code></td>
</tr>
<tr>
<td>HTC</td>
- <td><code>0BB4</code></td>
+ <td><code>0bb4</code></td>
</tr>
<tr>
<td>Huawei</td>
- <td><code>12D1</code></td>
+ <td><code>12d1</code></td>
</tr>
<tr>
<td>K-Touch</td>
- <td><code>24E3</code></td>
+ <td><code>24e3</code></td>
</tr>
<tr>
<td>KT Tech</td>
@@ -185,8 +185,8 @@
<td><code>0482</code></td>
</tr>
<tr>
- <td>Lenevo</td>
- <td><code>17EF</code></td>
+ <td>Lenovo</td>
+ <td><code>17ef</code></td>
</tr>
<tr>
<td>LG</td>
@@ -194,7 +194,7 @@
</tr>
<tr>
<td>Motorola</td>
- <td><code>22B8</code></td>
+ <td><code>22b8</code></td>
</tr>
<tr>
<td>NEC</td>
@@ -214,11 +214,11 @@
</tr>
<tr>
<td>Pantech</td>
- <td><code>10A9</code></td>
+ <td><code>10a9</code></td>
</tr>
<tr>
<td>Pegatron</td>
- <td><code>1D4D</code></td>
+ <td><code>1d4d</code></td>
</tr>
<tr>
<td>Philips</td>
@@ -226,31 +226,31 @@
</tr>
<tr>
<td>PMC-Sierra</td>
- <td><code>04DA</code></td>
+ <td><code>04da</code></td>
</tr>
<tr>
<td>Qualcomm</td>
- <td><code>05C6</code></td>
+ <td><code>05c6</code></td>
</tr>
<tr>
<td>SK Telesys</td>
- <td><code>1F53</code></td>
+ <td><code>1f53</code></td>
</tr>
<tr>
<td>Samsung</td>
- <td><code>04E8</code></td>
+ <td><code>04e8</code></td>
</tr>
<tr>
<td>Sharp</td>
- <td><code>04DD</code></td>
+ <td><code>04dd</code></td>
</tr>
<tr>
<td>Sony</td>
- <td><code>054C</code></td>
+ <td><code>054c</code></td>
</tr>
<tr>
<td>Sony Ericsson</td>
- <td><code>0FCE</code></td>
+ <td><code>0fce</code></td>
</tr>
<tr>
<td>Teleepoch</td>
@@ -262,6 +262,6 @@
</tr>
<tr>
<td>ZTE</td>
- <td><code>19D2</code></td>
+ <td><code>19d2</code></td>
</tr>
</table>
diff --git a/docs/html/guide/developing/devices/emulator.jd b/docs/html/guide/developing/devices/emulator.jd
index c217790..5edd1f5 100644
--- a/docs/html/guide/developing/devices/emulator.jd
+++ b/docs/html/guide/developing/devices/emulator.jd
@@ -9,28 +9,58 @@
<h2>In this document</h2>
<ol>
<li><a href="#overview">Overview</a></li>
+ <li><a href="#avds">Android Virtual Devices and the Emulator</a></li>
<li><a href="#starting">Starting and Stopping the Emulator</a></li>
- <li><a href="#starting">Android Virtual Devices and the Emulator</a></li>
- <li><a href="#controlling">Controlling the Emulator</a></li>
- <li><a href="#startup-options">Emulator Startup Options</a></li>
+ <li><a href="#apps">Installing Applications on the Emulator</a></li>
+ <li><a href="#acceleration">Using Hardware Acceleration</a>
+ <ol>
+ <li><a href="#accel-graphics">Configuring Graphics Acceleration</a></li>
+ <li><a href="#accel-vm">Configuring Virtual Machine Acceleration</a></li>
+ </ol>
+ </li>
+ <li><a href="#sdcard">SD Card Emulation</a>
+ <ol>
+ <li><a href="#sdcard-creating">Creating an SD card image</a></li>
+ <li><a href="#sdcard-files">Copying files to an SD card image</a></li>
+ <li><a href="#sdcard-loading">Loading an SD card image</a></li>
+ </ol>
+ </li>
<li><a href="#diskimages">Working with Emulator Disk Images</a>
<ol>
- <li><a href="#defaultimages">Default Images</a></li>
- <li><a href="#runtimeimages">Runtime Images: User Data and SD Card</a></li>
- <li><a href="#temporaryimages">Temporary Images</a></li>
+ <li><a href="#defaultimages">Default image files</a></li>
+ <li><a href="#runtimeimages">Runtime images: user data and SD card</a></li>
+ <li><a href="#temporaryimages">Temporary images</a></li>
</ol>
</li>
<li><a href="#emulatornetworking">Emulator Networking</a>
<ol>
<li><a href="#networkaddresses">Network Address Space</a></li>
<li><a href="#networkinglimitations">Local Networking Limitations</a></li>
- <li><a href="#redirections">Using Network Redirections</a></li>
+ <li><a href="#redirection">Using Network Redirection</a></li>
<li><a href="#dns">Configuring the Emulator's DNS Settings</a></li>
<li><a href="#proxy">Using the Emulator with a Proxy</a></li>
<li><a href="#connecting">Interconnecting Emulator Instances</a></li>
<li><a href="#calling">Sending a Voice Call or SMS to Another Emulator Instance</a></li>
</ol>
</li>
+ <li><a href="#console">Using the Emulator Console</a>
+ <ol>
+ <li><a href="#portredirection">Port Redirection</a></li>
+ <li><a href="#geo">Geo Location Provider Emulation</a></li>
+ <li><a href="#events">Hardware Events Emulation</a></li>
+ <li><a href="#power">Device Power Characteristics</a></li>
+ <li><a href="#netstatus">Network Status</a></li>
+ <li><a href="#netdelay">Network Delay Emulation</a></li>
+ <li><a href="#netspeed">Network Speed Emulation</a></li>
+ <li><a href="#telephony">Telephony Emulation</a></li>
+ <li><a href="#sms">SMS Emulation</a></li>
+ <li><a href="#vm">VM State</a></li>
+ <li><a href="#window">Emulator Window</a></li>
+ <li><a href="#terminating">Terminating an Emulator Instance</a></li>
+ </ol>
+ </li>
+ <li><a href="#limitations">Emulator Limitations</a></li>
+ <li><a href="#troubleshooting">Troubleshooting Emulator Problems</a></li>
</ol>
<h2>See also</h2>
@@ -44,7 +74,7 @@
<img src="{@docRoot}images/emulator-wvga800l.png" alt="Image of the Android Emulator"
width="367" height="349" style="margin-left:2em;float:right;"/>
<p>The Android SDK includes a virtual mobile device emulator
-that runs on your computer. The emulator lets you prototype, develop, and test
+that runs on your computer. The emulator lets you prototype, develop and test
Android applications without using a physical device. </p>
<p>The Android emulator mimics all of the hardware and software features
@@ -52,7 +82,7 @@
calls. It provides a variety of navigation and control keys, which you can "press"
using your mouse or keyboard to generate events for your application. It also
provides a screen in which your application is displayed, together with any other
-Android applications running. </p>
+active Android applications. </p>
<p>To let you model and test your application more easily, the emulator utilizes
Android Virtual Device (AVD) configurations. AVDs let you define certain hardware
@@ -62,16 +92,16 @@
applications, access the network, play audio and video, store and retrieve data,
notify the user, and render graphical transitions and themes. </p>
-<p>The emulator also includes a variety of debug capabilities, such as a console
-from which you can log kernel output, simulate application interrupts (such as
-arriving SMS messages or phone calls), and simulate latency effects and dropouts
-on the data channel.</p>
+<p>The emulator also includes a variety of debug capabilities, such as a console
+from which you can log kernel output, simulate application interrupts (such as
+arriving SMS messages or phone calls), and simulate latency effects and dropouts
+on the data network.</p>
-<h2 id="overview">Overview</h2>
+<h2 id="overview">Overview</h2>
-<p>The Android emulator is a QEMU-based application that provides a virtual ARM
+<p>The Android emulator is an application that provides a virtual
mobile device on which you can run your Android applications. It runs a full
Android system stack, down to the kernel level, that includes a set of
preinstalled applications (such as the dialer) that you can access from your
@@ -81,16 +111,15 @@
you can use a variety of commands and options to control its behavior.
</p>
-<p>The Android system image distributed in the SDK contains ARM machine code for
-the Android Linux kernel, the native libraries, the Dalvik VM, and the various
-Android package files (such as for for the Android framework and preinstalled
-applications). The emulator's QEMU layers provide dynamic binary translation of
-the ARM machine code to the OS and processor architecture of your development
-machine. </p>
+<p>The Android system images available through the Android SDK Manager contain
+code for the Android Linux kernel, the native libraries, the Dalvik VM, and the
+various Android packages (such as the Android framework and preinstalled
+applications). The emulator provides dynamic binary translation of device
+machine code to the OS and processor architecture of your development
+machine.</p>
-<p>Adding custom capabilities to the underlying QEMU services, the Android
-emulator supports many hardware features likely to be found on mobile devices,
-including: </p>
+<p>The Android emulator supports many hardware features likely to be found on
+mobile devices, including: </p>
<ul>
<li>An ARMv5 CPU and the corresponding memory-management unit (MMU)</li>
@@ -101,41 +130,37 @@
<li>Flash memory partitions (emulated through disk image files on the
development machine)</li>
<li>A GSM modem, including a simulated SIM Card</li>
+ <li>A camera, using a webcam connected to your development computer.</li>
+ <li>Sensors like an accelerometer, using data from a USB-connected Android device.</li>
</ul>
-<p>The sections below provide more information about the emulator and how to use
-it for developing Android applications.</p>
+<p>The following sections describe the emulator and its use for development of Android
+applications in more detail.</p>
-<a name="avds"></a>
-
-<h2>Android Virtual Devices and the Emulator</h2>
+<h2 id="avds">Android Virtual Devices and the Emulator</h2>
<p>To use the emulator, you first must create one or more AVD configurations. In each
configuration, you specify an Android platform to run in the emulator and the set of hardware
options and emulator skin you want to use. Then, when you launch the emulator, you specify
the AVD configuration that you want to load. </p>
-<p>To specify the AVD you want to load when starting the emulator, you use the
-<code>-avd</code> argument, as shown in the previous section. </p>
-
<p>Each AVD functions as an independent device, with its own private storage for
user data, SD card, and so on. When you launch the emulator with an AVD configuration,
it automatically loads the user data and SD card data from the AVD directory. By default,
the emulator stores the user data, SD card data, and cache in the AVD directory.</p>
<p>To create and manage AVDs you use the AVD Manager UI or the <code>android</code> tool
-that is included in the SDK.
+that is included in the SDK.
For complete information about how to set up AVDs, see <a
href="{@docRoot}guide/developing/devices/index.html">Managing Virtual Devices</a>.</p>
-<a name="starting"></a>
-<h2>Starting and Stopping the Emulator</h2>
+<h2 id="starting">Starting and Stopping the Emulator</h2>
<p>During development and testing of your application, you install and run your
application in the Android emulator. You can launch the emulator as a standalone
-application, from a command line, or you can use it as part of your Eclipse
+application from a command line, or you can run it from within your Eclipse
development environment. In either case, you specify the AVD configuration to
load and any startup options you want to use, as described in this document.
</p>
@@ -144,20 +169,24 @@
depending on your needs, you can start multiple emulator instances and run your
application in more than one emulated device. You can use the emulator's
built-in commands to simulate GSM phone calling or SMS between emulator
-instances, and you can set up network redirections that allow emulators to send
+instances, and you can set up network redirection that allows emulators to send
data to one another. For more information, see <a href="#telephony">Telephony
Emulation</a>, <a href="#sms">SMS Emulation</a>, and
<a href="#emulatornetworking">Emulator Networking</a></p>
-<p>To start an instance of the emulator from the command line, change to the
+<p>To start an instance of the emulator from the command line, navigate to the
<code>tools/</code> folder of the SDK. Enter <code>emulator</code> command
like this: </p>
-<pre>emulator -avd <avd_name></pre>
+<pre>emulator -avd <avd_name> [<options>]</pre>
-<p>This initializes the emulator and loads an AVD configuration (see the next
-section for more information about AVDs). You will see the emulator window
-appear on your screen. </p>
+<p>This initializes the emulator, loads an AVD configuration and displays the emulator
+window. For more information about command line options for the emulator, see the
+<a href="{@docRoot}guide/developing/tools/emulator.html">Android Emulator</a> tool reference.</p>
+
+<p class="note"><strong>Note:</strong> You can run multiple
+instances of the emulator concurrently, each with its own AVD configuration and
+storage area for user data, SD card, and so on.</p>
<p>If you are working in Eclipse, the ADT plugin for Eclipse installs your
application and starts the emulator automatically, when you run or debug
@@ -171,585 +200,435 @@
<p>To stop an emulator instance, just close the emulator's window.</p>
<p>For a reference of the emulator's startup commands and keyboard mapping, see
-the <a href="{@docRoot}guide/developing/tools/emulator.html">Android Emulator</a> document.</p>
+the <a href="{@docRoot}guide/developing/tools/emulator.html">Android Emulator</a> tool
+reference.</p>
+<h2 id="apps">Installing Applications on the Emulator</h2>
+
+<p>If you don't have access to Eclipse or the ADT Plugin, you can install your application on the
+emulator using the <a href="{@docRoot}guide/developing/tools/adb.html#move">adb</a> utility. Before
+installing the application, you need to build and package it into an <code>.apk</code> as described
+in <a href="{@docRoot}guide/developing/building/index.html">Building and
+Running Apps</a>. Once the application is installed, you can start the emulator from the command
+line as described previously, using any startup options necessary.
+When the emulator is running, you can also connect to the emulator instance's
+<a href="#console">console</a> to issue commands as needed.</p>
+
+<p>As you update your code, you periodically package and install it on the emulator.
+The emulator preserves the application and its state data across restarts,
+in a user-data disk partition. To ensure that the application runs properly
+as you update it, you may need to delete the emulator's user-data partition.
+To do so, start the emulator with the <code>-wipe-data</code> option.
+For more information about the user-data partition and other emulator storage,
+see <a href="#diskimages">Working with Emulator Disk Images</a>.</p>
+<h2 id="acceleration">Using Hardware Acceleration</h2>
-<a name="controlling"></a>
+<p>In order to make the Android emulator run faster and be more responsive, you can configure it to
+take advantage of hardware acceleration, using a combination of configuration options, specific
+Android system images and hardware drivers.</p>
-<h2>Controlling the Emulator</h2>
+<h3 id="accel-graphics">Configuring Graphics Acceleration</h3>
-<p>You can use emulator <a href="#startup-options">startup options</a> and <a
-href="#console">console commands</a> to control the behaviors and
-characteristics of the emulated environment itself.
+<p class="caution"><strong>Caution:</strong> As of SDK Tools Revision 17, the graphics
+acceleration feature for the emulator is experimental; be alert for incompatibilities and
+errors when using this feature. </p>
+
+<p>Graphics acceleration for the emulator takes advantage of your development computer's graphics
+hardware, specifically its graphics processing unit (GPU), to make screen drawing faster. To use
+the graphics acceleration feature, you must have the following versions of the Android development
+tools installed:</p>
+
+<ul>
+ <li>Android SDK Tools, Revision 17 or higher</li>
+ <li>Android SDK Platform API 15, Revision 3 or higher</li>
+</ul>
+
+<p>Use the <a href="{@docRoot}sdk/installing.html#AddingComponents">Android SDK
+Manager</a> to install these components:</p>
+
+<p class="note"><strong>Note:</strong> Not all applications are compatible with graphics hardware
+acceleration. In particular, the Browser application and applications using the {@link
+android.webkit.WebView} component are not compatible with graphics acceleration.</p>
+
+<p>To configure an AVD to use graphics acceleration:</p>
+
+<ol>
+ <li>Make sure you have the required SDK components installed (listed above).</li>
+ <li>Start the AVD Manager and create a new AVD with the <strong>Target</strong> value of
+<strong>Android 4.0.3 (API Level 15)</strong>, revision 3 or higher.</li>
+ <li>If you want to have graphics acceleration enabled by default for this AVD, in the
+<strong>Hardware</strong> section, click <strong>New</strong>, select <strong>GPU emulation</strong>
+and set the value to <strong>Yes</strong>.
+ <p class="note"><strong>Note:</strong> You can also enable graphics acceleration when you
+start an emulator using command line options as describe in the next section.</p>
+ </li>
+ <li>Name the AVD instance and select any other configuration options.
+ <p class="caution"><strong>Caution:</strong> Do not select the <strong>Snapshot: Enabled</strong>
+option. Snapshots are not supported for emulators with graphics acceleration enabled.</p>
+ </li>
+ <li>Click <strong>Create AVD</strong> to save the emulator configuration.</li>
+</ol>
+
+<p>If you set <strong>GPU emulation</strong> to <strong>Yes</strong> for your AVD, then graphics
+acceleration is automatically enabled when you run it. If you did not enable <strong>GPU
+emulation</strong> when you created the AVD, you can still enable it at runtime.</p>
+
+<p>To enable graphics acceleration at runtime for an AVD:</p>
+
+<ul>
+ <li>If you are running the emulator from the command line, just include the {@code -gpu on}
+option:
+<pre>emulator -avd <avd_name> -gpu on</pre>
+ <p class="note"><strong>Note:</strong> You must specify an AVD configuration that uses
+Android 4.0.3 (API Level 15, revision 3) or higher system image target. Graphics acceleration is not
+available for earlier system images.</p>
+ </li>
+ <li>If you are running the emulator from Eclipse, run your Android application using an AVD with
+the {@code -gpu on} option enabled:
+ <ol>
+ <li>In Eclipse, click your Android project folder and then select <strong>Run > Run
+Configurations...</strong></li>
+ <li>In the left panel of the <strong>Run Configurations</strong> dialog, select your Android
+project run configuration or create a new configuration.</li>
+ <li>Click the <strong>Target</strong> tab.</li>
+ <li>Select the AVD you created in the previous procedure.</li>
+ <li>In the <strong>Additional Emulator Command Line Options</strong> field, enter:<br>
+ {@code -gpu on}</li>
+ <li>Run your Android project using this run configuration.</li>
+ </ol>
+ </li>
+</ul>
+
+
+<h3 id="accel-vm">Configuring Virtual Machine Acceleration</h2>
+
+<p class="caution"><strong>Caution:</strong> As of SDK Tools Revision 17, the virtual machine
+acceleration feature for the emulator is experimental; be alert for incompatibilities and errors
+when using this feature.</p>
+
+<p>Many modern CPUs provide extensions for running virtual machines (VMs) more efficiently. Taking
+advantage of these extensions with the Android emulator requires some additional configuration of
+your development system, but can significantly improve the execution speed. Before attempting to use
+this type of acceleration, you should first determine if your development system’s CPU supports one
+of the following virtualization extensions technologies:</p>
+
+<ul>
+ <li>Intel Virtualization Technology (VT, VT-x, vmx) extensions</li>
+ <li>AMD Virtualization (AMD-V, SVM) extensions (only supported for Linux)</li>
+</ul>
+
+<p>The specifications from the manufacturer of your CPU should indicate if it supports
+virtualization extensions. If your CPU does not support one of these virtualization technologies,
+then you cannot use virtual machine acceleration.</p>
+
+<p class="note"><strong>Note:</strong> Virtualization extensions are typically enabled through
+your computer's BIOS and are frequently turned off by default. Check the documentation for your
+system's motherboard to find out how to enable virtualization extensions.</p>
+
+<p>Once you have determined that your CPU supports virtualization extensions, make sure you can work
+within these additional requirements of running an emulator inside an accelerated virtual
+machine:</p>
+
+<ul>
+ <li><strong>x86 AVD Only</strong> - You must use an AVD that is uses an x86 system image target.
+AVDs that use ARM-based system images cannot be accelerated using the emulator configurations
+described here.</li>
+ <li><strong>Not Inside a VM</strong> - You cannot run a VM-accelerated emulator inside another
+virtual machine, such as a VirtualBox or VMWare-hosted virtual machine. You must run the emulator
+directly on your system hardware.</li>
+ <li><strong>Other VM Drivers</strong> - If you are running another virtualization technology on
+your system such as VirtualBox or VMWare, you may need to unload the driver for that virtual machine
+hosting software before running an accelerated emulator.</li>
+ <li><strong>OpenGL® Graphics</strong> - Emulation of OpenGL ES graphics may not perform at the
+same level as an actual device.</li>
+</ul>
+
+<p>To use virtual machine acceleration with the emulator, you need the following version of Android
+development tools. Use the <a href="{@docRoot}sdk/installing.html#AddingComponents">Android SDK
+Manager</a> to install these components:</p>
+
+<ul>
+ <li>Android SDK Tools, Revision 17 or higher</li>
+ <li>Android x86-based system image</li>
+</ul>
+
+<p>If your development environment meets all of the requirements for running a VM-accelerated
+emulator, you can use the AVD Manager to create an x86-based AVD configuration:</p>
+
+<ol>
+ <li>In the Android SDK Manager, make sure you have an x86-based <strong>System Image</strong>
+ installed for your target Android version. If you do not have an x86 <strong>System
+ Image</strong> installed, select one in the Android SDK Manager and install it.
+ <p class="note"><strong>Tip:</strong> System images are listed under each API Level in the SDK
+ Manager. An x86 system image may not be available for all API levels.</p>
+ </li>
+ <li>Start the AVD Manager and create a new AVD with an x86 value for the
+<strong>CPU/ABI</strong> field. You may need to select a specific <strong>Target</strong> value, or
+select a <strong>Target</strong> value and then select a specific <strong>CPU/ABI</strong>
+option.</li>
+ <li>Name the emulator instance and select any other configuration options.</li>
+ <li>Click <strong>Create AVD</strong> to save the emulator configuration.</li>
+</ol>
+
+<h4 id="vm-windows">Configuring VM Acceleration on Windows</h4>
+
+<p>Virtual machine acceleration for Windows requires the installation of the Intel Hardware
+Accelerated Execution Manager (Intel HAXM). The software requires an Intel CPU with
+Virtualization Technology (VT) support and one of the following operating systems:</p>
+
+<ul>
+ <li>Windows 7 (32/64-bit)</li>
+ <li>Windows Vista (32/64-bit)</li>
+ <li>Windows XP (32-bit only)</li>
+</ul>
+
+<p>To install the virtualization driver:</p>
+
+<ol>
+ <li>Start the Android SDK Manager, select <strong>Extras</strong> and then select <strong>Intel
+Hardware Accelerated Execution Manager</strong>.</li>
+ <li>After the download completes, execute {@code
+<sdk>/extras/intel/Hardware_Accelerated_Execution_Manager/IntelHAXM.exe}.</li>
+ <li>Follow the on-screen instructions to complete installation.</li>
+ <li>After installation completes, confirm that the virtualization driver is operating correctly by
+opening a command prompt window and running the following command:
+ <pre>sc query intelhaxm</pre>
+ <p>You should see a status message including the following information:</p>
+<pre>
+SERVICE_NAME: intelhaxm
+ ...
+ STATE : 4 RUNNING
+ ...
+</pre>
+ </li>
+</ol>
+
+<p>To run an x86-based emulator with VM acceleration:</p>
+<ul>
+ <li>If you are running the emulator from the command line, just specify an x86-based AVD:
+<pre>emulator -avd <avd_name></pre>
+ <p class="note"><strong>Note:</strong> You must provide an x86-based AVD configuration
+name, otherwise VM acceleration will not be enabled.</p>
+ </li>
+ <li>If you are running the emulator from Eclipse, run your Android application with an x86-based
+AVD:
+ <ol>
+ <li>In Eclipse, click your Android project folder and then select <strong>Run > Run
+Configurations...</strong></li>
+ <li>In the left panel of the <strong>Run Configurations</strong> dialog, select your Android
+project run configuration or create a new configuration.</li>
+ <li>Click the <strong>Target</strong> tab.</li>
+ <li>Select the x86-based AVD you created previously.</li>
+ <li>Run your Android project using this run configuration.</li>
+ </ol>
+ </li>
+</ul>
+
+<p>You can adjust the amount of memory available to the Intel HAXM kernel extension by re-running
+its installer.</p>
+
+<p>You can stop using the virtualization driver by uninstalling it. Re-run the installer or use
+the Control Panel to remove the software.</p>
+
+
+<h4 id="vm-mac">Configuring VM Acceleration on Mac</h4>
+
+<p>Virtual machine acceleration on a Mac requires the installation of the Intel Hardware Accelerated
+Execution Manager (Intel HAXM) kernel extension to allow the Android emulator to make use of CPU
+virtualization extensions. The kernel extension is compatible with Mac OS X Snow Leopard (version
+10.6.0) and higher.</p>
+
+<p>To install the Intel HAXM kernel extension:</p>
+
+<ol>
+ <li>Start the Android SDK Manager, select <strong>Extras</strong> and then select <strong>Intel
+Hardware Accelerated Execution Manager</strong>.
+ <li>After the download completes, execute
+ {@code <sdk>/extras/intel/Hardware_Accelerated_Execution_Manager/IntelHAXM.dmg}.</li>
+ <li>Double click the <strong>IntelHAXM.mpkg</strong> icon to begin installation.</li>
+ <li>Follow the on-screen instructions to complete installation.</li>
+ <li>After installation completes, confirm that the new kernel extension is operating correctly by
+opening a terminal window and running the following command:
+ <pre>kextstat | grep intel</pre>
+ <p>You should see a status message containing the following extension name, indicating that the
+ kernel extension is loaded:</p>
+ <pre>com.intel.kext.intelhaxm</pre>
+ </li>
+</ol>
+
+<p>To run an x86-based emulator with VM acceleration:</p>
+<ul>
+ <li>If you are running the emulator from the command line, just specify an x86-based AVD:
+<pre>emulator -avd <avd_name></pre>
+ <p class="note"><strong>Note:</strong> You must provide an x86-based AVD configuration
+name, otherwise VM acceleration will not be enabled.</p>
+ </li>
+ <li>If you are running the emulator from Eclipse, run your Android application with an x86-based
+AVD:
+ <ol>
+ <li>In Eclipse, click your Android project folder and then select <strong>Run > Run
+Configurations...</strong></li>
+ <li>In the left panel of the <strong>Run Configurations</strong> dialog, select your Android
+project run configuration or create a new configuration.</li>
+ <li>Click the <strong>Target</strong> tab.</li>
+ <li>Select the x86-based AVD you created previously.</li>
+ <li>Run your Android project using this run configuration.</li>
+ </ol>
+ </li>
+</ul>
+
+<p>You can adjust the amount of memory available to the Intel HAXM kernel extension by re-running
+the installer.</p>
+
+<p>You can stop using the virtualization kernel driver by uninstalling it. Before removing it, shut
+down any running x86 emulators. To unload the virtualization kernel driver, run the following
+command in a terminal window:</p>
+
+<pre>sudo /System/Library/Extensions/intelhaxm.kext/Contents/Resources/uninstall.sh</pre>
+
+<h4 id="vm-linux">Configuring VM Acceleration on Linux</h4>
+
+<p>Linux-based systems support virtual machine acceleration through the KVM software package. Follow
+<a href="https://www.google.com/?q=kvm+installation">instructions for installing KVM</a> on your
+Linux system, and verify that KVM is enabled. In addition to following the installation
+instructions, be aware of these configuration requirements:</p>
+
+<ul>
+ <li>Running KVM requires specific user permissions, make sure you have sufficient permissions
+according to the KVM installation instructions.</li>
+ <li>If you use another virtualization technology in your Linux platform, unload its kernel driver
+before running the x86 emulator. For example, the VirtualBox driver program is {@code vboxdrv}.</li>
+</ul>
+
+<p>To run an x86-based emulator with VM acceleration:</p>
+
+<ul>
+ <li>If you are running the emulator from the command line, start the emulator with an x86-based
+AVD and include the KVM options:
+<pre>emulator -avd <avd_name> -qemu -m 512 -enable-kvm</pre>
+ <p class="note"><strong>Note:</strong> You must provide an x86-based AVD configuration
+name, otherwise VM acceleration will not be enabled.</p>
+ </li>
+ <li>If you are running the emulator from Eclipse, run your Android application with an x86-based
+AVD and include the KVM options:
+ <ol>
+ <li>In Eclipse, click your Android project folder and then select <strong>Run > Run
+Configurations...</strong></li>
+ <li>In the left panel of the <strong>Run Configurations</strong> dialog, select your Android
+project run configuration or create a new configuration.</li>
+ <li>Click the <strong>Target</strong> tab.</li>
+ <li>Select the x86-based AVD you created previously.</li>
+ <li>In the <strong>Additional Emulator Command Line Options</strong> field, enter:
+ <pre>-qemu -m 512 -enable-kvm</pre>
+ </li>
+ <li>Run your Android project using this run configuration.</li>
+ </ol>
+ </li>
+</ul>
+
+<p class="note"><strong>Important:</strong> When using the {@code -qemu} command line option, make sure
+it is the last parameter in your command. All subsequent options are interpreted as qemu-specific
+parameters.</p>
+
+
+<h2 id="sdcard">SD Card Emulation</h2>
+
+<p>You can create a disk image and then load it to the emulator at startup, to
+simulate the presence of a user's SD card in the device. To do this, you can specify
+an SD card image when you create an AVD, or you can use the mksdcard utility included
+in the SDK.</p>
+
+<p>The following sections describe how to create an SD card disk image, how to copy
+files to it, and how to load it in the emulator at startup. </p>
+
+<p>Note that you can only load a disk image at emulator startup. Similarly, you
+can not remove a simulated SD card from a running emulator. However, you can
+browse, send files to, and copy/remove files from a simulated SD card either
+with adb or the emulator. </p>
+
+<p>The emulator supports emulated SDHC cards, so you can create an SD card image
+of any size up to 128 gigabytes.</p>
+
+
+<h3 id="sdcard-creating">Creating an SD card image</h3>
+
+<p>There are several ways of creating an SD card image. The easiest way is to use the
+<strong>AVD Manager</strong> to create a new SD card by specifying a size when you create an AVD.
+You can also use the {@code android} command line tool when creating an AVD. Just add the
+<code>-c</code> option to your command: </p>
+
+<pre>android create avd -n <avd_name> -t <targetID> -c <size>[K|M]</pre>
+
+<p>The <code>-c</code> option can also be used to to specify a path to an SD card
+image for the new AVD. For more information, see <a
+href="{@docRoot}guide/developing/devices/managing-avds-cmdline.html">Managing Virtual Devices
+from the Command Line</a>.
</p>
-<p>When the emulator is running, you can interact with the emulated mobile
-device just as you would an actual mobile device, except that you use your mouse
-pointer to "touch" the touchscreen and your keyboard keys to
-"press" the simulated device keys. </p>
+<p>You can also use the mksdcard tool, included in the SDK, to create a FAT32 disk
+image that you can load in the emulator at startup. You can access mksdcard in
+the tools/ directory of the SDK and create a disk image like this: </p>
-<p>The table below summarizes the mappings between the emulator keys and and
-the keys of your keyboard. </p>
+<pre>mksdcard <size> <file></pre>
-<table border="0" style="clear:left;">
- <tr>
- <th>Emulated Device Key </th>
- <th>Keyboard Key </th>
- </tr>
- <tr>
- <td>Home</td>
- <td>HOME</td>
- </tr>
- <tr>
- <td>Menu (left softkey)</td>
- <td>F2 <em>or</em> Page-up button</td>
- </tr>
- <tr>
- <td>Star (right softkey)</td>
- <td>Shift-F2 <em>or </em>Page Down</td>
- </tr>
- <tr>
- <td>Back</td>
- <td>ESC</td>
- </tr>
- <tr>
- <td>Call/dial button </td>
- <td>F3</td>
- </tr>
- <tr>
- <td>Hangup/end call button</td>
- <td>F4</td>
- </tr>
- <tr>
- <td>Search</td>
- <td>F5 </td>
- </tr>
- <tr>
- <td>Power button</td>
- <td>F7 </td>
- </tr>
- <tr>
- <td>Audio volume up button</td>
- <td>KEYPAD_PLUS, Ctrl-5</td>
- </tr>
+<p>For example:</p>
- <tr>
- <td>Audio volume down button</td>
- <td>KEYPAD_MINUS, Ctrl-F6</td>
- </tr>
- <tr>
- <td>Camera button</td>
- <td>Ctrl-KEYPAD_5, Ctrl-F3</td>
- </tr>
- <tr>
- <td>Switch to previous layout orientation (for example, portrait, landscape)</td>
- <td>KEYPAD_7, Ctrl-F11</td>
- </tr>
- <tr>
- <td>Switch to next layout orientation (for example, portrait, landscape)</td>
- <td>KEYPAD_9, Ctrl-F12</td>
- </tr>
- <tr>
- <td>Toggle cell networking on/off</td>
- <td>F8</td>
- </tr>
- <tr>
- <td>Toggle code profiling</td>
- <td>F9 (only with <code>-trace</code> startup option)</td>
- </tr>
- <tr>
- <td>Toggle fullscreen mode</td>
- <td>Alt-Enter</td>
- </tr>
- <tr>
- <td>Toggle trackball mode</td>
- <td>F6</td>
- </tr>
- <tr>
- <td>Enter trackball mode temporarily (while key is pressed)</td>
- <td>Delete</td>
- </tr>
- <tr>
- <td>DPad left/up/right/down</td>
- <td>KEYPAD_4/8/6/2</td>
- </tr>
- <tr>
- <td>DPad center click</td>
- <td>KEYPAD_5</td>
- </tr>
- <tr>
- <td>Onion alpha increase/decrease</td>
- <td>KEYPAD_MULTIPLY(*) / KEYPAD_DIVIDE(/)</td>
- </tr>
-</table>
+<pre>mksdcard 1024M sdcard1.iso</pre>
-<p>Note that, to use keypad keys, you must first disable NumLock on your development computer. </p>
-
-<h2 id="emulator">Emulator Startup Options</h2>
-
-<p>The emulator supports a variety of options that you can specify
-when launching the emulator, to control its appearance or behavior.
-Here's the command-line usage for launching the emulator with options: </p>
-
-<pre>emulator -avd <avd_name> [-<option> [<value>]] ... [-<qemu args>]</pre>
-
-<p>The table below summarizes the available options.</p>
-
-<table>
-<tr>
- <th width="10%" >Category</th>
- <th width="20%" >Option</th>
- <th width="30%" >Description</th>
- <th width="40%" >Comments</th>
-</tr>
-
-<tr>
- <td rowspan="9">Help</td>
- <td><code>-help</code></td>
- <td>Print a list of all emulator options.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-all</code></td>
- <td>Print help for all startup options.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-<option></code></td>
- <td>Print help for a specific startup option.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-debug-tags</code></td>
- <td>Print a list of all tags for <code>-debug <tags></code>.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-disk-images</code></td>
- <td>Print help for using emulator disk images.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-environment</code></td>
- <td>Print help for emulator environment variables.</td>
- <td> </td>
-</tr><tr>
- <td><code>-help-keys</code></td>
- <td>Print the current mapping of keys.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-keyset-file</code></td>
- <td>Print help for defining a custom key mappings file.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-virtual-device</code></td>
- <td>Print help for Android Virtual Device usage.</td>
- <td> </td>
-</tr>
-<tr>
- <td>AVD</td>
- <td><code>-avd <avd_name></code> or <br>
- <code>@<avd_name></code></td>
- <td><strong>Required</strong>. Specifies the AVD to load for this emulator
- instance.</td>
- <td>You must create an AVD configuration before launching the emulator. For
- information, see <a href="{@docRoot}guide/developing/devices/managing-avds.html">Managing
- Virtual Devices with AVD Manager</a>.</td>
-<tr>
- <td rowspan="7">Disk Images</td>
- <td><code>-cache <filepath></code></td>
- <td>Use <filepath> as the working cache partition image. </td>
- <td>Optionally, you can specify a path relative to the current working directory.
- If no cache file is specified, the emulator's default behavior is to use a temporary file instead.
- <p>For more information on disk images, use <code>-help-disk-images</code>.</p>
-</td></tr>
-<tr>
- <td><code>-data <filepath></code></td>
- <td>Use <filepath> as the working user-data disk image. </td>
- <td>Optionally, you can specify a path relative to the current working directory.
- If <code>-data</code> is not used, the emulator looks for a file named "userdata-qemu.img"
- in the storage area of the AVD being used (see <code>-avd</code>).
-</td></tr>
-<!--
-<tr>
- <td><code>-datadir <dir></code></td>
- <td>Search for the user-data disk image specified in <code>-data</code> in <dir></td>
- <td><code><dir></code> is a path relative to the current working directory.
-
-<p>If you do not specify <code>-datadir</code>, the emulator looks for the user-data image
-in the storage area of the AVD being used (see <code>-avd</code>)</p><p>For more information
-on disk images, use <code>-help-disk-images</code>.</p>
-</td></tr>
--->
-<!--
-<tr>
- <td><code>-image <filepath></code></td>
- <td>Use <filepath> as the system image.</td>
- <td>Optionally, you can specify a path relative to the current working directory.
- Default is <system>/system.img.</td>
-</tr>
--->
-<tr>
- <td><code>-initdata <filepath></code></td>
- <td>When resetting the user-data image (through <code>-wipe-data</code>), copy the contents
- of this file to the new user-data disk image. By default, the emulator copies the <code><system>/userdata.img</code>.</td>
- <td>Optionally, you can specify a path relative to the current working directory. See also <code>-wipe-data</code>.
- <p>For more information on disk images, use <code>-help-disk-images</code>.</p></td>
-</tr>
-<!--
-<tr>
- <td><code>-kernel <filepath></code></td>
- <td>Use <filepath> as the emulated kernel.</td>
- <td>Optionally, you can specify a path relative to the current working directory. </td>
-</tr>
--->
-<tr>
- <td><code>-nocache</code></td>
- <td>Start the emulator without a cache partition.</td>
- <td>See also <code>-cache <file></code>.</td>
-</tr>
-<tr>
- <td><code>-ramdisk <filepath></code></td>
- <td>Use <filepath> as the ramdisk image.</td>
- <td>Default value is <code><system>/ramdisk.img</code>.
- <p>Optionally, you can specify a path relative to the current working directory.
- For more information on disk images, use <code>-help-disk-images</code>.</p>
-</td>
-</tr>
-<tr>
- <td><code>-sdcard <filepath></code></td>
- <td>Use <file> as the SD card image.</td>
- <td>Default value is <code><system>/sdcard.img</code>.
- <p>Optionally, you can specify a path relative to the current working directory. For more information on disk images, use <code>-help-disk-images</code>.</p>
-</td>
-</tr>
-<!--
-<tr>
- <td><code>-system <dirpath></code></td>
- <td>Search for system, ramdisk and user data images in <dir>.</td>
- <td><code><dir></code> is a directory path relative to the current
- working directory.</td>
-</tr>
--->
-<tr>
- <td><code>-wipe-data</code></td>
- <td>Reset the current user-data disk image (that is, the file specified by <code>-datadir</code> and
- <code>-data</code>, or the default file). The emulator deletes all data from the user data image file,
- then copies the contents of the file at <code>-inidata</code> data to the image file before starting.
- </td>
- <td>See also <code>-initdata</code>.
- <p>For more information on disk images, use <code>-help-disk-images</code>.</p>
-</td>
-</tr>
-<tr>
- <td rowspan="9">Debug</td>
- <td><code>-debug <tags></code></td>
- <td>Enable/disable debug messages for the specified debug tags.</td>
- <td><code><tags></code> is a space/comma/column-separated list of debug component names.
- Use <code>-help-debug-tags</code> to print a list of debug component names that you can use. </td>
-</tr>
-<tr>
- <td><code>-debug-<tag></code></td>
- <td>Enable/disable debug messages for the specified debug tag.</td>
- <td rowspan="2">Use <code>-help-debug-tags</code> to print a list of debug component names that you can use in <code><tag></code>. </td>
-</tr>
-<tr>
- <td><code>-debug-no-<tag></code></td>
- <td>Disable debug messages for the specified debug tag.</td>
-</tr>
-<tr>
- <td><code>-logcat <logtags></code></td>
- <td>Enable logcat output with given tags.</td>
- <td>If the environment variable ANDROID_LOG_TAGS is defined and not
- empty, its value will be used to enable logcat output by default.</td>
-</tr>
-<tr>
- <td><code>-shell</code></td>
- <td>Create a root shell console on the current terminal.</td>
- <td>You can use this command even if the adb daemon in the emulated system is broken.
- Pressing Ctrl-c from the shell stops the emulator instead of the shell.</td>
-</tr>
-<tr>
- <td><code>-shell-serial <device></code></td>
- <td>Enable the root shell (as in <code>-shell</code> and specify the QEMU character
- device to use for communication with the shell.</td>
- <td><device> must be a QEMU device type. See the documentation for '-serial <em>dev</em>' at
- <a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a>
- for a list of device types.
-
-<p>Here are some examples: </p>
-<ul>
- <li><code>-shell-serial stdio</code> is identical to <code>-shell</code></li>
- <li><code>-shell-serial tcp::4444,server,nowait</code> lets you communicate with the shell over TCP port 4444</li>
- <li><code>-shell-serial fdpair:3:6</code> lets a parent process communicate with the shell using fds 3 (in) and 6 (out)</li>
- <li><code>-shell-serial fdpair:0:1</code> uses the normal stdin and stdout fds, except that QEMU won't tty-cook the data.</li>
- </ul>
-</td>
-</tr>
-<tr>
- <td><code>-show-kernel <name></code></td>
- <td>Display kernel messages.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-trace <name></code></td>
- <td>Enable code profiling (press F9 to start), written to a specified file.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-verbose</code></td>
- <td>Enable verbose output.</td>
- <td>Equivalent to <code>-debug-init</code>.
-<p>You can define the default verbose output options used by emulator instances in the Android environment variable
-ANDROID_VERBOSE. Define the options you want to use in a comma-delimited list, specifying only the stem of each option:
-<code>-debug-<tags>.</code> </p>
-<p>Here's an example showing ANDROID_VERBOSE defined with the <code>-debug-init</code> and <code>-debug-modem</code> options:
-<p><code>ANDROID_VERBOSE=init,modem</code></p>
-<p>For more information about debug tags, use <code><-help-debug-tags></code>.</p>
-</td>
-</tr>
-<tr>
- <td rowspan="6">Media</td>
- <td><code>-audio <backend></code></td>
- <td>Use the specified audio backend.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-audio-in <backend></code></td>
- <td>Use the specified audio-input backend.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-audio-out <backend></code></td>
- <td>Use the specified audio-output backend.</td>
- <td> </td>
-</tr>
-<!--<tr>
- <td><code>-mic <device or file></code></td>
- <td>Use device or WAV file for audio input.</td>
- <td> </td>
-</tr>
--->
-<tr>
- <td><code>-noaudio</code></td>
- <td>Disable audio support in the current emulator instance.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-radio <device></code></td>
- <td>Redirect radio modem interface to a host character device.</td>
- <td> </td></tr>
-<tr>
- <td><code>-useaudio</code></td>
- <td>Enable audio support in the current emulator instance.</td>
- <td>Enabled by default. </td>
-</tr>
-
-<tr>
- <td rowspan="7">Network</td>
- <td><code>-dns-server <servers></code></td>
- <td>Use the specified DNS server(s). </td>
- <td>The value of <code><servers></code> must be a comma-separated list of up to 4 DNS server names or
- IP addresses.</td>
-</tr>
-<tr>
- <td><code>-http-proxy <proxy></code></td>
- <td>Make all TCP connections through a specified HTTP/HTTPS proxy</td>
- <td>The value of <code><proxy></code> can be one of the following:<br>
- <code>http://<server>:<port></code><br>
- <code>http://<username>:<password>@<server>:<port></code>
- <p>The <code>http://</code> prefix can be omitted. If the <code>-http-proxy <proxy></code> command is not supplied,
- the emulator looks up the <code>http_proxy</code> environment variable and automatically uses any value matching
- the <code><proxy></code> format described above.</p></td>
-</tr>
-<tr>
- <td><code>-netdelay <delay></code></td>
- <td>Set network latency emulation to <delay>.</td>
- <td>Default value is <code>none</code>. See the table in <a href="#netdelay">Network Delay Emulation</a> for
- supported <code><delay></code> values. </td>
-</tr>
-<tr>
- <td><code>-netfast</code></td>
- <td>Shortcut for <code>-netspeed full -netdelay none</code></td>
- <td> </td></tr>
-<tr>
- <td><code>-netspeed <speed></code></td>
- <td>Set network speed emulation to <speed>.</td>
- <td>Default value is <code>full</code>. See the table in <a href="#netspeed">Network Speed Emulation</a> for
- supported <code><speed></code> values. </td>
-</tr>
-<tr>
- <td><code>-port <port></code></td>
- <td>Set the console port number for this emulator instance to <code><port></code>.</td>
- <td>The console port number must be an even integer between 5554 and 5584, inclusive. <code><port></code>+1
- must also be free and will be reserved for ADB.</td>
-</tr>
-<tr>
- <td><code>-report-console <socket></code></td>
- <td>Report the assigned console port for this emulator instance to a remote third party
- before starting the emulation. </td>
- <td><code><socket></code> must use one of these formats:
-
-<p><code>tcp:<port>[,server][,max=<seconds>]</code></br>
-<code>unix:<port>[,server][,max=<seconds>]</code></p>
-
-<p>Use <code>-help-report-console</code></p> to view more information about this topic. </td>
-</tr>
-<tr>
- <td rowspan="8">System</td>
- <td><code>-cpu-delay <delay></code></td>
- <td>Slow down emulated CPU speed by <delay> </td>
- <td>Supported values for <delay> are integers between 0 and 1000.
-
-<p>Note that the <delay> does not correlate to clock speed or other absolute metrics
-— it simply represents an abstract, relative delay factor applied non-deterministically
-in the emulator. Effective performance does not always
-scale in direct relationship with <delay> values.</p>
-</td>
-</tr>
-<tr>
- <td><code>-gps <device></code></td>
- <td>Redirect NMEA GPS to character device.</td>
- <td>Use this command to emulate an NMEA-compatible GPS unit connected to
- an external character device or socket. The format of <code><device></code> must be QEMU-specific
- serial device specification. See the documentation for 'serial -dev' at
- <a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a>.
-</td>
-</tr>
-<tr>
- <td><code>-nojni</code></td>
- <td>Disable JNI checks in the Dalvik runtime.</td><td> </td></tr>
-<tr>
- <td><code>-qemu</code></td>
- <td>Pass arguments to qemu.</td>
- <td> </td></tr>
-<tr>
- <td><code>-qemu -h</code></td>
- <td>Display qemu help.</td>
- <td></td></tr>
-<tr>
- <td><code>-radio <device></code></td>
- <td>Redirect radio mode to the specified character device.</td>
- <td>The format of <code><device></code> must be QEMU-specific
- serial device specification. See the documentation for 'serial -dev' at
-<a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a>.
-</td>
-</tr>
-<tr>
- <td><code>-timezone <timezone></code></td>
- <td>Set the timezone for the emulated device to <timezone>, instead of the host's timezone.</td>
- <td><code><timezone></code> must be specified in zoneinfo format. For example:
-<p>"America/Los_Angeles"<br>
-"Europe/Paris"</p>
-</td>
-</tr>
-<tr>
- <td><code>-version</code></td>
- <td>Display the emulator's version number.</td>
- <td> </td>
-</tr>
-<tr>
- <td rowspan="12">UI</td>
- <td><code>-dpi-device <dpi></code></td>
- <td>Scale the resolution of the emulator to match the screen size
- of a physical device.</td>
- <td>The default value is 165. See also <code>-scale</code>.</td>
-</tr>
-<tr>
- <td><code>-no-boot-anim</code></td>
- <td>Disable the boot animation during emulator startup.</td>
- <td>Disabling the boot animation can speed the startup time for the emulator.</td>
-</tr>
-<tr>
- <td><code>-no-window</code></td>
- <td>Disable the emulator's graphical window display.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-scale <scale></code></td>
- <td>Scale the emulator window. </td>
- <td><code><scale></code> is a number between 0.1 and 3 that represents the desired scaling factor. You can
- also specify scale as a DPI value if you add the suffix "dpi" to the scale value. A value of "auto"
- tells the emulator to select the best window size.</td>
-</tr>
-<tr>
- <td><code>-raw-keys</code></td>
- <td>Disable Unicode keyboard reverse-mapping.</td>
- <td> </td></tr>
-<tr>
- <td><code>-noskin</code></td>
- <td>Don't use any emulator skin.</td>
- <td> </td></tr>
-<tr>
- <td><code>-keyset <file></code></td>
- <td>Use the specified keyset file instead of the default.</td>
- <td>The keyset file defines the list of key bindings between the emulator and the host keyboard.
- For more information, use <code>-help-keyset</code> to print information about this topic.
-</td>
-</tr>
-<tr>
- <td><code>-onion <image></code></td>
- <td>Use overlay image over screen.</td>
- <td>No support for JPEG. Only PNG is supported.</td></tr>
-<tr>
- <td><code>-onion-alpha <percent></code></td>
- <td>Specify onion skin translucency value (as percent).
- <td>Default is 50.</td>
-</tr>
-<tr>
- <td><code>-onion-rotation <position></code></td>
- <td>Specify onion skin rotation.
- <td><code><position></code> must be one of the values 0, 1, 2, 3.</td>
-</tr>
-<tr>
- <td><code>-skin <skinID></code></td>
- <td>This emulator option is deprecated. </td>
- <td>Please set skin options using AVDs, rather than by using this emulator
-option. Using this option may yield unexpected and in some cases misleading
-results, since the density with which to render the skin may not be defined.
-AVDs let you associate each skin with a default density and override the default
-as needed. For more information, see <a
-href="{@docRoot}guide/developing/devices/managing-avds.html">Managing Virtual Devices
-with AVD Manager</a>.
-</td>
-</tr>
-<tr>
- <td><code>-skindir <dir></code></td>
- <td>This emulator option is deprecated. </td>
- <td>See comments for <code>-skin</code>, above.</td></tr>
-</table>
+<p>For more information, see <a
+href="{@docRoot}guide/developing/tools/mksdcard.html"><code>mksdcard</code></a>.</p>
-<a name="diskimages"></a>
+<h3 id="sdcard-files">Copying files to an SD card image</h3>
-<h2>Working with Emulator Disk Images</h2>
+<p>Once you have created the disk image, you can copy files to it prior to
+loading it in the emulator. To copy files, you can mount the image as a loop
+device and then copy the files to it, or you can use a utility such as {@code mtools} to
+copy the files directly to the image. The {@code mtools} package is available for Linux,
+Mac, and Windows.</p>
+
+<p>Alternatively, you can use the {@code adb push} command to move files onto an SD card image
+while it is loaded in an emulator. For more information see the <a
+href="{@docRoot}guide/developing/tools/adb.html#copyfiles">{@code adb push}</a> documentation.</p>
+
+<h3 id="sdcard-loading">Loading an SD card image</h3>
+
+<p>By default, the emulator loads the SD card image that is stored with the active
+AVD (see the <code>-avd</code> startup option).</p>
+
+<p>Alternatively, you can start the emulator with the
+<code>-sdcard</code> flag and specify the name and path of your image (relative
+to the current working directory): </p>
+
+<pre>emulator -sdcard <filepath></pre>
+
+
+<h2 id="diskimages">Working with Emulator Disk Images</h2>
<p>The emulator uses mountable disk images stored on your development machine to
-simulate flash (or similar) partitions on an actual device. For example, it uses
+simulate flash (or similar) partitions on an actual device. For example, it uses a
disk image containing an emulator-specific kernel, the Android system, a
ramdisk image, and writeable images for user data and simulated SD card.</p>
<p>To run properly, the emulator requires access to a specific set of disk image
-files. By default, the Emulator always looks for the disk images in the
-private storage area of the AVD in use. If no images exist there when
-the Emulator is launched, it creates the images in the AVD directory based on
+files. By default, the Emulator always looks for the disk images in the
+private storage area of the AVD in use. If no images exist there when
+the Emulator is launched, it creates the images in the AVD directory based on
default versions stored in the SDK. </p>
-<p class="note"><strong>Note:</strong> The default storage location for
-AVDs is in <code>~/.android/avd</code> on OS X and Linux, <code>C:\Documents and
-Settings\<user>\.android\</code> on Windows XP, and
+<p class="note"><strong>Note:</strong> The default storage location for
+AVDs is in <code>~/.android/avd</code> on OS X and Linux, <code>C:\Documents and
+Settings\<user>\.android\</code> on Windows XP, and
<code>C:\Users\<user>\.android\</code>
on Windows Vista.</p>
<p>To let you use alternate or custom versions of the image files, the emulator
provides startup options that override the default locations and filenames of
-the image files. When you use the options, the emulator searches for the image
+the image files. When you use one of these options, the emulator searches for the image
file under the image name or location that you specify; if it can not locate the
image, it reverts to using the default names and location.</p>
@@ -757,20 +636,19 @@
image files, and temporary image files. The sections below describe how to
override the location/name of each type of file. </p>
-<a name="defaultimages"></a>
-<h3>Default Images</h3>
+<h3 id="defaultimages">Default image files</h3>
-<p>When the emulator launches but does not find an existing user data image in
+<p>When the emulator launches, but does not find an existing user data image in
the active AVD's storage area, it creates a new one from a default version
-included in the SDK. The default user data image is read-only. The image
+included in the SDK. The default user data image is read-only. The image
files are read-only.</p>
<p>The emulator provides the <code>-system <dir></code> startup option to
-let you override the location under which the emulator looks for the default
+let you override the location where the emulator looks for the default
user data image. </p>
<p>The emulator also provides a startup option that lets you override the name
-of the default user data image, as described in the table below. When you use the
+of the default user data image, as described in the following table. When you use the
option, the emulator looks in the default directory, or in a custom location
(if you specified <code>-system <dir></code>). </p>
@@ -810,25 +688,24 @@
</table>
-<a name="runtimeimages"></a>
-<h3>Runtime Images: User Data and SD Card</h3>
+<h3 id="runtimeimages">Runtime images: user data and SD card</h3>
-<p>At runtime, the emulator reads and writes data on two disk images: a
-user-data image and (optionally) an SD card image. This emulates the user-data
+<p>At runtime, the emulator reads and writes data to two disk images: a
+user-data image and (optionally) an SD card image. These images emulate the user-data
partition and removable storage media on actual device. </p>
-<p>The emulator provides a default user-data disk image. At startup, the emulator
-creates the default image as a copy of the system user-data image (user-data.img),
+<p>The emulator provides a default user-data disk image. At startup, the emulator
+creates the default image as a copy of the system user-data image (user-data.img),
described above. The emulator stores the new image with the files of the active AVD.</p>
<!--
-<p>The emulator provides a startup option, <code>-datadir <dir></code>,
+<p>The emulator provides a startup option, <code>-datadir <dir></code>,
that you can use to override the location under which the emulator looks for the runtime
image files. </p>
-->
-<p>The emulator provides startup options to let you override the actual names and storage
-locations of the runtime images to load, as described in the table below. When you use one
+<p>The emulator provides startup options to let you override the actual names and storage
+locations of the runtime images to load, as described in the following table. When you use one
of these options, the emulator looks for the specified file(s) in the current working directory,
in the AVD directory, or in a custom location (if you specified a path with the filename). </p>
@@ -842,7 +719,7 @@
<td><code>userdata-qemu.img</code></td>
<td>An image to which the emulator writes runtime user-data for a unique user.</td>
<td>Override using <code>-data <filepath></code>, where <code><filepath></code> is the
-path the image, relative to the current working directory. If you supply a filename only,
+path the image, relative to the current working directory. If you supply a filename only,
the emulator looks for the file in the current working directory. If the file at <code><filepath></code> does
not exist, the emulator creates an image from the default userdata.img, stores it under the name you
specified, and persists user data to it at shutdown. </td>
@@ -852,7 +729,7 @@
<td><code>sdcard.img</code></td>
<td>An image representing an SD card inserted into the emulated device.</td>
<td>Override using <code>-sdcard <filepath></code>, where <code><filepath></code> is the
-path the image, relative to the current working directory. If you supply a filename only,
+path the image, relative to the current working directory. If you supply a filename only,
the emulator looks for the file in the current working directory. </td>
</tr>
@@ -864,38 +741,38 @@
session-specific data. For example, it uses the image to store a unique user's
installed application data, settings, databases, and files. </p>
-<p>At startup, the emulator attempts to load a user-data image stored during
-a previous session. It looks for the file in the current working directory,
-in the AVD directory as described above, and at the custom location/name
+<p>At startup, the emulator attempts to load a user-data image stored during
+a previous session. It looks for the file in the current working directory,
+in the AVD directory described in a previous section and at the custom location/name
that you specified at startup. </p>
<ul>
-<li>If it finds a user-data image, it mounts the image and makes it available
-to the system for reading/writing of user data. </li>
+<li>If it finds a user-data image, it mounts the image and makes it available
+to the system for reading and writing of user data. </li>
<li>If it does not find one, it creates an image by copying the system user-data
image (userdata.img), described above. At device power-off, the system persists
-the user data to the image, so that it will be available in the next session.
+the user data to the image, so that it will be available in the next session.
Note that the emulator stores the new disk image at the location/name that you
specify in <code>-data</code> startup option.</li>
</ul>
<p class="note"><strong>Note:</strong> Because of the AVD configurations used in the emulator,
-each emulator instance now gets its own dedicated storage. There is no need
+each emulator instance gets its own dedicated storage. There is no longer a need
to use the <code>-d</code> option to specify an instance-specific storage area.</p>
<h4>SD Card</h4>
<P>Optionally, you can create a writeable disk image that the emulator can use
-to simulate removeable storage in an actual device. For information about how to create an
+to simulate removeable storage in an actual device. For information about how to create an
emulated SD card and load it in the emulator, see <a href="#sdcard">SD Card Emulation</a></p>
<p>You can also use the android tool to automatically create an SD Card image
-for you, when creating an AVD. For more information, see <a
+for you, when creating an AVD. For more information, see <a
href="{@docRoot}guide/developing/devices/managing-avds.html">Managing Virtual Devices with AVD
Manager</a>.
-<a name="temporaryimages"></a>
-<h3>Temporary Images</h3>
+
+<h3 id="temporaryimages">Temporary Images</h3>
<p>The emulator creates two writeable images at startup that it deletes at
device power-off. The images are: </p>
@@ -909,8 +786,8 @@
persisting it at device power-off. </p>
<p>The <code>/cache</code> partition image is initially empty, and is used by
-the browser to cache downloaded web pages and images. The emulator provides an
-<code>-cache <file></code>, which specifies the name of the file at which
+the browser to cache downloaded web pages and images. The emulator provides an
+<code>-cache <file></code>, which specifies the name of the file in which
to persist the <code>/cache</code> image at device power-off. If <code><file>
</code> does not exist, the emulator creates it as an empty file. </p>
@@ -918,16 +795,14 @@
<code>-nocache</code> option at startup. </p>
-<a name="emulatornetworking"></a>
-<h2>Emulator Networking</h2>
+<h2 id="emulatornetworking">Emulator Networking</h2>
<p>The emulator provides versatile networking capabilities that you can use to
set up complex modeling and testing environments for your application. The
sections below introduce the emulator's network architecture and capabilities.
</p>
-<a name="networkaddresses"></a>
-<h3>Network Address Space</h3>
+<h3 id="networkaddresses">Network Address Space</h3>
<p>Each instance of the emulator runs behind a virtual router/firewall service
that isolates it from your development machine's network interfaces and settings
@@ -990,14 +865,13 @@
devices (which are also very likely to be NAT-ed, i.e., behind a
router/firewall)</p>
-<a name="networkinglimitations"></a>
-<h3>Local Networking Limitations</h3>
-<p>Each emulator instance runs behind a virtual router, but unlike an actual
-device connected to a physical router, the emulated device doesn't have access
-to a physical network. Instead it runs as part of a normal application on your
-development machine. This means that it is subject to the same networking
-limitations as other applications on your machine:</p>
+<h3 id="networkinglimitations">Local Networking Limitations</h3>
+
+<p>Android applications running in an emulator can connect to the network available on your
+workstation. However, they connect through the emulator, not directly to hardware, and the emulator
+acts like a normal application on your workstation. This means that the emulator, and thus your
+Android applications, are subject to some limitations:</p>
<ul>
<li>Communication with the emulated device may be blocked by a firewall
@@ -1016,25 +890,24 @@
protocols (such as ICMP, used for "ping") might not be supported. Currently, the
emulator does not support IGMP or multicast. </p>
-<a name="redirections"></a>
-<h3>Using Network Redirections</h3>
+<h3 id="redirection">Using Network Redirection</h3>
<p>To communicate with an emulator instance behind its virtual router, you need
-to set up network redirections on the virtual router. Clients can then connect
+to set up network redirection on the virtual router. Clients can then connect
to a specified guest port on the router, while the router directs traffic
to/from that port to the emulated device's host port. </p>
-<p>To set up the network redirections, you create a mapping of host and guest
+<p>To set up the network redirection, you create a mapping of host and guest
ports/addresses on the the emulator instance. There are two ways to set up
-network redirections: using emulator console commands and using the ADB tool, as
+network redirection: using emulator console commands and using the ADB tool, as
described below. </p>
-<a name="consoleredir"></a>
-<h4>Setting up Redirections through the Emulator Console</h4>
+
+<h4 id="consoleredir">Setting up Redirection through the Emulator Console</h4>
<p>Each emulator instance provides a control console the you can connect to, to
issue commands that are specific to that instance. You can use the
-<code>redir</code> console command to set up redirections as needed for an
+<code>redir</code> console command to set up redirection as needed for an
emulator instance. </p>
<p>First, determine the console port number for the target emulator instance.
@@ -1044,25 +917,25 @@
<pre><code>telnet localhost 5554</code></pre>
-<p>Once connected, use the <code>redir</code> command to work with redirections.
+<p>Once connected, use the <code>redir</code> command to work with redirection.
To add a redirection, use:</p>
<pre><code>add <protocol>:<host-port>:<guest-port></code>
</pre>
-<p>where <code><protocol></code> is either <code>tcp</code> or <code>udp</code>,
-and <code><host-port></code> and <code><guest-port></code> sets the
+<p>where <code><protocol></code> is either <code>tcp</code> or <code>udp</code>,
+and <code><host-port></code> and <code><guest-port></code> sets the
mapping between your own machine and the emulated system, respectively. </p>
-<p>For example, the following command sets up a redirection that will handle all
+<p>For example, the following command sets up a redirection that handles all
incoming TCP connections to your host (development) machine on 127.0.0.1:5000
and will pass them through to the emulated system's 10.0.2.15:6000.:</p>
<pre>redir add tcp:5000:6000</pre>
<p>To delete a redirection, you can use the <code>redir del</code> command. To
-list all redirections for a specific instance, you can use <code>redir
-list</code>. For more information about these and other console commands, see
+list all redirection for a specific instance, you can use <code>redir
+list</code>. For more information about these and other console commands, see
<a href="#console">Using the Emulator Console</a>. </p>
<p>Note that port numbers are restricted by your local environment. this typically
@@ -1071,29 +944,28 @@
host port that is already in use by another process on your machine. In that
case, <code>redir</code> generates an error message to that effect. </p>
-<a name="adbredir"></a>
-<h4>Setting Up Redirections through ADB</h4>
+<h4 id="adbredir">Setting Up Redirection through ADB</h4>
<p>The Android Debug Bridge (ADB) tool provides port forwarding, an alternate
-way for you to set up network redirections. For more information, see <a
+way for you to set up network redirection. For more information, see <a
href="{@docRoot}guide/developing/tools/adb.html#forwardports">Forwarding Ports</a> in the ADB
documentation.</p>
<p>Note that ADB does not currently offer any way to remove a redirection,
except by killing the ADB server.</p>
-<a name="dns"></a>
-<h3>Configuring the Emulator's DNS Settings</h3>
+
+<h3 id="dns">Configuring the Emulator's DNS Settings</h3>
<p>At startup, the emulator reads the list of DNS servers that your system is
currently using. It then stores the IP addresses of up to four servers on this
list and sets up aliases to them on the emulated addresses 10.0.2.3, 10.0.2.4,
10.0.2.5 and 10.0.2.6 as needed. </p>
-<p>On Linux and OS X, the emulator obtains the DNS server addresses by parsing
-the file <code>/etc/resolv.conf</code>. On Windows, the emulator obtains the
-addresses by calling the <code>GetNetworkParams()</code> API. Note that this
-usually means that the emulator ignores the content of your "hosts" file
+<p>On Linux and OS X, the emulator obtains the DNS server addresses by parsing
+the file <code>/etc/resolv.conf</code>. On Windows, the emulator obtains the
+addresses by calling the <code>GetNetworkParams()</code> API. Note that this
+usually means that the emulator ignores the content of your "hosts" file
(<code>/etc/hosts</code> on Linux/OS X, <code>%WINDOWS%/system32/HOSTS</code>
on Windows).</P>
@@ -1104,8 +976,8 @@
encounter DNS resolution problems in the emulated network (for example, an
"Unknown Host error" message that appears when using the web browser).</p>
-<a name="proxy"></a>
-<h3>Using the Emulator with a Proxy</h3>
+
+<h3 id="proxy">Using the Emulator with a Proxy</h3>
<p>If your emulator must access the Internet through a proxy server, you can use
the <code>-http-proxy <proxy></code> option when starting the emulator, to
@@ -1132,18 +1004,18 @@
<p>You can use the <code>-verbose-proxy</code> option to diagnose proxy
connection problems.</p>
-<a name="connecting"></a>
-<h3>Interconnecting Emulator Instances</h3>
+
+<h3 id="connecting">Interconnecting Emulator Instances</h3>
<p>To allow one emulator instance to communicate with another, you must set up
-the necessary network redirections as illustrated below. </p>
+the necessary network redirection as illustrated below. </p>
<p>Assume that your environment is</p>
<ul>
<li>A is you development machine</li>
<li>B is your first emulator instance, running on A</li>
- <li>C is your second emulator instance, running on A too</li>
+ <li>C is your second emulator instance, also running on A</li>
</ul>
<p>and you want to run a server on B, to which C will connect, here is how you
@@ -1168,10 +1040,11 @@
<li>C connects to 10.0.2.2:8080</li>
</ul>
-<a name="calling"></a>
-<h3>Sending a Voice Call or SMS to Another Emulator Instance</h3>
+<h3 id="calling">Sending a Voice Call or SMS to Another Emulator Instance</h3>
-<p>The emulator automatically forwards simulated voice calls and SMS messages from one instance to another. To send a voice call or SMS, you use the dialer application and SMS application (if available) installed on one emulator </p>
+<p>The emulator automatically forwards simulated voice calls and SMS messages from one instance to
+another. To send a voice call or SMS, use the dialer application or SMS application, respectively,
+from one of the emulators.</p>
<p>To initiate a simulated voice call to another emulator instance:</p>
<ol>
@@ -1186,16 +1059,23 @@
<p>You can also connect to an emulator instance's console to simulate an incoming voice call or SMS. For more information, see <a href="#telephony">Telephony Emulation</a> and <a href="#sms">SMS Emulation</a>.
-<a name="console"></a>
-<h2>Using the Emulator Console</h2>
+<h2 id="console">Using the Emulator Console</h2>
-<p>Each running emulator instance includes a console facility that lets you dynamically query and control the simulated device environment. For example, you can use the console to dynamically manage port redirections and network characteristics and simulate telephony events. To access the console and enter commands, you use telnet to connect to the console's port number. </p>
+<p>Each running emulator instance provides a console that lets you query and control the emulated
+device environment. For example, you can use the console to manage port redirection, network
+characteristics, and telephony events while your application is running on the emulator. To
+access the console and enter commands, use telnet to connect to the console's port number.</p>
+
<p>To connect to the console of any running emulator instance at any time, use this command: </p>
<pre>telnet localhost <console-port></pre>
-<p>An emulator instance occupies a pair of adjacent ports: a console port and an adb port. The port numbers differ by 1, with the adb port having the higher port number. The console of the first emulator instance running on a given machine uses console port 5554 and adb port 5555. Subsequent instances use port numbers increasing by two — for example, 5556/5557, 5558/5559, and so on. Up to 16 concurrent emulator instances can run a console facility. </p>
+<p>An emulator instance occupies a pair of adjacent ports: a console port and an {@code adb} port.
+The port numbers differ by 1, with the {@code adb} port having the higher port number. The console
+of the first emulator instance running on a given machine uses console port 5554 and {@code adb}
+port 5555. Subsequent instances use port numbers increasing by two — for example, 5556/5557,
+5558/5559, and so on. Up to 16 concurrent emulator instances can run a console facility. </p>
<p>To connect to the emulator console, you must specify a valid console port. If multiple emulator instances are running, you need to determine the console port of the emulator instance you want to connect to. You can find the instance's console port listed in the title of the instance window. For example, here's the window title for an instance whose console port is 5554:</p>
@@ -1209,12 +1089,14 @@
<p>To exit the console session, use <code>quit</code> or <code>exit</code>.</p>
-<p>The sections below describe the major functional areas of the console.</p>
+<p>The following sections below describe the major functional areas of the console.</p>
-<a name="portredirection"></a>
-<h3>Port Redirection</h3>
-<p>You can use the console to add and remove port redirections while the emulator is running. After connecting to the console, you can manage port redirections in this way:</p>
+<h3 id="portredirection">Port Redirection</h3>
+
+<p>You can use the console to add and remove port redirection while the emulator is running. After
+you connect to the console, manage port redirection by entering the following command:</p>
+
<pre>redir <list|add|del> </pre>
<p>The <code>redir</code> command supports the subcommands listed in the table below. </p>
@@ -1225,14 +1107,14 @@
<th width="30%" >Description</th>
<th width="35%">Comments</th>
</tr>
-
+
<tr>
<td><code>list</code></td>
- <td>List the current port redirections.</td>
+ <td>List the current port redirection.</td>
<td> </td>
</tr>
-
+
<tr>
<td><code>add <protocol>:<host-port>:<guest-port></code></td>
<td>Add a new port redirection.</td>
@@ -1244,16 +1126,16 @@
<tr>
<td><code>del <protocol>:<host-port></code></td>
<td>Delete a port redirection.</td>
-<td>See above for meanings of <protocol> and <host-port>.</td>
+<td>The meanings of <protocol> and <host-port> are listed in the previous row.</td>
</tr>
</table>
-<a name="geo"></a>
-<h3>Geo Location Provider Emulation</h3>
-<p>The console provides commands to let you set the geo position used by an emulator emulated device.
-You can use the <code>geo</code> command to send a simple GPS fix to the emulator, without needing to
-use NMEA 1083 formatting. The usage for the command is:</p>
+<h3 id="geo">Geo Location Provider Emulation</h3>
+
+<p>You can use the console to set the geographic location reported to the applications running
+inside an emulator. Use the <code>geo</code> command to send a simple GPS fix to the
+emulator, with or without NMEA 1083 formatting:</p>
<pre>geo <fix|nmea></pre>
@@ -1261,11 +1143,11 @@
<table>
<tr>
- <th width="25%" >Subcommand
- <th width="30%" >Description</th>
+ <th width="25%">Subcommand</th>
+ <th width="30%">Description</th>
<th width="35%">Comments</th>
</tr>
-
+
<tr>
<td><code>fix <longitude> <latitude> [<altitude>]</code></td>
<td>Send a simple GPS fix to the emulator instance.</td>
@@ -1278,19 +1160,21 @@
</tr>
</table>
-<p>You can issue the <code>geo</code> command to fix the GPS location as soon as an emulator instance is running.
-The emulator creates a mock location provider that sends it to GPS-aware applications as soon as they start and
-register location listeners. Any application can query the location manager to obtain the current GPS fix for the
-emulated device by calling:
+<p>You can issue the <code>geo</code> command as soon as an emulator instance is running. The
+emulator sets the location you enter by creating a mock location provider. This provider responds to
+location listeners set by applications, and also supplies the location to the {@link
+android.location.LocationManager}. Any application can query the location manager to obtain the
+current GPS fix for the emulated device by calling:
<pre>LocationManager.getLastKnownLocation("gps")</pre>
-<p>For more information about the Location Manager, see {@link android.location.LocationManager} and its methods.</p>
+<p>For more information about the Location Manager, see {@link android.location.LocationManager}.
+</p>
-<a name="events"></a>
-<h3>Hardware Events Emulation</h3>
+<h3 id="events">Hardware Events Emulation</h3>
-<p>You can use the <code>event</code> command to send various events to the emulator.The usage for the command is: </p>
+<p>The {@code event} console commands sends hardware events to the emulator. The syntax for this
+command is as follows:</p>
<pre>event <send|types|codes|text></pre>
@@ -1302,7 +1186,7 @@
<th width="30%" >Description</th>
<th width="35%">Comments</th>
</tr>
-
+
<tr>
<td><code>send <type>:<code>:<value> [...]</code></td>
<td>Send one or more events to the Android kernel. </td>
@@ -1315,7 +1199,7 @@
</tr>
<tr>
<td><code>codes <type></code></td>
- <td>List all <code><codes></code> string aliases supported by the <code>event</code>
+ <td>List all <code><codes></code> string aliases supported by the <code>event</code>
subcommands for the specified <code><type></code>.</td>
<td> </td>
</tr>
@@ -1326,10 +1210,11 @@
</tr>
</table>
-<a name="power"></a>
-<h3>Device Power Characteristics</h3>
-<p>You can use the <code>power</code> command to control the simulated power state of the emulator instance.The usage for the command is: </p>
+<h3 id="power">Device Power Characteristics</h3>
+
+<p>The {@code power} command controls the power state reported by the emulator to applications. The
+syntax for this command is as follows: </p>
<pre>power <display|ac|status|present|health|capacity></pre>
@@ -1341,7 +1226,7 @@
<th width="30%" >Description</th>
<th width="35%">Comments</th>
</tr>
-
+
<tr>
<td><code>display</code></td>
<td>Display battery and charger state.</td>
@@ -1375,23 +1260,32 @@
</tr>
</table>
-<a name="netstatus"></a>
-<h3>Network Status</h3>
+
+<h3 id="netstatus">Network Status</h3>
<p>You can use the console to check the network status and current delay and speed characteristics. To do so, connect to the console and use the <code>netstatus</code> command. Here's an example of the command and its output. </p>
<pre>network status
</pre>
-<a name="netdelay"></a>
-<h3>Network Delay Emulation</h3>
-<p>The emulator lets you simulate various network latency levels, so that you can test your application in an environment more typical of the actual conditions in which it will run. You can set a latency level or range at emulator startup or you can use the console to change the latency dynamically, while the application is running in the emulator. </p>
-<p>To set latency at emulator startup, use the <code>-netdelay</code> emulator option with a supported <code><delay></code> value, as listed in the table below. Here are some examples:</p>
+<h3 id="netdelay">Network Delay Emulation</h3>
+
+<p>The emulator lets you simulate various network latency levels, so that you can test your
+application in an environment more typical of the actual conditions in which it will run. You can
+set a latency level or range at emulator startup or you can use the console to change the latency,
+while the application is running in the emulator. </p>
+
+<p>To set latency at emulator startup, use the <code>-netdelay</code> emulator option with a
+supported <code><delay></code> value, as listed in the table below. Here are some
+examples:</p>
+
<pre>emulator -netdelay gprs
emulator -netdelay 40 100</pre>
-<p>To make dynamic changes to network delay while the emulator is running, connect to the console and use the <code>netdelay</code> command with a supported <code><delay></code> value from the table below. </p>
+<p>To make changes to network delay while the emulator is running, connect to the console and use
+the <code>netdelay</code> command with a supported <code><delay></code> value from the table
+below.</p>
<pre>network delay gprs</pre>
@@ -1401,7 +1295,7 @@
<tr>
<th width="30%" >Value</th>
<th width="35%" >Description</th><th width="35%">Comments</th></tr>
-
+
<tr><td><code>gprs</code></td><td>GPRS</td>
<td>(min 150, max 550)</td>
</tr>
@@ -1421,19 +1315,22 @@
<td> </td></tr>
</table>
-<a name="netspeed"></a>
-<h3>Network Speed Emulation</h3>
-<p>The emulator also lets you simulate various network transfer rates.
-You can set a transfer rate or range at emulator startup or you can use the console to change the rate dynamically,
-while the application is running in the emulator.</p>
+<h3 id="netspeed">Network Speed Emulation</h3>
+
+<p>The emulator also lets you simulate various network transfer rates.
+You can set a transfer rate or range at emulator startup or you can use the console to change the
+rate, while the application is running in the emulator.</p>
<p>To set the network speed at emulator startup, use the <code>-netspeed</code> emulator option with a supported
<code><speed></code> value, as listed in the table below. Here are some examples:</p>
+
<pre>emulator -netspeed gsm
emulator -netspeed 14.4 80</pre>
-<p>To make dynamic changes to network speed while the emulator is running, connect to the console and use the <code>netspeed</code> command with a supported <code><speed></code> value from the table below. </p>
+<p>To make changes to network speed while the emulator is running, connect to the console and use
+the <code>netspeed</code> command with a supported <code><speed></code> value from the table
+below.</p>
<pre>network speed 14.4 80</pre>
@@ -1444,7 +1341,7 @@
<tr>
<th width="30%">Value</th>
<th width="35%">Description</th><th width="35%">Comments</th></tr>
-
+
<tr>
<td><code>gsm</code></td>
<td>GSM/CSD</td><td>(Up: 14.4, down: 14.4)</td></tr>
@@ -1476,14 +1373,19 @@
<td>Set exact rates for upload and download separately.</td><td></td></tr>
</table>
-<a name="telephony"></a>
-<h3>Telephony Emulation</h3>
+<h3 id="telephony">Telephony Emulation</h3>
-<p>The Android emulator includes its own GSM emulated modem that lets you simulate telephony functions in the emulator. For example, you can simulate inbound phone calls and establish/terminate data connections. The Android system handles simulated calls exactly as it would actual calls. The emulator does not support call audio in this release. </p>
-<p>You can use the console to access the emulator's telephony functions. After connecting to the console, you can use</p>
+<p>The Android emulator includes its own GSM emulated modem that lets you simulate telephony
+functions in the emulator. For example, you can simulate inbound phone calls, establish data
+connections and terminate them. The Android system handles simulated calls exactly as it would
+actual calls. The emulator does not support call audio.</p>
+
+<p>You can use the {@code gsm} command to access the emulator's telephony functions after connecting
+to the console. The syntax for this command is as follows:</p>
+
<pre>gsm <call|accept|busy|cancel|data|hold|list|voice|status> </pre>
-<p>to invoke telephony functions. </p>
+
<p>The <code>gsm</code> command supports the subcommands listed in the table below. </p>
<table>
<tr>
@@ -1559,11 +1461,12 @@
</tr>
</table>
-<a name="sms"></a>
-<h3>SMS Emulation</h3>
+<h3 id="sms">SMS Emulation</h3>
-<p>The Android emulator console lets you generate an SMS message and direct it to an emulator instance. Once you connect to an emulator instance, you can generate an emulated incoming SMS using this command:</p>
+<p>The Android emulator console lets you generate an SMS message and direct it to an emulator
+instance. Once you connect to an emulator instance, you can generate an emulated incoming SMS using
+the following command:</p>
<pre>sms send <senderPhoneNumber> <textmessage></pre>
@@ -1571,11 +1474,11 @@
<p>The console forwards the SMS message to the Android framework, which passes it through to an application that handles that message type. </p>
-<a name="vm"></a>
-<h3>VM State</h3>
+<h3 id="vm">VM State</h3>
-<p>You can use the <code>vm</code> command to control the VM on an emulator instance.The usage for the command is: </p>
+<p>You can use the <code>vm</code> command to control the VM on an emulator instance. The syntax for
+this command is as follows: </p>
<pre>vm <start|stop|status></pre>
@@ -1583,8 +1486,8 @@
<table>
<tr>
- <th width="25%" >Subcommand </th>
- <th width="30%" >Description</th>
+ <th width="25%">Subcommand</th>
+ <th width="30%">Description</th>
<th width="35%">Comments</th>
</tr>
<tr>
@@ -1605,11 +1508,10 @@
</table>
-<a name="window"></a>
+<h3 id="window">Emulator Window</h3>
-<h3>Emulator Window</h3>
-
-<p>You can use the <code>window</code> command to manage the emulator window. The usage for the command is: </p>
+<p>You can use the <code>window</code> command to manage the emulator window. The syntax for this
+command is as follows: </p>
<pre>window <scale></pre>
@@ -1617,158 +1519,53 @@
<table>
<tr>
- <th width="25%" >Subcommand
- <th width="30%" >Description</th>
+ <th width="25%">Subcommand</th>
+ <th width="30%">Description</th>
<th width="35%">Comments</th>
</tr>
<tr>
<td><code>scale <scale></code></td>
<td>Scale the emulator window.</td>
- <td><scale> must be a number between 0.1 and 3 that describes the desired scaling factor. You can
- also specify scale as a DPI value if you add the suffix "dpi" to the scale value. A value of "auto"
+ <td>A number between 0.1 and 3 that sets the scaling factor. You can
+ also specify scale as a DPI value if you add the suffix "dpi" to the scale value. A value of "auto"
tells the emulator to select the best window size.</td>
</tr>
</table>
-<a name="terminating"></a>
-
-<h3>Terminating an Emulator Instance</h3>
+<h3 id="terminating">Terminating an Emulator Instance</h3>
<p>You can terminate an emulator instance through the console, using the <code>kill</code> command.</p>
-<a name="skins"></a>
+<h2 id="limitations">Emulator Limitations</h2>
-<h2>Using Emulator Skins</h2>
-
-<p>The Android SDK includes several Emulator skins that you can use to control the resolution and density of the emulated device's screen. To select a specific skin for running the emulator, create an AVD that uses that skin. Please do not use deprecated emulator options such as <code>-skin</code> to control the skin used by an emulator instance. For more information about AVDs, see <a
-href="{@docRoot}guide/developing/devices/index.html">Managing Virtual Devices</a>.</p>
+<p>The functional limitations of the emulator include: </p>
+<ul>
+ <li>No support for placing or receiving actual phone calls. You can simulate phone calls (placed
+ and received) through the emulator console, however. </li>
+ <li>No support for USB connections</li>
+ <li>No support for device-attached headphones</li>
+ <li>No support for determining network connected state</li>
+ <li>No support for determining battery charge level and AC charging state</li>
+ <li>No support for determining SD card insert/eject</li>
+ <li>No support for Bluetooth</li>
+</ul>
-<a name="multipleinstances"></a>
+<h2 id="troubleshooting">Troubleshooting Emulator Problems</h2>
-<h2>Running Multiple Emulator Instances</h2>
+<p>The {@code adb} utility sees the emulator as an actual physical device. For this reason, you
+might have to use the {@code -d} flag with some common {@code adb} commands, such as
+<code>install</code>. The {@code -d} flag lets you specify which of several connected devices to use
+as the target of a command. If you don't specify {@code -d}, the emulator targets the first
+device in its list. For more information about {@code adb}, see <a
+href="{@docRoot}guide/developing/tools/adb.html">Android Debug Bridge</a>.</p>
-<p>Through the AVDs configurations used by the emulator, you can run multiple
-instances of the emulator concurrently, each with its own AVD configuration and
-storage area for user data, SD card, and so on. You no longer need to use the
-<code>-d</code> option when launching the emulator, to point to an
-instance-specific storage area. </p>
-
-<a name="apps"></a>
-
-<h2>Installing Applications on the Emulator</h2>
-
-<p>If you don't have access to Eclipse or the ADT Plugin, you can install
-your application on the emulator <a href="{@docRoot}guide/developing/tools/adb.html#move">using
-the adb utility</a>. Before installing the application, you need to build and package it
-into an <code>.apk</code> as described in <a href="{@docRoot}guide/developing/building/index.html">Building and
-Running Apps</a>. Once the application is installed, you can start the emulator from the command
-line, as described in this document, using any startup options necessary.
-When the emulator is running, you can also connect to the emulator instance's
-console to issue commands as needed.</p>
-
-<p>As you update your code, you periodically package and install it on the emulator.
-The emulator preserves the application and its state data across restarts,
-in a user-data disk partition. To ensure that the application runs properly
-as you update it, you may need to delete the emulator's user-data partition.
-To do so, start the emulator with the <code>-wipe-data</code> option.
-For more information about the user-data partition and other emulator storage,
-see <a href="#diskimages">Working with Emulator Disk Images</a>.</p>
-
-<a name="sdcard"></a>
-<a name="creating"></a>
-
-<h2>SD Card Emulation</h2>
-
-<p>You can create a disk image and then load it to the emulator at startup, to
-simulate the presence of a user's SD card in the device. To do this, you can use
-the android tool to create a new SD card image with a new AVD, or you can use
-the mksdcard utility included in the SDK. </p>
-
-<p>The sections below describe how to create an SD card disk image, how to copy
-files to it, and how to load it in the emulator at startup. </p>
-
-<p>Note that you can only load disk image at emulator startup. Similarly, you
-can not remove a simulated SD card from a running emulator. However, you can
-browse, send files to, and copy/remove files from a simulated SD card either
-with adb or the emulator. </p>
-
-<p>The emulator supports emulated SDHC cards, so you can create an SD card image
-of any size up to 128 gigabytes.</p>
-
-<h3 id="creatinga">Creating an SD card image using the android tool</h3>
-
-<p>The easiest way to create a new SD card is to use the android tool. When
-creating an AVD, you simply specify the <code>-c</code> option, like this: </p>
-
-<pre>android create avd -n <avd_name> -t <targetID> -c <size>[K|M]</pre>
-
-<p>You can also use the <code>-c</code> option to specify a path to an SD card
-image to use in the new AVD. For more information, see <a
-href="{@docRoot}guide/developing/devices/managing-avds-cmdline.html">Managing Virtual Devices
-from the Command Line</a>.
-</p>
-
-<h3 id="creatingm">Creating an SD card image using mksdcard</h3>
-
-<p>You can use the mksdcard tool, included in the SDK, to create a FAT32 disk
-image that you can load in the emulator at startup. You can access mksdcard in
-the tools/ directory of the SDK and create a disk image like this: </p>
-
-<pre>mksdcard <size> <file></pre>
-
-<p>For example:</p>
-
-<pre>mksdcard 1024M sdcard1.iso</pre>
-
-<p>For more information, see <a href="{@docRoot}guide/developing/tools/mksdcard.html"><code>mksdcard</code></a>.</p>
-
-<a name="copying"></a>
-<h3>Copying Files to a Disk Image</h3>
-
-<p>Once you have created the disk image, you can copy files to it prior to
-loading it in the emulator. To copy files, you can mount the image as a loop
-device and then copy the files to it, or you can use a utility such as mtools to
-copy the files directly to the image. The mtools package is available for Linux,
-Mac, and Windows.</p>
-
-<a name="loading"></a>
-<a name="step3" id="step3"></a>
-
-<h3>Loading the Disk Image at Emulator Startup</h3>
-
-<p>By default, the emulator loads the SD card image that is stored with the active
-AVD (see the <code>-avd</code> startup option).</p>
-
-<p>Alternatively, you ca start the emulator with the
-<code>-sdcard</code> flag and specify the name and path of your image (relative
-to the current working directory): </p>
-
-<pre>emulator -sdcard <filepath></pre>
-
-<a name="troubleshooting"></a>
-
-<h2>Troubleshooting Emulator Problems</h2>
-
-<p>The adb utility sees the emulator as an actual physical device. For this reason, you might have to use the -d flag with some common adb commands, such as <code>install</code>. The -d flag lets you specify which of several connected devices to use as the target of a command. If you don't specify -d, the emulator will target the first device in its list. For more information about adb, see <a href="{@docRoot}guide/developing/tools/adb.html">Android Debug Bridge</a>.</p>
-
-<p>For emulators running on Mac OS X, if you see an error "Warning: No DNS servers found" when starting the emulator, check to see whether you have an <code>/etc/resolv.conf</code> file. If not, please run the following line in a command window:</p>
+<p>For emulators running on Mac OS X, if you see an error {@code Warning: No DNS servers found}
+when starting the emulator, check to see whether you have an <code>/etc/resolv.conf</code> file. If
+not, please run the following line in a command window:</p>
<pre>ln -s /private/var/run/resolv.conf /etc/resolv.conf</pre>
-<p>See <a href="{@docRoot}resources/faq/index.html">Frequently Asked Questions</a> for more troubleshooting information. </p>
-
-<a name="limitations"></a>
- <h2>Emulator Limitations</h2>
- <p>In this release, the limitations of the emulator include: </p>
- <ul>
- <li>No support for placing or receiving actual phone calls. You can simulate phone calls (placed and received) through the emulator console, however. </li>
- <li>No support for USB connections</li>
- <li>No support for camera/video capture (input).</li>
- <li>No support for device-attached headphones</li>
- <li>No support for determining connected state</li>
- <li>No support for determining battery charge level and AC charging state</li>
- <li>No support for determining SD card insert/eject</li>
- <li>No support for Bluetooth</li>
- </ul>
+<p>See <a href="{@docRoot}resources/faq/index.html">Frequently Asked Questions</a> for more
+troubleshooting information. </p>
diff --git a/docs/html/guide/developing/tools/emulator.jd b/docs/html/guide/developing/tools/emulator.jd
index 09e41c3..21d4263 100644
--- a/docs/html/guide/developing/tools/emulator.jd
+++ b/docs/html/guide/developing/tools/emulator.jd
@@ -8,8 +8,8 @@
<h2>In this document</h2>
<ol>
- <li><a href="#startup-options">Emulator Startup Options</a></li>
- <li><a href="#KeyMapping">Emulator Keyboard Mapping</a></li>
+ <li><a href="#KeyMapping">Keyboard Commands</a></li>
+ <li><a href="#startup-options">Command Line Parameters</a></li>
</ol>
<h2>See also</h2>
@@ -22,461 +22,21 @@
</div>
-<p>The Android SDK includes a mobile device emulator — a virtual mobile device
+<p>The Android SDK includes a mobile device emulator — a virtual mobile device
that runs on your computer. The emulator lets you develop and test
Android applications without using a physical device.</p>
-<p>When the emulator is running, you can interact with the emulated mobile
-device just as you would an actual mobile device, except that you use your mouse
-pointer to "touch" the touchscreen and can use some keyboard keys to
-invoke certain keys on the device. </p>
-
-<p>This document is a reference to the available command line options and the keyboard mapping to device keys.
-For a complete guide to using the Android Emulator, see
+<p>This document is a reference to the available command line options and the keyboard mapping to
+device keys.
+For a complete guide to using the Android Emulator, see
<a href="{@docRoot}guide/developing/devices/emulator.html">Using the Android Emulator</a>.
-<h2 id="startup-options">Emulator Startup Options</h2>
+<h2 id="KeyMapping">Keyboard Commands</h2>
-<p>The emulator supports a variety of options that you can specify
-when launching the emulator, to control its appearance or behavior.
-Here's the command-line usage for launching the emulator with options: </p>
+<p>Table 1 summarizes the mappings between the emulator keys and the keys of your keyboard.</p>
-<pre>emulator -avd <avd_name> [-<option> [<value>]] ... [-<qemu args>]</pre>
-
-<p class="table-caption"><strong>Table 1.</strong>Emulator startup options</p>
-
-<table>
-<tr>
- <th width="10%" >Category</th>
- <th width="20%" >Option</th>
- <th width="30%" >Description</th>
- <th width="40%" >Comments</th>
-</tr>
-
-<tr>
- <td rowspan="9">Help</td>
- <td><code>-help</code></td>
- <td>Print a list of all emulator options.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-all</code></td>
- <td>Print help for all startup options.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-<option></code></td>
- <td>Print help for a specific startup option.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-debug-tags</code></td>
- <td>Print a list of all tags for <code>-debug <tags></code>.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-disk-images</code></td>
- <td>Print help for using emulator disk images.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-environment</code></td>
- <td>Print help for emulator environment variables.</td>
- <td> </td>
-</tr><tr>
- <td><code>-help-keys</code></td>
- <td>Print the current mapping of keys.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-keyset-file</code></td>
- <td>Print help for defining a custom key mappings file.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-virtual-device</code></td>
- <td>Print help for Android Virtual Device usage.</td>
- <td> </td>
-</tr>
-<tr>
- <td>AVD</td>
- <td><code>-avd <avd_name></code> or <br>
- <code>@<avd_name></code></td>
- <td><strong>Required</strong>. Specifies the AVD to load for this emulator
- instance.</td>
- <td>You must create an AVD configuration before launching the emulator. For
- information, see <a href="{@docRoot}guide/developing/devices/managing-avds.html#createavd">
- Managing AVDs with AVD Manager</a>.</td>
-<tr>
- <td rowspan="7">Disk Images</td>
- <td><code>-cache <filepath></code></td>
- <td>Use <filepath> as the working cache partition image. </td>
- <td>Optionally, you can specify a path relative to the current working directory.
- If no cache file is specified, the emulator's default behavior is to use a temporary file instead.
- <p>For more information on disk images, use <code>-help-disk-images</code>.</p>
-</td></tr>
-<tr>
- <td><code>-data <filepath></code></td>
- <td>Use <filepath> as the working user-data disk image. </td>
- <td>Optionally, you can specify a path relative to the current working directory.
- If <code>-data</code> is not used, the emulator looks for a file named "userdata-qemu.img"
- in the storage area of the AVD being used (see <code>-avd</code>).
-</td></tr>
-<!--
-<tr>
- <td><code>-datadir <dir></code></td>
- <td>Search for the user-data disk image specified in <code>-data</code> in <dir></td>
- <td><code><dir></code> is a path relative to the current working directory.
-
-<p>If you do not specify <code>-datadir</code>, the emulator looks for the user-data image
-in the storage area of the AVD being used (see <code>-avd</code>)</p><p>For more information
-on disk images, use <code>-help-disk-images</code>.</p>
-</td></tr>
--->
-<!--
-<tr>
- <td><code>-image <filepath></code></td>
- <td>Use <filepath> as the system image.</td>
- <td>Optionally, you can specify a path relative to the current working directory.
- Default is <system>/system.img.</td>
-</tr>
--->
-<tr>
- <td><code>-initdata <filepath></code></td>
- <td>When resetting the user-data image (through <code>-wipe-data</code>), copy the contents
- of this file to the new user-data disk image. By default, the emulator copies the <code><system>/userdata.img</code>.</td>
- <td>Optionally, you can specify a path relative to the current working directory. See also <code>-wipe-data</code>. <p>For more information on disk images, use <code>-help-disk-images</code>.</p></td>
-</tr>
-<!--
-<tr>
- <td><code>-kernel <filepath></code></td>
- <td>Use <filepath> as the emulated kernel.</td>
- <td>Optionally, you can specify a path relative to the current working directory. </td>
-</tr>
--->
-<tr>
- <td><code>-nocache</code></td>
- <td>Start the emulator without a cache partition.</td>
- <td>See also <code>-cache <file></code>.</td>
-</tr>
-<tr>
- <td><code>-ramdisk <filepath></code></td>
- <td>Use <filepath> as the ramdisk image.</td>
- <td>Default value is <code><system>/ramdisk.img</code>.
- <p>Optionally, you can specify a path relative to the current working directory. For more information on disk images, use <code>-help-disk-images</code>.</p>
-</td>
-</tr>
-<tr>
- <td><code>-sdcard <filepath></code></td>
- <td>Use <file> as the SD card image.</td>
- <td>Default value is <code><system>/sdcard.img</code>.
- <p>Optionally, you can specify a path relative to the current working directory. For more information on disk images, use <code>-help-disk-images</code>.</p>
-</td>
-</tr>
-<!--
-<tr>
- <td><code>-system <dirpath></code></td>
- <td>Search for system, ramdisk and user data images in <dir>.</td>
- <td><code><dir></code> is a directory path relative to the current
- working directory.</td>
-</tr>
--->
-<tr>
- <td><code>-wipe-data</code></td>
- <td>Reset the current user-data disk image (that is, the file specified by <code>-datadir</code> and
- <code>-data</code>, or the default file). The emulator deletes all data from the user data image file,
- then copies the contents of the file at <code>-inidata</code> data to the image file before starting.
- </td>
- <td>See also <code>-initdata</code>.
- <p>For more information on disk images, use <code>-help-disk-images</code>.</p>
-</td>
-</tr>
-<tr>
- <td rowspan="9">Debug</td>
- <td><code>-debug <tags></code></td>
- <td>Enable/disable debug messages for the specified debug tags.</td>
- <td><code><tags></code> is a space/comma/column-separated list of debug component names.
- Use <code>-help-debug-tags</code> to print a list of debug component names that you can use. </td>
-</tr>
-<tr>
- <td><code>-debug-<tag></code></td>
- <td>Enable/disable debug messages for the specified debug tag.</td>
- <td rowspan="2">Use <code>-help-debug-tags</code> to print a list of debug component names that you can use in <code><tag></code>. </td>
-</tr>
-<tr>
- <td><code>-debug-no-<tag></code></td>
- <td>Disable debug messages for the specified debug tag.</td>
-</tr>
-<tr>
- <td><code>-logcat <logtags></code></td>
- <td>Enable logcat output with given tags.</td>
- <td>If the environment variable ANDROID_LOG_TAGS is defined and not
- empty, its value will be used to enable logcat output by default.</td>
-</tr>
-<tr>
- <td><code>-shell</code></td>
- <td>Create a root shell console on the current terminal.</td>
- <td>You can use this command even if the adb daemon in the emulated system is broken.
- Pressing Ctrl-c from the shell stops the emulator instead of the shell.</td>
-</tr>
-<tr>
- <td><code>-shell-serial <device></code></td>
- <td>Enable the root shell (as in <code>-shell</code> and specify the QEMU character
- device to use for communication with the shell.</td>
- <td><device> must be a QEMU device type. See the documentation for '-serial <em>dev</em>' at
- <a href="http://wiki.qemu.org/download/qemu-doc.html">wiki.qemu.org</a>
- for more information.</p>
-
-<p>Here are some examples: </p>
-<ul>
- <li><code>-shell-serial stdio</code> is identical to <code>-shell</code></li>
- <li><code>-shell-serial tcp::4444,server,nowait</code> lets you communicate with the shell over TCP port 4444</li>
- <li><code>-shell-serial fdpair:3:6</code> lets a parent process communicate with the shell using fds 3 (in) and 6 (out)</li>
- <li><code>-shell-serial fdpair:0:1</code> uses the normal stdin and stdout fds, except that QEMU won't tty-cook the data.</li>
- </ul>
-</td>
-</tr>
-<tr>
- <td><code>-show-kernel <name></code></td>
- <td>Display kernel messages.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-trace <name></code></td>
- <td>Enable code profiling (press F9 to start), written to a specified file.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-verbose</code></td>
- <td>Enable verbose output.</td>
- <td>Equivalent to <code>-debug-init</code>.
-<p>You can define the default verbose output options used by emulator instances in the Android environment variable
-ANDROID_VERBOSE. Define the options you want to use in a comma-delimited list, specifying only the stem of each option:
-<code>-debug-<tags>.</code> </p>
-<p>Here's an example showing ANDROID_VERBOSE defined with the <code>-debug-init</code> and <code>-debug-modem</code> options:
-<p><code>ANDROID_VERBOSE=init,modem</code></p>
-<p>For more information about debug tags, use <code><-help-debug-tags></code>.</p>
-</td>
-</tr>
-<tr>
- <td rowspan="6">Media</td>
- <td><code>-audio <backend></code></td>
- <td>Use the specified audio backend.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-audio-in <backend></code></td>
- <td>Use the specified audio-input backend.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-audio-out <backend></code></td>
- <td>Use the specified audio-output backend.</td>
- <td> </td>
-</tr>
-<!--<tr>
- <td><code>-mic <device or file></code></td>
- <td>Use device or WAV file for audio input.</td>
- <td> </td>
-</tr>
--->
-<tr>
- <td><code>-noaudio</code></td>
- <td>Disable audio support in the current emulator instance.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-radio <device></code></td>
- <td>Redirect radio modem interface to a host character device.</td>
- <td> </td></tr>
-<tr>
- <td><code>-useaudio</code></td>
- <td>Enable audio support in the current emulator instance.</td>
- <td>Enabled by default. </td>
-</tr>
-
-<tr>
- <td rowspan="7">Network</td>
- <td><code>-dns-server <servers></code></td>
- <td>Use the specified DNS server(s). </td>
- <td>The value of <code><servers></code> must be a comma-separated list of up to 4 DNS server names or
- IP addresses.</td>
-</tr>
-<tr>
- <td><code>-http-proxy <proxy></code></td>
- <td>Make all TCP connections through a specified HTTP/HTTPS proxy</td>
- <td>The value of <code><proxy></code> can be one of the following:<br>
- <code>http://<server>:<port></code><br>
- <code>http://<username>:<password>@<server>:<port></code>
- <p>The <code>http://</code> prefix can be omitted. If the <code>-http-proxy <proxy></code> command is not supplied,
- the emulator looks up the <code>http_proxy</code> environment variable and automatically uses any value matching
- the <code><proxy></code> format described above.</p></td>
-</tr>
-<tr>
- <td><code>-netdelay <delay></code></td>
- <td>Set network latency emulation to <delay>.</td>
- <td>Default value is <code>none</code>. See the table in <a href="#netdelay">Network Delay Emulation</a> for
- supported <code><delay></code> values. </td>
-</tr>
-<tr>
- <td><code>-netfast</code></td>
- <td>Shortcut for <code>-netspeed full -netdelay none</code></td>
- <td> </td></tr>
-<tr>
- <td><code>-netspeed <speed></code></td>
- <td>Set network speed emulation to <speed>.</td>
- <td>Default value is <code>full</code>. See the table in <a href="#netspeed">Network Speed Emulation</a> for
- supported <code><speed></code> values. </td>
-</tr>
-<tr>
- <td><code>-port <port></code></td>
- <td>Set the console port number for this emulator instance to <code><port></code>.</td>
- <td>The console port number must be an even integer between 5554 and 5584, inclusive. <code><port></code>+1
- must also be free and will be reserved for ADB.</td>
-</tr>
-<tr>
- <td><code>-report-console <socket></code></td>
- <td>Report the assigned console port for this emulator instance to a remote third party
- before starting the emulation. </td>
- <td><code><socket></code> must use one of these formats:
-
-<p><code>tcp:<port>[,server][,max=<seconds>]</code></br>
-<code>unix:<port>[,server][,max=<seconds>]</code></p>
-
-<p>Use <code>-help-report-console</code></p> to view more information about this topic. </td>
-</tr>
-<tr>
- <td rowspan="8">System</td>
- <td><code>-cpu-delay <delay></code></td>
- <td>Slow down emulated CPU speed by <delay> </td>
- <td>Supported values for <delay> are integers between 0 and 1000.
-
-<p>Note that the <delay> does not correlate to clock speed or other absolute metrics
-— it simply represents an abstract, relative delay factor applied non-deterministically
-in the emulator. Effective performance does not always
-scale in direct relationship with <delay> values.</p>
-</td>
-</tr>
-<tr>
- <td><code>-gps <device></code></td>
- <td>Redirect NMEA GPS to character device.</td>
- <td>Use this command to emulate an NMEA-compatible GPS unit connected to
- an external character device or socket. The format of <code><device></code> must be QEMU-specific
- serial device specification. See the documentation for 'serial -dev' at
- <a href="http://www.bellard.org/qemu/qemu-doc.html#SEC10">http://www.bellard.org/qemu/qemu-doc.html#SEC10</a>.
-</td>
-</tr>
-<tr>
- <td><code>-nojni</code></td>
- <td>Disable JNI checks in the Dalvik runtime.</td><td> </td></tr>
-<tr>
- <td><code>-qemu</code></td>
- <td>Pass arguments to qemu.</td>
- <td> </td></tr>
-<tr>
- <td><code>-qemu -h</code></td>
- <td>Display qemu help.</td>
- <td></td></tr>
-<tr>
- <td><code>-radio <device></code></td>
- <td>Redirect radio mode to the specified character device.</td>
- <td>The format of <code><device></code> must be QEMU-specific
- serial device specification. See the documentation for 'serial -dev' at
-<a href="http://www.bellard.org/qemu/qemu-doc.html#SEC10">http://www.bellard.org/qemu/qemu-doc.html#SEC10</a>.
-</td>
-</tr>
-<tr>
- <td><code>-timezone <timezone></code></td>
- <td>Set the timezone for the emulated device to <timezone>, instead of the host's timezone.</td>
- <td><code><timezone></code> must be specified in zoneinfo format. For example:
-<p>"America/Los_Angeles"<br>
-"Europe/Paris"</p>
-</td>
-</tr>
-<tr>
- <td><code>-version</code></td>
- <td>Display the emulator's version number.</td>
- <td> </td>
-</tr>
-<tr>
- <td rowspan="12">UI</td>
- <td><code>-dpi-device <dpi></code></td>
- <td>Scale the resolution of the emulator to match the screen size
- of a physical device.</td>
- <td>The default value is 165. See also <code>-scale</code>.</td>
-</tr>
-<tr>
- <td><code>-no-boot-anim</code></td>
- <td>Disable the boot animation during emulator startup.</td>
- <td>Disabling the boot animation can speed the startup time for the emulator.</td>
-</tr>
-<tr>
- <td><code>-no-window</code></td>
- <td>Disable the emulator's graphical window display.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-scale <scale></code></td>
- <td>Scale the emulator window. </td>
- <td><code><scale></code> is a number between 0.1 and 3 that represents the desired scaling factor. You can
- also specify scale as a DPI value if you add the suffix "dpi" to the scale value. A value of "auto"
- tells the emulator to select the best window size.</td>
-</tr>
-<tr>
- <td><code>-raw-keys</code></td>
- <td>Disable Unicode keyboard reverse-mapping.</td>
- <td> </td></tr>
-<tr>
- <td><code>-noskin</code></td>
- <td>Don't use any emulator skin.</td>
- <td> </td></tr>
-<tr>
- <td><code>-keyset <file></code></td>
- <td>Use the specified keyset file instead of the default.</td>
- <td>The keyset file defines the list of key bindings between the emulator and the host keyboard.
- For more information, use <code>-help-keyset</code> to print information about this topic.
-</td>
-</tr>
-<tr>
- <td><code>-onion <image></code></td>
- <td>Use overlay image over screen.</td>
- <td>No support for JPEG. Only PNG is supported.</td></tr>
-<tr>
- <td><code>-onion-alpha <percent></code></td>
- <td>Specify onion skin translucency value (as percent).
- <td>Default is 50.</td>
-</tr>
-<tr>
- <td><code>-onion-rotation <position></code></td>
- <td>Specify onion skin rotation.
- <td><code><position></code> must be one of the values 0, 1, 2, 3.</td>
-</tr>
-<tr>
- <td><code>-skin <skinID></code></td>
- <td>This emulator option is deprecated. </td>
- <td>Please set skin options using AVDs, rather than by using this emulator
-option. Using this option may yield unexpected and in some cases misleading
-results, since the density with which to render the skin may not be defined.
-AVDs let you associate each skin with a default density and override the default
-as needed. For more information, see <a
-href="{@docRoot}guide/developing/devices/managing-avds.html#createavd">
-Managing Virtual Devices with AVD Manager</a>.
-</td>
-</tr>
-<tr>
- <td><code>-skindir <dir></code></td>
- <td>This emulator option is deprecated. </td>
- <td>See comments for <code>-skin</code>, above.</td></tr>
-</table>
-
-
-
-<h2 id="KeyMapping">Emulator Keyboard Mapping</h2>
-
-<p>The table below summarizes the mappings between the emulator keys and and
-the keys of your keyboard. </p>
-<p class="table-caption"><strong>Table 2.</strong> Emulator keyboard mapping</p>
+<p class="table-caption"><strong>Table 1.</strong> Emulator keyboard mapping</p>
<table border="0" style="clear:left;">
<tr>
<th>Emulated Device Key </th>
@@ -569,4 +129,453 @@
</tr>
</table>
-<p>Note that, to use keypad keys, you must first disable NumLock on your development computer. </p>
+
+<h2 id="startup-options">Command Line Parameters</h2>
+
+<p>The emulator supports a variety of options that you can specify
+when launching the emulator, to control its appearance or behavior.
+Here's the command-line syntax of the options available to the {@code emulator} program:</p>
+
+<pre>emulator -avd <avd_name> [-<option> [<value>]] ... [-<qemu args>]</pre>
+
+<p class="table-caption"><strong>Table 2.</strong> Emulator command line parameters</p>
+<table>
+<tr>
+ <th width="10%" >Category</th>
+ <th width="20%" >Option</th>
+ <th width="30%" >Description</th>
+ <th width="40%" >Comments</th>
+</tr>
+
+<tr>
+ <td>AVD</td>
+ <td><code>-avd <avd_name></code> or <br>
+ <code>@<avd_name></code></td>
+ <td><strong>Required</strong>. Specifies the AVD to load for this emulator
+ instance.</td>
+ <td>You must create an AVD configuration before launching the emulator. For
+ information, see <a href="{@docRoot}guide/developing/devices/managing-avds.html">Managing
+ AVDs with AVD Manager</a>.</td>
+<tr>
+ <td rowspan="7">Disk Images</td>
+ <td><code>-cache <filepath></code></td>
+ <td>Use <filepath> as the working cache partition image. </td>
+ <td>An absolute or relative path to the current working directory.
+ If no cache file is specified, the emulator's default behavior is to use a temporary file instead.
+ <p>For more information on disk images, use <code>-help-disk-images</code>.</p>
+</td></tr>
+<tr>
+ <td><code>-data <filepath></code></td>
+ <td>Use {@code <filepath>} as the working user-data disk image. </td>
+ <td>Optionally, you can specify a path relative to the current working directory.
+ If <code>-data</code> is not used, the emulator looks for a file named {@code userdata-qemu.img}
+ in the storage area of the AVD being used (see <code>-avd</code>).
+</td></tr>
+<!--
+<tr>
+ <td><code>-datadir <dir></code></td>
+ <td>Search for the user-data disk image specified in <code>-data</code> in <dir></td>
+ <td><code><dir></code> is a path relative to the current working directory.
+
+<p>If you do not specify <code>-datadir</code>, the emulator looks for the user-data image
+in the storage area of the AVD being used (see <code>-avd</code>)</p><p>For more information
+on disk images, use <code>-help-disk-images</code>.</p>
+</td></tr>
+-->
+<!--
+<tr>
+ <td><code>-image <filepath></code></td>
+ <td>Use <filepath> as the system image.</td>
+ <td>Optionally, you can specify a path relative to the current working directory.
+ Default is <system>/system.img.</td>
+</tr>
+-->
+<tr>
+ <td><code>-initdata <filepath></code></td>
+ <td>When resetting the user-data image (through <code>-wipe-data</code>), copy the contents
+ of this file to the new user-data disk image. By default, the emulator copies the <code><system>/userdata.img</code>.</td>
+ <td>Optionally, you can specify a path relative to the current working directory. See also <code>-wipe-data</code>.
+ <p>For more information on disk images, use <code>-help-disk-images</code>.</p></td>
+</tr>
+<tr>
+ <td><code>-nocache</code></td>
+ <td>Start the emulator without a cache partition.</td>
+ <td>See also <code>-cache <file></code>.</td>
+</tr>
+<tr>
+ <td><code>-ramdisk <filepath></code></td>
+ <td>Use <filepath> as the ramdisk image.</td>
+ <td>Default value is <code><system>/ramdisk.img</code>.
+ <p>Optionally, you can specify a path relative to the current working directory.
+ For more information on disk images, use <code>-help-disk-images</code>.</p>
+</td>
+</tr>
+<tr>
+ <td><code>-sdcard <filepath></code></td>
+ <td>Use <file> as the SD card image.</td>
+ <td>Default value is <code><system>/sdcard.img</code>.
+ <p>Optionally, you can specify a path relative to the current working directory. For more information on disk images, use <code>-help-disk-images</code>.</p>
+</td>
+</tr>
+<!--
+<tr>
+ <td><code>-system <dirpath></code></td>
+ <td>Search for system, ramdisk and user data images in <dir>.</td>
+ <td><code><dir></code> is a directory path relative to the current
+ working directory.</td>
+</tr>
+-->
+<tr>
+ <td><code>-wipe-data</code></td>
+ <td>Reset the current user-data disk image (that is, the file specified by <code>-datadir</code> and
+ <code>-data</code>, or the default file). The emulator deletes all data from the user data image file,
+ then copies the contents of the file at <code>-inidata</code> data to the image file before starting.
+ </td>
+ <td>See also <code>-initdata</code>.
+ <p>For more information on disk images, use <code>-help-disk-images</code>.</p>
+</td>
+</tr>
+<tr>
+ <td rowspan="9">Debug</td>
+ <td><code>-debug <tags></code></td>
+ <td>Enable/disable debug messages for the specified debug tags.</td>
+ <td><code><tags></code> is a space/comma/column-separated list of debug component names.
+ Use <code>-help-debug-tags</code> to print a list of debug component names that you can use. </td>
+</tr>
+<tr>
+ <td><code>-debug-<tag></code></td>
+ <td>Enable/disable debug messages for the specified debug tag.</td>
+ <td rowspan="2">Use <code>-help-debug-tags</code> to print a list of debug component names that you can use in <code><tag></code>. </td>
+</tr>
+<tr>
+ <td><code>-debug-no-<tag></code></td>
+ <td>Disable debug messages for the specified debug tag.</td>
+</tr>
+<tr>
+ <td><code>-logcat <logtags></code></td>
+ <td>Enable logcat output with given tags.</td>
+ <td>If the environment variable ANDROID_LOG_TAGS is defined and not
+ empty, its value will be used to enable logcat output by default.</td>
+</tr>
+<tr>
+ <td><code>-shell</code></td>
+ <td>Create a root shell console on the current terminal.</td>
+ <td>You can use this command even if the adb daemon in the emulated system is broken.
+ Pressing Ctrl-c from the shell stops the emulator instead of the shell.</td>
+</tr>
+<tr>
+ <td><code>-shell-serial <device></code></td>
+ <td>Enable the root shell (as in <code>-shell</code> and specify the QEMU character
+ device to use for communication with the shell.</td>
+ <td><device> must be a QEMU device type. See the documentation for '-serial <em>dev</em>' at
+ <a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a>
+ for a list of device types.
+
+<p>Here are some examples: </p>
+<ul>
+ <li><code>-shell-serial stdio</code> is identical to <code>-shell</code></li>
+ <li><code>-shell-serial tcp::4444,server,nowait</code> lets you communicate with the shell over TCP port 4444</li>
+ <li><code>-shell-serial fdpair:3:6</code> lets a parent process communicate with the shell using fds 3 (in) and 6 (out)</li>
+ <li><code>-shell-serial fdpair:0:1</code> uses the normal stdin and stdout fds, except that QEMU won't tty-cook the data.</li>
+ </ul>
+</td>
+</tr>
+<tr>
+ <td><code>-show-kernel <name></code></td>
+ <td>Display kernel messages.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-trace <name></code></td>
+ <td>Enable code profiling (press F9 to start), written to a specified file.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-verbose</code></td>
+ <td>Enable verbose output.</td>
+ <td>Equivalent to <code>-debug-init</code>.
+<p>You can define the default verbose output options used by emulator instances in the Android environment variable
+ANDROID_VERBOSE. Define the options you want to use in a comma-delimited list, specifying only the stem of each option:
+<code>-debug-<tags>.</code> </p>
+<p>Here's an example showing ANDROID_VERBOSE defined with the <code>-debug-init</code> and <code>-debug-modem</code> options:
+<p><code>ANDROID_VERBOSE=init,modem</code></p>
+<p>For more information about debug tags, use <code><-help-debug-tags></code>.</p>
+</td>
+</tr>
+<tr>
+ <td rowspan="6">Media</td>
+ <td><code>-audio <backend></code></td>
+ <td>Use the specified audio backend.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-audio-in <backend></code></td>
+ <td>Use the specified audio-input backend.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-audio-out <backend></code></td>
+ <td>Use the specified audio-output backend.</td>
+ <td> </td>
+</tr>
+<!--<tr>
+ <td><code>-mic <device or file></code></td>
+ <td>Use device or WAV file for audio input.</td>
+ <td> </td>
+</tr>
+-->
+<tr>
+ <td><code>-noaudio</code></td>
+ <td>Disable audio support in the current emulator instance.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-radio <device></code></td>
+ <td>Redirect radio modem interface to a host character device.</td>
+ <td> </td></tr>
+<tr>
+ <td><code>-useaudio</code></td>
+ <td>Enable audio support in the current emulator instance.</td>
+ <td>Enabled by default. </td>
+</tr>
+
+<tr>
+ <td rowspan="7">Network</td>
+ <td><code>-dns-server <servers></code></td>
+ <td>Use the specified DNS server(s). </td>
+ <td>The value of <code><servers></code> must be a comma-separated list of up to 4 DNS server names or
+ IP addresses.</td>
+</tr>
+<tr>
+ <td><code>-http-proxy <proxy></code></td>
+ <td>Make all TCP connections through a specified HTTP/HTTPS proxy</td>
+ <td>The value of <code><proxy></code> can be one of the following:<br>
+ <code>http://<server>:<port></code><br>
+ <code>http://<username>:<password>@<server>:<port></code>
+ <p>The <code>http://</code> prefix can be omitted. If the <code>-http-proxy <proxy></code> command is not supplied,
+ the emulator looks up the <code>http_proxy</code> environment variable and automatically uses any value matching
+ the <code><proxy></code> format described above.</p></td>
+</tr>
+<tr>
+ <td><code>-netdelay <delay></code></td>
+ <td>Set network latency emulation to <delay>.</td>
+ <td>Default value is <code>none</code>. See the table in
+ <a href="{@docRoot}guide/developing/devices/emulator.html#netdelay">Network Delay Emulation</a>
+ for supported <code><delay></code> values. </td>
+</tr>
+<tr>
+ <td><code>-netfast</code></td>
+ <td>Shortcut for <code>-netspeed full -netdelay none</code></td>
+ <td> </td></tr>
+<tr>
+ <td><code>-netspeed <speed></code></td>
+ <td>Set network speed emulation to <speed>.</td>
+ <td>Default value is <code>full</code>. See the table in
+ <a href="{@docRoot}guide/developing/devices/emulator.html#netspeed">Network Speed Emulation</a> for
+ supported <code><speed></code> values. </td>
+</tr>
+<tr>
+ <td><code>-port <port></code></td>
+ <td>Set the console port number for this emulator instance to <code><port></code>.</td>
+ <td>The console port number must be an even integer between 5554 and 5584, inclusive. <code><port></code>+1
+ must also be free and will be reserved for ADB.</td>
+</tr>
+<tr>
+ <td><code>-report-console <socket></code></td>
+ <td>Report the assigned console port for this emulator instance to a remote third party
+ before starting the emulation. </td>
+ <td><code><socket></code> must use one of these formats:
+
+<p><code>tcp:<port>[,server][,max=<seconds>]</code></br>
+<code>unix:<port>[,server][,max=<seconds>]</code></p>
+
+<p>Use <code>-help-report-console</code></p> to view more information about this topic. </td>
+</tr>
+<tr>
+ <td rowspan="10">System</td>
+ <td><code>-cpu-delay <delay></code></td>
+ <td>Slow down emulated CPU speed by <delay> </td>
+ <td>Supported values for <delay> are integers between 0 and 1000.
+
+<p>Note that the <delay> does not correlate to clock speed or other absolute metrics
+— it simply represents an abstract, relative delay factor applied non-deterministically
+in the emulator. Effective performance does not always
+scale in direct relationship with <delay> values.</p>
+</td>
+</tr>
+<tr>
+ <td><code>-gps <device></code></td>
+ <td>Redirect NMEA GPS to character device.</td>
+ <td>Use this command to emulate an NMEA-compatible GPS unit connected to
+ an external character device or socket. The format of <code><device></code> must be QEMU-specific
+ serial device specification. See the documentation for 'serial -dev' at
+ <a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a>.
+</td>
+</tr>
+<tr>
+ <td><code>-nojni</code></td>
+ <td>Disable JNI checks in the Dalvik runtime.</td><td> </td></tr>
+<tr>
+ <td><code>-qemu</code></td>
+ <td>Pass arguments to the qemu emulator software.</td>
+ <td><p class="caution"><strong>Important:</strong> When using this option, make sure it is the
+ <em>last option</em> specified, since all options after it are interpretted as qemu-specific
+ options.</p></td></tr>
+<tr>
+ <td><code>-qemu -enable-kvm</code></td>
+ <td>Enable KVM acceleration of the emulator virtual machine.</td>
+ <td>This option is only effective when your system is set up to use
+ <a href="{@docRoot}guide/developing/devices/emulator.html#vm-linux">KVM-based VM acceleration</a>.
+ You can optionally specify a memory size ({@code -m <size>}) for the VM, which should match
+ your emulator's memory size:</p>
+ {@code -qemu -m 512 -enable-kvm}<br>
+ {@code -qemu -m 1024 -enable-kvm}
+ </td></tr>
+<tr>
+ <td><code>-qemu -h</code></td>
+ <td>Display qemu help.</td>
+ <td></td></tr>
+<tr>
+ <td><code>-gpu on</code></td>
+ <td>Turn on graphics acceleration for the emulator.</td>
+ <td>This option is only available for emulators using a system image with API Level 15, revision 3
+ and higher. For more information, see
+ <a href="{@docRoot}guide/developing/devices/emulator.html#accel-graphics">Using the Android
+ Emulator</a>.</td></tr>
+<tr>
+ <td><code>-radio <device></code></td>
+ <td>Redirect radio mode to the specified character device.</td>
+ <td>The format of <code><device></code> must be QEMU-specific
+ serial device specification. See the documentation for 'serial -dev' at
+<a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a>.
+</td>
+</tr>
+<tr>
+ <td><code>-timezone <timezone></code></td>
+ <td>Set the timezone for the emulated device to <timezone>, instead of the host's timezone.</td>
+ <td><code><timezone></code> must be specified in zoneinfo format. For example:
+<p>"America/Los_Angeles"<br>
+"Europe/Paris"</p>
+</td>
+</tr>
+<tr>
+ <td><code>-version</code></td>
+ <td>Display the emulator's version number.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td rowspan="12">UI</td>
+ <td><code>-dpi-device <dpi></code></td>
+ <td>Scale the resolution of the emulator to match the screen size
+ of a physical device.</td>
+ <td>The default value is 165. See also <code>-scale</code>.</td>
+</tr>
+<tr>
+ <td><code>-no-boot-anim</code></td>
+ <td>Disable the boot animation during emulator startup.</td>
+ <td>Disabling the boot animation can speed the startup time for the emulator.</td>
+</tr>
+<tr>
+ <td><code>-no-window</code></td>
+ <td>Disable the emulator's graphical window display.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-scale <scale></code></td>
+ <td>Scale the emulator window. </td>
+ <td><code><scale></code> is a number between 0.1 and 3 that represents the desired scaling factor. You can
+ also specify scale as a DPI value if you add the suffix "dpi" to the scale value. A value of "auto"
+ tells the emulator to select the best window size.</td>
+</tr>
+<tr>
+ <td><code>-raw-keys</code></td>
+ <td>Disable Unicode keyboard reverse-mapping.</td>
+ <td> </td></tr>
+<tr>
+ <td><code>-noskin</code></td>
+ <td>Don't use any emulator skin.</td>
+ <td> </td></tr>
+<tr>
+ <td><code>-keyset <file></code></td>
+ <td>Use the specified keyset file instead of the default.</td>
+ <td>The keyset file defines the list of key bindings between the emulator and the host keyboard.
+ For more information, use <code>-help-keyset</code> to print information about this topic.
+</td>
+</tr>
+<tr>
+ <td><code>-onion <image></code></td>
+ <td>Use overlay image over screen.</td>
+ <td>No support for JPEG. Only PNG is supported.</td></tr>
+<tr>
+ <td><code>-onion-alpha <percent></code></td>
+ <td>Specify onion skin translucency value (as percent).
+ <td>Default is 50.</td>
+</tr>
+<tr>
+ <td><code>-onion-rotation <position></code></td>
+ <td>Specify onion skin rotation.
+ <td><code><position></code> must be one of the values 0, 1, 2, 3.</td>
+</tr>
+<tr>
+ <td><code>-skin <skinID></code></td>
+ <td>This emulator option is deprecated. </td>
+ <td>Please set skin options using AVDs, rather than by using this emulator
+option. Using this option may yield unexpected and in some cases misleading
+results, since the density with which to render the skin may not be defined.
+AVDs let you associate each skin with a default density and override the default
+as needed. For more information, see <a
+href="{@docRoot}guide/developing/devices/managing-avds.html">Managing Virtual Devices
+with AVD Manager</a>.
+</td>
+</tr>
+<tr>
+ <td><code>-skindir <dir></code></td>
+ <td>This emulator option is deprecated. </td>
+ <td>See comments for <code>-skin</code>, above.</td>
+</tr>
+<tr>
+ <td rowspan="9">Help</td>
+ <td><code>-help</code></td>
+ <td>Print a list of all emulator options.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-help-all</code></td>
+ <td>Print help for all startup options.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-help-<option></code></td>
+ <td>Print help for a specific startup option.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-help-debug-tags</code></td>
+ <td>Print a list of all tags for <code>-debug <tags></code>.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-help-disk-images</code></td>
+ <td>Print help for using emulator disk images.</td>
+ <td> </td>
+ </tr>
+<tr>
+ <td><code>-help-environment</code></td>
+ <td>Print help for emulator environment variables.</td>
+ <td> </td>s
+</tr><tr>
+ <td><code>-help-keys</code></td>
+ <td>Print the current mapping of keys.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-help-keyset-file</code></td>
+ <td>Print help for defining a custom key mappings file.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-help-virtual-device</code></td>
+ <td>Print help for Android Virtual Device usage.</td>
+ <td> </td>
+</tr>
+</table>
diff --git a/docs/html/guide/developing/tools/monkeyrunner_concepts.jd b/docs/html/guide/developing/tools/monkeyrunner_concepts.jd
index 499b610..346a0c6 100644
--- a/docs/html/guide/developing/tools/monkeyrunner_concepts.jd
+++ b/docs/html/guide/developing/tools/monkeyrunner_concepts.jd
@@ -236,7 +236,7 @@
You can generate an API reference for monkeyrunner by running:
</p>
<pre>
-monkeyrunner <format> help.py <outfile>
+monkeyrunner help.py <format> <outfile>
</pre>
<p>
The arguments are:
diff --git a/docs/html/guide/market/expansion-files.jd b/docs/html/guide/market/expansion-files.jd
index 01acb33..36b8f9c 100644
--- a/docs/html/guide/market/expansion-files.jd
+++ b/docs/html/guide/market/expansion-files.jd
@@ -1088,12 +1088,8 @@
<dd>Most applications don't need to use this class. This class defines a {@link
android.content.ContentProvider} that marshals the data from the ZIP files through a content
provider {@link android.net.Uri} in order to provide file access for certain Android APIs that
-expect {@link android.net.Uri} access to media files.
- <p>The sample application available in the
-Apk Expansion package demonstrates a scenario in which this class is useful
-to specify a video with {@link android.widget.VideoView#setVideoURI
-VideoView.setVideoURI()}. See the sample app's class {@code SampleZipfileProvider} for an
-example of how to extend this class to use in your application.</p></dd>
+expect {@link android.net.Uri} access to media files. For example, this is useful if you want to
+play a video with {@link android.widget.VideoView#setVideoURI VideoView.setVideoURI()}.</p></dd>
</dl>
<h4>Reading from a ZIP file</h4>
diff --git a/docs/html/guide/market/licensing/setting-up.jd b/docs/html/guide/market/licensing/setting-up.jd
index 15214d1..41e3bc4 100644
--- a/docs/html/guide/market/licensing/setting-up.jd
+++ b/docs/html/guide/market/licensing/setting-up.jd
@@ -177,12 +177,6 @@
<strong>Google APIs Add-On, API 8 (release 2) or higher</strong> includes the necessary Google
Play services.</p>
-
-<img src="{@docRoot}images/licensing_gapis_8.png" alt=""/>
-<p class="img-caption"><strong>Figure 2.</strong> Google APIs
-Add-On, API 8 (release 2) or higher lets you debug and test your licensing
-implementation in an emulator.</p>
-
<p>To set up an emulator for adding licensing to an application, follow
these steps: </p>
@@ -190,7 +184,7 @@
<li>Launch the Android SDK Manager. </li>
<li>In the <strong>Available Packages</strong> panel, select and download the
SDK component "Google APIs (Google Inc.) - API Level 8" (or higher) from the SDK
-repository, as shown in figure 2.
+repository.
<p>When the download is complete, use the Android SDK Manager to
create a new AVD based on that component, described next.</p></li>
<li>In the <strong>Virtual
@@ -256,11 +250,11 @@
<p>To download the LVL component into your development environment, use the
Android SDK Manager. Launch the Android SDK Manager and then
-select the "Google Market Licensing" component, as shown in figure 3.
+select the "Google Market Licensing" component, as shown in figure 2.
Accept the terms and click <strong>Install Selected</strong> to begin the download. </p>
<img src="{@docRoot}images/licensing_package.png" alt=""/>
-<p class="img-caption"><strong>Figure 3.</strong> The Licensing package contains the LVL and
+<p class="img-caption"><strong>Figure 2.</strong> The Licensing package contains the LVL and
the LVL sample application.</p>
<p>When the download is complete, the Android SDK Manager installs both
@@ -390,7 +384,7 @@
<img src="{@docRoot}images/licensing_add_library.png" alt=""/>
-<p class="img-caption"><strong>Figure 4.</strong> If you are
+<p class="img-caption"><strong>Figure 3.</strong> If you are
working in Eclipse with ADT, you can add the LVL library project to your
application from the application's project properties.</p>
@@ -494,7 +488,7 @@
href="{@docRoot}guide/market/licensing/licensing-reference.html">Licensing Reference</a>.</p>
<img src="{@docRoot}images/licensing_test_response.png" alt=""/>
-<p class="img-caption"><strong>Figure 5.</strong> The Licensing
+<p class="img-caption"><strong>Figure 4.</strong> The Licensing
panel of your account's Edit Profile page, showing the Test Accounts field and the
Test Response menu.</p>
@@ -586,7 +580,7 @@
<h4 id="reg-test-acct">Registering test accounts on the publisher account</h4>
<p>To get started, you need to register each test account in your publisher
-account. As shown in Figure 5, you
+account. As shown in Figure 4, you
register test accounts in the Licensing panel of your publisher account's Edit
Profile page. Simply enter the accounts as a comma-delimited list and click
<strong>Save</strong> to save your profile changes.</p>
diff --git a/docs/html/guide/topics/fundamentals/tasks-and-back-stack.jd b/docs/html/guide/topics/fundamentals/tasks-and-back-stack.jd
index 465cf54..0880614 100644
--- a/docs/html/guide/topics/fundamentals/tasks-and-back-stack.jd
+++ b/docs/html/guide/topics/fundamentals/tasks-and-back-stack.jd
@@ -154,7 +154,7 @@
<p>Because the activities in the back stack are never rearranged, if your application allows
users to start a particular activity from more than one activity, a new instance of
-that activity is created and popped onto the stack (rather than bringing any previous instance of
+that activity is created and pushed onto the stack (rather than bringing any previous instance of
the activity to the top). As such, one activity in your application might be instantiated multiple
times (even from different tasks), as shown in figure 3. As such, if the user navigates backward
using the <em>Back</em> button, each instance of the activity is revealed in the order they were
@@ -291,7 +291,7 @@
should associate with a task, then Activity A's request (as defined in the intent) is honored
over Activity B's request (as defined in its manifest).</p>
-<p class="note"><strong>Note:</strong> Some the launch modes available in the manifest
+<p class="note"><strong>Note:</strong> Some launch modes available for the manifest file
are not available as flags for an intent and, likewise, some launch modes available as flags
for an intent cannot be defined in the manifest.</p>
diff --git a/docs/html/guide/topics/manifest/manifest-element.jd b/docs/html/guide/topics/manifest/manifest-element.jd
index 9788945..98968d7 100644
--- a/docs/html/guide/topics/manifest/manifest-element.jd
+++ b/docs/html/guide/topics/manifest/manifest-element.jd
@@ -37,7 +37,7 @@
<dt>description:</dt>
<dd>The root element of the AndroidManifest.xml file. It must
contain an <code><a href="{@docRoot}guide/topics/manifest/application-element.html"><application></a></code> element
-and specify {@code xlmns:android} and {@code package} attributes.</dd>
+and specify {@code xmlns:android} and {@code package} attributes.</dd>
<dt>attributes:</dt>
<dd>
diff --git a/docs/html/guide/topics/providers/content-provider-basics.jd b/docs/html/guide/topics/providers/content-provider-basics.jd
index 40b5c3f..de89568 100644
--- a/docs/html/guide/topics/providers/content-provider-basics.jd
+++ b/docs/html/guide/topics/providers/content-provider-basics.jd
@@ -123,7 +123,7 @@
<!-- Intro paragraphs -->
<p>
- A content provider manages access to a central repository of data. The provider and
+ A content provider manages access to a central repository of data. A provider
is part of an Android application, which often provides its own UI for working with
the data. However, content providers are primarily intended to be used by other
applications, which access the provider using a provider client object. Together, providers
@@ -569,7 +569,7 @@
</pre>
<p>
A selection clause that uses <code>?</code> as a replaceable parameter and an array of
- selection arguments array are preferred way to specify a selection, even the provider isn't
+ selection arguments array are preferred way to specify a selection, even if the provider isn't
based on an SQL database.
</p>
<!-- Displaying the results -->
diff --git a/docs/html/guide/topics/resources/providing-resources.jd b/docs/html/guide/topics/resources/providing-resources.jd
index 380791a..b33a097 100644
--- a/docs/html/guide/topics/resources/providing-resources.jd
+++ b/docs/html/guide/topics/resources/providing-resources.jd
@@ -287,9 +287,8 @@
from the SIM card in the device. For example, <code>mcc310</code> is U.S. on any carrier,
<code>mcc310-mnc004</code> is U.S. on Verizon, and <code>mcc208-mnc00</code> is France on
Orange.</p>
- <p>If the device uses a radio connection (GSM phone), the MCC comes
- from the SIM, and the MNC comes from the network to which the
- device is connected.</p>
+ <p>If the device uses a radio connection (GSM phone), the MCC and MNC values come
+ from the SIM card.</p>
<p>You can also use the MCC alone (for example, to include country-specific legal
resources in your application). If you need to specify based on the language only, then use the
<em>language and region</em> qualifier instead (discussed next). If you decide to use the MCC and
diff --git a/docs/html/guide/topics/resources/string-resource.jd b/docs/html/guide/topics/resources/string-resource.jd
index ecd2d48..5f5484e 100644
--- a/docs/html/guide/topics/resources/string-resource.jd
+++ b/docs/html/guide/topics/resources/string-resource.jd
@@ -358,11 +358,14 @@
<pre>
int count = getNumberOfsongsAvailable();
Resources res = {@link android.content.Context#getResources()};
-String songsFound = res.{@link android.content.res.Resources#getQuantityString(int,int)
-getQuantityString}(R.plurals.numberOfSongsAvailable, count, count);
+String songsFound = res.<a
+href="{@docRoot}reference/android/content/res/Resources.html#getQuantityString(int, int, java.lang.Object...)"
+>getQuantityString</a>(R.plurals.numberOfSongsAvailable, count, count);
</pre>
-<p>When using the {@link android.content.res.Resources#getQuantityString(int,int)
-getQuantityString()} method, you need to pass the {@code count} twice if your string includes
+
+<p>When using the <a
+href="{@docRoot}reference/android/content/res/Resources.html#getQuantityString(int, int, java.lang.Object...)">{@code
+getQuantityString()}</a> method, you need to pass the {@code count} twice if your string includes
<a href="#FormattingAndStyling">string formatting</a> with a number. For example, for the string
{@code %d songs found}, the first {@code count} parameter selects the appropriate plural string and
the second {@code count} parameter is inserted into the {@code %d} placeholder. If your plural
diff --git a/docs/html/guide/topics/sensors/index.jd b/docs/html/guide/topics/sensors/index.jd
index 75a1716..43903dc 100644
--- a/docs/html/guide/topics/sensors/index.jd
+++ b/docs/html/guide/topics/sensors/index.jd
@@ -43,7 +43,7 @@
application might use the geomagnetic field sensor and accelerometer to report a compass
bearing.</p>
-<p>The Android platform supports four broad categories of sensors:</p>
+<p>The Android platform supports three broad categories of sensors:</p>
<ul>
<li>Motion sensors
diff --git a/docs/html/guide/topics/ui/layout-objects.jd b/docs/html/guide/topics/ui/layout-objects.jd
index 8b2792d..e251fe9 100644
--- a/docs/html/guide/topics/ui/layout-objects.jd
+++ b/docs/html/guide/topics/ui/layout-objects.jd
@@ -163,7 +163,7 @@
<td>
<pre>
<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/blue"
diff --git a/docs/html/guide/topics/wireless/wifip2p.jd b/docs/html/guide/topics/wireless/wifip2p.jd
index 4dd3d26..ec8e71e 100644
--- a/docs/html/guide/topics/wireless/wifip2p.jd
+++ b/docs/html/guide/topics/wireless/wifip2p.jd
@@ -333,7 +333,7 @@
...
mManager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE);
mChannel = mManager.initialize(this, getMainLooper(), null);
- Receiver = new WiFiDirectBroadcastReceiver(manager, channel, this);
+ mReceiver = new WiFiDirectBroadcastReceiver(manager, channel, this);
...
}
</pre>
@@ -364,13 +364,13 @@
@Override
protected void onResume() {
super.onResume();
- registerReceiver(receiver, intentFilter);
+ registerReceiver(mReceiver, mIntentFilter);
}
/* unregister the broadcast receiver */
@Override
protected void onPause() {
super.onPause();
- unregisterReceiver(receiver);
+ unregisterReceiver(mReceiver);
}
</pre>
diff --git a/docs/html/images/avd-manager.png b/docs/html/images/avd-manager.png
index c33d8a8..fd373f9 100644
--- a/docs/html/images/avd-manager.png
+++ b/docs/html/images/avd-manager.png
Binary files differ
diff --git a/docs/html/images/billing_package.png b/docs/html/images/billing_package.png
index 951e117..6e673c8 100644
--- a/docs/html/images/billing_package.png
+++ b/docs/html/images/billing_package.png
Binary files differ
diff --git a/docs/html/images/developing/avd-dialog.png b/docs/html/images/developing/avd-dialog.png
index d0e2eec..9dfbd68 100644
--- a/docs/html/images/developing/avd-dialog.png
+++ b/docs/html/images/developing/avd-dialog.png
Binary files differ
diff --git a/docs/html/images/developing/sdk-usb-driver.png b/docs/html/images/developing/sdk-usb-driver.png
index 207d3d7..3489991 100644
--- a/docs/html/images/developing/sdk-usb-driver.png
+++ b/docs/html/images/developing/sdk-usb-driver.png
Binary files differ
diff --git a/docs/html/images/emulator-wvga800l.png b/docs/html/images/emulator-wvga800l.png
index a214033..c92c1b9 100644
--- a/docs/html/images/emulator-wvga800l.png
+++ b/docs/html/images/emulator-wvga800l.png
Binary files differ
diff --git a/docs/html/images/licensing_add_library.png b/docs/html/images/licensing_add_library.png
index 3bbe6d5..257a628 100644
--- a/docs/html/images/licensing_add_library.png
+++ b/docs/html/images/licensing_add_library.png
Binary files differ
diff --git a/docs/html/images/licensing_gapis_8.png b/docs/html/images/licensing_gapis_8.png
deleted file mode 100644
index 480d989..0000000
--- a/docs/html/images/licensing_gapis_8.png
+++ /dev/null
Binary files differ
diff --git a/docs/html/images/licensing_package.png b/docs/html/images/licensing_package.png
index eb2c5cf..dc34473 100644
--- a/docs/html/images/licensing_package.png
+++ b/docs/html/images/licensing_package.png
Binary files differ
diff --git a/docs/html/images/sdk_manager_packages.png b/docs/html/images/sdk_manager_packages.png
index 19a7cb9..a0e8108 100644
--- a/docs/html/images/sdk_manager_packages.png
+++ b/docs/html/images/sdk_manager_packages.png
Binary files differ
diff --git a/docs/html/index.jd b/docs/html/index.jd
index cfd9ff1..787a655 100644
--- a/docs/html/index.jd
+++ b/docs/html/index.jd
@@ -12,10 +12,8 @@
</div><!-- end homeTitle -->
<div id="announcement-block">
<!-- total max width is 520px -->
- <a href="{@docRoot}design/index.html">
<img src="{@docRoot}images/home/play_logo.png"
alt="Google Play" width="120px" style="padding:10px 52px"/>
- </a>
<div id="announcement" style="width:275px">
<p>Introducing <strong>Google Play</strong>: An integrated digital content destination where
users buy and enjoy all of their favorite content in one place. It's the new destination for
diff --git a/docs/html/resources/resources_toc.cs b/docs/html/resources/resources_toc.cs
index 8483037..e1a5e0f 100644
--- a/docs/html/resources/resources_toc.cs
+++ b/docs/html/resources/resources_toc.cs
@@ -99,6 +99,27 @@
</li>
<li class="toggle-list">
+ <div><a href="<?cs var:toroot ?>training/search/index.html">
+ <span class="en">Adding Search Functionality</span>
+ </a> <span class="new">new!</span>
+ </div>
+ <ul>
+ <li><a href="<?cs var:toroot ?>training/search/setup.html">
+ <span class="en">Setting up the Search Interface</span>
+ </a>
+ </li>
+ <li><a href="<?cs var:toroot ?>training/search/search.html">
+ <span class="en">Storing and Searching for Data</span>
+ </a>
+ </li>
+ <li><a href="<?cs var:toroot ?>training/search/backward-compat.html">
+ <span class="en">Remaining Backward Compatible</span>
+ </a>
+ </li>
+ </ul>
+ </li>
+
+ <li class="toggle-list">
<div><a href="<?cs var:toroot ?>training/id-auth/index.html">
<span class="en">Remembering Users</span>
</a></div>
diff --git a/docs/html/resources/tutorials/views/hello-webview.jd b/docs/html/resources/tutorials/views/hello-webview.jd
index 2d07647..f6a6a71 100644
--- a/docs/html/resources/tutorials/views/hello-webview.jd
+++ b/docs/html/resources/tutorials/views/hello-webview.jd
@@ -52,7 +52,7 @@
<li>While you're in the manifest, give some more space for web pages by removing the title
bar, with the "NoTitleBar" theme:
<pre>
-<activity android:name=".HelloGoogleMaps" android:label="@string/app_name"
+<activity android:name=".HelloWebView" android:label="@string/app_name"
<strong>android:theme="@android:style/Theme.NoTitleBar"</strong>>
</pre>
</li>
diff --git a/docs/html/sdk/android-4.0-highlights.jd b/docs/html/sdk/android-4.0-highlights.jd
index 50e9a14..98f467d 100644
--- a/docs/html/sdk/android-4.0-highlights.jd
+++ b/docs/html/sdk/android-4.0-highlights.jd
@@ -343,7 +343,7 @@
<p>The Camera app includes many new features that let users capture special moments
with great photos and videos. After capturing images, they can edit and share
-them easily with friemds. </p>
+them easily with friends. </p>
<p>When taking pictures, <strong>continuous focus</strong>, <strong>zero shutter
lag exposure</strong>, and decreased shot-to-shot speed help capture clear,
diff --git a/docs/html/sdk/win-usb.jd b/docs/html/sdk/win-usb.jd
index 2bd031e..6869d74 100644
--- a/docs/html/sdk/win-usb.jd
+++ b/docs/html/sdk/win-usb.jd
@@ -147,7 +147,7 @@
<h2 id="WinUsbDriver">Downloading the Google USB Driver</h2>
-<div class="figure" style="width:498px;margin:0">
+<div class="figure" style="width:536px;margin:0">
<img src="{@docRoot}images/developing/sdk-usb-driver.png" alt="" />
<p class="img-caption"><strong>Figure 1.</strong> The SDK and AVD Manager
with the Google USB Driver selected.</p>
diff --git a/docs/html/training/monitoring-device-state/docking-monitoring.jd b/docs/html/training/monitoring-device-state/docking-monitoring.jd
index 392ce30..82d655e 100644
--- a/docs/html/training/monitoring-device-state/docking-monitoring.jd
+++ b/docs/html/training/monitoring-device-state/docking-monitoring.jd
@@ -15,7 +15,7 @@
<h2>This lesson teaches you to</h2>
<ol>
- <li><a href="#CurrentDockState">Request the Audio Focus</a></li>
+ <li><a href="#CurrentDockState">Determine the Current Docking State</a></li>
<li><a href="#DockType">Determine the Current Dock Type</a></li>
<li><a href="#MonitorDockState">Monitor for Changes in the Dock State or Type</a></li>
</ol>
diff --git a/docs/html/training/search/backward-compat.jd b/docs/html/training/search/backward-compat.jd
new file mode 100644
index 0000000..0894fa9
--- /dev/null
+++ b/docs/html/training/search/backward-compat.jd
@@ -0,0 +1,87 @@
+page.title=Remaining Backward Compatible
+trainingnavtop=true
+previous.title=Storing and Searching for Data
+previous.link=search.html
+
+@jd:body
+
+ <div id="tb-wrapper">
+ <div id="tb">
+ <h2>This lesson teaches you to</h2>
+
+ <ul>
+ <li><a href="{@docRoot}training/search/backward-compat.html#set-sdk">Set Minimum
+ and Target API levels</a></li>
+
+ <li><a href="{@docRoot}training/search/backward-compat.html#provide-sd">Provide the Search
+ Dialog for Older Devices</a></li>
+
+ <li><a href="{@docRoot}training/search/backward-compat.html#check-ver">Check the Android Build
+ Version at Runtime</a></li>
+ </ul>
+ </div>
+ </div>
+
+ <p>The {@link android.widget.SearchView} and action bar are only available on Android 3.0 and
+ later. To support older platforms, you can fall back to the search dialog. The search dialog is a
+ system provided UI that overlays on top of your application when invoked.</p>
+
+ <h2 id="set-sdk">Set Minimum and Target API levels</h2>
+
+ <p>To setup the search dialog, first declare in your manifest that you want to support older
+ devices, but want to target Android 3.0 or later versions. When you do this, your application
+ automatically uses the action bar on Android 3.0 or later and uses the traditional menu system on
+ older devices:</p>
+ <pre>
+<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15" />
+
+<application>
+...
+</pre>
+
+ <h2 id="provide-sd">Provide the Search Dialog for Older Devices</h2>
+
+ <p>To invoke the search dialog on older devices, call {@link
+ android.app.Activity#onSearchRequested onSearchRequested()} whenever a user selects the search
+ menu item from the options menu. Because Android 3.0 and higher devices show the
+ {@link android.widget.SearchView} in the action bar (as demonstrated in the first lesson), only versions
+ older than 3.0 call {@link android.app.Activity#onOptionsItemSelected onOptionsItemSelected()} when the
+ user selects the search menu item.
+ </p>
+ <pre>
+@Override
+public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.search:
+ onSearchRequested();
+ return true;
+ default:
+ return false;
+ }
+}
+</pre>
+
+ <h2 id="check-ver">Check the Android Build Version at Runtime</h2>
+
+ <p>At runtime, check the device version to make sure an unsupported use of {@link
+ android.widget.SearchView} does not occur on older devices. In our example code, this happens in
+ the {@link android.app.Activity#onCreateOptionsMenu onCreateOptionsMenu()} method:</p>
+ <pre>
+@Override
+public boolean onCreateOptionsMenu(Menu menu) {
+
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.options_menu, menu);
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ SearchManager searchManager =
+ (SearchManager) getSystemService(Context.SEARCH_SERVICE);
+ SearchView searchView =
+ (SearchView) menu.findItem(R.id.search).getActionView();
+ searchView.setSearchableInfo(
+ searchManager.getSearchableInfo(getComponentName()));
+ searchView.setIconifiedByDefault(false);
+ }
+ return true;
+}
+</pre>
diff --git a/docs/html/training/search/index.jd b/docs/html/training/search/index.jd
new file mode 100644
index 0000000..bfd1618
--- /dev/null
+++ b/docs/html/training/search/index.jd
@@ -0,0 +1,53 @@
+page.title=Adding Search Functionality
+trainingnavtop=true
+startpage=true
+next.title=Setting Up the Search Interface
+next.link=setup.html
+
+@jd:body
+
+ <div id="tb-wrapper">
+ <div id="tb">
+ <h2>Dependencies and prerequisites</h2>
+
+ <ul>
+ <li>Android 3.0 or later (with some support for Android 2.1)</li>
+
+ <li>Experience building an Android <a href="{@docRoot}guide/topics/ui/index.html">User
+ Interface</a></li>
+ </ul>
+
+ <h2>You should also read</h2>
+
+ <ul>
+ <li><a href="{@docRoot}guide/topics/search/index.html">Search</a></li>
+
+ <li><a href="{@docRoot}resources/samples/SearchableDictionary/index.html">Searchable
+ Dictionary Sample App</a></li>
+ </ul>
+ </div>
+ </div>
+
+ <p>Android's built-in search features offer apps an easy way to provide a
+ consistent search experience for all users. There are two ways to implement search in your app
+ depending on the version of Android that is running on the device. This class covers how to add
+ search with {@link android.widget.SearchView}, which was introduced in Android 3.0, while
+ maintaining backward compatibility with older versions of Android by using the default search
+ dialog provided by the system.</p>
+
+ <h2>Lessons</h2>
+
+ <dl>
+ <dt><b><a href="setup.html">Setting Up the Search Interface</a></b></dt>
+
+ <dd>Learn how to add a search interface to your app and how to configure an activity to handle
+ search queries.</dd>
+
+ <dt><b><a href="search.html">Storing and Searching for Data</a></b></dt>
+
+ <dd>Learn a simple way to store and search for data in a SQLite virtual database table.</dd>
+
+ <dt><b><a href="backward-compat.html">Remaining Backward Compatible</a></b></dt>
+
+ <dd>Learn how to keep search features backward compatible with older devices by using.</dd>
+ </dl>
\ No newline at end of file
diff --git a/docs/html/training/search/search.jd b/docs/html/training/search/search.jd
new file mode 100644
index 0000000..17e7640
--- /dev/null
+++ b/docs/html/training/search/search.jd
@@ -0,0 +1,217 @@
+page.title=Storing and Searching for Data
+trainingnavtop=true
+previous.title=Setting Up the Search Interface
+previous.link=setup.html
+next.title=Remaining Backward Compatible
+next.link=backward-compat.html
+
+@jd:body
+
+ <div id="tb-wrapper">
+ <div id="tb">
+ <h2>This lesson teaches you to</h2>
+
+ <ul>
+ <li><a href="{@docRoot}training/search/search.html#create">Create the Virtual
+ Table</a></li>
+
+ <li><a href="{@docRoot}training/search/search.html#populate">Populate the Virtual
+ Table</a></li>
+
+ <li><a href="{@docRoot}training/search/search.html#search">Search for the Query</a></li>
+ </ul>
+ </div>
+ </div>
+
+ <p>There are many ways to store your data, such as in an online database, in a local SQLite
+ database, or even in a text file. It is up to you to decide what is the best solution for your
+ application. This lesson shows you how to create a SQLite virtual table that can provide robust
+ full-text searching. The table is populated with data from a text file that contains a word and
+ definition pair on each line in the file.</p>
+
+ <h2 id="create">Create the Virtual Table</h2>
+
+ <p>A virtual table behaves similarly to a SQLite table, but reads and writes to an object in
+ memory via callbacks, instead of to a database file. To create a virtual table, create a class
+ for the table:</p>
+ <pre>
+public class DatabaseTable {
+ private final DatabaseOpenHelper mDatabaseOpenHelper;
+
+ public DatabaseTable(Context context) {
+ mDatabaseOpenHelper = new DatabaseOpenHelper(context);
+ }
+}
+</pre>
+
+ <p>Create an inner class in <code>DatabaseTable</code> that extends {@link
+ android.database.sqlite.SQLiteOpenHelper}. The {@link android.database.sqlite.SQLiteOpenHelper} class
+ defines abstract methods that you must override so that your database table can be created and
+ upgraded when necessary. For example, here is some code that declares a database table that will
+ contain words for a dictionary app:</p>
+ <pre>
+public class DatabaseTable {
+
+ private static final String TAG = "DictionaryDatabase";
+
+ //The columns we'll include in the dictionary table
+ public static final String COL_WORD = "WORD";
+ public static final String COL_DEFINITION = "DEFINITION";
+
+ private static final String DATABASE_NAME = "DICTIONARY";
+ private static final String FTS_VIRTUAL_TABLE = "FTS";
+ private static final int DATABASE_VERSION = 1;
+
+ private final DatabaseOpenHelper mDatabaseOpenHelper;
+
+ public DatabaseTable(Context context) {
+ mDatabaseOpenHelper = new DatabaseOpenHelper(context);
+ }
+
+ private static class DatabaseOpenHelper extends SQLiteOpenHelper {
+
+ private final Context mHelperContext;
+ private SQLiteDatabase mDatabase;
+
+ private static final String FTS_TABLE_CREATE =
+ "CREATE VIRTUAL TABLE " + FTS_VIRTUAL_TABLE +
+ " USING fts3 (" +
+ COL_WORD + ", " +
+ COL_DEFINITION + ")";
+
+ DatabaseOpenHelper(Context context) {
+ super(context, DATABASE_NAME, null, DATABASE_VERSION);
+ mHelperContext = context;
+ }
+
+ @Override
+ public void onCreate(SQLiteDatabase db) {
+ mDatabase = db;
+ mDatabase.execSQL(FTS_TABLE_CREATE);
+ }
+
+ @Override
+ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+ Log.w(TAG, "Upgrading database from version " + oldVersion + " to "
+ + newVersion + ", which will destroy all old data");
+ db.execSQL("DROP TABLE IF EXISTS " + FTS_VIRTUAL_TABLE);
+ onCreate(db);
+ }
+ }
+}
+</pre>
+
+ <h2 id="populate">Populate the Virtual Table</h2>
+
+ <p>The table now needs data to store. The following code shows you how to read a text file
+ (located in <code>res/raw/definitions.txt</code>) that contains words and their definitions, how
+ to parse that file, and how to insert each line of that file as a row in the virtual table. This
+ is all done in another thread to prevent the UI from locking. Add the following code to your
+ <code>DatabaseOpenHelper</code> inner class.</p>
+
+ <p class="note"><strong>Tip:</strong> You also might want to set up a callback to notify your UI
+ activity of this thread's completion.</p>
+ <pre>
+private void loadDictionary() {
+ new Thread(new Runnable() {
+ public void run() {
+ try {
+ loadWords();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }).start();
+ }
+
+private void loadWords() throws IOException {
+ final Resources resources = mHelperContext.getResources();
+ InputStream inputStream = resources.openRawResource(R.raw.definitions);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
+
+ try {
+ String line;
+ while ((line = reader.readLine()) != null) {
+ String[] strings = TextUtils.split(line, "-");
+ if (strings.length < 2) continue;
+ long id = addWord(strings[0].trim(), strings[1].trim());
+ if (id < 0) {
+ Log.e(TAG, "unable to add word: " + strings[0].trim());
+ }
+ }
+ } finally {
+ reader.close();
+ }
+}
+
+public long addWord(String word, String definition) {
+ ContentValues initialValues = new ContentValues();
+ initialValues.put(COL_WORD, word);
+ initialValues.put(COL_DEFINITION, definition);
+
+ return mDatabase.insert(FTS_VIRTUAL_TABLE, null, initialValues);
+}
+</pre>
+
+ <p>Call the <code>loadDictionary()</code> method wherever appropriate to populate the table. A
+ good place would be in the {@link android.database.sqlite.SQLiteOpenHelper#onCreate onCreate()}
+ method of the <code>DatabaseOpenHelper</code> class, right after you create the table:</p>
+ <pre>
+@Override
+public void onCreate(SQLiteDatabase db) {
+ mDatabase = db;
+ mDatabase.execSQL(FTS_TABLE_CREATE);
+ loadDictionary();
+}
+</pre>
+
+ <h2 id="search">Search for the Query</h2>
+
+ <p>When you have the virtual table created and populated, use the query supplied by your {@link
+ android.widget.SearchView} to search the data. Add the following methods to the
+ <code>DatabaseTable</code> class to build a SQL statement that searches for the query:</p>
+ <pre>
+public Cursor getWordMatches(String query, String[] columns) {
+ String selection = COL_WORD + " MATCH ?";
+ String[] selectionArgs = new String[] {query+"*"};
+
+ return query(selection, selectionArgs, columns);
+}
+
+private Cursor query(String selection, String[] selectionArgs, String[] columns) {
+ SQLiteQueryBuilder builder = new SQLiteQueryBuilder();
+ builder.setTables(FTS_VIRTUAL_TABLE);
+
+ Cursor cursor = builder.query(mDatabaseOpenHelper.getReadableDatabase(),
+ columns, selection, selectionArgs, null, null, null);
+
+ if (cursor == null) {
+ return null;
+ } else if (!cursor.moveToFirst()) {
+ cursor.close();
+ return null;
+ }
+ return cursor;
+}
+</pre>
+
+ <p>Search for a query by calling <code>getWordMatches()</code>. Any matching results are returned
+ in a {@link android.database.Cursor} that you can iterate through or use to build a {@link android.widget.ListView}.
+ This example calls <code>getWordMatches()</code> in the <code>handleIntent()</code> method of the searchable
+ activity. Remember that the searchable activity receives the query inside of the {@link
+ android.content.Intent#ACTION_SEARCH} intent as an extra, because of the intent filter that you
+ previously created:</p>
+ <pre>
+DatabaseTable db = new DatabaseTable(this);
+
+...
+
+private void handleIntent(Intent intent) {
+
+ if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
+ String query = intent.getStringExtra(SearchManager.QUERY);
+ Cursor c = db.getWordMatches(query, null);
+ //process Cursor and display results
+ }
+}
+</pre>
\ No newline at end of file
diff --git a/docs/html/training/search/setup.jd b/docs/html/training/search/setup.jd
new file mode 100644
index 0000000..044e422
--- /dev/null
+++ b/docs/html/training/search/setup.jd
@@ -0,0 +1,197 @@
+page.title=Setting Up the Search Interface
+trainingnavtop=true
+next.title=Storing and Searching for Data
+next.link=search.html
+
+@jd:body
+
+ <div id="tb-wrapper">
+ <div id="tb">
+ <h2>This lesson teaches you to</h2>
+
+ <ul>
+ <li><a href="{@docRoot}training/search/setup.html#add-sv">Add the Search View to the Action
+ Bar</a></li>
+
+ <li><a href="{@docRoot}training/search/setup.html#create-sc">Create a Searchable
+ Configuration</a></li>
+
+ <li><a href="{@docRoot}training/search/setup.html#create-sa">Create a Searchable
+ Activity</a></li>
+ </ul>
+
+ <h2>You should also read:</h2>
+
+ <ul>
+ <li><a href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a></li>
+ </ul>
+ </div>
+ </div>
+
+ <p>Beginning in Android 3.0, using the {@link android.widget.SearchView} widget as an item in
+ the action bar is the preferred way to provide search in your app. Like with all items in
+ the action bar, you can define the {@link android.widget.SearchView} to show at all times, only
+ when there is room, or as a collapsible action, which displays the {@link
+ android.widget.SearchView} as an icon initially, then takes up the entire action bar as a search
+ field when the user clicks the icon.</p>
+
+ <p class="note"><strong>Note:</strong> Later in this class, you will learn how to make your
+ app compatible down to Android 2.1 (API level 7) for devices that do not support
+ {@link android.widget.SearchView}.</p>
+
+ <h2 id="add-sv">Add the Search View to the Action Bar</h2>
+
+ <p>To add a {@link android.widget.SearchView} widget to the action bar, create a file named
+ <code>res/menu/options_menu.xml</code> in your project and add the following code to the file.
+ This code defines how to create the search item, such as the icon to use and the title of the
+ item. The <code>collapseActionView</code> attribute allows your {@link android.widget.SearchView}
+ to expand to take up the whole action bar and collapse back down into a
+ normal action bar item when not in use. Because of the limited action bar space on handset devices,
+ using the <code>collapsibleActionView</code> attribute is recommended to provide a better
+ user experience.</p>
+ <pre>
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/search"
+ android:title="@string/search_title"
+ android:icon="@drawable/ic_search"
+ android:showAsAction="collapseActionView|ifRoom"
+ android:actionViewClass="android.widget.SearchView" />
+</menu>
+</pre>
+
+ <p class="note"><strong>Note:</strong> If you already have an existing XML file for your menu
+ items, you can add the <code><item></code> element to that file instead.</p>
+
+ <p>To display the {@link android.widget.SearchView} in the action bar, inflate the XML menu
+ resource (<code>res/menu/options_menu.xml</code>) in the {@link
+ android.app.Activity#onCreateOptionsMenu onCreateOptionsMenu()} method of your activity:</p>
+ <pre>
+@Override
+public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.options_menu, menu);
+
+ return true;
+}
+</pre>
+
+ <p>If you run your app now, the {@link android.widget.SearchView} appears in your app's action
+ bar, but it isn't functional. You now need to define <em>how</em> the {@link
+ android.widget.SearchView} behaves.</p>
+
+ <h2 id="create-sc">Create a Searchable Configuration</h2>
+
+ <p>A <a href="http://developer.android.com/guide/topics/search/searchable-config.html">searchable
+ configuration</a> defines how the {@link android.widget.SearchView} behaves and is defined in a
+ <code>res/xml/searchable.xml</code> file. At a minimum, a searchable configuration must contain
+ an <code>android:label</code> attribute that has the same value as the
+ <code>android:label</code> attribute of the <a href="{@docRoot}guide/topics/manifest/application-element.html"><application></a> or
+ <a href="{@docRoot}guide/topics/manifest/activity-element.html"><activity></a> element in your Android manifest.
+ However, we also recommend adding an <code>android:hint</code> attribute to give the user an idea of what to enter into the search
+ box:</p>
+ <pre>
+<?xml version="1.0" encoding="utf-8"?>
+
+<searchable xmlns:android="http://schemas.android.com/apk/res/android"
+ android:label="@string/app_name"
+ android:hint="@string/search_hint" />
+</pre>
+
+ <p>In your application's manifest file, declare a <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">
+ <code><meta-data></code></a> element that points to the <code>res/xml/searchable.xml</code> file,
+ so that your application knows where to find it. Declare the element in an <code><activity></code>
+ that you want to display the {@link android.widget.SearchView} in:</p>
+ <pre>
+<activity ... >
+ ...
+ <meta-data android:name="android.app.searchable"
+ android:resource="@xml/searchable" />
+
+</activity>
+</pre>
+
+ <p>In the {@link android.app.Activity#onCreateOptionsMenu onCreateOptionsMenu()} method that you
+ created before, associate the searchable configuration with the {@link android.widget.SearchView}
+ by calling {@link android.widget.SearchView#setSearchableInfo}:</p>
+ <pre>
+@Override
+public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.options_menu, menu);
+
+ // Associate searchable configuration with the SearchView
+ SearchManager searchManager =
+ (SearchManager) getSystemService(Context.SEARCH_SERVICE);
+ SearchView searchView =
+ (SearchView) menu.findItem(R.id.search).getActionView();
+ searchView.setSearchableInfo(
+ searchManager.getSearchableInfo(getComponentName()));
+
+ return true;
+}
+</pre>
+
+ <p>The call to {@link android.app.SearchManager#getSearchableInfo getSearchableInfo()} obtains a
+ {@link android.app.SearchableInfo} object that is created from the searchable configuration XML
+ file. When the searchable configuration is correctly associated with your {@link
+ android.widget.SearchView}, the {@link android.widget.SearchView} starts an activity with the
+ {@link android.content.Intent#ACTION_SEARCH} intent when a user submits a query. You now need an
+ activity that can filter for this intent and handle the search query.</p>
+
+ <h2 id="create-sa">Create a Searchable Activity</h2>
+
+ <p>A {@link android.widget.SearchView} tries to start an activity with the {@link
+ android.content.Intent#ACTION_SEARCH} when a user submits a search query. A searchable activity
+ filters for the {@link android.content.Intent#ACTION_SEARCH} intent and searches for the query in
+ some sort of data set. To create a searchable activity, declare an activity of your choice to
+ filter for the {@link android.content.Intent#ACTION_SEARCH} intent:</p>
+ <pre>
+<activity android:name=".SearchResultsActivity" ... >
+ ...
+ <intent-filter>
+ <action android:name="android.intent.action.SEARCH" />
+ </intent-filter>
+ ...
+</activity>
+</pre>
+
+ <p>In your searchable activity, handle the {@link android.content.Intent#ACTION_SEARCH} intent by
+ checking for it in your {@link android.app.Activity#onCreate onCreate()} method.</p>
+
+ <p class="note"><strong>Note:</strong> If your searchable activity launches in single top mode
+ (<code>android:launchMode="singleTop"</code>), also handle the {@link
+ android.content.Intent#ACTION_SEARCH} intent in the {@link android.app.Activity#onNewIntent
+ onNewIntent()} method. In single top mode, only one instance of your activity is created and
+ subsequent calls to start your activity do not create a new activity on the
+ stack. This launch mode is useful so users can perform searches from the same activity
+ without creating a new activity instance every time.</p>
+ <pre>
+public class SearchResultsActivity extends Activity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ ...
+ handleIntent(getIntent());
+ }
+
+ @Override
+ protected void onNewIntent(Intent intent) {
+ ...
+ handleIntent(intent);
+ }
+
+ private void handleIntent(Intent intent) {
+
+ if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
+ String query = intent.getStringExtra(SearchManager.QUERY);
+ //use the query to search your data somehow
+ }
+ }
+ ...
+}
+</pre>
+
+ <p>If you run your app now, the {@link android.widget.SearchView} can accept the user's query and
+ start your searchable activity with the {@link android.content.Intent#ACTION_SEARCH} intent. It
+ is now up to you to figure out how to store and search your data given a query.</p>
\ No newline at end of file
diff --git a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
index 5ee41e6..4b1b40eb 100644
--- a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
+++ b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
@@ -159,11 +159,13 @@
return DRM_NO_ERROR;
}
+// make sure that lower-case letters are used.
const String8 FwdLockEngine::FileSuffixes[] = {
String8(".fl"),
String8(".dm"),
};
+// make sure that lower-case letters are used.
const String8 FwdLockEngine::MimeTypes[] = {
String8("application/x-android-drm-fl"),
String8("application/vnd.oma.drm.message"),
@@ -184,8 +186,10 @@
}
bool FwdLockEngine::IsMimeTypeSupported(const String8& mime) {
+ String8 tmp(mime);
+ tmp.toLower();
for (size_t i = 0, n = sizeof(MimeTypes)/sizeof(MimeTypes[0]); i < n; ++i) {
- if (mime == MimeTypes[i]) {
+ if (tmp == MimeTypes[i]) {
return true;
}
}
@@ -193,8 +197,10 @@
}
bool FwdLockEngine::IsFileSuffixSupported(const String8& suffix) {
+ String8 tmp(suffix);
+ tmp.toLower();
for (size_t i = 0, n = sizeof(FileSuffixes)/sizeof(FileSuffixes[0]); i < n; ++i) {
- if (suffix == FileSuffixes[i]) {
+ if (tmp == FileSuffixes[i]) {
return true;
}
}
@@ -220,7 +226,6 @@
bool result = false;
String8 extString = path.getPathExtension();
- extString.toLower();
return IsFileSuffixSupported(extString);
}
@@ -331,8 +336,6 @@
LOG_VERBOSE("FwdLockEngine::onGetDrmObjectType");
- mimeStr.toLower();
-
/* Checks whether
* 1. path and mime type both are not empty strings (meaning unavailable) else content is unknown
* 2. if one of them is empty string and if other is known then its a DRM Content Object.
diff --git a/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp b/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
index 0ffc0a7..a3eac3e 100644
--- a/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
+++ b/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define LOG_NDEBUG 0
+//#define LOG_NDEBUG 0
#define LOG_TAG "DrmPassthruPlugIn"
#include <utils/Log.h>
@@ -58,7 +58,7 @@
DrmConstraints* DrmPassthruPlugIn::onGetConstraints(
int uniqueId, const String8* path, int action) {
- ALOGD("DrmPassthruPlugIn::onGetConstraints From Path: %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onGetConstraints From Path: %d", uniqueId);
DrmConstraints* drmConstraints = new DrmConstraints();
String8 value("dummy_available_time");
@@ -73,7 +73,7 @@
}
DrmInfoStatus* DrmPassthruPlugIn::onProcessDrmInfo(int uniqueId, const DrmInfo* drmInfo) {
- ALOGD("DrmPassthruPlugIn::onProcessDrmInfo - Enter : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onProcessDrmInfo - Enter : %d", uniqueId);
DrmInfoStatus* drmInfoStatus = NULL;
if (NULL != drmInfo) {
switch (drmInfo->getInfoType()) {
@@ -102,28 +102,28 @@
}
}
}
- ALOGD("DrmPassthruPlugIn::onProcessDrmInfo - Exit");
+ ALOGV("DrmPassthruPlugIn::onProcessDrmInfo - Exit");
return drmInfoStatus;
}
status_t DrmPassthruPlugIn::onSetOnInfoListener(
int uniqueId, const IDrmEngine::OnInfoListener* infoListener) {
- ALOGD("DrmPassthruPlugIn::onSetOnInfoListener : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onSetOnInfoListener : %d", uniqueId);
return DRM_NO_ERROR;
}
status_t DrmPassthruPlugIn::onInitialize(int uniqueId) {
- ALOGD("DrmPassthruPlugIn::onInitialize : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onInitialize : %d", uniqueId);
return DRM_NO_ERROR;
}
status_t DrmPassthruPlugIn::onTerminate(int uniqueId) {
- ALOGD("DrmPassthruPlugIn::onTerminate : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onTerminate : %d", uniqueId);
return DRM_NO_ERROR;
}
DrmSupportInfo* DrmPassthruPlugIn::onGetSupportInfo(int uniqueId) {
- ALOGD("DrmPassthruPlugIn::onGetSupportInfo : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onGetSupportInfo : %d", uniqueId);
DrmSupportInfo* drmSupportInfo = new DrmSupportInfo();
// Add mimetype's
drmSupportInfo->addMimeType(String8("application/vnd.passthru.drm"));
@@ -136,12 +136,12 @@
status_t DrmPassthruPlugIn::onSaveRights(int uniqueId, const DrmRights& drmRights,
const String8& rightsPath, const String8& contentPath) {
- ALOGD("DrmPassthruPlugIn::onSaveRights : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onSaveRights : %d", uniqueId);
return DRM_NO_ERROR;
}
DrmInfo* DrmPassthruPlugIn::onAcquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest) {
- ALOGD("DrmPassthruPlugIn::onAcquireDrmInfo : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onAcquireDrmInfo : %d", uniqueId);
DrmInfo* drmInfo = NULL;
if (NULL != drmInfoRequest) {
@@ -157,65 +157,65 @@
}
bool DrmPassthruPlugIn::onCanHandle(int uniqueId, const String8& path) {
- ALOGD("DrmPassthruPlugIn::canHandle: %s ", path.string());
+ ALOGV("DrmPassthruPlugIn::canHandle: %s ", path.string());
String8 extension = path.getPathExtension();
extension.toLower();
return (String8(".passthru") == extension);
}
String8 DrmPassthruPlugIn::onGetOriginalMimeType(int uniqueId, const String8& path) {
- ALOGD("DrmPassthruPlugIn::onGetOriginalMimeType() : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onGetOriginalMimeType() : %d", uniqueId);
return String8("video/passthru");
}
int DrmPassthruPlugIn::onGetDrmObjectType(
int uniqueId, const String8& path, const String8& mimeType) {
- ALOGD("DrmPassthruPlugIn::onGetDrmObjectType() : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onGetDrmObjectType() : %d", uniqueId);
return DrmObjectType::UNKNOWN;
}
int DrmPassthruPlugIn::onCheckRightsStatus(int uniqueId, const String8& path, int action) {
- ALOGD("DrmPassthruPlugIn::onCheckRightsStatus() : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onCheckRightsStatus() : %d", uniqueId);
int rightsStatus = RightsStatus::RIGHTS_VALID;
return rightsStatus;
}
status_t DrmPassthruPlugIn::onConsumeRights(int uniqueId, DecryptHandle* decryptHandle,
int action, bool reserve) {
- ALOGD("DrmPassthruPlugIn::onConsumeRights() : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onConsumeRights() : %d", uniqueId);
return DRM_NO_ERROR;
}
status_t DrmPassthruPlugIn::onSetPlaybackStatus(int uniqueId, DecryptHandle* decryptHandle,
int playbackStatus, int64_t position) {
- ALOGD("DrmPassthruPlugIn::onSetPlaybackStatus() : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onSetPlaybackStatus() : %d", uniqueId);
return DRM_NO_ERROR;
}
bool DrmPassthruPlugIn::onValidateAction(int uniqueId, const String8& path,
int action, const ActionDescription& description) {
- ALOGD("DrmPassthruPlugIn::onValidateAction() : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onValidateAction() : %d", uniqueId);
return true;
}
status_t DrmPassthruPlugIn::onRemoveRights(int uniqueId, const String8& path) {
- ALOGD("DrmPassthruPlugIn::onRemoveRights() : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onRemoveRights() : %d", uniqueId);
return DRM_NO_ERROR;
}
status_t DrmPassthruPlugIn::onRemoveAllRights(int uniqueId) {
- ALOGD("DrmPassthruPlugIn::onRemoveAllRights() : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onRemoveAllRights() : %d", uniqueId);
return DRM_NO_ERROR;
}
status_t DrmPassthruPlugIn::onOpenConvertSession(int uniqueId, int convertId) {
- ALOGD("DrmPassthruPlugIn::onOpenConvertSession() : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onOpenConvertSession() : %d", uniqueId);
return DRM_NO_ERROR;
}
DrmConvertedStatus* DrmPassthruPlugIn::onConvertData(
int uniqueId, int convertId, const DrmBuffer* inputData) {
- ALOGD("DrmPassthruPlugIn::onConvertData() : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onConvertData() : %d", uniqueId);
DrmBuffer* convertedData = NULL;
if (NULL != inputData && 0 < inputData->length) {
@@ -229,13 +229,13 @@
}
DrmConvertedStatus* DrmPassthruPlugIn::onCloseConvertSession(int uniqueId, int convertId) {
- ALOGD("DrmPassthruPlugIn::onCloseConvertSession() : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onCloseConvertSession() : %d", uniqueId);
return new DrmConvertedStatus(DrmConvertedStatus::STATUS_OK, NULL, 0 /*offset*/);
}
status_t DrmPassthruPlugIn::onOpenDecryptSession(
int uniqueId, DecryptHandle* decryptHandle, int fd, off64_t offset, off64_t length) {
- ALOGD("DrmPassthruPlugIn::onOpenDecryptSession() : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onOpenDecryptSession() : %d", uniqueId);
#ifdef ENABLE_PASSTHRU_DECRYPTION
decryptHandle->mimeType = String8("video/passthru");
@@ -254,7 +254,7 @@
}
status_t DrmPassthruPlugIn::onCloseDecryptSession(int uniqueId, DecryptHandle* decryptHandle) {
- ALOGD("DrmPassthruPlugIn::onCloseDecryptSession() : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onCloseDecryptSession() : %d", uniqueId);
if (NULL != decryptHandle) {
if (NULL != decryptHandle->decryptInfo) {
delete decryptHandle->decryptInfo; decryptHandle->decryptInfo = NULL;
@@ -266,34 +266,40 @@
status_t DrmPassthruPlugIn::onInitializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle,
int decryptUnitId, const DrmBuffer* headerInfo) {
- ALOGD("DrmPassthruPlugIn::onInitializeDecryptUnit() : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onInitializeDecryptUnit() : %d", uniqueId);
return DRM_NO_ERROR;
}
status_t DrmPassthruPlugIn::onDecrypt(int uniqueId, DecryptHandle* decryptHandle,
int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
- ALOGD("DrmPassthruPlugIn::onDecrypt() : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onDecrypt() : %d", uniqueId);
/**
* As a workaround implementation passthru would copy the given
* encrypted buffer as it is to decrypted buffer. Note, decBuffer
* memory has to be allocated by the caller.
*/
if (NULL != (*decBuffer) && 0 < (*decBuffer)->length) {
- memcpy((*decBuffer)->data, encBuffer->data, encBuffer->length);
- (*decBuffer)->length = encBuffer->length;
+ if ((*decBuffer)->length >= encBuffer->length) {
+ memcpy((*decBuffer)->data, encBuffer->data, encBuffer->length);
+ (*decBuffer)->length = encBuffer->length;
+ } else {
+ ALOGE("decBuffer size (%d) too small to hold %d bytes",
+ (*decBuffer)->length, encBuffer->length);
+ return DRM_ERROR_UNKNOWN;
+ }
}
return DRM_NO_ERROR;
}
status_t DrmPassthruPlugIn::onFinalizeDecryptUnit(
int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) {
- ALOGD("DrmPassthruPlugIn::onFinalizeDecryptUnit() : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onFinalizeDecryptUnit() : %d", uniqueId);
return DRM_NO_ERROR;
}
ssize_t DrmPassthruPlugIn::onPread(int uniqueId, DecryptHandle* decryptHandle,
void* buffer, ssize_t numBytes, off64_t offset) {
- ALOGD("DrmPassthruPlugIn::onPread() : %d", uniqueId);
+ ALOGV("DrmPassthruPlugIn::onPread() : %d", uniqueId);
return 0;
}
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index bff2a76..c5705f6 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -32,6 +32,8 @@
* and byte-arrays.
*/
public class BitmapFactory {
+ private static final int DECODE_BUFFER_SIZE = 16 * 1024;
+
public static class Options {
/**
* Create a default Options object, which if left unchanged will give
@@ -469,7 +471,7 @@
// we need mark/reset to work properly
if (!is.markSupported()) {
- is = new BufferedInputStream(is, 16 * 1024);
+ is = new BufferedInputStream(is, DECODE_BUFFER_SIZE);
}
// so we can call reset() if a given codec gives up after reading up to
@@ -477,11 +479,30 @@
// value should be.
is.mark(1024);
- Bitmap bm;
+ Bitmap bm;
+ boolean finish = true;
if (is instanceof AssetManager.AssetInputStream) {
- bm = nativeDecodeAsset(((AssetManager.AssetInputStream) is).getAssetInt(),
- outPadding, opts);
+ final int asset = ((AssetManager.AssetInputStream) is).getAssetInt();
+
+ if (opts == null || (opts.inScaled && opts.inBitmap == null)) {
+ float scale = 1.0f;
+ int targetDensity = 0;
+ if (opts != null) {
+ final int density = opts.inDensity;
+ targetDensity = opts.inTargetDensity;
+ if (density != 0 && targetDensity != 0) {
+ scale = targetDensity / (float) density;
+ }
+ }
+
+ bm = nativeDecodeAsset(asset, outPadding, opts, true, scale);
+ if (bm != null && targetDensity != 0) bm.setDensity(targetDensity);
+
+ finish = false;
+ } else {
+ bm = nativeDecodeAsset(asset, outPadding, opts);
+ }
} else {
// pass some temp storage down to the native code. 1024 is made up,
// but should be large enough to avoid too many small calls back
@@ -490,13 +511,32 @@
byte [] tempStorage = null;
if (opts != null) tempStorage = opts.inTempStorage;
if (tempStorage == null) tempStorage = new byte[16 * 1024];
- bm = nativeDecodeStream(is, tempStorage, outPadding, opts);
+
+ if (opts == null || (opts.inScaled && opts.inBitmap == null)) {
+ float scale = 1.0f;
+ int targetDensity = 0;
+ if (opts != null) {
+ final int density = opts.inDensity;
+ targetDensity = opts.inTargetDensity;
+ if (density != 0 && targetDensity != 0) {
+ scale = targetDensity / (float) density;
+ }
+ }
+
+ bm = nativeDecodeStream(is, tempStorage, outPadding, opts, true, scale);
+ if (bm != null && targetDensity != 0) bm.setDensity(targetDensity);
+
+ finish = false;
+ } else {
+ bm = nativeDecodeStream(is, tempStorage, outPadding, opts);
+ }
}
+
if (bm == null && opts != null && opts.inBitmap != null) {
throw new IllegalArgumentException("Problem decoding into existing bitmap");
}
- return finishDecode(bm, outPadding, opts);
+ return finish ? finishDecode(bm, outPadding, opts) : bm;
}
private static Bitmap finishDecode(Bitmap bm, Rect outPadding, Options opts) {
@@ -524,12 +564,13 @@
bm = Bitmap.createScaledBitmap(oldBitmap, (int) (bm.getWidth() * scale + 0.5f),
(int) (bm.getHeight() * scale + 0.5f), true);
if (bm != oldBitmap) oldBitmap.recycle();
+
+ if (isNinePatch) {
+ np = nativeScaleNinePatch(np, scale, outPadding);
+ bm.setNinePatchChunk(np);
+ }
}
- if (isNinePatch) {
- if (scale != 1.0f) np = nativeScaleNinePatch(np, scale, outPadding);
- bm.setNinePatchChunk(np);
- }
bm.setDensity(targetDensity);
}
@@ -595,35 +636,15 @@
return decodeFileDescriptor(fd, null, null);
}
- /**
- * Set the default config used for decoding bitmaps. This config is
- * presented to the codec if the caller did not specify a preferred config
- * in their call to decode...
- *
- * The default value is chosen by the system to best match the device's
- * screen and memory constraints.
- *
- * @param config The preferred config for decoding bitmaps. If null, then
- * a suitable default is chosen by the system.
- *
- * @hide - only called by the browser at the moment, but should be stable
- * enough to expose if needed
- */
- public static void setDefaultConfig(Bitmap.Config config) {
- if (config == null) {
- // pick this for now, as historically it was our default.
- // However, if we have a smarter algorithm, we can change this.
- config = Bitmap.Config.RGB_565;
- }
- nativeSetDefaultConfig(config.nativeInt);
- }
-
- private static native void nativeSetDefaultConfig(int nativeConfig);
private static native Bitmap nativeDecodeStream(InputStream is, byte[] storage,
Rect padding, Options opts);
+ private static native Bitmap nativeDecodeStream(InputStream is, byte[] storage,
+ Rect padding, Options opts, boolean applyScale, float scale);
private static native Bitmap nativeDecodeFileDescriptor(FileDescriptor fd,
Rect padding, Options opts);
private static native Bitmap nativeDecodeAsset(int asset, Rect padding, Options opts);
+ private static native Bitmap nativeDecodeAsset(int asset, Rect padding, Options opts,
+ boolean applyScale, float scale);
private static native Bitmap nativeDecodeByteArray(byte[] data, int offset,
int length, Options opts);
private static native byte[] nativeScaleNinePatch(byte[] chunk, float scale, Rect pad);
diff --git a/include/android_runtime/AndroidRuntime.h b/include/android_runtime/AndroidRuntime.h
index fd33d59..0b3ce9a 100644
--- a/include/android_runtime/AndroidRuntime.h
+++ b/include/android_runtime/AndroidRuntime.h
@@ -66,6 +66,12 @@
void start(const char *classname, const char* options);
+ void exit(int code);
+
+ void setExitWithoutCleanup(bool exitWithoutCleanup) {
+ mExitWithoutCleanup = exitWithoutCleanup;
+ }
+
static AndroidRuntime* getRuntime();
/**
@@ -86,14 +92,13 @@
* fork. Override it to initialize threads, etc. Upon return, the
* correct static main will be invoked.
*/
- virtual void onZygoteInit() {};
-
+ virtual void onZygoteInit() { }
/**
- * Called when the Java application exits. The default
- * implementation calls exit(code).
+ * Called when the Java application exits to perform additional cleanup actions
+ * before the process is terminated.
*/
- virtual void onExit(int code);
+ virtual void onExit(int code) { }
/** create a new thread that is visible from Java */
static android_thread_id_t createJavaThread(const char* name, void (*start)(void *),
@@ -114,6 +119,7 @@
int startVm(JavaVM** pJavaVM, JNIEnv** pEnv);
Vector<JavaVMOption> mOptions;
+ bool mExitWithoutCleanup;
/* JNI JavaVM pointer */
static JavaVM* mJavaVM;
diff --git a/include/android_runtime/android_app_NativeActivity.h b/include/android_runtime/android_app_NativeActivity.h
index a59677a..7977c23 100644
--- a/include/android_runtime/android_app_NativeActivity.h
+++ b/include/android_runtime/android_app_NativeActivity.h
@@ -65,7 +65,7 @@
* b. Java sends event through default key handler.
* c. event is finished.
*/
-struct AInputQueue : public android::InputEventFactoryInterface {
+struct AInputQueue {
public:
/* Creates a consumer associated with an input channel. */
explicit AInputQueue(const android::sp<android::InputChannel>& channel, int workWrite);
@@ -96,16 +96,16 @@
android::KeyEvent* consumeUnhandledEvent();
android::KeyEvent* consumePreDispatchingEvent(int* outSeq);
- virtual android::KeyEvent* createKeyEvent();
- virtual android::MotionEvent* createMotionEvent();
+ android::KeyEvent* createKeyEvent();
int mWorkWrite;
private:
void doUnhandledKey(android::KeyEvent* keyEvent);
bool preDispatchKey(android::KeyEvent* keyEvent);
- void wakeupDispatch();
+ void wakeupDispatchLocked();
+ android::PooledInputEventFactory mPooledInputEventFactory;
android::InputConsumer mConsumer;
android::sp<android::Looper> mLooper;
@@ -127,11 +127,6 @@
int mSeq;
- // Cache of previously allocated key events.
- android::Vector<android::KeyEvent*> mAvailKeyEvents;
- // Cache of previously allocated motion events.
- android::Vector<android::MotionEvent*> mAvailMotionEvents;
-
// All input events that are actively being processed.
android::Vector<in_flight_event> mInFlightEvents;
diff --git a/include/androidfw/Input.h b/include/androidfw/Input.h
index f5db6e24..a4ebd95 100644
--- a/include/androidfw/Input.h
+++ b/include/androidfw/Input.h
@@ -616,6 +616,26 @@
};
/*
+ * An input event factory implementation that maintains a pool of input events.
+ */
+class PooledInputEventFactory : public InputEventFactoryInterface {
+public:
+ PooledInputEventFactory(size_t maxPoolSize = 20);
+ virtual ~PooledInputEventFactory();
+
+ virtual KeyEvent* createKeyEvent();
+ virtual MotionEvent* createMotionEvent();
+
+ void recycle(InputEvent* event);
+
+private:
+ const size_t mMaxPoolSize;
+
+ Vector<KeyEvent*> mKeyEventPool;
+ Vector<MotionEvent*> mMotionEventPool;
+};
+
+/*
* Calculates the velocity of pointer movements over time.
*/
class VelocityTracker {
diff --git a/include/androidfw/InputTransport.h b/include/androidfw/InputTransport.h
index a846e65..29c296e 100644
--- a/include/androidfw/InputTransport.h
+++ b/include/androidfw/InputTransport.h
@@ -292,7 +292,29 @@
*/
status_t sendFinishedSignal(uint32_t seq, bool handled);
- /* Returns true if there is a pending batch. */
+ /* Returns true if there is a deferred event waiting.
+ *
+ * Should be called after calling consume() to determine whether the consumer
+ * has a deferred event to be processed. Deferred events are somewhat special in
+ * that they have already been removed from the input channel. If the input channel
+ * becomes empty, the client may need to do extra work to ensure that it processes
+ * the deferred event despite the fact that the inptu channel's file descriptor
+ * is not readable.
+ *
+ * One option is simply to call consume() in a loop until it returns WOULD_BLOCK.
+ * This guarantees that all deferred events will be processed.
+ *
+ * Alternately, the caller can call hasDeferredEvent() to determine whether there is
+ * a deferred event waiting and then ensure that its event loop wakes up at least
+ * one more time to consume the deferred event.
+ */
+ bool hasDeferredEvent() const;
+
+ /* Returns true if there is a pending batch.
+ *
+ * Should be called after calling consume() with consumeBatches == false to determine
+ * whether consume() should be called again later on with consumeBatches == true.
+ */
bool hasPendingBatch() const;
private:
diff --git a/include/camera/Camera.h b/include/camera/Camera.h
index 234e165..3fedea0 100644
--- a/include/camera/Camera.h
+++ b/include/camera/Camera.h
@@ -72,7 +72,7 @@
static int32_t getNumberOfCameras();
static status_t getCameraInfo(int cameraId,
struct CameraInfo* cameraInfo);
- static sp<Camera> connect(int cameraId);
+ static sp<Camera> connect(int cameraId, bool force, bool keep);
virtual ~Camera();
void init();
diff --git a/include/camera/CameraParameters.h b/include/camera/CameraParameters.h
deleted file mode 100644
index 7edf6b4..0000000
--- a/include/camera/CameraParameters.h
+++ /dev/null
@@ -1,666 +0,0 @@
-/*
- * Copyright (C) 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT 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 ANDROID_HARDWARE_CAMERA_PARAMETERS_H
-#define ANDROID_HARDWARE_CAMERA_PARAMETERS_H
-
-#include <utils/KeyedVector.h>
-#include <utils/String8.h>
-
-namespace android {
-
-struct Size {
- int width;
- int height;
-
- Size() {
- width = 0;
- height = 0;
- }
-
- Size(int w, int h) {
- width = w;
- height = h;
- }
-};
-
-class CameraParameters
-{
-public:
- CameraParameters();
- CameraParameters(const String8 ¶ms) { unflatten(params); }
- ~CameraParameters();
-
- String8 flatten() const;
- void unflatten(const String8 ¶ms);
-
- void set(const char *key, const char *value);
- void set(const char *key, int value);
- void setFloat(const char *key, float value);
- const char *get(const char *key) const;
- int getInt(const char *key) const;
- float getFloat(const char *key) const;
-
- void remove(const char *key);
-
- void setPreviewSize(int width, int height);
- void getPreviewSize(int *width, int *height) const;
- void getSupportedPreviewSizes(Vector<Size> &sizes) const;
-
- // Set the dimensions in pixels to the given width and height
- // for video frames. The given width and height must be one
- // of the supported dimensions returned from
- // getSupportedVideoSizes(). Must not be called if
- // getSupportedVideoSizes() returns an empty Vector of Size.
- void setVideoSize(int width, int height);
- // Retrieve the current dimensions (width and height)
- // in pixels for video frames, which must be one of the
- // supported dimensions returned from getSupportedVideoSizes().
- // Must not be called if getSupportedVideoSizes() returns an
- // empty Vector of Size.
- void getVideoSize(int *width, int *height) const;
- // Retrieve a Vector of supported dimensions (width and height)
- // in pixels for video frames. If sizes returned from the method
- // is empty, the camera does not support calls to setVideoSize()
- // or getVideoSize(). In adddition, it also indicates that
- // the camera only has a single output, and does not have
- // separate output for video frames and preview frame.
- void getSupportedVideoSizes(Vector<Size> &sizes) const;
- // Retrieve the preferred preview size (width and height) in pixels
- // for video recording. The given width and height must be one of
- // supported preview sizes returned from getSupportedPreviewSizes().
- // Must not be called if getSupportedVideoSizes() returns an empty
- // Vector of Size. If getSupportedVideoSizes() returns an empty
- // Vector of Size, the width and height returned from this method
- // is invalid, and is "-1x-1".
- void getPreferredPreviewSizeForVideo(int *width, int *height) const;
-
- void setPreviewFrameRate(int fps);
- int getPreviewFrameRate() const;
- void getPreviewFpsRange(int *min_fps, int *max_fps) const;
- void setPreviewFormat(const char *format);
- const char *getPreviewFormat() const;
- void setPictureSize(int width, int height);
- void getPictureSize(int *width, int *height) const;
- void getSupportedPictureSizes(Vector<Size> &sizes) const;
- void setPictureFormat(const char *format);
- const char *getPictureFormat() const;
-
- void dump() const;
- status_t dump(int fd, const Vector<String16>& args) const;
-
- // Parameter keys to communicate between camera application and driver.
- // The access (read/write, read only, or write only) is viewed from the
- // perspective of applications, not driver.
-
- // Preview frame size in pixels (width x height).
- // Example value: "480x320". Read/Write.
- static const char KEY_PREVIEW_SIZE[];
- // Supported preview frame sizes in pixels.
- // Example value: "800x600,480x320". Read only.
- static const char KEY_SUPPORTED_PREVIEW_SIZES[];
- // The current minimum and maximum preview fps. This controls the rate of
- // preview frames received (CAMERA_MSG_PREVIEW_FRAME). The minimum and
- // maximum fps must be one of the elements from
- // KEY_SUPPORTED_PREVIEW_FPS_RANGE parameter.
- // Example value: "10500,26623"
- static const char KEY_PREVIEW_FPS_RANGE[];
- // The supported preview fps (frame-per-second) ranges. Each range contains
- // a minimum fps and maximum fps. If minimum fps equals to maximum fps, the
- // camera outputs frames in fixed frame rate. If not, the camera outputs
- // frames in auto frame rate. The actual frame rate fluctuates between the
- // minimum and the maximum. The list has at least one element. The list is
- // sorted from small to large (first by maximum fps and then minimum fps).
- // Example value: "(10500,26623),(15000,26623),(30000,30000)"
- static const char KEY_SUPPORTED_PREVIEW_FPS_RANGE[];
- // The image format for preview frames. See CAMERA_MSG_PREVIEW_FRAME in
- // frameworks/base/include/camera/Camera.h.
- // Example value: "yuv420sp" or PIXEL_FORMAT_XXX constants. Read/write.
- static const char KEY_PREVIEW_FORMAT[];
- // Supported image formats for preview frames.
- // Example value: "yuv420sp,yuv422i-yuyv". Read only.
- static const char KEY_SUPPORTED_PREVIEW_FORMATS[];
- // Number of preview frames per second. This is the target frame rate. The
- // actual frame rate depends on the driver.
- // Example value: "15". Read/write.
- static const char KEY_PREVIEW_FRAME_RATE[];
- // Supported number of preview frames per second.
- // Example value: "24,15,10". Read.
- static const char KEY_SUPPORTED_PREVIEW_FRAME_RATES[];
- // The dimensions for captured pictures in pixels (width x height).
- // Example value: "1024x768". Read/write.
- static const char KEY_PICTURE_SIZE[];
- // Supported dimensions for captured pictures in pixels.
- // Example value: "2048x1536,1024x768". Read only.
- static const char KEY_SUPPORTED_PICTURE_SIZES[];
- // The image format for captured pictures. See CAMERA_MSG_COMPRESSED_IMAGE
- // in frameworks/base/include/camera/Camera.h.
- // Example value: "jpeg" or PIXEL_FORMAT_XXX constants. Read/write.
- static const char KEY_PICTURE_FORMAT[];
- // Supported image formats for captured pictures.
- // Example value: "jpeg,rgb565". Read only.
- static const char KEY_SUPPORTED_PICTURE_FORMATS[];
- // The width (in pixels) of EXIF thumbnail in Jpeg picture.
- // Example value: "512". Read/write.
- static const char KEY_JPEG_THUMBNAIL_WIDTH[];
- // The height (in pixels) of EXIF thumbnail in Jpeg picture.
- // Example value: "384". Read/write.
- static const char KEY_JPEG_THUMBNAIL_HEIGHT[];
- // Supported EXIF thumbnail sizes (width x height). 0x0 means not thumbnail
- // in EXIF.
- // Example value: "512x384,320x240,0x0". Read only.
- static const char KEY_SUPPORTED_JPEG_THUMBNAIL_SIZES[];
- // The quality of the EXIF thumbnail in Jpeg picture. The range is 1 to 100,
- // with 100 being the best.
- // Example value: "90". Read/write.
- static const char KEY_JPEG_THUMBNAIL_QUALITY[];
- // Jpeg quality of captured picture. The range is 1 to 100, with 100 being
- // the best.
- // Example value: "90". Read/write.
- static const char KEY_JPEG_QUALITY[];
- // The rotation angle in degrees relative to the orientation of the camera.
- // This affects the pictures returned from CAMERA_MSG_COMPRESSED_IMAGE. The
- // camera driver may set orientation in the EXIF header without rotating the
- // picture. Or the driver may rotate the picture and the EXIF thumbnail. If
- // the Jpeg picture is rotated, the orientation in the EXIF header will be
- // missing or 1 (row #0 is top and column #0 is left side).
- //
- // Note that the JPEG pictures of front-facing cameras are not mirrored
- // as in preview display.
- //
- // For example, suppose the natural orientation of the device is portrait.
- // The device is rotated 270 degrees clockwise, so the device orientation is
- // 270. Suppose a back-facing camera sensor is mounted in landscape and the
- // top side of the camera sensor is aligned with the right edge of the
- // display in natural orientation. So the camera orientation is 90. The
- // rotation should be set to 0 (270 + 90).
- //
- // Example value: "0" or "90" or "180" or "270". Write only.
- static const char KEY_ROTATION[];
- // GPS latitude coordinate. GPSLatitude and GPSLatitudeRef will be stored in
- // JPEG EXIF header.
- // Example value: "25.032146" or "-33.462809". Write only.
- static const char KEY_GPS_LATITUDE[];
- // GPS longitude coordinate. GPSLongitude and GPSLongitudeRef will be stored
- // in JPEG EXIF header.
- // Example value: "121.564448" or "-70.660286". Write only.
- static const char KEY_GPS_LONGITUDE[];
- // GPS altitude. GPSAltitude and GPSAltitudeRef will be stored in JPEG EXIF
- // header.
- // Example value: "21.0" or "-5". Write only.
- static const char KEY_GPS_ALTITUDE[];
- // GPS timestamp (UTC in seconds since January 1, 1970). This should be
- // stored in JPEG EXIF header.
- // Example value: "1251192757". Write only.
- static const char KEY_GPS_TIMESTAMP[];
- // GPS Processing Method
- // Example value: "GPS" or "NETWORK". Write only.
- static const char KEY_GPS_PROCESSING_METHOD[];
- // Current white balance setting.
- // Example value: "auto" or WHITE_BALANCE_XXX constants. Read/write.
- static const char KEY_WHITE_BALANCE[];
- // Supported white balance settings.
- // Example value: "auto,incandescent,daylight". Read only.
- static const char KEY_SUPPORTED_WHITE_BALANCE[];
- // Current color effect setting.
- // Example value: "none" or EFFECT_XXX constants. Read/write.
- static const char KEY_EFFECT[];
- // Supported color effect settings.
- // Example value: "none,mono,sepia". Read only.
- static const char KEY_SUPPORTED_EFFECTS[];
- // Current antibanding setting.
- // Example value: "auto" or ANTIBANDING_XXX constants. Read/write.
- static const char KEY_ANTIBANDING[];
- // Supported antibanding settings.
- // Example value: "auto,50hz,60hz,off". Read only.
- static const char KEY_SUPPORTED_ANTIBANDING[];
- // Current scene mode.
- // Example value: "auto" or SCENE_MODE_XXX constants. Read/write.
- static const char KEY_SCENE_MODE[];
- // Supported scene mode settings.
- // Example value: "auto,night,fireworks". Read only.
- static const char KEY_SUPPORTED_SCENE_MODES[];
- // Current flash mode.
- // Example value: "auto" or FLASH_MODE_XXX constants. Read/write.
- static const char KEY_FLASH_MODE[];
- // Supported flash modes.
- // Example value: "auto,on,off". Read only.
- static const char KEY_SUPPORTED_FLASH_MODES[];
- // Current focus mode. This will not be empty. Applications should call
- // CameraHardwareInterface.autoFocus to start the focus if focus mode is
- // FOCUS_MODE_AUTO or FOCUS_MODE_MACRO.
- // Example value: "auto" or FOCUS_MODE_XXX constants. Read/write.
- static const char KEY_FOCUS_MODE[];
- // Supported focus modes.
- // Example value: "auto,macro,fixed". Read only.
- static const char KEY_SUPPORTED_FOCUS_MODES[];
- // The maximum number of focus areas supported. This is the maximum length
- // of KEY_FOCUS_AREAS.
- // Example value: "0" or "2". Read only.
- static const char KEY_MAX_NUM_FOCUS_AREAS[];
- // Current focus areas.
- //
- // Before accessing this parameter, apps should check
- // KEY_MAX_NUM_FOCUS_AREAS first to know the maximum number of focus areas
- // first. If the value is 0, focus area is not supported.
- //
- // Each focus area is a five-element int array. The first four elements are
- // the rectangle of the area (left, top, right, bottom). The direction is
- // relative to the sensor orientation, that is, what the sensor sees. The
- // direction is not affected by the rotation or mirroring of
- // CAMERA_CMD_SET_DISPLAY_ORIENTATION. Coordinates range from -1000 to 1000.
- // (-1000,-1000) is the upper left point. (1000, 1000) is the lower right
- // point. The width and height of focus areas cannot be 0 or negative.
- //
- // The fifth element is the weight. Values for weight must range from 1 to
- // 1000. The weight should be interpreted as a per-pixel weight - all
- // pixels in the area have the specified weight. This means a small area
- // with the same weight as a larger area will have less influence on the
- // focusing than the larger area. Focus areas can partially overlap and the
- // driver will add the weights in the overlap region.
- //
- // A special case of single focus area (0,0,0,0,0) means driver to decide
- // the focus area. For example, the driver may use more signals to decide
- // focus areas and change them dynamically. Apps can set (0,0,0,0,0) if they
- // want the driver to decide focus areas.
- //
- // Focus areas are relative to the current field of view (KEY_ZOOM). No
- // matter what the zoom level is, (-1000,-1000) represents the top of the
- // currently visible camera frame. The focus area cannot be set to be
- // outside the current field of view, even when using zoom.
- //
- // Focus area only has effect if the current focus mode is FOCUS_MODE_AUTO,
- // FOCUS_MODE_MACRO, FOCUS_MODE_CONTINUOUS_VIDEO, or
- // FOCUS_MODE_CONTINUOUS_PICTURE.
- // Example value: "(-10,-10,0,0,300),(0,0,10,10,700)". Read/write.
- static const char KEY_FOCUS_AREAS[];
- // Focal length in millimeter.
- // Example value: "4.31". Read only.
- static const char KEY_FOCAL_LENGTH[];
- // Horizontal angle of view in degrees.
- // Example value: "54.8". Read only.
- static const char KEY_HORIZONTAL_VIEW_ANGLE[];
- // Vertical angle of view in degrees.
- // Example value: "42.5". Read only.
- static const char KEY_VERTICAL_VIEW_ANGLE[];
- // Exposure compensation index. 0 means exposure is not adjusted.
- // Example value: "0" or "5". Read/write.
- static const char KEY_EXPOSURE_COMPENSATION[];
- // The maximum exposure compensation index (>=0).
- // Example value: "6". Read only.
- static const char KEY_MAX_EXPOSURE_COMPENSATION[];
- // The minimum exposure compensation index (<=0).
- // Example value: "-6". Read only.
- static const char KEY_MIN_EXPOSURE_COMPENSATION[];
- // The exposure compensation step. Exposure compensation index multiply by
- // step eqals to EV. Ex: if exposure compensation index is 6 and step is
- // 0.3333, EV is -2.
- // Example value: "0.333333333" or "0.5". Read only.
- static const char KEY_EXPOSURE_COMPENSATION_STEP[];
- // The state of the auto-exposure lock. "true" means that
- // auto-exposure is locked to its current value and will not
- // change. "false" means the auto-exposure routine is free to
- // change exposure values. If auto-exposure is already locked,
- // setting this to true again has no effect (the driver will not
- // recalculate exposure values). Changing exposure compensation
- // settings will still affect the exposure settings while
- // auto-exposure is locked. Stopping preview or taking a still
- // image will not change the lock. In conjunction with
- // exposure compensation, this allows for capturing multi-exposure
- // brackets with known relative exposure values. Locking
- // auto-exposure after open but before the first call to
- // startPreview may result in severely over- or under-exposed
- // images. The driver will not change the AE lock after
- // auto-focus completes.
- static const char KEY_AUTO_EXPOSURE_LOCK[];
- // Whether locking the auto-exposure is supported. "true" means it is, and
- // "false" or this key not existing means it is not supported.
- static const char KEY_AUTO_EXPOSURE_LOCK_SUPPORTED[];
- // The state of the auto-white balance lock. "true" means that
- // auto-white balance is locked to its current value and will not
- // change. "false" means the auto-white balance routine is free to
- // change white balance values. If auto-white balance is already
- // locked, setting this to true again has no effect (the driver
- // will not recalculate white balance values). Stopping preview or
- // taking a still image will not change the lock. In conjunction
- // with exposure compensation, this allows for capturing
- // multi-exposure brackets with fixed white balance. Locking
- // auto-white balance after open but before the first call to
- // startPreview may result in severely incorrect color. The
- // driver will not change the AWB lock after auto-focus
- // completes.
- static const char KEY_AUTO_WHITEBALANCE_LOCK[];
- // Whether locking the auto-white balance is supported. "true"
- // means it is, and "false" or this key not existing means it is
- // not supported.
- static const char KEY_AUTO_WHITEBALANCE_LOCK_SUPPORTED[];
-
- // The maximum number of metering areas supported. This is the maximum
- // length of KEY_METERING_AREAS.
- // Example value: "0" or "2". Read only.
- static const char KEY_MAX_NUM_METERING_AREAS[];
- // Current metering areas. Camera driver uses these areas to decide
- // exposure.
- //
- // Before accessing this parameter, apps should check
- // KEY_MAX_NUM_METERING_AREAS first to know the maximum number of metering
- // areas first. If the value is 0, metering area is not supported.
- //
- // Each metering area is a rectangle with specified weight. The direction is
- // relative to the sensor orientation, that is, what the sensor sees. The
- // direction is not affected by the rotation or mirroring of
- // CAMERA_CMD_SET_DISPLAY_ORIENTATION. Coordinates of the rectangle range
- // from -1000 to 1000. (-1000, -1000) is the upper left point. (1000, 1000)
- // is the lower right point. The width and height of metering areas cannot
- // be 0 or negative.
- //
- // The fifth element is the weight. Values for weight must range from 1 to
- // 1000. The weight should be interpreted as a per-pixel weight - all
- // pixels in the area have the specified weight. This means a small area
- // with the same weight as a larger area will have less influence on the
- // metering than the larger area. Metering areas can partially overlap and
- // the driver will add the weights in the overlap region.
- //
- // A special case of all-zero single metering area means driver to decide
- // the metering area. For example, the driver may use more signals to decide
- // metering areas and change them dynamically. Apps can set all-zero if they
- // want the driver to decide metering areas.
- //
- // Metering areas are relative to the current field of view (KEY_ZOOM).
- // No matter what the zoom level is, (-1000,-1000) represents the top of the
- // currently visible camera frame. The metering area cannot be set to be
- // outside the current field of view, even when using zoom.
- //
- // No matter what metering areas are, the final exposure are compensated
- // by KEY_EXPOSURE_COMPENSATION.
- // Example value: "(-10,-10,0,0,300),(0,0,10,10,700)". Read/write.
- static const char KEY_METERING_AREAS[];
- // Current zoom value.
- // Example value: "0" or "6". Read/write.
- static const char KEY_ZOOM[];
- // Maximum zoom value.
- // Example value: "6". Read only.
- static const char KEY_MAX_ZOOM[];
- // The zoom ratios of all zoom values. The zoom ratio is in 1/100
- // increments. Ex: a zoom of 3.2x is returned as 320. The number of list
- // elements is KEY_MAX_ZOOM + 1. The first element is always 100. The last
- // element is the zoom ratio of zoom value KEY_MAX_ZOOM.
- // Example value: "100,150,200,250,300,350,400". Read only.
- static const char KEY_ZOOM_RATIOS[];
- // Whether zoom is supported. Zoom is supported if the value is "true". Zoom
- // is not supported if the value is not "true" or the key does not exist.
- // Example value: "true". Read only.
- static const char KEY_ZOOM_SUPPORTED[];
- // Whether if smooth zoom is supported. Smooth zoom is supported if the
- // value is "true". It is not supported if the value is not "true" or the
- // key does not exist.
- // See CAMERA_CMD_START_SMOOTH_ZOOM, CAMERA_CMD_STOP_SMOOTH_ZOOM, and
- // CAMERA_MSG_ZOOM in frameworks/base/include/camera/Camera.h.
- // Example value: "true". Read only.
- static const char KEY_SMOOTH_ZOOM_SUPPORTED[];
-
- // The distances (in meters) from the camera to where an object appears to
- // be in focus. The object is sharpest at the optimal focus distance. The
- // depth of field is the far focus distance minus near focus distance.
- //
- // Focus distances may change after starting auto focus, canceling auto
- // focus, or starting the preview. Applications can read this anytime to get
- // the latest focus distances. If the focus mode is FOCUS_MODE_CONTINUOUS,
- // focus distances may change from time to time.
- //
- // This is intended to estimate the distance between the camera and the
- // subject. After autofocus, the subject distance may be within near and far
- // focus distance. However, the precision depends on the camera hardware,
- // autofocus algorithm, the focus area, and the scene. The error can be
- // large and it should be only used as a reference.
- //
- // Far focus distance > optimal focus distance > near focus distance. If
- // the far focus distance is infinity, the value should be "Infinity" (case
- // sensitive). The format is three float values separated by commas. The
- // first is near focus distance. The second is optimal focus distance. The
- // third is far focus distance.
- // Example value: "0.95,1.9,Infinity" or "0.049,0.05,0.051". Read only.
- static const char KEY_FOCUS_DISTANCES[];
-
- // The current dimensions in pixels (width x height) for video frames.
- // The width and height must be one of the supported sizes retrieved
- // via KEY_SUPPORTED_VIDEO_SIZES.
- // Example value: "1280x720". Read/write.
- static const char KEY_VIDEO_SIZE[];
- // A list of the supported dimensions in pixels (width x height)
- // for video frames. See CAMERA_MSG_VIDEO_FRAME for details in
- // frameworks/base/include/camera/Camera.h.
- // Example: "176x144,1280x720". Read only.
- static const char KEY_SUPPORTED_VIDEO_SIZES[];
-
- // The maximum number of detected faces supported by hardware face
- // detection. If the value is 0, hardware face detection is not supported.
- // Example: "5". Read only
- static const char KEY_MAX_NUM_DETECTED_FACES_HW[];
-
- // The maximum number of detected faces supported by software face
- // detection. If the value is 0, software face detection is not supported.
- // Example: "5". Read only
- static const char KEY_MAX_NUM_DETECTED_FACES_SW[];
-
- // Preferred preview frame size in pixels for video recording.
- // The width and height must be one of the supported sizes retrieved
- // via KEY_SUPPORTED_PREVIEW_SIZES. This key can be used only when
- // getSupportedVideoSizes() does not return an empty Vector of Size.
- // Camcorder applications are recommended to set the preview size
- // to a value that is not larger than the preferred preview size.
- // In other words, the product of the width and height of the
- // preview size should not be larger than that of the preferred
- // preview size. In addition, we recommend to choos a preview size
- // that has the same aspect ratio as the resolution of video to be
- // recorded.
- // Example value: "800x600". Read only.
- static const char KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO[];
-
- // The image format for video frames. See CAMERA_MSG_VIDEO_FRAME in
- // frameworks/base/include/camera/Camera.h.
- // Example value: "yuv420sp" or PIXEL_FORMAT_XXX constants. Read only.
- static const char KEY_VIDEO_FRAME_FORMAT[];
-
- // Sets the hint of the recording mode. If this is true, MediaRecorder.start
- // may be faster or has less glitches. This should be called before starting
- // the preview for the best result. But it is allowed to change the hint
- // while the preview is active. The default value is false.
- //
- // The apps can still call Camera.takePicture when the hint is true. The
- // apps can call MediaRecorder.start when the hint is false. But the
- // performance may be worse.
- // Example value: "true" or "false". Read/write.
- static const char KEY_RECORDING_HINT[];
-
- // Returns true if video snapshot is supported. That is, applications
- // can call Camera.takePicture during recording. Applications do not need to
- // call Camera.startPreview after taking a picture. The preview will be
- // still active. Other than that, taking a picture during recording is
- // identical to taking a picture normally. All settings and methods related
- // to takePicture work identically. Ex: KEY_PICTURE_SIZE,
- // KEY_SUPPORTED_PICTURE_SIZES, KEY_JPEG_QUALITY, KEY_ROTATION, and etc.
- // The picture will have an EXIF header. FLASH_MODE_AUTO and FLASH_MODE_ON
- // also still work, but the video will record the flash.
- //
- // Applications can set shutter callback as null to avoid the shutter
- // sound. It is also recommended to set raw picture and post view callbacks
- // to null to avoid the interrupt of preview display.
- //
- // Field-of-view of the recorded video may be different from that of the
- // captured pictures.
- // Example value: "true" or "false". Read only.
- static const char KEY_VIDEO_SNAPSHOT_SUPPORTED[];
-
- // The state of the video stabilization. If set to true, both the
- // preview stream and the recorded video stream are stabilized by
- // the camera. Only valid to set if KEY_VIDEO_STABILIZATION_SUPPORTED is
- // set to true.
- //
- // The value of this key can be changed any time the camera is
- // open. If preview or recording is active, it is acceptable for
- // there to be a slight video glitch when video stabilization is
- // toggled on and off.
- //
- // This only stabilizes video streams (between-frames stabilization), and
- // has no effect on still image capture.
- static const char KEY_VIDEO_STABILIZATION[];
-
- // Returns true if video stabilization is supported. That is, applications
- // can set KEY_VIDEO_STABILIZATION to true and have a stabilized preview
- // stream and record stabilized videos.
- static const char KEY_VIDEO_STABILIZATION_SUPPORTED[];
-
- // Value for KEY_ZOOM_SUPPORTED or KEY_SMOOTH_ZOOM_SUPPORTED.
- static const char TRUE[];
- static const char FALSE[];
-
- // Value for KEY_FOCUS_DISTANCES.
- static const char FOCUS_DISTANCE_INFINITY[];
-
- // Values for white balance settings.
- static const char WHITE_BALANCE_AUTO[];
- static const char WHITE_BALANCE_INCANDESCENT[];
- static const char WHITE_BALANCE_FLUORESCENT[];
- static const char WHITE_BALANCE_WARM_FLUORESCENT[];
- static const char WHITE_BALANCE_DAYLIGHT[];
- static const char WHITE_BALANCE_CLOUDY_DAYLIGHT[];
- static const char WHITE_BALANCE_TWILIGHT[];
- static const char WHITE_BALANCE_SHADE[];
-
- // Values for effect settings.
- static const char EFFECT_NONE[];
- static const char EFFECT_MONO[];
- static const char EFFECT_NEGATIVE[];
- static const char EFFECT_SOLARIZE[];
- static const char EFFECT_SEPIA[];
- static const char EFFECT_POSTERIZE[];
- static const char EFFECT_WHITEBOARD[];
- static const char EFFECT_BLACKBOARD[];
- static const char EFFECT_AQUA[];
-
- // Values for antibanding settings.
- static const char ANTIBANDING_AUTO[];
- static const char ANTIBANDING_50HZ[];
- static const char ANTIBANDING_60HZ[];
- static const char ANTIBANDING_OFF[];
-
- // Values for flash mode settings.
- // Flash will not be fired.
- static const char FLASH_MODE_OFF[];
- // Flash will be fired automatically when required. The flash may be fired
- // during preview, auto-focus, or snapshot depending on the driver.
- static const char FLASH_MODE_AUTO[];
- // Flash will always be fired during snapshot. The flash may also be
- // fired during preview or auto-focus depending on the driver.
- static const char FLASH_MODE_ON[];
- // Flash will be fired in red-eye reduction mode.
- static const char FLASH_MODE_RED_EYE[];
- // Constant emission of light during preview, auto-focus and snapshot.
- // This can also be used for video recording.
- static const char FLASH_MODE_TORCH[];
-
- // Values for scene mode settings.
- static const char SCENE_MODE_AUTO[];
- static const char SCENE_MODE_ACTION[];
- static const char SCENE_MODE_PORTRAIT[];
- static const char SCENE_MODE_LANDSCAPE[];
- static const char SCENE_MODE_NIGHT[];
- static const char SCENE_MODE_NIGHT_PORTRAIT[];
- static const char SCENE_MODE_THEATRE[];
- static const char SCENE_MODE_BEACH[];
- static const char SCENE_MODE_SNOW[];
- static const char SCENE_MODE_SUNSET[];
- static const char SCENE_MODE_STEADYPHOTO[];
- static const char SCENE_MODE_FIREWORKS[];
- static const char SCENE_MODE_SPORTS[];
- static const char SCENE_MODE_PARTY[];
- static const char SCENE_MODE_CANDLELIGHT[];
- // Applications are looking for a barcode. Camera driver will be optimized
- // for barcode reading.
- static const char SCENE_MODE_BARCODE[];
-
- // Pixel color formats for KEY_PREVIEW_FORMAT, KEY_PICTURE_FORMAT,
- // and KEY_VIDEO_FRAME_FORMAT
- static const char PIXEL_FORMAT_YUV422SP[];
- static const char PIXEL_FORMAT_YUV420SP[]; // NV21
- static const char PIXEL_FORMAT_YUV422I[]; // YUY2
- static const char PIXEL_FORMAT_YUV420P[]; // YV12
- static const char PIXEL_FORMAT_RGB565[];
- static const char PIXEL_FORMAT_RGBA8888[];
- static const char PIXEL_FORMAT_JPEG[];
- // Raw bayer format used for images, which is 10 bit precision samples
- // stored in 16 bit words. The filter pattern is RGGB.
- static const char PIXEL_FORMAT_BAYER_RGGB[];
-
- // Values for focus mode settings.
- // Auto-focus mode. Applications should call
- // CameraHardwareInterface.autoFocus to start the focus in this mode.
- static const char FOCUS_MODE_AUTO[];
- // Focus is set at infinity. Applications should not call
- // CameraHardwareInterface.autoFocus in this mode.
- static const char FOCUS_MODE_INFINITY[];
- // Macro (close-up) focus mode. Applications should call
- // CameraHardwareInterface.autoFocus to start the focus in this mode.
- static const char FOCUS_MODE_MACRO[];
- // Focus is fixed. The camera is always in this mode if the focus is not
- // adjustable. If the camera has auto-focus, this mode can fix the
- // focus, which is usually at hyperfocal distance. Applications should
- // not call CameraHardwareInterface.autoFocus in this mode.
- static const char FOCUS_MODE_FIXED[];
- // Extended depth of field (EDOF). Focusing is done digitally and
- // continuously. Applications should not call
- // CameraHardwareInterface.autoFocus in this mode.
- static const char FOCUS_MODE_EDOF[];
- // Continuous auto focus mode intended for video recording. The camera
- // continuously tries to focus. This is the best choice for video
- // recording because the focus changes smoothly . Applications still can
- // call CameraHardwareInterface.takePicture in this mode but the subject may
- // not be in focus. Auto focus starts when the parameter is set.
- //
- // Applications can call CameraHardwareInterface.autoFocus in this mode. The
- // focus callback will immediately return with a boolean that indicates
- // whether the focus is sharp or not. The focus position is locked after
- // autoFocus call. If applications want to resume the continuous focus,
- // cancelAutoFocus must be called. Restarting the preview will not resume
- // the continuous autofocus. To stop continuous focus, applications should
- // change the focus mode to other modes.
- static const char FOCUS_MODE_CONTINUOUS_VIDEO[];
- // Continuous auto focus mode intended for taking pictures. The camera
- // continuously tries to focus. The speed of focus change is more aggressive
- // than FOCUS_MODE_CONTINUOUS_VIDEO. Auto focus starts when the parameter is
- // set.
- //
- // Applications can call CameraHardwareInterface.autoFocus in this mode. If
- // the autofocus is in the middle of scanning, the focus callback will
- // return when it completes. If the autofocus is not scanning, focus
- // callback will immediately return with a boolean that indicates whether
- // the focus is sharp or not. The apps can then decide if they want to take
- // a picture immediately or to change the focus mode to auto, and run a full
- // autofocus cycle. The focus position is locked after autoFocus call. If
- // applications want to resume the continuous focus, cancelAutoFocus must be
- // called. Restarting the preview will not resume the continuous autofocus.
- // To stop continuous focus, applications should change the focus mode to
- // other modes.
- static const char FOCUS_MODE_CONTINUOUS_PICTURE[];
-
-private:
- DefaultKeyedVector<String8,String8> mMap;
-};
-
-}; // namespace android
-
-#endif
diff --git a/include/camera/ICameraService.h b/include/camera/ICameraService.h
index 7d70c1e..97e3169 100644
--- a/include/camera/ICameraService.h
+++ b/include/camera/ICameraService.h
@@ -42,7 +42,7 @@
virtual status_t getCameraInfo(int cameraId,
struct CameraInfo* cameraInfo) = 0;
virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient,
- int cameraId) = 0;
+ int cameraId, bool force, bool keep) = 0;
};
// ----------------------------------------------------------------------------
diff --git a/include/cpustats/ThreadCpuUsage.h b/include/cpustats/ThreadCpuUsage.h
index 24012a4..9cd93d8 100644
--- a/include/cpustats/ThreadCpuUsage.h
+++ b/include/cpustats/ThreadCpuUsage.h
@@ -17,16 +17,17 @@
#ifndef _THREAD_CPU_USAGE_H
#define _THREAD_CPU_USAGE_H
-#include <cpustats/CentralTendencyStatistics.h>
+#include <fcntl.h>
+#include <pthread.h>
-// Track CPU usage for the current thread, and maintain statistics on
-// the CPU usage. Units are in per-thread CPU ns, as reported by
+namespace android {
+
+// Track CPU usage for the current thread.
+// Units are in per-thread CPU ns, as reported by
// clock_gettime(CLOCK_THREAD_CPUTIME_ID). Simple usage: for cyclic
// threads where you want to measure the execution time of the whole
// cycle, just call sampleAndEnable() at the start of each cycle.
-// Then call statistics() to get the results, and resetStatistics()
-// to start a new set of measurements.
-// For acyclic threads, or for cyclic threads where you want to measure
+// For acyclic threads, or for cyclic threads where you want to measure/track
// only part of each cycle, call enable(), disable(), and/or setEnabled()
// to demarcate the region(s) of interest, and then call sample() periodically.
// This class is not thread-safe for concurrent calls from multiple threads;
@@ -44,13 +45,17 @@
// mPreviousTs
// mMonotonicTs
mMonotonicKnown(false)
- // mStatistics
- { }
+ {
+ (void) pthread_once(&sOnceControl, &init);
+ for (int i = 0; i < sKernelMax; ++i) {
+ mCurrentkHz[i] = (uint32_t) ~0; // unknown
+ }
+ }
~ThreadCpuUsage() { }
// Return whether currently tracking CPU usage by current thread
- bool isEnabled() { return mIsEnabled; }
+ bool isEnabled() const { return mIsEnabled; }
// Enable tracking of CPU usage by current thread;
// any CPU used from this point forward will be tracked.
@@ -66,39 +71,52 @@
// This method is intended to be used for safe nested enable/disabling.
bool setEnabled(bool isEnabled);
- // Add a sample point for central tendency statistics, and also
- // enable tracking if needed. If tracking has never been enabled, then
- // enables tracking but does not add a sample (it is not possible to add
- // a sample the first time because no previous). Otherwise if tracking is
- // enabled, then adds a sample for tracked CPU ns since the previous
+ // Add a sample point, and also enable tracking if needed.
+ // If tracking has never been enabled, then this call enables tracking but
+ // does _not_ add a sample -- it is not possible to add a sample the
+ // first time because there is no previous point to subtract from.
+ // Otherwise, if tracking is enabled,
+ // then adds a sample for tracked CPU ns since the previous
// sample, or since the first call to sampleAndEnable(), enable(), or
// setEnabled(true). If there was a previous sample but tracking is
// now disabled, then adds a sample for the tracked CPU ns accumulated
// up until the most recent disable(), resets this accumulator, and then
// enables tracking. Calling this method rather than enable() followed
// by sample() avoids a race condition for the first sample.
- void sampleAndEnable();
+ // Returns true if the sample 'ns' is valid, or false if invalid.
+ // Note that 'ns' is an output parameter passed by reference.
+ // The caller does not need to initialize this variable.
+ // The units are CPU nanoseconds consumed by current thread.
+ bool sampleAndEnable(double& ns);
- // Add a sample point for central tendency statistics, but do not
+ // Add a sample point, but do not
// change the tracking enabled status. If tracking has either never been
// enabled, or has never been enabled since the last sample, then log a warning
// and don't add sample. Otherwise, adds a sample for tracked CPU ns since
// the previous sample or since the first call to sampleAndEnable(),
// enable(), or setEnabled(true) if no previous sample.
- void sample();
+ // Returns true if the sample is valid, or false if invalid.
+ // Note that 'ns' is an output parameter passed by reference.
+ // The caller does not need to initialize this variable.
+ // The units are CPU nanoseconds consumed by current thread.
+ bool sample(double& ns);
- // Return the elapsed delta wall clock ns since initial enable or statistics reset,
+ // Return the elapsed delta wall clock ns since initial enable or reset,
// as reported by clock_gettime(CLOCK_MONOTONIC).
long long elapsed() const;
- // Reset statistics and elapsed. Has no effect on tracking or accumulator.
- void resetStatistics();
+ // Reset elapsed wall clock. Has no effect on tracking or accumulator.
+ void resetElapsed();
- // Return a const reference to the central tendency statistics.
- // Note that only the const methods can be called on this object.
- const CentralTendencyStatistics& statistics() const {
- return mStatistics;
- }
+ // Return current clock frequency for specified CPU, in kHz.
+ // You can get your CPU number using sched_getcpu(2). Note that, unless CPU affinity
+ // has been configured appropriately, the CPU number can change.
+ // Also note that, unless the CPU governor has been configured appropriately,
+ // the CPU frequency can change. And even if the CPU frequency is locked down
+ // to a particular value, that the frequency might still be adjusted
+ // to prevent thermal overload. Therefore you should poll for your thread's
+ // current CPU number and clock frequency periodically.
+ uint32_t getCpukHz(int cpuNum);
private:
bool mIsEnabled; // whether tracking is currently enabled
@@ -107,7 +125,15 @@
struct timespec mPreviousTs; // most recent thread CPU time, valid only if mIsEnabled is true
struct timespec mMonotonicTs; // most recent monotonic time
bool mMonotonicKnown; // whether mMonotonicTs has been set
- CentralTendencyStatistics mStatistics;
+
+ static const int MAX_CPU = 8;
+ static int sScalingFds[MAX_CPU];// file descriptor per CPU for reading scaling_cur_freq
+ uint32_t mCurrentkHz[MAX_CPU]; // current CPU frequency in kHz, not static to avoid a race
+ static pthread_once_t sOnceControl;
+ static int sKernelMax; // like MAX_CPU, but determined at runtime == cpu/kernel_max + 1
+ static void init();
};
+} // namespace android
+
#endif // _THREAD_CPU_USAGE_H
diff --git a/include/media/IAudioRecord.h b/include/media/IAudioRecord.h
index 7869020..089be3b 100644
--- a/include/media/IAudioRecord.h
+++ b/include/media/IAudioRecord.h
@@ -32,7 +32,7 @@
class IAudioRecord : public IInterface
{
-public:
+public:
DECLARE_META_INTERFACE(AudioRecord);
/* After it's created the track is not active. Call start() to
@@ -42,13 +42,13 @@
virtual status_t start(pid_t tid) = 0;
/* Stop a track. If set, the callback will cease being called and
- * obtainBuffer will return an error. Buffers that are already released
+ * obtainBuffer will return an error. Buffers that are already released
* will be processed, unless flush() is called.
*/
virtual void stop() = 0;
/* get this tracks control block */
- virtual sp<IMemory> getCblk() const = 0;
+ virtual sp<IMemory> getCblk() const = 0;
};
// ----------------------------------------------------------------------------
diff --git a/include/media/IAudioTrack.h b/include/media/IAudioTrack.h
index 77f3e21..577b095 100644
--- a/include/media/IAudioTrack.h
+++ b/include/media/IAudioTrack.h
@@ -32,7 +32,7 @@
class IAudioTrack : public IInterface
{
-public:
+public:
DECLARE_META_INTERFACE(AudioTrack);
/* Get this track's control block */
@@ -45,7 +45,7 @@
virtual status_t start(pid_t tid) = 0;
/* Stop a track. If set, the callback will cease being called and
- * obtainBuffer will return an error. Buffers that are already released
+ * obtainBuffer will return an error. Buffers that are already released
* will continue to be processed, unless/until flush() is called.
*/
virtual void stop() = 0;
@@ -59,9 +59,9 @@
* While muted, the callback, if set, is still called.
*/
virtual void mute(bool) = 0;
-
+
/* Pause a track. If set, the callback will cease being called and
- * obtainBuffer will return an error. Buffers that are already released
+ * obtainBuffer will return an error. Buffers that are already released
* will continue to be processed, unless/until flush() is called.
*/
virtual void pause() = 0;
diff --git a/include/media/IMediaMetadataRetriever.h b/include/media/IMediaMetadataRetriever.h
index 1c1c268..6dbb2d7 100644
--- a/include/media/IMediaMetadataRetriever.h
+++ b/include/media/IMediaMetadataRetriever.h
@@ -56,4 +56,3 @@
}; // namespace android
#endif // ANDROID_IMEDIAMETADATARETRIEVER_H
-
diff --git a/include/media/IMediaPlayer.h b/include/media/IMediaPlayer.h
index 39d58ab..00facc5 100644
--- a/include/media/IMediaPlayer.h
+++ b/include/media/IMediaPlayer.h
@@ -64,6 +64,7 @@
virtual status_t setParameter(int key, const Parcel& request) = 0;
virtual status_t getParameter(int key, Parcel* reply) = 0;
virtual status_t setRetransmitEndpoint(const struct sockaddr_in* endpoint) = 0;
+ virtual status_t setNextPlayer(const sp<IMediaPlayer>& next) = 0;
// Invoke a generic method on the player by using opaque parcels
// for the request and reply.
diff --git a/include/media/IMediaPlayerClient.h b/include/media/IMediaPlayerClient.h
index daec1c7..8f1843e 100644
--- a/include/media/IMediaPlayerClient.h
+++ b/include/media/IMediaPlayerClient.h
@@ -45,4 +45,3 @@
}; // namespace android
#endif // ANDROID_IMEDIAPLAYERCLIENT_H
-
diff --git a/include/media/IMediaRecorderClient.h b/include/media/IMediaRecorderClient.h
index 0058ef2..e7d0229 100644
--- a/include/media/IMediaRecorderClient.h
+++ b/include/media/IMediaRecorderClient.h
@@ -45,4 +45,3 @@
}; // namespace android
#endif // ANDROID_IMEDIARECORDERCLIENT_H
-
diff --git a/include/media/JetPlayer.h b/include/media/JetPlayer.h
index 491a950..38a3e44 100644
--- a/include/media/JetPlayer.h
+++ b/include/media/JetPlayer.h
@@ -22,7 +22,7 @@
#include <libsonivox/jet.h>
#include <libsonivox/eas_types.h>
-#include "AudioTrack.h"
+#include <media/AudioTrack.h>
namespace android {
@@ -40,13 +40,13 @@
static const int JET_NUMQUEUEDSEGMENT_UPDATE = 3;
static const int JET_PAUSE_UPDATE = 4;
- JetPlayer(jobject javaJetPlayer,
- int maxTracks = 32,
+ JetPlayer(jobject javaJetPlayer,
+ int maxTracks = 32,
int trackBufferSize = 1200);
~JetPlayer();
int init();
int release();
-
+
int loadFromFile(const char* url);
int loadFromFD(const int fd, const long long offset, const long long length);
int closeFile();
@@ -60,7 +60,7 @@
int clearQueue();
void setEventCallback(jetevent_callback callback);
-
+
int getMaxTracks() { return mMaxTracks; };
@@ -88,7 +88,7 @@
int mMaxTracks; // max number of MIDI tracks, usually 32
EAS_DATA_HANDLE mEasData;
EAS_FILE_LOCATOR mEasJetFileLoc;
- EAS_PCM* mAudioBuffer;// EAS renders the MIDI data into this buffer,
+ EAS_PCM* mAudioBuffer;// EAS renders the MIDI data into this buffer,
AudioTrack* mAudioTrack; // and we play it in this audio track
int mTrackBufferSize;
S_JET_STATUS mJetStatus;
diff --git a/include/media/MediaMetadataRetrieverInterface.h b/include/media/MediaMetadataRetrieverInterface.h
index 27b7e4d..ecc3b65 100644
--- a/include/media/MediaMetadataRetrieverInterface.h
+++ b/include/media/MediaMetadataRetrieverInterface.h
@@ -1,6 +1,6 @@
/*
**
-** Copyright (C) 2008 The Android Open Source Project
+** Copyright (C) 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.
@@ -56,4 +56,3 @@
}; // namespace android
#endif // ANDROID_MEDIAMETADATARETRIEVERINTERFACE_H
-
diff --git a/include/media/MediaPlayerInterface.h b/include/media/MediaPlayerInterface.h
index 8168dff..d4aa233 100644
--- a/include/media/MediaPlayerInterface.h
+++ b/include/media/MediaPlayerInterface.h
@@ -107,6 +107,7 @@
virtual void close() = 0;
virtual status_t setPlaybackRatePermille(int32_t rate) { return INVALID_OPERATION; }
+ virtual bool needsTrailingPadding() { return true; }
};
MediaPlayerBase() : mCookie(0), mNotify(0) {}
diff --git a/include/media/MediaProfiles.h b/include/media/MediaProfiles.h
index 250f267..9fc962c 100644
--- a/include/media/MediaProfiles.h
+++ b/include/media/MediaProfiles.h
@@ -516,4 +516,3 @@
}; // namespace android
#endif // ANDROID_MEDIAPROFILES_H
-
diff --git a/include/media/MemoryLeakTrackUtil.h b/include/media/MemoryLeakTrackUtil.h
index ac0f6b2..d2618aa 100644
--- a/include/media/MemoryLeakTrackUtil.h
+++ b/include/media/MemoryLeakTrackUtil.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2011, The Android Open Source Project
*
diff --git a/include/media/mediaplayer.h b/include/media/mediaplayer.h
index 9cd5f9f..a68ab4e 100644
--- a/include/media/mediaplayer.h
+++ b/include/media/mediaplayer.h
@@ -96,6 +96,9 @@
enum media_info_type {
// 0xx
MEDIA_INFO_UNKNOWN = 1,
+ // The player was started because it was used as the next player for another
+ // player, which just completed playback
+ MEDIA_INFO_STARTED_AS_NEXT = 2,
// 7xx
// The video is too complex for the decoder: it can't decode frames fast
// enough. Possibly only the audio plays fine at this stage.
@@ -117,6 +120,9 @@
MEDIA_INFO_NOT_SEEKABLE = 801,
// New media metadata is available.
MEDIA_INFO_METADATA_UPDATE = 802,
+
+ //9xx
+ MEDIA_INFO_TIMED_TEXT_ERROR = 900,
};
@@ -137,9 +143,6 @@
// The same enum space is used for both set and get, in case there are future keys that
// can be both set and get. But as of now, all parameters are either set only or get only.
enum media_parameter_keys {
- KEY_PARAMETER_TIMED_TEXT_TRACK_INDEX = 1000, // set only
- KEY_PARAMETER_TIMED_TEXT_ADD_OUT_OF_BAND_SOURCE = 1001, // set only
-
// Streaming/buffering parameters
KEY_PARAMETER_CACHE_STAT_COLLECT_FREQ_MS = 1100, // set only
@@ -152,6 +155,23 @@
KEY_PARAMETER_PLAYBACK_RATE_PERMILLE = 1300, // set only
};
+// Keep INVOKE_ID_* in sync with MediaPlayer.java.
+enum media_player_invoke_ids {
+ INVOKE_ID_GET_TRACK_INFO = 1,
+ INVOKE_ID_ADD_EXTERNAL_SOURCE = 2,
+ INVOKE_ID_ADD_EXTERNAL_SOURCE_FD = 3,
+ INVOKE_ID_SELECT_TRACK = 4,
+ INVOKE_ID_UNSELECT_TRACK = 5,
+};
+
+// Keep MEDIA_TRACK_TYPE_* in sync with MediaPlayer.java.
+enum media_track_type {
+ MEDIA_TRACK_TYPE_UNKNOWN = 0,
+ MEDIA_TRACK_TYPE_VIDEO = 1,
+ MEDIA_TRACK_TYPE_AUDIO = 2,
+ MEDIA_TRACK_TYPE_TIMEDTEXT = 3,
+};
+
// ----------------------------------------------------------------------------
// ref-counted object for callbacks
class MediaPlayerListener: virtual public RefBase
@@ -207,6 +227,7 @@
status_t setParameter(int key, const Parcel& request);
status_t getParameter(int key, Parcel* reply);
status_t setRetransmitEndpoint(const char* addrString, uint16_t port);
+ status_t setNextMediaPlayer(const sp<MediaPlayer>& player);
private:
void clear_l();
diff --git a/include/media/stagefright/HardwareAPI.h b/include/media/stagefright/HardwareAPI.h
deleted file mode 100644
index 17efd35..0000000
--- a/include/media/stagefright/HardwareAPI.h
+++ /dev/null
@@ -1,113 +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.
- */
-
-#ifndef HARDWARE_API_H_
-
-#define HARDWARE_API_H_
-
-#include <media/stagefright/OMXPluginBase.h>
-#include <system/window.h>
-#include <utils/RefBase.h>
-
-#include <OMX_Component.h>
-
-namespace android {
-
-// A pointer to this struct is passed to the OMX_SetParameter when the extension
-// index for the 'OMX.google.android.index.enableAndroidNativeBuffers' extension
-// is given.
-//
-// When Android native buffer use is disabled for a port (the default state),
-// the OMX node should operate as normal, and expect UseBuffer calls to set its
-// buffers. This is the mode that will be used when CPU access to the buffer is
-// required.
-//
-// When Android native buffer use has been enabled for a given port, the video
-// color format for the port is to be interpreted as an Android pixel format
-// rather than an OMX color format. The node should then expect to receive
-// UseAndroidNativeBuffer calls (via OMX_SetParameter) rather than UseBuffer
-// calls for that port.
-struct EnableAndroidNativeBuffersParams {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL enable;
-};
-
-// A pointer to this struct is passed to OMX_SetParameter() when the extension
-// index "OMX.google.android.index.storeMetaDataInBuffers"
-// is given.
-//
-// When meta data is stored in the video buffers passed between OMX clients
-// and OMX components, interpretation of the buffer data is up to the
-// buffer receiver, and the data may or may not be the actual video data, but
-// some information helpful for the receiver to locate the actual data.
-// The buffer receiver thus needs to know how to interpret what is stored
-// in these buffers, with mechanisms pre-determined externally. How to
-// interpret the meta data is outside of the scope of this method.
-//
-// Currently, this is specifically used to pass meta data from video source
-// (camera component, for instance) to video encoder to avoid memcpying of
-// input video frame data. To do this, bStoreMetaDta is set to OMX_TRUE.
-// If bStoreMetaData is set to false, real YUV frame data will be stored
-// in the buffers. In addition, if no OMX_SetParameter() call is made
-// with the corresponding extension index, real YUV data is stored
-// in the buffers.
-struct StoreMetaDataInBuffersParams {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL bStoreMetaData;
-};
-
-// A pointer to this struct is passed to OMX_SetParameter when the extension
-// index for the 'OMX.google.android.index.useAndroidNativeBuffer' extension is
-// given. This call will only be performed if a prior call was made with the
-// 'OMX.google.android.index.enableAndroidNativeBuffers' extension index,
-// enabling use of Android native buffers.
-struct UseAndroidNativeBufferParams {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_PTR pAppPrivate;
- OMX_BUFFERHEADERTYPE **bufferHeader;
- const sp<ANativeWindowBuffer>& nativeBuffer;
-};
-
-// A pointer to this struct is passed to OMX_GetParameter when the extension
-// index for the 'OMX.google.android.index.getAndroidNativeBufferUsage'
-// extension is given. The usage bits returned from this query will be used to
-// allocate the Gralloc buffers that get passed to the useAndroidNativeBuffer
-// command.
-struct GetAndroidNativeBufferUsageParams {
- OMX_U32 nSize; // IN
- OMX_VERSIONTYPE nVersion; // IN
- OMX_U32 nPortIndex; // IN
- OMX_U32 nUsage; // OUT
-};
-
-// An enum OMX_COLOR_FormatAndroidOpaque to indicate an opaque colorformat
-// is declared in media/stagefright/openmax/OMX_IVCommon.h
-// This will inform the encoder that the actual
-// colorformat will be relayed by the GRalloc Buffers.
-// OMX_COLOR_FormatAndroidOpaque = 0x7F000001,
-
-
-} // namespace android
-
-extern android::OMXPluginBase *createOMXPlugin();
-
-#endif // HARDWARE_API_H_
diff --git a/include/media/stagefright/MediaDefs.h b/include/media/stagefright/MediaDefs.h
index 2eb259e..457d5d7 100644
--- a/include/media/stagefright/MediaDefs.h
+++ b/include/media/stagefright/MediaDefs.h
@@ -54,6 +54,7 @@
extern const char *MEDIA_MIMETYPE_CONTAINER_WVM;
extern const char *MEDIA_MIMETYPE_TEXT_3GPP;
+extern const char *MEDIA_MIMETYPE_TEXT_SUBRIP;
} // namespace android
diff --git a/include/media/stagefright/MetadataBufferType.h b/include/media/stagefright/MetadataBufferType.h
deleted file mode 100644
index 4eaf8ac..0000000
--- a/include/media/stagefright/MetadataBufferType.h
+++ /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.
- */
-
-#ifndef METADATA_BUFFER_TYPE_H
-#define METADATA_BUFFER_TYPE_H
-
-#ifdef __cplusplus
-extern "C" {
-namespace android {
-#endif
-
-/*
- * MetadataBufferType defines the type of the metadata buffers that
- * can be passed to video encoder component for encoding, via Stagefright
- * media recording framework. To see how to work with the metadata buffers
- * in media recording framework, please consult HardwareAPI.h
- *
- * The creator of metadata buffers and video encoder share common knowledge
- * on what is actually being stored in these metadata buffers, and
- * how the information can be used by the video encoder component
- * to locate the actual pixel data as the source input for video
- * encoder, plus whatever other information that is necessary. Stagefright
- * media recording framework does not need to know anything specific about the
- * metadata buffers, except for receving each individual metadata buffer
- * as the source input, making a copy of the metadata buffer, and passing the
- * copy via OpenMAX API to the video encoder component.
- *
- * The creator of the metadata buffers must ensure that the first
- * 4 bytes in every metadata buffer indicates its buffer type,
- * and the rest of the metadata buffer contains the
- * actual metadata information. When a video encoder component receives
- * a metadata buffer, it uses the first 4 bytes in that buffer to find
- * out the type of the metadata buffer, and takes action appropriate
- * to that type of metadata buffers (for instance, locate the actual
- * pixel data input and then encoding the input data to produce a
- * compressed output buffer).
- *
- * The following shows the layout of a metadata buffer,
- * where buffer type is a 4-byte field of MetadataBufferType,
- * and the payload is the metadata information.
- *
- * --------------------------------------------------------------
- * | buffer type | payload |
- * --------------------------------------------------------------
- *
- */
-typedef enum {
-
- /*
- * kMetadataBufferTypeCameraSource is used to indicate that
- * the source of the metadata buffer is the camera component.
- */
- kMetadataBufferTypeCameraSource = 0,
-
- /*
- * kMetadataBufferTypeGrallocSource is used to indicate that
- * the payload of the metadata buffers can be interpreted as
- * a buffer_handle_t.
- * So in this case,the metadata that the encoder receives
- * will have a byte stream that consists of two parts:
- * 1. First, there is an integer indicating that it is a GRAlloc
- * source (kMetadataBufferTypeGrallocSource)
- * 2. This is followed by the buffer_handle_t that is a handle to the
- * GRalloc buffer. The encoder needs to interpret this GRalloc handle
- * and encode the frames.
- * --------------------------------------------------------------
- * | kMetadataBufferTypeGrallocSource | sizeof(buffer_handle_t) |
- * --------------------------------------------------------------
- */
- kMetadataBufferTypeGrallocSource = 1,
-
- // Add more here...
-
-} MetadataBufferType;
-
-#ifdef __cplusplus
-} // namespace android
-}
-#endif
-
-#endif // METADATA_BUFFER_TYPE_H
diff --git a/include/media/stagefright/OMXPluginBase.h b/include/media/stagefright/OMXPluginBase.h
deleted file mode 100644
index 2fd8e12..0000000
--- a/include/media/stagefright/OMXPluginBase.h
+++ /dev/null
@@ -1,61 +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.
- */
-
-#ifndef OMX_PLUGIN_BASE_H_
-
-#define OMX_PLUGIN_BASE_H_
-
-#include <sys/types.h>
-
-#include <OMX_Component.h>
-
-#include <utils/String8.h>
-#include <utils/Vector.h>
-
-namespace android {
-
-struct OMXComponentBase;
-
-struct OMXPluginBase {
- OMXPluginBase() {}
- virtual ~OMXPluginBase() {}
-
- virtual OMX_ERRORTYPE makeComponentInstance(
- const char *name,
- const OMX_CALLBACKTYPE *callbacks,
- OMX_PTR appData,
- OMX_COMPONENTTYPE **component) = 0;
-
- virtual OMX_ERRORTYPE destroyComponentInstance(
- OMX_COMPONENTTYPE *component) = 0;
-
- virtual OMX_ERRORTYPE enumerateComponents(
- OMX_STRING name,
- size_t size,
- OMX_U32 index) = 0;
-
- virtual OMX_ERRORTYPE getRolesOfComponent(
- const char *name,
- Vector<String8> *roles) = 0;
-
-private:
- OMXPluginBase(const OMXPluginBase &);
- OMXPluginBase &operator=(const OMXPluginBase &);
-};
-
-} // namespace android
-
-#endif // OMX_PLUGIN_BASE_H_
diff --git a/include/media/stagefright/openmax/OMX_Audio.h b/include/media/stagefright/openmax/OMX_Audio.h
deleted file mode 100644
index 3482841..0000000
--- a/include/media/stagefright/openmax/OMX_Audio.h
+++ /dev/null
@@ -1,1328 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/*
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is 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 Software.
- *
- * THE SOFTWARE IS 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
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/** @file OMX_Audio.h - OpenMax IL version 1.1.2
- * The structures needed by Audio components to exchange
- * parameters and configuration data with the componenmilts.
- */
-
-#ifndef OMX_Audio_h
-#define OMX_Audio_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* Each OMX header must include all required header files to allow the
- * header to compile without errors. The includes below are required
- * for this header file to compile successfully
- */
-
-#include <OMX_Core.h>
-
-/** @defgroup midi MIDI
- * @ingroup audio
- */
-
-/** @defgroup effects Audio effects
- * @ingroup audio
- */
-
-/** @defgroup audio OpenMAX IL Audio Domain
- * Structures for OpenMAX IL Audio domain
- * @{
- */
-
-/** Enumeration used to define the possible audio codings.
- * If "OMX_AUDIO_CodingUnused" is selected, the coding selection must
- * be done in a vendor specific way. Since this is for an audio
- * processing element this enum is relevant. However, for another
- * type of component other enums would be in this area.
- */
-typedef enum OMX_AUDIO_CODINGTYPE {
- OMX_AUDIO_CodingUnused = 0, /**< Placeholder value when coding is N/A */
- OMX_AUDIO_CodingAutoDetect, /**< auto detection of audio format */
- OMX_AUDIO_CodingPCM, /**< Any variant of PCM coding */
- OMX_AUDIO_CodingADPCM, /**< Any variant of ADPCM encoded data */
- OMX_AUDIO_CodingAMR, /**< Any variant of AMR encoded data */
- OMX_AUDIO_CodingGSMFR, /**< Any variant of GSM fullrate (i.e. GSM610) */
- OMX_AUDIO_CodingGSMEFR, /**< Any variant of GSM Enhanced Fullrate encoded data*/
- OMX_AUDIO_CodingGSMHR, /**< Any variant of GSM Halfrate encoded data */
- OMX_AUDIO_CodingPDCFR, /**< Any variant of PDC Fullrate encoded data */
- OMX_AUDIO_CodingPDCEFR, /**< Any variant of PDC Enhanced Fullrate encoded data */
- OMX_AUDIO_CodingPDCHR, /**< Any variant of PDC Halfrate encoded data */
- OMX_AUDIO_CodingTDMAFR, /**< Any variant of TDMA Fullrate encoded data (TIA/EIA-136-420) */
- OMX_AUDIO_CodingTDMAEFR, /**< Any variant of TDMA Enhanced Fullrate encoded data (TIA/EIA-136-410) */
- OMX_AUDIO_CodingQCELP8, /**< Any variant of QCELP 8kbps encoded data */
- OMX_AUDIO_CodingQCELP13, /**< Any variant of QCELP 13kbps encoded data */
- OMX_AUDIO_CodingEVRC, /**< Any variant of EVRC encoded data */
- OMX_AUDIO_CodingSMV, /**< Any variant of SMV encoded data */
- OMX_AUDIO_CodingG711, /**< Any variant of G.711 encoded data */
- OMX_AUDIO_CodingG723, /**< Any variant of G.723 dot 1 encoded data */
- OMX_AUDIO_CodingG726, /**< Any variant of G.726 encoded data */
- OMX_AUDIO_CodingG729, /**< Any variant of G.729 encoded data */
- OMX_AUDIO_CodingAAC, /**< Any variant of AAC encoded data */
- OMX_AUDIO_CodingMP3, /**< Any variant of MP3 encoded data */
- OMX_AUDIO_CodingSBC, /**< Any variant of SBC encoded data */
- OMX_AUDIO_CodingVORBIS, /**< Any variant of VORBIS encoded data */
- OMX_AUDIO_CodingWMA, /**< Any variant of WMA encoded data */
- OMX_AUDIO_CodingRA, /**< Any variant of RA encoded data */
- OMX_AUDIO_CodingMIDI, /**< Any variant of MIDI encoded data */
- OMX_AUDIO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_CodingMax = 0x7FFFFFFF
-} OMX_AUDIO_CODINGTYPE;
-
-
-/** The PortDefinition structure is used to define all of the parameters
- * necessary for the compliant component to setup an input or an output audio
- * path. If additional information is needed to define the parameters of the
- * port (such as frequency), additional structures must be sent such as the
- * OMX_AUDIO_PARAM_PCMMODETYPE structure to supply the extra parameters for the port.
- */
-typedef struct OMX_AUDIO_PORTDEFINITIONTYPE {
- OMX_STRING cMIMEType; /**< MIME type of data for the port */
- OMX_NATIVE_DEVICETYPE pNativeRender; /** < platform specific reference
- for an output device,
- otherwise this field is 0 */
- OMX_BOOL bFlagErrorConcealment; /**< Turns on error concealment if it is
- supported by the OMX component */
- OMX_AUDIO_CODINGTYPE eEncoding; /**< Type of data expected for this
- port (e.g. PCM, AMR, MP3, etc) */
-} OMX_AUDIO_PORTDEFINITIONTYPE;
-
-
-/** Port format parameter. This structure is used to enumerate
- * the various data input/output format supported by the port.
- */
-typedef struct OMX_AUDIO_PARAM_PORTFORMATTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Indicates which port to set */
- OMX_U32 nIndex; /**< Indicates the enumeration index for the format from 0x0 to N-1 */
- OMX_AUDIO_CODINGTYPE eEncoding; /**< Type of data expected for this port (e.g. PCM, AMR, MP3, etc) */
-} OMX_AUDIO_PARAM_PORTFORMATTYPE;
-
-
-/** PCM mode type */
-typedef enum OMX_AUDIO_PCMMODETYPE {
- OMX_AUDIO_PCMModeLinear = 0, /**< Linear PCM encoded data */
- OMX_AUDIO_PCMModeALaw, /**< A law PCM encoded data (G.711) */
- OMX_AUDIO_PCMModeMULaw, /**< Mu law PCM encoded data (G.711) */
- OMX_AUDIO_PCMModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_PCMModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_PCMModeMax = 0x7FFFFFFF
-} OMX_AUDIO_PCMMODETYPE;
-
-
-typedef enum OMX_AUDIO_CHANNELTYPE {
- OMX_AUDIO_ChannelNone = 0x0, /**< Unused or empty */
- OMX_AUDIO_ChannelLF = 0x1, /**< Left front */
- OMX_AUDIO_ChannelRF = 0x2, /**< Right front */
- OMX_AUDIO_ChannelCF = 0x3, /**< Center front */
- OMX_AUDIO_ChannelLS = 0x4, /**< Left surround */
- OMX_AUDIO_ChannelRS = 0x5, /**< Right surround */
- OMX_AUDIO_ChannelLFE = 0x6, /**< Low frequency effects */
- OMX_AUDIO_ChannelCS = 0x7, /**< Back surround */
- OMX_AUDIO_ChannelLR = 0x8, /**< Left rear. */
- OMX_AUDIO_ChannelRR = 0x9, /**< Right rear. */
- OMX_AUDIO_ChannelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_ChannelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_ChannelMax = 0x7FFFFFFF
-} OMX_AUDIO_CHANNELTYPE;
-
-#define OMX_AUDIO_MAXCHANNELS 16 /**< maximum number distinct audio channels that a buffer may contain */
-#define OMX_MIN_PCMPAYLOAD_MSEC 5 /**< Minimum audio buffer payload size for uncompressed (PCM) audio */
-
-/** PCM format description */
-typedef struct OMX_AUDIO_PARAM_PCMMODETYPE {
- OMX_U32 nSize; /**< Size of this structure, in Bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels (e.g. 2 for stereo) */
- OMX_NUMERICALDATATYPE eNumData; /**< indicates PCM data as signed or unsigned */
- OMX_ENDIANTYPE eEndian; /**< indicates PCM data as little or big endian */
- OMX_BOOL bInterleaved; /**< True for normal interleaved data; false for
- non-interleaved data (e.g. block data) */
- OMX_U32 nBitPerSample; /**< Bit per sample */
- OMX_U32 nSamplingRate; /**< Sampling rate of the source data. Use 0 for
- variable or unknown sampling rate. */
- OMX_AUDIO_PCMMODETYPE ePCMMode; /**< PCM mode enumeration */
- OMX_AUDIO_CHANNELTYPE eChannelMapping[OMX_AUDIO_MAXCHANNELS]; /**< Slot i contains channel defined by eChannelMap[i] */
-
-} OMX_AUDIO_PARAM_PCMMODETYPE;
-
-
-/** Audio channel mode. This is used by both AAC and MP3, although the names are more appropriate
- * for the MP3. For example, JointStereo for MP3 is CouplingChannels for AAC.
- */
-typedef enum OMX_AUDIO_CHANNELMODETYPE {
- OMX_AUDIO_ChannelModeStereo = 0, /**< 2 channels, the bitrate allocation between those
- two channels changes accordingly to each channel information */
- OMX_AUDIO_ChannelModeJointStereo, /**< mode that takes advantage of what is common between
- 2 channels for higher compression gain */
- OMX_AUDIO_ChannelModeDual, /**< 2 mono-channels, each channel is encoded with half
- the bitrate of the overall bitrate */
- OMX_AUDIO_ChannelModeMono, /**< Mono channel mode */
- OMX_AUDIO_ChannelModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_ChannelModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_ChannelModeMax = 0x7FFFFFFF
-} OMX_AUDIO_CHANNELMODETYPE;
-
-
-typedef enum OMX_AUDIO_MP3STREAMFORMATTYPE {
- OMX_AUDIO_MP3StreamFormatMP1Layer3 = 0, /**< MP3 Audio MPEG 1 Layer 3 Stream format */
- OMX_AUDIO_MP3StreamFormatMP2Layer3, /**< MP3 Audio MPEG 2 Layer 3 Stream format */
- OMX_AUDIO_MP3StreamFormatMP2_5Layer3, /**< MP3 Audio MPEG2.5 Layer 3 Stream format */
- OMX_AUDIO_MP3StreamFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_MP3StreamFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_MP3StreamFormatMax = 0x7FFFFFFF
-} OMX_AUDIO_MP3STREAMFORMATTYPE;
-
-/** MP3 params */
-typedef struct OMX_AUDIO_PARAM_MP3TYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels */
- OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable
- rate or unknown bit rates */
- OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for
- variable or unknown sampling rate. */
- OMX_U32 nAudioBandWidth; /**< Audio band width (in Hz) to which an encoder should
- limit the audio signal. Use 0 to let encoder decide */
- OMX_AUDIO_CHANNELMODETYPE eChannelMode; /**< Channel mode enumeration */
- OMX_AUDIO_MP3STREAMFORMATTYPE eFormat; /**< MP3 stream format */
-} OMX_AUDIO_PARAM_MP3TYPE;
-
-
-typedef enum OMX_AUDIO_AACSTREAMFORMATTYPE {
- OMX_AUDIO_AACStreamFormatMP2ADTS = 0, /**< AAC Audio Data Transport Stream 2 format */
- OMX_AUDIO_AACStreamFormatMP4ADTS, /**< AAC Audio Data Transport Stream 4 format */
- OMX_AUDIO_AACStreamFormatMP4LOAS, /**< AAC Low Overhead Audio Stream format */
- OMX_AUDIO_AACStreamFormatMP4LATM, /**< AAC Low overhead Audio Transport Multiplex */
- OMX_AUDIO_AACStreamFormatADIF, /**< AAC Audio Data Interchange Format */
- OMX_AUDIO_AACStreamFormatMP4FF, /**< AAC inside MPEG-4/ISO File Format */
- OMX_AUDIO_AACStreamFormatRAW, /**< AAC Raw Format */
- OMX_AUDIO_AACStreamFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_AACStreamFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_AACStreamFormatMax = 0x7FFFFFFF
-} OMX_AUDIO_AACSTREAMFORMATTYPE;
-
-
-/** AAC mode type. Note that the term profile is used with the MPEG-2
- * standard and the term object type and profile is used with MPEG-4 */
-typedef enum OMX_AUDIO_AACPROFILETYPE{
- OMX_AUDIO_AACObjectNull = 0, /**< Null, not used */
- OMX_AUDIO_AACObjectMain = 1, /**< AAC Main object */
- OMX_AUDIO_AACObjectLC, /**< AAC Low Complexity object (AAC profile) */
- OMX_AUDIO_AACObjectSSR, /**< AAC Scalable Sample Rate object */
- OMX_AUDIO_AACObjectLTP, /**< AAC Long Term Prediction object */
- OMX_AUDIO_AACObjectHE, /**< AAC High Efficiency (object type SBR, HE-AAC profile) */
- OMX_AUDIO_AACObjectScalable, /**< AAC Scalable object */
- OMX_AUDIO_AACObjectERLC = 17, /**< ER AAC Low Complexity object (Error Resilient AAC-LC) */
- OMX_AUDIO_AACObjectLD = 23, /**< AAC Low Delay object (Error Resilient) */
- OMX_AUDIO_AACObjectHE_PS = 29, /**< AAC High Efficiency with Parametric Stereo coding (HE-AAC v2, object type PS) */
- OMX_AUDIO_AACObjectKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_AACObjectVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_AACObjectMax = 0x7FFFFFFF
-} OMX_AUDIO_AACPROFILETYPE;
-
-
-/** AAC tool usage (for nAACtools in OMX_AUDIO_PARAM_AACPROFILETYPE).
- * Required for encoder configuration and optional as decoder info output.
- * For MP3, OMX_AUDIO_CHANNELMODETYPE is sufficient. */
-#define OMX_AUDIO_AACToolNone 0x00000000 /**< no AAC tools allowed (encoder config) or active (decoder info output) */
-#define OMX_AUDIO_AACToolMS 0x00000001 /**< MS: Mid/side joint coding tool allowed or active */
-#define OMX_AUDIO_AACToolIS 0x00000002 /**< IS: Intensity stereo tool allowed or active */
-#define OMX_AUDIO_AACToolTNS 0x00000004 /**< TNS: Temporal Noise Shaping tool allowed or active */
-#define OMX_AUDIO_AACToolPNS 0x00000008 /**< PNS: MPEG-4 Perceptual Noise substitution tool allowed or active */
-#define OMX_AUDIO_AACToolLTP 0x00000010 /**< LTP: MPEG-4 Long Term Prediction tool allowed or active */
-#define OMX_AUDIO_AACToolAll 0x7FFFFFFF /**< all AAC tools allowed or active (*/
-
-/** MPEG-4 AAC error resilience (ER) tool usage (for nAACERtools in OMX_AUDIO_PARAM_AACPROFILETYPE).
- * Required for ER encoder configuration and optional as decoder info output */
-#define OMX_AUDIO_AACERNone 0x00000000 /**< no AAC ER tools allowed/used */
-#define OMX_AUDIO_AACERVCB11 0x00000001 /**< VCB11: Virtual Code Books for AAC section data */
-#define OMX_AUDIO_AACERRVLC 0x00000002 /**< RVLC: Reversible Variable Length Coding */
-#define OMX_AUDIO_AACERHCR 0x00000004 /**< HCR: Huffman Codeword Reordering */
-#define OMX_AUDIO_AACERAll 0x7FFFFFFF /**< all AAC ER tools allowed/used */
-
-
-/** AAC params */
-typedef struct OMX_AUDIO_PARAM_AACPROFILETYPE {
- OMX_U32 nSize; /**< Size of this structure, in Bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels */
- OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for
- variable or unknown sampling rate. */
- OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable
- rate or unknown bit rates */
- OMX_U32 nAudioBandWidth; /**< Audio band width (in Hz) to which an encoder should
- limit the audio signal. Use 0 to let encoder decide */
- OMX_U32 nFrameLength; /**< Frame length (in audio samples per channel) of the codec.
- Can be 1024 or 960 (AAC-LC), 2048 (HE-AAC), 480 or 512 (AAC-LD).
- Use 0 to let encoder decide */
- OMX_U32 nAACtools; /**< AAC tool usage */
- OMX_U32 nAACERtools; /**< MPEG-4 AAC error resilience tool usage */
- OMX_AUDIO_AACPROFILETYPE eAACProfile; /**< AAC profile enumeration */
- OMX_AUDIO_AACSTREAMFORMATTYPE eAACStreamFormat; /**< AAC stream format enumeration */
- OMX_AUDIO_CHANNELMODETYPE eChannelMode; /**< Channel mode enumeration */
-} OMX_AUDIO_PARAM_AACPROFILETYPE;
-
-
-/** VORBIS params */
-typedef struct OMX_AUDIO_PARAM_VORBISTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels */
- OMX_U32 nBitRate; /**< Bit rate of the encoded data data. Use 0 for variable
- rate or unknown bit rates. Encoding is set to the
- bitrate closest to specified value (in bps) */
- OMX_U32 nMinBitRate; /**< Sets minimum bitrate (in bps). */
- OMX_U32 nMaxBitRate; /**< Sets maximum bitrate (in bps). */
-
- OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for
- variable or unknown sampling rate. */
- OMX_U32 nAudioBandWidth; /**< Audio band width (in Hz) to which an encoder should
- limit the audio signal. Use 0 to let encoder decide */
- OMX_S32 nQuality; /**< Sets encoding quality to n, between -1 (low) and 10 (high).
- In the default mode of operation, teh quality level is 3.
- Normal quality range is 0 - 10. */
- OMX_BOOL bManaged; /**< Set bitrate management mode. This turns off the
- normal VBR encoding, but allows hard or soft bitrate
- constraints to be enforced by the encoder. This mode can
- be slower, and may also be lower quality. It is
- primarily useful for streaming. */
- OMX_BOOL bDownmix; /**< Downmix input from stereo to mono (has no effect on
- non-stereo streams). Useful for lower-bitrate encoding. */
-} OMX_AUDIO_PARAM_VORBISTYPE;
-
-
-/** WMA Version */
-typedef enum OMX_AUDIO_WMAFORMATTYPE {
- OMX_AUDIO_WMAFormatUnused = 0, /**< format unused or unknown */
- OMX_AUDIO_WMAFormat7, /**< Windows Media Audio format 7 */
- OMX_AUDIO_WMAFormat8, /**< Windows Media Audio format 8 */
- OMX_AUDIO_WMAFormat9, /**< Windows Media Audio format 9 */
- OMX_AUDIO_WMAFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_WMAFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_WMAFormatMax = 0x7FFFFFFF
-} OMX_AUDIO_WMAFORMATTYPE;
-
-
-/** WMA Profile */
-typedef enum OMX_AUDIO_WMAPROFILETYPE {
- OMX_AUDIO_WMAProfileUnused = 0, /**< profile unused or unknown */
- OMX_AUDIO_WMAProfileL1, /**< Windows Media audio version 9 profile L1 */
- OMX_AUDIO_WMAProfileL2, /**< Windows Media audio version 9 profile L2 */
- OMX_AUDIO_WMAProfileL3, /**< Windows Media audio version 9 profile L3 */
- OMX_AUDIO_WMAProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_WMAProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_WMAProfileMax = 0x7FFFFFFF
-} OMX_AUDIO_WMAPROFILETYPE;
-
-
-/** WMA params */
-typedef struct OMX_AUDIO_PARAM_WMATYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U16 nChannels; /**< Number of channels */
- OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable
- rate or unknown bit rates */
- OMX_AUDIO_WMAFORMATTYPE eFormat; /**< Version of WMA stream / data */
- OMX_AUDIO_WMAPROFILETYPE eProfile; /**< Profile of WMA stream / data */
- OMX_U32 nSamplingRate; /**< Sampling rate of the source data */
- OMX_U16 nBlockAlign; /**< is the block alignment, or block size, in bytes of the audio codec */
- OMX_U16 nEncodeOptions; /**< WMA Type-specific data */
- OMX_U32 nSuperBlockAlign; /**< WMA Type-specific data */
-} OMX_AUDIO_PARAM_WMATYPE;
-
-/**
- * RealAudio format
- */
-typedef enum OMX_AUDIO_RAFORMATTYPE {
- OMX_AUDIO_RAFormatUnused = 0, /**< Format unused or unknown */
- OMX_AUDIO_RA8, /**< RealAudio 8 codec */
- OMX_AUDIO_RA9, /**< RealAudio 9 codec */
- OMX_AUDIO_RA10_AAC, /**< MPEG-4 AAC codec for bitrates of more than 128kbps */
- OMX_AUDIO_RA10_CODEC, /**< RealAudio codec for bitrates less than 128 kbps */
- OMX_AUDIO_RA10_LOSSLESS, /**< RealAudio Lossless */
- OMX_AUDIO_RA10_MULTICHANNEL, /**< RealAudio Multichannel */
- OMX_AUDIO_RA10_VOICE, /**< RealAudio Voice for bitrates below 15 kbps */
- OMX_AUDIO_RAFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_RAFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_RAFormatMax = 0x7FFFFFFF
-} OMX_AUDIO_RAFORMATTYPE;
-
-/** RA (Real Audio) params */
-typedef struct OMX_AUDIO_PARAM_RATYPE {
- OMX_U32 nSize; /**< Size of this structure, in Bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels */
- OMX_U32 nSamplingRate; /**< is the sampling rate of the source data */
- OMX_U32 nBitsPerFrame; /**< is the value for bits per frame */
- OMX_U32 nSamplePerFrame; /**< is the value for samples per frame */
- OMX_U32 nCouplingQuantBits; /**< is the number of coupling quantization bits in the stream */
- OMX_U32 nCouplingStartRegion; /**< is the coupling start region in the stream */
- OMX_U32 nNumRegions; /**< is the number of regions value */
- OMX_AUDIO_RAFORMATTYPE eFormat; /**< is the RealAudio audio format */
-} OMX_AUDIO_PARAM_RATYPE;
-
-
-/** SBC Allocation Method Type */
-typedef enum OMX_AUDIO_SBCALLOCMETHODTYPE {
- OMX_AUDIO_SBCAllocMethodLoudness, /**< Loudness allocation method */
- OMX_AUDIO_SBCAllocMethodSNR, /**< SNR allocation method */
- OMX_AUDIO_SBCAllocMethodKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_SBCAllocMethodVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_SBCAllocMethodMax = 0x7FFFFFFF
-} OMX_AUDIO_SBCALLOCMETHODTYPE;
-
-
-/** SBC params */
-typedef struct OMX_AUDIO_PARAM_SBCTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels */
- OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable
- rate or unknown bit rates */
- OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for
- variable or unknown sampling rate. */
- OMX_U32 nBlocks; /**< Number of blocks */
- OMX_U32 nSubbands; /**< Number of subbands */
- OMX_U32 nBitPool; /**< Bitpool value */
- OMX_BOOL bEnableBitrate; /**< Use bitrate value instead of bitpool */
- OMX_AUDIO_CHANNELMODETYPE eChannelMode; /**< Channel mode enumeration */
- OMX_AUDIO_SBCALLOCMETHODTYPE eSBCAllocType; /**< SBC Allocation method type */
-} OMX_AUDIO_PARAM_SBCTYPE;
-
-
-/** ADPCM stream format parameters */
-typedef struct OMX_AUDIO_PARAM_ADPCMTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_U32 nBitsPerSample; /**< Number of bits in each sample */
- OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for
- variable or unknown sampling rate. */
-} OMX_AUDIO_PARAM_ADPCMTYPE;
-
-
-/** G723 rate */
-typedef enum OMX_AUDIO_G723RATE {
- OMX_AUDIO_G723ModeUnused = 0, /**< AMRNB Mode unused / unknown */
- OMX_AUDIO_G723ModeLow, /**< 5300 bps */
- OMX_AUDIO_G723ModeHigh, /**< 6300 bps */
- OMX_AUDIO_G723ModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_G723ModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_G723ModeMax = 0x7FFFFFFF
-} OMX_AUDIO_G723RATE;
-
-
-/** G723 - Sample rate must be 8 KHz */
-typedef struct OMX_AUDIO_PARAM_G723TYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_AUDIO_G723RATE eBitRate; /**< todo: Should this be moved to a config? */
- OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */
- OMX_BOOL bPostFilter; /**< Enable Post Filter */
-} OMX_AUDIO_PARAM_G723TYPE;
-
-
-/** ITU G726 (ADPCM) rate */
-typedef enum OMX_AUDIO_G726MODE {
- OMX_AUDIO_G726ModeUnused = 0, /**< G726 Mode unused / unknown */
- OMX_AUDIO_G726Mode16, /**< 16 kbps */
- OMX_AUDIO_G726Mode24, /**< 24 kbps */
- OMX_AUDIO_G726Mode32, /**< 32 kbps, most common rate, also G721 */
- OMX_AUDIO_G726Mode40, /**< 40 kbps */
- OMX_AUDIO_G726ModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_G726ModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_G726ModeMax = 0x7FFFFFFF
-} OMX_AUDIO_G726MODE;
-
-
-/** G.726 stream format parameters - must be at 8KHz */
-typedef struct OMX_AUDIO_PARAM_G726TYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_AUDIO_G726MODE eG726Mode;
-} OMX_AUDIO_PARAM_G726TYPE;
-
-
-/** G729 coder type */
-typedef enum OMX_AUDIO_G729TYPE {
- OMX_AUDIO_G729 = 0, /**< ITU G.729 encoded data */
- OMX_AUDIO_G729A, /**< ITU G.729 annex A encoded data */
- OMX_AUDIO_G729B, /**< ITU G.729 with annex B encoded data */
- OMX_AUDIO_G729AB, /**< ITU G.729 annexes A and B encoded data */
- OMX_AUDIO_G729KhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_G729VendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_G729Max = 0x7FFFFFFF
-} OMX_AUDIO_G729TYPE;
-
-
-/** G729 stream format parameters - fixed 6KHz sample rate */
-typedef struct OMX_AUDIO_PARAM_G729TYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_AUDIO_G729TYPE eBitType;
-} OMX_AUDIO_PARAM_G729TYPE;
-
-
-/** AMR Frame format */
-typedef enum OMX_AUDIO_AMRFRAMEFORMATTYPE {
- OMX_AUDIO_AMRFrameFormatConformance = 0, /**< Frame Format is AMR Conformance
- (Standard) Format */
- OMX_AUDIO_AMRFrameFormatIF1, /**< Frame Format is AMR Interface
- Format 1 */
- OMX_AUDIO_AMRFrameFormatIF2, /**< Frame Format is AMR Interface
- Format 2*/
- OMX_AUDIO_AMRFrameFormatFSF, /**< Frame Format is AMR File Storage
- Format */
- OMX_AUDIO_AMRFrameFormatRTPPayload, /**< Frame Format is AMR Real-Time
- Transport Protocol Payload Format */
- OMX_AUDIO_AMRFrameFormatITU, /**< Frame Format is ITU Format (added at Motorola request) */
- OMX_AUDIO_AMRFrameFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_AMRFrameFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_AMRFrameFormatMax = 0x7FFFFFFF
-} OMX_AUDIO_AMRFRAMEFORMATTYPE;
-
-
-/** AMR band mode */
-typedef enum OMX_AUDIO_AMRBANDMODETYPE {
- OMX_AUDIO_AMRBandModeUnused = 0, /**< AMRNB Mode unused / unknown */
- OMX_AUDIO_AMRBandModeNB0, /**< AMRNB Mode 0 = 4750 bps */
- OMX_AUDIO_AMRBandModeNB1, /**< AMRNB Mode 1 = 5150 bps */
- OMX_AUDIO_AMRBandModeNB2, /**< AMRNB Mode 2 = 5900 bps */
- OMX_AUDIO_AMRBandModeNB3, /**< AMRNB Mode 3 = 6700 bps */
- OMX_AUDIO_AMRBandModeNB4, /**< AMRNB Mode 4 = 7400 bps */
- OMX_AUDIO_AMRBandModeNB5, /**< AMRNB Mode 5 = 7950 bps */
- OMX_AUDIO_AMRBandModeNB6, /**< AMRNB Mode 6 = 10200 bps */
- OMX_AUDIO_AMRBandModeNB7, /**< AMRNB Mode 7 = 12200 bps */
- OMX_AUDIO_AMRBandModeWB0, /**< AMRWB Mode 0 = 6600 bps */
- OMX_AUDIO_AMRBandModeWB1, /**< AMRWB Mode 1 = 8850 bps */
- OMX_AUDIO_AMRBandModeWB2, /**< AMRWB Mode 2 = 12650 bps */
- OMX_AUDIO_AMRBandModeWB3, /**< AMRWB Mode 3 = 14250 bps */
- OMX_AUDIO_AMRBandModeWB4, /**< AMRWB Mode 4 = 15850 bps */
- OMX_AUDIO_AMRBandModeWB5, /**< AMRWB Mode 5 = 18250 bps */
- OMX_AUDIO_AMRBandModeWB6, /**< AMRWB Mode 6 = 19850 bps */
- OMX_AUDIO_AMRBandModeWB7, /**< AMRWB Mode 7 = 23050 bps */
- OMX_AUDIO_AMRBandModeWB8, /**< AMRWB Mode 8 = 23850 bps */
- OMX_AUDIO_AMRBandModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_AMRBandModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_AMRBandModeMax = 0x7FFFFFFF
-} OMX_AUDIO_AMRBANDMODETYPE;
-
-
-/** AMR Discontinuous Transmission mode */
-typedef enum OMX_AUDIO_AMRDTXMODETYPE {
- OMX_AUDIO_AMRDTXModeOff = 0, /**< AMR Discontinuous Transmission Mode is disabled */
- OMX_AUDIO_AMRDTXModeOnVAD1, /**< AMR Discontinuous Transmission Mode using
- Voice Activity Detector 1 (VAD1) is enabled */
- OMX_AUDIO_AMRDTXModeOnVAD2, /**< AMR Discontinuous Transmission Mode using
- Voice Activity Detector 2 (VAD2) is enabled */
- OMX_AUDIO_AMRDTXModeOnAuto, /**< The codec will automatically select between
- Off, VAD1 or VAD2 modes */
-
- OMX_AUDIO_AMRDTXasEFR, /**< DTX as EFR instead of AMR standard (3GPP 26.101, frame type =8,9,10) */
-
- OMX_AUDIO_AMRDTXModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_AMRDTXModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_AMRDTXModeMax = 0x7FFFFFFF
-} OMX_AUDIO_AMRDTXMODETYPE;
-
-
-/** AMR params */
-typedef struct OMX_AUDIO_PARAM_AMRTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels */
- OMX_U32 nBitRate; /**< Bit rate read only field */
- OMX_AUDIO_AMRBANDMODETYPE eAMRBandMode; /**< AMR Band Mode enumeration */
- OMX_AUDIO_AMRDTXMODETYPE eAMRDTXMode; /**< AMR DTX Mode enumeration */
- OMX_AUDIO_AMRFRAMEFORMATTYPE eAMRFrameFormat; /**< AMR frame format enumeration */
-} OMX_AUDIO_PARAM_AMRTYPE;
-
-
-/** GSM_FR (ETSI 06.10, 3GPP 46.010) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_GSMFRTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_GSMFRTYPE;
-
-
-/** GSM-HR (ETSI 06.20, 3GPP 46.020) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_GSMHRTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_GSMHRTYPE;
-
-
-/** GSM-EFR (ETSI 06.60, 3GPP 46.060) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_GSMEFRTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_GSMEFRTYPE;
-
-
-/** TDMA FR (TIA/EIA-136-420, VSELP 7.95kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_TDMAFRTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_TDMAFRTYPE;
-
-
-/** TDMA EFR (TIA/EIA-136-410, ACELP 7.4kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_TDMAEFRTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_TDMAEFRTYPE;
-
-
-/** PDC FR ( RCR-27, VSELP 6.7kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_PDCFRTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_PDCFRTYPE;
-
-
-/** PDC EFR ( RCR-27, ACELP 6.7kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_PDCEFRTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_PDCEFRTYPE;
-
-/** PDC HR ( RCR-27, PSI-CELP 3.45kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_PDCHRTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_PDCHRTYPE;
-
-
-/** CDMA Rate types */
-typedef enum OMX_AUDIO_CDMARATETYPE {
- OMX_AUDIO_CDMARateBlank = 0, /**< CDMA encoded frame is blank */
- OMX_AUDIO_CDMARateFull, /**< CDMA encoded frame in full rate */
- OMX_AUDIO_CDMARateHalf, /**< CDMA encoded frame in half rate */
- OMX_AUDIO_CDMARateQuarter, /**< CDMA encoded frame in quarter rate */
- OMX_AUDIO_CDMARateEighth, /**< CDMA encoded frame in eighth rate (DTX)*/
- OMX_AUDIO_CDMARateErasure, /**< CDMA erasure frame */
- OMX_AUDIO_CDMARateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_CDMARateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_CDMARateMax = 0x7FFFFFFF
-} OMX_AUDIO_CDMARATETYPE;
-
-
-/** QCELP8 (TIA/EIA-96, up to 8kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_QCELP8TYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable
- rate or unknown bit rates */
- OMX_AUDIO_CDMARATETYPE eCDMARate; /**< Frame rate */
- OMX_U32 nMinBitRate; /**< minmal rate for the encoder = 1,2,3,4, default = 1 */
- OMX_U32 nMaxBitRate; /**< maximal rate for the encoder = 1,2,3,4, default = 4 */
-} OMX_AUDIO_PARAM_QCELP8TYPE;
-
-
-/** QCELP13 ( CDMA, EIA/TIA-733, 13.3kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_QCELP13TYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_AUDIO_CDMARATETYPE eCDMARate; /**< Frame rate */
- OMX_U32 nMinBitRate; /**< minmal rate for the encoder = 1,2,3,4, default = 1 */
- OMX_U32 nMaxBitRate; /**< maximal rate for the encoder = 1,2,3,4, default = 4 */
-} OMX_AUDIO_PARAM_QCELP13TYPE;
-
-
-/** EVRC ( CDMA, EIA/TIA-127, RCELP up to 8.55kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_EVRCTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_AUDIO_CDMARATETYPE eCDMARate; /**< actual Frame rate */
- OMX_BOOL bRATE_REDUCon; /**< RATE_REDUCtion is requested for this frame */
- OMX_U32 nMinBitRate; /**< minmal rate for the encoder = 1,2,3,4, default = 1 */
- OMX_U32 nMaxBitRate; /**< maximal rate for the encoder = 1,2,3,4, default = 4 */
- OMX_BOOL bHiPassFilter; /**< Enable encoder's High Pass Filter */
- OMX_BOOL bNoiseSuppressor; /**< Enable encoder's noise suppressor pre-processing */
- OMX_BOOL bPostFilter; /**< Enable decoder's post Filter */
-} OMX_AUDIO_PARAM_EVRCTYPE;
-
-
-/** SMV ( up to 8.55kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_SMVTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_AUDIO_CDMARATETYPE eCDMARate; /**< Frame rate */
- OMX_BOOL bRATE_REDUCon; /**< RATE_REDUCtion is requested for this frame */
- OMX_U32 nMinBitRate; /**< minmal rate for the encoder = 1,2,3,4, default = 1 ??*/
- OMX_U32 nMaxBitRate; /**< maximal rate for the encoder = 1,2,3,4, default = 4 ??*/
- OMX_BOOL bHiPassFilter; /**< Enable encoder's High Pass Filter ??*/
- OMX_BOOL bNoiseSuppressor; /**< Enable encoder's noise suppressor pre-processing */
- OMX_BOOL bPostFilter; /**< Enable decoder's post Filter ??*/
-} OMX_AUDIO_PARAM_SMVTYPE;
-
-
-/** MIDI Format
- * @ingroup midi
- */
-typedef enum OMX_AUDIO_MIDIFORMATTYPE
-{
- OMX_AUDIO_MIDIFormatUnknown = 0, /**< MIDI Format unknown or don't care */
- OMX_AUDIO_MIDIFormatSMF0, /**< Standard MIDI File Type 0 */
- OMX_AUDIO_MIDIFormatSMF1, /**< Standard MIDI File Type 1 */
- OMX_AUDIO_MIDIFormatSMF2, /**< Standard MIDI File Type 2 */
- OMX_AUDIO_MIDIFormatSPMIDI, /**< SP-MIDI */
- OMX_AUDIO_MIDIFormatXMF0, /**< eXtensible Music Format type 0 */
- OMX_AUDIO_MIDIFormatXMF1, /**< eXtensible Music Format type 1 */
- OMX_AUDIO_MIDIFormatMobileXMF, /**< Mobile XMF (eXtensible Music Format type 2) */
- OMX_AUDIO_MIDIFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_MIDIFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_MIDIFormatMax = 0x7FFFFFFF
-} OMX_AUDIO_MIDIFORMATTYPE;
-
-
-/** MIDI params
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_PARAM_MIDITYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nFileSize; /**< size of the MIDI file in bytes, where the entire
- MIDI file passed in, otherwise if 0x0, the MIDI data
- is merged and streamed (instead of passed as an
- entire MIDI file) */
- OMX_BU32 sMaxPolyphony; /**< Specifies the maximum simultaneous polyphonic
- voices. A value of zero indicates that the default
- polyphony of the device is used */
- OMX_BOOL bLoadDefaultSound; /**< Whether to load default sound
- bank at initialization */
- OMX_AUDIO_MIDIFORMATTYPE eMidiFormat; /**< Version of the MIDI file */
-} OMX_AUDIO_PARAM_MIDITYPE;
-
-
-/** Type of the MIDI sound bank
- * @ingroup midi
- */
-typedef enum OMX_AUDIO_MIDISOUNDBANKTYPE {
- OMX_AUDIO_MIDISoundBankUnused = 0, /**< unused/unknown soundbank type */
- OMX_AUDIO_MIDISoundBankDLS1, /**< DLS version 1 */
- OMX_AUDIO_MIDISoundBankDLS2, /**< DLS version 2 */
- OMX_AUDIO_MIDISoundBankMobileDLSBase, /**< Mobile DLS, using the base functionality */
- OMX_AUDIO_MIDISoundBankMobileDLSPlusOptions, /**< Mobile DLS, using the specification-defined optional feature set */
- OMX_AUDIO_MIDISoundBankKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_MIDISoundBankVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_MIDISoundBankMax = 0x7FFFFFFF
-} OMX_AUDIO_MIDISOUNDBANKTYPE;
-
-
-/** Bank Layout describes how bank MSB & LSB are used in the DLS instrument definitions sound bank
- * @ingroup midi
- */
-typedef enum OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE {
- OMX_AUDIO_MIDISoundBankLayoutUnused = 0, /**< unused/unknown soundbank type */
- OMX_AUDIO_MIDISoundBankLayoutGM, /**< GS layout (based on bank MSB 0x00) */
- OMX_AUDIO_MIDISoundBankLayoutGM2, /**< General MIDI 2 layout (using MSB 0x78/0x79, LSB 0x00) */
- OMX_AUDIO_MIDISoundBankLayoutUser, /**< Does not conform to any bank numbering standards */
- OMX_AUDIO_MIDISoundBankLayoutKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_MIDISoundBankLayoutVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_MIDISoundBankLayoutMax = 0x7FFFFFFF
-} OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE;
-
-
-/** MIDI params to load/unload user soundbank
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nDLSIndex; /**< DLS file index to be loaded */
- OMX_U32 nDLSSize; /**< Size in bytes */
- OMX_PTR pDLSData; /**< Pointer to DLS file data */
- OMX_AUDIO_MIDISOUNDBANKTYPE eMidiSoundBank; /**< Midi sound bank type enumeration */
- OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE eMidiSoundBankLayout; /**< Midi sound bank layout enumeration */
-} OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE;
-
-
-/** Structure for Live MIDI events and MIP messages.
- * (MIP = Maximum Instantaneous Polyphony; part of the SP-MIDI standard.)
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port that this structure applies to */
- OMX_U32 nMidiEventSize; /**< Size of immediate MIDI events or MIP message in bytes */
- OMX_U8 nMidiEvents[1]; /**< MIDI event array to be rendered immediately, or an
- array for the MIP message buffer, where the size is
- indicated by nMidiEventSize */
-} OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE;
-
-
-/** MIDI sound bank/ program pair in a given channel
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port that this structure applies to */
- OMX_U32 nChannel; /**< Valid channel values range from 1 to 16 */
- OMX_U16 nIDProgram; /**< Valid program ID range is 1 to 128 */
- OMX_U16 nIDSoundBank; /**< Sound bank ID */
- OMX_U32 nUserSoundBankIndex;/**< User soundbank index, easier to access soundbanks
- by index if multiple banks are present */
-} OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE;
-
-
-/** MIDI control
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_CONFIG_MIDICONTROLTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BS32 sPitchTransposition; /**< Pitch transposition in semitones, stored as Q22.10
- format based on JAVA MMAPI (JSR-135) requirement */
- OMX_BU32 sPlayBackRate; /**< Relative playback rate, stored as Q14.17 fixed-point
- number based on JSR-135 requirement */
- OMX_BU32 sTempo ; /**< Tempo in beats per minute (BPM), stored as Q22.10
- fixed-point number based on JSR-135 requirement */
- OMX_U32 nMaxPolyphony; /**< Specifies the maximum simultaneous polyphonic
- voices. A value of zero indicates that the default
- polyphony of the device is used */
- OMX_U32 nNumRepeat; /**< Number of times to repeat playback */
- OMX_U32 nStopTime; /**< Time in milliseconds to indicate when playback
- will stop automatically. Set to zero if not used */
- OMX_U16 nChannelMuteMask; /**< 16 bit mask for channel mute status */
- OMX_U16 nChannelSoloMask; /**< 16 bit mask for channel solo status */
- OMX_U32 nTrack0031MuteMask; /**< 32 bit mask for track mute status. Note: This is for tracks 0-31 */
- OMX_U32 nTrack3263MuteMask; /**< 32 bit mask for track mute status. Note: This is for tracks 32-63 */
- OMX_U32 nTrack0031SoloMask; /**< 32 bit mask for track solo status. Note: This is for tracks 0-31 */
- OMX_U32 nTrack3263SoloMask; /**< 32 bit mask for track solo status. Note: This is for tracks 32-63 */
-
-} OMX_AUDIO_CONFIG_MIDICONTROLTYPE;
-
-
-/** MIDI Playback States
- * @ingroup midi
- */
-typedef enum OMX_AUDIO_MIDIPLAYBACKSTATETYPE {
- OMX_AUDIO_MIDIPlayBackStateUnknown = 0, /**< Unknown state or state does not map to
- other defined states */
- OMX_AUDIO_MIDIPlayBackStateClosedEngaged, /**< No MIDI resource is currently open.
- The MIDI engine is currently processing
- MIDI events. */
- OMX_AUDIO_MIDIPlayBackStateParsing, /**< A MIDI resource is open and is being
- primed. The MIDI engine is currently
- processing MIDI events. */
- OMX_AUDIO_MIDIPlayBackStateOpenEngaged, /**< A MIDI resource is open and primed but
- not playing. The MIDI engine is currently
- processing MIDI events. The transition to
- this state is only possible from the
- OMX_AUDIO_MIDIPlayBackStatePlaying state,
- when the 'playback head' reaches the end
- of media data or the playback stops due
- to stop time set.*/
- OMX_AUDIO_MIDIPlayBackStatePlaying, /**< A MIDI resource is open and currently
- playing. The MIDI engine is currently
- processing MIDI events.*/
- OMX_AUDIO_MIDIPlayBackStatePlayingPartially, /**< Best-effort playback due to SP-MIDI/DLS
- resource constraints */
- OMX_AUDIO_MIDIPlayBackStatePlayingSilently, /**< Due to system resource constraints and
- SP-MIDI content constraints, there is
- no audible MIDI content during playback
- currently. The situation may change if
- resources are freed later.*/
- OMX_AUDIO_MIDIPlayBackStateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_MIDIPlayBackStateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_MIDIPlayBackStateMax = 0x7FFFFFFF
-} OMX_AUDIO_MIDIPLAYBACKSTATETYPE;
-
-
-/** MIDI status
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_CONFIG_MIDISTATUSTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U16 nNumTracks; /**< Number of MIDI tracks in the file, read only field.
- NOTE: May not return a meaningful value until the entire
- file is parsed and buffered. */
- OMX_U32 nDuration; /**< The length of the currently open MIDI resource
- in milliseconds. NOTE: May not return a meaningful value
- until the entire file is parsed and buffered. */
- OMX_U32 nPosition; /**< Current Position of the MIDI resource being played
- in milliseconds */
- OMX_BOOL bVibra; /**< Does Vibra track exist? NOTE: May not return a meaningful
- value until the entire file is parsed and buffered. */
- OMX_U32 nNumMetaEvents; /**< Total number of MIDI Meta Events in the currently
- open MIDI resource. NOTE: May not return a meaningful value
- until the entire file is parsed and buffered. */
- OMX_U32 nNumActiveVoices; /**< Number of active voices in the currently playing
- MIDI resource. NOTE: May not return a meaningful value until
- the entire file is parsed and buffered. */
- OMX_AUDIO_MIDIPLAYBACKSTATETYPE eMIDIPlayBackState; /**< MIDI playback state enumeration, read only field */
-} OMX_AUDIO_CONFIG_MIDISTATUSTYPE;
-
-
-/** MIDI Meta Event structure one per Meta Event.
- * MIDI Meta Events are like audio metadata, except that they are interspersed
- * with the MIDI content throughout the file and are not localized in the header.
- * As such, it is necessary to retrieve information about these Meta Events from
- * the engine, as it encounters these Meta Events within the MIDI content.
- * For example, SMF files can have up to 14 types of MIDI Meta Events (copyright,
- * author, default tempo, etc.) scattered throughout the file.
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE{
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nIndex; /**< Index of Meta Event */
- OMX_U8 nMetaEventType; /**< Meta Event Type, 7bits (i.e. 0 - 127) */
- OMX_U32 nMetaEventSize; /**< size of the Meta Event in bytes */
- OMX_U32 nTrack; /**< track number for the meta event */
- OMX_U32 nPosition; /**< Position of the meta-event in milliseconds */
-} OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE;
-
-
-/** MIDI Meta Event Data structure - one per Meta Event.
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_CONFIG_MIDIMETAEVENTDATATYPE{
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nIndex; /**< Index of Meta Event */
- OMX_U32 nMetaEventSize; /**< size of the Meta Event in bytes */
- OMX_U8 nData[1]; /**< array of one or more bytes of meta data
- as indicated by the nMetaEventSize field */
-} OMX_AUDIO_CONFIG__MIDIMETAEVENTDATATYPE;
-
-
-/** Audio Volume adjustment for a port */
-typedef struct OMX_AUDIO_CONFIG_VOLUMETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port index indicating which port to
- set. Select the input port to set
- just that port's volume. Select the
- output port to adjust the master
- volume. */
- OMX_BOOL bLinear; /**< Is the volume to be set in linear (0.100)
- or logarithmic scale (mB) */
- OMX_BS32 sVolume; /**< Volume linear setting in the 0..100 range, OR
- Volume logarithmic setting for this port. The values
- for volume are in mB (millibels = 1/100 dB) relative
- to a gain of 1 (e.g. the output is the same as the
- input level). Values are in mB from nMax
- (maximum volume) to nMin mB (typically negative).
- Since the volume is "voltage"
- and not a "power", it takes a setting of
- -600 mB to decrease the volume by 1/2. If
- a component cannot accurately set the
- volume to the requested value, it must
- set the volume to the closest value BELOW
- the requested value. When getting the
- volume setting, the current actual volume
- must be returned. */
-} OMX_AUDIO_CONFIG_VOLUMETYPE;
-
-
-/** Audio Volume adjustment for a channel */
-typedef struct OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port index indicating which port to
- set. Select the input port to set
- just that port's volume. Select the
- output port to adjust the master
- volume. */
- OMX_U32 nChannel; /**< channel to select from 0 to N-1,
- using OMX_ALL to apply volume settings
- to all channels */
- OMX_BOOL bLinear; /**< Is the volume to be set in linear (0.100) or
- logarithmic scale (mB) */
- OMX_BS32 sVolume; /**< Volume linear setting in the 0..100 range, OR
- Volume logarithmic setting for this port.
- The values for volume are in mB
- (millibels = 1/100 dB) relative to a gain
- of 1 (e.g. the output is the same as the
- input level). Values are in mB from nMax
- (maximum volume) to nMin mB (typically negative).
- Since the volume is "voltage"
- and not a "power", it takes a setting of
- -600 mB to decrease the volume by 1/2. If
- a component cannot accurately set the
- volume to the requested value, it must
- set the volume to the closest value BELOW
- the requested value. When getting the
- volume setting, the current actual volume
- must be returned. */
- OMX_BOOL bIsMIDI; /**< TRUE if nChannel refers to a MIDI channel,
- FALSE otherwise */
-} OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE;
-
-
-/** Audio balance setting */
-typedef struct OMX_AUDIO_CONFIG_BALANCETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port index indicating which port to
- set. Select the input port to set
- just that port's balance. Select the
- output port to adjust the master
- balance. */
- OMX_S32 nBalance; /**< balance setting for this port
- (-100 to 100, where -100 indicates
- all left, and no right */
-} OMX_AUDIO_CONFIG_BALANCETYPE;
-
-
-/** Audio Port mute */
-typedef struct OMX_AUDIO_CONFIG_MUTETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port index indicating which port to
- set. Select the input port to set
- just that port's mute. Select the
- output port to adjust the master
- mute. */
- OMX_BOOL bMute; /**< Mute setting for this port */
-} OMX_AUDIO_CONFIG_MUTETYPE;
-
-
-/** Audio Channel mute */
-typedef struct OMX_AUDIO_CONFIG_CHANNELMUTETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannel; /**< channel to select from 0 to N-1,
- using OMX_ALL to apply mute settings
- to all channels */
- OMX_BOOL bMute; /**< Mute setting for this channel */
- OMX_BOOL bIsMIDI; /**< TRUE if nChannel refers to a MIDI channel,
- FALSE otherwise */
-} OMX_AUDIO_CONFIG_CHANNELMUTETYPE;
-
-
-
-/** Enable / Disable for loudness control, which boosts bass and to a
- * smaller extent high end frequencies to compensate for hearing
- * ability at the extreme ends of the audio spectrum
- */
-typedef struct OMX_AUDIO_CONFIG_LOUDNESSTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bLoudness; /**< Enable/disable for loudness */
-} OMX_AUDIO_CONFIG_LOUDNESSTYPE;
-
-
-/** Enable / Disable for bass, which controls low frequencies
- */
-typedef struct OMX_AUDIO_CONFIG_BASSTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bEnable; /**< Enable/disable for bass control */
- OMX_S32 nBass; /**< bass setting for the port, as a
- continuous value from -100 to 100
- (0 means no change in bass level)*/
-} OMX_AUDIO_CONFIG_BASSTYPE;
-
-
-/** Enable / Disable for treble, which controls high frequencies tones
- */
-typedef struct OMX_AUDIO_CONFIG_TREBLETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bEnable; /**< Enable/disable for treble control */
- OMX_S32 nTreble; /**< treble setting for the port, as a
- continuous value from -100 to 100
- (0 means no change in treble level) */
-} OMX_AUDIO_CONFIG_TREBLETYPE;
-
-
-/** An equalizer is typically used for two reasons: to compensate for an
- * sub-optimal frequency response of a system to make it sound more natural
- * or to create intentionally some unnatural coloring to the sound to create
- * an effect.
- * @ingroup effects
- */
-typedef struct OMX_AUDIO_CONFIG_EQUALIZERTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bEnable; /**< Enable/disable for equalizer */
- OMX_BU32 sBandIndex; /**< Band number to be set. Upper Limit is
- N-1, where N is the number of bands, lower limit is 0 */
- OMX_BU32 sCenterFreq; /**< Center frequecies in Hz. This is a
- read only element and is used to determine
- the lower, center and upper frequency of
- this band. */
- OMX_BS32 sBandLevel; /**< band level in millibels */
-} OMX_AUDIO_CONFIG_EQUALIZERTYPE;
-
-
-/** Stereo widening mode type
- * @ingroup effects
- */
-typedef enum OMX_AUDIO_STEREOWIDENINGTYPE {
- OMX_AUDIO_StereoWideningHeadphones, /**< Stereo widening for loudspeakers */
- OMX_AUDIO_StereoWideningLoudspeakers, /**< Stereo widening for closely spaced loudspeakers */
- OMX_AUDIO_StereoWideningKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_StereoWideningVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_StereoWideningMax = 0x7FFFFFFF
-} OMX_AUDIO_STEREOWIDENINGTYPE;
-
-
-/** Control for stereo widening, which is a special 2-channel
- * case of the audio virtualizer effect. For example, for 5.1-channel
- * output, it translates to virtual surround sound.
- * @ingroup effects
- */
-typedef struct OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bEnable; /**< Enable/disable for stereo widening control */
- OMX_AUDIO_STEREOWIDENINGTYPE eWideningType; /**< Stereo widening algorithm type */
- OMX_U32 nStereoWidening; /**< stereo widening setting for the port,
- as a continuous value from 0 to 100 */
-} OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE;
-
-
-/** The chorus effect (or ``choralizer'') is any signal processor which makes
- * one sound source (such as a voice) sound like many such sources singing
- * (or playing) in unison. Since performance in unison is never exact, chorus
- * effects simulate this by making independently modified copies of the input
- * signal. Modifications may include (1) delay, (2) frequency shift, and
- * (3) amplitude modulation.
- * @ingroup effects
- */
-typedef struct OMX_AUDIO_CONFIG_CHORUSTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bEnable; /**< Enable/disable for chorus */
- OMX_BU32 sDelay; /**< average delay in milliseconds */
- OMX_BU32 sModulationRate; /**< rate of modulation in millihertz */
- OMX_U32 nModulationDepth; /**< depth of modulation as a percentage of
- delay (i.e. 0 to 100) */
- OMX_BU32 nFeedback; /**< Feedback from chorus output to input in percentage */
-} OMX_AUDIO_CONFIG_CHORUSTYPE;
-
-
-/** Reverberation is part of the reflected sound that follows the early
- * reflections. In a typical room, this consists of a dense succession of
- * echoes whose energy decays exponentially. The reverberation effect structure
- * as defined here includes both (early) reflections as well as (late) reverberations.
- * @ingroup effects
- */
-typedef struct OMX_AUDIO_CONFIG_REVERBERATIONTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bEnable; /**< Enable/disable for reverberation control */
- OMX_BS32 sRoomLevel; /**< Intensity level for the whole room effect
- (i.e. both early reflections and late
- reverberation) in millibels */
- OMX_BS32 sRoomHighFreqLevel; /**< Attenuation at high frequencies
- relative to the intensity at low
- frequencies in millibels */
- OMX_BS32 sReflectionsLevel; /**< Intensity level of early reflections
- (relative to room value), in millibels */
- OMX_BU32 sReflectionsDelay; /**< Delay time of the first reflection relative
- to the direct path, in milliseconds */
- OMX_BS32 sReverbLevel; /**< Intensity level of late reverberation
- relative to room level, in millibels */
- OMX_BU32 sReverbDelay; /**< Time delay from the first early reflection
- to the beginning of the late reverberation
- section, in milliseconds */
- OMX_BU32 sDecayTime; /**< Late reverberation decay time at low
- frequencies, in milliseconds */
- OMX_BU32 nDecayHighFreqRatio; /**< Ratio of high frequency decay time relative
- to low frequency decay time in percent */
- OMX_U32 nDensity; /**< Modal density in the late reverberation decay,
- in percent (i.e. 0 - 100) */
- OMX_U32 nDiffusion; /**< Echo density in the late reverberation decay,
- in percent (i.e. 0 - 100) */
- OMX_BU32 sReferenceHighFreq; /**< Reference high frequency in Hertz. This is
- the frequency used as the reference for all
- the high-frequency settings above */
-
-} OMX_AUDIO_CONFIG_REVERBERATIONTYPE;
-
-
-/** Possible settings for the Echo Cancelation structure to use
- * @ingroup effects
- */
-typedef enum OMX_AUDIO_ECHOCANTYPE {
- OMX_AUDIO_EchoCanOff = 0, /**< Echo Cancellation is disabled */
- OMX_AUDIO_EchoCanNormal, /**< Echo Cancellation normal operation -
- echo from plastics and face */
- OMX_AUDIO_EchoCanHFree, /**< Echo Cancellation optimized for
- Hands Free operation */
- OMX_AUDIO_EchoCanCarKit, /**< Echo Cancellation optimized for
- Car Kit (longer echo) */
- OMX_AUDIO_EchoCanKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_EchoCanVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_EchoCanMax = 0x7FFFFFFF
-} OMX_AUDIO_ECHOCANTYPE;
-
-
-/** Enable / Disable for echo cancelation, which removes undesired echo's
- * from the audio
- * @ingroup effects
- */
-typedef struct OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_AUDIO_ECHOCANTYPE eEchoCancelation; /**< Echo cancelation settings */
-} OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE;
-
-
-/** Enable / Disable for noise reduction, which undesired noise from
- * the audio
- * @ingroup effects
- */
-typedef struct OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bNoiseReduction; /**< Enable/disable for noise reduction */
-} OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE;
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
-
diff --git a/include/media/stagefright/openmax/OMX_Component.h b/include/media/stagefright/openmax/OMX_Component.h
deleted file mode 100644
index b5b784ea..0000000
--- a/include/media/stagefright/openmax/OMX_Component.h
+++ /dev/null
@@ -1,596 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/*
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is 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 Software.
- *
- * THE SOFTWARE IS 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
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/** OMX_Component.h - OpenMax IL version 1.1.2
- * The OMX_Component header file contains the definitions used to define
- * the public interface of a component. This header file is intended to
- * be used by both the application and the component.
- */
-
-#ifndef OMX_Component_h
-#define OMX_Component_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-
-/* Each OMX header must include all required header files to allow the
- * header to compile without errors. The includes below are required
- * for this header file to compile successfully
- */
-
-#include <OMX_Audio.h>
-#include <OMX_Video.h>
-#include <OMX_Image.h>
-#include <OMX_Other.h>
-
-/** @ingroup comp */
-typedef enum OMX_PORTDOMAINTYPE {
- OMX_PortDomainAudio,
- OMX_PortDomainVideo,
- OMX_PortDomainImage,
- OMX_PortDomainOther,
- OMX_PortDomainKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_PortDomainVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_PortDomainMax = 0x7ffffff
-} OMX_PORTDOMAINTYPE;
-
-/** @ingroup comp */
-typedef struct OMX_PARAM_PORTDEFINITIONTYPE {
- OMX_U32 nSize; /**< Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port number the structure applies to */
- OMX_DIRTYPE eDir; /**< Direction (input or output) of this port */
- OMX_U32 nBufferCountActual; /**< The actual number of buffers allocated on this port */
- OMX_U32 nBufferCountMin; /**< The minimum number of buffers this port requires */
- OMX_U32 nBufferSize; /**< Size, in bytes, for buffers to be used for this channel */
- OMX_BOOL bEnabled; /**< Ports default to enabled and are enabled/disabled by
- OMX_CommandPortEnable/OMX_CommandPortDisable.
- When disabled a port is unpopulated. A disabled port
- is not populated with buffers on a transition to IDLE. */
- OMX_BOOL bPopulated; /**< Port is populated with all of its buffers as indicated by
- nBufferCountActual. A disabled port is always unpopulated.
- An enabled port is populated on a transition to OMX_StateIdle
- and unpopulated on a transition to loaded. */
- OMX_PORTDOMAINTYPE eDomain; /**< Domain of the port. Determines the contents of metadata below. */
- union {
- OMX_AUDIO_PORTDEFINITIONTYPE audio;
- OMX_VIDEO_PORTDEFINITIONTYPE video;
- OMX_IMAGE_PORTDEFINITIONTYPE image;
- OMX_OTHER_PORTDEFINITIONTYPE other;
- } format;
- OMX_BOOL bBuffersContiguous;
- OMX_U32 nBufferAlignment;
-} OMX_PARAM_PORTDEFINITIONTYPE;
-
-/** @ingroup comp */
-typedef struct OMX_PARAM_U32TYPE {
- OMX_U32 nSize; /**< Size of this structure, in Bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nU32; /**< U32 value */
-} OMX_PARAM_U32TYPE;
-
-/** @ingroup rpm */
-typedef enum OMX_SUSPENSIONPOLICYTYPE {
- OMX_SuspensionDisabled, /**< No suspension; v1.0 behavior */
- OMX_SuspensionEnabled, /**< Suspension allowed */
- OMX_SuspensionPolicyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_SuspensionPolicyStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_SuspensionPolicyMax = 0x7fffffff
-} OMX_SUSPENSIONPOLICYTYPE;
-
-/** @ingroup rpm */
-typedef struct OMX_PARAM_SUSPENSIONPOLICYTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_SUSPENSIONPOLICYTYPE ePolicy;
-} OMX_PARAM_SUSPENSIONPOLICYTYPE;
-
-/** @ingroup rpm */
-typedef enum OMX_SUSPENSIONTYPE {
- OMX_NotSuspended, /**< component is not suspended */
- OMX_Suspended, /**< component is suspended */
- OMX_SuspensionKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_SuspensionVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_SuspendMax = 0x7FFFFFFF
-} OMX_SUSPENSIONTYPE;
-
-/** @ingroup rpm */
-typedef struct OMX_PARAM_SUSPENSIONTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_SUSPENSIONTYPE eType;
-} OMX_PARAM_SUSPENSIONTYPE ;
-
-typedef struct OMX_CONFIG_BOOLEANTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_BOOL bEnabled;
-} OMX_CONFIG_BOOLEANTYPE;
-
-/* Parameter specifying the content uri to use. */
-/** @ingroup cp */
-typedef struct OMX_PARAM_CONTENTURITYPE
-{
- OMX_U32 nSize; /**< size of the structure in bytes, including
- actual URI name */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U8 contentURI[1]; /**< The URI name */
-} OMX_PARAM_CONTENTURITYPE;
-
-/* Parameter specifying the pipe to use. */
-/** @ingroup cp */
-typedef struct OMX_PARAM_CONTENTPIPETYPE
-{
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_HANDLETYPE hPipe; /**< The pipe handle*/
-} OMX_PARAM_CONTENTPIPETYPE;
-
-/** @ingroup rpm */
-typedef struct OMX_RESOURCECONCEALMENTTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_BOOL bResourceConcealmentForbidden; /**< disallow the use of resource concealment
- methods (like degrading algorithm quality to
- lower resource consumption or functional bypass)
- on a component as a resolution to resource conflicts. */
-} OMX_RESOURCECONCEALMENTTYPE;
-
-
-/** @ingroup metadata */
-typedef enum OMX_METADATACHARSETTYPE {
- OMX_MetadataCharsetUnknown = 0,
- OMX_MetadataCharsetASCII,
- OMX_MetadataCharsetBinary,
- OMX_MetadataCharsetCodePage1252,
- OMX_MetadataCharsetUTF8,
- OMX_MetadataCharsetJavaConformantUTF8,
- OMX_MetadataCharsetUTF7,
- OMX_MetadataCharsetImapUTF7,
- OMX_MetadataCharsetUTF16LE,
- OMX_MetadataCharsetUTF16BE,
- OMX_MetadataCharsetGB12345,
- OMX_MetadataCharsetHZGB2312,
- OMX_MetadataCharsetGB2312,
- OMX_MetadataCharsetGB18030,
- OMX_MetadataCharsetGBK,
- OMX_MetadataCharsetBig5,
- OMX_MetadataCharsetISO88591,
- OMX_MetadataCharsetISO88592,
- OMX_MetadataCharsetISO88593,
- OMX_MetadataCharsetISO88594,
- OMX_MetadataCharsetISO88595,
- OMX_MetadataCharsetISO88596,
- OMX_MetadataCharsetISO88597,
- OMX_MetadataCharsetISO88598,
- OMX_MetadataCharsetISO88599,
- OMX_MetadataCharsetISO885910,
- OMX_MetadataCharsetISO885913,
- OMX_MetadataCharsetISO885914,
- OMX_MetadataCharsetISO885915,
- OMX_MetadataCharsetShiftJIS,
- OMX_MetadataCharsetISO2022JP,
- OMX_MetadataCharsetISO2022JP1,
- OMX_MetadataCharsetISOEUCJP,
- OMX_MetadataCharsetSMS7Bit,
- OMX_MetadataCharsetKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_MetadataCharsetVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_MetadataCharsetTypeMax= 0x7FFFFFFF
-} OMX_METADATACHARSETTYPE;
-
-/** @ingroup metadata */
-typedef enum OMX_METADATASCOPETYPE
-{
- OMX_MetadataScopeAllLevels,
- OMX_MetadataScopeTopLevel,
- OMX_MetadataScopePortLevel,
- OMX_MetadataScopeNodeLevel,
- OMX_MetadataScopeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_MetadataScopeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_MetadataScopeTypeMax = 0x7fffffff
-} OMX_METADATASCOPETYPE;
-
-/** @ingroup metadata */
-typedef enum OMX_METADATASEARCHMODETYPE
-{
- OMX_MetadataSearchValueSizeByIndex,
- OMX_MetadataSearchItemByIndex,
- OMX_MetadataSearchNextItemByKey,
- OMX_MetadataSearchKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_MetadataSearchVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_MetadataSearchTypeMax = 0x7fffffff
-} OMX_METADATASEARCHMODETYPE;
-/** @ingroup metadata */
-typedef struct OMX_CONFIG_METADATAITEMCOUNTTYPE
-{
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_METADATASCOPETYPE eScopeMode;
- OMX_U32 nScopeSpecifier;
- OMX_U32 nMetadataItemCount;
-} OMX_CONFIG_METADATAITEMCOUNTTYPE;
-
-/** @ingroup metadata */
-typedef struct OMX_CONFIG_METADATAITEMTYPE
-{
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_METADATASCOPETYPE eScopeMode;
- OMX_U32 nScopeSpecifier;
- OMX_U32 nMetadataItemIndex;
- OMX_METADATASEARCHMODETYPE eSearchMode;
- OMX_METADATACHARSETTYPE eKeyCharset;
- OMX_U8 nKeySizeUsed;
- OMX_U8 nKey[128];
- OMX_METADATACHARSETTYPE eValueCharset;
- OMX_STRING sLanguageCountry;
- OMX_U32 nValueMaxSize;
- OMX_U32 nValueSizeUsed;
- OMX_U8 nValue[1];
-} OMX_CONFIG_METADATAITEMTYPE;
-
-/* @ingroup metadata */
-typedef struct OMX_CONFIG_CONTAINERNODECOUNTTYPE
-{
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_BOOL bAllKeys;
- OMX_U32 nParentNodeID;
- OMX_U32 nNumNodes;
-} OMX_CONFIG_CONTAINERNODECOUNTTYPE;
-
-/** @ingroup metadata */
-typedef struct OMX_CONFIG_CONTAINERNODEIDTYPE
-{
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_BOOL bAllKeys;
- OMX_U32 nParentNodeID;
- OMX_U32 nNodeIndex;
- OMX_U32 nNodeID;
- OMX_STRING cNodeName;
- OMX_BOOL bIsLeafType;
-} OMX_CONFIG_CONTAINERNODEIDTYPE;
-
-/** @ingroup metadata */
-typedef struct OMX_PARAM_METADATAFILTERTYPE
-{
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_BOOL bAllKeys; /* if true then this structure refers to all keys and
- * the three key fields below are ignored */
- OMX_METADATACHARSETTYPE eKeyCharset;
- OMX_U32 nKeySizeUsed;
- OMX_U8 nKey [128];
- OMX_U32 nLanguageCountrySizeUsed;
- OMX_U8 nLanguageCountry[128];
- OMX_BOOL bEnabled; /* if true then key is part of filter (e.g.
- * retained for query later). If false then
- * key is not part of filter */
-} OMX_PARAM_METADATAFILTERTYPE;
-
-/** The OMX_HANDLETYPE structure defines the component handle. The component
- * handle is used to access all of the component's public methods and also
- * contains pointers to the component's private data area. The component
- * handle is initialized by the OMX core (with help from the component)
- * during the process of loading the component. After the component is
- * successfully loaded, the application can safely access any of the
- * component's public functions (although some may return an error because
- * the state is inappropriate for the access).
- *
- * @ingroup comp
- */
-typedef struct OMX_COMPONENTTYPE
-{
- /** The size of this structure, in bytes. It is the responsibility
- of the allocator of this structure to fill in this value. Since
- this structure is allocated by the GetHandle function, this
- function will fill in this value. */
- OMX_U32 nSize;
-
- /** nVersion is the version of the OMX specification that the structure
- is built against. It is the responsibility of the creator of this
- structure to initialize this value and every user of this structure
- should verify that it knows how to use the exact version of
- this structure found herein. */
- OMX_VERSIONTYPE nVersion;
-
- /** pComponentPrivate is a pointer to the component private data area.
- This member is allocated and initialized by the component when the
- component is first loaded. The application should not access this
- data area. */
- OMX_PTR pComponentPrivate;
-
- /** pApplicationPrivate is a pointer that is a parameter to the
- OMX_GetHandle method, and contains an application private value
- provided by the IL client. This application private data is
- returned to the IL Client by OMX in all callbacks */
- OMX_PTR pApplicationPrivate;
-
- /** refer to OMX_GetComponentVersion in OMX_core.h or the OMX IL
- specification for details on the GetComponentVersion method.
- */
- OMX_ERRORTYPE (*GetComponentVersion)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_OUT OMX_STRING pComponentName,
- OMX_OUT OMX_VERSIONTYPE* pComponentVersion,
- OMX_OUT OMX_VERSIONTYPE* pSpecVersion,
- OMX_OUT OMX_UUIDTYPE* pComponentUUID);
-
- /** refer to OMX_SendCommand in OMX_core.h or the OMX IL
- specification for details on the SendCommand method.
- */
- OMX_ERRORTYPE (*SendCommand)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_COMMANDTYPE Cmd,
- OMX_IN OMX_U32 nParam1,
- OMX_IN OMX_PTR pCmdData);
-
- /** refer to OMX_GetParameter in OMX_core.h or the OMX IL
- specification for details on the GetParameter method.
- */
- OMX_ERRORTYPE (*GetParameter)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_INDEXTYPE nParamIndex,
- OMX_INOUT OMX_PTR pComponentParameterStructure);
-
-
- /** refer to OMX_SetParameter in OMX_core.h or the OMX IL
- specification for details on the SetParameter method.
- */
- OMX_ERRORTYPE (*SetParameter)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_INDEXTYPE nIndex,
- OMX_IN OMX_PTR pComponentParameterStructure);
-
-
- /** refer to OMX_GetConfig in OMX_core.h or the OMX IL
- specification for details on the GetConfig method.
- */
- OMX_ERRORTYPE (*GetConfig)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_INDEXTYPE nIndex,
- OMX_INOUT OMX_PTR pComponentConfigStructure);
-
-
- /** refer to OMX_SetConfig in OMX_core.h or the OMX IL
- specification for details on the SetConfig method.
- */
- OMX_ERRORTYPE (*SetConfig)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_INDEXTYPE nIndex,
- OMX_IN OMX_PTR pComponentConfigStructure);
-
-
- /** refer to OMX_GetExtensionIndex in OMX_core.h or the OMX IL
- specification for details on the GetExtensionIndex method.
- */
- OMX_ERRORTYPE (*GetExtensionIndex)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_STRING cParameterName,
- OMX_OUT OMX_INDEXTYPE* pIndexType);
-
-
- /** refer to OMX_GetState in OMX_core.h or the OMX IL
- specification for details on the GetState method.
- */
- OMX_ERRORTYPE (*GetState)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_OUT OMX_STATETYPE* pState);
-
-
- /** The ComponentTunnelRequest method will interact with another OMX
- component to determine if tunneling is possible and to setup the
- tunneling. The return codes for this method can be used to
- determine if tunneling is not possible, or if tunneling is not
- supported.
-
- Base profile components (i.e. non-interop) do not support this
- method and should return OMX_ErrorNotImplemented
-
- The interop profile component MUST support tunneling to another
- interop profile component with a compatible port parameters.
- A component may also support proprietary communication.
-
- If proprietary communication is supported the negotiation of
- proprietary communication is done outside of OMX in a vendor
- specific way. It is only required that the proper result be
- returned and the details of how the setup is done is left
- to the component implementation.
-
- When this method is invoked when nPort in an output port, the
- component will:
- 1. Populate the pTunnelSetup structure with the output port's
- requirements and constraints for the tunnel.
-
- When this method is invoked when nPort in an input port, the
- component will:
- 1. Query the necessary parameters from the output port to
- determine if the ports are compatible for tunneling
- 2. If the ports are compatible, the component should store
- the tunnel step provided by the output port
- 3. Determine which port (either input or output) is the buffer
- supplier, and call OMX_SetParameter on the output port to
- indicate this selection.
-
- The component will return from this call within 5 msec.
-
- @param [in] hComp
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle method.
- @param [in] nPort
- nPort is used to select the port on the component to be used
- for tunneling.
- @param [in] hTunneledComp
- Handle of the component to tunnel with. This is the component
- handle returned by the call to the OMX_GetHandle method. When
- this parameter is 0x0 the component should setup the port for
- communication with the application / IL Client.
- @param [in] nPortOutput
- nPortOutput is used indicate the port the component should
- tunnel with.
- @param [in] pTunnelSetup
- Pointer to the tunnel setup structure. When nPort is an output port
- the component should populate the fields of this structure. When
- When nPort is an input port the component should review the setup
- provided by the component with the output port.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup tun
- */
-
- OMX_ERRORTYPE (*ComponentTunnelRequest)(
- OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_U32 nPort,
- OMX_IN OMX_HANDLETYPE hTunneledComp,
- OMX_IN OMX_U32 nTunneledPort,
- OMX_INOUT OMX_TUNNELSETUPTYPE* pTunnelSetup);
-
- /** refer to OMX_UseBuffer in OMX_core.h or the OMX IL
- specification for details on the UseBuffer method.
- @ingroup buf
- */
- OMX_ERRORTYPE (*UseBuffer)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr,
- OMX_IN OMX_U32 nPortIndex,
- OMX_IN OMX_PTR pAppPrivate,
- OMX_IN OMX_U32 nSizeBytes,
- OMX_IN OMX_U8* pBuffer);
-
- /** refer to OMX_AllocateBuffer in OMX_core.h or the OMX IL
- specification for details on the AllocateBuffer method.
- @ingroup buf
- */
- OMX_ERRORTYPE (*AllocateBuffer)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_INOUT OMX_BUFFERHEADERTYPE** ppBuffer,
- OMX_IN OMX_U32 nPortIndex,
- OMX_IN OMX_PTR pAppPrivate,
- OMX_IN OMX_U32 nSizeBytes);
-
- /** refer to OMX_FreeBuffer in OMX_core.h or the OMX IL
- specification for details on the FreeBuffer method.
- @ingroup buf
- */
- OMX_ERRORTYPE (*FreeBuffer)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_U32 nPortIndex,
- OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
-
- /** refer to OMX_EmptyThisBuffer in OMX_core.h or the OMX IL
- specification for details on the EmptyThisBuffer method.
- @ingroup buf
- */
- OMX_ERRORTYPE (*EmptyThisBuffer)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
-
- /** refer to OMX_FillThisBuffer in OMX_core.h or the OMX IL
- specification for details on the FillThisBuffer method.
- @ingroup buf
- */
- OMX_ERRORTYPE (*FillThisBuffer)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
-
- /** The SetCallbacks method is used by the core to specify the callback
- structure from the application to the component. This is a blocking
- call. The component will return from this call within 5 msec.
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the GetHandle function.
- @param [in] pCallbacks
- pointer to an OMX_CALLBACKTYPE structure used to provide the
- callback information to the component
- @param [in] pAppData
- pointer to an application defined value. It is anticipated that
- the application will pass a pointer to a data structure or a "this
- pointer" in this area to allow the callback (in the application)
- to determine the context of the call
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- */
- OMX_ERRORTYPE (*SetCallbacks)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_CALLBACKTYPE* pCallbacks,
- OMX_IN OMX_PTR pAppData);
-
- /** ComponentDeInit method is used to deinitialize the component
- providing a means to free any resources allocated at component
- initialization. NOTE: After this call the component handle is
- not valid for further use.
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the GetHandle function.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- */
- OMX_ERRORTYPE (*ComponentDeInit)(
- OMX_IN OMX_HANDLETYPE hComponent);
-
- /** @ingroup buf */
- OMX_ERRORTYPE (*UseEGLImage)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr,
- OMX_IN OMX_U32 nPortIndex,
- OMX_IN OMX_PTR pAppPrivate,
- OMX_IN void* eglImage);
-
- OMX_ERRORTYPE (*ComponentRoleEnum)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_OUT OMX_U8 *cRole,
- OMX_IN OMX_U32 nIndex);
-
-} OMX_COMPONENTTYPE;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
diff --git a/include/media/stagefright/openmax/OMX_ContentPipe.h b/include/media/stagefright/openmax/OMX_ContentPipe.h
deleted file mode 100644
index ee9e4db..0000000
--- a/include/media/stagefright/openmax/OMX_ContentPipe.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/*
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is 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 Software.
- *
- * THE SOFTWARE IS 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
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/** OMX_ContentPipe.h - OpenMax IL version 1.1.2
- * The OMX_ContentPipe header file contains the definitions used to define
- * the public interface for content piples. This header file is intended to
- * be used by the component.
- */
-
-#ifndef OMX_CONTENTPIPE_H
-#define OMX_CONTENTPIPE_H
-
-#ifndef KD_EACCES
-/* OpenKODE error codes. CPResult values may be zero (indicating success
- or one of the following values) */
-#define KD_EACCES (1)
-#define KD_EADDRINUSE (2)
-#define KD_EAGAIN (5)
-#define KD_EBADF (7)
-#define KD_EBUSY (8)
-#define KD_ECONNREFUSED (9)
-#define KD_ECONNRESET (10)
-#define KD_EDEADLK (11)
-#define KD_EDESTADDRREQ (12)
-#define KD_ERANGE (35)
-#define KD_EEXIST (13)
-#define KD_EFBIG (14)
-#define KD_EHOSTUNREACH (15)
-#define KD_EINVAL (17)
-#define KD_EIO (18)
-#define KD_EISCONN (20)
-#define KD_EISDIR (21)
-#define KD_EMFILE (22)
-#define KD_ENAMETOOLONG (23)
-#define KD_ENOENT (24)
-#define KD_ENOMEM (25)
-#define KD_ENOSPC (26)
-#define KD_ENOSYS (27)
-#define KD_ENOTCONN (28)
-#define KD_EPERM (33)
-#define KD_ETIMEDOUT (36)
-#define KD_EILSEQ (19)
-#endif
-
-/** Map types from OMX standard types only here so interface is as generic as possible. */
-typedef OMX_U32 CPresult;
-typedef char * CPstring;
-typedef void * CPhandle;
-typedef OMX_U32 CPuint;
-typedef OMX_S32 CPint;
-typedef char CPbyte;
-typedef OMX_BOOL CPbool;
-
-/** enumeration of origin types used in the CP_PIPETYPE's Seek function
- * @ingroup cp
- */
-typedef enum CP_ORIGINTYPE {
- CP_OriginBegin,
- CP_OriginCur,
- CP_OriginEnd,
- CP_OriginKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- CP_OriginVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- CP_OriginMax = 0X7FFFFFFF
-} CP_ORIGINTYPE;
-
-/** enumeration of contact access types used in the CP_PIPETYPE's Open function
- * @ingroup cp
- */
-typedef enum CP_ACCESSTYPE {
- CP_AccessRead,
- CP_AccessWrite,
- CP_AccessReadWrite ,
- CP_AccessKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- CP_AccessVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- CP_AccessMax = 0X7FFFFFFF
-} CP_ACCESSTYPE;
-
-/** enumeration of results returned by the CP_PIPETYPE's CheckAvailableBytes function
- * @ingroup cp
- */
-typedef enum CP_CHECKBYTESRESULTTYPE
-{
- CP_CheckBytesOk, /**< There are at least the request number
- of bytes available */
- CP_CheckBytesNotReady, /**< The pipe is still retrieving bytes
- and presently lacks sufficient bytes.
- Client will be called when they are
- sufficient bytes are available. */
- CP_CheckBytesInsufficientBytes , /**< The pipe has retrieved all bytes
- but those available are less than those
- requested */
- CP_CheckBytesAtEndOfStream, /**< The pipe has reached the end of stream
- and no more bytes are available. */
- CP_CheckBytesOutOfBuffers, /**< All read/write buffers are currently in use. */
- CP_CheckBytesKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- CP_CheckBytesVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- CP_CheckBytesMax = 0X7FFFFFFF
-} CP_CHECKBYTESRESULTTYPE;
-
-/** enumeration of content pipe events sent to the client callback.
- * @ingroup cp
- */
-typedef enum CP_EVENTTYPE{
- CP_BytesAvailable, /** bytes requested in a CheckAvailableBytes call are now available*/
- CP_Overflow, /** enumeration of content pipe events sent to the client callback*/
- CP_PipeDisconnected , /** enumeration of content pipe events sent to the client callback*/
- CP_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- CP_EventVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- CP_EventMax = 0X7FFFFFFF
-} CP_EVENTTYPE;
-
-/** content pipe definition
- * @ingroup cp
- */
-typedef struct CP_PIPETYPE
-{
- /** Open a content stream for reading or writing. */
- CPresult (*Open)( CPhandle* hContent, CPstring szURI, CP_ACCESSTYPE eAccess );
-
- /** Close a content stream. */
- CPresult (*Close)( CPhandle hContent );
-
- /** Create a content source and open it for writing. */
- CPresult (*Create)( CPhandle *hContent, CPstring szURI );
-
- /** Check the that specified number of bytes are available for reading or writing (depending on access type).*/
- CPresult (*CheckAvailableBytes)( CPhandle hContent, CPuint nBytesRequested, CP_CHECKBYTESRESULTTYPE *eResult );
-
- /** Seek to certain position in the content relative to the specified origin. */
- CPresult (*SetPosition)( CPhandle hContent, CPint nOffset, CP_ORIGINTYPE eOrigin);
-
- /** Retrieve the current position relative to the start of the content. */
- CPresult (*GetPosition)( CPhandle hContent, CPuint *pPosition);
-
- /** Retrieve data of the specified size from the content stream (advance content pointer by size of data).
- Note: pipe client provides pointer. This function is appropriate for small high frequency reads. */
- CPresult (*Read)( CPhandle hContent, CPbyte *pData, CPuint nSize);
-
- /** Retrieve a buffer allocated by the pipe that contains the requested number of bytes.
- Buffer contains the next block of bytes, as specified by nSize, of the content. nSize also
- returns the size of the block actually read. Content pointer advances the by the returned size.
- Note: pipe provides pointer. This function is appropriate for large reads. The client must call
- ReleaseReadBuffer when done with buffer.
-
- In some cases the requested block may not reside in contiguous memory within the
- pipe implementation. For instance if the pipe leverages a circular buffer then the requested
- block may straddle the boundary of the circular buffer. By default a pipe implementation
- performs a copy in this case to provide the block to the pipe client in one contiguous buffer.
- If, however, the client sets bForbidCopy, then the pipe returns only those bytes preceding the memory
- boundary. Here the client may retrieve the data in segments over successive calls. */
- CPresult (*ReadBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint *nSize, CPbool bForbidCopy);
-
- /** Release a buffer obtained by ReadBuffer back to the pipe. */
- CPresult (*ReleaseReadBuffer)(CPhandle hContent, CPbyte *pBuffer);
-
- /** Write data of the specified size to the content (advance content pointer by size of data).
- Note: pipe client provides pointer. This function is appropriate for small high frequency writes. */
- CPresult (*Write)( CPhandle hContent, CPbyte *data, CPuint nSize);
-
- /** Retrieve a buffer allocated by the pipe used to write data to the content.
- Client will fill buffer with output data. Note: pipe provides pointer. This function is appropriate
- for large writes. The client must call WriteBuffer when done it has filled the buffer with data.*/
- CPresult (*GetWriteBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint nSize);
-
- /** Deliver a buffer obtained via GetWriteBuffer to the pipe. Pipe will write the
- the contents of the buffer to content and advance content pointer by the size of the buffer */
- CPresult (*WriteBuffer)( CPhandle hContent, CPbyte *pBuffer, CPuint nFilledSize);
-
- /** Register a per-handle client callback with the content pipe. */
- CPresult (*RegisterCallback)( CPhandle hContent, CPresult (*ClientCallback)(CP_EVENTTYPE eEvent, CPuint iParam));
-
-} CP_PIPETYPE;
-
-#endif
-
diff --git a/include/media/stagefright/openmax/OMX_Core.h b/include/media/stagefright/openmax/OMX_Core.h
deleted file mode 100644
index 9fb0f6f..0000000
--- a/include/media/stagefright/openmax/OMX_Core.h
+++ /dev/null
@@ -1,1448 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/*
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is 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 Software.
- *
- * THE SOFTWARE IS 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
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/** OMX_Core.h - OpenMax IL version 1.1.2
- * The OMX_Core header file contains the definitions used by both the
- * application and the component to access common items.
- */
-
-#ifndef OMX_Core_h
-#define OMX_Core_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* Each OMX header shall include all required header files to allow the
- * header to compile without errors. The includes below are required
- * for this header file to compile successfully
- */
-
-#include <OMX_Index.h>
-
-
-/** The OMX_COMMANDTYPE enumeration is used to specify the action in the
- * OMX_SendCommand macro.
- * @ingroup core
- */
-typedef enum OMX_COMMANDTYPE
-{
- OMX_CommandStateSet, /**< Change the component state */
- OMX_CommandFlush, /**< Flush the data queue(s) of a component */
- OMX_CommandPortDisable, /**< Disable a port on a component. */
- OMX_CommandPortEnable, /**< Enable a port on a component. */
- OMX_CommandMarkBuffer, /**< Mark a component/buffer for observation */
- OMX_CommandKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_CommandVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_CommandMax = 0X7FFFFFFF
-} OMX_COMMANDTYPE;
-
-
-
-/** The OMX_STATETYPE enumeration is used to indicate or change the component
- * state. This enumeration reflects the current state of the component when
- * used with the OMX_GetState macro or becomes the parameter in a state change
- * command when used with the OMX_SendCommand macro.
- *
- * The component will be in the Loaded state after the component is initially
- * loaded into memory. In the Loaded state, the component is not allowed to
- * allocate or hold resources other than to build it's internal parameter
- * and configuration tables. The application will send one or more
- * SetParameters/GetParameters and SetConfig/GetConfig commands to the
- * component and the component will record each of these parameter and
- * configuration changes for use later. When the application sends the
- * Idle command, the component will acquire the resources needed for the
- * specified configuration and will transition to the idle state if the
- * allocation is successful. If the component cannot successfully
- * transition to the idle state for any reason, the state of the component
- * shall be fully rolled back to the Loaded state (e.g. all allocated
- * resources shall be released). When the component receives the command
- * to go to the Executing state, it shall begin processing buffers by
- * sending all input buffers it holds to the application. While
- * the component is in the Idle state, the application may also send the
- * Pause command. If the component receives the pause command while in the
- * Idle state, the component shall send all input buffers it holds to the
- * application, but shall not begin processing buffers. This will allow the
- * application to prefill buffers.
- *
- * @ingroup comp
- */
-
-typedef enum OMX_STATETYPE
-{
- OMX_StateInvalid, /**< component has detected that it's internal data
- structures are corrupted to the point that
- it cannot determine it's state properly */
- OMX_StateLoaded, /**< component has been loaded but has not completed
- initialization. The OMX_SetParameter macro
- and the OMX_GetParameter macro are the only
- valid macros allowed to be sent to the
- component in this state. */
- OMX_StateIdle, /**< component initialization has been completed
- successfully and the component is ready to
- to start. */
- OMX_StateExecuting, /**< component has accepted the start command and
- is processing data (if data is available) */
- OMX_StatePause, /**< component has received pause command */
- OMX_StateWaitForResources, /**< component is waiting for resources, either after
- preemption or before it gets the resources requested.
- See specification for complete details. */
- OMX_StateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_StateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_StateMax = 0X7FFFFFFF
-} OMX_STATETYPE;
-
-/** The OMX_ERRORTYPE enumeration defines the standard OMX Errors. These
- * errors should cover most of the common failure cases. However,
- * vendors are free to add additional error messages of their own as
- * long as they follow these rules:
- * 1. Vendor error messages shall be in the range of 0x90000000 to
- * 0x9000FFFF.
- * 2. Vendor error messages shall be defined in a header file provided
- * with the component. No error messages are allowed that are
- * not defined.
- */
-typedef enum OMX_ERRORTYPE
-{
- OMX_ErrorNone = 0,
-
- /** There were insufficient resources to perform the requested operation */
- OMX_ErrorInsufficientResources = (OMX_S32) 0x80001000,
-
- /** There was an error, but the cause of the error could not be determined */
- OMX_ErrorUndefined = (OMX_S32) 0x80001001,
-
- /** The component name string was not valid */
- OMX_ErrorInvalidComponentName = (OMX_S32) 0x80001002,
-
- /** No component with the specified name string was found */
- OMX_ErrorComponentNotFound = (OMX_S32) 0x80001003,
-
- /** The component specified did not have a "OMX_ComponentInit" or
- "OMX_ComponentDeInit entry point */
- OMX_ErrorInvalidComponent = (OMX_S32) 0x80001004,
-
- /** One or more parameters were not valid */
- OMX_ErrorBadParameter = (OMX_S32) 0x80001005,
-
- /** The requested function is not implemented */
- OMX_ErrorNotImplemented = (OMX_S32) 0x80001006,
-
- /** The buffer was emptied before the next buffer was ready */
- OMX_ErrorUnderflow = (OMX_S32) 0x80001007,
-
- /** The buffer was not available when it was needed */
- OMX_ErrorOverflow = (OMX_S32) 0x80001008,
-
- /** The hardware failed to respond as expected */
- OMX_ErrorHardware = (OMX_S32) 0x80001009,
-
- /** The component is in the state OMX_StateInvalid */
- OMX_ErrorInvalidState = (OMX_S32) 0x8000100A,
-
- /** Stream is found to be corrupt */
- OMX_ErrorStreamCorrupt = (OMX_S32) 0x8000100B,
-
- /** Ports being connected are not compatible */
- OMX_ErrorPortsNotCompatible = (OMX_S32) 0x8000100C,
-
- /** Resources allocated to an idle component have been
- lost resulting in the component returning to the loaded state */
- OMX_ErrorResourcesLost = (OMX_S32) 0x8000100D,
-
- /** No more indicies can be enumerated */
- OMX_ErrorNoMore = (OMX_S32) 0x8000100E,
-
- /** The component detected a version mismatch */
- OMX_ErrorVersionMismatch = (OMX_S32) 0x8000100F,
-
- /** The component is not ready to return data at this time */
- OMX_ErrorNotReady = (OMX_S32) 0x80001010,
-
- /** There was a timeout that occurred */
- OMX_ErrorTimeout = (OMX_S32) 0x80001011,
-
- /** This error occurs when trying to transition into the state you are already in */
- OMX_ErrorSameState = (OMX_S32) 0x80001012,
-
- /** Resources allocated to an executing or paused component have been
- preempted, causing the component to return to the idle state */
- OMX_ErrorResourcesPreempted = (OMX_S32) 0x80001013,
-
- /** A non-supplier port sends this error to the IL client (via the EventHandler callback)
- during the allocation of buffers (on a transition from the LOADED to the IDLE state or
- on a port restart) when it deems that it has waited an unusually long time for the supplier
- to send it an allocated buffer via a UseBuffer call. */
- OMX_ErrorPortUnresponsiveDuringAllocation = (OMX_S32) 0x80001014,
-
- /** A non-supplier port sends this error to the IL client (via the EventHandler callback)
- during the deallocation of buffers (on a transition from the IDLE to LOADED state or
- on a port stop) when it deems that it has waited an unusually long time for the supplier
- to request the deallocation of a buffer header via a FreeBuffer call. */
- OMX_ErrorPortUnresponsiveDuringDeallocation = (OMX_S32) 0x80001015,
-
- /** A supplier port sends this error to the IL client (via the EventHandler callback)
- during the stopping of a port (either on a transition from the IDLE to LOADED
- state or a port stop) when it deems that it has waited an unusually long time for
- the non-supplier to return a buffer via an EmptyThisBuffer or FillThisBuffer call. */
- OMX_ErrorPortUnresponsiveDuringStop = (OMX_S32) 0x80001016,
-
- /** Attempting a state transtion that is not allowed */
- OMX_ErrorIncorrectStateTransition = (OMX_S32) 0x80001017,
-
- /* Attempting a command that is not allowed during the present state. */
- OMX_ErrorIncorrectStateOperation = (OMX_S32) 0x80001018,
-
- /** The values encapsulated in the parameter or config structure are not supported. */
- OMX_ErrorUnsupportedSetting = (OMX_S32) 0x80001019,
-
- /** The parameter or config indicated by the given index is not supported. */
- OMX_ErrorUnsupportedIndex = (OMX_S32) 0x8000101A,
-
- /** The port index supplied is incorrect. */
- OMX_ErrorBadPortIndex = (OMX_S32) 0x8000101B,
-
- /** The port has lost one or more of its buffers and it thus unpopulated. */
- OMX_ErrorPortUnpopulated = (OMX_S32) 0x8000101C,
-
- /** Component suspended due to temporary loss of resources */
- OMX_ErrorComponentSuspended = (OMX_S32) 0x8000101D,
-
- /** Component suspended due to an inability to acquire dynamic resources */
- OMX_ErrorDynamicResourcesUnavailable = (OMX_S32) 0x8000101E,
-
- /** When the macroblock error reporting is enabled the component returns new error
- for every frame that has errors */
- OMX_ErrorMbErrorsInFrame = (OMX_S32) 0x8000101F,
-
- /** A component reports this error when it cannot parse or determine the format of an input stream. */
- OMX_ErrorFormatNotDetected = (OMX_S32) 0x80001020,
-
- /** The content open operation failed. */
- OMX_ErrorContentPipeOpenFailed = (OMX_S32) 0x80001021,
-
- /** The content creation operation failed. */
- OMX_ErrorContentPipeCreationFailed = (OMX_S32) 0x80001022,
-
- /** Separate table information is being used */
- OMX_ErrorSeperateTablesUsed = (OMX_S32) 0x80001023,
-
- /** Tunneling is unsupported by the component*/
- OMX_ErrorTunnelingUnsupported = (OMX_S32) 0x80001024,
-
- OMX_ErrorKhronosExtensions = (OMX_S32)0x8F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_ErrorVendorStartUnused = (OMX_S32)0x90000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_ErrorMax = 0x7FFFFFFF
-} OMX_ERRORTYPE;
-
-/** @ingroup core */
-typedef OMX_ERRORTYPE (* OMX_COMPONENTINITTYPE)(OMX_IN OMX_HANDLETYPE hComponent);
-
-/** @ingroup core */
-typedef struct OMX_COMPONENTREGISTERTYPE
-{
- const char * pName; /* Component name, 128 byte limit (including '\0') applies */
- OMX_COMPONENTINITTYPE pInitialize; /* Component instance initialization function */
-} OMX_COMPONENTREGISTERTYPE;
-
-/** @ingroup core */
-extern OMX_COMPONENTREGISTERTYPE OMX_ComponentRegistered[];
-
-/** @ingroup rpm */
-typedef struct OMX_PRIORITYMGMTTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nGroupPriority; /**< Priority of the component group */
- OMX_U32 nGroupID; /**< ID of the component group */
-} OMX_PRIORITYMGMTTYPE;
-
-/* Component name and Role names are limited to 128 characters including the terminating '\0'. */
-#define OMX_MAX_STRINGNAME_SIZE 128
-
-/** @ingroup comp */
-typedef struct OMX_PARAM_COMPONENTROLETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U8 cRole[OMX_MAX_STRINGNAME_SIZE]; /**< name of standard component which defines component role */
-} OMX_PARAM_COMPONENTROLETYPE;
-
-/** End of Stream Buffer Flag:
- *
- * A component sets EOS when it has no more data to emit on a particular
- * output port. Thus an output port shall set EOS on the last buffer it
- * emits. A component's determination of when an output port should
- * cease sending data is implemenation specific.
- * @ingroup buf
- */
-
-#define OMX_BUFFERFLAG_EOS 0x00000001
-
-/** Start Time Buffer Flag:
- *
- * The source of a stream (e.g. a demux component) sets the STARTTIME
- * flag on the buffer that contains the starting timestamp for the
- * stream. The starting timestamp corresponds to the first data that
- * should be displayed at startup or after a seek.
- * The first timestamp of the stream is not necessarily the start time.
- * For instance, in the case of a seek to a particular video frame,
- * the target frame may be an interframe. Thus the first buffer of
- * the stream will be the intra-frame preceding the target frame and
- * the starttime will occur with the target frame (with any other
- * required frames required to reconstruct the target intervening).
- *
- * The STARTTIME flag is directly associated with the buffer's
- * timestamp ' thus its association to buffer data and its
- * propagation is identical to the timestamp's.
- *
- * When a Sync Component client receives a buffer with the
- * STARTTIME flag it shall perform a SetConfig on its sync port
- * using OMX_ConfigTimeClientStartTime and passing the buffer's
- * timestamp.
- *
- * @ingroup buf
- */
-
-#define OMX_BUFFERFLAG_STARTTIME 0x00000002
-
-
-
-/** Decode Only Buffer Flag:
- *
- * The source of a stream (e.g. a demux component) sets the DECODEONLY
- * flag on any buffer that should shall be decoded but should not be
- * displayed. This flag is used, for instance, when a source seeks to
- * a target interframe that requires the decode of frames preceding the
- * target to facilitate the target's reconstruction. In this case the
- * source would emit the frames preceding the target downstream
- * but mark them as decode only.
- *
- * The DECODEONLY is associated with buffer data and propagated in a
- * manner identical to the buffer timestamp.
- *
- * A component that renders data should ignore all buffers with
- * the DECODEONLY flag set.
- *
- * @ingroup buf
- */
-
-#define OMX_BUFFERFLAG_DECODEONLY 0x00000004
-
-
-/* Data Corrupt Flag: This flag is set when the IL client believes the data in the associated buffer is corrupt
- * @ingroup buf
- */
-
-#define OMX_BUFFERFLAG_DATACORRUPT 0x00000008
-
-/* End of Frame: The buffer contains exactly one end of frame and no data
- * occurs after the end of frame. This flag is an optional hint. The absence
- * of this flag does not imply the absence of an end of frame within the buffer.
- * @ingroup buf
-*/
-#define OMX_BUFFERFLAG_ENDOFFRAME 0x00000010
-
-/* Sync Frame Flag: This flag is set when the buffer content contains a coded sync frame '
- * a frame that has no dependency on any other frame information
- * @ingroup buf
- */
-#define OMX_BUFFERFLAG_SYNCFRAME 0x00000020
-
-/* Extra data present flag: there is extra data appended to the data stream
- * residing in the buffer
- * @ingroup buf
- */
-#define OMX_BUFFERFLAG_EXTRADATA 0x00000040
-
-/** Codec Config Buffer Flag:
-* OMX_BUFFERFLAG_CODECCONFIG is an optional flag that is set by an
-* output port when all bytes in the buffer form part or all of a set of
-* codec specific configuration data. Examples include SPS/PPS nal units
-* for OMX_VIDEO_CodingAVC or AudioSpecificConfig data for
-* OMX_AUDIO_CodingAAC. Any component that for a given stream sets
-* OMX_BUFFERFLAG_CODECCONFIG shall not mix codec configuration bytes
-* with frame data in the same buffer, and shall send all buffers
-* containing codec configuration bytes before any buffers containing
-* frame data that those configurations bytes describe.
-* If the stream format for a particular codec has a frame specific
-* header at the start of each frame, for example OMX_AUDIO_CodingMP3 or
-* OMX_AUDIO_CodingAAC in ADTS mode, then these shall be presented as
-* normal without setting OMX_BUFFERFLAG_CODECCONFIG.
- * @ingroup buf
- */
-#define OMX_BUFFERFLAG_CODECCONFIG 0x00000080
-
-
-
-/** @ingroup buf */
-typedef struct OMX_BUFFERHEADERTYPE
-{
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U8* pBuffer; /**< Pointer to actual block of memory
- that is acting as the buffer */
- OMX_U32 nAllocLen; /**< size of the buffer allocated, in bytes */
- OMX_U32 nFilledLen; /**< number of bytes currently in the
- buffer */
- OMX_U32 nOffset; /**< start offset of valid data in bytes from
- the start of the buffer */
- OMX_PTR pAppPrivate; /**< pointer to any data the application
- wants to associate with this buffer */
- OMX_PTR pPlatformPrivate; /**< pointer to any data the platform
- wants to associate with this buffer */
- OMX_PTR pInputPortPrivate; /**< pointer to any data the input port
- wants to associate with this buffer */
- OMX_PTR pOutputPortPrivate; /**< pointer to any data the output port
- wants to associate with this buffer */
- OMX_HANDLETYPE hMarkTargetComponent; /**< The component that will generate a
- mark event upon processing this buffer. */
- OMX_PTR pMarkData; /**< Application specific data associated with
- the mark sent on a mark event to disambiguate
- this mark from others. */
- OMX_U32 nTickCount; /**< Optional entry that the component and
- application can update with a tick count
- when they access the component. This
- value should be in microseconds. Since
- this is a value relative to an arbitrary
- starting point, this value cannot be used
- to determine absolute time. This is an
- optional entry and not all components
- will update it.*/
- OMX_TICKS nTimeStamp; /**< Timestamp corresponding to the sample
- starting at the first logical sample
- boundary in the buffer. Timestamps of
- successive samples within the buffer may
- be inferred by adding the duration of the
- of the preceding buffer to the timestamp
- of the preceding buffer.*/
- OMX_U32 nFlags; /**< buffer specific flags */
- OMX_U32 nOutputPortIndex; /**< The index of the output port (if any) using
- this buffer */
- OMX_U32 nInputPortIndex; /**< The index of the input port (if any) using
- this buffer */
-} OMX_BUFFERHEADERTYPE;
-
-/** The OMX_EXTRADATATYPE enumeration is used to define the
- * possible extra data payload types.
- * NB: this enum is binary backwards compatible with the previous
- * OMX_EXTRADATA_QUANT define. This should be replaced with
- * OMX_ExtraDataQuantization.
- */
-typedef enum OMX_EXTRADATATYPE
-{
- OMX_ExtraDataNone = 0, /**< Indicates that no more extra data sections follow */
- OMX_ExtraDataQuantization, /**< The data payload contains quantization data */
- OMX_ExtraDataKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_ExtraDataVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_ExtraDataMax = 0x7FFFFFFF
-} OMX_EXTRADATATYPE;
-
-
-typedef struct OMX_OTHER_EXTRADATATYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_EXTRADATATYPE eType; /* Extra Data type */
- OMX_U32 nDataSize; /* Size of the supporting data to follow */
- OMX_U8 data[1]; /* Supporting data hint */
-} OMX_OTHER_EXTRADATATYPE;
-
-/** @ingroup comp */
-typedef struct OMX_PORT_PARAM_TYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPorts; /**< The number of ports for this component */
- OMX_U32 nStartPortNumber; /** first port number for this type of port */
-} OMX_PORT_PARAM_TYPE;
-
-/** @ingroup comp */
-typedef enum OMX_EVENTTYPE
-{
- OMX_EventCmdComplete, /**< component has sucessfully completed a command */
- OMX_EventError, /**< component has detected an error condition */
- OMX_EventMark, /**< component has detected a buffer mark */
- OMX_EventPortSettingsChanged, /**< component is reported a port settings change */
- OMX_EventBufferFlag, /**< component has detected an EOS */
- OMX_EventResourcesAcquired, /**< component has been granted resources and is
- automatically starting the state change from
- OMX_StateWaitForResources to OMX_StateIdle. */
- OMX_EventComponentResumed, /**< Component resumed due to reacquisition of resources */
- OMX_EventDynamicResourcesAvailable, /**< Component has acquired previously unavailable dynamic resources */
- OMX_EventPortFormatDetected, /**< Component has detected a supported format. */
- OMX_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_EventVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_EventMax = 0x7FFFFFFF
-} OMX_EVENTTYPE;
-
-typedef struct OMX_CALLBACKTYPE
-{
- /** The EventHandler method is used to notify the application when an
- event of interest occurs. Events are defined in the OMX_EVENTTYPE
- enumeration. Please see that enumeration for details of what will
- be returned for each type of event. Callbacks should not return
- an error to the component, so if an error occurs, the application
- shall handle it internally. This is a blocking call.
-
- The application should return from this call within 5 msec to avoid
- blocking the component for an excessively long period of time.
-
- @param hComponent
- handle of the component to access. This is the component
- handle returned by the call to the GetHandle function.
- @param pAppData
- pointer to an application defined value that was provided in the
- pAppData parameter to the OMX_GetHandle method for the component.
- This application defined value is provided so that the application
- can have a component specific context when receiving the callback.
- @param eEvent
- Event that the component wants to notify the application about.
- @param nData1
- nData will be the OMX_ERRORTYPE for an error event and will be
- an OMX_COMMANDTYPE for a command complete event and OMX_INDEXTYPE for a OMX_PortSettingsChanged event.
- @param nData2
- nData2 will hold further information related to the event. Can be OMX_STATETYPE for
- a OMX_CommandStateSet command or port index for a OMX_PortSettingsChanged event.
- Default value is 0 if not used. )
- @param pEventData
- Pointer to additional event-specific data (see spec for meaning).
- */
-
- OMX_ERRORTYPE (*EventHandler)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_PTR pAppData,
- OMX_IN OMX_EVENTTYPE eEvent,
- OMX_IN OMX_U32 nData1,
- OMX_IN OMX_U32 nData2,
- OMX_IN OMX_PTR pEventData);
-
- /** The EmptyBufferDone method is used to return emptied buffers from an
- input port back to the application for reuse. This is a blocking call
- so the application should not attempt to refill the buffers during this
- call, but should queue them and refill them in another thread. There
- is no error return, so the application shall handle any errors generated
- internally.
-
- The application should return from this call within 5 msec.
-
- @param hComponent
- handle of the component to access. This is the component
- handle returned by the call to the GetHandle function.
- @param pAppData
- pointer to an application defined value that was provided in the
- pAppData parameter to the OMX_GetHandle method for the component.
- This application defined value is provided so that the application
- can have a component specific context when receiving the callback.
- @param pBuffer
- pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
- or AllocateBuffer indicating the buffer that was emptied.
- @ingroup buf
- */
- OMX_ERRORTYPE (*EmptyBufferDone)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_PTR pAppData,
- OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
-
- /** The FillBufferDone method is used to return filled buffers from an
- output port back to the application for emptying and then reuse.
- This is a blocking call so the application should not attempt to
- empty the buffers during this call, but should queue the buffers
- and empty them in another thread. There is no error return, so
- the application shall handle any errors generated internally. The
- application shall also update the buffer header to indicate the
- number of bytes placed into the buffer.
-
- The application should return from this call within 5 msec.
-
- @param hComponent
- handle of the component to access. This is the component
- handle returned by the call to the GetHandle function.
- @param pAppData
- pointer to an application defined value that was provided in the
- pAppData parameter to the OMX_GetHandle method for the component.
- This application defined value is provided so that the application
- can have a component specific context when receiving the callback.
- @param pBuffer
- pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
- or AllocateBuffer indicating the buffer that was filled.
- @ingroup buf
- */
- OMX_ERRORTYPE (*FillBufferDone)(
- OMX_OUT OMX_HANDLETYPE hComponent,
- OMX_OUT OMX_PTR pAppData,
- OMX_OUT OMX_BUFFERHEADERTYPE* pBuffer);
-
-} OMX_CALLBACKTYPE;
-
-/** The OMX_BUFFERSUPPLIERTYPE enumeration is used to dictate port supplier
- preference when tunneling between two ports.
- @ingroup tun buf
-*/
-typedef enum OMX_BUFFERSUPPLIERTYPE
-{
- OMX_BufferSupplyUnspecified = 0x0, /**< port supplying the buffers is unspecified,
- or don't care */
- OMX_BufferSupplyInput, /**< input port supplies the buffers */
- OMX_BufferSupplyOutput, /**< output port supplies the buffers */
- OMX_BufferSupplyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_BufferSupplyVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_BufferSupplyMax = 0x7FFFFFFF
-} OMX_BUFFERSUPPLIERTYPE;
-
-
-/** buffer supplier parameter
- * @ingroup tun
- */
-typedef struct OMX_PARAM_BUFFERSUPPLIERTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BUFFERSUPPLIERTYPE eBufferSupplier; /**< buffer supplier */
-} OMX_PARAM_BUFFERSUPPLIERTYPE;
-
-
-/**< indicates that buffers received by an input port of a tunnel
- may not modify the data in the buffers
- @ingroup tun
- */
-#define OMX_PORTTUNNELFLAG_READONLY 0x00000001
-
-
-/** The OMX_TUNNELSETUPTYPE structure is used to pass data from an output
- port to an input port as part the two ComponentTunnelRequest calls
- resulting from a OMX_SetupTunnel call from the IL Client.
- @ingroup tun
- */
-typedef struct OMX_TUNNELSETUPTYPE
-{
- OMX_U32 nTunnelFlags; /**< bit flags for tunneling */
- OMX_BUFFERSUPPLIERTYPE eSupplier; /**< supplier preference */
-} OMX_TUNNELSETUPTYPE;
-
-/* OMX Component headers is included to enable the core to use
- macros for functions into the component for OMX release 1.0.
- Developers should not access any structures or data from within
- the component header directly */
-/* TO BE REMOVED - #include <OMX_Component.h> */
-
-/** GetComponentVersion will return information about the component.
- This is a blocking call. This macro will go directly from the
- application to the component (via a core macro). The
- component will return from this call within 5 msec.
- @param [in] hComponent
- handle of component to execute the command
- @param [out] pComponentName
- pointer to an empty string of length 128 bytes. The component
- will write its name into this string. The name will be
- terminated by a single zero byte. The name of a component will
- be 127 bytes or less to leave room for the trailing zero byte.
- An example of a valid component name is "OMX.ABC.ChannelMixer\0".
- @param [out] pComponentVersion
- pointer to an OMX Version structure that the component will fill
- in. The component will fill in a value that indicates the
- component version. NOTE: the component version is NOT the same
- as the OMX Specification version (found in all structures). The
- component version is defined by the vendor of the component and
- its value is entirely up to the component vendor.
- @param [out] pSpecVersion
- pointer to an OMX Version structure that the component will fill
- in. The SpecVersion is the version of the specification that the
- component was built against. Please note that this value may or
- may not match the structure's version. For example, if the
- component was built against the 2.0 specification, but the
- application (which creates the structure is built against the
- 1.0 specification the versions would be different.
- @param [out] pComponentUUID
- pointer to the UUID of the component which will be filled in by
- the component. The UUID is a unique identifier that is set at
- RUN time for the component and is unique to each instantion of
- the component.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp
- */
-#define OMX_GetComponentVersion( \
- hComponent, \
- pComponentName, \
- pComponentVersion, \
- pSpecVersion, \
- pComponentUUID) \
- ((OMX_COMPONENTTYPE*)hComponent)->GetComponentVersion( \
- hComponent, \
- pComponentName, \
- pComponentVersion, \
- pSpecVersion, \
- pComponentUUID) /* Macro End */
-
-
-/** Send a command to the component. This call is a non-blocking call.
- The component should check the parameters and then queue the command
- to the component thread to be executed. The component thread shall
- send the EventHandler() callback at the conclusion of the command.
- This macro will go directly from the application to the component (via
- a core macro). The component will return from this call within 5 msec.
-
- When the command is "OMX_CommandStateSet" the component will queue a
- state transition to the new state idenfied in nParam.
-
- When the command is "OMX_CommandFlush", to flush a port's buffer queues,
- the command will force the component to return all buffers NOT CURRENTLY
- BEING PROCESSED to the application, in the order in which the buffers
- were received.
-
- When the command is "OMX_CommandPortDisable" or
- "OMX_CommandPortEnable", the component's port (given by the value of
- nParam) will be stopped or restarted.
-
- When the command "OMX_CommandMarkBuffer" is used to mark a buffer, the
- pCmdData will point to a OMX_MARKTYPE structure containing the component
- handle of the component to examine the buffer chain for the mark. nParam1
- contains the index of the port on which the buffer mark is applied.
-
- Specification text for more details.
-
- @param [in] hComponent
- handle of component to execute the command
- @param [in] Cmd
- Command for the component to execute
- @param [in] nParam
- Parameter for the command to be executed. When Cmd has the value
- OMX_CommandStateSet, value is a member of OMX_STATETYPE. When Cmd has
- the value OMX_CommandFlush, value of nParam indicates which port(s)
- to flush. -1 is used to flush all ports a single port index will
- only flush that port. When Cmd has the value "OMX_CommandPortDisable"
- or "OMX_CommandPortEnable", the component's port is given by
- the value of nParam. When Cmd has the value "OMX_CommandMarkBuffer"
- the components pot is given by the value of nParam.
- @param [in] pCmdData
- Parameter pointing to the OMX_MARKTYPE structure when Cmd has the value
- "OMX_CommandMarkBuffer".
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp
- */
-#define OMX_SendCommand( \
- hComponent, \
- Cmd, \
- nParam, \
- pCmdData) \
- ((OMX_COMPONENTTYPE*)hComponent)->SendCommand( \
- hComponent, \
- Cmd, \
- nParam, \
- pCmdData) /* Macro End */
-
-
-/** The OMX_GetParameter macro will get one of the current parameter
- settings from the component. This macro cannot only be invoked when
- the component is in the OMX_StateInvalid state. The nParamIndex
- parameter is used to indicate which structure is being requested from
- the component. The application shall allocate the correct structure
- and shall fill in the structure size and version information before
- invoking this macro. When the parameter applies to a port, the
- caller shall fill in the appropriate nPortIndex value indicating the
- port on which the parameter applies. If the component has not had
- any settings changed, then the component should return a set of
- valid DEFAULT parameters for the component. This is a blocking
- call.
-
- The component should return from this call within 20 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [in] nParamIndex
- Index of the structure to be filled. This value is from the
- OMX_INDEXTYPE enumeration.
- @param [in,out] pComponentParameterStructure
- Pointer to application allocated structure to be filled by the
- component.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp
- */
-#define OMX_GetParameter( \
- hComponent, \
- nParamIndex, \
- pComponentParameterStructure) \
- ((OMX_COMPONENTTYPE*)hComponent)->GetParameter( \
- hComponent, \
- nParamIndex, \
- pComponentParameterStructure) /* Macro End */
-
-
-/** The OMX_SetParameter macro will send an initialization parameter
- structure to a component. Each structure shall be sent one at a time,
- in a separate invocation of the macro. This macro can only be
- invoked when the component is in the OMX_StateLoaded state, or the
- port is disabled (when the parameter applies to a port). The
- nParamIndex parameter is used to indicate which structure is being
- passed to the component. The application shall allocate the
- correct structure and shall fill in the structure size and version
- information (as well as the actual data) before invoking this macro.
- The application is free to dispose of this structure after the call
- as the component is required to copy any data it shall retain. This
- is a blocking call.
-
- The component should return from this call within 20 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [in] nIndex
- Index of the structure to be sent. This value is from the
- OMX_INDEXTYPE enumeration.
- @param [in] pComponentParameterStructure
- pointer to application allocated structure to be used for
- initialization by the component.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp
- */
-#define OMX_SetParameter( \
- hComponent, \
- nParamIndex, \
- pComponentParameterStructure) \
- ((OMX_COMPONENTTYPE*)hComponent)->SetParameter( \
- hComponent, \
- nParamIndex, \
- pComponentParameterStructure) /* Macro End */
-
-
-/** The OMX_GetConfig macro will get one of the configuration structures
- from a component. This macro can be invoked anytime after the
- component has been loaded. The nParamIndex call parameter is used to
- indicate which structure is being requested from the component. The
- application shall allocate the correct structure and shall fill in the
- structure size and version information before invoking this macro.
- If the component has not had this configuration parameter sent before,
- then the component should return a set of valid DEFAULT values for the
- component. This is a blocking call.
-
- The component should return from this call within 5 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [in] nIndex
- Index of the structure to be filled. This value is from the
- OMX_INDEXTYPE enumeration.
- @param [in,out] pComponentConfigStructure
- pointer to application allocated structure to be filled by the
- component.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp
-*/
-#define OMX_GetConfig( \
- hComponent, \
- nConfigIndex, \
- pComponentConfigStructure) \
- ((OMX_COMPONENTTYPE*)hComponent)->GetConfig( \
- hComponent, \
- nConfigIndex, \
- pComponentConfigStructure) /* Macro End */
-
-
-/** The OMX_SetConfig macro will send one of the configuration
- structures to a component. Each structure shall be sent one at a time,
- each in a separate invocation of the macro. This macro can be invoked
- anytime after the component has been loaded. The application shall
- allocate the correct structure and shall fill in the structure size
- and version information (as well as the actual data) before invoking
- this macro. The application is free to dispose of this structure after
- the call as the component is required to copy any data it shall retain.
- This is a blocking call.
-
- The component should return from this call within 5 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [in] nConfigIndex
- Index of the structure to be sent. This value is from the
- OMX_INDEXTYPE enumeration above.
- @param [in] pComponentConfigStructure
- pointer to application allocated structure to be used for
- initialization by the component.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp
- */
-#define OMX_SetConfig( \
- hComponent, \
- nConfigIndex, \
- pComponentConfigStructure) \
- ((OMX_COMPONENTTYPE*)hComponent)->SetConfig( \
- hComponent, \
- nConfigIndex, \
- pComponentConfigStructure) /* Macro End */
-
-
-/** The OMX_GetExtensionIndex macro will invoke a component to translate
- a vendor specific configuration or parameter string into an OMX
- structure index. There is no requirement for the vendor to support
- this command for the indexes already found in the OMX_INDEXTYPE
- enumeration (this is done to save space in small components). The
- component shall support all vendor supplied extension indexes not found
- in the master OMX_INDEXTYPE enumeration. This is a blocking call.
-
- The component should return from this call within 5 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the GetHandle function.
- @param [in] cParameterName
- OMX_STRING that shall be less than 128 characters long including
- the trailing null byte. This is the string that will get
- translated by the component into a configuration index.
- @param [out] pIndexType
- a pointer to a OMX_INDEXTYPE to receive the index value.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp
- */
-#define OMX_GetExtensionIndex( \
- hComponent, \
- cParameterName, \
- pIndexType) \
- ((OMX_COMPONENTTYPE*)hComponent)->GetExtensionIndex( \
- hComponent, \
- cParameterName, \
- pIndexType) /* Macro End */
-
-
-/** The OMX_GetState macro will invoke the component to get the current
- state of the component and place the state value into the location
- pointed to by pState.
-
- The component should return from this call within 5 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [out] pState
- pointer to the location to receive the state. The value returned
- is one of the OMX_STATETYPE members
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp
- */
-#define OMX_GetState( \
- hComponent, \
- pState) \
- ((OMX_COMPONENTTYPE*)hComponent)->GetState( \
- hComponent, \
- pState) /* Macro End */
-
-
-/** The OMX_UseBuffer macro will request that the component use
- a buffer (and allocate its own buffer header) already allocated
- by another component, or by the IL Client. This is a blocking
- call.
-
- The component should return from this call within 20 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [out] ppBuffer
- pointer to an OMX_BUFFERHEADERTYPE structure used to receive the
- pointer to the buffer header
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp buf
- */
-
-#define OMX_UseBuffer( \
- hComponent, \
- ppBufferHdr, \
- nPortIndex, \
- pAppPrivate, \
- nSizeBytes, \
- pBuffer) \
- ((OMX_COMPONENTTYPE*)hComponent)->UseBuffer( \
- hComponent, \
- ppBufferHdr, \
- nPortIndex, \
- pAppPrivate, \
- nSizeBytes, \
- pBuffer)
-
-
-/** The OMX_AllocateBuffer macro will request that the component allocate
- a new buffer and buffer header. The component will allocate the
- buffer and the buffer header and return a pointer to the buffer
- header. This is a blocking call.
-
- The component should return from this call within 5 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [out] ppBuffer
- pointer to an OMX_BUFFERHEADERTYPE structure used to receive
- the pointer to the buffer header
- @param [in] nPortIndex
- nPortIndex is used to select the port on the component the buffer will
- be used with. The port can be found by using the nPortIndex
- value as an index into the Port Definition array of the component.
- @param [in] pAppPrivate
- pAppPrivate is used to initialize the pAppPrivate member of the
- buffer header structure.
- @param [in] nSizeBytes
- size of the buffer to allocate. Used when bAllocateNew is true.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp buf
- */
-#define OMX_AllocateBuffer( \
- hComponent, \
- ppBuffer, \
- nPortIndex, \
- pAppPrivate, \
- nSizeBytes) \
- ((OMX_COMPONENTTYPE*)hComponent)->AllocateBuffer( \
- hComponent, \
- ppBuffer, \
- nPortIndex, \
- pAppPrivate, \
- nSizeBytes) /* Macro End */
-
-
-/** The OMX_FreeBuffer macro will release a buffer header from the component
- which was allocated using either OMX_AllocateBuffer or OMX_UseBuffer. If
- the component allocated the buffer (see the OMX_UseBuffer macro) then
- the component shall free the buffer and buffer header. This is a
- blocking call.
-
- The component should return from this call within 20 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [in] nPortIndex
- nPortIndex is used to select the port on the component the buffer will
- be used with.
- @param [in] pBuffer
- pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
- or AllocateBuffer.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp buf
- */
-#define OMX_FreeBuffer( \
- hComponent, \
- nPortIndex, \
- pBuffer) \
- ((OMX_COMPONENTTYPE*)hComponent)->FreeBuffer( \
- hComponent, \
- nPortIndex, \
- pBuffer) /* Macro End */
-
-
-/** The OMX_EmptyThisBuffer macro will send a buffer full of data to an
- input port of a component. The buffer will be emptied by the component
- and returned to the application via the EmptyBufferDone call back.
- This is a non-blocking call in that the component will record the buffer
- and return immediately and then empty the buffer, later, at the proper
- time. As expected, this macro may be invoked only while the component
- is in the OMX_StateExecuting. If nPortIndex does not specify an input
- port, the component shall return an error.
-
- The component should return from this call within 5 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [in] pBuffer
- pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
- or AllocateBuffer.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp buf
- */
-#define OMX_EmptyThisBuffer( \
- hComponent, \
- pBuffer) \
- ((OMX_COMPONENTTYPE*)hComponent)->EmptyThisBuffer( \
- hComponent, \
- pBuffer) /* Macro End */
-
-
-/** The OMX_FillThisBuffer macro will send an empty buffer to an
- output port of a component. The buffer will be filled by the component
- and returned to the application via the FillBufferDone call back.
- This is a non-blocking call in that the component will record the buffer
- and return immediately and then fill the buffer, later, at the proper
- time. As expected, this macro may be invoked only while the component
- is in the OMX_ExecutingState. If nPortIndex does not specify an output
- port, the component shall return an error.
-
- The component should return from this call within 5 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [in] pBuffer
- pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
- or AllocateBuffer.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp buf
- */
-#define OMX_FillThisBuffer( \
- hComponent, \
- pBuffer) \
- ((OMX_COMPONENTTYPE*)hComponent)->FillThisBuffer( \
- hComponent, \
- pBuffer) /* Macro End */
-
-
-
-/** The OMX_UseEGLImage macro will request that the component use
- a EGLImage provided by EGL (and allocate its own buffer header)
- This is a blocking call.
-
- The component should return from this call within 20 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [out] ppBuffer
- pointer to an OMX_BUFFERHEADERTYPE structure used to receive the
- pointer to the buffer header. Note that the memory location used
- for this buffer is NOT visible to the IL Client.
- @param [in] nPortIndex
- nPortIndex is used to select the port on the component the buffer will
- be used with. The port can be found by using the nPortIndex
- value as an index into the Port Definition array of the component.
- @param [in] pAppPrivate
- pAppPrivate is used to initialize the pAppPrivate member of the
- buffer header structure.
- @param [in] eglImage
- eglImage contains the handle of the EGLImage to use as a buffer on the
- specified port. The component is expected to validate properties of
- the EGLImage against the configuration of the port to ensure the component
- can use the EGLImage as a buffer.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp buf
- */
-#define OMX_UseEGLImage( \
- hComponent, \
- ppBufferHdr, \
- nPortIndex, \
- pAppPrivate, \
- eglImage) \
- ((OMX_COMPONENTTYPE*)hComponent)->UseEGLImage( \
- hComponent, \
- ppBufferHdr, \
- nPortIndex, \
- pAppPrivate, \
- eglImage)
-
-/** The OMX_Init method is used to initialize the OMX core. It shall be the
- first call made into OMX and it should only be executed one time without
- an interviening OMX_Deinit call.
-
- The core should return from this call within 20 msec.
-
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Init(void);
-
-
-/** The OMX_Deinit method is used to deinitialize the OMX core. It shall be
- the last call made into OMX. In the event that the core determines that
- thare are components loaded when this call is made, the core may return
- with an error rather than try to unload the components.
-
- The core should return from this call within 20 msec.
-
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Deinit(void);
-
-
-/** The OMX_ComponentNameEnum method will enumerate through all the names of
- recognised valid components in the system. This function is provided
- as a means to detect all the components in the system run-time. There is
- no strict ordering to the enumeration order of component names, although
- each name will only be enumerated once. If the OMX core supports run-time
- installation of new components, it is only requried to detect newly
- installed components when the first call to enumerate component names
- is made (i.e. when nIndex is 0x0).
-
- The core should return from this call in 20 msec.
-
- @param [out] cComponentName
- pointer to a null terminated string with the component name. The
- names of the components are strings less than 127 bytes in length
- plus the trailing null for a maximum size of 128 bytes. An example
- of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0". Names are
- assigned by the vendor, but shall start with "OMX." and then have
- the Vendor designation next.
- @param [in] nNameLength
- number of characters in the cComponentName string. With all
- component name strings restricted to less than 128 characters
- (including the trailing null) it is recomended that the caller
- provide a input string for the cComponentName of 128 characters.
- @param [in] nIndex
- number containing the enumeration index for the component.
- Multiple calls to OMX_ComponentNameEnum with increasing values
- of nIndex will enumerate through the component names in the
- system until OMX_ErrorNoMore is returned. The value of nIndex
- is 0 to (N-1), where N is the number of valid installed components
- in the system.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. When the value of nIndex exceeds the number of
- components in the system minus 1, OMX_ErrorNoMore will be
- returned. Otherwise the appropriate OMX error will be returned.
- @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_ComponentNameEnum(
- OMX_OUT OMX_STRING cComponentName,
- OMX_IN OMX_U32 nNameLength,
- OMX_IN OMX_U32 nIndex);
-
-
-/** The OMX_GetHandle method will locate the component specified by the
- component name given, load that component into memory and then invoke
- the component's methods to create an instance of the component.
-
- The core should return from this call within 20 msec.
-
- @param [out] pHandle
- pointer to an OMX_HANDLETYPE pointer to be filled in by this method.
- @param [in] cComponentName
- pointer to a null terminated string with the component name. The
- names of the components are strings less than 127 bytes in length
- plus the trailing null for a maximum size of 128 bytes. An example
- of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0". Names are
- assigned by the vendor, but shall start with "OMX." and then have
- the Vendor designation next.
- @param [in] pAppData
- pointer to an application defined value that will be returned
- during callbacks so that the application can identify the source
- of the callback.
- @param [in] pCallBacks
- pointer to a OMX_CALLBACKTYPE structure that will be passed to the
- component to initialize it with.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_GetHandle(
- OMX_OUT OMX_HANDLETYPE* pHandle,
- OMX_IN OMX_STRING cComponentName,
- OMX_IN OMX_PTR pAppData,
- OMX_IN OMX_CALLBACKTYPE* pCallBacks);
-
-
-/** The OMX_FreeHandle method will free a handle allocated by the OMX_GetHandle
- method. If the component reference count goes to zero, the component will
- be unloaded from memory.
-
- The core should return from this call within 20 msec when the component is
- in the OMX_StateLoaded state.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the GetHandle function.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_FreeHandle(
- OMX_IN OMX_HANDLETYPE hComponent);
-
-
-
-/** The OMX_SetupTunnel method will handle the necessary calls to the components
- to setup the specified tunnel the two components. NOTE: This is
- an actual method (not a #define macro). This method will make calls into
- the component ComponentTunnelRequest method to do the actual tunnel
- connection.
-
- The ComponentTunnelRequest method on both components will be called.
- This method shall not be called unless the component is in the
- OMX_StateLoaded state except when the ports used for the tunnel are
- disabled. In this case, the component may be in the OMX_StateExecuting,
- OMX_StatePause, or OMX_StateIdle states.
-
- The core should return from this call within 20 msec.
-
- @param [in] hOutput
- Handle of the component to be accessed. Also this is the handle
- of the component whose port, specified in the nPortOutput parameter
- will be used the source for the tunnel. This is the component handle
- returned by the call to the OMX_GetHandle function. There is a
- requirement that hOutput be the source for the data when
- tunelling (i.e. nPortOutput is an output port). If 0x0, the component
- specified in hInput will have it's port specified in nPortInput
- setup for communication with the application / IL client.
- @param [in] nPortOutput
- nPortOutput is used to select the source port on component to be
- used in the tunnel.
- @param [in] hInput
- This is the component to setup the tunnel with. This is the handle
- of the component whose port, specified in the nPortInput parameter
- will be used the destination for the tunnel. This is the component handle
- returned by the call to the OMX_GetHandle function. There is a
- requirement that hInput be the destination for the data when
- tunelling (i.e. nPortInut is an input port). If 0x0, the component
- specified in hOutput will have it's port specified in nPortPOutput
- setup for communication with the application / IL client.
- @param [in] nPortInput
- nPortInput is used to select the destination port on component to be
- used in the tunnel.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- When OMX_ErrorNotImplemented is returned, one or both components is
- a non-interop component and does not support tunneling.
-
- On failure, the ports of both components are setup for communication
- with the application / IL Client.
- @ingroup core tun
- */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_SetupTunnel(
- OMX_IN OMX_HANDLETYPE hOutput,
- OMX_IN OMX_U32 nPortOutput,
- OMX_IN OMX_HANDLETYPE hInput,
- OMX_IN OMX_U32 nPortInput);
-
-/** @ingroup cp */
-OMX_API OMX_ERRORTYPE OMX_GetContentPipe(
- OMX_OUT OMX_HANDLETYPE *hPipe,
- OMX_IN OMX_STRING szURI);
-
-/** The OMX_GetComponentsOfRole method will return the number of components that support the given
- role and (if the compNames field is non-NULL) the names of those components. The call will fail if
- an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the
- client should:
- * first call this function with the compNames field NULL to determine the number of component names
- * second call this function with the compNames field pointing to an array of names allocated
- according to the number returned by the first call.
-
- The core should return from this call within 5 msec.
-
- @param [in] role
- This is generic standard component name consisting only of component class
- name and the type within that class (e.g. 'audio_decoder.aac').
- @param [inout] pNumComps
- This is used both as input and output.
-
- If compNames is NULL, the input is ignored and the output specifies how many components support
- the given role.
-
- If compNames is not NULL, on input it bounds the size of the input structure and
- on output, it specifies the number of components string names listed within the compNames parameter.
- @param [inout] compNames
- If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings which accepts
- a list of the names of all physical components that implement the specified standard component name.
- Each name is NULL terminated. numComps indicates the number of names.
- @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_GetComponentsOfRole (
- OMX_IN OMX_STRING role,
- OMX_INOUT OMX_U32 *pNumComps,
- OMX_INOUT OMX_U8 **compNames);
-
-/** The OMX_GetRolesOfComponent method will return the number of roles supported by the given
- component and (if the roles field is non-NULL) the names of those roles. The call will fail if
- an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the
- client should:
- * first call this function with the roles field NULL to determine the number of role names
- * second call this function with the roles field pointing to an array of names allocated
- according to the number returned by the first call.
-
- The core should return from this call within 5 msec.
-
- @param [in] compName
- This is the name of the component being queried about.
- @param [inout] pNumRoles
- This is used both as input and output.
-
- If roles is NULL, the input is ignored and the output specifies how many roles the component supports.
-
- If compNames is not NULL, on input it bounds the size of the input structure and
- on output, it specifies the number of roles string names listed within the roles parameter.
- @param [out] roles
- If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings
- which accepts a list of the names of all standard components roles implemented on the
- specified component name. numComps indicates the number of names.
- @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_GetRolesOfComponent (
- OMX_IN OMX_STRING compName,
- OMX_INOUT OMX_U32 *pNumRoles,
- OMX_OUT OMX_U8 **roles);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
-
diff --git a/include/media/stagefright/openmax/OMX_IVCommon.h b/include/media/stagefright/openmax/OMX_IVCommon.h
deleted file mode 100644
index 8bb4ded..0000000
--- a/include/media/stagefright/openmax/OMX_IVCommon.h
+++ /dev/null
@@ -1,947 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/**
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is 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 Software.
- *
- * THE SOFTWARE IS 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
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/**
- * @file OMX_IVCommon.h - OpenMax IL version 1.1.2
- * The structures needed by Video and Image components to exchange
- * parameters and configuration data with the components.
- */
-#ifndef OMX_IVCommon_h
-#define OMX_IVCommon_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/**
- * Each OMX header must include all required header files to allow the header
- * to compile without errors. The includes below are required for this header
- * file to compile successfully
- */
-
-#include <OMX_Core.h>
-
-/** @defgroup iv OpenMAX IL Imaging and Video Domain
- * Common structures for OpenMAX IL Imaging and Video domains
- * @{
- */
-
-
-/**
- * Enumeration defining possible uncompressed image/video formats.
- *
- * ENUMS:
- * Unused : Placeholder value when format is N/A
- * Monochrome : black and white
- * 8bitRGB332 : Red 7:5, Green 4:2, Blue 1:0
- * 12bitRGB444 : Red 11:8, Green 7:4, Blue 3:0
- * 16bitARGB4444 : Alpha 15:12, Red 11:8, Green 7:4, Blue 3:0
- * 16bitARGB1555 : Alpha 15, Red 14:10, Green 9:5, Blue 4:0
- * 16bitRGB565 : Red 15:11, Green 10:5, Blue 4:0
- * 16bitBGR565 : Blue 15:11, Green 10:5, Red 4:0
- * 18bitRGB666 : Red 17:12, Green 11:6, Blue 5:0
- * 18bitARGB1665 : Alpha 17, Red 16:11, Green 10:5, Blue 4:0
- * 19bitARGB1666 : Alpha 18, Red 17:12, Green 11:6, Blue 5:0
- * 24bitRGB888 : Red 24:16, Green 15:8, Blue 7:0
- * 24bitBGR888 : Blue 24:16, Green 15:8, Red 7:0
- * 24bitARGB1887 : Alpha 23, Red 22:15, Green 14:7, Blue 6:0
- * 25bitARGB1888 : Alpha 24, Red 23:16, Green 15:8, Blue 7:0
- * 32bitBGRA8888 : Blue 31:24, Green 23:16, Red 15:8, Alpha 7:0
- * 32bitARGB8888 : Alpha 31:24, Red 23:16, Green 15:8, Blue 7:0
- * YUV411Planar : U,Y are subsampled by a factor of 4 horizontally
- * YUV411PackedPlanar : packed per payload in planar slices
- * YUV420Planar : Three arrays Y,U,V.
- * YUV420PackedPlanar : packed per payload in planar slices
- * YUV420SemiPlanar : Two arrays, one is all Y, the other is U and V
- * YUV422Planar : Three arrays Y,U,V.
- * YUV422PackedPlanar : packed per payload in planar slices
- * YUV422SemiPlanar : Two arrays, one is all Y, the other is U and V
- * YCbYCr : Organized as 16bit YUYV (i.e. YCbYCr)
- * YCrYCb : Organized as 16bit YVYU (i.e. YCrYCb)
- * CbYCrY : Organized as 16bit UYVY (i.e. CbYCrY)
- * CrYCbY : Organized as 16bit VYUY (i.e. CrYCbY)
- * YUV444Interleaved : Each pixel contains equal parts YUV
- * RawBayer8bit : SMIA camera output format
- * RawBayer10bit : SMIA camera output format
- * RawBayer8bitcompressed : SMIA camera output format
- */
-typedef enum OMX_COLOR_FORMATTYPE {
- OMX_COLOR_FormatUnused,
- OMX_COLOR_FormatMonochrome,
- OMX_COLOR_Format8bitRGB332,
- OMX_COLOR_Format12bitRGB444,
- OMX_COLOR_Format16bitARGB4444,
- OMX_COLOR_Format16bitARGB1555,
- OMX_COLOR_Format16bitRGB565,
- OMX_COLOR_Format16bitBGR565,
- OMX_COLOR_Format18bitRGB666,
- OMX_COLOR_Format18bitARGB1665,
- OMX_COLOR_Format19bitARGB1666,
- OMX_COLOR_Format24bitRGB888,
- OMX_COLOR_Format24bitBGR888,
- OMX_COLOR_Format24bitARGB1887,
- OMX_COLOR_Format25bitARGB1888,
- OMX_COLOR_Format32bitBGRA8888,
- OMX_COLOR_Format32bitARGB8888,
- OMX_COLOR_FormatYUV411Planar,
- OMX_COLOR_FormatYUV411PackedPlanar,
- OMX_COLOR_FormatYUV420Planar,
- OMX_COLOR_FormatYUV420PackedPlanar,
- OMX_COLOR_FormatYUV420SemiPlanar,
- OMX_COLOR_FormatYUV422Planar,
- OMX_COLOR_FormatYUV422PackedPlanar,
- OMX_COLOR_FormatYUV422SemiPlanar,
- OMX_COLOR_FormatYCbYCr,
- OMX_COLOR_FormatYCrYCb,
- OMX_COLOR_FormatCbYCrY,
- OMX_COLOR_FormatCrYCbY,
- OMX_COLOR_FormatYUV444Interleaved,
- OMX_COLOR_FormatRawBayer8bit,
- OMX_COLOR_FormatRawBayer10bit,
- OMX_COLOR_FormatRawBayer8bitcompressed,
- OMX_COLOR_FormatL2,
- OMX_COLOR_FormatL4,
- OMX_COLOR_FormatL8,
- OMX_COLOR_FormatL16,
- OMX_COLOR_FormatL24,
- OMX_COLOR_FormatL32,
- OMX_COLOR_FormatYUV420PackedSemiPlanar,
- OMX_COLOR_FormatYUV422PackedSemiPlanar,
- OMX_COLOR_Format18BitBGR666,
- OMX_COLOR_Format24BitARGB6666,
- OMX_COLOR_Format24BitABGR6666,
- OMX_COLOR_FormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_COLOR_FormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- /**<Reserved android opaque colorformat. Tells the encoder that
- * the actual colorformat will be relayed by the
- * Gralloc Buffers.
- * FIXME: In the process of reserving some enum values for
- * Android-specific OMX IL colorformats. Change this enum to
- * an acceptable range once that is done.
- * */
- OMX_COLOR_FormatAndroidOpaque = 0x7F000789,
- OMX_TI_COLOR_FormatYUV420PackedSemiPlanar = 0x7F000100,
- OMX_QCOM_COLOR_FormatYVU420SemiPlanar = 0x7FA30C00,
- OMX_COLOR_FormatMax = 0x7FFFFFFF
-} OMX_COLOR_FORMATTYPE;
-
-
-/**
- * Defines the matrix for conversion from RGB to YUV or vice versa.
- * iColorMatrix should be initialized with the fixed point values
- * used in converting between formats.
- */
-typedef struct OMX_CONFIG_COLORCONVERSIONTYPE {
- OMX_U32 nSize; /**< Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version info */
- OMX_U32 nPortIndex; /**< Port that this struct applies to */
- OMX_S32 xColorMatrix[3][3]; /**< Stored in signed Q16 format */
- OMX_S32 xColorOffset[4]; /**< Stored in signed Q16 format */
-}OMX_CONFIG_COLORCONVERSIONTYPE;
-
-
-/**
- * Structure defining percent to scale each frame dimension. For example:
- * To make the width 50% larger, use fWidth = 1.5 and to make the width
- * 1/2 the original size, use fWidth = 0.5
- */
-typedef struct OMX_CONFIG_SCALEFACTORTYPE {
- OMX_U32 nSize; /**< Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version info */
- OMX_U32 nPortIndex; /**< Port that this struct applies to */
- OMX_S32 xWidth; /**< Fixed point value stored as Q16 */
- OMX_S32 xHeight; /**< Fixed point value stored as Q16 */
-}OMX_CONFIG_SCALEFACTORTYPE;
-
-
-/**
- * Enumeration of possible image filter types
- */
-typedef enum OMX_IMAGEFILTERTYPE {
- OMX_ImageFilterNone,
- OMX_ImageFilterNoise,
- OMX_ImageFilterEmboss,
- OMX_ImageFilterNegative,
- OMX_ImageFilterSketch,
- OMX_ImageFilterOilPaint,
- OMX_ImageFilterHatch,
- OMX_ImageFilterGpen,
- OMX_ImageFilterAntialias,
- OMX_ImageFilterDeRing,
- OMX_ImageFilterSolarize,
- OMX_ImageFilterKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_ImageFilterVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_ImageFilterMax = 0x7FFFFFFF
-} OMX_IMAGEFILTERTYPE;
-
-
-/**
- * Image filter configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eImageFilter : Image filter type enumeration
- */
-typedef struct OMX_CONFIG_IMAGEFILTERTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_IMAGEFILTERTYPE eImageFilter;
-} OMX_CONFIG_IMAGEFILTERTYPE;
-
-
-/**
- * Customized U and V for color enhancement
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * bColorEnhancement : Enable/disable color enhancement
- * nCustomizedU : Practical values: 16-240, range: 0-255, value set for
- * U component
- * nCustomizedV : Practical values: 16-240, range: 0-255, value set for
- * V component
- */
-typedef struct OMX_CONFIG_COLORENHANCEMENTTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL bColorEnhancement;
- OMX_U8 nCustomizedU;
- OMX_U8 nCustomizedV;
-} OMX_CONFIG_COLORENHANCEMENTTYPE;
-
-
-/**
- * Define color key and color key mask
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nARGBColor : 32bit Alpha, Red, Green, Blue Color
- * nARGBMask : 32bit Mask for Alpha, Red, Green, Blue channels
- */
-typedef struct OMX_CONFIG_COLORKEYTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nARGBColor;
- OMX_U32 nARGBMask;
-} OMX_CONFIG_COLORKEYTYPE;
-
-
-/**
- * List of color blend types for pre/post processing
- *
- * ENUMS:
- * None : No color blending present
- * AlphaConstant : Function is (alpha_constant * src) +
- * (1 - alpha_constant) * dst)
- * AlphaPerPixel : Function is (alpha * src) + (1 - alpha) * dst)
- * Alternate : Function is alternating pixels from src and dst
- * And : Function is (src & dst)
- * Or : Function is (src | dst)
- * Invert : Function is ~src
- */
-typedef enum OMX_COLORBLENDTYPE {
- OMX_ColorBlendNone,
- OMX_ColorBlendAlphaConstant,
- OMX_ColorBlendAlphaPerPixel,
- OMX_ColorBlendAlternate,
- OMX_ColorBlendAnd,
- OMX_ColorBlendOr,
- OMX_ColorBlendInvert,
- OMX_ColorBlendKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_ColorBlendVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_ColorBlendMax = 0x7FFFFFFF
-} OMX_COLORBLENDTYPE;
-
-
-/**
- * Color blend configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nRGBAlphaConstant : Constant global alpha values when global alpha is used
- * eColorBlend : Color blend type enumeration
- */
-typedef struct OMX_CONFIG_COLORBLENDTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nRGBAlphaConstant;
- OMX_COLORBLENDTYPE eColorBlend;
-} OMX_CONFIG_COLORBLENDTYPE;
-
-
-/**
- * Hold frame dimension
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nWidth : Frame width in pixels
- * nHeight : Frame height in pixels
- */
-typedef struct OMX_FRAMESIZETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nWidth;
- OMX_U32 nHeight;
-} OMX_FRAMESIZETYPE;
-
-
-/**
- * Rotation configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nRotation : +/- integer rotation value
- */
-typedef struct OMX_CONFIG_ROTATIONTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_S32 nRotation;
-} OMX_CONFIG_ROTATIONTYPE;
-
-
-/**
- * Possible mirroring directions for pre/post processing
- *
- * ENUMS:
- * None : No mirroring
- * Vertical : Vertical mirroring, flip on X axis
- * Horizontal : Horizontal mirroring, flip on Y axis
- * Both : Both vertical and horizontal mirroring
- */
-typedef enum OMX_MIRRORTYPE {
- OMX_MirrorNone = 0,
- OMX_MirrorVertical,
- OMX_MirrorHorizontal,
- OMX_MirrorBoth,
- OMX_MirrorKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_MirrorVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_MirrorMax = 0x7FFFFFFF
-} OMX_MIRRORTYPE;
-
-
-/**
- * Mirroring configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eMirror : Mirror type enumeration
- */
-typedef struct OMX_CONFIG_MIRRORTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_MIRRORTYPE eMirror;
-} OMX_CONFIG_MIRRORTYPE;
-
-
-/**
- * Position information only
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nX : X coordinate for the point
- * nY : Y coordinate for the point
- */
-typedef struct OMX_CONFIG_POINTTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_S32 nX;
- OMX_S32 nY;
-} OMX_CONFIG_POINTTYPE;
-
-
-/**
- * Frame size plus position
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nLeft : X Coordinate of the top left corner of the rectangle
- * nTop : Y Coordinate of the top left corner of the rectangle
- * nWidth : Width of the rectangle
- * nHeight : Height of the rectangle
- */
-typedef struct OMX_CONFIG_RECTTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_S32 nLeft;
- OMX_S32 nTop;
- OMX_U32 nWidth;
- OMX_U32 nHeight;
-} OMX_CONFIG_RECTTYPE;
-
-
-/**
- * Deblocking state; it is required to be set up before starting the codec
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * bDeblocking : Enable/disable deblocking mode
- */
-typedef struct OMX_PARAM_DEBLOCKINGTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL bDeblocking;
-} OMX_PARAM_DEBLOCKINGTYPE;
-
-
-/**
- * Stabilization state
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * bStab : Enable/disable frame stabilization state
- */
-typedef struct OMX_CONFIG_FRAMESTABTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL bStab;
-} OMX_CONFIG_FRAMESTABTYPE;
-
-
-/**
- * White Balance control type
- *
- * STRUCT MEMBERS:
- * SunLight : Referenced in JSR-234
- * Flash : Optimal for device's integrated flash
- */
-typedef enum OMX_WHITEBALCONTROLTYPE {
- OMX_WhiteBalControlOff = 0,
- OMX_WhiteBalControlAuto,
- OMX_WhiteBalControlSunLight,
- OMX_WhiteBalControlCloudy,
- OMX_WhiteBalControlShade,
- OMX_WhiteBalControlTungsten,
- OMX_WhiteBalControlFluorescent,
- OMX_WhiteBalControlIncandescent,
- OMX_WhiteBalControlFlash,
- OMX_WhiteBalControlHorizon,
- OMX_WhiteBalControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_WhiteBalControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_WhiteBalControlMax = 0x7FFFFFFF
-} OMX_WHITEBALCONTROLTYPE;
-
-
-/**
- * White Balance control configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eWhiteBalControl : White balance enumeration
- */
-typedef struct OMX_CONFIG_WHITEBALCONTROLTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_WHITEBALCONTROLTYPE eWhiteBalControl;
-} OMX_CONFIG_WHITEBALCONTROLTYPE;
-
-
-/**
- * Exposure control type
- */
-typedef enum OMX_EXPOSURECONTROLTYPE {
- OMX_ExposureControlOff = 0,
- OMX_ExposureControlAuto,
- OMX_ExposureControlNight,
- OMX_ExposureControlBackLight,
- OMX_ExposureControlSpotLight,
- OMX_ExposureControlSports,
- OMX_ExposureControlSnow,
- OMX_ExposureControlBeach,
- OMX_ExposureControlLargeAperture,
- OMX_ExposureControlSmallApperture,
- OMX_ExposureControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_ExposureControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_ExposureControlMax = 0x7FFFFFFF
-} OMX_EXPOSURECONTROLTYPE;
-
-
-/**
- * White Balance control configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eExposureControl : Exposure control enumeration
- */
-typedef struct OMX_CONFIG_EXPOSURECONTROLTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_EXPOSURECONTROLTYPE eExposureControl;
-} OMX_CONFIG_EXPOSURECONTROLTYPE;
-
-
-/**
- * Defines sensor supported mode.
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nFrameRate : Single shot mode is indicated by a 0
- * bOneShot : Enable for single shot, disable for streaming
- * sFrameSize : Framesize
- */
-typedef struct OMX_PARAM_SENSORMODETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nFrameRate;
- OMX_BOOL bOneShot;
- OMX_FRAMESIZETYPE sFrameSize;
-} OMX_PARAM_SENSORMODETYPE;
-
-
-/**
- * Defines contrast level
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nContrast : Values allowed for contrast -100 to 100, zero means no change
- */
-typedef struct OMX_CONFIG_CONTRASTTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_S32 nContrast;
-} OMX_CONFIG_CONTRASTTYPE;
-
-
-/**
- * Defines brightness level
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nBrightness : 0-100%
- */
-typedef struct OMX_CONFIG_BRIGHTNESSTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nBrightness;
-} OMX_CONFIG_BRIGHTNESSTYPE;
-
-
-/**
- * Defines backlight level configuration for a video sink, e.g. LCD panel
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nBacklight : Values allowed for backlight 0-100%
- * nTimeout : Number of milliseconds before backlight automatically turns
- * off. A value of 0x0 disables backight timeout
- */
-typedef struct OMX_CONFIG_BACKLIGHTTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nBacklight;
- OMX_U32 nTimeout;
-} OMX_CONFIG_BACKLIGHTTYPE;
-
-
-/**
- * Defines setting for Gamma
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nGamma : Values allowed for gamma -100 to 100, zero means no change
- */
-typedef struct OMX_CONFIG_GAMMATYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_S32 nGamma;
-} OMX_CONFIG_GAMMATYPE;
-
-
-/**
- * Define for setting saturation
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nSaturation : Values allowed for saturation -100 to 100, zero means
- * no change
- */
-typedef struct OMX_CONFIG_SATURATIONTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_S32 nSaturation;
-} OMX_CONFIG_SATURATIONTYPE;
-
-
-/**
- * Define for setting Lightness
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nLightness : Values allowed for lightness -100 to 100, zero means no
- * change
- */
-typedef struct OMX_CONFIG_LIGHTNESSTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_S32 nLightness;
-} OMX_CONFIG_LIGHTNESSTYPE;
-
-
-/**
- * Plane blend configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Index of input port associated with the plane.
- * nDepth : Depth of the plane in relation to the screen. Higher
- * numbered depths are "behind" lower number depths.
- * This number defaults to the Port Index number.
- * nAlpha : Transparency blending component for the entire plane.
- * See blending modes for more detail.
- */
-typedef struct OMX_CONFIG_PLANEBLENDTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nDepth;
- OMX_U32 nAlpha;
-} OMX_CONFIG_PLANEBLENDTYPE;
-
-
-/**
- * Define interlace type
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * bEnable : Enable control variable for this functionality
- * (see below)
- * nInterleavePortIndex : Index of input or output port associated with
- * the interleaved plane.
- * pPlanarPortIndexes[4] : Index of input or output planar ports.
- */
-typedef struct OMX_PARAM_INTERLEAVETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL bEnable;
- OMX_U32 nInterleavePortIndex;
-} OMX_PARAM_INTERLEAVETYPE;
-
-
-/**
- * Defines the picture effect used for an input picture
- */
-typedef enum OMX_TRANSITIONEFFECTTYPE {
- OMX_EffectNone,
- OMX_EffectFadeFromBlack,
- OMX_EffectFadeToBlack,
- OMX_EffectUnspecifiedThroughConstantColor,
- OMX_EffectDissolve,
- OMX_EffectWipe,
- OMX_EffectUnspecifiedMixOfTwoScenes,
- OMX_EffectKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_EffectVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_EffectMax = 0x7FFFFFFF
-} OMX_TRANSITIONEFFECTTYPE;
-
-
-/**
- * Structure used to configure current transition effect
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eEffect : Effect to enable
- */
-typedef struct OMX_CONFIG_TRANSITIONEFFECTTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_TRANSITIONEFFECTTYPE eEffect;
-} OMX_CONFIG_TRANSITIONEFFECTTYPE;
-
-
-/**
- * Defines possible data unit types for encoded video data. The data unit
- * types are used both for encoded video input for playback as well as
- * encoded video output from recording.
- */
-typedef enum OMX_DATAUNITTYPE {
- OMX_DataUnitCodedPicture,
- OMX_DataUnitVideoSegment,
- OMX_DataUnitSeveralSegments,
- OMX_DataUnitArbitraryStreamSection,
- OMX_DataUnitKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_DataUnitVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_DataUnitMax = 0x7FFFFFFF
-} OMX_DATAUNITTYPE;
-
-
-/**
- * Defines possible encapsulation types for coded video data unit. The
- * encapsulation information is used both for encoded video input for
- * playback as well as encoded video output from recording.
- */
-typedef enum OMX_DATAUNITENCAPSULATIONTYPE {
- OMX_DataEncapsulationElementaryStream,
- OMX_DataEncapsulationGenericPayload,
- OMX_DataEncapsulationRtpPayload,
- OMX_DataEncapsulationKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_DataEncapsulationVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_DataEncapsulationMax = 0x7FFFFFFF
-} OMX_DATAUNITENCAPSULATIONTYPE;
-
-
-/**
- * Structure used to configure the type of being decoded/encoded
- */
-typedef struct OMX_PARAM_DATAUNITTYPE {
- OMX_U32 nSize; /**< Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port that this structure applies to */
- OMX_DATAUNITTYPE eUnitType;
- OMX_DATAUNITENCAPSULATIONTYPE eEncapsulationType;
-} OMX_PARAM_DATAUNITTYPE;
-
-
-/**
- * Defines dither types
- */
-typedef enum OMX_DITHERTYPE {
- OMX_DitherNone,
- OMX_DitherOrdered,
- OMX_DitherErrorDiffusion,
- OMX_DitherOther,
- OMX_DitherKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_DitherVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_DitherMax = 0x7FFFFFFF
-} OMX_DITHERTYPE;
-
-
-/**
- * Structure used to configure current type of dithering
- */
-typedef struct OMX_CONFIG_DITHERTYPE {
- OMX_U32 nSize; /**< Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port that this structure applies to */
- OMX_DITHERTYPE eDither; /**< Type of dithering to use */
-} OMX_CONFIG_DITHERTYPE;
-
-typedef struct OMX_CONFIG_CAPTUREMODETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex; /**< Port that this structure applies to */
- OMX_BOOL bContinuous; /**< If true then ignore frame rate and emit capture
- * data as fast as possible (otherwise obey port's frame rate). */
- OMX_BOOL bFrameLimited; /**< If true then terminate capture after the port emits the
- * specified number of frames (otherwise the port does not
- * terminate the capture until instructed to do so by the client).
- * Even if set, the client may manually terminate the capture prior
- * to reaching the limit. */
- OMX_U32 nFrameLimit; /**< Limit on number of frames emitted during a capture (only
- * valid if bFrameLimited is set). */
-} OMX_CONFIG_CAPTUREMODETYPE;
-
-typedef enum OMX_METERINGTYPE {
-
- OMX_MeteringModeAverage, /**< Center-weighted average metering. */
- OMX_MeteringModeSpot, /**< Spot (partial) metering. */
- OMX_MeteringModeMatrix, /**< Matrix or evaluative metering. */
-
- OMX_MeteringKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_MeteringVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_EVModeMax = 0x7fffffff
-} OMX_METERINGTYPE;
-
-typedef struct OMX_CONFIG_EXPOSUREVALUETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_METERINGTYPE eMetering;
- OMX_S32 xEVCompensation; /**< Fixed point value stored as Q16 */
- OMX_U32 nApertureFNumber; /**< e.g. nApertureFNumber = 2 implies "f/2" - Q16 format */
- OMX_BOOL bAutoAperture; /**< Whether aperture number is defined automatically */
- OMX_U32 nShutterSpeedMsec; /**< Shutterspeed in milliseconds */
- OMX_BOOL bAutoShutterSpeed; /**< Whether shutter speed is defined automatically */
- OMX_U32 nSensitivity; /**< e.g. nSensitivity = 100 implies "ISO 100" */
- OMX_BOOL bAutoSensitivity; /**< Whether sensitivity is defined automatically */
-} OMX_CONFIG_EXPOSUREVALUETYPE;
-
-/**
- * Focus region configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * bCenter : Use center region as focus region of interest
- * bLeft : Use left region as focus region of interest
- * bRight : Use right region as focus region of interest
- * bTop : Use top region as focus region of interest
- * bBottom : Use bottom region as focus region of interest
- * bTopLeft : Use top left region as focus region of interest
- * bTopRight : Use top right region as focus region of interest
- * bBottomLeft : Use bottom left region as focus region of interest
- * bBottomRight : Use bottom right region as focus region of interest
- */
-typedef struct OMX_CONFIG_FOCUSREGIONTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL bCenter;
- OMX_BOOL bLeft;
- OMX_BOOL bRight;
- OMX_BOOL bTop;
- OMX_BOOL bBottom;
- OMX_BOOL bTopLeft;
- OMX_BOOL bTopRight;
- OMX_BOOL bBottomLeft;
- OMX_BOOL bBottomRight;
-} OMX_CONFIG_FOCUSREGIONTYPE;
-
-/**
- * Focus Status type
- */
-typedef enum OMX_FOCUSSTATUSTYPE {
- OMX_FocusStatusOff = 0,
- OMX_FocusStatusRequest,
- OMX_FocusStatusReached,
- OMX_FocusStatusUnableToReach,
- OMX_FocusStatusLost,
- OMX_FocusStatusKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_FocusStatusVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_FocusStatusMax = 0x7FFFFFFF
-} OMX_FOCUSSTATUSTYPE;
-
-/**
- * Focus status configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eFocusStatus : Specifies the focus status
- * bCenterStatus : Use center region as focus region of interest
- * bLeftStatus : Use left region as focus region of interest
- * bRightStatus : Use right region as focus region of interest
- * bTopStatus : Use top region as focus region of interest
- * bBottomStatus : Use bottom region as focus region of interest
- * bTopLeftStatus : Use top left region as focus region of interest
- * bTopRightStatus : Use top right region as focus region of interest
- * bBottomLeftStatus : Use bottom left region as focus region of interest
- * bBottomRightStatus : Use bottom right region as focus region of interest
- */
-typedef struct OMX_PARAM_FOCUSSTATUSTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_FOCUSSTATUSTYPE eFocusStatus;
- OMX_BOOL bCenterStatus;
- OMX_BOOL bLeftStatus;
- OMX_BOOL bRightStatus;
- OMX_BOOL bTopStatus;
- OMX_BOOL bBottomStatus;
- OMX_BOOL bTopLeftStatus;
- OMX_BOOL bTopRightStatus;
- OMX_BOOL bBottomLeftStatus;
- OMX_BOOL bBottomRightStatus;
-} OMX_PARAM_FOCUSSTATUSTYPE;
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
diff --git a/include/media/stagefright/openmax/OMX_Image.h b/include/media/stagefright/openmax/OMX_Image.h
deleted file mode 100644
index 42e39ec..0000000
--- a/include/media/stagefright/openmax/OMX_Image.h
+++ /dev/null
@@ -1,345 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/**
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is 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 Software.
- *
- * THE SOFTWARE IS 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
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * @file OMX_Image.h - OpenMax IL version 1.1.2
- * The structures needed by Image components to exchange parameters and
- * configuration data with the components.
- */
-#ifndef OMX_Image_h
-#define OMX_Image_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/**
- * Each OMX header must include all required header files to allow the
- * header to compile without errors. The includes below are required
- * for this header file to compile successfully
- */
-
-#include <OMX_IVCommon.h>
-
-/** @defgroup imaging OpenMAX IL Imaging Domain
- * @ingroup iv
- * Structures for OpenMAX IL Imaging domain
- * @{
- */
-
-/**
- * Enumeration used to define the possible image compression coding.
- */
-typedef enum OMX_IMAGE_CODINGTYPE {
- OMX_IMAGE_CodingUnused, /**< Value when format is N/A */
- OMX_IMAGE_CodingAutoDetect, /**< Auto detection of image format */
- OMX_IMAGE_CodingJPEG, /**< JPEG/JFIF image format */
- OMX_IMAGE_CodingJPEG2K, /**< JPEG 2000 image format */
- OMX_IMAGE_CodingEXIF, /**< EXIF image format */
- OMX_IMAGE_CodingTIFF, /**< TIFF image format */
- OMX_IMAGE_CodingGIF, /**< Graphics image format */
- OMX_IMAGE_CodingPNG, /**< PNG image format */
- OMX_IMAGE_CodingLZW, /**< LZW image format */
- OMX_IMAGE_CodingBMP, /**< Windows Bitmap format */
- OMX_IMAGE_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_IMAGE_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_IMAGE_CodingMax = 0x7FFFFFFF
-} OMX_IMAGE_CODINGTYPE;
-
-
-/**
- * Data structure used to define an image path. The number of image paths
- * for input and output will vary by type of the image component.
- *
- * Input (aka Source) : Zero Inputs, one Output,
- * Splitter : One Input, 2 or more Outputs,
- * Processing Element : One Input, one output,
- * Mixer : 2 or more inputs, one output,
- * Output (aka Sink) : One Input, zero outputs.
- *
- * The PortDefinition structure is used to define all of the parameters
- * necessary for the compliant component to setup an input or an output
- * image path. If additional vendor specific data is required, it should
- * be transmitted to the component using the CustomCommand function.
- * Compliant components will prepopulate this structure with optimal
- * values during the OMX_GetParameter() command.
- *
- * STRUCT MEMBERS:
- * cMIMEType : MIME type of data for the port
- * pNativeRender : Platform specific reference for a display if a
- * sync, otherwise this field is 0
- * nFrameWidth : Width of frame to be used on port if
- * uncompressed format is used. Use 0 for
- * unknown, don't care or variable
- * nFrameHeight : Height of frame to be used on port if
- * uncompressed format is used. Use 0 for
- * unknown, don't care or variable
- * nStride : Number of bytes per span of an image (i.e.
- * indicates the number of bytes to get from
- * span N to span N+1, where negative stride
- * indicates the image is bottom up
- * nSliceHeight : Height used when encoding in slices
- * bFlagErrorConcealment : Turns on error concealment if it is supported by
- * the OMX component
- * eCompressionFormat : Compression format used in this instance of
- * the component. When OMX_IMAGE_CodingUnused is
- * specified, eColorFormat is valid
- * eColorFormat : Decompressed format used by this component
- * pNativeWindow : Platform specific reference for a window object if a
- * display sink , otherwise this field is 0x0.
- */
-typedef struct OMX_IMAGE_PORTDEFINITIONTYPE {
- OMX_STRING cMIMEType;
- OMX_NATIVE_DEVICETYPE pNativeRender;
- OMX_U32 nFrameWidth;
- OMX_U32 nFrameHeight;
- OMX_S32 nStride;
- OMX_U32 nSliceHeight;
- OMX_BOOL bFlagErrorConcealment;
- OMX_IMAGE_CODINGTYPE eCompressionFormat;
- OMX_COLOR_FORMATTYPE eColorFormat;
- OMX_NATIVE_WINDOWTYPE pNativeWindow;
-} OMX_IMAGE_PORTDEFINITIONTYPE;
-
-
-/**
- * Port format parameter. This structure is used to enumerate the various
- * data input/output format supported by the port.
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Indicates which port to set
- * nIndex : Indicates the enumeration index for the format from
- * 0x0 to N-1
- * eCompressionFormat : Compression format used in this instance of the
- * component. When OMX_IMAGE_CodingUnused is specified,
- * eColorFormat is valid
- * eColorFormat : Decompressed format used by this component
- */
-typedef struct OMX_IMAGE_PARAM_PORTFORMATTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nIndex;
- OMX_IMAGE_CODINGTYPE eCompressionFormat;
- OMX_COLOR_FORMATTYPE eColorFormat;
-} OMX_IMAGE_PARAM_PORTFORMATTYPE;
-
-
-/**
- * Flash control type
- *
- * ENUMS
- * Torch : Flash forced constantly on
- */
-typedef enum OMX_IMAGE_FLASHCONTROLTYPE {
- OMX_IMAGE_FlashControlOn = 0,
- OMX_IMAGE_FlashControlOff,
- OMX_IMAGE_FlashControlAuto,
- OMX_IMAGE_FlashControlRedEyeReduction,
- OMX_IMAGE_FlashControlFillin,
- OMX_IMAGE_FlashControlTorch,
- OMX_IMAGE_FlashControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_IMAGE_FlashControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_IMAGE_FlashControlMax = 0x7FFFFFFF
-} OMX_IMAGE_FLASHCONTROLTYPE;
-
-
-/**
- * Flash control configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eFlashControl : Flash control type
- */
-typedef struct OMX_IMAGE_PARAM_FLASHCONTROLTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_IMAGE_FLASHCONTROLTYPE eFlashControl;
-} OMX_IMAGE_PARAM_FLASHCONTROLTYPE;
-
-
-/**
- * Focus control type
- */
-typedef enum OMX_IMAGE_FOCUSCONTROLTYPE {
- OMX_IMAGE_FocusControlOn = 0,
- OMX_IMAGE_FocusControlOff,
- OMX_IMAGE_FocusControlAuto,
- OMX_IMAGE_FocusControlAutoLock,
- OMX_IMAGE_FocusControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_IMAGE_FocusControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_IMAGE_FocusControlMax = 0x7FFFFFFF
-} OMX_IMAGE_FOCUSCONTROLTYPE;
-
-
-/**
- * Focus control configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eFocusControl : Focus control
- * nFocusSteps : Focus can take on values from 0 mm to infinity.
- * Interest is only in number of steps over this range.
- * nFocusStepIndex : Current focus step index
- */
-typedef struct OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_IMAGE_FOCUSCONTROLTYPE eFocusControl;
- OMX_U32 nFocusSteps;
- OMX_U32 nFocusStepIndex;
-} OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE;
-
-
-/**
- * Q Factor for JPEG compression, which controls the tradeoff between image
- * quality and size. Q Factor provides a more simple means of controlling
- * JPEG compression quality, without directly programming Quantization
- * tables for chroma and luma
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nQFactor : JPEG Q factor value in the range of 1-100. A factor of 1
- * produces the smallest, worst quality images, and a factor
- * of 100 produces the largest, best quality images. A
- * typical default is 75 for small good quality images
- */
-typedef struct OMX_IMAGE_PARAM_QFACTORTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nQFactor;
-} OMX_IMAGE_PARAM_QFACTORTYPE;
-
-/**
- * Quantization table type
- */
-
-typedef enum OMX_IMAGE_QUANTIZATIONTABLETYPE {
- OMX_IMAGE_QuantizationTableLuma = 0,
- OMX_IMAGE_QuantizationTableChroma,
- OMX_IMAGE_QuantizationTableChromaCb,
- OMX_IMAGE_QuantizationTableChromaCr,
- OMX_IMAGE_QuantizationTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_IMAGE_QuantizationTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_IMAGE_QuantizationTableMax = 0x7FFFFFFF
-} OMX_IMAGE_QUANTIZATIONTABLETYPE;
-
-/**
- * JPEG quantization tables are used to determine DCT compression for
- * YUV data, as an alternative to specifying Q factor, providing exact
- * control of compression
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eQuantizationTable : Quantization table type
- * nQuantizationMatrix[64] : JPEG quantization table of coefficients stored
- * in increasing columns then by rows of data (i.e.
- * row 1, ... row 8). Quantization values are in
- * the range 0-255 and stored in linear order
- * (i.e. the component will zig-zag the
- * quantization table data if required internally)
- */
-typedef struct OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_IMAGE_QUANTIZATIONTABLETYPE eQuantizationTable;
- OMX_U8 nQuantizationMatrix[64];
-} OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE;
-
-
-/**
- * Huffman table type, the same Huffman table is applied for chroma and
- * luma component
- */
-typedef enum OMX_IMAGE_HUFFMANTABLETYPE {
- OMX_IMAGE_HuffmanTableAC = 0,
- OMX_IMAGE_HuffmanTableDC,
- OMX_IMAGE_HuffmanTableACLuma,
- OMX_IMAGE_HuffmanTableACChroma,
- OMX_IMAGE_HuffmanTableDCLuma,
- OMX_IMAGE_HuffmanTableDCChroma,
- OMX_IMAGE_HuffmanTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_IMAGE_HuffmanTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_IMAGE_HuffmanTableMax = 0x7FFFFFFF
-} OMX_IMAGE_HUFFMANTABLETYPE;
-
-/**
- * JPEG Huffman table
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eHuffmanTable : Huffman table type
- * nNumberOfHuffmanCodeOfLength[16] : 0-16, number of Huffman codes of each
- * possible length
- * nHuffmanTable[256] : 0-255, the size used for AC and DC
- * HuffmanTable are 16 and 162
- */
-typedef struct OMX_IMAGE_PARAM_HUFFMANTTABLETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_IMAGE_HUFFMANTABLETYPE eHuffmanTable;
- OMX_U8 nNumberOfHuffmanCodeOfLength[16];
- OMX_U8 nHuffmanTable[256];
-}OMX_IMAGE_PARAM_HUFFMANTTABLETYPE;
-
-/** @} */
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
diff --git a/include/media/stagefright/openmax/OMX_Index.h b/include/media/stagefright/openmax/OMX_Index.h
deleted file mode 100644
index c0b8d92..0000000
--- a/include/media/stagefright/openmax/OMX_Index.h
+++ /dev/null
@@ -1,275 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/*
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is 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 Software.
- *
- * THE SOFTWARE IS 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
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/** @file OMX_Index.h - OpenMax IL version 1.1.2
- * The OMX_Index header file contains the definitions for both applications
- * and components .
- */
-
-
-#ifndef OMX_Index_h
-#define OMX_Index_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* Each OMX header must include all required header files to allow the
- * header to compile without errors. The includes below are required
- * for this header file to compile successfully
- */
-#include <OMX_Types.h>
-
-
-/** The OMX_INDEXTYPE enumeration is used to select a structure when either
- * getting or setting parameters and/or configuration data. Each entry in
- * this enumeration maps to an OMX specified structure. When the
- * OMX_GetParameter, OMX_SetParameter, OMX_GetConfig or OMX_SetConfig methods
- * are used, the second parameter will always be an entry from this enumeration
- * and the third entry will be the structure shown in the comments for the entry.
- * For example, if the application is initializing a cropping function, the
- * OMX_SetConfig command would have OMX_IndexConfigCommonInputCrop as the second parameter
- * and would send a pointer to an initialized OMX_RECTTYPE structure as the
- * third parameter.
- *
- * The enumeration entries named with the OMX_Config prefix are sent using
- * the OMX_SetConfig command and the enumeration entries named with the
- * OMX_PARAM_ prefix are sent using the OMX_SetParameter command.
- */
-typedef enum OMX_INDEXTYPE {
-
- OMX_IndexComponentStartUnused = 0x01000000,
- OMX_IndexParamPriorityMgmt, /**< reference: OMX_PRIORITYMGMTTYPE */
- OMX_IndexParamAudioInit, /**< reference: OMX_PORT_PARAM_TYPE */
- OMX_IndexParamImageInit, /**< reference: OMX_PORT_PARAM_TYPE */
- OMX_IndexParamVideoInit, /**< reference: OMX_PORT_PARAM_TYPE */
- OMX_IndexParamOtherInit, /**< reference: OMX_PORT_PARAM_TYPE */
- OMX_IndexParamNumAvailableStreams, /**< reference: OMX_PARAM_U32TYPE */
- OMX_IndexParamActiveStream, /**< reference: OMX_PARAM_U32TYPE */
- OMX_IndexParamSuspensionPolicy, /**< reference: OMX_PARAM_SUSPENSIONPOLICYTYPE */
- OMX_IndexParamComponentSuspended, /**< reference: OMX_PARAM_SUSPENSIONTYPE */
- OMX_IndexConfigCapturing, /**< reference: OMX_CONFIG_BOOLEANTYPE */
- OMX_IndexConfigCaptureMode, /**< reference: OMX_CONFIG_CAPTUREMODETYPE */
- OMX_IndexAutoPauseAfterCapture, /**< reference: OMX_CONFIG_BOOLEANTYPE */
- OMX_IndexParamContentURI, /**< reference: OMX_PARAM_CONTENTURITYPE */
- OMX_IndexParamCustomContentPipe, /**< reference: OMX_PARAM_CONTENTPIPETYPE */
- OMX_IndexParamDisableResourceConcealment, /**< reference: OMX_RESOURCECONCEALMENTTYPE */
- OMX_IndexConfigMetadataItemCount, /**< reference: OMX_CONFIG_METADATAITEMCOUNTTYPE */
- OMX_IndexConfigContainerNodeCount, /**< reference: OMX_CONFIG_CONTAINERNODECOUNTTYPE */
- OMX_IndexConfigMetadataItem, /**< reference: OMX_CONFIG_METADATAITEMTYPE */
- OMX_IndexConfigCounterNodeID, /**< reference: OMX_CONFIG_CONTAINERNODEIDTYPE */
- OMX_IndexParamMetadataFilterType, /**< reference: OMX_PARAM_METADATAFILTERTYPE */
- OMX_IndexParamMetadataKeyFilter, /**< reference: OMX_PARAM_METADATAFILTERTYPE */
- OMX_IndexConfigPriorityMgmt, /**< reference: OMX_PRIORITYMGMTTYPE */
- OMX_IndexParamStandardComponentRole, /**< reference: OMX_PARAM_COMPONENTROLETYPE */
-
- OMX_IndexPortStartUnused = 0x02000000,
- OMX_IndexParamPortDefinition, /**< reference: OMX_PARAM_PORTDEFINITIONTYPE */
- OMX_IndexParamCompBufferSupplier, /**< reference: OMX_PARAM_BUFFERSUPPLIERTYPE */
- OMX_IndexReservedStartUnused = 0x03000000,
-
- /* Audio parameters and configurations */
- OMX_IndexAudioStartUnused = 0x04000000,
- OMX_IndexParamAudioPortFormat, /**< reference: OMX_AUDIO_PARAM_PORTFORMATTYPE */
- OMX_IndexParamAudioPcm, /**< reference: OMX_AUDIO_PARAM_PCMMODETYPE */
- OMX_IndexParamAudioAac, /**< reference: OMX_AUDIO_PARAM_AACPROFILETYPE */
- OMX_IndexParamAudioRa, /**< reference: OMX_AUDIO_PARAM_RATYPE */
- OMX_IndexParamAudioMp3, /**< reference: OMX_AUDIO_PARAM_MP3TYPE */
- OMX_IndexParamAudioAdpcm, /**< reference: OMX_AUDIO_PARAM_ADPCMTYPE */
- OMX_IndexParamAudioG723, /**< reference: OMX_AUDIO_PARAM_G723TYPE */
- OMX_IndexParamAudioG729, /**< reference: OMX_AUDIO_PARAM_G729TYPE */
- OMX_IndexParamAudioAmr, /**< reference: OMX_AUDIO_PARAM_AMRTYPE */
- OMX_IndexParamAudioWma, /**< reference: OMX_AUDIO_PARAM_WMATYPE */
- OMX_IndexParamAudioSbc, /**< reference: OMX_AUDIO_PARAM_SBCTYPE */
- OMX_IndexParamAudioMidi, /**< reference: OMX_AUDIO_PARAM_MIDITYPE */
- OMX_IndexParamAudioGsm_FR, /**< reference: OMX_AUDIO_PARAM_GSMFRTYPE */
- OMX_IndexParamAudioMidiLoadUserSound, /**< reference: OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE */
- OMX_IndexParamAudioG726, /**< reference: OMX_AUDIO_PARAM_G726TYPE */
- OMX_IndexParamAudioGsm_EFR, /**< reference: OMX_AUDIO_PARAM_GSMEFRTYPE */
- OMX_IndexParamAudioGsm_HR, /**< reference: OMX_AUDIO_PARAM_GSMHRTYPE */
- OMX_IndexParamAudioPdc_FR, /**< reference: OMX_AUDIO_PARAM_PDCFRTYPE */
- OMX_IndexParamAudioPdc_EFR, /**< reference: OMX_AUDIO_PARAM_PDCEFRTYPE */
- OMX_IndexParamAudioPdc_HR, /**< reference: OMX_AUDIO_PARAM_PDCHRTYPE */
- OMX_IndexParamAudioTdma_FR, /**< reference: OMX_AUDIO_PARAM_TDMAFRTYPE */
- OMX_IndexParamAudioTdma_EFR, /**< reference: OMX_AUDIO_PARAM_TDMAEFRTYPE */
- OMX_IndexParamAudioQcelp8, /**< reference: OMX_AUDIO_PARAM_QCELP8TYPE */
- OMX_IndexParamAudioQcelp13, /**< reference: OMX_AUDIO_PARAM_QCELP13TYPE */
- OMX_IndexParamAudioEvrc, /**< reference: OMX_AUDIO_PARAM_EVRCTYPE */
- OMX_IndexParamAudioSmv, /**< reference: OMX_AUDIO_PARAM_SMVTYPE */
- OMX_IndexParamAudioVorbis, /**< reference: OMX_AUDIO_PARAM_VORBISTYPE */
-
- OMX_IndexConfigAudioMidiImmediateEvent, /**< reference: OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE */
- OMX_IndexConfigAudioMidiControl, /**< reference: OMX_AUDIO_CONFIG_MIDICONTROLTYPE */
- OMX_IndexConfigAudioMidiSoundBankProgram, /**< reference: OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE */
- OMX_IndexConfigAudioMidiStatus, /**< reference: OMX_AUDIO_CONFIG_MIDISTATUSTYPE */
- OMX_IndexConfigAudioMidiMetaEvent, /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE */
- OMX_IndexConfigAudioMidiMetaEventData, /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTDATATYPE */
- OMX_IndexConfigAudioVolume, /**< reference: OMX_AUDIO_CONFIG_VOLUMETYPE */
- OMX_IndexConfigAudioBalance, /**< reference: OMX_AUDIO_CONFIG_BALANCETYPE */
- OMX_IndexConfigAudioChannelMute, /**< reference: OMX_AUDIO_CONFIG_CHANNELMUTETYPE */
- OMX_IndexConfigAudioMute, /**< reference: OMX_AUDIO_CONFIG_MUTETYPE */
- OMX_IndexConfigAudioLoudness, /**< reference: OMX_AUDIO_CONFIG_LOUDNESSTYPE */
- OMX_IndexConfigAudioEchoCancelation, /**< reference: OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE */
- OMX_IndexConfigAudioNoiseReduction, /**< reference: OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE */
- OMX_IndexConfigAudioBass, /**< reference: OMX_AUDIO_CONFIG_BASSTYPE */
- OMX_IndexConfigAudioTreble, /**< reference: OMX_AUDIO_CONFIG_TREBLETYPE */
- OMX_IndexConfigAudioStereoWidening, /**< reference: OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE */
- OMX_IndexConfigAudioChorus, /**< reference: OMX_AUDIO_CONFIG_CHORUSTYPE */
- OMX_IndexConfigAudioEqualizer, /**< reference: OMX_AUDIO_CONFIG_EQUALIZERTYPE */
- OMX_IndexConfigAudioReverberation, /**< reference: OMX_AUDIO_CONFIG_REVERBERATIONTYPE */
- OMX_IndexConfigAudioChannelVolume, /**< reference: OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE */
-
- /* Image specific parameters and configurations */
- OMX_IndexImageStartUnused = 0x05000000,
- OMX_IndexParamImagePortFormat, /**< reference: OMX_IMAGE_PARAM_PORTFORMATTYPE */
- OMX_IndexParamFlashControl, /**< reference: OMX_IMAGE_PARAM_FLASHCONTROLTYPE */
- OMX_IndexConfigFocusControl, /**< reference: OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE */
- OMX_IndexParamQFactor, /**< reference: OMX_IMAGE_PARAM_QFACTORTYPE */
- OMX_IndexParamQuantizationTable, /**< reference: OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE */
- OMX_IndexParamHuffmanTable, /**< reference: OMX_IMAGE_PARAM_HUFFMANTTABLETYPE */
- OMX_IndexConfigFlashControl, /**< reference: OMX_IMAGE_PARAM_FLASHCONTROLTYPE */
-
- /* Video specific parameters and configurations */
- OMX_IndexVideoStartUnused = 0x06000000,
- OMX_IndexParamVideoPortFormat, /**< reference: OMX_VIDEO_PARAM_PORTFORMATTYPE */
- OMX_IndexParamVideoQuantization, /**< reference: OMX_VIDEO_PARAM_QUANTIZATIONTYPE */
- OMX_IndexParamVideoFastUpdate, /**< reference: OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE */
- OMX_IndexParamVideoBitrate, /**< reference: OMX_VIDEO_PARAM_BITRATETYPE */
- OMX_IndexParamVideoMotionVector, /**< reference: OMX_VIDEO_PARAM_MOTIONVECTORTYPE */
- OMX_IndexParamVideoIntraRefresh, /**< reference: OMX_VIDEO_PARAM_INTRAREFRESHTYPE */
- OMX_IndexParamVideoErrorCorrection, /**< reference: OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE */
- OMX_IndexParamVideoVBSMC, /**< reference: OMX_VIDEO_PARAM_VBSMCTYPE */
- OMX_IndexParamVideoMpeg2, /**< reference: OMX_VIDEO_PARAM_MPEG2TYPE */
- OMX_IndexParamVideoMpeg4, /**< reference: OMX_VIDEO_PARAM_MPEG4TYPE */
- OMX_IndexParamVideoWmv, /**< reference: OMX_VIDEO_PARAM_WMVTYPE */
- OMX_IndexParamVideoRv, /**< reference: OMX_VIDEO_PARAM_RVTYPE */
- OMX_IndexParamVideoAvc, /**< reference: OMX_VIDEO_PARAM_AVCTYPE */
- OMX_IndexParamVideoH263, /**< reference: OMX_VIDEO_PARAM_H263TYPE */
- OMX_IndexParamVideoProfileLevelQuerySupported, /**< reference: OMX_VIDEO_PARAM_PROFILELEVELTYPE */
- OMX_IndexParamVideoProfileLevelCurrent, /**< reference: OMX_VIDEO_PARAM_PROFILELEVELTYPE */
- OMX_IndexConfigVideoBitrate, /**< reference: OMX_VIDEO_CONFIG_BITRATETYPE */
- OMX_IndexConfigVideoFramerate, /**< reference: OMX_CONFIG_FRAMERATETYPE */
- OMX_IndexConfigVideoIntraVOPRefresh, /**< reference: OMX_CONFIG_INTRAREFRESHVOPTYPE */
- OMX_IndexConfigVideoIntraMBRefresh, /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */
- OMX_IndexConfigVideoMBErrorReporting, /**< reference: OMX_CONFIG_MBERRORREPORTINGTYPE */
- OMX_IndexParamVideoMacroblocksPerFrame, /**< reference: OMX_PARAM_MACROBLOCKSTYPE */
- OMX_IndexConfigVideoMacroBlockErrorMap, /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */
- OMX_IndexParamVideoSliceFMO, /**< reference: OMX_VIDEO_PARAM_AVCSLICEFMO */
- OMX_IndexConfigVideoAVCIntraPeriod, /**< reference: OMX_VIDEO_CONFIG_AVCINTRAPERIOD */
- OMX_IndexConfigVideoNalSize, /**< reference: OMX_VIDEO_CONFIG_NALSIZE */
-
- /* Image & Video common Configurations */
- OMX_IndexCommonStartUnused = 0x07000000,
- OMX_IndexParamCommonDeblocking, /**< reference: OMX_PARAM_DEBLOCKINGTYPE */
- OMX_IndexParamCommonSensorMode, /**< reference: OMX_PARAM_SENSORMODETYPE */
- OMX_IndexParamCommonInterleave, /**< reference: OMX_PARAM_INTERLEAVETYPE */
- OMX_IndexConfigCommonColorFormatConversion, /**< reference: OMX_CONFIG_COLORCONVERSIONTYPE */
- OMX_IndexConfigCommonScale, /**< reference: OMX_CONFIG_SCALEFACTORTYPE */
- OMX_IndexConfigCommonImageFilter, /**< reference: OMX_CONFIG_IMAGEFILTERTYPE */
- OMX_IndexConfigCommonColorEnhancement, /**< reference: OMX_CONFIG_COLORENHANCEMENTTYPE */
- OMX_IndexConfigCommonColorKey, /**< reference: OMX_CONFIG_COLORKEYTYPE */
- OMX_IndexConfigCommonColorBlend, /**< reference: OMX_CONFIG_COLORBLENDTYPE */
- OMX_IndexConfigCommonFrameStabilisation,/**< reference: OMX_CONFIG_FRAMESTABTYPE */
- OMX_IndexConfigCommonRotate, /**< reference: OMX_CONFIG_ROTATIONTYPE */
- OMX_IndexConfigCommonMirror, /**< reference: OMX_CONFIG_MIRRORTYPE */
- OMX_IndexConfigCommonOutputPosition, /**< reference: OMX_CONFIG_POINTTYPE */
- OMX_IndexConfigCommonInputCrop, /**< reference: OMX_CONFIG_RECTTYPE */
- OMX_IndexConfigCommonOutputCrop, /**< reference: OMX_CONFIG_RECTTYPE */
- OMX_IndexConfigCommonDigitalZoom, /**< reference: OMX_CONFIG_SCALEFACTORTYPE */
- OMX_IndexConfigCommonOpticalZoom, /**< reference: OMX_CONFIG_SCALEFACTORTYPE*/
- OMX_IndexConfigCommonWhiteBalance, /**< reference: OMX_CONFIG_WHITEBALCONTROLTYPE */
- OMX_IndexConfigCommonExposure, /**< reference: OMX_CONFIG_EXPOSURECONTROLTYPE */
- OMX_IndexConfigCommonContrast, /**< reference: OMX_CONFIG_CONTRASTTYPE */
- OMX_IndexConfigCommonBrightness, /**< reference: OMX_CONFIG_BRIGHTNESSTYPE */
- OMX_IndexConfigCommonBacklight, /**< reference: OMX_CONFIG_BACKLIGHTTYPE */
- OMX_IndexConfigCommonGamma, /**< reference: OMX_CONFIG_GAMMATYPE */
- OMX_IndexConfigCommonSaturation, /**< reference: OMX_CONFIG_SATURATIONTYPE */
- OMX_IndexConfigCommonLightness, /**< reference: OMX_CONFIG_LIGHTNESSTYPE */
- OMX_IndexConfigCommonExclusionRect, /**< reference: OMX_CONFIG_RECTTYPE */
- OMX_IndexConfigCommonDithering, /**< reference: OMX_CONFIG_DITHERTYPE */
- OMX_IndexConfigCommonPlaneBlend, /**< reference: OMX_CONFIG_PLANEBLENDTYPE */
- OMX_IndexConfigCommonExposureValue, /**< reference: OMX_CONFIG_EXPOSUREVALUETYPE */
- OMX_IndexConfigCommonOutputSize, /**< reference: OMX_FRAMESIZETYPE */
- OMX_IndexParamCommonExtraQuantData, /**< reference: OMX_OTHER_EXTRADATATYPE */
- OMX_IndexConfigCommonFocusRegion, /**< reference: OMX_CONFIG_FOCUSREGIONTYPE */
- OMX_IndexConfigCommonFocusStatus, /**< reference: OMX_PARAM_FOCUSSTATUSTYPE */
- OMX_IndexConfigCommonTransitionEffect, /**< reference: OMX_CONFIG_TRANSITIONEFFECTTYPE */
-
- /* Reserved Configuration range */
- OMX_IndexOtherStartUnused = 0x08000000,
- OMX_IndexParamOtherPortFormat, /**< reference: OMX_OTHER_PARAM_PORTFORMATTYPE */
- OMX_IndexConfigOtherPower, /**< reference: OMX_OTHER_CONFIG_POWERTYPE */
- OMX_IndexConfigOtherStats, /**< reference: OMX_OTHER_CONFIG_STATSTYPE */
-
-
- /* Reserved Time range */
- OMX_IndexTimeStartUnused = 0x09000000,
- OMX_IndexConfigTimeScale, /**< reference: OMX_TIME_CONFIG_SCALETYPE */
- OMX_IndexConfigTimeClockState, /**< reference: OMX_TIME_CONFIG_CLOCKSTATETYPE */
- OMX_IndexConfigTimeActiveRefClock, /**< reference: OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE */
- OMX_IndexConfigTimeCurrentMediaTime, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only) */
- OMX_IndexConfigTimeCurrentWallTime, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only) */
- OMX_IndexConfigTimeCurrentAudioReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
- OMX_IndexConfigTimeCurrentVideoReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
- OMX_IndexConfigTimeMediaTimeRequest, /**< reference: OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE (write only) */
- OMX_IndexConfigTimeClientStartTime, /**<reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
- OMX_IndexConfigTimePosition, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE */
- OMX_IndexConfigTimeSeekMode, /**< reference: OMX_TIME_CONFIG_SEEKMODETYPE */
-
-
- OMX_IndexKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- /* Vendor specific area */
- OMX_IndexVendorStartUnused = 0x7F000000,
- /* Vendor specific structures should be in the range of 0x7F000000
- to 0x7FFFFFFE. This range is not broken out by vendor, so
- private indexes are not guaranteed unique and therefore should
- only be sent to the appropriate component. */
-
- OMX_IndexMax = 0x7FFFFFFF
-
-} OMX_INDEXTYPE;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
diff --git a/include/media/stagefright/openmax/OMX_Other.h b/include/media/stagefright/openmax/OMX_Other.h
deleted file mode 100644
index efbce83..0000000
--- a/include/media/stagefright/openmax/OMX_Other.h
+++ /dev/null
@@ -1,354 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/*
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is 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 Software.
- *
- * THE SOFTWARE IS 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
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/** @file OMX_Other.h - OpenMax IL version 1.1.2
- * The structures needed by Other components to exchange
- * parameters and configuration data with the components.
- */
-
-#ifndef OMX_Other_h
-#define OMX_Other_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* Each OMX header must include all required header files to allow the
- * header to compile without errors. The includes below are required
- * for this header file to compile successfully
- */
-
-#include <OMX_Core.h>
-
-
-/**
- * Enumeration of possible data types which match to multiple domains or no
- * domain at all. For types which are vendor specific, a value above
- * OMX_OTHER_VENDORTSTART should be used.
- */
-typedef enum OMX_OTHER_FORMATTYPE {
- OMX_OTHER_FormatTime = 0, /**< Transmission of various timestamps, elapsed time,
- time deltas, etc */
- OMX_OTHER_FormatPower, /**< Perhaps used for enabling/disabling power
- management, setting clocks? */
- OMX_OTHER_FormatStats, /**< Could be things such as frame rate, frames
- dropped, etc */
- OMX_OTHER_FormatBinary, /**< Arbitrary binary data */
- OMX_OTHER_FormatVendorReserved = 1000, /**< Starting value for vendor specific
- formats */
-
- OMX_OTHER_FormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_OTHER_FormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_OTHER_FormatMax = 0x7FFFFFFF
-} OMX_OTHER_FORMATTYPE;
-
-/**
- * Enumeration of seek modes.
- */
-typedef enum OMX_TIME_SEEKMODETYPE {
- OMX_TIME_SeekModeFast = 0, /**< Prefer seeking to an approximation
- * of the requested seek position over
- * the actual seek position if it
- * results in a faster seek. */
- OMX_TIME_SeekModeAccurate, /**< Prefer seeking to the actual seek
- * position over an approximation
- * of the requested seek position even
- * if it results in a slower seek. */
- OMX_TIME_SeekModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_TIME_SeekModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_TIME_SeekModeMax = 0x7FFFFFFF
-} OMX_TIME_SEEKMODETYPE;
-
-/* Structure representing the seekmode of the component */
-typedef struct OMX_TIME_CONFIG_SEEKMODETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_TIME_SEEKMODETYPE eType; /**< The seek mode */
-} OMX_TIME_CONFIG_SEEKMODETYPE;
-
-/** Structure representing a time stamp used with the following configs
- * on the Clock Component (CC):
- *
- * OMX_IndexConfigTimeCurrentWallTime: query of the CCs current wall
- * time
- * OMX_IndexConfigTimeCurrentMediaTime: query of the CCs current media
- * time
- * OMX_IndexConfigTimeCurrentAudioReference and
- * OMX_IndexConfigTimeCurrentVideoReference: audio/video reference
- * clock sending SC its reference time
- * OMX_IndexConfigTimeClientStartTime: a Clock Component client sends
- * this structure to the Clock Component via a SetConfig on its
- * client port when it receives a buffer with
- * OMX_BUFFERFLAG_STARTTIME set. It must use the timestamp
- * specified by that buffer for nStartTimestamp.
- *
- * Its also used with the following config on components in general:
- *
- * OMX_IndexConfigTimePosition: IL client querying component position
- * (GetConfig) or commanding a component to seek to the given location
- * (SetConfig)
- */
-typedef struct OMX_TIME_CONFIG_TIMESTAMPTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version
- * information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_TICKS nTimestamp; /**< timestamp .*/
-} OMX_TIME_CONFIG_TIMESTAMPTYPE;
-
-/** Enumeration of possible reference clocks to the media time. */
-typedef enum OMX_TIME_UPDATETYPE {
- OMX_TIME_UpdateRequestFulfillment, /**< Update is the fulfillment of a media time request. */
- OMX_TIME_UpdateScaleChanged, /**< Update was generated because the scale chagned. */
- OMX_TIME_UpdateClockStateChanged, /**< Update was generated because the clock state changed. */
- OMX_TIME_UpdateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_TIME_UpdateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_TIME_UpdateMax = 0x7FFFFFFF
-} OMX_TIME_UPDATETYPE;
-
-/** Enumeration of possible reference clocks to the media time. */
-typedef enum OMX_TIME_REFCLOCKTYPE {
- OMX_TIME_RefClockNone, /**< Use no references. */
- OMX_TIME_RefClockAudio, /**< Use references sent through OMX_IndexConfigTimeCurrentAudioReference */
- OMX_TIME_RefClockVideo, /**< Use references sent through OMX_IndexConfigTimeCurrentVideoReference */
- OMX_TIME_RefClockKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_TIME_RefClockVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_TIME_RefClockMax = 0x7FFFFFFF
-} OMX_TIME_REFCLOCKTYPE;
-
-/** Enumeration of clock states. */
-typedef enum OMX_TIME_CLOCKSTATE {
- OMX_TIME_ClockStateRunning, /**< Clock running. */
- OMX_TIME_ClockStateWaitingForStartTime, /**< Clock waiting until the
- * prescribed clients emit their
- * start time. */
- OMX_TIME_ClockStateStopped, /**< Clock stopped. */
- OMX_TIME_ClockStateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_TIME_ClockStateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_TIME_ClockStateMax = 0x7FFFFFFF
-} OMX_TIME_CLOCKSTATE;
-
-/** Structure representing a media time request to the clock component.
- *
- * A client component sends this structure to the Clock Component via a SetConfig
- * on its client port to specify a media timestamp the Clock Component
- * should emit. The Clock Component should fulfill the request by sending a
- * OMX_TIME_MEDIATIMETYPE when its media clock matches the requested
- * timestamp.
- *
- * The client may require a media time request be fulfilled slightly
- * earlier than the media time specified. In this case the client specifies
- * an offset which is equal to the difference between wall time corresponding
- * to the requested media time and the wall time when it will be
- * fulfilled.
- *
- * A client component may uses these requests and the OMX_TIME_MEDIATIMETYPE to
- * time events according to timestamps. If a client must perform an operation O at
- * a time T (e.g. deliver a video frame at its corresponding timestamp), it makes a
- * media time request at T (perhaps specifying an offset to ensure the request fulfillment
- * is a little early). When the clock component passes the resulting OMX_TIME_MEDIATIMETYPE
- * structure back to the client component, the client may perform operation O (perhaps having
- * to wait a slight amount more time itself as specified by the return values).
- */
-
-typedef struct OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_PTR pClientPrivate; /**< Client private data to disabiguate this media time
- * from others (e.g. the number of the frame to deliver).
- * Duplicated in the media time structure that fulfills
- * this request. A value of zero is reserved for time scale
- * updates. */
- OMX_TICKS nMediaTimestamp; /**< Media timestamp requested.*/
- OMX_TICKS nOffset; /**< Amount of wall clock time by which this
- * request should be fulfilled early */
-} OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE;
-
-/**< Structure sent from the clock component client either when fulfilling
- * a media time request or when the time scale has changed.
- *
- * In the former case the Clock Component fills this structure and times its emission
- * to a client component (via the client port) according to the corresponding media
- * time request sent by the client. The Clock Component should time the emission to occur
- * when the requested timestamp matches the Clock Component's media time but also the
- * prescribed offset early.
- *
- * Upon scale changes the clock component clears the nClientPrivate data, sends the current
- * media time and sets the nScale to the new scale via the client port. It emits a
- * OMX_TIME_MEDIATIMETYPE to all clients independent of any requests. This allows clients to
- * alter processing to accomodate scaling. For instance a video component might skip inter-frames
- * in the case of extreme fastforward. Likewise an audio component might add or remove samples
- * from an audio frame to scale audio data.
- *
- * It is expected that some clock components may not be able to fulfill requests
- * at exactly the prescribed time. This is acceptable so long as the request is
- * fulfilled at least as early as described and not later. This structure provides
- * fields the client may use to wait for the remaining time.
- *
- * The client may use either the nOffset or nWallTimeAtMedia fields to determine the
- * wall time until the nMediaTimestamp actually occurs. In the latter case the
- * client can get a more accurate value for offset by getting the current wall
- * from the cloc component and subtracting it from nWallTimeAtMedia.
- */
-
-typedef struct OMX_TIME_MEDIATIMETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nClientPrivate; /**< Client private data to disabiguate this media time
- * from others. Copied from the media time request.
- * A value of zero is reserved for time scale updates. */
- OMX_TIME_UPDATETYPE eUpdateType; /**< Reason for the update */
- OMX_TICKS nMediaTimestamp; /**< Media time requested. If no media time was
- * requested then this is the current media time. */
- OMX_TICKS nOffset; /**< Amount of wall clock time by which this
- * request was actually fulfilled early */
-
- OMX_TICKS nWallTimeAtMediaTime; /**< Wall time corresponding to nMediaTimeStamp.
- * A client may compare this value to current
- * media time obtained from the Clock Component to determine
- * the wall time until the media timestamp is really
- * current. */
- OMX_S32 xScale; /**< Current media time scale in Q16 format. */
- OMX_TIME_CLOCKSTATE eState; /* Seeking Change. Added 7/12.*/
- /**< State of the media time. */
-} OMX_TIME_MEDIATIMETYPE;
-
-/** Structure representing the current media time scale factor. Applicable only to clock
- * component, other components see scale changes via OMX_TIME_MEDIATIMETYPE buffers sent via
- * the clock component client ports. Upon recieving this config the clock component changes
- * the rate by which the media time increases or decreases effectively implementing trick modes.
- */
-typedef struct OMX_TIME_CONFIG_SCALETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_S32 xScale; /**< This is a value in Q16 format which is used for
- * scaling the media time */
-} OMX_TIME_CONFIG_SCALETYPE;
-
-/** Bits used to identify a clock port. Used in OMX_TIME_CONFIG_CLOCKSTATETYPEs nWaitMask field */
-#define OMX_CLOCKPORT0 0x00000001
-#define OMX_CLOCKPORT1 0x00000002
-#define OMX_CLOCKPORT2 0x00000004
-#define OMX_CLOCKPORT3 0x00000008
-#define OMX_CLOCKPORT4 0x00000010
-#define OMX_CLOCKPORT5 0x00000020
-#define OMX_CLOCKPORT6 0x00000040
-#define OMX_CLOCKPORT7 0x00000080
-
-/** Structure representing the current mode of the media clock.
- * IL Client uses this config to change or query the mode of the
- * media clock of the clock component. Applicable only to clock
- * component.
- *
- * On a SetConfig if eState is OMX_TIME_ClockStateRunning media time
- * starts immediately at the prescribed start time. If
- * OMX_TIME_ClockStateWaitingForStartTime the Clock Component ignores
- * the given nStartTime and waits for all clients specified in the
- * nWaitMask to send starttimes (via
- * OMX_IndexConfigTimeClientStartTime). The Clock Component then starts
- * the media clock using the earliest start time supplied. */
-typedef struct OMX_TIME_CONFIG_CLOCKSTATETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version
- * information */
- OMX_TIME_CLOCKSTATE eState; /**< State of the media time. */
- OMX_TICKS nStartTime; /**< Start time of the media time. */
- OMX_TICKS nOffset; /**< Time to offset the media time by
- * (e.g. preroll). Media time will be
- * reported to be nOffset ticks earlier.
- */
- OMX_U32 nWaitMask; /**< Mask of OMX_CLOCKPORT values. */
-} OMX_TIME_CONFIG_CLOCKSTATETYPE;
-
-/** Structure representing the reference clock currently being used to
- * compute media time. IL client uses this config to change or query the
- * clock component's active reference clock */
-typedef struct OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_TIME_REFCLOCKTYPE eClock; /**< Reference clock used to compute media time */
-} OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE;
-
-/** Descriptor for setting specifics of power type.
- * Note: this structure is listed for backwards compatibility. */
-typedef struct OMX_OTHER_CONFIG_POWERTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_BOOL bEnablePM; /**< Flag to enable Power Management */
-} OMX_OTHER_CONFIG_POWERTYPE;
-
-
-/** Descriptor for setting specifics of stats type.
- * Note: this structure is listed for backwards compatibility. */
-typedef struct OMX_OTHER_CONFIG_STATSTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- /* what goes here */
-} OMX_OTHER_CONFIG_STATSTYPE;
-
-
-/**
- * The PortDefinition structure is used to define all of the parameters
- * necessary for the compliant component to setup an input or an output other
- * path.
- */
-typedef struct OMX_OTHER_PORTDEFINITIONTYPE {
- OMX_OTHER_FORMATTYPE eFormat; /**< Type of data expected for this channel */
-} OMX_OTHER_PORTDEFINITIONTYPE;
-
-/** Port format parameter. This structure is used to enumerate
- * the various data input/output format supported by the port.
- */
-typedef struct OMX_OTHER_PARAM_PORTFORMATTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Indicates which port to set */
- OMX_U32 nIndex; /**< Indicates the enumeration index for the format from 0x0 to N-1 */
- OMX_OTHER_FORMATTYPE eFormat; /**< Type of data expected for this channel */
-} OMX_OTHER_PARAM_PORTFORMATTYPE;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
diff --git a/include/media/stagefright/openmax/OMX_Types.h b/include/media/stagefright/openmax/OMX_Types.h
deleted file mode 100644
index 03fd4bc..0000000
--- a/include/media/stagefright/openmax/OMX_Types.h
+++ /dev/null
@@ -1,365 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/*
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is 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 Software.
- *
- * THE SOFTWARE IS 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
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/** OMX_Types.h - OpenMax IL version 1.1.2
- * The OMX_Types header file contains the primitive type definitions used by
- * the core, the application and the component. This file may need to be
- * modified to be used on systems that do not have "char" set to 8 bits,
- * "short" set to 16 bits and "long" set to 32 bits.
- */
-
-#ifndef OMX_Types_h
-#define OMX_Types_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/** The OMX_API and OMX_APIENTRY are platform specific definitions used
- * to declare OMX function prototypes. They are modified to meet the
- * requirements for a particular platform */
-#ifdef __SYMBIAN32__
-# ifdef __OMX_EXPORTS
-# define OMX_API __declspec(dllexport)
-# else
-# ifdef _WIN32
-# define OMX_API __declspec(dllexport)
-# else
-# define OMX_API __declspec(dllimport)
-# endif
-# endif
-#else
-# ifdef _WIN32
-# ifdef __OMX_EXPORTS
-# define OMX_API __declspec(dllexport)
-# else
-//# define OMX_API __declspec(dllimport)
-#define OMX_API
-# endif
-# else
-# ifdef __OMX_EXPORTS
-# define OMX_API
-# else
-# define OMX_API extern
-# endif
-# endif
-#endif
-
-#ifndef OMX_APIENTRY
-#define OMX_APIENTRY
-#endif
-
-/** OMX_IN is used to identify inputs to an OMX function. This designation
- will also be used in the case of a pointer that points to a parameter
- that is used as an output. */
-#ifndef OMX_IN
-#define OMX_IN
-#endif
-
-/** OMX_OUT is used to identify outputs from an OMX function. This
- designation will also be used in the case of a pointer that points
- to a parameter that is used as an input. */
-#ifndef OMX_OUT
-#define OMX_OUT
-#endif
-
-
-/** OMX_INOUT is used to identify parameters that may be either inputs or
- outputs from an OMX function at the same time. This designation will
- also be used in the case of a pointer that points to a parameter that
- is used both as an input and an output. */
-#ifndef OMX_INOUT
-#define OMX_INOUT
-#endif
-
-/** OMX_ALL is used to as a wildcard to select all entities of the same type
- * when specifying the index, or referring to a object by an index. (i.e.
- * use OMX_ALL to indicate all N channels). When used as a port index
- * for a config or parameter this OMX_ALL denotes that the config or
- * parameter applies to the entire component not just one port. */
-#define OMX_ALL 0xFFFFFFFF
-
-/** In the following we define groups that help building doxygen documentation */
-
-/** @defgroup core OpenMAX IL core
- * Functions and structure related to the OMX IL core
- */
-
- /** @defgroup comp OpenMAX IL component
- * Functions and structure related to the OMX IL component
- */
-
-/** @defgroup rpm Resource and Policy Management
- * Structures for resource and policy management of components
- */
-
-/** @defgroup buf Buffer Management
- * Buffer handling functions and structures
- */
-
-/** @defgroup tun Tunneling
- * @ingroup core comp
- * Structures and functions to manage tunnels among component ports
- */
-
-/** @defgroup cp Content Pipes
- * @ingroup core
- */
-
- /** @defgroup metadata Metadata handling
- *
- */
-
-/** OMX_U8 is an 8 bit unsigned quantity that is byte aligned */
-typedef unsigned char OMX_U8;
-
-/** OMX_S8 is an 8 bit signed quantity that is byte aligned */
-typedef signed char OMX_S8;
-
-/** OMX_U16 is a 16 bit unsigned quantity that is 16 bit word aligned */
-typedef unsigned short OMX_U16;
-
-/** OMX_S16 is a 16 bit signed quantity that is 16 bit word aligned */
-typedef signed short OMX_S16;
-
-/** OMX_U32 is a 32 bit unsigned quantity that is 32 bit word aligned */
-typedef unsigned long OMX_U32;
-
-/** OMX_S32 is a 32 bit signed quantity that is 32 bit word aligned */
-typedef signed long OMX_S32;
-
-
-/* Users with compilers that cannot accept the "long long" designation should
- define the OMX_SKIP64BIT macro. It should be noted that this may cause
- some components to fail to compile if the component was written to require
- 64 bit integral types. However, these components would NOT compile anyway
- since the compiler does not support the way the component was written.
-*/
-#ifndef OMX_SKIP64BIT
-#ifdef __SYMBIAN32__
-/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
-typedef unsigned long long OMX_U64;
-
-/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
-typedef signed long long OMX_S64;
-
-#elif defined(WIN32)
-
-/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
-typedef unsigned __int64 OMX_U64;
-
-/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
-typedef signed __int64 OMX_S64;
-
-#else /* WIN32 */
-
-/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
-typedef unsigned long long OMX_U64;
-
-/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
-typedef signed long long OMX_S64;
-
-#endif /* WIN32 */
-#endif
-
-
-/** The OMX_BOOL type is intended to be used to represent a true or a false
- value when passing parameters to and from the OMX core and components. The
- OMX_BOOL is a 32 bit quantity and is aligned on a 32 bit word boundary.
- */
-typedef enum OMX_BOOL {
- OMX_FALSE = 0,
- OMX_TRUE = !OMX_FALSE,
- OMX_BOOL_MAX = 0x7FFFFFFF
-} OMX_BOOL;
-
-/** The OMX_PTR type is intended to be used to pass pointers between the OMX
- applications and the OMX Core and components. This is a 32 bit pointer and
- is aligned on a 32 bit boundary.
- */
-typedef void* OMX_PTR;
-
-/** The OMX_STRING type is intended to be used to pass "C" type strings between
- the application and the core and component. The OMX_STRING type is a 32
- bit pointer to a zero terminated string. The pointer is word aligned and
- the string is byte aligned.
- */
-typedef char* OMX_STRING;
-
-/** The OMX_BYTE type is intended to be used to pass arrays of bytes such as
- buffers between the application and the component and core. The OMX_BYTE
- type is a 32 bit pointer to a zero terminated string. The pointer is word
- aligned and the string is byte aligned.
- */
-typedef unsigned char* OMX_BYTE;
-
-/** OMX_UUIDTYPE is a very long unique identifier to uniquely identify
- at runtime. This identifier should be generated by a component in a way
- that guarantees that every instance of the identifier running on the system
- is unique. */
-typedef unsigned char OMX_UUIDTYPE[128];
-
-/** The OMX_DIRTYPE enumeration is used to indicate if a port is an input or
- an output port. This enumeration is common across all component types.
- */
-typedef enum OMX_DIRTYPE
-{
- OMX_DirInput, /**< Port is an input port */
- OMX_DirOutput, /**< Port is an output port */
- OMX_DirMax = 0x7FFFFFFF
-} OMX_DIRTYPE;
-
-/** The OMX_ENDIANTYPE enumeration is used to indicate the bit ordering
- for numerical data (i.e. big endian, or little endian).
- */
-typedef enum OMX_ENDIANTYPE
-{
- OMX_EndianBig, /**< big endian */
- OMX_EndianLittle, /**< little endian */
- OMX_EndianMax = 0x7FFFFFFF
-} OMX_ENDIANTYPE;
-
-
-/** The OMX_NUMERICALDATATYPE enumeration is used to indicate if data
- is signed or unsigned
- */
-typedef enum OMX_NUMERICALDATATYPE
-{
- OMX_NumericalDataSigned, /**< signed data */
- OMX_NumericalDataUnsigned, /**< unsigned data */
- OMX_NumercialDataMax = 0x7FFFFFFF
-} OMX_NUMERICALDATATYPE;
-
-
-/** Unsigned bounded value type */
-typedef struct OMX_BU32 {
- OMX_U32 nValue; /**< actual value */
- OMX_U32 nMin; /**< minimum for value (i.e. nValue >= nMin) */
- OMX_U32 nMax; /**< maximum for value (i.e. nValue <= nMax) */
-} OMX_BU32;
-
-
-/** Signed bounded value type */
-typedef struct OMX_BS32 {
- OMX_S32 nValue; /**< actual value */
- OMX_S32 nMin; /**< minimum for value (i.e. nValue >= nMin) */
- OMX_S32 nMax; /**< maximum for value (i.e. nValue <= nMax) */
-} OMX_BS32;
-
-
-/** Structure representing some time or duration in microseconds. This structure
- * must be interpreted as a signed 64 bit value. The quantity is signed to accommodate
- * negative deltas and preroll scenarios. The quantity is represented in microseconds
- * to accomodate high resolution timestamps (e.g. DVD presentation timestamps based
- * on a 90kHz clock) and to allow more accurate and synchronized delivery (e.g.
- * individual audio samples delivered at 192 kHz). The quantity is 64 bit to
- * accommodate a large dynamic range (signed 32 bit values would allow only for plus
- * or minus 35 minutes).
- *
- * Implementations with limited precision may convert the signed 64 bit value to
- * a signed 32 bit value internally but risk loss of precision.
- */
-#ifndef OMX_SKIP64BIT
-typedef OMX_S64 OMX_TICKS;
-#else
-typedef struct OMX_TICKS
-{
- OMX_U32 nLowPart; /** low bits of the signed 64 bit tick value */
- OMX_U32 nHighPart; /** high bits of the signed 64 bit tick value */
-} OMX_TICKS;
-#endif
-#define OMX_TICKS_PER_SECOND 1000000
-
-/** Define the public interface for the OMX Handle. The core will not use
- this value internally, but the application should only use this value.
- */
-typedef void* OMX_HANDLETYPE;
-
-typedef struct OMX_MARKTYPE
-{
- OMX_HANDLETYPE hMarkTargetComponent; /**< The component that will
- generate a mark event upon
- processing the mark. */
- OMX_PTR pMarkData; /**< Application specific data associated with
- the mark sent on a mark event to disambiguate
- this mark from others. */
-} OMX_MARKTYPE;
-
-
-/** OMX_NATIVE_DEVICETYPE is used to map a OMX video port to the
- * platform & operating specific object used to reference the display
- * or can be used by a audio port for native audio rendering */
-typedef void* OMX_NATIVE_DEVICETYPE;
-
-/** OMX_NATIVE_WINDOWTYPE is used to map a OMX video port to the
- * platform & operating specific object used to reference the window */
-typedef void* OMX_NATIVE_WINDOWTYPE;
-
-/** The OMX_VERSIONTYPE union is used to specify the version for
- a structure or component. For a component, the version is entirely
- specified by the component vendor. Components doing the same function
- from different vendors may or may not have the same version. For
- structures, the version shall be set by the entity that allocates the
- structure. For structures specified in the OMX 1.1 specification, the
- value of the version shall be set to 1.1.0.0 in all cases. Access to the
- OMX_VERSIONTYPE can be by a single 32 bit access (e.g. by nVersion) or
- by accessing one of the structure elements to, for example, check only
- the Major revision.
- */
-typedef union OMX_VERSIONTYPE
-{
- struct
- {
- OMX_U8 nVersionMajor; /**< Major version accessor element */
- OMX_U8 nVersionMinor; /**< Minor version accessor element */
- OMX_U8 nRevision; /**< Revision version accessor element */
- OMX_U8 nStep; /**< Step version accessor element */
- } s;
- OMX_U32 nVersion; /**< 32 bit value to make accessing the
- version easily done in a single word
- size copy/compare operation */
-} OMX_VERSIONTYPE;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
diff --git a/include/media/stagefright/openmax/OMX_Video.h b/include/media/stagefright/openmax/OMX_Video.h
deleted file mode 100644
index 4f8485d..0000000
--- a/include/media/stagefright/openmax/OMX_Video.h
+++ /dev/null
@@ -1,1078 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/**
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is 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 Software.
- *
- * THE SOFTWARE IS 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
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/**
- * @file OMX_Video.h - OpenMax IL version 1.1.2
- * The structures is needed by Video components to exchange parameters
- * and configuration data with OMX components.
- */
-#ifndef OMX_Video_h
-#define OMX_Video_h
-
-/** @defgroup video OpenMAX IL Video Domain
- * @ingroup iv
- * Structures for OpenMAX IL Video domain
- * @{
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/**
- * Each OMX header must include all required header files to allow the
- * header to compile without errors. The includes below are required
- * for this header file to compile successfully
- */
-
-#include <OMX_IVCommon.h>
-
-
-/**
- * Enumeration used to define the possible video compression codings.
- * NOTE: This essentially refers to file extensions. If the coding is
- * being used to specify the ENCODE type, then additional work
- * must be done to configure the exact flavor of the compression
- * to be used. For decode cases where the user application can
- * not differentiate between MPEG-4 and H.264 bit streams, it is
- * up to the codec to handle this.
- */
-typedef enum OMX_VIDEO_CODINGTYPE {
- OMX_VIDEO_CodingUnused, /**< Value when coding is N/A */
- OMX_VIDEO_CodingAutoDetect, /**< Autodetection of coding type */
- OMX_VIDEO_CodingMPEG2, /**< AKA: H.262 */
- OMX_VIDEO_CodingH263, /**< H.263 */
- OMX_VIDEO_CodingMPEG4, /**< MPEG-4 */
- OMX_VIDEO_CodingWMV, /**< all versions of Windows Media Video */
- OMX_VIDEO_CodingRV, /**< all versions of Real Video */
- OMX_VIDEO_CodingAVC, /**< H.264/AVC */
- OMX_VIDEO_CodingMJPEG, /**< Motion JPEG */
- OMX_VIDEO_CodingVPX, /**< Google VPX, formerly known as On2 VP8 */
- OMX_VIDEO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_CodingMax = 0x7FFFFFFF
-} OMX_VIDEO_CODINGTYPE;
-
-
-/**
- * Data structure used to define a video path. The number of Video paths for
- * input and output will vary by type of the Video component.
- *
- * Input (aka Source) : zero Inputs, one Output,
- * Splitter : one Input, 2 or more Outputs,
- * Processing Element : one Input, one output,
- * Mixer : 2 or more inputs, one output,
- * Output (aka Sink) : one Input, zero outputs.
- *
- * The PortDefinition structure is used to define all of the parameters
- * necessary for the compliant component to setup an input or an output video
- * path. If additional vendor specific data is required, it should be
- * transmitted to the component using the CustomCommand function. Compliant
- * components will prepopulate this structure with optimal values during the
- * GetDefaultInitParams command.
- *
- * STRUCT MEMBERS:
- * cMIMEType : MIME type of data for the port
- * pNativeRender : Platform specific reference for a display if a
- * sync, otherwise this field is 0
- * nFrameWidth : Width of frame to be used on channel if
- * uncompressed format is used. Use 0 for unknown,
- * don't care or variable
- * nFrameHeight : Height of frame to be used on channel if
- * uncompressed format is used. Use 0 for unknown,
- * don't care or variable
- * nStride : Number of bytes per span of an image
- * (i.e. indicates the number of bytes to get
- * from span N to span N+1, where negative stride
- * indicates the image is bottom up
- * nSliceHeight : Height used when encoding in slices
- * nBitrate : Bit rate of frame to be used on channel if
- * compressed format is used. Use 0 for unknown,
- * don't care or variable
- * xFramerate : Frame rate to be used on channel if uncompressed
- * format is used. Use 0 for unknown, don't care or
- * variable. Units are Q16 frames per second.
- * bFlagErrorConcealment : Turns on error concealment if it is supported by
- * the OMX component
- * eCompressionFormat : Compression format used in this instance of the
- * component. When OMX_VIDEO_CodingUnused is
- * specified, eColorFormat is used
- * eColorFormat : Decompressed format used by this component
- * pNativeWindow : Platform specific reference for a window object if a
- * display sink , otherwise this field is 0x0.
- */
-typedef struct OMX_VIDEO_PORTDEFINITIONTYPE {
- OMX_STRING cMIMEType;
- OMX_NATIVE_DEVICETYPE pNativeRender;
- OMX_U32 nFrameWidth;
- OMX_U32 nFrameHeight;
- OMX_S32 nStride;
- OMX_U32 nSliceHeight;
- OMX_U32 nBitrate;
- OMX_U32 xFramerate;
- OMX_BOOL bFlagErrorConcealment;
- OMX_VIDEO_CODINGTYPE eCompressionFormat;
- OMX_COLOR_FORMATTYPE eColorFormat;
- OMX_NATIVE_WINDOWTYPE pNativeWindow;
-} OMX_VIDEO_PORTDEFINITIONTYPE;
-
-/**
- * Port format parameter. This structure is used to enumerate the various
- * data input/output format supported by the port.
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Indicates which port to set
- * nIndex : Indicates the enumeration index for the format from
- * 0x0 to N-1
- * eCompressionFormat : Compression format used in this instance of the
- * component. When OMX_VIDEO_CodingUnused is specified,
- * eColorFormat is used
- * eColorFormat : Decompressed format used by this component
- * xFrameRate : Indicates the video frame rate in Q16 format
- */
-typedef struct OMX_VIDEO_PARAM_PORTFORMATTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nIndex;
- OMX_VIDEO_CODINGTYPE eCompressionFormat;
- OMX_COLOR_FORMATTYPE eColorFormat;
- OMX_U32 xFramerate;
-} OMX_VIDEO_PARAM_PORTFORMATTYPE;
-
-
-/**
- * This is a structure for configuring video compression quantization
- * parameter values. Codecs may support different QP values for different
- * frame types.
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version info
- * nPortIndex : Port that this structure applies to
- * nQpI : QP value to use for index frames
- * nQpP : QP value to use for P frames
- * nQpB : QP values to use for bidirectional frames
- */
-typedef struct OMX_VIDEO_PARAM_QUANTIZATIONTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nQpI;
- OMX_U32 nQpP;
- OMX_U32 nQpB;
-} OMX_VIDEO_PARAM_QUANTIZATIONTYPE;
-
-
-/**
- * Structure for configuration of video fast update parameters.
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version info
- * nPortIndex : Port that this structure applies to
- * bEnableVFU : Enable/Disable video fast update
- * nFirstGOB : Specifies the number of the first macroblock row
- * nFirstMB : specifies the first MB relative to the specified first GOB
- * nNumMBs : Specifies the number of MBs to be refreshed from nFirstGOB
- * and nFirstMB
- */
-typedef struct OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL bEnableVFU;
- OMX_U32 nFirstGOB;
- OMX_U32 nFirstMB;
- OMX_U32 nNumMBs;
-} OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE;
-
-
-/**
- * Enumeration of possible bitrate control types
- */
-typedef enum OMX_VIDEO_CONTROLRATETYPE {
- OMX_Video_ControlRateDisable,
- OMX_Video_ControlRateVariable,
- OMX_Video_ControlRateConstant,
- OMX_Video_ControlRateVariableSkipFrames,
- OMX_Video_ControlRateConstantSkipFrames,
- OMX_Video_ControlRateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_Video_ControlRateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_Video_ControlRateMax = 0x7FFFFFFF
-} OMX_VIDEO_CONTROLRATETYPE;
-
-
-/**
- * Structure for configuring bitrate mode of a codec.
- *
- * STRUCT MEMBERS:
- * nSize : Size of the struct in bytes
- * nVersion : OMX spec version info
- * nPortIndex : Port that this struct applies to
- * eControlRate : Control rate type enum
- * nTargetBitrate : Target bitrate to encode with
- */
-typedef struct OMX_VIDEO_PARAM_BITRATETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_VIDEO_CONTROLRATETYPE eControlRate;
- OMX_U32 nTargetBitrate;
-} OMX_VIDEO_PARAM_BITRATETYPE;
-
-
-/**
- * Enumeration of possible motion vector (MV) types
- */
-typedef enum OMX_VIDEO_MOTIONVECTORTYPE {
- OMX_Video_MotionVectorPixel,
- OMX_Video_MotionVectorHalfPel,
- OMX_Video_MotionVectorQuarterPel,
- OMX_Video_MotionVectorEighthPel,
- OMX_Video_MotionVectorKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_Video_MotionVectorVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_Video_MotionVectorMax = 0x7FFFFFFF
-} OMX_VIDEO_MOTIONVECTORTYPE;
-
-
-/**
- * Structure for configuring the number of motion vectors used as well
- * as their accuracy.
- *
- * STRUCT MEMBERS:
- * nSize : Size of the struct in bytes
- * nVersion : OMX spec version info
- * nPortIndex : port that this structure applies to
- * eAccuracy : Enumerated MV accuracy
- * bUnrestrictedMVs : Allow unrestricted MVs
- * bFourMV : Allow use of 4 MVs
- * sXSearchRange : Search range in horizontal direction for MVs
- * sYSearchRange : Search range in vertical direction for MVs
- */
-typedef struct OMX_VIDEO_PARAM_MOTIONVECTORTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_VIDEO_MOTIONVECTORTYPE eAccuracy;
- OMX_BOOL bUnrestrictedMVs;
- OMX_BOOL bFourMV;
- OMX_S32 sXSearchRange;
- OMX_S32 sYSearchRange;
-} OMX_VIDEO_PARAM_MOTIONVECTORTYPE;
-
-
-/**
- * Enumeration of possible methods to use for Intra Refresh
- */
-typedef enum OMX_VIDEO_INTRAREFRESHTYPE {
- OMX_VIDEO_IntraRefreshCyclic,
- OMX_VIDEO_IntraRefreshAdaptive,
- OMX_VIDEO_IntraRefreshBoth,
- OMX_VIDEO_IntraRefreshKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_IntraRefreshVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_IntraRefreshMax = 0x7FFFFFFF
-} OMX_VIDEO_INTRAREFRESHTYPE;
-
-
-/**
- * Structure for configuring intra refresh mode
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eRefreshMode : Cyclic, Adaptive, or Both
- * nAirMBs : Number of intra macroblocks to refresh in a frame when
- * AIR is enabled
- * nAirRef : Number of times a motion marked macroblock has to be
- * intra coded
- * nCirMBs : Number of consecutive macroblocks to be coded as "intra"
- * when CIR is enabled
- */
-typedef struct OMX_VIDEO_PARAM_INTRAREFRESHTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_VIDEO_INTRAREFRESHTYPE eRefreshMode;
- OMX_U32 nAirMBs;
- OMX_U32 nAirRef;
- OMX_U32 nCirMBs;
-} OMX_VIDEO_PARAM_INTRAREFRESHTYPE;
-
-
-/**
- * Structure for enabling various error correction methods for video
- * compression.
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * bEnableHEC : Enable/disable header extension codes (HEC)
- * bEnableResync : Enable/disable resynchronization markers
- * nResynchMarkerSpacing : Resynch markers interval (in bits) to be
- * applied in the stream
- * bEnableDataPartitioning : Enable/disable data partitioning
- * bEnableRVLC : Enable/disable reversible variable length
- * coding
- */
-typedef struct OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL bEnableHEC;
- OMX_BOOL bEnableResync;
- OMX_U32 nResynchMarkerSpacing;
- OMX_BOOL bEnableDataPartitioning;
- OMX_BOOL bEnableRVLC;
-} OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE;
-
-
-/**
- * Configuration of variable block-size motion compensation (VBSMC)
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * b16x16 : Enable inter block search 16x16
- * b16x8 : Enable inter block search 16x8
- * b8x16 : Enable inter block search 8x16
- * b8x8 : Enable inter block search 8x8
- * b8x4 : Enable inter block search 8x4
- * b4x8 : Enable inter block search 4x8
- * b4x4 : Enable inter block search 4x4
- */
-typedef struct OMX_VIDEO_PARAM_VBSMCTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL b16x16;
- OMX_BOOL b16x8;
- OMX_BOOL b8x16;
- OMX_BOOL b8x8;
- OMX_BOOL b8x4;
- OMX_BOOL b4x8;
- OMX_BOOL b4x4;
-} OMX_VIDEO_PARAM_VBSMCTYPE;
-
-
-/**
- * H.263 profile types, each profile indicates support for various
- * performance bounds and different annexes.
- *
- * ENUMS:
- * Baseline : Baseline Profile: H.263 (V1), no optional modes
- * H320 Coding : H.320 Coding Efficiency Backward Compatibility
- * Profile: H.263+ (V2), includes annexes I, J, L.4
- * and T
- * BackwardCompatible : Backward Compatibility Profile: H.263 (V1),
- * includes annex F
- * ISWV2 : Interactive Streaming Wireless Profile: H.263+
- * (V2), includes annexes I, J, K and T
- * ISWV3 : Interactive Streaming Wireless Profile: H.263++
- * (V3), includes profile 3 and annexes V and W.6.3.8
- * HighCompression : Conversational High Compression Profile: H.263++
- * (V3), includes profiles 1 & 2 and annexes D and U
- * Internet : Conversational Internet Profile: H.263++ (V3),
- * includes profile 5 and annex K
- * Interlace : Conversational Interlace Profile: H.263++ (V3),
- * includes profile 5 and annex W.6.3.11
- * HighLatency : High Latency Profile: H.263++ (V3), includes
- * profile 6 and annexes O.1 and P.5
- */
-typedef enum OMX_VIDEO_H263PROFILETYPE {
- OMX_VIDEO_H263ProfileBaseline = 0x01,
- OMX_VIDEO_H263ProfileH320Coding = 0x02,
- OMX_VIDEO_H263ProfileBackwardCompatible = 0x04,
- OMX_VIDEO_H263ProfileISWV2 = 0x08,
- OMX_VIDEO_H263ProfileISWV3 = 0x10,
- OMX_VIDEO_H263ProfileHighCompression = 0x20,
- OMX_VIDEO_H263ProfileInternet = 0x40,
- OMX_VIDEO_H263ProfileInterlace = 0x80,
- OMX_VIDEO_H263ProfileHighLatency = 0x100,
- OMX_VIDEO_H263ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_H263ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_H263ProfileMax = 0x7FFFFFFF
-} OMX_VIDEO_H263PROFILETYPE;
-
-
-/**
- * H.263 level types, each level indicates support for various frame sizes,
- * bit rates, decoder frame rates.
- */
-typedef enum OMX_VIDEO_H263LEVELTYPE {
- OMX_VIDEO_H263Level10 = 0x01,
- OMX_VIDEO_H263Level20 = 0x02,
- OMX_VIDEO_H263Level30 = 0x04,
- OMX_VIDEO_H263Level40 = 0x08,
- OMX_VIDEO_H263Level45 = 0x10,
- OMX_VIDEO_H263Level50 = 0x20,
- OMX_VIDEO_H263Level60 = 0x40,
- OMX_VIDEO_H263Level70 = 0x80,
- OMX_VIDEO_H263LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_H263LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_H263LevelMax = 0x7FFFFFFF
-} OMX_VIDEO_H263LEVELTYPE;
-
-
-/**
- * Specifies the picture type. These values should be OR'd to signal all
- * pictures types which are allowed.
- *
- * ENUMS:
- * Generic Picture Types: I, P and B
- * H.263 Specific Picture Types: SI and SP
- * H.264 Specific Picture Types: EI and EP
- * MPEG-4 Specific Picture Types: S
- */
-typedef enum OMX_VIDEO_PICTURETYPE {
- OMX_VIDEO_PictureTypeI = 0x01,
- OMX_VIDEO_PictureTypeP = 0x02,
- OMX_VIDEO_PictureTypeB = 0x04,
- OMX_VIDEO_PictureTypeSI = 0x08,
- OMX_VIDEO_PictureTypeSP = 0x10,
- OMX_VIDEO_PictureTypeEI = 0x11,
- OMX_VIDEO_PictureTypeEP = 0x12,
- OMX_VIDEO_PictureTypeS = 0x14,
- OMX_VIDEO_PictureTypeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_PictureTypeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_PictureTypeMax = 0x7FFFFFFF
-} OMX_VIDEO_PICTURETYPE;
-
-
-/**
- * H.263 Params
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nPFrames : Number of P frames between each I frame
- * nBFrames : Number of B frames between each I frame
- * eProfile : H.263 profile(s) to use
- * eLevel : H.263 level(s) to use
- * bPLUSPTYPEAllowed : Indicating that it is allowed to use PLUSPTYPE
- * (specified in the 1998 version of H.263) to
- * indicate custom picture sizes or clock
- * frequencies
- * nAllowedPictureTypes : Specifies the picture types allowed in the
- * bitstream
- * bForceRoundingTypeToZero : value of the RTYPE bit (bit 6 of MPPTYPE) is
- * not constrained. It is recommended to change
- * the value of the RTYPE bit for each reference
- * picture in error-free communication
- * nPictureHeaderRepetition : Specifies the frequency of picture header
- * repetition
- * nGOBHeaderInterval : Specifies the interval of non-empty GOB
- * headers in units of GOBs
- */
-typedef struct OMX_VIDEO_PARAM_H263TYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nPFrames;
- OMX_U32 nBFrames;
- OMX_VIDEO_H263PROFILETYPE eProfile;
- OMX_VIDEO_H263LEVELTYPE eLevel;
- OMX_BOOL bPLUSPTYPEAllowed;
- OMX_U32 nAllowedPictureTypes;
- OMX_BOOL bForceRoundingTypeToZero;
- OMX_U32 nPictureHeaderRepetition;
- OMX_U32 nGOBHeaderInterval;
-} OMX_VIDEO_PARAM_H263TYPE;
-
-
-/**
- * MPEG-2 profile types, each profile indicates support for various
- * performance bounds and different annexes.
- */
-typedef enum OMX_VIDEO_MPEG2PROFILETYPE {
- OMX_VIDEO_MPEG2ProfileSimple = 0, /**< Simple Profile */
- OMX_VIDEO_MPEG2ProfileMain, /**< Main Profile */
- OMX_VIDEO_MPEG2Profile422, /**< 4:2:2 Profile */
- OMX_VIDEO_MPEG2ProfileSNR, /**< SNR Profile */
- OMX_VIDEO_MPEG2ProfileSpatial, /**< Spatial Profile */
- OMX_VIDEO_MPEG2ProfileHigh, /**< High Profile */
- OMX_VIDEO_MPEG2ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_MPEG2ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_MPEG2ProfileMax = 0x7FFFFFFF
-} OMX_VIDEO_MPEG2PROFILETYPE;
-
-
-/**
- * MPEG-2 level types, each level indicates support for various frame
- * sizes, bit rates, decoder frame rates. No need
- */
-typedef enum OMX_VIDEO_MPEG2LEVELTYPE {
- OMX_VIDEO_MPEG2LevelLL = 0, /**< Low Level */
- OMX_VIDEO_MPEG2LevelML, /**< Main Level */
- OMX_VIDEO_MPEG2LevelH14, /**< High 1440 */
- OMX_VIDEO_MPEG2LevelHL, /**< High Level */
- OMX_VIDEO_MPEG2LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_MPEG2LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_MPEG2LevelMax = 0x7FFFFFFF
-} OMX_VIDEO_MPEG2LEVELTYPE;
-
-
-/**
- * MPEG-2 params
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nPFrames : Number of P frames between each I frame
- * nBFrames : Number of B frames between each I frame
- * eProfile : MPEG-2 profile(s) to use
- * eLevel : MPEG-2 levels(s) to use
- */
-typedef struct OMX_VIDEO_PARAM_MPEG2TYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nPFrames;
- OMX_U32 nBFrames;
- OMX_VIDEO_MPEG2PROFILETYPE eProfile;
- OMX_VIDEO_MPEG2LEVELTYPE eLevel;
-} OMX_VIDEO_PARAM_MPEG2TYPE;
-
-
-/**
- * MPEG-4 profile types, each profile indicates support for various
- * performance bounds and different annexes.
- *
- * ENUMS:
- * - Simple Profile, Levels 1-3
- * - Simple Scalable Profile, Levels 1-2
- * - Core Profile, Levels 1-2
- * - Main Profile, Levels 2-4
- * - N-bit Profile, Level 2
- * - Scalable Texture Profile, Level 1
- * - Simple Face Animation Profile, Levels 1-2
- * - Simple Face and Body Animation (FBA) Profile, Levels 1-2
- * - Basic Animated Texture Profile, Levels 1-2
- * - Hybrid Profile, Levels 1-2
- * - Advanced Real Time Simple Profiles, Levels 1-4
- * - Core Scalable Profile, Levels 1-3
- * - Advanced Coding Efficiency Profile, Levels 1-4
- * - Advanced Core Profile, Levels 1-2
- * - Advanced Scalable Texture, Levels 2-3
- */
-typedef enum OMX_VIDEO_MPEG4PROFILETYPE {
- OMX_VIDEO_MPEG4ProfileSimple = 0x01,
- OMX_VIDEO_MPEG4ProfileSimpleScalable = 0x02,
- OMX_VIDEO_MPEG4ProfileCore = 0x04,
- OMX_VIDEO_MPEG4ProfileMain = 0x08,
- OMX_VIDEO_MPEG4ProfileNbit = 0x10,
- OMX_VIDEO_MPEG4ProfileScalableTexture = 0x20,
- OMX_VIDEO_MPEG4ProfileSimpleFace = 0x40,
- OMX_VIDEO_MPEG4ProfileSimpleFBA = 0x80,
- OMX_VIDEO_MPEG4ProfileBasicAnimated = 0x100,
- OMX_VIDEO_MPEG4ProfileHybrid = 0x200,
- OMX_VIDEO_MPEG4ProfileAdvancedRealTime = 0x400,
- OMX_VIDEO_MPEG4ProfileCoreScalable = 0x800,
- OMX_VIDEO_MPEG4ProfileAdvancedCoding = 0x1000,
- OMX_VIDEO_MPEG4ProfileAdvancedCore = 0x2000,
- OMX_VIDEO_MPEG4ProfileAdvancedScalable = 0x4000,
- OMX_VIDEO_MPEG4ProfileAdvancedSimple = 0x8000,
- OMX_VIDEO_MPEG4ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_MPEG4ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_MPEG4ProfileMax = 0x7FFFFFFF
-} OMX_VIDEO_MPEG4PROFILETYPE;
-
-
-/**
- * MPEG-4 level types, each level indicates support for various frame
- * sizes, bit rates, decoder frame rates. No need
- */
-typedef enum OMX_VIDEO_MPEG4LEVELTYPE {
- OMX_VIDEO_MPEG4Level0 = 0x01, /**< Level 0 */
- OMX_VIDEO_MPEG4Level0b = 0x02, /**< Level 0b */
- OMX_VIDEO_MPEG4Level1 = 0x04, /**< Level 1 */
- OMX_VIDEO_MPEG4Level2 = 0x08, /**< Level 2 */
- OMX_VIDEO_MPEG4Level3 = 0x10, /**< Level 3 */
- OMX_VIDEO_MPEG4Level4 = 0x20, /**< Level 4 */
- OMX_VIDEO_MPEG4Level4a = 0x40, /**< Level 4a */
- OMX_VIDEO_MPEG4Level5 = 0x80, /**< Level 5 */
- OMX_VIDEO_MPEG4LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_MPEG4LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_MPEG4LevelMax = 0x7FFFFFFF
-} OMX_VIDEO_MPEG4LEVELTYPE;
-
-
-/**
- * MPEG-4 configuration. This structure handles configuration options
- * which are specific to MPEG4 algorithms
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nSliceHeaderSpacing : Number of macroblocks between slice header (H263+
- * Annex K). Put zero if not used
- * bSVH : Enable Short Video Header mode
- * bGov : Flag to enable GOV
- * nPFrames : Number of P frames between each I frame (also called
- * GOV period)
- * nBFrames : Number of B frames between each I frame
- * nIDCVLCThreshold : Value of intra DC VLC threshold
- * bACPred : Flag to use ac prediction
- * nMaxPacketSize : Maximum size of packet in bytes.
- * nTimeIncRes : Used to pass VOP time increment resolution for MPEG4.
- * Interpreted as described in MPEG4 standard.
- * eProfile : MPEG-4 profile(s) to use.
- * eLevel : MPEG-4 level(s) to use.
- * nAllowedPictureTypes : Specifies the picture types allowed in the bitstream
- * nHeaderExtension : Specifies the number of consecutive video packet
- * headers within a VOP
- * bReversibleVLC : Specifies whether reversible variable length coding
- * is in use
- */
-typedef struct OMX_VIDEO_PARAM_MPEG4TYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nSliceHeaderSpacing;
- OMX_BOOL bSVH;
- OMX_BOOL bGov;
- OMX_U32 nPFrames;
- OMX_U32 nBFrames;
- OMX_U32 nIDCVLCThreshold;
- OMX_BOOL bACPred;
- OMX_U32 nMaxPacketSize;
- OMX_U32 nTimeIncRes;
- OMX_VIDEO_MPEG4PROFILETYPE eProfile;
- OMX_VIDEO_MPEG4LEVELTYPE eLevel;
- OMX_U32 nAllowedPictureTypes;
- OMX_U32 nHeaderExtension;
- OMX_BOOL bReversibleVLC;
-} OMX_VIDEO_PARAM_MPEG4TYPE;
-
-
-/**
- * WMV Versions
- */
-typedef enum OMX_VIDEO_WMVFORMATTYPE {
- OMX_VIDEO_WMVFormatUnused = 0x01, /**< Format unused or unknown */
- OMX_VIDEO_WMVFormat7 = 0x02, /**< Windows Media Video format 7 */
- OMX_VIDEO_WMVFormat8 = 0x04, /**< Windows Media Video format 8 */
- OMX_VIDEO_WMVFormat9 = 0x08, /**< Windows Media Video format 9 */
- OMX_VIDEO_WMFFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_WMFFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_WMVFormatMax = 0x7FFFFFFF
-} OMX_VIDEO_WMVFORMATTYPE;
-
-
-/**
- * WMV Params
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eFormat : Version of WMV stream / data
- */
-typedef struct OMX_VIDEO_PARAM_WMVTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_VIDEO_WMVFORMATTYPE eFormat;
-} OMX_VIDEO_PARAM_WMVTYPE;
-
-
-/**
- * Real Video Version
- */
-typedef enum OMX_VIDEO_RVFORMATTYPE {
- OMX_VIDEO_RVFormatUnused = 0, /**< Format unused or unknown */
- OMX_VIDEO_RVFormat8, /**< Real Video format 8 */
- OMX_VIDEO_RVFormat9, /**< Real Video format 9 */
- OMX_VIDEO_RVFormatG2, /**< Real Video Format G2 */
- OMX_VIDEO_RVFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_RVFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_RVFormatMax = 0x7FFFFFFF
-} OMX_VIDEO_RVFORMATTYPE;
-
-
-/**
- * Real Video Params
- *
- * STUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eFormat : Version of RV stream / data
- * nBitsPerPixel : Bits per pixel coded in the frame
- * nPaddedWidth : Padded width in pixel of a video frame
- * nPaddedHeight : Padded Height in pixels of a video frame
- * nFrameRate : Rate of video in frames per second
- * nBitstreamFlags : Flags which internal information about the bitstream
- * nBitstreamVersion : Bitstream version
- * nMaxEncodeFrameSize: Max encoded frame size
- * bEnablePostFilter : Turn on/off post filter
- * bEnableTemporalInterpolation : Turn on/off temporal interpolation
- * bEnableLatencyMode : When enabled, the decoder does not display a decoded
- * frame until it has detected that no enhancement layer
- * frames or dependent B frames will be coming. This
- * detection usually occurs when a subsequent non-B
- * frame is encountered
- */
-typedef struct OMX_VIDEO_PARAM_RVTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_VIDEO_RVFORMATTYPE eFormat;
- OMX_U16 nBitsPerPixel;
- OMX_U16 nPaddedWidth;
- OMX_U16 nPaddedHeight;
- OMX_U32 nFrameRate;
- OMX_U32 nBitstreamFlags;
- OMX_U32 nBitstreamVersion;
- OMX_U32 nMaxEncodeFrameSize;
- OMX_BOOL bEnablePostFilter;
- OMX_BOOL bEnableTemporalInterpolation;
- OMX_BOOL bEnableLatencyMode;
-} OMX_VIDEO_PARAM_RVTYPE;
-
-
-/**
- * AVC profile types, each profile indicates support for various
- * performance bounds and different annexes.
- */
-typedef enum OMX_VIDEO_AVCPROFILETYPE {
- OMX_VIDEO_AVCProfileBaseline = 0x01, /**< Baseline profile */
- OMX_VIDEO_AVCProfileMain = 0x02, /**< Main profile */
- OMX_VIDEO_AVCProfileExtended = 0x04, /**< Extended profile */
- OMX_VIDEO_AVCProfileHigh = 0x08, /**< High profile */
- OMX_VIDEO_AVCProfileHigh10 = 0x10, /**< High 10 profile */
- OMX_VIDEO_AVCProfileHigh422 = 0x20, /**< High 4:2:2 profile */
- OMX_VIDEO_AVCProfileHigh444 = 0x40, /**< High 4:4:4 profile */
- OMX_VIDEO_AVCProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_AVCProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_AVCProfileMax = 0x7FFFFFFF
-} OMX_VIDEO_AVCPROFILETYPE;
-
-
-/**
- * AVC level types, each level indicates support for various frame sizes,
- * bit rates, decoder frame rates. No need
- */
-typedef enum OMX_VIDEO_AVCLEVELTYPE {
- OMX_VIDEO_AVCLevel1 = 0x01, /**< Level 1 */
- OMX_VIDEO_AVCLevel1b = 0x02, /**< Level 1b */
- OMX_VIDEO_AVCLevel11 = 0x04, /**< Level 1.1 */
- OMX_VIDEO_AVCLevel12 = 0x08, /**< Level 1.2 */
- OMX_VIDEO_AVCLevel13 = 0x10, /**< Level 1.3 */
- OMX_VIDEO_AVCLevel2 = 0x20, /**< Level 2 */
- OMX_VIDEO_AVCLevel21 = 0x40, /**< Level 2.1 */
- OMX_VIDEO_AVCLevel22 = 0x80, /**< Level 2.2 */
- OMX_VIDEO_AVCLevel3 = 0x100, /**< Level 3 */
- OMX_VIDEO_AVCLevel31 = 0x200, /**< Level 3.1 */
- OMX_VIDEO_AVCLevel32 = 0x400, /**< Level 3.2 */
- OMX_VIDEO_AVCLevel4 = 0x800, /**< Level 4 */
- OMX_VIDEO_AVCLevel41 = 0x1000, /**< Level 4.1 */
- OMX_VIDEO_AVCLevel42 = 0x2000, /**< Level 4.2 */
- OMX_VIDEO_AVCLevel5 = 0x4000, /**< Level 5 */
- OMX_VIDEO_AVCLevel51 = 0x8000, /**< Level 5.1 */
- OMX_VIDEO_AVCLevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_AVCLevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_AVCLevelMax = 0x7FFFFFFF
-} OMX_VIDEO_AVCLEVELTYPE;
-
-
-/**
- * AVC loop filter modes
- *
- * OMX_VIDEO_AVCLoopFilterEnable : Enable
- * OMX_VIDEO_AVCLoopFilterDisable : Disable
- * OMX_VIDEO_AVCLoopFilterDisableSliceBoundary : Disabled on slice boundaries
- */
-typedef enum OMX_VIDEO_AVCLOOPFILTERTYPE {
- OMX_VIDEO_AVCLoopFilterEnable = 0,
- OMX_VIDEO_AVCLoopFilterDisable,
- OMX_VIDEO_AVCLoopFilterDisableSliceBoundary,
- OMX_VIDEO_AVCLoopFilterKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_AVCLoopFilterVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_AVCLoopFilterMax = 0x7FFFFFFF
-} OMX_VIDEO_AVCLOOPFILTERTYPE;
-
-
-/**
- * AVC params
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nSliceHeaderSpacing : Number of macroblocks between slice header, put
- * zero if not used
- * nPFrames : Number of P frames between each I frame
- * nBFrames : Number of B frames between each I frame
- * bUseHadamard : Enable/disable Hadamard transform
- * nRefFrames : Max number of reference frames to use for inter
- * motion search (1-16)
- * nRefIdxTrailing : Pic param set ref frame index (index into ref
- * frame buffer of trailing frames list), B frame
- * support
- * nRefIdxForward : Pic param set ref frame index (index into ref
- * frame buffer of forward frames list), B frame
- * support
- * bEnableUEP : Enable/disable unequal error protection. This
- * is only valid of data partitioning is enabled.
- * bEnableFMO : Enable/disable flexible macroblock ordering
- * bEnableASO : Enable/disable arbitrary slice ordering
- * bEnableRS : Enable/disable sending of redundant slices
- * eProfile : AVC profile(s) to use
- * eLevel : AVC level(s) to use
- * nAllowedPictureTypes : Specifies the picture types allowed in the
- * bitstream
- * bFrameMBsOnly : specifies that every coded picture of the
- * coded video sequence is a coded frame
- * containing only frame macroblocks
- * bMBAFF : Enable/disable switching between frame and
- * field macroblocks within a picture
- * bEntropyCodingCABAC : Entropy decoding method to be applied for the
- * syntax elements for which two descriptors appear
- * in the syntax tables
- * bWeightedPPrediction : Enable/disable weighted prediction shall not
- * be applied to P and SP slices
- * nWeightedBipredicitonMode : Default weighted prediction is applied to B
- * slices
- * bconstIpred : Enable/disable intra prediction
- * bDirect8x8Inference : Specifies the method used in the derivation
- * process for luma motion vectors for B_Skip,
- * B_Direct_16x16 and B_Direct_8x8 as specified
- * in subclause 8.4.1.2 of the AVC spec
- * bDirectSpatialTemporal : Flag indicating spatial or temporal direct
- * mode used in B slice coding (related to
- * bDirect8x8Inference) . Spatial direct mode is
- * more common and should be the default.
- * nCabacInitIdx : Index used to init CABAC contexts
- * eLoopFilterMode : Enable/disable loop filter
- */
-typedef struct OMX_VIDEO_PARAM_AVCTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nSliceHeaderSpacing;
- OMX_U32 nPFrames;
- OMX_U32 nBFrames;
- OMX_BOOL bUseHadamard;
- OMX_U32 nRefFrames;
- OMX_U32 nRefIdx10ActiveMinus1;
- OMX_U32 nRefIdx11ActiveMinus1;
- OMX_BOOL bEnableUEP;
- OMX_BOOL bEnableFMO;
- OMX_BOOL bEnableASO;
- OMX_BOOL bEnableRS;
- OMX_VIDEO_AVCPROFILETYPE eProfile;
- OMX_VIDEO_AVCLEVELTYPE eLevel;
- OMX_U32 nAllowedPictureTypes;
- OMX_BOOL bFrameMBsOnly;
- OMX_BOOL bMBAFF;
- OMX_BOOL bEntropyCodingCABAC;
- OMX_BOOL bWeightedPPrediction;
- OMX_U32 nWeightedBipredicitonMode;
- OMX_BOOL bconstIpred ;
- OMX_BOOL bDirect8x8Inference;
- OMX_BOOL bDirectSpatialTemporal;
- OMX_U32 nCabacInitIdc;
- OMX_VIDEO_AVCLOOPFILTERTYPE eLoopFilterMode;
-} OMX_VIDEO_PARAM_AVCTYPE;
-
-typedef struct OMX_VIDEO_PARAM_PROFILELEVELTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 eProfile; /**< type is OMX_VIDEO_AVCPROFILETYPE, OMX_VIDEO_H263PROFILETYPE,
- or OMX_VIDEO_MPEG4PROFILETYPE depending on context */
- OMX_U32 eLevel; /**< type is OMX_VIDEO_AVCLEVELTYPE, OMX_VIDEO_H263LEVELTYPE,
- or OMX_VIDEO_MPEG4PROFILETYPE depending on context */
- OMX_U32 nProfileIndex; /**< Used to query for individual profile support information,
- This parameter is valid only for
- OMX_IndexParamVideoProfileLevelQuerySupported index,
- For all other indices this parameter is to be ignored. */
-} OMX_VIDEO_PARAM_PROFILELEVELTYPE;
-
-/**
- * Structure for dynamically configuring bitrate mode of a codec.
- *
- * STRUCT MEMBERS:
- * nSize : Size of the struct in bytes
- * nVersion : OMX spec version info
- * nPortIndex : Port that this struct applies to
- * nEncodeBitrate : Target average bitrate to be generated in bps
- */
-typedef struct OMX_VIDEO_CONFIG_BITRATETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nEncodeBitrate;
-} OMX_VIDEO_CONFIG_BITRATETYPE;
-
-/**
- * Defines Encoder Frame Rate setting
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * xEncodeFramerate : Encoding framerate represented in Q16 format
- */
-typedef struct OMX_CONFIG_FRAMERATETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 xEncodeFramerate; /* Q16 format */
-} OMX_CONFIG_FRAMERATETYPE;
-
-typedef struct OMX_CONFIG_INTRAREFRESHVOPTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL IntraRefreshVOP;
-} OMX_CONFIG_INTRAREFRESHVOPTYPE;
-
-typedef struct OMX_CONFIG_MACROBLOCKERRORMAPTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nErrMapSize; /* Size of the Error Map in bytes */
- OMX_U8 ErrMap[1]; /* Error map hint */
-} OMX_CONFIG_MACROBLOCKERRORMAPTYPE;
-
-typedef struct OMX_CONFIG_MBERRORREPORTINGTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL bEnabled;
-} OMX_CONFIG_MBERRORREPORTINGTYPE;
-
-typedef struct OMX_PARAM_MACROBLOCKSTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nMacroblocks;
-} OMX_PARAM_MACROBLOCKSTYPE;
-
-/**
- * AVC Slice Mode modes
- *
- * OMX_VIDEO_SLICEMODE_AVCDefault : Normal frame encoding, one slice per frame
- * OMX_VIDEO_SLICEMODE_AVCMBSlice : NAL mode, number of MBs per frame
- * OMX_VIDEO_SLICEMODE_AVCByteSlice : NAL mode, number of bytes per frame
- */
-typedef enum OMX_VIDEO_AVCSLICEMODETYPE {
- OMX_VIDEO_SLICEMODE_AVCDefault = 0,
- OMX_VIDEO_SLICEMODE_AVCMBSlice,
- OMX_VIDEO_SLICEMODE_AVCByteSlice,
- OMX_VIDEO_SLICEMODE_AVCKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_SLICEMODE_AVCVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_SLICEMODE_AVCLevelMax = 0x7FFFFFFF
-} OMX_VIDEO_AVCSLICEMODETYPE;
-
-/**
- * AVC FMO Slice Mode Params
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nNumSliceGroups : Specifies the number of slice groups
- * nSliceGroupMapType : Specifies the type of slice groups
- * eSliceMode : Specifies the type of slice
- */
-typedef struct OMX_VIDEO_PARAM_AVCSLICEFMO {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U8 nNumSliceGroups;
- OMX_U8 nSliceGroupMapType;
- OMX_VIDEO_AVCSLICEMODETYPE eSliceMode;
-} OMX_VIDEO_PARAM_AVCSLICEFMO;
-
-/**
- * AVC IDR Period Configs
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nIDRPeriod : Specifies periodicity of IDR frames
- * nPFrames : Specifies internal of coding Intra frames
- */
-typedef struct OMX_VIDEO_CONFIG_AVCINTRAPERIOD {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nIDRPeriod;
- OMX_U32 nPFrames;
-} OMX_VIDEO_CONFIG_AVCINTRAPERIOD;
-
-/**
- * AVC NAL Size Configs
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nNaluBytes : Specifies the NAL unit size
- */
-typedef struct OMX_VIDEO_CONFIG_NALSIZE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nNaluBytes;
-} OMX_VIDEO_CONFIG_NALSIZE;
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
-
diff --git a/include/media/stagefright/timedtext/TimedTextDriver.h b/include/media/stagefright/timedtext/TimedTextDriver.h
index efedb6e..b9752df 100644
--- a/include/media/stagefright/timedtext/TimedTextDriver.h
+++ b/include/media/stagefright/timedtext/TimedTextDriver.h
@@ -37,26 +37,26 @@
~TimedTextDriver();
- // TODO: pause-resume pair seems equivalent to stop-start pair.
- // Check if it is replaceable with stop-start.
status_t start();
- status_t stop();
status_t pause();
- status_t resume();
+ status_t selectTrack(int32_t index);
+ status_t unselectTrack(int32_t index);
status_t seekToAsync(int64_t timeUs);
status_t addInBandTextSource(const sp<MediaSource>& source);
- status_t addOutOfBandTextSource(const Parcel &request);
+ status_t addOutOfBandTextSource(const char *uri, const char *mimeType);
+ // Caller owns the file desriptor and caller is responsible for closing it.
+ status_t addOutOfBandTextSource(
+ int fd, off64_t offset, size_t length, const char *mimeType);
- status_t setTimedTextTrackIndex(int32_t index);
+ void getTrackInfo(Parcel *parcel);
private:
Mutex mLock;
enum State {
UNINITIALIZED,
- STOPPED,
PLAYING,
PAUSED,
};
@@ -67,11 +67,11 @@
// Variables to be guarded by mLock.
State mState;
- Vector<sp<TimedTextSource> > mTextInBandVector;
- Vector<sp<TimedTextSource> > mTextOutOfBandVector;
+ int32_t mCurrentTrackIndex;
+ Vector<sp<TimedTextSource> > mTextSourceVector;
// -- End of variables to be guarded by mLock
- status_t setTimedTextTrackIndex_l(int32_t index);
+ status_t selectTrack_l(int32_t index);
DISALLOW_EVIL_CONSTRUCTORS(TimedTextDriver);
};
diff --git a/include/private/media/VideoFrame.h b/include/private/media/VideoFrame.h
index 3aff0c6..0ecc348 100644
--- a/include/private/media/VideoFrame.h
+++ b/include/private/media/VideoFrame.h
@@ -26,7 +26,7 @@
namespace android {
// A simple buffer to hold binary data
-class MediaAlbumArt
+class MediaAlbumArt
{
public:
MediaAlbumArt(): mSize(0), mData(0) {}
@@ -57,9 +57,9 @@
fclose(in);
}
- MediaAlbumArt(const MediaAlbumArt& copy) {
- mSize = copy.mSize;
- mData = NULL; // initialize it first
+ MediaAlbumArt(const MediaAlbumArt& copy) {
+ mSize = copy.mSize;
+ mData = NULL; // initialize it first
if (mSize > 0 && copy.mData != NULL) {
mData = new uint8_t[copy.mSize];
if (mData != NULL) {
@@ -89,7 +89,7 @@
{
public:
VideoFrame(): mWidth(0), mHeight(0), mDisplayWidth(0), mDisplayHeight(0), mSize(0), mData(0) {}
-
+
VideoFrame(const VideoFrame& copy) {
mWidth = copy.mWidth;
mHeight = copy.mHeight;
diff --git a/keystore/java/android/security/KeyChain.java b/keystore/java/android/security/KeyChain.java
index fba5bab..fe03437 100644
--- a/keystore/java/android/security/KeyChain.java
+++ b/keystore/java/android/security/KeyChain.java
@@ -169,7 +169,6 @@
/**
- * @hide TODO This is temporary and will be removed
* Broadcast Action: Indicates the trusted storage has changed. Sent when
* one of this happens:
*
diff --git a/libs/androidfw/Input.cpp b/libs/androidfw/Input.cpp
index ca09caf..da57839 100644
--- a/libs/androidfw/Input.cpp
+++ b/libs/androidfw/Input.cpp
@@ -683,6 +683,58 @@
}
+// --- PooledInputEventFactory ---
+
+PooledInputEventFactory::PooledInputEventFactory(size_t maxPoolSize) :
+ mMaxPoolSize(maxPoolSize) {
+}
+
+PooledInputEventFactory::~PooledInputEventFactory() {
+ for (size_t i = 0; i < mKeyEventPool.size(); i++) {
+ delete mKeyEventPool.itemAt(i);
+ }
+ for (size_t i = 0; i < mMotionEventPool.size(); i++) {
+ delete mMotionEventPool.itemAt(i);
+ }
+}
+
+KeyEvent* PooledInputEventFactory::createKeyEvent() {
+ if (!mKeyEventPool.isEmpty()) {
+ KeyEvent* event = mKeyEventPool.top();
+ mKeyEventPool.pop();
+ return event;
+ }
+ return new KeyEvent();
+}
+
+MotionEvent* PooledInputEventFactory::createMotionEvent() {
+ if (!mMotionEventPool.isEmpty()) {
+ MotionEvent* event = mMotionEventPool.top();
+ mMotionEventPool.pop();
+ return event;
+ }
+ return new MotionEvent();
+}
+
+void PooledInputEventFactory::recycle(InputEvent* event) {
+ switch (event->getType()) {
+ case AINPUT_EVENT_TYPE_KEY:
+ if (mKeyEventPool.size() < mMaxPoolSize) {
+ mKeyEventPool.push(static_cast<KeyEvent*>(event));
+ return;
+ }
+ break;
+ case AINPUT_EVENT_TYPE_MOTION:
+ if (mMotionEventPool.size() < mMaxPoolSize) {
+ mMotionEventPool.push(static_cast<MotionEvent*>(event));
+ return;
+ }
+ break;
+ }
+ delete event;
+}
+
+
// --- VelocityTracker ---
const uint32_t VelocityTracker::DEFAULT_DEGREE;
diff --git a/libs/androidfw/InputTransport.cpp b/libs/androidfw/InputTransport.cpp
index 1ebd75c..294236f 100644
--- a/libs/androidfw/InputTransport.cpp
+++ b/libs/androidfw/InputTransport.cpp
@@ -527,6 +527,10 @@
return mChannel->sendMessage(&msg);
}
+bool InputConsumer::hasDeferredEvent() const {
+ return mMsgDeferred;
+}
+
bool InputConsumer::hasPendingBatch() const {
return !mBatches.isEmpty();
}
diff --git a/libs/camera/Camera.cpp b/libs/camera/Camera.cpp
index d43cb0b..b81fe86 100644
--- a/libs/camera/Camera.cpp
+++ b/libs/camera/Camera.cpp
@@ -116,13 +116,13 @@
return cs->getCameraInfo(cameraId, cameraInfo);
}
-sp<Camera> Camera::connect(int cameraId)
+sp<Camera> Camera::connect(int cameraId, bool force, bool keep)
{
ALOGV("connect");
sp<Camera> c = new Camera();
const sp<ICameraService>& cs = getCameraService();
if (cs != 0) {
- c->mCamera = cs->connect(c, cameraId);
+ c->mCamera = cs->connect(c, cameraId, force, keep);
}
if (c->mCamera != 0) {
c->mCamera->asBinder()->linkToDeath(c);
diff --git a/libs/camera/ICameraService.cpp b/libs/camera/ICameraService.cpp
index 85f1a29..c74298a 100644
--- a/libs/camera/ICameraService.cpp
+++ b/libs/camera/ICameraService.cpp
@@ -56,12 +56,15 @@
}
// connect to camera service
- virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient, int cameraId)
+ virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient, int cameraId,
+ bool force, bool keep)
{
Parcel data, reply;
data.writeInterfaceToken(ICameraService::getInterfaceDescriptor());
data.writeStrongBinder(cameraClient->asBinder());
data.writeInt32(cameraId);
+ data.writeInt32(force);
+ data.writeInt32(keep);
remote()->transact(BnCameraService::CONNECT, data, &reply);
return interface_cast<ICamera>(reply.readStrongBinder());
}
@@ -93,7 +96,10 @@
case CONNECT: {
CHECK_INTERFACE(ICameraService, data, reply);
sp<ICameraClient> cameraClient = interface_cast<ICameraClient>(data.readStrongBinder());
- sp<ICamera> camera = connect(cameraClient, data.readInt32());
+ const int cameraId = data.readInt32();
+ const int force = data.readInt32();
+ const int keep = data.readInt32();
+ sp<ICamera> camera = connect(cameraClient, cameraId, force, keep);
reply->writeStrongBinder(camera->asBinder());
return NO_ERROR;
} break;
@@ -105,4 +111,3 @@
// ----------------------------------------------------------------------------
}; // namespace android
-
diff --git a/libs/cpustats/ThreadCpuUsage.cpp b/libs/cpustats/ThreadCpuUsage.cpp
index ffee039..99b4c8363 100644
--- a/libs/cpustats/ThreadCpuUsage.cpp
+++ b/libs/cpustats/ThreadCpuUsage.cpp
@@ -14,18 +14,26 @@
* limitations under the License.
*/
+#define LOG_TAG "ThreadCpuUsage"
+//#define LOG_NDEBUG 0
+
#include <errno.h>
+#include <stdlib.h>
#include <time.h>
+#include <utils/Debug.h>
#include <utils/Log.h>
#include <cpustats/ThreadCpuUsage.h>
+namespace android {
+
bool ThreadCpuUsage::setEnabled(bool isEnabled)
{
bool wasEnabled = mIsEnabled;
// only do something if there is a change
if (isEnabled != wasEnabled) {
+ ALOGV("setEnabled(%d)", isEnabled);
int rc;
// enabling
if (isEnabled) {
@@ -65,20 +73,28 @@
return wasEnabled;
}
-void ThreadCpuUsage::sampleAndEnable()
+bool ThreadCpuUsage::sampleAndEnable(double& ns)
{
+ bool ret;
bool wasEverEnabled = mWasEverEnabled;
if (enable()) {
// already enabled, so add a new sample relative to previous
- sample();
+ return sample(ns);
} else if (wasEverEnabled) {
// was disabled, but add sample for accumulated time while enabled
- mStatistics.sample((double) mAccumulator);
+ ns = (double) mAccumulator;
mAccumulator = 0;
+ ALOGV("sampleAndEnable %.0f", ns);
+ return true;
+ } else {
+ // first time called
+ ns = 0.0;
+ ALOGV("sampleAndEnable false");
+ return false;
}
}
-void ThreadCpuUsage::sample()
+bool ThreadCpuUsage::sample(double &ns)
{
if (mWasEverEnabled) {
if (mIsEnabled) {
@@ -87,6 +103,8 @@
rc = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
if (rc) {
ALOGE("clock_gettime(CLOCK_THREAD_CPUTIME_ID) errno=%d", errno);
+ ns = 0.0;
+ return false;
} else {
long long delta = (ts.tv_sec - mPreviousTs.tv_sec) * 1000000000LL +
(ts.tv_nsec - mPreviousTs.tv_nsec);
@@ -96,10 +114,14 @@
} else {
mWasEverEnabled = false;
}
- mStatistics.sample((double) mAccumulator);
+ ns = (double) mAccumulator;
+ ALOGV("sample %.0f", ns);
mAccumulator = 0;
+ return true;
} else {
ALOGW("Can't add sample because measurements have never been enabled");
+ ns = 0.0;
+ return false;
}
}
@@ -122,12 +144,13 @@
ALOGW("Can't compute elapsed time because measurements have never been enabled");
elapsed = 0;
}
+ ALOGV("elapsed %lld", elapsed);
return elapsed;
}
-void ThreadCpuUsage::resetStatistics()
+void ThreadCpuUsage::resetElapsed()
{
- mStatistics.reset();
+ ALOGV("resetElapsed");
if (mMonotonicKnown) {
int rc;
rc = clock_gettime(CLOCK_MONOTONIC, &mMonotonicTs);
@@ -137,3 +160,93 @@
}
}
}
+
+/*static*/
+int ThreadCpuUsage::sScalingFds[ThreadCpuUsage::MAX_CPU];
+pthread_once_t ThreadCpuUsage::sOnceControl = PTHREAD_ONCE_INIT;
+int ThreadCpuUsage::sKernelMax;
+
+/*static*/
+void ThreadCpuUsage::init()
+{
+ // read the number of CPUs
+ sKernelMax = 1;
+ int fd = open("/sys/devices/system/cpu/kernel_max", O_RDONLY);
+ if (fd >= 0) {
+#define KERNEL_MAX_SIZE 12
+ char kernelMax[KERNEL_MAX_SIZE];
+ ssize_t actual = read(fd, kernelMax, sizeof(kernelMax));
+ if (actual >= 2 && kernelMax[actual-1] == '\n') {
+ sKernelMax = atoi(kernelMax);
+ if (sKernelMax >= MAX_CPU - 1) {
+ ALOGW("kernel_max %d but MAX_CPU %d", sKernelMax, MAX_CPU);
+ sKernelMax = MAX_CPU;
+ } else if (sKernelMax < 0) {
+ ALOGW("kernel_max invalid %d", sKernelMax);
+ sKernelMax = 1;
+ } else {
+ ++sKernelMax;
+ ALOGV("number of CPUs %d", sKernelMax);
+ }
+ } else {
+ ALOGW("Can't read number of CPUs");
+ }
+ (void) close(fd);
+ } else {
+ ALOGW("Can't open number of CPUs");
+ }
+
+ // open fd to each frequency per CPU
+#define FREQ_SIZE 64
+ char freq_path[FREQ_SIZE];
+#define FREQ_DIGIT 27
+ COMPILE_TIME_ASSERT_FUNCTION_SCOPE(MAX_CPU <= 10);
+ strlcpy(freq_path, "/sys/devices/system/cpu/cpu?/cpufreq/scaling_cur_freq", sizeof(freq_path));
+ int i;
+ for (i = 0; i < MAX_CPU; ++i) {
+ sScalingFds[i] = -1;
+ }
+ for (i = 0; i < sKernelMax; ++i) {
+ freq_path[FREQ_DIGIT] = i + '0';
+ fd = open(freq_path, O_RDONLY);
+ if (fd >= 0) {
+ // keep this fd until process exit
+ sScalingFds[i] = fd;
+ } else {
+ ALOGW("Can't open CPU %d", i);
+ }
+ }
+}
+
+uint32_t ThreadCpuUsage::getCpukHz(int cpuNum)
+{
+ if (cpuNum < 0 || cpuNum >= MAX_CPU) {
+ ALOGW("getCpukHz called with invalid CPU %d", cpuNum);
+ return 0;
+ }
+ int fd = sScalingFds[cpuNum];
+ if (fd < 0) {
+ ALOGW("getCpukHz called for unopened CPU %d", cpuNum);
+ return 0;
+ }
+#define KHZ_SIZE 12
+ char kHz[KHZ_SIZE]; // kHz base 10
+ ssize_t actual = pread(fd, kHz, sizeof(kHz), (off_t) 0);
+ uint32_t ret;
+ if (actual >= 2 && kHz[actual-1] == '\n') {
+ ret = atoi(kHz);
+ } else {
+ ret = 0;
+ }
+ if (ret != mCurrentkHz[cpuNum]) {
+ if (ret > 0) {
+ ALOGV("CPU %d frequency %u kHz", cpuNum, ret);
+ } else {
+ ALOGW("Can't read CPU %d frequency", cpuNum);
+ }
+ mCurrentkHz[cpuNum] = ret;
+ }
+ return ret;
+}
+
+} // namespace android
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 24f4f1c..118608d 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -16,11 +16,11 @@
#define LOG_TAG "OpenGLRenderer"
+#include <SkCamera.h>
#include "DisplayListLogBuffer.h"
#include "DisplayListRenderer.h"
#include "Caches.h"
-#include "SkCamera.h"
namespace android {
namespace uirenderer {
@@ -91,7 +91,9 @@
fflush(file);
}
-DisplayList::DisplayList(const DisplayListRenderer& recorder) {
+DisplayList::DisplayList(const DisplayListRenderer& recorder) :
+ mTransformMatrix(NULL), mTransformCamera(NULL), mTransformMatrix3D(NULL) {
+
initFromDisplayListRenderer(recorder);
}
@@ -124,9 +126,6 @@
mWidth = 0;
mHeight = 0;
mPivotExplicitlySet = false;
- mTransformMatrix = NULL;
- mTransformCamera = NULL;
- mTransformMatrix3D = NULL;
mCaching = false;
}
@@ -140,17 +139,19 @@
void DisplayList::clearResources() {
sk_free((void*) mReader.base());
- if (mTransformMatrix) {
- delete mTransformMatrix;
- mTransformMatrix = NULL;
- }
- if (mTransformCamera) {
- delete mTransformCamera;
- mTransformCamera = NULL;
- }
- if (mTransformMatrix3D) {
- delete mTransformMatrix3D;
- mTransformMatrix3D = NULL;
+ if (USE_DISPLAY_LIST_PROPERTIES) {
+ if (mTransformMatrix) {
+ delete mTransformMatrix;
+ mTransformMatrix = NULL;
+ }
+ if (mTransformCamera) {
+ delete mTransformCamera;
+ mTransformCamera = NULL;
+ }
+ if (mTransformMatrix3D) {
+ delete mTransformMatrix3D;
+ mTransformMatrix3D = NULL;
+ }
}
Caches& caches = Caches::getInstance();
@@ -670,18 +671,6 @@
if (mLeft != 0 || mTop != 0) {
ALOGD("%s%s %d, %d", indent, "Translate", mLeft, mTop);
}
- if (mAlpha < 1) {
- // TODO: should be able to store the size of a DL at record time and not
- // have to pass it into this call. In fact, this information might be in the
- // location/size info that we store with the new native transform data.
- int flags = SkCanvas::kHasAlphaLayer_SaveFlag;
- if (mClipChildren) {
- flags |= SkCanvas::kClipToLayer_SaveFlag;
- }
- ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d, 0x%x", indent, "SaveLayerAlpha",
- (float) 0, (float) 0, (float) mRight - mLeft, (float) mBottom - mTop,
- mMultipliedAlpha, flags);
- }
if (mMatrixFlags != 0) {
if (mMatrixFlags == TRANSLATION) {
ALOGD("%s%s %f, %f", indent, "Translate", mTranslationX, mTranslationY);
@@ -695,6 +684,18 @@
mTransformMatrix->get(8));
}
}
+ if (mAlpha < 1) {
+ // TODO: should be able to store the size of a DL at record time and not
+ // have to pass it into this call. In fact, this information might be in the
+ // location/size info that we store with the new native transform data.
+ int flags = SkCanvas::kHasAlphaLayer_SaveFlag;
+ if (mClipChildren) {
+ flags |= SkCanvas::kClipToLayer_SaveFlag;
+ }
+ ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d, 0x%x", indent, "SaveLayerAlpha",
+ (float) 0, (float) 0, (float) mRight - mLeft, (float) mBottom - mTop,
+ mMultipliedAlpha, flags);
+ }
if (mClipChildren) {
ALOGD("%s%s %.2f, %.2f, %.2f, %.2f", indent, "ClipRect", 0.0f, 0.0f,
(float) mRight - mLeft, (float) mBottom - mTop);
@@ -723,20 +724,6 @@
mApplicationScale, mApplicationScale);
renderer.scale(mApplicationScale, mApplicationScale);
}
- if (mAlpha < 1 && !mCaching) {
- // TODO: should be able to store the size of a DL at record time and not
- // have to pass it into this call. In fact, this information might be in the
- // location/size info that we store with the new native transform data.
- int flags = SkCanvas::kHasAlphaLayer_SaveFlag;
- if (mClipChildren) {
- flags |= SkCanvas::kClipToLayer_SaveFlag;
- }
- DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d, 0x%x", indent, "SaveLayerAlpha",
- (float) 0, (float) 0, (float) mRight - mLeft, (float) mBottom - mTop,
- mMultipliedAlpha, flags);
- renderer.saveLayerAlpha(0, 0, mRight - mLeft, mBottom - mTop,
- mMultipliedAlpha, flags);
- }
if (mMatrixFlags != 0) {
if (mMatrixFlags == TRANSLATION) {
DISPLAY_LIST_LOGD("%s%s %f, %f", indent, "Translate", mTranslationX, mTranslationY);
@@ -753,6 +740,20 @@
renderer.concatMatrix(mTransformMatrix);
}
}
+ if (mAlpha < 1 && !mCaching) {
+ // TODO: should be able to store the size of a DL at record time and not
+ // have to pass it into this call. In fact, this information might be in the
+ // location/size info that we store with the new native transform data.
+ int flags = SkCanvas::kHasAlphaLayer_SaveFlag;
+ if (mClipChildren) {
+ flags |= SkCanvas::kClipToLayer_SaveFlag;
+ }
+ DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d, 0x%x", indent, "SaveLayerAlpha",
+ (float) 0, (float) 0, (float) mRight - mLeft, (float) mBottom - mTop,
+ mMultipliedAlpha, flags);
+ renderer.saveLayerAlpha(0, 0, mRight - mLeft, mBottom - mTop,
+ mMultipliedAlpha, flags);
+ }
if (mClipChildren) {
DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %.2f", indent, "ClipRect", 0.0f, 0.0f,
(float) mRight - mLeft, (float) mBottom - mTop);
@@ -825,7 +826,7 @@
while (!mReader.eof()) {
int op = mReader.readInt();
if (op & OP_MAY_BE_SKIPPED_MASK) {
- int32_t skip = mReader.readInt() * 4;
+ int32_t skip = mReader.readInt();
if (CC_LIKELY(flags & kReplayFlag_ClipChildren)) {
mReader.skip(skip);
DISPLAY_LIST_LOGD("%s%s skipping %d bytes", (char*) indent,
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index abe8b82..38d0374 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -51,7 +51,7 @@
// Set to 1 to enable native processing of View properties. 0 by default. Eventually this
// will go away and we will always use this approach for accelerated apps.
-#define USE_DISPLAY_LIST_PROPERTIES 0
+#define USE_DISPLAY_LIST_PROPERTIES 1
#define TRANSLATION 0x0001
#define ROTATION 0x0002
@@ -574,7 +574,7 @@
virtual void drawLines(float* points, int count, SkPaint* paint);
virtual void drawPoints(float* points, int count, SkPaint* paint);
virtual void drawText(const char* text, int bytesCount, int count, float x, float y,
- SkPaint* paint, float length = 1.0f);
+ SkPaint* paint, float length = -1.0f);
virtual void drawTextOnPath(const char* text, int bytesCount, int count, SkPath* path,
float hOffset, float vOffset, SkPaint* paint);
virtual void drawPosText(const char* text, int bytesCount, int count, const float* positions,
@@ -656,9 +656,8 @@
if (reject) {
mWriter.writeInt(OP_MAY_BE_SKIPPED_MASK | drawOp);
mWriter.writeInt(0xdeaddead);
- uint32_t* location = reject ?
- mWriter.peek32(mWriter.size() - sizeof(int32_t)) : NULL;
- return location;
+ mBufferSize = mWriter.size();
+ return mWriter.peek32(mBufferSize - sizeof(int32_t));
}
mWriter.writeInt(drawOp);
return NULL;
@@ -666,8 +665,7 @@
inline void addSkip(uint32_t* location) {
if (location) {
- *location = (int32_t) (mWriter.peek32(
- mWriter.size() - sizeof(int32_t)) - location);
+ *location = (int32_t) (mWriter.size() - mBufferSize);
}
}
@@ -822,6 +820,7 @@
Vector<SkMatrix*> mMatrices;
SkWriter32 mWriter;
+ uint32_t mBufferSize;
int mRestoreSaveCount;
diff --git a/libs/rs/Script.cpp b/libs/rs/Script.cpp
index 25fa673..c87d460 100644
--- a/libs/rs/Script.cpp
+++ b/libs/rs/Script.cpp
@@ -25,12 +25,12 @@
#include "Allocation.h"
#include "Script.h"
-void Script::invoke(uint32_t slot, const void *v, size_t len) {
+void Script::invoke(uint32_t slot, const void *v, size_t len) const {
rsScriptInvokeV(mRS->mContext, getID(), slot, v, len);
}
void Script::forEach(uint32_t slot, const Allocation *ain, const Allocation *aout,
- const void *usr, size_t usrLen) {
+ const void *usr, size_t usrLen) const {
if ((ain == NULL) && (aout == NULL)) {
mRS->throwError("At least one of ain or aout is required to be non-null.");
}
@@ -44,16 +44,16 @@
}
-void Script::bindAllocation(const Allocation *va, uint32_t slot) {
+void Script::bindAllocation(const Allocation *va, uint32_t slot) const {
rsScriptBindAllocation(mRS->mContext, getID(), BaseObj::getObjID(va), slot);
}
-void Script::setVar(uint32_t index, const BaseObj *o) {
+void Script::setVar(uint32_t index, const BaseObj *o) const {
rsScriptSetVarObj(mRS->mContext, getID(), index, (o == NULL) ? 0 : o->getID());
}
-void Script::setVar(uint32_t index, const void *v, size_t len) {
+void Script::setVar(uint32_t index, const void *v, size_t len) const {
rsScriptSetVarV(mRS->mContext, getID(), index, v, len);
}
diff --git a/libs/rs/Script.h b/libs/rs/Script.h
index 54d1e40..0700898 100644
--- a/libs/rs/Script.h
+++ b/libs/rs/Script.h
@@ -30,29 +30,29 @@
class Script : public BaseObj {
protected:
Script(void *id, RenderScript *rs);
- void forEach(uint32_t slot, const Allocation *in, const Allocation *out, const void *v, size_t);
- void bindAllocation(const Allocation *va, uint32_t slot);
- void setVar(uint32_t index, const void *, size_t len);
- void setVar(uint32_t index, const BaseObj *o);
- void invoke(uint32_t slot, const void *v, size_t len);
+ void forEach(uint32_t slot, const Allocation *in, const Allocation *out, const void *v, size_t) const;
+ void bindAllocation(const Allocation *va, uint32_t slot) const;
+ void setVar(uint32_t index, const void *, size_t len) const;
+ void setVar(uint32_t index, const BaseObj *o) const;
+ void invoke(uint32_t slot, const void *v, size_t len) const;
- void invoke(uint32_t slot) {
+ void invoke(uint32_t slot) const {
invoke(slot, NULL, 0);
}
- void setVar(uint32_t index, float v) {
+ void setVar(uint32_t index, float v) const {
setVar(index, &v, sizeof(v));
}
- void setVar(uint32_t index, double v) {
+ void setVar(uint32_t index, double v) const {
setVar(index, &v, sizeof(v));
}
- void setVar(uint32_t index, int32_t v) {
+ void setVar(uint32_t index, int32_t v) const {
setVar(index, &v, sizeof(v));
}
- void setVar(uint32_t index, int64_t v) {
+ void setVar(uint32_t index, int64_t v) const {
setVar(index, &v, sizeof(v));
}
- void setVar(uint32_t index, bool v) {
+ void setVar(uint32_t index, bool v) const {
setVar(index, &v, sizeof(v));
}
diff --git a/libs/rs/ScriptC.cpp b/libs/rs/ScriptC.cpp
index ad82ff4..80e8efc 100644
--- a/libs/rs/ScriptC.cpp
+++ b/libs/rs/ScriptC.cpp
@@ -22,11 +22,11 @@
#include "ScriptC.h"
ScriptC::ScriptC(RenderScript *rs,
- const char *codeTxt, size_t codeLength,
+ const void *codeTxt, size_t codeLength,
const char *cachedName, size_t cachedNameLength,
const char *cacheDir, size_t cacheDirLength)
: Script(NULL, rs) {
mID = rsScriptCCreate(rs->mContext, cachedName, cachedNameLength,
- cacheDir, cacheDirLength, codeTxt, codeLength);
+ cacheDir, cacheDirLength, (const char *)codeTxt, codeLength);
}
diff --git a/libs/rs/ScriptC.h b/libs/rs/ScriptC.h
index dcbbe10..b68f61c 100644
--- a/libs/rs/ScriptC.h
+++ b/libs/rs/ScriptC.h
@@ -25,7 +25,7 @@
class ScriptC : public Script {
protected:
ScriptC(RenderScript *rs,
- const char *codeTxt, size_t codeLength,
+ const void *codeTxt, size_t codeLength,
const char *cachedName, size_t cachedNameLength,
const char *cacheDir, size_t cacheDirLength);
diff --git a/libs/rs/driver/rsdCore.cpp b/libs/rs/driver/rsdCore.cpp
index 403393f..35a5c08 100644
--- a/libs/rs/driver/rsdCore.cpp
+++ b/libs/rs/driver/rsdCore.cpp
@@ -228,7 +228,12 @@
int cpu = sysconf(_SC_NPROCESSORS_ONLN);
ALOGV("%p Launching thread(s), CPUs %i", rsc, cpu);
- if (cpu < 2) cpu = 0;
+ if(rsc->props.mDebugMaxThreads && (cpu > (int)rsc->props.mDebugMaxThreads)) {
+ cpu = rsc->props.mDebugMaxThreads;
+ }
+ if (cpu < 2) {
+ cpu = 0;
+ }
dc->mWorkers.mCount = (uint32_t)cpu;
dc->mWorkers.mThreadId = (pthread_t *) calloc(dc->mWorkers.mCount, sizeof(pthread_t));
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 1b51872..5e21763 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -178,10 +178,10 @@
mFragmentStore->setup(this, &mStateFragmentStore);
}
-static bool getProp(const char *str) {
+static uint32_t getProp(const char *str) {
char buf[PROPERTY_VALUE_MAX];
property_get(str, buf, "0");
- return 0 != strcmp(buf, "0");
+ return atoi(buf);
}
void Context::displayDebugStats() {
@@ -211,13 +211,14 @@
setpriority(PRIO_PROCESS, rsc->mNativeThreadId, ANDROID_PRIORITY_DISPLAY);
rsc->mThreadPriority = ANDROID_PRIORITY_DISPLAY;
#endif //ANDROID_RS_SERIALIZE
- rsc->props.mLogTimes = getProp("debug.rs.profile");
- rsc->props.mLogScripts = getProp("debug.rs.script");
- rsc->props.mLogObjects = getProp("debug.rs.object");
- rsc->props.mLogShaders = getProp("debug.rs.shader");
- rsc->props.mLogShadersAttr = getProp("debug.rs.shader.attributes");
- rsc->props.mLogShadersUniforms = getProp("debug.rs.shader.uniforms");
- rsc->props.mLogVisual = getProp("debug.rs.visual");
+ rsc->props.mLogTimes = getProp("debug.rs.profile") != 0;
+ rsc->props.mLogScripts = getProp("debug.rs.script") != 0;
+ rsc->props.mLogObjects = getProp("debug.rs.object") != 0;
+ rsc->props.mLogShaders = getProp("debug.rs.shader") != 0;
+ rsc->props.mLogShadersAttr = getProp("debug.rs.shader.attributes") != 0;
+ rsc->props.mLogShadersUniforms = getProp("debug.rs.shader.uniforms") != 0;
+ rsc->props.mLogVisual = getProp("debug.rs.visual") != 0;
+ rsc->props.mDebugMaxThreads = getProp("debug.rs.max-threads");
if (!rsdHalInit(rsc, 0, 0)) {
rsc->setError(RS_ERROR_FATAL_DRIVER, "Failed initializing GL");
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index 0f44267..de110c6 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -184,6 +184,7 @@
bool mLogShadersAttr;
bool mLogShadersUniforms;
bool mLogVisual;
+ uint32_t mDebugMaxThreads;
} props;
mutable struct {
diff --git a/libs/rs/tests/Android.mk b/libs/rs/tests/Android.mk
index 197e862..627ff72 100644
--- a/libs/rs/tests/Android.mk
+++ b/libs/rs/tests/Android.mk
@@ -22,9 +22,15 @@
LOCAL_MODULE_TAGS := tests
-LOCAL_C_INCLUDES += .. \
- frameworks/base/libs/rs \
- out/target/product/stingray/obj/SHARED_LIBRARIES/libRS_intermediates
+intermediates := $(call intermediates-dir-for,STATIC_LIBRARIES,libRS,TARGET,)
+librs_generated_headers := \
+ $(intermediates)/rsgApiStructs.h \
+ $(intermediates)/rsgApiFuncDecl.h
+LOCAL_GENERATED_SOURCES := $(librs_generated_headers)
+
+LOCAL_C_INCLUDES += frameworks/base/libs/rs
+LOCAL_C_INCLUDES += $(intermediates)
+
include $(BUILD_EXECUTABLE)
diff --git a/libs/rs/tests/ScriptC_mono.cpp b/libs/rs/tests/ScriptC_mono.cpp
index 7f83616a..a6c63a8 100644
--- a/libs/rs/tests/ScriptC_mono.cpp
+++ b/libs/rs/tests/ScriptC_mono.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2012 The Android Open Source Project
+ * 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.
@@ -14,74 +14,105 @@
* limitations under the License.
*/
+
+/*
+ * This file is auto-generated. DO NOT MODIFY!
+ * The source Renderscript file: mono.rs
+ */
+
+
#include "ScriptC_mono.h"
-static const char mono[] = \
- "\xDE\xC0\x17\x0B\x00\x00\x00\x00\x18\x00\x00\x00\xFC\x03\x00\x00\x00\x00\x00\x00" \
- "\x10\x00\x00\x00\x42\x43\xC0\xDE\x21\x0C\x00\x00\xFC\x00\x00\x00\x01\x10\x00\x00" \
- "\x12\x00\x00\x00\x07\x81\x23\x91\x41\xC8\x04\x49\x06\x10\x32\x39\x92\x01\x84\x0C" \
- "\x25\x05\x08\x19\x1E\x04\x8B\x62\x80\x14\x45\x02\x42\x92\x0B\x42\xA4\x10\x32\x14" \
- "\x38\x08\x18\x49\x0A\x32\x44\x24\x48\x0A\x90\x21\x23\xC4\x52\x80\x0C\x19\x21\x72" \
- "\x24\x07\xC8\x48\x11\x62\xA8\xA0\xA8\x40\xC6\xF0\x01\x00\x00\x00\x49\x18\x00\x00" \
- "\x08\x00\x00\x00\x0B\x8C\x00\x04\x41\x10\x04\x09\x01\x04\x41\x10\x04\x89\xFF\xFF" \
- "\xFF\xFF\x1F\xC0\x60\x81\xF0\xFF\xFF\xFF\xFF\x03\x18\x00\x00\x00\x89\x20\x00\x00" \
- "\x13\x00\x00\x00\x32\x22\x48\x09\x20\x64\x85\x04\x93\x22\xA4\x84\x04\x93\x22\xE3" \
- "\x84\xA1\x90\x14\x12\x4C\x8A\x8C\x0B\x84\xA4\x4C\x10\x48\x23\x00\x73\x04\xC8\x30" \
- "\x02\x11\x90\x28\x03\x18\x83\xC8\x0C\xC0\x30\x02\x61\x14\xE1\x08\x42\xC3\x08\x83" \
- "\x51\x06\xA3\x14\xAD\x22\x08\x45\x6D\x20\x60\x8E\x00\x0C\x86\x11\x06\x08\x00\x00" \
- "\x13\xB0\x70\x90\x87\x76\xB0\x87\x3B\x68\x03\x77\x78\x07\x77\x28\x87\x36\x60\x87" \
- "\x74\x70\x87\x7A\xC0\x87\x36\x38\x07\x77\xA8\x87\x72\x08\x07\x71\x48\x87\x0D\xF2" \
- "\x50\x0E\x6D\x00\x0F\x7A\x30\x07\x72\xA0\x07\x73\x20\x07\x7A\x30\x07\x72\xD0\x06" \
- "\xE9\x10\x07\x7A\x80\x07\x7A\x80\x07\x6D\x90\x0E\x78\xA0\x07\x78\xA0\x07\x78\xD0" \
- "\x06\xE9\x10\x07\x76\xA0\x07\x71\x60\x07\x7A\x10\x07\x76\xD0\x06\xE9\x30\x07\x72" \
- "\xA0\x07\x73\x20\x07\x7A\x30\x07\x72\xD0\x06\xE9\x60\x07\x74\xA0\x07\x76\x40\x07" \
- "\x7A\x60\x07\x74\xD0\x06\xE6\x30\x07\x72\xA0\x07\x73\x20\x07\x7A\x30\x07\x72\xD0" \
- "\x06\xE6\x60\x07\x74\xA0\x07\x76\x40\x07\x7A\x60\x07\x74\xD0\x06\xF6\x60\x07\x74" \
- "\xA0\x07\x76\x40\x07\x7A\x60\x07\x74\xD0\x06\xF6\x10\x07\x72\x80\x07\x7A\x60\x07" \
- "\x74\xA0\x07\x71\x20\x07\x78\xD0\x06\xE1\x00\x07\x7A\x00\x07\x7A\x60\x07\x74\xD0" \
- "\x06\xEE\x30\x07\x72\xD0\x06\xB3\x60\x07\x74\x30\x44\x29\x00\x00\x08\x00\x00\x00" \
- "\x80\x21\x4A\x02\x04\x00\x00\x00\x00\x00\x0C\x51\x18\x20\x00\x00\x00\x00\x00\x60" \
- "\x88\xE2\x00\x01\x00\x00\x00\x00\x00\x79\x18\x00\x45\x00\x00\x00\x43\x88\x27\x78" \
- "\x84\x05\x87\x3D\x94\x83\x3C\xCC\x43\x3A\xBC\x83\x3B\x2C\x08\xE2\x60\x08\xF1\x10" \
- "\x4F\xB1\x20\x52\x87\x70\xB0\x87\x70\xF8\x05\x78\x08\x87\x71\x58\x87\x70\x38\x87" \
- "\x72\xF8\x05\x77\x08\x87\x76\x28\x87\x05\x63\x30\x0E\xEF\xD0\x0E\x6E\x50\x0E\xF8" \
- "\x10\x0E\xED\x00\x0F\xEC\x50\x0E\x6E\x10\x0E\xEE\x40\x0E\xF2\xF0\x0E\xE9\x40\x0E" \
- "\x6E\x20\x0F\xF3\xE0\x06\xE8\x50\x0E\xEC\xC0\x0E\xEF\x30\x0E\xEF\xD0\x0E\xF0\x50" \
- "\x0F\xF4\x50\x0E\x43\x84\xE7\x58\x40\xC8\xC3\x3B\xBC\x03\x3D\x0C\x11\x9E\x64\x41" \
- "\x30\x07\x43\x88\x67\x79\x98\x05\xCF\x3B\xB4\x83\x3B\xA4\x03\x3C\xBC\x03\x3D\x94" \
- "\x83\x3B\xD0\x03\x18\x8C\x03\x3A\x84\x83\x3C\x0C\x21\x9E\x06\x00\x16\x44\xB3\x90" \
- "\x0E\xED\x00\x0F\xEC\x50\x0E\x60\x30\x0A\x6F\x30\x0A\x6B\xB0\x06\x60\x40\x0B\xA2" \
- "\x10\x0A\xA1\x30\xE2\x18\x03\x78\x90\x87\x70\x38\x87\x76\x08\x87\x29\x02\x30\x8C" \
- "\xB8\xC6\x40\x1E\xE6\xE1\x17\xCA\x01\x1F\xE0\xE1\x1D\xE4\x81\x1E\x7E\xC1\x1C\xDE" \
- "\x41\x1E\xCA\x21\x1C\xC6\x01\x1D\x7E\xC1\x1D\xC2\xA1\x1D\xCA\x61\x4A\x60\x8C\x90" \
- "\xC6\x40\x1E\xE6\xE1\x17\xCA\x01\x1F\xE0\xE1\x1D\xE4\x81\x1E\x7E\xC1\x1C\xDE\x41" \
- "\x1E\xCA\x21\x1C\xC6\x01\x1D\xA6\x04\x08\x00\x00\x61\x20\x00\x00\x24\x00\x00\x00" \
- "\x13\x04\x41\x2C\x10\x00\x00\x00\x0C\x00\x00\x00\x04\x8B\xA0\x04\x46\x00\xE8\xCC" \
- "\x00\x90\x9A\x01\x98\x63\x70\x1A\x86\xCC\x18\x41\x6D\xFA\xB2\xEF\x8D\x11\x88\x6D" \
- "\xCC\xC6\xDF\x18\xC1\x49\x97\x72\xFA\x51\x9C\x63\x40\x0E\x63\x04\x00\x00\x00\x00" \
- "\x44\x8C\x11\x03\x42\x08\x82\x68\x90\x41\x4A\x9E\x11\x83\x42\x08\x84\x69\x99\x63" \
- "\x50\x28\x64\x90\xA1\x52\xA0\x11\x03\x42\x08\x06\x6B\x30\xA2\xB8\x06\x00\xC3\x81" \
- "\x00\x00\x00\x00\x03\x00\x00\x00\x46\x40\x54\x3F\xD2\x58\x41\x51\xFD\x0E\x35\x01" \
- "\x01\x31\x00\x00\x03\x00\x00\x00\x5B\x06\x20\x50\xB6\x0C\x47\xA0\x00\x00\x00\x00" \
- "\x00\x00\x00\x00\x79\x18\x00\x00\x0B\x00\x00\x00\x33\x08\x80\x1C\xC4\xE1\x1C\x66" \
- "\x14\x01\x3D\x88\x43\x38\x84\xC3\x8C\x42\x80\x07\x79\x78\x07\x73\x98\xB1\x0C\xE6" \
- "\x00\x0F\xE1\x30\x0E\xE3\x50\x0F\xF2\x10\x0E\xE3\x90\x0F\x00\x00\x71\x20\x00\x00" \
- "\x0E\x00\x00\x00\x06\x40\x44\x8E\x33\x59\x40\x14\x49\x6E\xF3\x00\x82\xC2\x39\x8B" \
- "\x13\xF1\x3C\xCF\x9B\x40\xF3\xCF\xF7\xE0\x4C\x5D\x75\xFF\x05\xFB\xDB\x80\xF6\xCF" \
- "\xF5\x1E\x49\x29\x20\x28\x9C\xB3\x38\x51\xEB\xF0\x3C\xCF\x77\xD5\xFD\x17\x00\x00" \
- "\x00\x00\x00\x00";
-
+static const unsigned char __txt[] = {
+ 0xde,0xc0,0x17,0x0b,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0xd0,0x04,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,
+ 0x31,0x01,0x00,0x00,0x01,0x10,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,
+ 0x41,0xc8,0x04,0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,
+ 0x1e,0x04,0x8b,0x62,0x80,0x14,0x45,0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,
+ 0x38,0x08,0x18,0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,
+ 0x0c,0x19,0x21,0x72,0x24,0x07,0xc8,0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,
+ 0x01,0x00,0x00,0x00,0x49,0x18,0x00,0x00,0x08,0x00,0x00,0x00,0x0b,0x8c,0x00,0x04,
+ 0x41,0x10,0x04,0x09,0x01,0x04,0x41,0x10,0x04,0x89,0xff,0xff,0xff,0xff,0x1f,0xc0,
+ 0x60,0x81,0xf0,0xff,0xff,0xff,0xff,0x03,0x18,0x00,0x00,0x00,0x89,0x20,0x00,0x00,
+ 0x14,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4,0x84,
+ 0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4,0x4c,
+ 0x10,0x54,0x73,0x04,0x60,0x40,0x60,0x06,0x80,0xc4,0x1c,0x01,0x42,0x64,0x04,0x60,
+ 0x18,0x81,0x20,0xe8,0x94,0xc1,0x20,0x44,0x69,0x18,0x81,0x10,0x8a,0xb0,0x0e,0xb1,
+ 0x61,0x84,0x41,0x28,0x83,0x70,0x8e,0x5e,0x11,0x8e,0xa3,0x38,0x10,0x30,0x8c,0x30,
+ 0x00,0x00,0x00,0x00,0x13,0xb0,0x70,0x90,0x87,0x76,0xb0,0x87,0x3b,0x68,0x03,0x77,
+ 0x78,0x07,0x77,0x28,0x87,0x36,0x60,0x87,0x74,0x70,0x87,0x7a,0xc0,0x87,0x36,0x38,
+ 0x07,0x77,0xa8,0x87,0x72,0x08,0x07,0x71,0x48,0x87,0x0d,0xf2,0x50,0x0e,0x6d,0x00,
+ 0x0f,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,
+ 0xe9,0x10,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90,0x0e,0x78,0xa0,0x07,0x78,
+ 0xa0,0x07,0x78,0xd0,0x06,0xe9,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x7a,0x10,
+ 0x07,0x76,0xd0,0x06,0xe9,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,
+ 0x72,0xd0,0x06,0xe9,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,
+ 0xd0,0x06,0xe6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,
+ 0x06,0xe6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,
+ 0xf6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,
+ 0x10,0x07,0x72,0x80,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,
+ 0x06,0xe1,0x00,0x07,0x7a,0x00,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xee,0x30,0x07,
+ 0x72,0xd0,0x06,0xb3,0x60,0x07,0x74,0xa0,0xf3,0x40,0x86,0x04,0x32,0x42,0x44,0x04,
+ 0x60,0x20,0x30,0x77,0x81,0x59,0x0a,0x34,0x44,0x51,0x00,0x00,0x08,0x00,0x00,0x00,
+ 0x80,0x21,0x4a,0x03,0x04,0x00,0x00,0x00,0x00,0x00,0x0c,0x51,0x20,0x20,0x00,0x00,
+ 0x00,0x00,0x00,0x60,0x88,0x22,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x59,0x20,0x00,
+ 0x08,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,
+ 0xc6,0x04,0x43,0x02,0x85,0x50,0x06,0x44,0x4a,0x80,0xc4,0x18,0x81,0xce,0x9a,0x73,
+ 0xfe,0x01,0x00,0x00,0x79,0x18,0x00,0x00,0x69,0x00,0x00,0x00,0x43,0x88,0x29,0x98,
+ 0x84,0x05,0x87,0x3d,0x94,0x83,0x3c,0xcc,0x43,0x3a,0xbc,0x83,0x3b,0x2c,0x08,0xe2,
+ 0x60,0x08,0x31,0x11,0x53,0xb1,0x20,0x52,0x87,0x70,0xb0,0x87,0x70,0xf8,0x05,0x78,
+ 0x08,0x87,0x71,0x58,0x87,0x70,0x38,0x87,0x72,0xf8,0x05,0x77,0x08,0x87,0x76,0x28,
+ 0x87,0x05,0x63,0x30,0x0e,0xef,0xd0,0x0e,0x6e,0x50,0x0e,0xf8,0x10,0x0e,0xed,0x00,
+ 0x0f,0xec,0x50,0x0e,0x6e,0x10,0x0e,0xee,0x40,0x0e,0xf2,0xf0,0x0e,0xe9,0x40,0x0e,
+ 0x6e,0x20,0x0f,0xf3,0xe0,0x06,0xe8,0x50,0x0e,0xec,0xc0,0x0e,0xef,0x30,0x0e,0xef,
+ 0xd0,0x0e,0xf0,0x50,0x0f,0xf4,0x50,0x0e,0x43,0x04,0x00,0x19,0x42,0x4c,0xc8,0x94,
+ 0x2c,0x20,0xce,0x21,0x15,0xdc,0x81,0x1e,0x16,0x04,0x75,0x30,0x84,0x98,0x96,0x49,
+ 0x58,0x60,0x8c,0x83,0x29,0xb0,0xc3,0x3b,0x84,0x03,0x3d,0x0c,0x21,0xa6,0x66,0x72,
+ 0x16,0x14,0xe7,0x20,0x0a,0xef,0xf0,0x0e,0xec,0xb0,0x40,0x88,0x83,0x38,0x18,0x22,
+ 0x4c,0xd0,0x02,0x42,0x1e,0xde,0xe1,0x1d,0xe8,0x61,0x88,0x30,0x49,0x0b,0x82,0x39,
+ 0x18,0x42,0x4c,0xd4,0x54,0x2d,0x78,0xde,0xa1,0x1d,0xdc,0x21,0x1d,0xe0,0xe1,0x1d,
+ 0xe8,0xa1,0x1c,0xdc,0x81,0x1e,0xc0,0x60,0x1c,0xd0,0x21,0x1c,0xe4,0x61,0x08,0x31,
+ 0x59,0x06,0xb0,0x20,0x9a,0x85,0x74,0x68,0x07,0x78,0x60,0x87,0x72,0x00,0x83,0x51,
+ 0x78,0x83,0x51,0x58,0x83,0x35,0x00,0x03,0x5a,0x10,0x85,0x50,0x08,0x85,0x11,0xc7,
+ 0x18,0xc0,0x83,0x3c,0x84,0xc3,0x39,0xb4,0x43,0x38,0x4c,0x11,0x80,0x61,0xc4,0x34,
+ 0x06,0xef,0x00,0x0f,0xf4,0x90,0x0e,0xed,0x90,0x0e,0xfa,0x10,0x0e,0xf4,0x90,0x0e,
+ 0xef,0xe0,0x0e,0xbf,0xc0,0x0e,0xe5,0x60,0x0f,0xe5,0xc0,0x0e,0x53,0x02,0x63,0x84,
+ 0x33,0x06,0xf2,0x30,0x0f,0xbf,0x50,0x0e,0xf8,0x00,0x0f,0xef,0x20,0x0f,0xf4,0xf0,
+ 0x0b,0xf6,0x10,0x0e,0xf2,0x30,0x65,0x38,0x14,0x66,0x04,0x34,0x06,0xf2,0x30,0x0f,
+ 0xbf,0xf0,0x0e,0xe2,0xa0,0x0e,0xe5,0x30,0x0e,0xf4,0xf0,0x0b,0xf3,0xc0,0x0e,0xef,
+ 0x40,0x0f,0xf3,0x30,0x05,0x18,0x71,0x8d,0x81,0x3c,0xcc,0xc3,0x2f,0x94,0x03,0x3e,
+ 0xc0,0xc3,0x3b,0xc8,0x03,0x3d,0xfc,0x82,0x39,0xbc,0x83,0x3c,0x94,0x43,0x38,0x8c,
+ 0x03,0x3a,0xfc,0x82,0x3b,0x84,0x43,0x3b,0x94,0xc3,0x94,0xe0,0x19,0x21,0x8d,0x81,
+ 0x3c,0xcc,0xc3,0x2f,0x94,0x03,0x3e,0xc0,0xc3,0x3b,0xc8,0x03,0x3d,0xfc,0x82,0x39,
+ 0xbc,0x83,0x3c,0x94,0x43,0x38,0x8c,0x03,0x3a,0x4c,0x09,0x22,0x00,0x00,0x00,0x00,
+ 0x79,0x18,0x00,0x00,0x0b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,
+ 0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07,0x73,
+ 0x98,0xb1,0x0c,0xe6,0x00,0x0f,0xe1,0x30,0x0e,0xe3,0x50,0x0f,0xf2,0x10,0x0e,0xe3,
+ 0x90,0x0f,0x00,0x00,0x71,0x20,0x00,0x00,0x13,0x00,0x00,0x00,0x06,0x40,0x18,0x62,
+ 0x33,0x99,0x40,0x61,0x6c,0x8e,0xb3,0xd8,0x00,0x11,0x39,0xce,0x64,0x04,0x51,0x24,
+ 0xb9,0xcd,0x03,0x08,0x0a,0xe7,0x2c,0x4e,0xc4,0xf3,0x3c,0x6f,0x05,0xcd,0x3f,0xdf,
+ 0x83,0x33,0x75,0xd5,0xfd,0x17,0xec,0x6f,0x01,0x86,0xf0,0x2d,0x0e,0x30,0x99,0x81,
+ 0xf6,0xcf,0xf5,0x1e,0x49,0x29,0x20,0x28,0x9c,0xb3,0x38,0x51,0xeb,0xf0,0x3c,0xcf,
+ 0x77,0xd5,0xfd,0x17,0x00,0x00,0x00,0x00,0x61,0x20,0x00,0x00,0x21,0x00,0x00,0x00,
+ 0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x46,0x00,0x68,
+ 0xcd,0x00,0x90,0x9b,0x01,0x18,0x6b,0x38,0xe9,0x52,0x4e,0x3f,0xb1,0x8d,0xd9,0xf8,
+ 0xab,0x4d,0x5f,0xf6,0x3d,0xa2,0x63,0x0d,0x40,0x20,0x8c,0x00,0x00,0x00,0x00,0x00,
+ 0xb4,0x8c,0x11,0x03,0x42,0x08,0x88,0x69,0x90,0x81,0x72,0xa2,0x11,0x83,0x42,0x08,
+ 0x8a,0x0a,0x9a,0x63,0x78,0xac,0x66,0x90,0xe1,0x7a,0xa4,0x11,0x03,0x42,0x08,0x0c,
+ 0x6c,0x30,0x82,0xc9,0x06,0x00,0xc3,0x81,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
+ 0xb6,0x40,0x54,0x3f,0xd2,0x18,0x43,0x51,0xfd,0x0e,0x35,0x01,0x01,0x31,0x00,0x00,
+ 0x03,0x00,0x00,0x00,0x5b,0x06,0x20,0x98,0xb6,0x0c,0x47,0x30,0x01,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+};
ScriptC_mono::ScriptC_mono(RenderScript *rs, const char *cacheDir, size_t cacheDirLength) :
- ScriptC(rs, mono, sizeof(mono) - 1, "mono", 4, cacheDir, cacheDirLength) {
-
- printf("sizeof text %i", sizeof(mono));
-
-
-
+ ScriptC(rs, __txt, sizeof(__txt), "mono.rs", 4, cacheDir, cacheDirLength) {
}
-void ScriptC_mono::forEach_root(const Allocation *ain, const Allocation *aout) {
+ScriptC_mono::~ScriptC_mono() {
+}
+
+void ScriptC_mono::forEach_root(const Allocation *ain, const Allocation *aout) const {
forEach(0, ain, aout, NULL, 0);
}
diff --git a/libs/rs/tests/ScriptC_mono.h b/libs/rs/tests/ScriptC_mono.h
index 7e4f601..69c41ac 100644
--- a/libs/rs/tests/ScriptC_mono.h
+++ b/libs/rs/tests/ScriptC_mono.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2012 The Android Open Source Project
+ * 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.
@@ -14,13 +14,42 @@
* limitations under the License.
*/
+
+/*
+ * This file is auto-generated. DO NOT MODIFY!
+ * The source Renderscript file: mono.rs
+ */
+
+
#include "ScriptC.h"
class ScriptC_mono : protected ScriptC {
+private:
+ int32_t __gInt;
+ bool __gBool;
public:
ScriptC_mono(RenderScript *rs, const char *cacheDir, size_t cacheDirLength);
-
- void forEach_root(const Allocation *ain, const Allocation *aout);
-
+ virtual ~ScriptC_mono();
+
+ void set_gInt(int32_t v) {
+ setVar(0, v);
+ __gInt = v;
+ }
+ int32_t get_gInt() const {
+ return __gInt;
+ }
+
+ float get_cFloat() const {
+ return 1.2f;
+ }
+
+ void set_gBool(bool v) {
+ setVar(2, v);
+ __gBool = v;
+ }
+ bool get_gBool() const {
+ return __gBool;
+ }
+
+ void forEach_root(const Allocation *ain, const Allocation *aout) const;
};
-
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index 139ff01..d92180d 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -24,6 +24,7 @@
import android.os.Looper;
import android.os.Message;
import android.os.Parcel;
+import android.os.Parcelable;
import android.os.ParcelFileDescriptor;
import android.os.PowerManager;
import android.util.Log;
@@ -455,6 +456,22 @@
* <td>Successful invoke of this method in a valid state transfers the
* object to the <em>Stopped</em> state. Calling this method in an
* invalid state transfers the object to the <em>Error</em> state.</p></td></tr>
+ * <tr><td>getTrackInfo </p></td>
+ * <td>{Prepared, Started, Stopped, Paused, PlaybackCompleted}</p></td>
+ * <td>{Idle, Initialized, Error}</p></td>
+ * <td>Successful invoke of this method does not change the state.</p></td></tr>
+ * <tr><td>addExternalSource </p></td>
+ * <td>{Prepared, Started, Stopped, Paused, PlaybackCompleted}</p></td>
+ * <td>{Idle, Initialized, Error}</p></td>
+ * <td>Successful invoke of this method does not change the state.</p></td></tr>
+ * <tr><td>selectTrack </p></td>
+ * <td>{Prepared, Started, Stopped, Paused, PlaybackCompleted}</p></td>
+ * <td>{Idle, Initialized, Error}</p></td>
+ * <td>Successful invoke of this method does not change the state.</p></td></tr>
+ * <tr><td>disableTrack </p></td>
+ * <td>{Prepared, Started, Stopped, Paused, PlaybackCompleted}</p></td>
+ * <td>{Idle, Initialized, Error}</p></td>
+ * <td>Successful invoke of this method does not change the state.</p></td></tr>
*
* </table>
*
@@ -572,6 +589,15 @@
*/
private native void _setVideoSurface(Surface surface);
+ /* Do not change these values (starting with INVOKE_ID) without updating
+ * their counterparts in include/media/mediaplayer.h!
+ */
+ private static final int INVOKE_ID_GET_TRACK_INFO = 1;
+ private static final int INVOKE_ID_ADD_EXTERNAL_SOURCE = 2;
+ private static final int INVOKE_ID_ADD_EXTERNAL_SOURCE_FD = 3;
+ private static final int INVOKE_ID_SELECT_TRACK = 4;
+ private static final int INVOKE_ID_UNSELECT_TRACK = 5;
+
/**
* Create a request parcel which can be routed to the native media
* player using {@link #invoke(Parcel, Parcel)}. The Parcel
@@ -1155,6 +1181,25 @@
}
/**
+ * Set the MediaPlayer to start when this MediaPlayer finishes playback
+ * (i.e. reaches the end of the stream).
+ * The media framework will attempt to transition from this player to
+ * the next as seamlessly as possible. The next player can be set at
+ * any time before completion. The next player must be prepared by the
+ * app, and the application should not call start() on it.
+ * The next MediaPlayer must be different from 'this'. An exception
+ * will be thrown if next == this.
+ * The application may call setNextMediaPlayer(null) to indicate no
+ * next player should be started at the end of playback.
+ * If the current player is looping, it will keep looping and the next
+ * player will not be started.
+ *
+ * @param next the player to start after this one completes playback.
+ *
+ */
+ public native void setNextMediaPlayer(MediaPlayer next);
+
+ /**
* Releases resources associated with this MediaPlayer object.
* It is considered good practice to call this method when you're
* done using the MediaPlayer. In particular, whenever an Activity
@@ -1293,23 +1338,6 @@
/* Do not change these values (starting with KEY_PARAMETER) without updating
* their counterparts in include/media/mediaplayer.h!
*/
- /*
- * Key used in setParameter method.
- * Indicates the index of the timed text track to be enabled/disabled.
- * The index includes both the in-band and out-of-band timed text.
- * The index should start from in-band text if any. Application can retrieve the number
- * of in-band text tracks by using MediaMetadataRetriever::extractMetadata().
- * Note it might take a few hundred ms to scan an out-of-band text file
- * before displaying it.
- */
- private static final int KEY_PARAMETER_TIMED_TEXT_TRACK_INDEX = 1000;
- /*
- * Key used in setParameter method.
- * Used to add out-of-band timed text source path.
- * Application can add multiple text sources by calling setParameter() with
- * KEY_PARAMETER_TIMED_TEXT_ADD_OUT_OF_BAND_SOURCE multiple times.
- */
- private static final int KEY_PARAMETER_TIMED_TEXT_ADD_OUT_OF_BAND_SOURCE = 1001;
// There are currently no defined keys usable from Java with get*Parameter.
// But if any keys are defined, the order must be kept in sync with include/media/mediaplayer.h.
@@ -1354,7 +1382,7 @@
return ret;
}
- /**
+ /*
* Gets the value of the parameter indicated by key.
* @param key key indicates the parameter to get.
* @param reply value of the parameter to get.
@@ -1416,7 +1444,7 @@
*/
public native void setAuxEffectSendLevel(float level);
- /**
+ /*
* @param request Parcel destinated to the media player. The
* Interface token must be set to the IMediaPlayer
* one to be routed correctly through the system.
@@ -1426,7 +1454,7 @@
private native final int native_invoke(Parcel request, Parcel reply);
- /**
+ /*
* @param update_only If true fetch only the set of metadata that have
* changed since the last invocation of getMetadata.
* The set is built using the unfiltered
@@ -1443,7 +1471,7 @@
boolean apply_filter,
Parcel reply);
- /**
+ /*
* @param request Parcel with the 2 serialized lists of allowed
* metadata types followed by the one to be
* dropped. Each list starts with an integer
@@ -1457,33 +1485,289 @@
private native final void native_finalize();
/**
- * @param index The index of the text track to be turned on.
- * @return true if the text track is enabled successfully.
+ * Class for MediaPlayer to return each audio/video/subtitle track's metadata.
+ *
+ * {@see #getTrackInfo()}.
* {@hide}
*/
- public boolean enableTimedTextTrackIndex(int index) {
- if (index < 0) {
- return false;
+ static public class TrackInfo implements Parcelable {
+ /**
+ * Gets the track type.
+ * @return TrackType which indicates if the track is video, audio, timed text.
+ */
+ public int getTrackType() {
+ return mTrackType;
}
- return setParameter(KEY_PARAMETER_TIMED_TEXT_TRACK_INDEX, index);
+
+ /**
+ * Gets the language code of the track.
+ * @return a language code in either way of ISO-639-1 or ISO-639-2.
+ * When the language is unknown or could not be determined,
+ * ISO-639-2 language code, "und", is returned.
+ */
+ public String getLanguage() {
+ return mLanguage;
+ }
+
+ public static final int MEDIA_TRACK_TYPE_UNKNOWN = 0;
+ public static final int MEDIA_TRACK_TYPE_VIDEO = 1;
+ public static final int MEDIA_TRACK_TYPE_AUDIO = 2;
+ public static final int MEDIA_TRACK_TYPE_TIMEDTEXT = 3;
+
+ final int mTrackType;
+ final String mLanguage;
+
+ TrackInfo(Parcel in) {
+ mTrackType = in.readInt();
+ mLanguage = in.readString();
+ }
+
+ /*
+ * No special parcel contents. Keep it as hide.
+ * {@hide}
+ */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /*
+ * {@hide}
+ */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(mTrackType);
+ dest.writeString(mLanguage);
+ }
+
+ /**
+ * Used to read a TrackInfo from a Parcel.
+ */
+ static final Parcelable.Creator<TrackInfo> CREATOR
+ = new Parcelable.Creator<TrackInfo>() {
+ @Override
+ public TrackInfo createFromParcel(Parcel in) {
+ return new TrackInfo(in);
+ }
+
+ @Override
+ public TrackInfo[] newArray(int size) {
+ return new TrackInfo[size];
+ }
+ };
+
+ };
+
+ /**
+ * Returns an array of track information.
+ *
+ * @return Array of track info. null if an error occured.
+ * {@hide}
+ */
+ // FIXME: It returns timed text tracks' information for now. Other types of tracks will be
+ // supported in future.
+ public TrackInfo[] getTrackInfo() {
+ Parcel request = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ request.writeInterfaceToken(IMEDIA_PLAYER);
+ request.writeInt(INVOKE_ID_GET_TRACK_INFO);
+ invoke(request, reply);
+ TrackInfo trackInfo[] = reply.createTypedArray(TrackInfo.CREATOR);
+ return trackInfo;
+ }
+
+ /*
+ * A helper function to check if the mime type is supported by media framework.
+ */
+ private boolean availableMimeTypeForExternalSource(String mimeType) {
+ if (mimeType == MEDIA_MIMETYPE_TEXT_SUBRIP) {
+ return true;
+ }
+ return false;
+ }
+
+ /* TODO: Limit the total number of external timed text source to a reasonable number.
+ */
+ /**
+ * Adds an external source file.
+ *
+ * Currently supported format is SubRip with the file extension .srt, case insensitive.
+ * Note that a single external source may contain multiple tracks in it.
+ * One can find the total number of available tracks using {@link #getTrackInfo()} to see what
+ * additional tracks become available after this method call.
+ *
+ * @param path The file path of external source file.
+ * {@hide}
+ */
+ // FIXME: define error codes and throws exceptions according to the error codes.
+ // (IllegalStateException, IOException).
+ public void addExternalSource(String path, String mimeType)
+ throws IllegalArgumentException {
+ if (!availableMimeTypeForExternalSource(mimeType)) {
+ throw new IllegalArgumentException("Illegal mimeType for external source: " + mimeType);
+ }
+
+ Parcel request = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ request.writeInterfaceToken(IMEDIA_PLAYER);
+ request.writeInt(INVOKE_ID_ADD_EXTERNAL_SOURCE);
+ request.writeString(path);
+ request.writeString(mimeType);
+ invoke(request, reply);
}
/**
- * Enables the first timed text track if any.
- * @return true if the text track is enabled successfully
+ * Adds an external source file (Uri).
+ *
+ * Currently supported format is SubRip with the file extension .srt, case insensitive.
+ * Note that a single external source may contain multiple tracks in it.
+ * One can find the total number of available tracks using {@link #getTrackInfo()} to see what
+ * additional tracks become available after this method call.
+ *
+ * @param context the Context to use when resolving the Uri
+ * @param uri the Content URI of the data you want to play
* {@hide}
*/
- public boolean enableTimedText() {
- return enableTimedTextTrackIndex(0);
+ // FIXME: define error codes and throws exceptions according to the error codes.
+ // (IllegalStateException, IOException).
+ public void addExternalSource(Context context, Uri uri, String mimeType)
+ throws IOException, IllegalArgumentException {
+ String scheme = uri.getScheme();
+ if(scheme == null || scheme.equals("file")) {
+ addExternalSource(uri.getPath(), mimeType);
+ return;
+ }
+
+ AssetFileDescriptor fd = null;
+ try {
+ ContentResolver resolver = context.getContentResolver();
+ fd = resolver.openAssetFileDescriptor(uri, "r");
+ if (fd == null) {
+ return;
+ }
+ addExternalSource(fd.getFileDescriptor(), mimeType);
+ return;
+ } catch (SecurityException ex) {
+ } catch (IOException ex) {
+ } finally {
+ if (fd != null) {
+ fd.close();
+ }
+ }
+
+ // TODO: try server side.
+ }
+
+ /* Do not change these values without updating their counterparts
+ * in include/media/stagefright/MediaDefs.h and media/libstagefright/MediaDefs.cpp!
+ */
+ /**
+ * MIME type for SubRip (SRT) container. Used in {@link #addExternalSource()} APIs.
+ * {@hide}
+ */
+ public static final String MEDIA_MIMETYPE_TEXT_SUBRIP = "application/x-subrip";
+
+ /**
+ * Adds an external source file (FileDescriptor).
+ * It is the caller's responsibility to close the file descriptor.
+ * It is safe to do so as soon as this call returns.
+ *
+ * Currently supported format is SubRip with the file extension .srt, case insensitive.
+ * Note that a single external source may contain multiple tracks in it.
+ * One can find the total number of available tracks using {@link #getTrackInfo()} to see what
+ * additional tracks become available after this method call.
+ *
+ * @param fd the FileDescriptor for the file you want to play
+ * @param mimeType A MIME type for the content. It can be null.
+ * <ul>
+ * <li>{@link #MEDIA_MIMETYPE_TEXT_SUBRIP}
+ * </ul>
+ * {@hide}
+ */
+ // FIXME: define error codes and throws exceptions according to the error codes.
+ // (IllegalStateException, IOException).
+ public void addExternalSource(FileDescriptor fd, String mimeType)
+ throws IllegalArgumentException {
+ // intentionally less than LONG_MAX
+ addExternalSource(fd, 0, 0x7ffffffffffffffL, mimeType);
}
/**
- * Disables timed text display.
- * @return true if the text track is disabled successfully.
+ * Adds an external timed text file (FileDescriptor).
+ * It is the caller's responsibility to close the file descriptor.
+ * It is safe to do so as soon as this call returns.
+ *
+ * Currently supported format is SubRip with the file extension .srt, case insensitive.
+ * Note that a single external source may contain multiple tracks in it.
+ * One can find the total number of available tracks using {@link #getTrackInfo()} to see what
+ * additional tracks become available after this method call.
+ *
+ * @param fd the FileDescriptor for the file you want to play
+ * @param offset the offset into the file where the data to be played starts, in bytes
+ * @param length the length in bytes of the data to be played
+ * @param mimeType A MIME type for the content. It can be null.
* {@hide}
*/
- public boolean disableTimedText() {
- return setParameter(KEY_PARAMETER_TIMED_TEXT_TRACK_INDEX, -1);
+ // FIXME: define error codes and throws exceptions according to the error codes.
+ // (IllegalStateException, IOException).
+ public void addExternalSource(FileDescriptor fd, long offset, long length, String mimeType)
+ throws IllegalArgumentException {
+ if (!availableMimeTypeForExternalSource(mimeType)) {
+ throw new IllegalArgumentException("Illegal mimeType for external source: " + mimeType);
+ }
+ Parcel request = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ request.writeInterfaceToken(IMEDIA_PLAYER);
+ request.writeInt(INVOKE_ID_ADD_EXTERNAL_SOURCE_FD);
+ request.writeFileDescriptor(fd);
+ request.writeLong(offset);
+ request.writeLong(length);
+ request.writeString(mimeType);
+ invoke(request, reply);
+ }
+
+ /**
+ * Selects a track.
+ * <p>
+ * If a MediaPlayer is in invalid state, it throws exception.
+ * If a MediaPlayer is in Started state, the selected track will be presented immediately.
+ * If a MediaPlayer is not in Started state, it just marks the track to be played.
+ * </p>
+ * <p>
+ * In any valid state, if it is called multiple times on the same type of track (ie. Video,
+ * Audio, Timed Text), the most recent one will be chosen.
+ * </p>
+ * <p>
+ * The first audio and video tracks will be selected by default, even though this function is not
+ * called. However, no timed text track will be selected until this function is called.
+ * </p>
+ * {@hide}
+ */
+ // FIXME: define error codes and throws exceptions according to the error codes.
+ // (IllegalStateException, IOException, IllegalArgumentException).
+ public void selectTrack(int index) {
+ Parcel request = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ request.writeInterfaceToken(IMEDIA_PLAYER);
+ request.writeInt(INVOKE_ID_SELECT_TRACK);
+ request.writeInt(index);
+ invoke(request, reply);
+ }
+
+ /**
+ * Unselect a track.
+ * If the track identified by index has not been selected before, it throws an exception.
+ * {@hide}
+ */
+ // FIXME: define error codes and throws exceptions according to the error codes.
+ // (IllegalStateException, IOException, IllegalArgumentException).
+ public void unselectTrack(int index) {
+ Parcel request = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ request.writeInterfaceToken(IMEDIA_PLAYER);
+ request.writeInt(INVOKE_ID_UNSELECT_TRACK);
+ request.writeInt(index);
+ invoke(request, reply);
}
/**
@@ -1622,14 +1906,14 @@
// No real default action so far.
return;
case MEDIA_TIMED_TEXT:
- if (mOnTimedTextListener != null) {
- if (msg.obj == null) {
- mOnTimedTextListener.onTimedText(mMediaPlayer, null);
- } else {
- if (msg.obj instanceof byte[]) {
- TimedText text = new TimedText((byte[])(msg.obj));
- mOnTimedTextListener.onTimedText(mMediaPlayer, text);
- }
+ if (mOnTimedTextListener == null)
+ return;
+ if (msg.obj == null) {
+ mOnTimedTextListener.onTimedText(mMediaPlayer, null);
+ } else {
+ if (msg.obj instanceof byte[]) {
+ TimedText text = new TimedText((byte[])(msg.obj));
+ mOnTimedTextListener.onTimedText(mMediaPlayer, text);
}
}
return;
@@ -1644,7 +1928,7 @@
}
}
- /**
+ /*
* Called from native code when an interesting event happens. This method
* just uses the EventHandler system to post the event back to the main app thread.
* We use a weak reference to the original MediaPlayer object so that the native
@@ -1659,6 +1943,10 @@
return;
}
+ if (what == MEDIA_INFO && arg1 == MEDIA_INFO_STARTED_AS_NEXT) {
+ // this acquires the wakelock if needed, and sets the client side state
+ mp.start();
+ }
if (mp.mEventHandler != null) {
Message m = mp.mEventHandler.obtainMessage(what, arg1, arg2, obj);
mp.mEventHandler.sendMessage(m);
@@ -1913,6 +2201,13 @@
*/
public static final int MEDIA_INFO_UNKNOWN = 1;
+ /** The player was started because it was used as the next player for another
+ * player, which just completed playback.
+ * @see android.media.MediaPlayer.OnInfoListener
+ * @hide
+ */
+ public static final int MEDIA_INFO_STARTED_AS_NEXT = 2;
+
/** The video is too complex for the decoder: it can't decode frames fast
* enough. Possibly only the audio plays fine at this stage.
* @see android.media.MediaPlayer.OnInfoListener
@@ -1947,6 +2242,13 @@
*/
public static final int MEDIA_INFO_METADATA_UPDATE = 802;
+ /** Failed to handle timed text track properly.
+ * @see android.media.MediaPlayer.OnInfoListener
+ *
+ * {@hide}
+ */
+ public static final int MEDIA_INFO_TIMED_TEXT_ERROR = 900;
+
/**
* Interface definition of a callback to be invoked to communicate some
* info and/or warning about the media or its playback.
diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java
index 2fe45ec..2175131 100644
--- a/media/java/android/media/MediaRecorder.java
+++ b/media/java/android/media/MediaRecorder.java
@@ -124,9 +124,15 @@
/**
* Sets a Surface to show a preview of recorded media (video). Calls this
* before prepare() to make sure that the desirable preview display is
- * set.
+ * set. If {@link #setCamera(Camera)} is used and the surface has been
+ * already set to the camera, application do not need to call this. If
+ * this is called with non-null surface, the preview surface of the camera
+ * will be replaced by the new surface. If this method is called with null
+ * surface or not called at all, media recorder will not change the preview
+ * surface of the camera.
*
* @param sv the Surface to use for the preview
+ * @see android.hardware.Camera#setPreviewDisplay(android.view.SurfaceHolder)
*/
public void setPreviewDisplay(Surface sv) {
mSurface = sv;
diff --git a/media/jni/Android.mk b/media/jni/Android.mk
index 070d2d9..079a284 100644
--- a/media/jni/Android.mk
+++ b/media/jni/Android.mk
@@ -22,6 +22,7 @@
libutils \
libbinder \
libmedia \
+ libmedia_native \
libskia \
libui \
libcutils \
@@ -47,7 +48,7 @@
frameworks/base/media/libstagefright/codecs/amrnb/common \
frameworks/base/media/libstagefright/codecs/amrnb/common/include \
frameworks/base/media/mtp \
- frameworks/base/include/media/stagefright/openmax \
+ frameworks/native/include/media/openmax \
$(PV_INCLUDES) \
$(JNI_H_INCLUDE) \
$(call include-path-for, corecg graphics)
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index f572f71..745e253 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -795,6 +795,33 @@
process_media_player_call(env, thiz, mp->getParameter(key, reply), NULL, NULL );
}
+static void
+android_media_MediaPlayer_setNextMediaPlayer(JNIEnv *env, jobject thiz, jobject java_player)
+{
+ ALOGV("setNextMediaPlayer");
+ sp<MediaPlayer> thisplayer = getMediaPlayer(env, thiz);
+ if (thisplayer == NULL) {
+ jniThrowException(env, "java/lang/IllegalStateException", "This player not initialized");
+ return;
+ }
+ sp<MediaPlayer> nextplayer = (java_player == NULL) ? NULL : getMediaPlayer(env, java_player);
+ if (nextplayer == NULL && java_player != NULL) {
+ jniThrowException(env, "java/lang/IllegalStateException", "That player not initialized");
+ return;
+ }
+
+ if (nextplayer == thisplayer) {
+ jniThrowException(env, "java/lang/IllegalArgumentException", "Next player can't be self");
+ return;
+ }
+ // tie the two players together
+ process_media_player_call(
+ env, thiz, thisplayer->setNextMediaPlayer(nextplayer),
+ "java/lang/IllegalArgumentException",
+ "setNextMediaPlayer failed." );
+ ;
+}
+
// ----------------------------------------------------------------------------
static JNINativeMethod gMethods[] = {
@@ -840,6 +867,7 @@
{"setParameter", "(ILandroid/os/Parcel;)Z", (void *)android_media_MediaPlayer_setParameter},
{"getParameter", "(ILandroid/os/Parcel;)V", (void *)android_media_MediaPlayer_getParameter},
{"native_setRetransmitEndpoint", "(Ljava/lang/String;I)I", (void *)android_media_MediaPlayer_setRetransmitEndpoint},
+ {"setNextMediaPlayer", "(Landroid/media/MediaPlayer;)V", (void *)android_media_MediaPlayer_setNextMediaPlayer},
};
static const char* const kClassPathName = "android/media/MediaPlayer";
diff --git a/media/jni/audioeffect/Android.mk b/media/jni/audioeffect/Android.mk
index 3e493b1..0059bb2 100644
--- a/media/jni/audioeffect/Android.mk
+++ b/media/jni/audioeffect/Android.mk
@@ -10,10 +10,11 @@
libutils \
libandroid_runtime \
libnativehelper \
- libmedia
+ libmedia \
+ libmedia_native
LOCAL_C_INCLUDES := \
- system/media/audio_effects/include
+ $(call include-path-for, audio-effects)
LOCAL_MODULE:= libaudioeffect_jni
diff --git a/media/jni/mediaeditor/Android.mk b/media/jni/mediaeditor/Android.mk
index 6003608..688e180 100755
--- a/media/jni/mediaeditor/Android.mk
+++ b/media/jni/mediaeditor/Android.mk
@@ -36,14 +36,15 @@
$(TOP)/frameworks/base/media/libstagefright/rtsp \
$(JNI_H_INCLUDE) \
$(call include-path-for, corecg graphics) \
- $(TOP)/frameworks/base/include/media/stagefright/openmax \
+ $(TOP)/frameworks/native/include/media/editor \
$(TOP)/frameworks/base/core/jni/mediaeditor \
$(TOP)/frameworks/media/libvideoeditor/vss/inc \
$(TOP)/frameworks/media/libvideoeditor/vss/common/inc \
$(TOP)/frameworks/media/libvideoeditor/vss/mcs/inc \
$(TOP)/frameworks/media/libvideoeditor/vss/stagefrightshells/inc \
$(TOP)/frameworks/media/libvideoeditor/lvpp \
- $(TOP)/frameworks/media/libvideoeditor/osal/inc
+ $(TOP)/frameworks/media/libvideoeditor/osal/inc \
+ $(TOP)/frameworks/native/include/media/openmax
LOCAL_SHARED_LIBRARIES := \
libaudioutils \
diff --git a/media/jni/soundpool/Android.mk b/media/jni/soundpool/Android.mk
index 9ff2e24..98d6449 100644
--- a/media/jni/soundpool/Android.mk
+++ b/media/jni/soundpool/Android.mk
@@ -12,7 +12,8 @@
libbinder \
libandroid_runtime \
libnativehelper \
- libmedia
+ libmedia \
+ libmedia_native
LOCAL_MODULE:= libsoundpool
diff --git a/media/libaah_rtp/Android.mk b/media/libaah_rtp/Android.mk
index 54fd9ec..6c927ba 100644
--- a/media/libaah_rtp/Android.mk
+++ b/media/libaah_rtp/Android.mk
@@ -21,14 +21,15 @@
LOCAL_C_INCLUDES := \
frameworks/base/include \
- frameworks/base/include/media/stagefright/openmax \
frameworks/base/media \
- frameworks/base/media/libstagefright
+ frameworks/base/media/libstagefright \
+ frameworks/native/include/media/openmax
LOCAL_SHARED_LIBRARIES := \
libcommon_time_client \
libbinder \
libmedia \
+ libmedia_native \
libstagefright \
libstagefright_foundation \
libutils
@@ -37,4 +38,3 @@
-lpthread
include $(BUILD_SHARED_LIBRARY)
-
diff --git a/media/libaah_rtp/aah_decoder_pump.cpp b/media/libaah_rtp/aah_decoder_pump.cpp
index 28b8c7b..bebba54e 100644
--- a/media/libaah_rtp/aah_decoder_pump.cpp
+++ b/media/libaah_rtp/aah_decoder_pump.cpp
@@ -105,9 +105,8 @@
AudioTrack::getMinFrameCount(&frameCount,
AUDIO_STREAM_DEFAULT,
static_cast<int>(format_sample_rate_));
- int ch_format = (format_channels_ == 1)
- ? AUDIO_CHANNEL_OUT_MONO
- : AUDIO_CHANNEL_OUT_STEREO;
+ audio_channel_mask_t ch_format =
+ audio_channel_out_mask_from_count(format_channels_);
res = renderer_->set(AUDIO_STREAM_DEFAULT,
format_sample_rate_,
diff --git a/media/libaah_rtp/aah_decoder_pump.h b/media/libaah_rtp/aah_decoder_pump.h
index f5a6529..4d57e49 100644
--- a/media/libaah_rtp/aah_decoder_pump.h
+++ b/media/libaah_rtp/aah_decoder_pump.h
@@ -75,7 +75,7 @@
void stopAndCleanupRenderer();
sp<MetaData> format_;
- int32_t format_channels_;
+ int32_t format_channels_; // channel count, not channel mask
int32_t format_sample_rate_;
sp<MediaSource> decoder_;
diff --git a/media/libeffects/downmix/Android.mk b/media/libeffects/downmix/Android.mk
index 0348e1e..95ca6fd 100644
--- a/media/libeffects/downmix/Android.mk
+++ b/media/libeffects/downmix/Android.mk
@@ -20,8 +20,8 @@
endif
LOCAL_C_INCLUDES := \
- system/media/audio_effects/include \
- system/media/audio_utils/include
+ $(call include-path-for, audio-effects) \
+ $(call include-path-for, audio-utils)
LOCAL_PRELINK_MODULE := false
diff --git a/media/libeffects/factory/Android.mk b/media/libeffects/factory/Android.mk
index 2f2b974..6e69151 100644
--- a/media/libeffects/factory/Android.mk
+++ b/media/libeffects/factory/Android.mk
@@ -15,6 +15,6 @@
LOCAL_SHARED_LIBRARIES += libdl
LOCAL_C_INCLUDES := \
- system/media/audio_effects/include
+ $(call include-path-for, audio-effects)
include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libeffects/lvm/wrapper/Android.mk b/media/libeffects/lvm/wrapper/Android.mk
index f097dd0..4313424 100644
--- a/media/libeffects/lvm/wrapper/Android.mk
+++ b/media/libeffects/lvm/wrapper/Android.mk
@@ -26,7 +26,7 @@
$(LOCAL_PATH)/Bundle \
$(LOCAL_PATH)/../lib/Common/lib/ \
$(LOCAL_PATH)/../lib/Bundle/lib/ \
- system/media/audio_effects/include
+ $(call include-path-for, audio-effects)
include $(BUILD_SHARED_LIBRARY)
@@ -55,6 +55,6 @@
$(LOCAL_PATH)/Reverb \
$(LOCAL_PATH)/../lib/Common/lib/ \
$(LOCAL_PATH)/../lib/Reverb/lib/ \
- system/media/audio_effects/include
+ $(call include-path-for, audio-effects)
-include $(BUILD_SHARED_LIBRARY)
\ No newline at end of file
+include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index 3714283..ca93ce5 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -24,7 +24,7 @@
#include <stdlib.h>
#include <string.h>
#include <new>
-#include <EffectBundle.h>
+#include "EffectBundle.h"
// effect_handle_t interface implementation for bass boost
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
index 358357e..9599dcc 100755
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
@@ -24,8 +24,9 @@
#include <stdlib.h>
#include <string.h>
#include <new>
-#include <EffectReverb.h>
-#include <LVREV.h>
+#include "EffectReverb.h"
+// from Reverb/lib
+#include "LVREV.h"
// effect_handle_t interface implementation for reverb
extern "C" const struct effect_interface_s gReverbInterface;
diff --git a/media/libeffects/preprocessing/Android.mk b/media/libeffects/preprocessing/Android.mk
index 7f7c7e1..c13b9d4 100755
--- a/media/libeffects/preprocessing/Android.mk
+++ b/media/libeffects/preprocessing/Android.mk
@@ -14,7 +14,7 @@
external/webrtc/src \
external/webrtc/src/modules/interface \
external/webrtc/src/modules/audio_processing/interface \
- system/media/audio_effects/include
+ $(call include-path-for, audio-effects)
LOCAL_C_INCLUDES += $(call include-path-for, speex)
diff --git a/media/libeffects/preprocessing/PreProcessing.cpp b/media/libeffects/preprocessing/PreProcessing.cpp
index dc27d38..1d76f62 100755
--- a/media/libeffects/preprocessing/PreProcessing.cpp
+++ b/media/libeffects/preprocessing/PreProcessing.cpp
@@ -956,10 +956,9 @@
memset(config, 0, sizeof(effect_config_t));
config->inputCfg.samplingRate = config->outputCfg.samplingRate = session->samplingRate;
config->inputCfg.format = config->outputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
- config->inputCfg.channels = session->inChannelCount == 1 ?
- AUDIO_CHANNEL_IN_MONO : AUDIO_CHANNEL_IN_STEREO;
- config->outputCfg.channels = session->outChannelCount == 1 ?
- AUDIO_CHANNEL_IN_MONO : AUDIO_CHANNEL_IN_STEREO;
+ config->inputCfg.channels = audio_channel_in_mask_from_count(session->inChannelCount);
+ // "out" doesn't mean output device, so this is the correct API to convert channel count to mask
+ config->outputCfg.channels = audio_channel_in_mask_from_count(session->outChannelCount);
config->inputCfg.mask = config->outputCfg.mask =
(EFFECT_CONFIG_SMP_RATE | EFFECT_CONFIG_CHANNELS | EFFECT_CONFIG_FORMAT);
}
@@ -999,7 +998,7 @@
config->inputCfg.samplingRate = config->outputCfg.samplingRate = session->samplingRate;
config->inputCfg.format = config->outputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
config->inputCfg.channels = config->outputCfg.channels =
- session->revChannelCount == 1 ? AUDIO_CHANNEL_IN_MONO : AUDIO_CHANNEL_IN_STEREO;
+ audio_channel_in_mask_from_count(session->revChannelCount);
config->inputCfg.mask = config->outputCfg.mask =
(EFFECT_CONFIG_SMP_RATE | EFFECT_CONFIG_CHANNELS | EFFECT_CONFIG_FORMAT);
}
diff --git a/media/libeffects/testlibs/Android.mk_ b/media/libeffects/testlibs/Android.mk_
index 249ebf4..2954908 100644
--- a/media/libeffects/testlibs/Android.mk_
+++ b/media/libeffects/testlibs/Android.mk_
@@ -23,7 +23,7 @@
endif
LOCAL_C_INCLUDES := \
- system/media/audio_effects/include \
+ $(call include-path-for, audio-effects) \
$(call include-path-for, graphics corecg)
LOCAL_MODULE_TAGS := optional
@@ -60,7 +60,7 @@
LOCAL_C_INCLUDES := \
$(call include-path-for, graphics corecg) \
- system/media/audio_effects/include
+ $(call include-path-for, audio-effects)
LOCAL_MODULE_TAGS := optional
diff --git a/media/libeffects/visualizer/Android.mk b/media/libeffects/visualizer/Android.mk
index 2160177..76b5110 100644
--- a/media/libeffects/visualizer/Android.mk
+++ b/media/libeffects/visualizer/Android.mk
@@ -17,7 +17,7 @@
LOCAL_C_INCLUDES := \
$(call include-path-for, graphics corecg) \
- system/media/audio_effects/include
+ $(call include-path-for, audio-effects)
include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libmedia/Android.mk b/media/libmedia/Android.mk
index 23670df..21e8f29 100644
--- a/media/libmedia/Android.mk
+++ b/media/libmedia/Android.mk
@@ -48,7 +48,7 @@
LOCAL_SHARED_LIBRARIES := \
libui libcutils libutils libbinder libsonivox libicuuc libexpat \
libcamera_client libstagefright_foundation \
- libgui libdl libaudioutils
+ libgui libdl libaudioutils libmedia_native
LOCAL_WHOLE_STATIC_LIBRARY := libmedia_helper
@@ -57,10 +57,10 @@
LOCAL_C_INCLUDES := \
$(JNI_H_INCLUDE) \
$(call include-path-for, graphics corecg) \
- $(TOP)/frameworks/base/include/media/stagefright/openmax \
+ $(TOP)/frameworks/native/include/media/openmax \
external/icu4c/common \
external/expat/lib \
- system/media/audio_effects/include \
- system/media/audio_utils/include
+ $(call include-path-for, audio-effects) \
+ $(call include-path-for, audio-utils)
include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libmedia/AudioEffect.cpp b/media/libmedia/AudioEffect.cpp
index 6808aa2..34451ca 100644
--- a/media/libmedia/AudioEffect.cpp
+++ b/media/libmedia/AudioEffect.cpp
@@ -174,7 +174,7 @@
mIEffect->disconnect();
mIEffect->asBinder()->unlinkToDeath(mIEffectClient);
}
- IPCThreadState::self()->flushCommands();
+ IPCThreadState::self()->flushCommands();
}
mIEffect.clear();
mIEffectClient.clear();
@@ -480,4 +480,3 @@
}; // namespace android
-
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index 22c3a18..05ade75 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -293,13 +293,13 @@
return WOULD_BLOCK;
}
}
- }
+ }
AutoMutex lock(mLock);
// acquire a strong reference on the IAudioRecord and IMemory so that they cannot be destroyed
// while we are accessing the cblk
- sp <IAudioRecord> audioRecord = mAudioRecord;
- sp <IMemory> iMem = mCblkMemory;
+ sp<IAudioRecord> audioRecord = mAudioRecord;
+ sp<IMemory> iMem = mCblkMemory;
audio_track_cblk_t* cblk = mCblk;
if (mActive == 0) {
mActive = 1;
@@ -638,8 +638,8 @@
mLock.lock();
// acquire a strong reference on the IAudioRecord and IMemory so that they cannot be destroyed
// while we are accessing the cblk
- sp <IAudioRecord> audioRecord = mAudioRecord;
- sp <IMemory> iMem = mCblkMemory;
+ sp<IAudioRecord> audioRecord = mAudioRecord;
+ sp<IMemory> iMem = mCblkMemory;
mLock.unlock();
do {
@@ -684,8 +684,8 @@
mLock.lock();
// acquire a strong reference on the IAudioRecord and IMemory so that they cannot be destroyed
// while we are accessing the cblk
- sp <IAudioRecord> audioRecord = mAudioRecord;
- sp <IMemory> iMem = mCblkMemory;
+ sp<IAudioRecord> audioRecord = mAudioRecord;
+ sp<IMemory> iMem = mCblkMemory;
audio_track_cblk_t* cblk = mCblk;
mLock.unlock();
@@ -806,7 +806,7 @@
}
}
ALOGV("restoreRecord_l() status %d mActive %d cblk %p, old cblk %p flags %08x old flags %08x",
- result, mActive, mCblk, cblk, mCblk->flags, cblk->flags);
+ result, mActive, mCblk, cblk, mCblk->flags, cblk->flags);
if (result == NO_ERROR) {
// from now on we switch to the newly created cblk
@@ -843,4 +843,3 @@
// -------------------------------------------------------------------------
}; // namespace android
-
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp
index a1cbf0f..33c7d03 100644
--- a/media/libmedia/AudioSystem.cpp
+++ b/media/libmedia/AudioSystem.cpp
@@ -59,14 +59,14 @@
break;
ALOGW("AudioFlinger not published, waiting...");
usleep(500000); // 0.5 s
- } while(true);
+ } while (true);
if (gAudioFlingerClient == NULL) {
gAudioFlingerClient = new AudioFlingerClient();
} else {
if (gAudioErrorCallback) {
gAudioErrorCallback(NO_ERROR);
}
- }
+ }
binder->linkToDeath(gAudioFlingerClient);
gAudioFlinger = interface_cast<IAudioFlinger>(binder);
gAudioFlinger->registerClient(gAudioFlingerClient);
@@ -482,7 +482,7 @@
}
bool AudioSystem::routedToA2dpOutput(audio_stream_type_t streamType) {
- switch(streamType) {
+ switch (streamType) {
case AUDIO_STREAM_MUSIC:
case AUDIO_STREAM_VOICE_CALL:
case AUDIO_STREAM_BLUETOOTH_SCO:
@@ -512,7 +512,7 @@
break;
ALOGW("AudioPolicyService not published, waiting...");
usleep(500000); // 0.5 s
- } while(true);
+ } while (true);
if (gAudioPolicyServiceClient == NULL) {
gAudioPolicyServiceClient = new AudioPolicyServiceClient();
}
@@ -768,4 +768,3 @@
}
}; // namespace android
-
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 34563ca..048be1d 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -72,7 +72,7 @@
if (minBufCount < 2) minBufCount = 2;
*frameCount = (sampleRate == 0) ? afFrameCount * minBufCount :
- afFrameCount * minBufCount * sampleRate / afSampleRate;
+ afFrameCount * minBufCount * sampleRate / afSampleRate;
return NO_ERROR;
}
@@ -352,13 +352,13 @@
return;
}
}
- }
+ }
AutoMutex lock(mLock);
// acquire a strong reference on the IMemory and IAudioTrack so that they cannot be destroyed
// while we are accessing the cblk
- sp <IAudioTrack> audioTrack = mAudioTrack;
- sp <IMemory> iMem = mCblkMemory;
+ sp<IAudioTrack> audioTrack = mAudioTrack;
+ sp<IMemory> iMem = mCblkMemory;
audio_track_cblk_t* cblk = mCblk;
if (!mActive) {
@@ -743,8 +743,8 @@
status_t status;
const sp<IAudioFlinger>& audioFlinger = AudioSystem::get_audio_flinger();
if (audioFlinger == 0) {
- ALOGE("Could not get audioflinger");
- return NO_INIT;
+ ALOGE("Could not get audioflinger");
+ return NO_INIT;
}
int afSampleRate;
@@ -830,7 +830,7 @@
mCblk->buffers = (char*)mCblk + sizeof(audio_track_cblk_t);
} else {
mCblk->buffers = sharedBuffer->pointer();
- // Force buffer full condition as data is already present in shared memory
+ // Force buffer full condition as data is already present in shared memory
mCblk->stepUser(mCblk->frameCount);
}
@@ -991,8 +991,8 @@
// acquire a strong reference on the IMemory and IAudioTrack so that they cannot be destroyed
// while we are accessing the cblk
mLock.lock();
- sp <IAudioTrack> audioTrack = mAudioTrack;
- sp <IMemory> iMem = mCblkMemory;
+ sp<IAudioTrack> audioTrack = mAudioTrack;
+ sp<IMemory> iMem = mCblkMemory;
mLock.unlock();
ssize_t written = 0;
@@ -1095,8 +1095,8 @@
mLock.lock();
// acquire a strong reference on the IMemory and IAudioTrack so that they cannot be destroyed
// while we are accessing the cblk
- sp <IAudioTrack> audioTrack = mAudioTrack;
- sp <IMemory> iMem = mCblkMemory;
+ sp<IAudioTrack> audioTrack = mAudioTrack;
+ sp<IMemory> iMem = mCblkMemory;
audio_track_cblk_t* cblk = mCblk;
bool active = mActive;
mLock.unlock();
@@ -1224,7 +1224,7 @@
if (!(android_atomic_or(CBLK_RESTORING_ON, &cblk->flags) & CBLK_RESTORING_MSK)) {
ALOGW("dead IAudioTrack, creating a new one from %s TID %d",
- fromStart ? "start()" : "obtainBuffer()", gettid());
+ fromStart ? "start()" : "obtainBuffer()", gettid());
// signal old cblk condition so that other threads waiting for available buffers stop
// waiting now
@@ -1310,7 +1310,7 @@
}
}
ALOGV("restoreTrack_l() status %d mActive %d cblk %p, old cblk %p flags %08x old flags %08x",
- result, mActive, mCblk, cblk, mCblk->flags, cblk->flags);
+ result, mActive, mCblk, cblk, mCblk->flags, cblk->flags);
if (result == NO_ERROR) {
// from now on we switch to the newly created cblk
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index 47c261da..07b12e4 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -622,11 +622,11 @@
sp<IEffect> effect;
if (pDesc == NULL) {
- return effect;
- if (status) {
- *status = BAD_VALUE;
- }
- }
+ return effect;
+ if (status) {
+ *status = BAD_VALUE;
+ }
+ }
data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
data.writeInt32(pid);
@@ -679,7 +679,7 @@
status_t BnAudioFlinger::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
- switch(code) {
+ switch (code) {
case CREATE_TRACK: {
CHECK_INTERFACE(IAudioFlinger, data, reply);
pid_t pid = data.readInt32();
@@ -745,7 +745,7 @@
reply->writeInt32( latency((audio_io_handle_t) data.readInt32()) );
return NO_ERROR;
} break;
- case SET_MASTER_VOLUME: {
+ case SET_MASTER_VOLUME: {
CHECK_INTERFACE(IAudioFlinger, data, reply);
reply->writeInt32( setMasterVolume(data.readFloat()) );
return NO_ERROR;
@@ -815,14 +815,14 @@
String8 keyValuePairs(data.readString8());
reply->writeInt32(setParameters(ioHandle, keyValuePairs));
return NO_ERROR;
- } break;
+ } break;
case GET_PARAMETERS: {
CHECK_INTERFACE(IAudioFlinger, data, reply);
audio_io_handle_t ioHandle = (audio_io_handle_t) data.readInt32();
String8 keys(data.readString8());
reply->writeString8(getParameters(ioHandle, keys));
return NO_ERROR;
- } break;
+ } break;
case REGISTER_CLIENT: {
CHECK_INTERFACE(IAudioFlinger, data, reply);
diff --git a/media/libmedia/IAudioFlingerClient.cpp b/media/libmedia/IAudioFlingerClient.cpp
index 1db39a3..4178b29 100644
--- a/media/libmedia/IAudioFlingerClient.cpp
+++ b/media/libmedia/IAudioFlingerClient.cpp
@@ -68,7 +68,7 @@
status_t BnAudioFlingerClient::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
- switch(code) {
+ switch (code) {
case IO_CONFIG_CHANGED: {
CHECK_INTERFACE(IAudioFlingerClient, data, reply);
int event = data.readInt32();
diff --git a/media/libmedia/IAudioPolicyService.cpp b/media/libmedia/IAudioPolicyService.cpp
index da7c124..5040bd9 100644
--- a/media/libmedia/IAudioPolicyService.cpp
+++ b/media/libmedia/IAudioPolicyService.cpp
@@ -365,7 +365,7 @@
status_t BnAudioPolicyService::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
- switch(code) {
+ switch (code) {
case SET_DEVICE_CONNECTION_STATE: {
CHECK_INTERFACE(IAudioPolicyService, data, reply);
audio_devices_t device =
diff --git a/media/libmedia/IAudioRecord.cpp b/media/libmedia/IAudioRecord.cpp
index 6b473c9..377b9a8 100644
--- a/media/libmedia/IAudioRecord.cpp
+++ b/media/libmedia/IAudioRecord.cpp
@@ -2,16 +2,16 @@
**
** Copyright 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
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this 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,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
** limitations under the License.
*/
@@ -41,7 +41,7 @@
: BpInterface<IAudioRecord>(impl)
{
}
-
+
virtual status_t start(pid_t tid)
{
Parcel data, reply;
@@ -55,14 +55,14 @@
}
return status;
}
-
+
virtual void stop()
{
Parcel data, reply;
data.writeInterfaceToken(IAudioRecord::getInterfaceDescriptor());
remote()->transact(STOP, data, &reply);
}
-
+
virtual sp<IMemory> getCblk() const
{
Parcel data, reply;
@@ -73,7 +73,7 @@
cblk = interface_cast<IMemory>(reply.readStrongBinder());
}
return cblk;
- }
+ }
};
IMPLEMENT_META_INTERFACE(AudioRecord, "android.media.IAudioRecord");
@@ -83,8 +83,8 @@
status_t BnAudioRecord::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
- switch(code) {
- case GET_CBLK: {
+ switch (code) {
+ case GET_CBLK: {
CHECK_INTERFACE(IAudioRecord, data, reply);
reply->writeStrongBinder(getCblk()->asBinder());
return NO_ERROR;
@@ -105,4 +105,3 @@
}
}; // namespace android
-
diff --git a/media/libmedia/IAudioTrack.cpp b/media/libmedia/IAudioTrack.cpp
index 28ebbbfc..09f31a7 100644
--- a/media/libmedia/IAudioTrack.cpp
+++ b/media/libmedia/IAudioTrack.cpp
@@ -2,16 +2,16 @@
**
** Copyright 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
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this 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,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
** limitations under the License.
*/
@@ -48,7 +48,7 @@
: BpInterface<IAudioTrack>(impl)
{
}
-
+
virtual sp<IMemory> getCblk() const
{
Parcel data, reply;
@@ -74,14 +74,14 @@
}
return status;
}
-
+
virtual void stop()
{
Parcel data, reply;
data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor());
remote()->transact(STOP, data, &reply);
}
-
+
virtual void flush()
{
Parcel data, reply;
@@ -96,14 +96,14 @@
data.writeInt32(e);
remote()->transact(MUTE, data, &reply);
}
-
+
virtual void pause()
{
Parcel data, reply;
data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor());
remote()->transact(PAUSE, data, &reply);
}
-
+
virtual status_t attachAuxEffect(int effectId)
{
Parcel data, reply;
@@ -172,8 +172,8 @@
status_t BnAudioTrack::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
- switch(code) {
- case GET_CBLK: {
+ switch (code) {
+ case GET_CBLK: {
CHECK_INTERFACE(IAudioTrack, data, reply);
reply->writeStrongBinder(getCblk()->asBinder());
return NO_ERROR;
diff --git a/media/libmedia/IEffect.cpp b/media/libmedia/IEffect.cpp
index 5d40cc8..a303a8f 100644
--- a/media/libmedia/IEffect.cpp
+++ b/media/libmedia/IEffect.cpp
@@ -129,7 +129,7 @@
status_t BnEffect::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
- switch(code) {
+ switch (code) {
case ENABLE: {
ALOGV("ENABLE");
CHECK_INTERFACE(IEffect, data, reply);
@@ -186,10 +186,10 @@
} break;
case GET_CBLK: {
- CHECK_INTERFACE(IEffect, data, reply);
- reply->writeStrongBinder(getCblk()->asBinder());
- return NO_ERROR;
- } break;
+ CHECK_INTERFACE(IEffect, data, reply);
+ reply->writeStrongBinder(getCblk()->asBinder());
+ return NO_ERROR;
+ } break;
default:
return BBinder::onTransact(code, data, reply, flags);
@@ -199,4 +199,3 @@
// ----------------------------------------------------------------------------
}; // namespace android
-
diff --git a/media/libmedia/IEffectClient.cpp b/media/libmedia/IEffectClient.cpp
index 4693b45..aef4371 100644
--- a/media/libmedia/IEffectClient.cpp
+++ b/media/libmedia/IEffectClient.cpp
@@ -94,7 +94,7 @@
status_t BnEffectClient::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
- switch(code) {
+ switch (code) {
case CONTROL_STATUS_CHANGED: {
ALOGV("CONTROL_STATUS_CHANGED");
CHECK_INTERFACE(IEffectClient, data, reply);
@@ -142,4 +142,3 @@
// ----------------------------------------------------------------------------
}; // namespace android
-
diff --git a/media/libmedia/IMediaDeathNotifier.cpp b/media/libmedia/IMediaDeathNotifier.cpp
index aeb35a5..9199db6 100644
--- a/media/libmedia/IMediaDeathNotifier.cpp
+++ b/media/libmedia/IMediaDeathNotifier.cpp
@@ -43,10 +43,10 @@
binder = sm->getService(String16("media.player"));
if (binder != 0) {
break;
- }
- ALOGW("Media player service not published, waiting...");
- usleep(500000); // 0.5 s
- } while(true);
+ }
+ ALOGW("Media player service not published, waiting...");
+ usleep(500000); // 0.5 s
+ } while (true);
if (sDeathNotifier == NULL) {
sDeathNotifier = new DeathNotifier();
diff --git a/media/libmedia/IMediaPlayer.cpp b/media/libmedia/IMediaPlayer.cpp
index c47fa41..0bb237d 100644
--- a/media/libmedia/IMediaPlayer.cpp
+++ b/media/libmedia/IMediaPlayer.cpp
@@ -55,6 +55,7 @@
SET_PARAMETER,
GET_PARAMETER,
SET_RETRANSMIT_ENDPOINT,
+ SET_NEXT_PLAYER,
};
class BpMediaPlayer: public BpInterface<IMediaPlayer>
@@ -307,7 +308,15 @@
if (OK != err) {
return err;
}
+ return reply.readInt32();
+ }
+ status_t setNextPlayer(const sp<IMediaPlayer>& player) {
+ Parcel data, reply;
+ data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor());
+ sp<IBinder> b(player->asBinder());
+ data.writeStrongBinder(b);
+ remote()->transact(SET_NEXT_PLAYER, data, &reply);
return reply.readInt32();
}
};
@@ -319,7 +328,7 @@
status_t BnMediaPlayer::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
- switch(code) {
+ switch (code) {
case DISCONNECT: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
disconnect();
@@ -489,7 +498,11 @@
} else {
reply->writeInt32(setRetransmitEndpoint(NULL));
}
-
+ return NO_ERROR;
+ } break;
+ case SET_NEXT_PLAYER: {
+ CHECK_INTERFACE(IMediaPlayer, data, reply);
+ reply->writeInt32(setNextPlayer(interface_cast<IMediaPlayer>(data.readStrongBinder())));
return NO_ERROR;
} break;
default:
diff --git a/media/libmedia/IMediaPlayerClient.cpp b/media/libmedia/IMediaPlayerClient.cpp
index 1f135c4..a670c96 100644
--- a/media/libmedia/IMediaPlayerClient.cpp
+++ b/media/libmedia/IMediaPlayerClient.cpp
@@ -56,7 +56,7 @@
status_t BnMediaPlayerClient::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
- switch(code) {
+ switch (code) {
case NOTIFY: {
CHECK_INTERFACE(IMediaPlayerClient, data, reply);
int msg = data.readInt32();
diff --git a/media/libmedia/IMediaPlayerService.cpp b/media/libmedia/IMediaPlayerService.cpp
index f5b5cbd..f5fccef 100644
--- a/media/libmedia/IMediaPlayerService.cpp
+++ b/media/libmedia/IMediaPlayerService.cpp
@@ -132,7 +132,7 @@
status_t BnMediaPlayerService::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
- switch(code) {
+ switch (code) {
case CREATE: {
CHECK_INTERFACE(IMediaPlayerService, data, reply);
pid_t pid = data.readInt32();
diff --git a/media/libmedia/IMediaRecorder.cpp b/media/libmedia/IMediaRecorder.cpp
index 2f4e31a..a710fd7 100644
--- a/media/libmedia/IMediaRecorder.cpp
+++ b/media/libmedia/IMediaRecorder.cpp
@@ -289,7 +289,7 @@
status_t BnMediaRecorder::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
- switch(code) {
+ switch (code) {
case RELEASE: {
ALOGV("RELEASE");
CHECK_INTERFACE(IMediaRecorder, data, reply);
diff --git a/media/libmedia/IMediaRecorderClient.cpp b/media/libmedia/IMediaRecorderClient.cpp
index ff235c9..e7907e3 100644
--- a/media/libmedia/IMediaRecorderClient.cpp
+++ b/media/libmedia/IMediaRecorderClient.cpp
@@ -53,7 +53,7 @@
status_t BnMediaRecorderClient::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
- switch(code) {
+ switch (code) {
case NOTIFY: {
CHECK_INTERFACE(IMediaRecorderClient, data, reply);
int msg = data.readInt32();
diff --git a/media/libmedia/JetPlayer.cpp b/media/libmedia/JetPlayer.cpp
index a85956c..f1f62f7 100644
--- a/media/libmedia/JetPlayer.cpp
+++ b/media/libmedia/JetPlayer.cpp
@@ -74,14 +74,14 @@
// init the EAS library
result = EAS_Init(&mEasData);
- if( result != EAS_SUCCESS) {
+ if (result != EAS_SUCCESS) {
ALOGE("JetPlayer::init(): Error initializing Sonivox EAS library, aborting.");
mState = EAS_STATE_ERROR;
return result;
}
// init the JET library with the default app event controller range
result = JET_Init(mEasData, NULL, sizeof(S_JET_CONFIG));
- if( result != EAS_SUCCESS) {
+ if (result != EAS_SUCCESS) {
ALOGE("JetPlayer::init(): Error initializing JET library, aborting.");
mState = EAS_STATE_ERROR;
return result;
@@ -92,7 +92,7 @@
mAudioTrack->set(AUDIO_STREAM_MUSIC, //TODO parametrize this
pLibConfig->sampleRate,
AUDIO_FORMAT_PCM_16_BIT,
- (pLibConfig->numChannels == 2) ? AUDIO_CHANNEL_OUT_STEREO : AUDIO_CHANNEL_OUT_MONO,
+ audio_channel_out_mask_from_count(pLibConfig->numChannels),
mTrackBufferSize,
AUDIO_POLICY_OUTPUT_FLAG_NONE);
@@ -151,7 +151,7 @@
mAudioBuffer = NULL;
}
mEasData = NULL;
-
+
return EAS_SUCCESS;
}
@@ -166,7 +166,7 @@
ALOGV("JetPlayer::render(): entering");
// allocate render buffer
- mAudioBuffer =
+ mAudioBuffer =
new EAS_PCM[pLibConfig->mixBufferSize * pLibConfig->numChannels * MIX_NUM_BUFFERS];
// signal main thread that we started
@@ -177,8 +177,8 @@
mCondition.signal();
}
- while (1) {
-
+ while (1) {
+
mMutex.lock(); // [[[[[[[[ LOCK ---------------------------------------
if (mEasData == NULL) {
@@ -186,20 +186,20 @@
ALOGV("JetPlayer::render(): NULL EAS data, exiting render.");
goto threadExit;
}
-
+
// nothing to render, wait for client thread to wake us up
while (!mRender)
{
ALOGV("JetPlayer::render(): signal wait");
- if (audioStarted) {
- mAudioTrack->pause();
+ if (audioStarted) {
+ mAudioTrack->pause();
// we have to restart the playback once we start rendering again
audioStarted = false;
}
mCondition.wait(mMutex);
ALOGV("JetPlayer::render(): signal rx'd");
}
-
+
// render midi data into the input buffer
int num_output = 0;
EAS_PCM* p = mAudioBuffer;
@@ -210,8 +210,8 @@
}
p += count * pLibConfig->numChannels;
num_output += count * pLibConfig->numChannels * sizeof(EAS_PCM);
-
- // send events that were generated (if any) to the event callback
+
+ // send events that were generated (if any) to the event callback
fireEventsFromJetQueue();
}
@@ -265,9 +265,9 @@
// precondition: mMutex locked
void JetPlayer::fireUpdateOnStatusChange()
{
- if( (mJetStatus.currentUserID != mPreviousJetStatus.currentUserID)
+ if ( (mJetStatus.currentUserID != mPreviousJetStatus.currentUserID)
||(mJetStatus.segmentRepeatCount != mPreviousJetStatus.segmentRepeatCount) ) {
- if(mEventCallback) {
+ if (mEventCallback) {
mEventCallback(
JetPlayer::JET_USERID_UPDATE,
mJetStatus.currentUserID,
@@ -278,8 +278,8 @@
mPreviousJetStatus.segmentRepeatCount = mJetStatus.segmentRepeatCount;
}
- if(mJetStatus.numQueuedSegments != mPreviousJetStatus.numQueuedSegments) {
- if(mEventCallback) {
+ if (mJetStatus.numQueuedSegments != mPreviousJetStatus.numQueuedSegments) {
+ if (mEventCallback) {
mEventCallback(
JetPlayer::JET_NUMQUEUEDSEGMENT_UPDATE,
mJetStatus.numQueuedSegments,
@@ -289,8 +289,8 @@
mPreviousJetStatus.numQueuedSegments = mJetStatus.numQueuedSegments;
}
- if(mJetStatus.paused != mPreviousJetStatus.paused) {
- if(mEventCallback) {
+ if (mJetStatus.paused != mPreviousJetStatus.paused) {
+ if (mEventCallback) {
mEventCallback(JetPlayer::JET_PAUSE_UPDATE,
mJetStatus.paused,
-1,
@@ -307,7 +307,7 @@
// precondition: mMutex locked
void JetPlayer::fireEventsFromJetQueue()
{
- if(!mEventCallback) {
+ if (!mEventCallback) {
// no callback, just empty the event queue
while (JET_GetEvent(mEasData, NULL, NULL)) { }
return;
@@ -341,7 +341,7 @@
mEasJetFileLoc->offset = 0;
EAS_RESULT result = JET_OpenFile(mEasData, mEasJetFileLoc);
- if(result != EAS_SUCCESS)
+ if (result != EAS_SUCCESS)
mState = EAS_STATE_ERROR;
else
mState = EAS_STATE_OPEN;
@@ -353,7 +353,7 @@
int JetPlayer::loadFromFD(const int fd, const long long offset, const long long length)
{
ALOGV("JetPlayer::loadFromFD(): fd=%d offset=%lld length=%lld", fd, offset, length);
-
+
Mutex::Autolock lock(mMutex);
mEasJetFileLoc = (EAS_FILE_LOCATOR) malloc(sizeof(EAS_FILE));
@@ -361,9 +361,9 @@
mEasJetFileLoc->offset = offset;
mEasJetFileLoc->length = length;
mEasJetFileLoc->path = NULL;
-
+
EAS_RESULT result = JET_OpenFile(mEasData, mEasJetFileLoc);
- if(result != EAS_SUCCESS)
+ if (result != EAS_SUCCESS)
mState = EAS_STATE_ERROR;
else
mState = EAS_STATE_OPEN;
@@ -392,7 +392,7 @@
JET_Status(mEasData, &mJetStatus);
this->dumpJetStatus(&mJetStatus);
-
+
fireUpdateOnStatusChange();
// wake up render thread
@@ -468,7 +468,7 @@
void JetPlayer::dumpJetStatus(S_JET_STATUS* pJetStatus)
{
- if(pJetStatus!=NULL)
+ if (pJetStatus!=NULL)
ALOGV(">> current JET player status: userID=%d segmentRepeatCount=%d numQueuedSegments=%d paused=%d",
pJetStatus->currentUserID, pJetStatus->segmentRepeatCount,
pJetStatus->numQueuedSegments, pJetStatus->paused);
@@ -478,4 +478,3 @@
} // end namespace android
-
diff --git a/media/libmedia/MediaProfiles.cpp b/media/libmedia/MediaProfiles.cpp
index 93ddca8..c224f06 100644
--- a/media/libmedia/MediaProfiles.cpp
+++ b/media/libmedia/MediaProfiles.cpp
@@ -26,7 +26,7 @@
#include <expat.h>
#include <media/MediaProfiles.h>
#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/openmax/OMX_Video.h>
+#include <OMX_Video.h>
namespace android {
@@ -1099,12 +1099,12 @@
camcorder_quality quality) const
{
ALOGV("getCamcorderProfileParamByName: %s for camera %d, quality %d",
- name, cameraId, quality);
+ name, cameraId, quality);
int index = getCamcorderProfileIndex(cameraId, quality);
if (index == -1) {
ALOGE("The given camcorder profile camera %d quality %d is not found",
- cameraId, quality);
+ cameraId, quality);
return -1;
}
diff --git a/media/libmedia/MediaScanner.cpp b/media/libmedia/MediaScanner.cpp
index 73d4519..28b5aa7 100644
--- a/media/libmedia/MediaScanner.cpp
+++ b/media/libmedia/MediaScanner.cpp
@@ -54,7 +54,7 @@
void MediaScanner::loadSkipList() {
mSkipList = (char *)malloc(PROPERTY_VALUE_MAX * sizeof(char));
if (mSkipList) {
- property_get("testing.mediascanner.skiplist", mSkipList, "");
+ property_get("testing.mediascanner.skiplist", mSkipList, "");
}
if (!mSkipList || (strlen(mSkipList) == 0)) {
free(mSkipList);
@@ -135,8 +135,8 @@
struct dirent* entry;
if (shouldSkipDirectory(path)) {
- ALOGD("Skipping: %s", path);
- return MEDIA_SCAN_RESULT_OK;
+ ALOGD("Skipping: %s", path);
+ return MEDIA_SCAN_RESULT_OK;
}
// Treat all files as non-media in directories that contain a ".nomedia" file
diff --git a/media/libmedia/MediaScannerClient.cpp b/media/libmedia/MediaScannerClient.cpp
index cdfd477..e1e334836 100644
--- a/media/libmedia/MediaScannerClient.cpp
+++ b/media/libmedia/MediaScannerClient.cpp
@@ -228,4 +228,3 @@
}
} // namespace android
-
diff --git a/media/libmedia/Metadata.cpp b/media/libmedia/Metadata.cpp
index 546a9b0..ef8a9ed 100644
--- a/media/libmedia/Metadata.cpp
+++ b/media/libmedia/Metadata.cpp
@@ -57,7 +57,7 @@
Metadata::Metadata(Parcel *p)
:mData(p),
- mBegin(p->dataPosition()) { }
+ mBegin(p->dataPosition()) { }
Metadata::~Metadata() { }
diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp
index 9c3170c..717d316 100644
--- a/media/libmedia/ToneGenerator.cpp
+++ b/media/libmedia/ToneGenerator.cpp
@@ -268,8 +268,8 @@
repeatCnt: 0,
repeatSegment: 0 }, // TONE_CDMA_CALL_SIGNAL_ISDN_SP_PRI
{ segments: { { duration: 0, waveFreq: { 0 }, 0, 0} },
- repeatCnt: 0,
- repeatSegment: 0 }, // TONE_CDMA_CALL_SIGNAL_ISDN_PAT3
+ repeatCnt: 0,
+ repeatSegment: 0 }, // TONE_CDMA_CALL_SIGNAL_ISDN_PAT3
{ segments: { { duration: 32, waveFreq: { 2091, 0 }, 0, 0 },
{ duration: 64, waveFreq: { 2556, 0 }, 4, 0 },
{ duration: 20, waveFreq: { 2091, 0 }, 0, 0 },
@@ -1015,7 +1015,7 @@
mpAudioTrack = NULL;
}
- // Open audio track in mono, PCM 16bit, default sampling rate, default buffer size
+ // Open audio track in mono, PCM 16bit, default sampling rate, default buffer size
mpAudioTrack = new AudioTrack();
ALOGV("Create Track: %p", mpAudioTrack);
@@ -1284,9 +1284,9 @@
ALOGV("Cbk starting track");
lpToneGen->mState = TONE_PLAYING;
lSignal = true;
- break;
+ break;
case TONE_PLAYING:
- break;
+ break;
default:
// Force loop exit
lNumSmp = 0;
@@ -1578,4 +1578,3 @@
}
} // end namespace android
-
diff --git a/media/libmedia/Visualizer.cpp b/media/libmedia/Visualizer.cpp
index 70f8c0c..bcd6ae4 100644
--- a/media/libmedia/Visualizer.cpp
+++ b/media/libmedia/Visualizer.cpp
@@ -66,7 +66,7 @@
}
}
t->mLock.lock();
- }
+ }
status_t status = AudioEffect::setEnabled(enabled);
@@ -320,4 +320,3 @@
}
}; // namespace android
-
diff --git a/media/libmedia/mediametadataretriever.cpp b/media/libmedia/mediametadataretriever.cpp
index 8d53357..b0241aa 100644
--- a/media/libmedia/mediametadataretriever.cpp
+++ b/media/libmedia/mediametadataretriever.cpp
@@ -45,7 +45,7 @@
}
ALOGW("MediaPlayerService not published, waiting...");
usleep(500000); // 0.5 s
- } while(true);
+ } while (true);
if (sDeathNotifier == NULL) {
sDeathNotifier = new DeathNotifier();
}
diff --git a/media/libmedia/mediaplayer.cpp b/media/libmedia/mediaplayer.cpp
index 4ff1862..b52a37d 100644
--- a/media/libmedia/mediaplayer.cpp
+++ b/media/libmedia/mediaplayer.cpp
@@ -195,8 +195,8 @@
(mCurrentState != MEDIA_PLAYER_STATE_ERROR) &&
((mCurrentState & MEDIA_PLAYER_IDLE) != MEDIA_PLAYER_IDLE);
if ((mPlayer != NULL) && hasBeenInitialized) {
- ALOGV("invoke %d", request.dataSize());
- return mPlayer->invoke(request, reply);
+ ALOGV("invoke %d", request.dataSize());
+ return mPlayer->invoke(request, reply);
}
ALOGE("invoke failed: wrong state %X", mCurrentState);
return INVALID_OPERATION;
@@ -556,9 +556,9 @@
return BAD_VALUE;
}
if (sessionId != mAudioSessionId) {
- AudioSystem::releaseAudioSessionId(mAudioSessionId);
- AudioSystem::acquireAudioSessionId(sessionId);
- mAudioSessionId = sessionId;
+ AudioSystem::releaseAudioSessionId(mAudioSessionId);
+ AudioSystem::acquireAudioSessionId(sessionId);
+ mAudioSessionId = sessionId;
}
return NO_ERROR;
}
@@ -610,7 +610,7 @@
ALOGV("MediaPlayer::getParameter(%d)", key);
Mutex::Autolock _l(mLock);
if (mPlayer != NULL) {
- return mPlayer->getParameter(key, reply);
+ return mPlayer->getParameter(key, reply);
}
ALOGV("getParameter: no active player");
return INVALID_OPERATION;
@@ -658,7 +658,7 @@
// and seekTo within the same process.
// FIXME: Remember, this is a hack, it's not even a hack that is applied
// consistently for all use-cases, this needs to be revisited.
- if (mLockThreadId != getThreadId()) {
+ if (mLockThreadId != getThreadId()) {
mLock.lock();
locked = true;
}
@@ -788,4 +788,11 @@
}
+status_t MediaPlayer::setNextMediaPlayer(const sp<MediaPlayer>& next) {
+ if (mPlayer == NULL) {
+ return NO_INIT;
+ }
+ return mPlayer->setNextPlayer(next == NULL ? NULL : next->mPlayer);
+}
+
}; // namespace android
diff --git a/media/libmedia/mediarecorder.cpp b/media/libmedia/mediarecorder.cpp
index cc73014..9541015 100644
--- a/media/libmedia/mediarecorder.cpp
+++ b/media/libmedia/mediarecorder.cpp
@@ -31,7 +31,7 @@
status_t MediaRecorder::setCamera(const sp<ICamera>& camera, const sp<ICameraRecordingProxy>& proxy)
{
ALOGV("setCamera(%p,%p)", camera.get(), proxy.get());
- if(mMediaRecorder == NULL) {
+ if (mMediaRecorder == NULL) {
ALOGE("media recorder is not initialized yet");
return INVALID_OPERATION;
}
@@ -52,7 +52,7 @@
status_t MediaRecorder::setPreviewSurface(const sp<Surface>& surface)
{
ALOGV("setPreviewSurface(%p)", surface.get());
- if(mMediaRecorder == NULL) {
+ if (mMediaRecorder == NULL) {
ALOGE("media recorder is not initialized yet");
return INVALID_OPERATION;
}
@@ -77,7 +77,7 @@
status_t MediaRecorder::init()
{
ALOGV("init");
- if(mMediaRecorder == NULL) {
+ if (mMediaRecorder == NULL) {
ALOGE("media recorder is not initialized yet");
return INVALID_OPERATION;
}
@@ -107,7 +107,7 @@
status_t MediaRecorder::setVideoSource(int vs)
{
ALOGV("setVideoSource(%d)", vs);
- if(mMediaRecorder == NULL) {
+ if (mMediaRecorder == NULL) {
ALOGE("media recorder is not initialized yet");
return INVALID_OPERATION;
}
@@ -142,7 +142,7 @@
status_t MediaRecorder::setAudioSource(int as)
{
ALOGV("setAudioSource(%d)", as);
- if(mMediaRecorder == NULL) {
+ if (mMediaRecorder == NULL) {
ALOGE("media recorder is not initialized yet");
return INVALID_OPERATION;
}
@@ -175,7 +175,7 @@
status_t MediaRecorder::setOutputFormat(int of)
{
ALOGV("setOutputFormat(%d)", of);
- if(mMediaRecorder == NULL) {
+ if (mMediaRecorder == NULL) {
ALOGE("media recorder is not initialized yet");
return INVALID_OPERATION;
}
@@ -201,7 +201,7 @@
status_t MediaRecorder::setVideoEncoder(int ve)
{
ALOGV("setVideoEncoder(%d)", ve);
- if(mMediaRecorder == NULL) {
+ if (mMediaRecorder == NULL) {
ALOGE("media recorder is not initialized yet");
return INVALID_OPERATION;
}
@@ -231,7 +231,7 @@
status_t MediaRecorder::setAudioEncoder(int ae)
{
ALOGV("setAudioEncoder(%d)", ae);
- if(mMediaRecorder == NULL) {
+ if (mMediaRecorder == NULL) {
ALOGE("media recorder is not initialized yet");
return INVALID_OPERATION;
}
@@ -261,7 +261,7 @@
status_t MediaRecorder::setOutputFile(const char* path)
{
ALOGV("setOutputFile(%s)", path);
- if(mMediaRecorder == NULL) {
+ if (mMediaRecorder == NULL) {
ALOGE("media recorder is not initialized yet");
return INVALID_OPERATION;
}
@@ -287,7 +287,7 @@
status_t MediaRecorder::setOutputFile(int fd, int64_t offset, int64_t length)
{
ALOGV("setOutputFile(%d, %lld, %lld)", fd, offset, length);
- if(mMediaRecorder == NULL) {
+ if (mMediaRecorder == NULL) {
ALOGE("media recorder is not initialized yet");
return INVALID_OPERATION;
}
@@ -324,7 +324,7 @@
status_t MediaRecorder::setVideoSize(int width, int height)
{
ALOGV("setVideoSize(%d, %d)", width, height);
- if(mMediaRecorder == NULL) {
+ if (mMediaRecorder == NULL) {
ALOGE("media recorder is not initialized yet");
return INVALID_OPERATION;
}
@@ -367,7 +367,7 @@
status_t MediaRecorder::setVideoFrameRate(int frames_per_second)
{
ALOGV("setVideoFrameRate(%d)", frames_per_second);
- if(mMediaRecorder == NULL) {
+ if (mMediaRecorder == NULL) {
ALOGE("media recorder is not initialized yet");
return INVALID_OPERATION;
}
@@ -391,7 +391,7 @@
status_t MediaRecorder::setParameters(const String8& params) {
ALOGV("setParameters(%s)", params.string());
- if(mMediaRecorder == NULL) {
+ if (mMediaRecorder == NULL) {
ALOGE("media recorder is not initialized yet");
return INVALID_OPERATION;
}
@@ -419,7 +419,7 @@
status_t MediaRecorder::prepare()
{
ALOGV("prepare");
- if(mMediaRecorder == NULL) {
+ if (mMediaRecorder == NULL) {
ALOGE("media recorder is not initialized yet");
return INVALID_OPERATION;
}
@@ -458,7 +458,7 @@
status_t MediaRecorder::getMaxAmplitude(int* max)
{
ALOGV("getMaxAmplitude");
- if(mMediaRecorder == NULL) {
+ if (mMediaRecorder == NULL) {
ALOGE("media recorder is not initialized yet");
return INVALID_OPERATION;
}
@@ -536,7 +536,7 @@
doCleanUp();
status_t ret = UNKNOWN_ERROR;
- switch(mCurrentState) {
+ switch (mCurrentState) {
case MEDIA_RECORDER_IDLE:
ret = OK;
break;
@@ -547,7 +547,7 @@
case MEDIA_RECORDER_ERROR: {
ret = doReset();
if (OK != ret) {
- return ret; // No need to continue
+ return ret; // No need to continue
}
} // Intentional fall through
case MEDIA_RECORDER_INITIALIZED:
diff --git a/media/libmedia_native/Android.mk b/media/libmedia_native/Android.mk
new file mode 100644
index 0000000..065a90f
--- /dev/null
+++ b/media/libmedia_native/Android.mk
@@ -0,0 +1,11 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES :=
+
+LOCAL_MODULE:= libmedia_native
+
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libmediaplayerservice/Android.mk b/media/libmediaplayerservice/Android.mk
index e521648..ba5c776 100644
--- a/media/libmediaplayerservice/Android.mk
+++ b/media/libmediaplayerservice/Android.mk
@@ -23,6 +23,7 @@
libvorbisidec \
libsonivox \
libmedia \
+ libmedia_native \
libcamera_client \
libandroid_runtime \
libstagefright \
@@ -36,13 +37,13 @@
libstagefright_nuplayer \
libstagefright_rtsp \
-LOCAL_C_INCLUDES := \
+LOCAL_C_INCLUDES := \
$(JNI_H_INCLUDE) \
$(call include-path-for, graphics corecg) \
- $(TOP)/frameworks/base/include/media/stagefright/openmax \
$(TOP)/frameworks/base/media/libstagefright/include \
$(TOP)/frameworks/base/media/libstagefright/rtsp \
- $(TOP)/external/tremolo/Tremolo \
+ $(TOP)/frameworks/native/include/media/openmax \
+ $(TOP)/external/tremolo/Tremolo
LOCAL_MODULE:= libmediaplayerservice
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index bbc53f3..8f62ee4 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -1068,6 +1068,20 @@
return ret;
}
+status_t MediaPlayerService::Client::setNextPlayer(const sp<IMediaPlayer>& player) {
+ ALOGV("setNextPlayer");
+ Mutex::Autolock l(mLock);
+ sp<Client> c = static_cast<Client*>(player.get());
+ mNextClient = c;
+ if (mAudioOutput != NULL && c != NULL) {
+ mAudioOutput->setNextOutput(c->mAudioOutput);
+ } else {
+ ALOGE("no current audio output");
+ }
+ return OK;
+}
+
+
status_t MediaPlayerService::Client::seekTo(int msec)
{
ALOGV("[%d] seekTo(%d)", mConnId, msec);
@@ -1189,6 +1203,15 @@
{
Client* client = static_cast<Client*>(cookie);
+ {
+ Mutex::Autolock l(client->mLock);
+ if (msg == MEDIA_PLAYBACK_COMPLETE && client->mNextClient != NULL) {
+ client->mAudioOutput->switchToNextOutput();
+ client->mNextClient->start();
+ client->mNextClient->mClient->notify(MEDIA_INFO, MEDIA_INFO_STARTED_AS_NEXT, 0, obj);
+ }
+ }
+
if (MEDIA_INFO == msg &&
MEDIA_INFO_METADATA_UPDATE == ext1) {
const media::Metadata::Type metadata_type = ext2;
@@ -1376,9 +1399,11 @@
MediaPlayerService::AudioOutput::AudioOutput(int sessionId)
: mCallback(NULL),
mCallbackCookie(NULL),
+ mCallbackData(NULL),
mSessionId(sessionId) {
ALOGV("AudioOutput(%d)", sessionId);
mTrack = 0;
+ mRecycledTrack = 0;
mStreamType = AUDIO_STREAM_MUSIC;
mLeftVolume = 1.0;
mRightVolume = 1.0;
@@ -1393,6 +1418,8 @@
MediaPlayerService::AudioOutput::~AudioOutput()
{
close();
+ delete mRecycledTrack;
+ delete mCallbackData;
}
void MediaPlayerService::AudioOutput::setMinBufferCount()
@@ -1473,7 +1500,6 @@
}
ALOGV("open(%u, %d, 0x%x, %d, %d, %d)", sampleRate, channelCount, channelMask,
format, bufferCount, mSessionId);
- if (mTrack) close();
int afSampleRate;
int afFrameCount;
int frameCount;
@@ -1488,15 +1514,54 @@
frameCount = (sampleRate*afFrameCount*bufferCount)/afSampleRate;
if (channelMask == CHANNEL_MASK_USE_CHANNEL_ORDER) {
- channelMask = audio_channel_mask_from_count(channelCount);
+ channelMask = audio_channel_out_mask_from_count(channelCount);
if (0 == channelMask) {
ALOGE("open() error, can\'t derive mask for %d audio channels", channelCount);
return NO_INIT;
}
}
+ if (mRecycledTrack) {
+ // check if the existing track can be reused as-is, or if a new track needs to be created.
+
+ bool reuse = true;
+ if ((mCallbackData == NULL && mCallback != NULL) ||
+ (mCallbackData != NULL && mCallback == NULL)) {
+ // recycled track uses callbacks but the caller wants to use writes, or vice versa
+ ALOGV("can't chain callback and write");
+ reuse = false;
+ } else if ((mRecycledTrack->getSampleRate() != sampleRate) ||
+ (mRecycledTrack->channelCount() != channelCount) ||
+ (mRecycledTrack->frameCount() != frameCount)) {
+ ALOGV("samplerate, channelcount or framecount differ");
+ reuse = false;
+ }
+ if (reuse) {
+ ALOGV("chaining to next output");
+ close();
+ mTrack = mRecycledTrack;
+ mRecycledTrack = NULL;
+ if (mCallbackData != NULL) {
+ mCallbackData->setOutput(this);
+ }
+ return OK;
+ }
+
+ // if we're not going to reuse the track, unblock and flush it
+ if (mCallbackData != NULL) {
+ mCallbackData->setOutput(NULL);
+ mCallbackData->endTrackSwitch();
+ }
+ mRecycledTrack->flush();
+ delete mRecycledTrack;
+ mRecycledTrack = NULL;
+ delete mCallbackData;
+ mCallbackData = NULL;
+ close();
+ }
AudioTrack *t;
if (mCallback != NULL) {
+ mCallbackData = new CallbackData(this);
t = new AudioTrack(
mStreamType,
sampleRate,
@@ -1505,7 +1570,7 @@
frameCount,
AUDIO_POLICY_OUTPUT_FLAG_NONE,
CallbackWrapper,
- this,
+ mCallbackData,
0,
mSessionId);
} else {
@@ -1546,6 +1611,9 @@
void MediaPlayerService::AudioOutput::start()
{
ALOGV("start");
+ if (mCallbackData != NULL) {
+ mCallbackData->endTrackSwitch();
+ }
if (mTrack) {
mTrack->setVolume(mLeftVolume, mRightVolume);
mTrack->setAuxEffectSendLevel(mSendLevel);
@@ -1553,8 +1621,27 @@
}
}
+void MediaPlayerService::AudioOutput::setNextOutput(const sp<AudioOutput>& nextOutput) {
+ mNextOutput = nextOutput;
+}
+void MediaPlayerService::AudioOutput::switchToNextOutput() {
+ ALOGV("switchToNextOutput");
+ if (mNextOutput != NULL) {
+ if (mCallbackData != NULL) {
+ mCallbackData->beginTrackSwitch();
+ }
+ delete mNextOutput->mCallbackData;
+ mNextOutput->mCallbackData = mCallbackData;
+ mCallbackData = NULL;
+ mNextOutput->mRecycledTrack = mTrack;
+ mTrack = NULL;
+ mNextOutput->mSampleRateHz = mSampleRateHz;
+ mNextOutput->mMsecsPerFrame = mMsecsPerFrame;
+ }
+}
+
ssize_t MediaPlayerService::AudioOutput::write(const void* buffer, size_t size)
{
LOG_FATAL_IF(mCallback != NULL, "Don't call write if supplying a callback.");
@@ -1646,13 +1733,22 @@
return;
}
- AudioOutput *me = (AudioOutput *)cookie;
+ CallbackData *data = (CallbackData*)cookie;
+ data->lock();
+ AudioOutput *me = data->getOutput();
AudioTrack::Buffer *buffer = (AudioTrack::Buffer *)info;
+ if (me == NULL) {
+ // no output set, likely because the track was scheduled to be reused
+ // by another player, but the format turned out to be incompatible.
+ data->unlock();
+ buffer->size = 0;
+ return;
+ }
size_t actualSize = (*me->mCallback)(
me, buffer->raw, buffer->size, me->mCallbackCookie);
- if (actualSize == 0 && buffer->size > 0) {
+ if (actualSize == 0 && buffer->size > 0 && me->mNextOutput == NULL) {
// We've reached EOS but the audio track is not stopped yet,
// keep playing silence.
@@ -1661,6 +1757,7 @@
}
buffer->size = actualSize;
+ data->unlock();
}
int MediaPlayerService::AudioOutput::getSessionId()
diff --git a/media/libmediaplayerservice/MediaPlayerService.h b/media/libmediaplayerservice/MediaPlayerService.h
index 85cec22..d4e0eb1 100644
--- a/media/libmediaplayerservice/MediaPlayerService.h
+++ b/media/libmediaplayerservice/MediaPlayerService.h
@@ -31,6 +31,7 @@
#include <media/IMediaPlayerService.h>
#include <media/MediaPlayerInterface.h>
#include <media/Metadata.h>
+#include <media/stagefright/foundation/ABase.h>
#include <system/audio.h>
@@ -69,7 +70,9 @@
class AudioOutput : public MediaPlayerBase::AudioSink
{
- public:
+ class CallbackData;
+
+ public:
AudioOutput(int sessionId);
virtual ~AudioOutput();
@@ -104,14 +107,21 @@
static bool isOnEmulator();
static int getMinBufferCount();
+ void setNextOutput(const sp<AudioOutput>& nextOutput);
+ void switchToNextOutput();
+ virtual bool needsTrailingPadding() { return mNextOutput == NULL; }
+
private:
static void setMinBufferCount();
static void CallbackWrapper(
int event, void *me, void *info);
AudioTrack* mTrack;
+ AudioTrack* mRecycledTrack;
+ sp<AudioOutput> mNextOutput;
AudioCallback mCallback;
void * mCallbackCookie;
+ CallbackData * mCallbackData;
audio_stream_type_t mStreamType;
float mLeftVolume;
float mRightVolume;
@@ -124,7 +134,38 @@
static bool mIsOnEmulator;
static int mMinBufferCount; // 12 for emulator; otherwise 4
- };
+ // CallbackData is what is passed to the AudioTrack as the "user" data.
+ // We need to be able to target this to a different Output on the fly,
+ // so we can't use the Output itself for this.
+ class CallbackData {
+ public:
+ CallbackData(AudioOutput *cookie) {
+ mData = cookie;
+ mSwitching = false;
+ }
+ AudioOutput * getOutput() { return mData;}
+ void setOutput(AudioOutput* newcookie) { mData = newcookie; }
+ // lock/unlock are used by the callback before accessing the payload of this object
+ void lock() { mLock.lock(); }
+ void unlock() { mLock.unlock(); }
+ // beginTrackSwitch/endTrackSwitch are used when this object is being handed over
+ // to the next sink.
+ void beginTrackSwitch() { mLock.lock(); mSwitching = true; }
+ void endTrackSwitch() {
+ if (mSwitching) {
+ mLock.unlock();
+ }
+ mSwitching = false;
+ }
+ private:
+ AudioOutput * mData;
+ mutable Mutex mLock;
+ bool mSwitching;
+ DISALLOW_EVIL_CONSTRUCTORS(CallbackData);
+ };
+
+ }; // AudioOutput
+
class AudioCache : public MediaPlayerBase::AudioSink
{
@@ -184,7 +225,7 @@
bool mCommandComplete;
sp<Thread> mCallbackThread;
- };
+ }; // AudioCache
public:
static void instantiate();
@@ -278,6 +319,7 @@
virtual status_t setParameter(int key, const Parcel &request);
virtual status_t getParameter(int key, Parcel *reply);
virtual status_t setRetransmitEndpoint(const struct sockaddr_in* endpoint);
+ virtual status_t setNextPlayer(const sp<IMediaPlayer>& player);
sp<MediaPlayerBase> createPlayer(player_type playerType);
@@ -350,6 +392,7 @@
sp<IBinder> mConnectedWindowBinder;
struct sockaddr_in mRetransmitEndpoint;
bool mRetransmitEndpointValid;
+ sp<Client> mNextClient;
// Metadata filters.
media::Metadata::Filter mMetadataAllow; // protected by mLock
@@ -364,7 +407,7 @@
#if CALLBACK_ANTAGONIZER
Antagonizer* mAntagonizer;
#endif
- };
+ }; // Client
// ----------------------------------------------------------------------------
diff --git a/media/libmediaplayerservice/StagefrightPlayer.cpp b/media/libmediaplayerservice/StagefrightPlayer.cpp
index 052ebf0..619c149 100644
--- a/media/libmediaplayerservice/StagefrightPlayer.cpp
+++ b/media/libmediaplayerservice/StagefrightPlayer.cpp
@@ -166,7 +166,8 @@
}
status_t StagefrightPlayer::invoke(const Parcel &request, Parcel *reply) {
- return INVALID_OPERATION;
+ ALOGV("invoke()");
+ return mPlayer->invoke(request, reply);
}
void StagefrightPlayer::setAudioSink(const sp<AudioSink> &audioSink) {
diff --git a/media/libmediaplayerservice/nuplayer/Android.mk b/media/libmediaplayerservice/nuplayer/Android.mk
index 33e2f93..9b485d7 100644
--- a/media/libmediaplayerservice/nuplayer/Android.mk
+++ b/media/libmediaplayerservice/nuplayer/Android.mk
@@ -12,11 +12,11 @@
StreamingSource.cpp \
LOCAL_C_INCLUDES := \
- $(TOP)/frameworks/base/include/media/stagefright/openmax \
+ $(TOP)/frameworks/base/media/libstagefright/httplive \
$(TOP)/frameworks/base/media/libstagefright/include \
- $(TOP)/frameworks/base/media/libstagefright/mpeg2ts \
- $(TOP)/frameworks/base/media/libstagefright/httplive \
- $(TOP)/frameworks/base/media/libstagefright/rtsp \
+ $(TOP)/frameworks/base/media/libstagefright/mpeg2ts \
+ $(TOP)/frameworks/base/media/libstagefright/rtsp \
+ $(TOP)/frameworks/native/include/media/openmax
LOCAL_MODULE:= libstagefright_nuplayer
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 09e4e45..e5ad4b7 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -746,6 +746,10 @@
"audio_decoder.aac", "audio_encoder.aac" },
{ MEDIA_MIMETYPE_AUDIO_VORBIS,
"audio_decoder.vorbis", "audio_encoder.vorbis" },
+ { MEDIA_MIMETYPE_AUDIO_G711_MLAW,
+ "audio_decoder.g711mlaw", "audio_encoder.g711mlaw" },
+ { MEDIA_MIMETYPE_AUDIO_G711_ALAW,
+ "audio_decoder.g711alaw", "audio_encoder.g711alaw" },
{ MEDIA_MIMETYPE_VIDEO_AVC,
"video_decoder.avc", "video_encoder.avc" },
{ MEDIA_MIMETYPE_VIDEO_MPEG4,
@@ -855,10 +859,6 @@
}
}
- if (err != OK) {
- return err;
- }
-
int32_t maxInputSize;
if (msg->findInt32("max-input-size", &maxInputSize)) {
err = setMinBufferSize(kPortIndexInput, (size_t)maxInputSize);
@@ -2770,6 +2770,9 @@
status_t err = mCodec->configureCodec(mime.c_str(), msg);
if (err != OK) {
+ ALOGE("[%s] configureCodec returning error %d",
+ mCodec->mComponentName.c_str(), err);
+
mCodec->signalError(OMX_ErrorUndefined, err);
return false;
}
diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk
index 5aea8d0..77714f3 100644
--- a/media/libstagefright/Android.mk
+++ b/media/libstagefright/Android.mk
@@ -57,8 +57,9 @@
LOCAL_C_INCLUDES:= \
$(JNI_H_INCLUDE) \
- $(TOP)/frameworks/base/include/media/stagefright/openmax \
$(TOP)/frameworks/base/include/media/stagefright/timedtext \
+ $(TOP)/frameworks/native/include/media/hardware \
+ $(TOP)/frameworks/native/include/media/openmax \
$(TOP)/external/expat/lib \
$(TOP)/external/flac/include \
$(TOP)/external/tremolo \
@@ -78,6 +79,7 @@
libicuuc \
liblog \
libmedia \
+ libmedia_native \
libsonivox \
libssl \
libstagefright_omx \
diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp
index 23c3c74..0f816e7 100644
--- a/media/libstagefright/AudioPlayer.cpp
+++ b/media/libstagefright/AudioPlayer.cpp
@@ -144,7 +144,7 @@
} else {
// playing to an AudioTrack, set up mask if necessary
audio_channel_mask_t audioMask = channelMask == CHANNEL_MASK_USE_CHANNEL_ORDER ?
- audio_channel_mask_from_count(numChannels) : channelMask;
+ audio_channel_out_mask_from_count(numChannels) : channelMask;
if (0 == audioMask) {
return BAD_VALUE;
}
@@ -419,7 +419,11 @@
timeToCompletionUs, timeToCompletionUs / 1E6);
postEOS = true;
- postEOSDelayUs = timeToCompletionUs + mLatencyUs;
+ if (mAudioSink->needsTrailingPadding()) {
+ postEOSDelayUs = timeToCompletionUs + mLatencyUs;
+ } else {
+ postEOSDelayUs = 0;
+ }
}
mReachedEOS = true;
diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp
index cbe709b..0f1d841 100644
--- a/media/libstagefright/AudioSource.cpp
+++ b/media/libstagefright/AudioSource.cpp
@@ -47,22 +47,22 @@
}
AudioSource::AudioSource(
- audio_source_t inputSource, uint32_t sampleRate, uint32_t channels)
+ audio_source_t inputSource, uint32_t sampleRate, uint32_t channelCount)
: mStarted(false),
mSampleRate(sampleRate),
mPrevSampleTimeUs(0),
mNumFramesReceived(0),
mNumClientOwnedBuffers(0) {
- ALOGV("sampleRate: %d, channels: %d", sampleRate, channels);
- CHECK(channels == 1 || channels == 2);
+ ALOGV("sampleRate: %d, channelCount: %d", sampleRate, channelCount);
+ CHECK(channelCount == 1 || channelCount == 2);
AudioRecord::record_flags flags = (AudioRecord::record_flags)
(AudioRecord::RECORD_AGC_ENABLE |
AudioRecord::RECORD_NS_ENABLE |
AudioRecord::RECORD_IIR_ENABLE);
mRecord = new AudioRecord(
inputSource, sampleRate, AUDIO_FORMAT_PCM_16_BIT,
- channels > 1? AUDIO_CHANNEL_IN_STEREO: AUDIO_CHANNEL_IN_MONO,
+ audio_channel_in_mask_from_count(channelCount),
4 * kMaxBufferSize / sizeof(int16_t), /* Enable ping-pong buffers */
flags,
AudioRecordCallbackFunction,
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 9e00bb3..f96a4df 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -1114,7 +1114,7 @@
modifyFlags(AUDIO_RUNNING, CLEAR);
}
- if (mFlags & TEXTPLAYER_STARTED) {
+ if (mFlags & TEXTPLAYER_INITIALIZED) {
mTextDriver->pause();
modifyFlags(TEXT_RUNNING, CLEAR);
}
@@ -1268,32 +1268,6 @@
return OK;
}
-status_t AwesomePlayer::setTimedTextTrackIndex(int32_t index) {
- if (mTextDriver != NULL) {
- if (index >= 0) { // to turn on a text track
- status_t err = mTextDriver->setTimedTextTrackIndex(index);
- if (err != OK) {
- return err;
- }
-
- modifyFlags(TEXT_RUNNING, SET);
- modifyFlags(TEXTPLAYER_STARTED, SET);
- return OK;
- } else { // to turn off the text track display
- if (mFlags & TEXT_RUNNING) {
- modifyFlags(TEXT_RUNNING, CLEAR);
- }
- if (mFlags & TEXTPLAYER_STARTED) {
- modifyFlags(TEXTPLAYER_STARTED, CLEAR);
- }
-
- return mTextDriver->setTimedTextTrackIndex(index);
- }
- } else {
- return INVALID_OPERATION;
- }
-}
-
status_t AwesomePlayer::seekTo_l(int64_t timeUs) {
if (mFlags & CACHE_UNDERRUN) {
modifyFlags(CACHE_UNDERRUN, CLEAR);
@@ -1315,7 +1289,7 @@
seekAudioIfNecessary_l();
- if (mFlags & TEXTPLAYER_STARTED) {
+ if (mFlags & TEXTPLAYER_INITIALIZED) {
mTextDriver->seekToAsync(mSeekTimeUs);
}
@@ -1691,8 +1665,8 @@
}
}
- if ((mFlags & TEXTPLAYER_STARTED) && !(mFlags & (TEXT_RUNNING | SEEK_PREVIEW))) {
- mTextDriver->resume();
+ if ((mFlags & TEXTPLAYER_INITIALIZED) && !(mFlags & (TEXT_RUNNING | SEEK_PREVIEW))) {
+ mTextDriver->start();
modifyFlags(TEXT_RUNNING, SET);
}
@@ -2232,20 +2206,6 @@
status_t AwesomePlayer::setParameter(int key, const Parcel &request) {
switch (key) {
- case KEY_PARAMETER_TIMED_TEXT_TRACK_INDEX:
- {
- Mutex::Autolock autoLock(mTimedTextLock);
- return setTimedTextTrackIndex(request.readInt32());
- }
- case KEY_PARAMETER_TIMED_TEXT_ADD_OUT_OF_BAND_SOURCE:
- {
- Mutex::Autolock autoLock(mTimedTextLock);
- if (mTextDriver == NULL) {
- mTextDriver = new TimedTextDriver(mListener);
- }
-
- return mTextDriver->addOutOfBandTextSource(request);
- }
case KEY_PARAMETER_CACHE_STAT_COLLECT_FREQ_MS:
{
return setCacheStatCollectFreq(request);
@@ -2294,6 +2254,90 @@
}
}
+status_t AwesomePlayer::invoke(const Parcel &request, Parcel *reply) {
+ if (NULL == reply) {
+ return android::BAD_VALUE;
+ }
+ int32_t methodId;
+ status_t ret = request.readInt32(&methodId);
+ if (ret != android::OK) {
+ return ret;
+ }
+ switch(methodId) {
+ case INVOKE_ID_GET_TRACK_INFO:
+ {
+ Mutex::Autolock autoLock(mTimedTextLock);
+ if (mTextDriver == NULL) {
+ return INVALID_OPERATION;
+ }
+ mTextDriver->getTrackInfo(reply);
+ return OK;
+ }
+ case INVOKE_ID_ADD_EXTERNAL_SOURCE:
+ {
+ Mutex::Autolock autoLock(mTimedTextLock);
+ if (mTextDriver == NULL) {
+ mTextDriver = new TimedTextDriver(mListener);
+ }
+ // String values written in Parcel are UTF-16 values.
+ String8 uri(request.readString16());
+ String8 mimeType(request.readString16());
+ return mTextDriver->addOutOfBandTextSource(uri, mimeType);
+ }
+ case INVOKE_ID_ADD_EXTERNAL_SOURCE_FD:
+ {
+ Mutex::Autolock autoLock(mTimedTextLock);
+ if (mTextDriver == NULL) {
+ mTextDriver = new TimedTextDriver(mListener);
+ }
+ int fd = request.readFileDescriptor();
+ off64_t offset = request.readInt64();
+ size_t length = request.readInt64();
+ String8 mimeType(request.readString16());
+ return mTextDriver->addOutOfBandTextSource(
+ fd, offset, length, mimeType);
+ }
+ case INVOKE_ID_SELECT_TRACK:
+ {
+ Mutex::Autolock autoLock(mTimedTextLock);
+ if (mTextDriver == NULL) {
+ return INVALID_OPERATION;
+ }
+
+ status_t err = mTextDriver->selectTrack(
+ request.readInt32());
+ if (err == OK) {
+ modifyFlags(TEXTPLAYER_INITIALIZED, SET);
+ if (mFlags & PLAYING && !(mFlags & TEXT_RUNNING)) {
+ mTextDriver->start();
+ modifyFlags(TEXT_RUNNING, SET);
+ }
+ }
+ return err;
+ }
+ case INVOKE_ID_UNSELECT_TRACK:
+ {
+ Mutex::Autolock autoLock(mTimedTextLock);
+ if (mTextDriver == NULL) {
+ return INVALID_OPERATION;
+ }
+ status_t err = mTextDriver->unselectTrack(
+ request.readInt32());
+ if (err == OK) {
+ modifyFlags(TEXTPLAYER_INITIALIZED, CLEAR);
+ modifyFlags(TEXT_RUNNING, CLEAR);
+ }
+ return err;
+ }
+ default:
+ {
+ return ERROR_UNSUPPORTED;
+ }
+ }
+ // It will not reach here.
+ return OK;
+}
+
bool AwesomePlayer::isStreamingHTTP() const {
return mCachedSource != NULL || mWVMExtractor != NULL;
}
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp
index 2df55282..fd3f892 100755
--- a/media/libstagefright/CameraSource.cpp
+++ b/media/libstagefright/CameraSource.cpp
@@ -182,7 +182,7 @@
int32_t cameraId) {
if (camera == 0) {
- mCamera = Camera::connect(cameraId);
+ mCamera = Camera::connect(cameraId, false, false);
if (mCamera == 0) return -EBUSY;
mCameraFlags &= ~FLAGS_HOT_CAMERA;
} else {
@@ -515,9 +515,13 @@
return err;
}
- // This CHECK is good, since we just passed the lock/unlock
- // check earlier by calling mCamera->setParameters().
- CHECK_EQ((status_t)OK, mCamera->setPreviewDisplay(mSurface));
+ // Set the preview display. Skip this if mSurface is null because
+ // applications may already set a surface to the camera.
+ if (mSurface != NULL) {
+ // This CHECK is good, since we just passed the lock/unlock
+ // check earlier by calling mCamera->setParameters().
+ CHECK_EQ((status_t)OK, mCamera->setPreviewDisplay(mSurface));
+ }
// By default, do not store metadata in video buffers
mIsMetaDataStoredInVideoBuffers = false;
diff --git a/media/libstagefright/MP3Extractor.cpp b/media/libstagefright/MP3Extractor.cpp
index 2215c07..69209b5 100644
--- a/media/libstagefright/MP3Extractor.cpp
+++ b/media/libstagefright/MP3Extractor.cpp
@@ -317,6 +317,13 @@
mSeeker = VBRISeeker::CreateFromSource(mDataSource, post_id3_pos);
}
+ if (mSeeker != NULL) {
+ // While it is safe to send the XING/VBRI frame to the decoder, this will
+ // result in an extra 1152 samples being output. The real first frame to
+ // decode is after the XING/VBRI frame, so skip there.
+ mFirstFramePos += frame_size;
+ }
+
int64_t durationUs;
if (mSeeker == NULL || !mSeeker->getDuration(&durationUs)) {
diff --git a/media/libstagefright/MediaDefs.cpp b/media/libstagefright/MediaDefs.cpp
index 444e823..2549de6 100644
--- a/media/libstagefright/MediaDefs.cpp
+++ b/media/libstagefright/MediaDefs.cpp
@@ -52,5 +52,6 @@
const char *MEDIA_MIMETYPE_CONTAINER_WVM = "video/wvm";
const char *MEDIA_MIMETYPE_TEXT_3GPP = "text/3gpp-tt";
+const char *MEDIA_MIMETYPE_TEXT_SUBRIP = "application/x-subrip";
} // namespace android
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 966416e..d5e6bec 100755
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -27,9 +27,9 @@
#include <binder/IServiceManager.h>
#include <binder/MemoryDealer.h>
#include <binder/ProcessState.h>
+#include <HardwareAPI.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/IMediaPlayerService.h>
-#include <media/stagefright/HardwareAPI.h>
#include <media/stagefright/MediaBuffer.h>
#include <media/stagefright/MediaBufferGroup.h>
#include <media/stagefright/MediaDefs.h>
@@ -1332,8 +1332,6 @@
"audio_decoder.mp1", "audio_encoder.mp1" },
{ MEDIA_MIMETYPE_AUDIO_MPEG_LAYER_II,
"audio_decoder.mp2", "audio_encoder.mp2" },
- { MEDIA_MIMETYPE_AUDIO_MPEG,
- "audio_decoder.mp3", "audio_encoder.mp3" },
{ MEDIA_MIMETYPE_AUDIO_AMR_NB,
"audio_decoder.amrnb", "audio_encoder.amrnb" },
{ MEDIA_MIMETYPE_AUDIO_AMR_WB,
@@ -1342,6 +1340,10 @@
"audio_decoder.aac", "audio_encoder.aac" },
{ MEDIA_MIMETYPE_AUDIO_VORBIS,
"audio_decoder.vorbis", "audio_encoder.vorbis" },
+ { MEDIA_MIMETYPE_AUDIO_G711_MLAW,
+ "audio_decoder.g711mlaw", "audio_encoder.g711mlaw" },
+ { MEDIA_MIMETYPE_AUDIO_G711_ALAW,
+ "audio_decoder.g711alaw", "audio_encoder.g711alaw" },
{ MEDIA_MIMETYPE_VIDEO_AVC,
"video_decoder.avc", "video_encoder.avc" },
{ MEDIA_MIMETYPE_VIDEO_MPEG4,
diff --git a/media/libstagefright/SurfaceMediaSource.cpp b/media/libstagefright/SurfaceMediaSource.cpp
index ab2cff0..7481e2e 100644
--- a/media/libstagefright/SurfaceMediaSource.cpp
+++ b/media/libstagefright/SurfaceMediaSource.cpp
@@ -20,8 +20,8 @@
#include <media/stagefright/SurfaceMediaSource.h>
#include <media/stagefright/MetaData.h>
#include <media/stagefright/MediaDefs.h>
-#include <media/stagefright/openmax/OMX_IVCommon.h>
-#include <media/stagefright/MetadataBufferType.h>
+#include <OMX_IVCommon.h>
+#include <MetadataBufferType.h>
#include <ui/GraphicBuffer.h>
#include <gui/ISurfaceComposer.h>
@@ -54,6 +54,9 @@
ALOGV("SurfaceMediaSource::SurfaceMediaSource");
sp<ISurfaceComposer> composer(ComposerService::getComposerService());
mGraphicBufferAlloc = composer->createGraphicBufferAlloc();
+ if (mGraphicBufferAlloc == 0) {
+ ALOGE("createGraphicBufferAlloc() failed in SurfaceMediaSource()");
+ }
}
SurfaceMediaSource::~SurfaceMediaSource() {
diff --git a/media/libstagefright/VBRISeeker.cpp b/media/libstagefright/VBRISeeker.cpp
index 6ac5a83..bcba874 100644
--- a/media/libstagefright/VBRISeeker.cpp
+++ b/media/libstagefright/VBRISeeker.cpp
@@ -92,7 +92,7 @@
}
sp<VBRISeeker> seeker = new VBRISeeker;
- seeker->mBasePos = post_id3_pos;
+ seeker->mBasePos = post_id3_pos + frameSize;
seeker->mDurationUs = durationUs;
off64_t offset = post_id3_pos;
diff --git a/media/libstagefright/XINGSeeker.cpp b/media/libstagefright/XINGSeeker.cpp
index 2091381..8c99c76 100644
--- a/media/libstagefright/XINGSeeker.cpp
+++ b/media/libstagefright/XINGSeeker.cpp
@@ -15,35 +15,13 @@
*/
#include "include/XINGSeeker.h"
+#include "include/avc_utils.h"
#include <media/stagefright/DataSource.h>
#include <media/stagefright/Utils.h>
namespace android {
-static bool parse_xing_header(
- const sp<DataSource> &source, off64_t first_frame_pos,
- int32_t *frame_number = NULL, int32_t *byte_number = NULL,
- unsigned char *table_of_contents = NULL,
- int32_t *quality_indicator = NULL, int64_t *duration = NULL);
-
-// static
-sp<XINGSeeker> XINGSeeker::CreateFromSource(
- const sp<DataSource> &source, off64_t first_frame_pos) {
- sp<XINGSeeker> seeker = new XINGSeeker;
-
- seeker->mFirstFramePos = first_frame_pos;
-
- if (!parse_xing_header(
- source, first_frame_pos,
- NULL, &seeker->mSizeBytes, seeker->mTableOfContents,
- NULL, &seeker->mDurationUs)) {
- return NULL;
- }
-
- return seeker;
-}
-
XINGSeeker::XINGSeeker()
: mDurationUs(-1),
mSizeBytes(0) {
@@ -60,7 +38,7 @@
}
bool XINGSeeker::getOffsetForTime(int64_t *timeUs, off64_t *pos) {
- if (mSizeBytes == 0 || mTableOfContents[0] <= 0 || mDurationUs < 0) {
+ if (mSizeBytes == 0 || !mTOCValid || mDurationUs < 0) {
return false;
}
@@ -76,10 +54,10 @@
if ( a == 0 ) {
fa = 0.0f;
} else {
- fa = (float)mTableOfContents[a-1];
+ fa = (float)mTOC[a-1];
}
if ( a < 99 ) {
- fb = (float)mTableOfContents[a];
+ fb = (float)mTOC[a];
} else {
fb = 256.0f;
}
@@ -91,59 +69,50 @@
return true;
}
-static bool parse_xing_header(
- const sp<DataSource> &source, off64_t first_frame_pos,
- int32_t *frame_number, int32_t *byte_number,
- unsigned char *table_of_contents, int32_t *quality_indicator,
- int64_t *duration) {
- if (frame_number) {
- *frame_number = 0;
- }
- if (byte_number) {
- *byte_number = 0;
- }
- if (table_of_contents) {
- table_of_contents[0] = 0;
- }
- if (quality_indicator) {
- *quality_indicator = 0;
- }
- if (duration) {
- *duration = 0;
- }
+// static
+sp<XINGSeeker> XINGSeeker::CreateFromSource(
+ const sp<DataSource> &source, off64_t first_frame_pos) {
+ sp<XINGSeeker> seeker = new XINGSeeker;
+
+ seeker->mFirstFramePos = first_frame_pos;
+
+ ALOGI("xingseeker first frame pos: %lld", first_frame_pos);
+
+ seeker->mSizeBytes = 0;
+ seeker->mTOCValid = false;
+ seeker->mDurationUs = 0;
uint8_t buffer[4];
int offset = first_frame_pos;
if (source->readAt(offset, &buffer, 4) < 4) { // get header
- return false;
+ return NULL;
}
offset += 4;
- uint8_t id, layer, sr_index, mode;
- layer = (buffer[1] >> 1) & 3;
- id = (buffer[1] >> 3) & 3;
- sr_index = (buffer[2] >> 2) & 3;
- mode = (buffer[3] >> 6) & 3;
- if (layer == 0) {
- return false;
+ int header = U32_AT(buffer);;
+ size_t xingframesize = 0;
+ int sampling_rate = 0;
+ int num_channels;
+ int samples_per_frame = 0;
+ if (!GetMPEGAudioFrameSize(header, &xingframesize, &sampling_rate, &num_channels,
+ NULL, &samples_per_frame)) {
+ return NULL;
}
- if (id == 1) {
- return false;
- }
- if (sr_index == 3) {
- return false;
- }
+ seeker->mFirstFramePos += xingframesize;
+
+ uint8_t version = (buffer[1] >> 3) & 3;
+
// determine offset of XING header
- if(id&1) { // mpeg1
- if (mode != 3) offset += 32;
+ if(version & 1) { // mpeg1
+ if (num_channels != 1) offset += 32;
else offset += 17;
- } else { // mpeg2
- if (mode != 3) offset += 17;
+ } else { // mpeg 2 or 2.5
+ if (num_channels != 1) offset += 17;
else offset += 9;
}
if (source->readAt(offset, &buffer, 4) < 4) { // XING header ID
- return false;
+ return NULL;
}
offset += 4;
// Check XING ID
@@ -151,70 +120,50 @@
|| (buffer[2] != 'n') || (buffer[3] != 'g')) {
if ((buffer[0] != 'I') || (buffer[1] != 'n')
|| (buffer[2] != 'f') || (buffer[3] != 'o')) {
- return false;
+ return NULL;
}
}
if (source->readAt(offset, &buffer, 4) < 4) { // flags
- return false;
+ return NULL;
}
offset += 4;
uint32_t flags = U32_AT(buffer);
if (flags & 0x0001) { // Frames field is present
if (source->readAt(offset, buffer, 4) < 4) {
- return false;
+ return NULL;
}
- if (frame_number) {
- *frame_number = U32_AT(buffer);
- }
- int32_t frame = U32_AT(buffer);
- // Samples per Frame: 1. index = MPEG Version ID, 2. index = Layer
- const int samplesPerFrames[2][3] =
- {
- { 384, 1152, 576 }, // MPEG 2, 2.5: layer1, layer2, layer3
- { 384, 1152, 1152 }, // MPEG 1: layer1, layer2, layer3
- };
- // sampling rates in hertz: 1. index = MPEG Version ID, 2. index = sampling rate index
- const int samplingRates[4][3] =
- {
- { 11025, 12000, 8000, }, // MPEG 2.5
- { 0, 0, 0, }, // reserved
- { 22050, 24000, 16000, }, // MPEG 2
- { 44100, 48000, 32000, } // MPEG 1
- };
- if (duration) {
- *duration = (int64_t)frame * samplesPerFrames[id&1][3-layer] * 1000000LL
- / samplingRates[id][sr_index];
- }
+ int32_t frames = U32_AT(buffer);
+ seeker->mDurationUs = (int64_t)frames * samples_per_frame * 1000000LL / sampling_rate;
offset += 4;
}
if (flags & 0x0002) { // Bytes field is present
- if (byte_number) {
- if (source->readAt(offset, buffer, 4) < 4) {
- return false;
- }
- *byte_number = U32_AT(buffer);
+ if (source->readAt(offset, buffer, 4) < 4) {
+ return NULL;
}
+ seeker->mSizeBytes = U32_AT(buffer);
offset += 4;
}
if (flags & 0x0004) { // TOC field is present
- if (table_of_contents) {
- if (source->readAt(offset + 1, table_of_contents, 99) < 99) {
- return false;
- }
+ if (source->readAt(offset + 1, seeker->mTOC, 99) < 99) {
+ return NULL;
}
+ seeker->mTOCValid = true;
offset += 100;
}
+
+#if 0
if (flags & 0x0008) { // Quality indicator field is present
- if (quality_indicator) {
- if (source->readAt(offset, buffer, 4) < 4) {
- return false;
- }
- *quality_indicator = U32_AT(buffer);
+ if (source->readAt(offset, buffer, 4) < 4) {
+ return NULL;
}
+ // do something with the quality indicator
+ offset += 4;
}
- return true;
+#endif
+
+ return seeker;
}
} // namespace android
diff --git a/media/libstagefright/chromium_http/Android.mk b/media/libstagefright/chromium_http/Android.mk
index 63775f1..e37b4a8 100644
--- a/media/libstagefright/chromium_http/Android.mk
+++ b/media/libstagefright/chromium_http/Android.mk
@@ -10,7 +10,7 @@
LOCAL_C_INCLUDES:= \
$(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
- $(TOP)/frameworks/base/include/media/stagefright/openmax \
+ $(TOP)/frameworks/native/include/media/openmax \
external/chromium \
external/chromium/android
diff --git a/media/libstagefright/codecs/aacdec/Android.mk b/media/libstagefright/codecs/aacdec/Android.mk
index 20c7bc0..fd6de79 100644
--- a/media/libstagefright/codecs/aacdec/Android.mk
+++ b/media/libstagefright/codecs/aacdec/Android.mk
@@ -164,7 +164,7 @@
LOCAL_C_INCLUDES := \
frameworks/base/media/libstagefright/include \
- frameworks/base/include/media/stagefright/openmax \
+ frameworks/native/include/media/openmax
LOCAL_CFLAGS := -DOSCL_IMPORT_REF=
diff --git a/media/libstagefright/codecs/aacenc/Android.mk b/media/libstagefright/codecs/aacenc/Android.mk
index 509193c..b47cb1e 100644
--- a/media/libstagefright/codecs/aacenc/Android.mk
+++ b/media/libstagefright/codecs/aacenc/Android.mk
@@ -94,9 +94,9 @@
SoftAACEncoder.cpp
LOCAL_C_INCLUDES := \
- frameworks/base/media/libstagefright/include \
- frameworks/base/include/media/stagefright/openmax \
+ frameworks/base/media/libstagefright/include \
frameworks/base/media/libstagefright/codecs/common/include \
+ frameworks/native/include/media/openmax
LOCAL_CFLAGS := -DOSCL_IMPORT_REF=
diff --git a/media/libstagefright/codecs/amrnb/dec/Android.mk b/media/libstagefright/codecs/amrnb/dec/Android.mk
index 23a22ef..b81306d 100644
--- a/media/libstagefright/codecs/amrnb/dec/Android.mk
+++ b/media/libstagefright/codecs/amrnb/dec/Android.mk
@@ -61,12 +61,12 @@
LOCAL_C_INCLUDES := \
frameworks/base/media/libstagefright/include \
- frameworks/base/include/media/stagefright/openmax \
+ frameworks/base/media/libstagefright/codecs/amrwb/src \
+ frameworks/native/include/media/openmax \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/../common/include \
- $(LOCAL_PATH)/../common \
- frameworks/base/media/libstagefright/codecs/amrwb/src \
+ $(LOCAL_PATH)/../common
LOCAL_CFLAGS := -DOSCL_IMPORT_REF=
diff --git a/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp b/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp
index 7602f2d..796caa4 100644
--- a/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp
+++ b/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp
@@ -236,6 +236,18 @@
return OMX_ErrorNone;
}
+ case OMX_IndexParamAudioPcm:
+ {
+ const OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =
+ (OMX_AUDIO_PARAM_PCMMODETYPE *)params;
+
+ if (pcmParams->nPortIndex != 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ return OMX_ErrorNone;
+ }
+
default:
return SimpleSoftOMXComponent::internalSetParameter(index, params);
}
diff --git a/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp b/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp
deleted file mode 100644
index 27d7e4d..0000000
--- a/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp
+++ /dev/null
@@ -1,249 +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 "AMRNBEncoder.h"
-
-#include "gsmamr_enc.h"
-
-#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/MediaBufferGroup.h>
-#include <media/stagefright/MediaDefs.h>
-#include <media/stagefright/MediaErrors.h>
-#include <media/stagefright/MetaData.h>
-
-namespace android {
-
-static const int32_t kNumSamplesPerFrame = 160;
-static const int32_t kSampleRate = 8000;
-
-AMRNBEncoder::AMRNBEncoder(const sp<MediaSource> &source, const sp<MetaData> &meta)
- : mSource(source),
- mMeta(meta),
- mStarted(false),
- mBufferGroup(NULL),
- mEncState(NULL),
- mSidState(NULL),
- mAnchorTimeUs(0),
- mNumFramesOutput(0),
- mInputBuffer(NULL),
- mMode(MR475),
- mNumInputSamples(0) {
-}
-
-AMRNBEncoder::~AMRNBEncoder() {
- if (mStarted) {
- stop();
- }
-}
-
-static Mode PickModeFromBitrate(int32_t bps) {
- if (bps <= 4750) {
- return MR475;
- } else if (bps <= 5150) {
- return MR515;
- } else if (bps <= 5900) {
- return MR59;
- } else if (bps <= 6700) {
- return MR67;
- } else if (bps <= 7400) {
- return MR74;
- } else if (bps <= 7950) {
- return MR795;
- } else if (bps <= 10200) {
- return MR102;
- } else {
- return MR122;
- }
-}
-
-status_t AMRNBEncoder::start(MetaData *params) {
- if (mStarted) {
- ALOGW("Call start() when encoder already started");
- return OK;
- }
-
- mBufferGroup = new MediaBufferGroup;
- mBufferGroup->add_buffer(new MediaBuffer(32));
-
- CHECK_EQ(AMREncodeInit(
- &mEncState, &mSidState, false /* dtx_enable */),
- 0);
-
- status_t err = mSource->start(params);
- if (err != OK) {
- ALOGE("AudioSource is not available");
- return err;
- }
-
- mAnchorTimeUs = 0;
- mNumFramesOutput = 0;
- mStarted = true;
- mNumInputSamples = 0;
-
- int32_t bitrate;
- if (params && params->findInt32(kKeyBitRate, &bitrate)) {
- mMode = PickModeFromBitrate(bitrate);
- } else {
- mMode = MR475;
- }
-
- return OK;
-}
-
-status_t AMRNBEncoder::stop() {
- if (!mStarted) {
- ALOGW("Call stop() when encoder has not started.");
- return OK;
- }
-
- if (mInputBuffer) {
- mInputBuffer->release();
- mInputBuffer = NULL;
- }
-
- delete mBufferGroup;
- mBufferGroup = NULL;
-
- mSource->stop();
-
- AMREncodeExit(&mEncState, &mSidState);
- mEncState = mSidState = NULL;
-
- mStarted = false;
-
- return OK;
-}
-
-sp<MetaData> AMRNBEncoder::getFormat() {
- sp<MetaData> srcFormat = mSource->getFormat();
-
- mMeta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_AMR_NB);
-
- int64_t durationUs;
- if (srcFormat->findInt64(kKeyDuration, &durationUs)) {
- mMeta->setInt64(kKeyDuration, durationUs);
- }
-
- mMeta->setCString(kKeyDecoderComponent, "AMRNBEncoder");
-
- return mMeta;
-}
-
-status_t AMRNBEncoder::read(
- MediaBuffer **out, const ReadOptions *options) {
- status_t err;
-
- *out = NULL;
-
- int64_t seekTimeUs;
- ReadOptions::SeekMode mode;
- CHECK(options == NULL || !options->getSeekTo(&seekTimeUs, &mode));
- bool readFromSource = false;
- int64_t wallClockTimeUs = -1;
-
- while (mNumInputSamples < kNumSamplesPerFrame) {
- if (mInputBuffer == NULL) {
- err = mSource->read(&mInputBuffer, options);
-
- if (err != OK) {
- if (mNumInputSamples == 0) {
- return ERROR_END_OF_STREAM;
- }
- memset(&mInputFrame[mNumInputSamples],
- 0,
- sizeof(int16_t)
- * (kNumSamplesPerFrame - mNumInputSamples));
- mNumInputSamples = kNumSamplesPerFrame;
- break;
- }
-
- size_t align = mInputBuffer->range_length() % sizeof(int16_t);
- CHECK_EQ(align, 0);
- readFromSource = true;
-
- int64_t timeUs;
- if (mInputBuffer->meta_data()->findInt64(kKeyDriftTime, &timeUs)) {
- wallClockTimeUs = timeUs;
- }
- if (mInputBuffer->meta_data()->findInt64(kKeyAnchorTime, &timeUs)) {
- mAnchorTimeUs = timeUs;
- }
- } else {
- readFromSource = false;
- }
-
- size_t copy =
- (kNumSamplesPerFrame - mNumInputSamples) * sizeof(int16_t);
-
- if (copy > mInputBuffer->range_length()) {
- copy = mInputBuffer->range_length();
- }
-
- memcpy(&mInputFrame[mNumInputSamples],
- (const uint8_t *)mInputBuffer->data()
- + mInputBuffer->range_offset(),
- copy);
-
- mNumInputSamples += copy / sizeof(int16_t);
-
- mInputBuffer->set_range(
- mInputBuffer->range_offset() + copy,
- mInputBuffer->range_length() - copy);
-
- if (mInputBuffer->range_length() == 0) {
- mInputBuffer->release();
- mInputBuffer = NULL;
- }
- }
-
- MediaBuffer *buffer;
- CHECK_EQ(mBufferGroup->acquire_buffer(&buffer), (status_t)OK);
-
- uint8_t *outPtr = (uint8_t *)buffer->data();
-
- Frame_Type_3GPP frameType;
- int res = AMREncode(
- mEncState, mSidState, (Mode)mMode,
- mInputFrame, outPtr, &frameType, AMR_TX_WMF);
-
- CHECK(res >= 0);
- CHECK((size_t)res < buffer->size());
-
- // Convert header byte from WMF to IETF format.
- outPtr[0] = ((outPtr[0] << 3) | 4) & 0x7c;
-
- buffer->set_range(0, res);
-
- // Each frame of 160 samples is 20ms long.
- int64_t mediaTimeUs = mNumFramesOutput * 20000LL;
- buffer->meta_data()->setInt64(
- kKeyTime, mAnchorTimeUs + mediaTimeUs);
-
- if (readFromSource && wallClockTimeUs != -1) {
- buffer->meta_data()->setInt64(kKeyDriftTime,
- mediaTimeUs - wallClockTimeUs);
- }
-
- ++mNumFramesOutput;
-
- *out = buffer;
-
- mNumInputSamples = 0;
-
- return OK;
-}
-
-} // namespace android
diff --git a/media/libstagefright/codecs/amrnb/enc/Android.mk b/media/libstagefright/codecs/amrnb/enc/Android.mk
index 94e8726..28246ae 100644
--- a/media/libstagefright/codecs/amrnb/enc/Android.mk
+++ b/media/libstagefright/codecs/amrnb/enc/Android.mk
@@ -2,7 +2,6 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
- AMRNBEncoder.cpp \
src/amrencode.cpp \
src/autocorr.cpp \
src/c1035pf.cpp \
@@ -84,7 +83,7 @@
LOCAL_C_INCLUDES := \
frameworks/base/media/libstagefright/include \
- frameworks/base/include/media/stagefright/openmax \
+ frameworks/native/include/media/openmax \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/../common/include \
diff --git a/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp b/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp
deleted file mode 100644
index 7fd3a95..0000000
--- a/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp
+++ /dev/null
@@ -1,301 +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.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "AMRWBEncoder"
-#include <utils/Log.h>
-
-#include "AMRWBEncoder.h"
-#include "voAMRWB.h"
-#include "cmnMemory.h"
-
-#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/MediaBufferGroup.h>
-#include <media/stagefright/MediaDefs.h>
-#include <media/stagefright/MediaErrors.h>
-#include <media/stagefright/MetaData.h>
-
-namespace android {
-
-static const int32_t kNumSamplesPerFrame = 320;
-static const int32_t kBitsPerSample = 16;
-static const int32_t kInputBufferSize = (kBitsPerSample / 8) * kNumSamplesPerFrame;
-static const int32_t kSampleRate = 16000;
-static const int32_t kNumChannels = 1;
-
-AMRWBEncoder::AMRWBEncoder(const sp<MediaSource> &source, const sp<MetaData> &meta)
- : mSource(source),
- mMeta(meta),
- mStarted(false),
- mBufferGroup(NULL),
- mInputBuffer(NULL),
- mEncoderHandle(NULL),
- mApiHandle(NULL),
- mMemOperator(NULL),
- mAnchorTimeUs(0),
- mNumFramesOutput(0),
- mNumInputSamples(0) {
-}
-
-static VOAMRWBMODE pickModeFromBitRate(int32_t bps) {
- CHECK(bps >= 0);
- if (bps <= 6600) {
- return VOAMRWB_MD66;
- } else if (bps <= 8850) {
- return VOAMRWB_MD885;
- } else if (bps <= 12650) {
- return VOAMRWB_MD1265;
- } else if (bps <= 14250) {
- return VOAMRWB_MD1425;
- } else if (bps <= 15850) {
- return VOAMRWB_MD1585;
- } else if (bps <= 18250) {
- return VOAMRWB_MD1825;
- } else if (bps <= 19850) {
- return VOAMRWB_MD1985;
- } else if (bps <= 23050) {
- return VOAMRWB_MD2305;
- }
- return VOAMRWB_MD2385;
-}
-
-status_t AMRWBEncoder::initCheck() {
- CHECK(mApiHandle == NULL && mEncoderHandle == NULL);
- CHECK(mMeta->findInt32(kKeyBitRate, &mBitRate));
-
- mApiHandle = new VO_AUDIO_CODECAPI;
- CHECK(mApiHandle);
-
- if (VO_ERR_NONE != voGetAMRWBEncAPI(mApiHandle)) {
- ALOGE("Failed to get api handle");
- return UNKNOWN_ERROR;
- }
-
- mMemOperator = new VO_MEM_OPERATOR;
- CHECK(mMemOperator != NULL);
- mMemOperator->Alloc = cmnMemAlloc;
- mMemOperator->Copy = cmnMemCopy;
- mMemOperator->Free = cmnMemFree;
- mMemOperator->Set = cmnMemSet;
- mMemOperator->Check = cmnMemCheck;
-
- VO_CODEC_INIT_USERDATA userData;
- memset(&userData, 0, sizeof(userData));
- userData.memflag = VO_IMF_USERMEMOPERATOR;
- userData.memData = (VO_PTR) mMemOperator;
- if (VO_ERR_NONE != mApiHandle->Init(&mEncoderHandle, VO_AUDIO_CodingAMRWB, &userData)) {
- ALOGE("Failed to init AMRWB encoder");
- return UNKNOWN_ERROR;
- }
-
- // Configure AMRWB encoder$
- VOAMRWBMODE mode = pickModeFromBitRate(mBitRate);
- if (VO_ERR_NONE != mApiHandle->SetParam(mEncoderHandle, VO_PID_AMRWB_MODE, &mode)) {
- ALOGE("Failed to set AMRWB encoder mode to %d", mode);
- return UNKNOWN_ERROR;
- }
-
- VOAMRWBFRAMETYPE type = VOAMRWB_RFC3267;
- if (VO_ERR_NONE != mApiHandle->SetParam(mEncoderHandle, VO_PID_AMRWB_FRAMETYPE, &type)) {
- ALOGE("Failed to set AMRWB encoder frame type to %d", type);
- return UNKNOWN_ERROR;
- }
-
- return OK;
-}
-
-AMRWBEncoder::~AMRWBEncoder() {
- if (mStarted) {
- stop();
- }
-}
-
-status_t AMRWBEncoder::start(MetaData *params) {
- if (mStarted) {
- ALOGW("Call start() when encoder already started");
- return OK;
- }
-
- mBufferGroup = new MediaBufferGroup;
-
- // The largest buffer size is header + 477 bits
- mBufferGroup->add_buffer(new MediaBuffer(1024));
-
- CHECK_EQ((status_t)OK, initCheck());
-
- mNumFramesOutput = 0;
-
- status_t err = mSource->start(params);
- if (err != OK) {
- ALOGE("AudioSource is not available");
- return err;
- }
- mStarted = true;
-
- return OK;
-}
-
-status_t AMRWBEncoder::stop() {
- if (!mStarted) {
- ALOGW("Call stop() when encoder has not started");
- return OK;
- }
-
- if (mInputBuffer) {
- mInputBuffer->release();
- mInputBuffer = NULL;
- }
-
- delete mBufferGroup;
- mBufferGroup = NULL;
-
-
- CHECK_EQ((VO_U32)VO_ERR_NONE, mApiHandle->Uninit(mEncoderHandle));
- mEncoderHandle = NULL;
-
- delete mApiHandle;
- mApiHandle = NULL;
-
- delete mMemOperator;
- mMemOperator;
-
- mStarted = false;
-
- mSource->stop();
- return OK;
-}
-
-sp<MetaData> AMRWBEncoder::getFormat() {
- sp<MetaData> srcFormat = mSource->getFormat();
-
- mMeta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_AMR_WB);
-
- int64_t durationUs;
- if (srcFormat->findInt64(kKeyDuration, &durationUs)) {
- mMeta->setInt64(kKeyDuration, durationUs);
- }
-
- mMeta->setCString(kKeyDecoderComponent, "AMRWBEncoder");
-
- return mMeta;
-}
-
-status_t AMRWBEncoder::read(
- MediaBuffer **out, const ReadOptions *options) {
- status_t err;
-
- *out = NULL;
-
- int64_t seekTimeUs;
- ReadOptions::SeekMode mode;
- CHECK(options == NULL || !options->getSeekTo(&seekTimeUs, &mode));
- bool readFromSource = false;
- int64_t wallClockTimeUs = -1;
-
- while (mNumInputSamples < kNumSamplesPerFrame) {
- if (mInputBuffer == NULL) {
- err = mSource->read(&mInputBuffer, options);
-
- if (err != OK) {
- if (mNumInputSamples == 0) {
- return ERROR_END_OF_STREAM;
- }
- memset(&mInputFrame[mNumInputSamples],
- 0,
- sizeof(int16_t)
- * (kNumSamplesPerFrame - mNumInputSamples));
- mNumInputSamples = 0;
- break;
- }
-
- size_t align = mInputBuffer->range_length() % sizeof(int16_t);
- CHECK_EQ(align, (size_t)0);
-
- int64_t timeUs;
- if (mInputBuffer->meta_data()->findInt64(kKeyDriftTime, &timeUs)) {
- wallClockTimeUs = timeUs;
- }
- if (mInputBuffer->meta_data()->findInt64(kKeyAnchorTime, &timeUs)) {
- mAnchorTimeUs = timeUs;
- }
- readFromSource = true;
- } else {
- readFromSource = false;
- }
-
- size_t copy =
- (kNumSamplesPerFrame - mNumInputSamples) * sizeof(int16_t);
-
- if (copy > mInputBuffer->range_length()) {
- copy = mInputBuffer->range_length();
- }
-
- memcpy(&mInputFrame[mNumInputSamples],
- (const uint8_t *)mInputBuffer->data()
- + mInputBuffer->range_offset(),
- copy);
-
- mInputBuffer->set_range(
- mInputBuffer->range_offset() + copy,
- mInputBuffer->range_length() - copy);
-
- if (mInputBuffer->range_length() == 0) {
- mInputBuffer->release();
- mInputBuffer = NULL;
- }
-
- mNumInputSamples += copy / sizeof(int16_t);
- if (mNumInputSamples >= kNumSamplesPerFrame) {
- mNumInputSamples %= kNumSamplesPerFrame;
- break; // Get a whole input frame 640 bytes
- }
- }
-
- VO_CODECBUFFER inputData;
- memset(&inputData, 0, sizeof(inputData));
- inputData.Buffer = (unsigned char*) mInputFrame;
- inputData.Length = kInputBufferSize;
- CHECK(VO_ERR_NONE == mApiHandle->SetInputData(mEncoderHandle,&inputData));
-
- MediaBuffer *buffer;
- CHECK_EQ(mBufferGroup->acquire_buffer(&buffer), (status_t)OK);
- uint8_t *outPtr = (uint8_t *)buffer->data();
-
- VO_CODECBUFFER outputData;
- memset(&outputData, 0, sizeof(outputData));
- VO_AUDIO_OUTPUTINFO outputInfo;
- memset(&outputInfo, 0, sizeof(outputInfo));
-
- VO_U32 ret = VO_ERR_NONE;
- outputData.Buffer = outPtr;
- outputData.Length = buffer->size();
- ret = mApiHandle->GetOutputData(mEncoderHandle, &outputData, &outputInfo);
- CHECK(ret == VO_ERR_NONE || ret == VO_ERR_INPUT_BUFFER_SMALL);
-
- buffer->set_range(0, outputData.Length);
- ++mNumFramesOutput;
-
- int64_t mediaTimeUs = mNumFramesOutput * 20000LL;
- buffer->meta_data()->setInt64(kKeyTime, mAnchorTimeUs + mediaTimeUs);
- if (readFromSource && wallClockTimeUs != -1) {
- buffer->meta_data()->setInt64(kKeyDriftTime, mediaTimeUs - wallClockTimeUs);
- }
-
- *out = buffer;
- return OK;
-}
-
-} // namespace android
diff --git a/media/libstagefright/codecs/amrwbenc/Android.mk b/media/libstagefright/codecs/amrwbenc/Android.mk
index 6ce6171..d3c3041 100644
--- a/media/libstagefright/codecs/amrwbenc/Android.mk
+++ b/media/libstagefright/codecs/amrwbenc/Android.mk
@@ -5,7 +5,6 @@
LOCAL_SRC_FILES := \
- AMRWBEncoder.cpp \
src/autocorr.c \
src/az_isp.c \
src/bits.c \
@@ -125,9 +124,9 @@
SoftAMRWBEncoder.cpp
LOCAL_C_INCLUDES := \
- frameworks/base/media/libstagefright/include \
- frameworks/base/include/media/stagefright/openmax \
+ frameworks/base/media/libstagefright/include \
frameworks/base/media/libstagefright/codecs/common/include \
+ frameworks/native/include/media/openmax
LOCAL_STATIC_LIBRARIES := \
libstagefright_amrwbenc
diff --git a/media/libstagefright/codecs/avc/enc/Android.mk b/media/libstagefright/codecs/avc/enc/Android.mk
index eb2e320..54cc9b1 100644
--- a/media/libstagefright/codecs/avc/enc/Android.mk
+++ b/media/libstagefright/codecs/avc/enc/Android.mk
@@ -25,8 +25,8 @@
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/../common/include \
- $(TOP)/frameworks/base/include/media/stagefright/openmax \
- $(TOP)/frameworks/base/media/libstagefright/include
+ $(TOP)/frameworks/base/media/libstagefright/include \
+ $(TOP)/frameworks/native/include/media/openmax
LOCAL_CFLAGS := \
-D__arm__ \
diff --git a/media/libstagefright/codecs/g711/dec/Android.mk b/media/libstagefright/codecs/g711/dec/Android.mk
index 6692533..42706a5 100644
--- a/media/libstagefright/codecs/g711/dec/Android.mk
+++ b/media/libstagefright/codecs/g711/dec/Android.mk
@@ -6,7 +6,7 @@
LOCAL_C_INCLUDES := \
frameworks/base/media/libstagefright/include \
- frameworks/base/include/media/stagefright/openmax \
+ frameworks/native/include/media/openmax
LOCAL_SHARED_LIBRARIES := \
libstagefright libstagefright_omx libstagefright_foundation libutils
diff --git a/media/libstagefright/codecs/g711/dec/SoftG711.cpp b/media/libstagefright/codecs/g711/dec/SoftG711.cpp
index 32ef003..bcdd3c7 100644
--- a/media/libstagefright/codecs/g711/dec/SoftG711.cpp
+++ b/media/libstagefright/codecs/g711/dec/SoftG711.cpp
@@ -140,7 +140,7 @@
OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =
(OMX_AUDIO_PARAM_PCMMODETYPE *)params;
- if (pcmParams->nPortIndex != 0) {
+ if (pcmParams->nPortIndex != 0 && pcmParams->nPortIndex != 1) {
return OMX_ErrorUndefined;
}
@@ -148,7 +148,9 @@
return OMX_ErrorUndefined;
}
- mNumChannels = pcmParams->nChannels;
+ if(pcmParams->nPortIndex == 0) {
+ mNumChannels = pcmParams->nChannels;
+ }
return OMX_ErrorNone;
}
diff --git a/media/libstagefright/codecs/m4v_h263/dec/Android.mk b/media/libstagefright/codecs/m4v_h263/dec/Android.mk
index 2ffa5f2..8c245d10 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/Android.mk
+++ b/media/libstagefright/codecs/m4v_h263/dec/Android.mk
@@ -42,7 +42,7 @@
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/include \
$(TOP)/frameworks/base/media/libstagefright/include \
- $(TOP)/frameworks/base/include/media/stagefright/openmax
+ $(TOP)/frameworks/native/include/media/openmax
LOCAL_CFLAGS := -DOSCL_EXPORT_REF= -DOSCL_IMPORT_REF=
@@ -59,7 +59,7 @@
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/include \
frameworks/base/media/libstagefright/include \
- frameworks/base/include/media/stagefright/openmax \
+ frameworks/native/include/media/openmax
LOCAL_CFLAGS := -DOSCL_EXPORT_REF= -DOSCL_IMPORT_REF=
diff --git a/media/libstagefright/codecs/m4v_h263/enc/Android.mk b/media/libstagefright/codecs/m4v_h263/enc/Android.mk
index 43318e9..2b7c938 100644
--- a/media/libstagefright/codecs/m4v_h263/enc/Android.mk
+++ b/media/libstagefright/codecs/m4v_h263/enc/Android.mk
@@ -31,7 +31,7 @@
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/include \
- $(TOP)/frameworks/base/include/media/stagefright/openmax \
- $(TOP)/frameworks/base/media/libstagefright/include
+ $(TOP)/frameworks/base/media/libstagefright/include \
+ $(TOP)/frameworks/native/include/media/openmax
include $(BUILD_STATIC_LIBRARY)
diff --git a/media/libstagefright/codecs/mp3dec/Android.mk b/media/libstagefright/codecs/mp3dec/Android.mk
index a08c9f0..ed51aa5 100644
--- a/media/libstagefright/codecs/mp3dec/Android.mk
+++ b/media/libstagefright/codecs/mp3dec/Android.mk
@@ -65,7 +65,7 @@
LOCAL_C_INCLUDES := \
frameworks/base/media/libstagefright/include \
- frameworks/base/include/media/stagefright/openmax \
+ frameworks/native/include/media/openmax \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/include
diff --git a/media/libstagefright/codecs/on2/dec/Android.mk b/media/libstagefright/codecs/on2/dec/Android.mk
index 32bbd6b..2997228 100644
--- a/media/libstagefright/codecs/on2/dec/Android.mk
+++ b/media/libstagefright/codecs/on2/dec/Android.mk
@@ -9,7 +9,7 @@
$(TOP)/external/libvpx/vpx_codec \
$(TOP)/external/libvpx/vpx_ports \
frameworks/base/media/libstagefright/include \
- frameworks/base/include/media/stagefright/openmax \
+ frameworks/native/include/media/openmax \
LOCAL_STATIC_LIBRARIES := \
libvpx
diff --git a/media/libstagefright/codecs/on2/h264dec/Android.mk b/media/libstagefright/codecs/on2/h264dec/Android.mk
index 5b3c876..43c20f0 100644
--- a/media/libstagefright/codecs/on2/h264dec/Android.mk
+++ b/media/libstagefright/codecs/on2/h264dec/Android.mk
@@ -35,7 +35,7 @@
LOCAL_C_INCLUDES := $(LOCAL_PATH)/./inc \
frameworks/base/media/libstagefright/include \
- frameworks/base/include/media/stagefright/openmax \
+ frameworks/native/include/media/openmax \
MY_ASM := \
./source/arm_neon_asm_gcc/h264bsdWriteMacroblock.S \
diff --git a/media/libstagefright/codecs/vorbis/dec/Android.mk b/media/libstagefright/codecs/vorbis/dec/Android.mk
index f33f3ac..fca70b7 100644
--- a/media/libstagefright/codecs/vorbis/dec/Android.mk
+++ b/media/libstagefright/codecs/vorbis/dec/Android.mk
@@ -7,7 +7,7 @@
LOCAL_C_INCLUDES := \
external/tremolo \
frameworks/base/media/libstagefright/include \
- frameworks/base/include/media/stagefright/openmax \
+ frameworks/native/include/media/openmax \
LOCAL_SHARED_LIBRARIES := \
libvorbisidec libstagefright libstagefright_omx \
diff --git a/media/libstagefright/colorconversion/Android.mk b/media/libstagefright/colorconversion/Android.mk
index 62ba40f..59a64ba 100644
--- a/media/libstagefright/colorconversion/Android.mk
+++ b/media/libstagefright/colorconversion/Android.mk
@@ -6,7 +6,7 @@
SoftwareRenderer.cpp
LOCAL_C_INCLUDES := \
- $(TOP)/frameworks/base/include/media/stagefright/openmax \
+ $(TOP)/frameworks/native/include/media/openmax \
$(TOP)/hardware/msm7k
LOCAL_MODULE:= libstagefright_color_conversion
diff --git a/media/libstagefright/httplive/Android.mk b/media/libstagefright/httplive/Android.mk
index 9225e41..a5990c3 100644
--- a/media/libstagefright/httplive/Android.mk
+++ b/media/libstagefright/httplive/Android.mk
@@ -9,9 +9,9 @@
LOCAL_C_INCLUDES:= \
$(JNI_H_INCLUDE) \
- $(TOP)/frameworks/base/include/media/stagefright/openmax \
- $(TOP)/frameworks/base/media/libstagefright \
- $(TOP)/external/openssl/include
+ $(TOP)/frameworks/base/media/libstagefright \
+ $(TOP)/frameworks/native/include/media/openmax \
+ $(TOP)/external/openssl/include
LOCAL_MODULE:= libstagefright_httplive
diff --git a/media/libstagefright/include/AACDecoder.h b/media/libstagefright/include/AACDecoder.h
deleted file mode 100644
index 886a3b7..0000000
--- a/media/libstagefright/include/AACDecoder.h
+++ /dev/null
@@ -1,68 +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.
- */
-
-#ifndef AAC_DECODER_H_
-
-#define AAC_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-
-struct tPVMP4AudioDecoderExternal;
-
-namespace android {
-
-struct MediaBufferGroup;
-struct MetaData;
-
-struct AACDecoder : public MediaSource {
- AACDecoder(const sp<MediaSource> &source);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
- virtual ~AACDecoder();
-
-private:
- sp<MetaData> mMeta;
- sp<MediaSource> mSource;
- bool mStarted;
-
- MediaBufferGroup *mBufferGroup;
-
- tPVMP4AudioDecoderExternal *mConfig;
- void *mDecoderBuf;
- int64_t mAnchorTimeUs;
- int64_t mNumSamplesOutput;
- status_t mInitCheck;
- int64_t mNumDecodedBuffers;
- int32_t mUpsamplingFactor;
-
- MediaBuffer *mInputBuffer;
-
- status_t initCheck();
- AACDecoder(const AACDecoder &);
- AACDecoder &operator=(const AACDecoder &);
-};
-
-} // namespace android
-
-#endif // AAC_DECODER_H_
diff --git a/media/libstagefright/include/AMRNBDecoder.h b/media/libstagefright/include/AMRNBDecoder.h
deleted file mode 100644
index cf24eda..0000000
--- a/media/libstagefright/include/AMRNBDecoder.h
+++ /dev/null
@@ -1,59 +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.
- */
-
-#ifndef AMR_NB_DECODER_H_
-
-#define AMR_NB_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct AMRNBDecoder : public MediaSource {
- AMRNBDecoder(const sp<MediaSource> &source);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
- virtual ~AMRNBDecoder();
-
-private:
- sp<MediaSource> mSource;
- bool mStarted;
-
- MediaBufferGroup *mBufferGroup;
-
- void *mState;
- int64_t mAnchorTimeUs;
- int64_t mNumSamplesOutput;
-
- MediaBuffer *mInputBuffer;
-
- AMRNBDecoder(const AMRNBDecoder &);
- AMRNBDecoder &operator=(const AMRNBDecoder &);
-};
-
-} // namespace android
-
-#endif // AMR_NB_DECODER_H_
diff --git a/media/libstagefright/include/AMRNBEncoder.h b/media/libstagefright/include/AMRNBEncoder.h
deleted file mode 100644
index 71160e6..0000000
--- a/media/libstagefright/include/AMRNBEncoder.h
+++ /dev/null
@@ -1,66 +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.
- */
-
-#ifndef AMR_NB_ENCODER_H_
-
-#define AMR_NB_ENCODER_H_
-
-#include <media/stagefright/MediaSource.h>
-#include <media/stagefright/MetaData.h>
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct AMRNBEncoder : public MediaSource {
- AMRNBEncoder(const sp<MediaSource> &source, const sp<MetaData> &meta);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
- virtual ~AMRNBEncoder();
-
-private:
- sp<MediaSource> mSource;
- sp<MetaData> mMeta;
- bool mStarted;
-
- MediaBufferGroup *mBufferGroup;
-
- void *mEncState;
- void *mSidState;
- int64_t mAnchorTimeUs;
- int64_t mNumFramesOutput;
-
- MediaBuffer *mInputBuffer;
- int mMode;
-
- int16_t mInputFrame[160];
- int32_t mNumInputSamples;
-
- AMRNBEncoder(const AMRNBEncoder &);
- AMRNBEncoder &operator=(const AMRNBEncoder &);
-};
-
-} // namespace android
-
-#endif // AMR_NB_ENCODER_H_
diff --git a/media/libstagefright/include/AMRWBDecoder.h b/media/libstagefright/include/AMRWBDecoder.h
deleted file mode 100644
index 927c51c..0000000
--- a/media/libstagefright/include/AMRWBDecoder.h
+++ /dev/null
@@ -1,62 +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.
- */
-
-#ifndef AMR_WB_DECODER_H_
-
-#define AMR_WB_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct AMRWBDecoder : public MediaSource {
- AMRWBDecoder(const sp<MediaSource> &source);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
- virtual ~AMRWBDecoder();
-
-private:
- sp<MediaSource> mSource;
- bool mStarted;
-
- MediaBufferGroup *mBufferGroup;
-
- void *mState;
- void *mDecoderBuf;
- int16_t *mDecoderCookie;
- int64_t mAnchorTimeUs;
- int64_t mNumSamplesOutput;
- int16_t mInputSampleBuffer[477];
-
- MediaBuffer *mInputBuffer;
-
- AMRWBDecoder(const AMRWBDecoder &);
- AMRWBDecoder &operator=(const AMRWBDecoder &);
-};
-
-} // namespace android
-
-#endif // AMR_WB_DECODER_H_
diff --git a/media/libstagefright/include/AMRWBEncoder.h b/media/libstagefright/include/AMRWBEncoder.h
deleted file mode 100644
index f2d155f..0000000
--- a/media/libstagefright/include/AMRWBEncoder.h
+++ /dev/null
@@ -1,72 +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.
- */
-
-#ifndef AMR_WB_ENCODER_H
-#define AMR_WB_ENCODER_H
-
-#include <media/stagefright/MediaSource.h>
-#include <media/stagefright/MetaData.h>
-
-struct VO_AUDIO_CODECAPI;
-struct VO_MEM_OPERATOR;
-
-namespace android {
-
-struct MediaBufferGroup;
-
-class AMRWBEncoder: public MediaSource {
- public:
- AMRWBEncoder(const sp<MediaSource> &source, const sp<MetaData> &meta);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
- virtual sp<MetaData> getFormat();
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
-
- protected:
- virtual ~AMRWBEncoder();
-
- private:
- sp<MediaSource> mSource;
- sp<MetaData> mMeta;
- bool mStarted;
- MediaBufferGroup *mBufferGroup;
- MediaBuffer *mInputBuffer;
- status_t mInitCheck;
- int32_t mBitRate;
- void *mEncoderHandle;
- VO_AUDIO_CODECAPI *mApiHandle;
- VO_MEM_OPERATOR *mMemOperator;
-
- int64_t mAnchorTimeUs;
- int64_t mNumFramesOutput;
-
- int16_t mInputFrame[320];
- int32_t mNumInputSamples;
-
- status_t initCheck();
-
- AMRWBEncoder& operator=(const AMRWBEncoder &rhs);
- AMRWBEncoder(const AMRWBEncoder& copy);
-
-};
-
-}
-
-#endif //#ifndef AMR_WB_ENCODER_H
-
diff --git a/media/libstagefright/include/AVCDecoder.h b/media/libstagefright/include/AVCDecoder.h
deleted file mode 100644
index eb3b142..0000000
--- a/media/libstagefright/include/AVCDecoder.h
+++ /dev/null
@@ -1,93 +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.
- */
-
-#ifndef AVC_DECODER_H_
-
-#define AVC_DECODER_H_
-
-#include <media/stagefright/MediaBuffer.h>
-#include <media/stagefright/MediaSource.h>
-#include <utils/Vector.h>
-
-struct tagAVCHandle;
-
-namespace android {
-
-struct AVCDecoder : public MediaSource,
- public MediaBufferObserver {
- AVCDecoder(const sp<MediaSource> &source);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
- virtual void signalBufferReturned(MediaBuffer *buffer);
-
-protected:
- virtual ~AVCDecoder();
-
-private:
- sp<MediaSource> mSource;
- bool mStarted;
-
- sp<MetaData> mFormat;
-
- Vector<MediaBuffer *> mCodecSpecificData;
-
- tagAVCHandle *mHandle;
- Vector<MediaBuffer *> mFrames;
- MediaBuffer *mInputBuffer;
-
- int64_t mAnchorTimeUs;
- int64_t mNumSamplesOutput;
- int64_t mPendingSeekTimeUs;
- MediaSource::ReadOptions::SeekMode mPendingSeekMode;
-
- int64_t mTargetTimeUs;
-
- bool mSPSSeen;
- bool mPPSSeen;
-
- void addCodecSpecificData(const uint8_t *data, size_t size);
-
- static int32_t ActivateSPSWrapper(
- void *userData, unsigned int sizeInMbs, unsigned int numBuffers);
-
- static int32_t BindFrameWrapper(
- void *userData, int32_t index, uint8_t **yuv);
-
- static void UnbindFrame(void *userData, int32_t index);
-
- int32_t activateSPS(
- unsigned int sizeInMbs, unsigned int numBuffers);
-
- int32_t bindFrame(int32_t index, uint8_t **yuv);
-
- void releaseFrames();
-
- MediaBuffer *drainOutputBuffer();
-
- AVCDecoder(const AVCDecoder &);
- AVCDecoder &operator=(const AVCDecoder &);
-};
-
-} // namespace android
-
-#endif // AVC_DECODER_H_
diff --git a/media/libstagefright/include/AwesomePlayer.h b/media/libstagefright/include/AwesomePlayer.h
index 4c7bfa6..06e9468 100644
--- a/media/libstagefright/include/AwesomePlayer.h
+++ b/media/libstagefright/include/AwesomePlayer.h
@@ -90,6 +90,7 @@
status_t setParameter(int key, const Parcel &request);
status_t getParameter(int key, Parcel *reply);
+ status_t invoke(const Parcel &request, Parcel *reply);
status_t setCacheStatCollectFreq(const Parcel &request);
status_t seekTo(int64_t timeUs);
@@ -100,8 +101,6 @@
void postAudioEOS(int64_t delayUs = 0ll);
void postAudioSeekComplete();
- status_t setTimedTextTrackIndex(int32_t index);
-
status_t dump(int fd, const Vector<String16> &args) const;
private:
@@ -136,7 +135,7 @@
INCOGNITO = 0x8000,
TEXT_RUNNING = 0x10000,
- TEXTPLAYER_STARTED = 0x20000,
+ TEXTPLAYER_INITIALIZED = 0x20000,
SLOW_DECODER_HACK = 0x40000,
};
diff --git a/media/libstagefright/include/G711Decoder.h b/media/libstagefright/include/G711Decoder.h
deleted file mode 100644
index 8b5143a..0000000
--- a/media/libstagefright/include/G711Decoder.h
+++ /dev/null
@@ -1,57 +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.
- */
-
-#ifndef G711_DECODER_H_
-
-#define G711_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct G711Decoder : public MediaSource {
- G711Decoder(const sp<MediaSource> &source);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
- virtual ~G711Decoder();
-
-private:
- sp<MediaSource> mSource;
- bool mStarted;
- bool mIsMLaw;
-
- MediaBufferGroup *mBufferGroup;
-
- static void DecodeALaw(int16_t *out, const uint8_t *in, size_t inSize);
- static void DecodeMLaw(int16_t *out, const uint8_t *in, size_t inSize);
-
- G711Decoder(const G711Decoder &);
- G711Decoder &operator=(const G711Decoder &);
-};
-
-} // namespace android
-
-#endif // G711_DECODER_H_
diff --git a/media/libstagefright/include/M4vH263Decoder.h b/media/libstagefright/include/M4vH263Decoder.h
deleted file mode 100644
index 7d73e30..0000000
--- a/media/libstagefright/include/M4vH263Decoder.h
+++ /dev/null
@@ -1,68 +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.
- */
-
-#ifndef M4V_H263_DECODER_H_
-
-#define M4V_H263_DECODER_H_
-
-#include <media/stagefright/MediaBuffer.h>
-#include <media/stagefright/MediaSource.h>
-
-struct tagvideoDecControls;
-
-namespace android {
-
-struct M4vH263Decoder : public MediaSource,
- public MediaBufferObserver {
- M4vH263Decoder(const sp<MediaSource> &source);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
- virtual void signalBufferReturned(MediaBuffer *buffer);
-
-protected:
- virtual ~M4vH263Decoder();
-
-private:
- sp<MediaSource> mSource;
- bool mStarted;
- int32_t mWidth, mHeight;
-
- sp<MetaData> mFormat;
-
- tagvideoDecControls *mHandle;
- MediaBuffer *mFrames[2];
- MediaBuffer *mInputBuffer;
-
- int64_t mNumSamplesOutput;
- int64_t mTargetTimeUs;
-
- void allocateFrames(int32_t width, int32_t height);
- void releaseFrames();
-
- M4vH263Decoder(const M4vH263Decoder &);
- M4vH263Decoder &operator=(const M4vH263Decoder &);
-};
-
-} // namespace android
-
-#endif // M4V_H263_DECODER_H_
diff --git a/media/libstagefright/include/MP3Decoder.h b/media/libstagefright/include/MP3Decoder.h
deleted file mode 100644
index 4086fb6..0000000
--- a/media/libstagefright/include/MP3Decoder.h
+++ /dev/null
@@ -1,67 +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.
- */
-
-#ifndef MP3_DECODER_H_
-
-#define MP3_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-
-struct tPVMP3DecoderExternal;
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct MP3Decoder : public MediaSource {
- MP3Decoder(const sp<MediaSource> &source);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
- virtual ~MP3Decoder();
-
-private:
- sp<MediaSource> mSource;
- sp<MetaData> mMeta;
- int32_t mNumChannels;
-
- bool mStarted;
-
- MediaBufferGroup *mBufferGroup;
-
- tPVMP3DecoderExternal *mConfig;
- void *mDecoderBuf;
- int64_t mAnchorTimeUs;
- int64_t mNumFramesOutput;
-
- MediaBuffer *mInputBuffer;
-
- void init();
-
- MP3Decoder(const MP3Decoder &);
- MP3Decoder &operator=(const MP3Decoder &);
-};
-
-} // namespace android
-
-#endif // MP3_DECODER_H_
diff --git a/media/libstagefright/include/VPXDecoder.h b/media/libstagefright/include/VPXDecoder.h
deleted file mode 100644
index 3b8362d..0000000
--- a/media/libstagefright/include/VPXDecoder.h
+++ /dev/null
@@ -1,62 +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.
- */
-
-#ifndef VPX_DECODER_H_
-
-#define VPX_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-#include <utils/Vector.h>
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct VPXDecoder : public MediaSource {
- VPXDecoder(const sp<MediaSource> &source);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
- virtual ~VPXDecoder();
-
-private:
- sp<MediaSource> mSource;
- bool mStarted;
- int32_t mWidth, mHeight;
- size_t mBufferSize;
-
- void *mCtx;
- MediaBufferGroup *mBufferGroup;
-
- int64_t mTargetTimeUs;
-
- sp<MetaData> mFormat;
-
- VPXDecoder(const VPXDecoder &);
- VPXDecoder &operator=(const VPXDecoder &);
-};
-
-} // namespace android
-
-#endif // VPX_DECODER_H_
-
diff --git a/media/libstagefright/include/VorbisDecoder.h b/media/libstagefright/include/VorbisDecoder.h
deleted file mode 100644
index 13e8b77..0000000
--- a/media/libstagefright/include/VorbisDecoder.h
+++ /dev/null
@@ -1,72 +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.
- */
-
-#ifndef VORBIS_DECODER_H_
-
-#define VORBIS_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-
-struct vorbis_dsp_state;
-struct vorbis_info;
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct VorbisDecoder : public MediaSource {
- VorbisDecoder(const sp<MediaSource> &source);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
- virtual ~VorbisDecoder();
-
-private:
- enum {
- kMaxNumSamplesPerBuffer = 8192 * 2
- };
-
- sp<MediaSource> mSource;
- bool mStarted;
-
- MediaBufferGroup *mBufferGroup;
-
- int32_t mNumChannels;
- int32_t mSampleRate;
- int64_t mAnchorTimeUs;
- int64_t mNumFramesOutput;
- int32_t mNumFramesLeftOnPage;
-
- vorbis_dsp_state *mState;
- vorbis_info *mVi;
-
- int decodePacket(MediaBuffer *packet, MediaBuffer *out);
-
- VorbisDecoder(const VorbisDecoder &);
- VorbisDecoder &operator=(const VorbisDecoder &);
-};
-
-} // namespace android
-
-#endif // VORBIS_DECODER_H_
-
diff --git a/media/libstagefright/include/XINGSeeker.h b/media/libstagefright/include/XINGSeeker.h
index ec5bd9b..8510979 100644
--- a/media/libstagefright/include/XINGSeeker.h
+++ b/media/libstagefright/include/XINGSeeker.h
@@ -37,7 +37,8 @@
int32_t mSizeBytes;
// TOC entries in XING header. Skip the first one since it's always 0.
- unsigned char mTableOfContents[99];
+ unsigned char mTOC[99];
+ bool mTOCValid;
XINGSeeker();
diff --git a/media/libstagefright/matroska/Android.mk b/media/libstagefright/matroska/Android.mk
index 1f1c68b..e67da4c 100644
--- a/media/libstagefright/matroska/Android.mk
+++ b/media/libstagefright/matroska/Android.mk
@@ -7,7 +7,7 @@
LOCAL_C_INCLUDES:= \
$(JNI_H_INCLUDE) \
$(TOP)/external/libvpx/mkvparser \
- $(TOP)/frameworks/base/include/media/stagefright/openmax \
+ $(TOP)/frameworks/native/include/media/openmax \
LOCAL_CFLAGS += -Wno-multichar
diff --git a/media/libstagefright/mpeg2ts/Android.mk b/media/libstagefright/mpeg2ts/Android.mk
index 578c669..ac4c2a1 100644
--- a/media/libstagefright/mpeg2ts/Android.mk
+++ b/media/libstagefright/mpeg2ts/Android.mk
@@ -11,8 +11,8 @@
LOCAL_C_INCLUDES:= \
$(JNI_H_INCLUDE) \
- $(TOP)/frameworks/base/include/media/stagefright/openmax \
- $(TOP)/frameworks/base/media/libstagefright
+ $(TOP)/frameworks/base/media/libstagefright \
+ $(TOP)/frameworks/native/include/media/openmax
LOCAL_MODULE:= libstagefright_mpeg2ts
diff --git a/media/libstagefright/omx/Android.mk b/media/libstagefright/omx/Android.mk
index d844f3d..083c7ef 100644
--- a/media/libstagefright/omx/Android.mk
+++ b/media/libstagefright/omx/Android.mk
@@ -5,7 +5,6 @@
LOCAL_SRC_FILES:= \
OMX.cpp \
- OMXComponentBase.cpp \
OMXMaster.cpp \
OMXNodeInstance.cpp \
SimpleSoftOMXComponent.cpp \
@@ -14,7 +13,8 @@
LOCAL_C_INCLUDES += \
frameworks/base/media/libstagefright \
- $(TOP)/frameworks/base/include/media/stagefright/openmax
+ $(TOP)/frameworks/native/include/media/hardware \
+ $(TOP)/frameworks/native/include/media/openmax
LOCAL_SHARED_LIBRARIES := \
libbinder \
diff --git a/media/libstagefright/omx/OMXComponentBase.cpp b/media/libstagefright/omx/OMXComponentBase.cpp
deleted file mode 100644
index 7d11dce..0000000
--- a/media/libstagefright/omx/OMXComponentBase.cpp
+++ /dev/null
@@ -1,201 +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 "OMXComponentBase.h"
-
-#include <stdlib.h>
-
-#include <media/stagefright/foundation/ADebug.h>
-
-namespace android {
-
-OMXComponentBase::OMXComponentBase(
- const OMX_CALLBACKTYPE *callbacks,
- OMX_PTR appData)
- : mCallbacks(callbacks),
- mAppData(appData),
- mComponentHandle(NULL) {
-}
-
-OMXComponentBase::~OMXComponentBase() {}
-
-void OMXComponentBase::setComponentHandle(OMX_COMPONENTTYPE *handle) {
- CHECK(mComponentHandle == NULL);
- mComponentHandle = handle;
-}
-
-void OMXComponentBase::postEvent(
- OMX_EVENTTYPE event, OMX_U32 param1, OMX_U32 param2) {
- (*mCallbacks->EventHandler)(
- mComponentHandle, mAppData, event, param1, param2, NULL);
-}
-
-void OMXComponentBase::postFillBufferDone(OMX_BUFFERHEADERTYPE *bufHdr) {
- (*mCallbacks->FillBufferDone)(mComponentHandle, mAppData, bufHdr);
-}
-
-void OMXComponentBase::postEmptyBufferDone(OMX_BUFFERHEADERTYPE *bufHdr) {
- (*mCallbacks->EmptyBufferDone)(mComponentHandle, mAppData, bufHdr);
-}
-
-static OMXComponentBase *getBase(OMX_HANDLETYPE hComponent) {
- return (OMXComponentBase *)
- ((OMX_COMPONENTTYPE *)hComponent)->pComponentPrivate;
-}
-
-static OMX_ERRORTYPE SendCommandWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_COMMANDTYPE Cmd,
- OMX_IN OMX_U32 nParam1,
- OMX_IN OMX_PTR pCmdData) {
- return getBase(hComponent)->sendCommand(Cmd, nParam1, pCmdData);
-}
-
-static OMX_ERRORTYPE GetParameterWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_INDEXTYPE nParamIndex,
- OMX_INOUT OMX_PTR pComponentParameterStructure) {
- return getBase(hComponent)->getParameter(
- nParamIndex, pComponentParameterStructure);
-}
-
-static OMX_ERRORTYPE SetParameterWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_INDEXTYPE nIndex,
- OMX_IN OMX_PTR pComponentParameterStructure) {
- return getBase(hComponent)->getParameter(
- nIndex, pComponentParameterStructure);
-}
-
-static OMX_ERRORTYPE GetConfigWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_INDEXTYPE nIndex,
- OMX_INOUT OMX_PTR pComponentConfigStructure) {
- return getBase(hComponent)->getConfig(nIndex, pComponentConfigStructure);
-}
-
-static OMX_ERRORTYPE SetConfigWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_INDEXTYPE nIndex,
- OMX_IN OMX_PTR pComponentConfigStructure) {
- return getBase(hComponent)->setConfig(nIndex, pComponentConfigStructure);
-}
-
-static OMX_ERRORTYPE GetExtensionIndexWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_STRING cParameterName,
- OMX_OUT OMX_INDEXTYPE* pIndexType) {
- return getBase(hComponent)->getExtensionIndex(cParameterName, pIndexType);
-}
-
-static OMX_ERRORTYPE GetStateWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_OUT OMX_STATETYPE* pState) {
- return getBase(hComponent)->getState(pState);
-}
-
-static OMX_ERRORTYPE UseBufferWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr,
- OMX_IN OMX_U32 nPortIndex,
- OMX_IN OMX_PTR pAppPrivate,
- OMX_IN OMX_U32 nSizeBytes,
- OMX_IN OMX_U8* pBuffer) {
- return getBase(hComponent)->useBuffer(
- ppBufferHdr, nPortIndex, pAppPrivate, nSizeBytes, pBuffer);
-}
-
-static OMX_ERRORTYPE AllocateBufferWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_INOUT OMX_BUFFERHEADERTYPE** ppBuffer,
- OMX_IN OMX_U32 nPortIndex,
- OMX_IN OMX_PTR pAppPrivate,
- OMX_IN OMX_U32 nSizeBytes) {
- return getBase(hComponent)->allocateBuffer(
- ppBuffer, nPortIndex, pAppPrivate, nSizeBytes);
-}
-
-static OMX_ERRORTYPE FreeBufferWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_U32 nPortIndex,
- OMX_IN OMX_BUFFERHEADERTYPE* pBuffer) {
- return getBase(hComponent)->freeBuffer(nPortIndex, pBuffer);
-}
-
-static OMX_ERRORTYPE EmptyThisBufferWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_BUFFERHEADERTYPE* pBuffer) {
- return getBase(hComponent)->emptyThisBuffer(pBuffer);
-}
-
-static OMX_ERRORTYPE FillThisBufferWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_BUFFERHEADERTYPE* pBuffer) {
- return getBase(hComponent)->fillThisBuffer(pBuffer);
-}
-
-static OMX_ERRORTYPE ComponentDeInitWrapper(
- OMX_IN OMX_HANDLETYPE hComponent) {
- delete getBase(hComponent);
- delete (OMX_COMPONENTTYPE *)hComponent;
-
- return OMX_ErrorNone;
-}
-
-static OMX_ERRORTYPE ComponentRoleEnumWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_OUT OMX_U8 *cRole,
- OMX_IN OMX_U32 nIndex) {
- return getBase(hComponent)->enumerateRoles(cRole, nIndex);
-}
-
-// static
-OMX_COMPONENTTYPE *OMXComponentBase::MakeComponent(OMXComponentBase *base) {
- OMX_COMPONENTTYPE *result = new OMX_COMPONENTTYPE;
-
- result->nSize = sizeof(OMX_COMPONENTTYPE);
- result->nVersion.s.nVersionMajor = 1;
- result->nVersion.s.nVersionMinor = 0;
- result->nVersion.s.nRevision = 0;
- result->nVersion.s.nStep = 0;
- result->pComponentPrivate = base;
- result->pApplicationPrivate = NULL;
-
- result->GetComponentVersion = NULL;
- result->SendCommand = SendCommandWrapper;
- result->GetParameter = GetParameterWrapper;
- result->SetParameter = SetParameterWrapper;
- result->GetConfig = GetConfigWrapper;
- result->SetConfig = SetConfigWrapper;
- result->GetExtensionIndex = GetExtensionIndexWrapper;
- result->GetState = GetStateWrapper;
- result->ComponentTunnelRequest = NULL;
- result->UseBuffer = UseBufferWrapper;
- result->AllocateBuffer = AllocateBufferWrapper;
- result->FreeBuffer = FreeBufferWrapper;
- result->EmptyThisBuffer = EmptyThisBufferWrapper;
- result->FillThisBuffer = FillThisBufferWrapper;
- result->SetCallbacks = NULL;
- result->ComponentDeInit = ComponentDeInitWrapper;
- result->UseEGLImage = NULL;
- result->ComponentRoleEnum = ComponentRoleEnumWrapper;
-
- base->setComponentHandle(result);
-
- return result;
-}
-
-} // namespace android
diff --git a/media/libstagefright/omx/OMXComponentBase.h b/media/libstagefright/omx/OMXComponentBase.h
deleted file mode 100644
index fd0df0b..0000000
--- a/media/libstagefright/omx/OMXComponentBase.h
+++ /dev/null
@@ -1,96 +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.
- */
-
-#ifndef OMX_COMPONENT_BASE_H_
-
-#define OMX_COMPONENT_BASE_H_
-
-#include <OMX_Component.h>
-
-namespace android {
-
-struct OMXComponentBase {
- OMXComponentBase(
- const OMX_CALLBACKTYPE *callbacks,
- OMX_PTR appData);
-
- virtual ~OMXComponentBase();
-
- virtual OMX_ERRORTYPE sendCommand(
- OMX_COMMANDTYPE cmd, OMX_U32 param, OMX_PTR cmdData) = 0;
-
- virtual OMX_ERRORTYPE getParameter(
- OMX_INDEXTYPE index, OMX_PTR params) = 0;
-
- virtual OMX_ERRORTYPE setParameter(
- OMX_INDEXTYPE index, const OMX_PTR params) = 0;
-
- virtual OMX_ERRORTYPE getConfig(
- OMX_INDEXTYPE index, OMX_PTR config) = 0;
-
- virtual OMX_ERRORTYPE setConfig(
- OMX_INDEXTYPE index, const OMX_PTR config) = 0;
-
- virtual OMX_ERRORTYPE getExtensionIndex(
- const OMX_STRING name, OMX_INDEXTYPE *index) = 0;
-
- virtual OMX_ERRORTYPE useBuffer(
- OMX_BUFFERHEADERTYPE **bufHdr,
- OMX_U32 portIndex,
- OMX_PTR appPrivate,
- OMX_U32 size,
- OMX_U8 *buffer) = 0;
-
- virtual OMX_ERRORTYPE allocateBuffer(
- OMX_BUFFERHEADERTYPE **bufHdr,
- OMX_U32 portIndex,
- OMX_PTR appPrivate,
- OMX_U32 size) = 0;
-
- virtual OMX_ERRORTYPE freeBuffer(
- OMX_U32 portIndex,
- OMX_BUFFERHEADERTYPE *buffer) = 0;
-
- virtual OMX_ERRORTYPE emptyThisBuffer(OMX_BUFFERHEADERTYPE *buffer) = 0;
- virtual OMX_ERRORTYPE fillThisBuffer(OMX_BUFFERHEADERTYPE *buffer) = 0;
-
- virtual OMX_ERRORTYPE enumerateRoles(OMX_U8 *role, OMX_U32 index) = 0;
-
- virtual OMX_ERRORTYPE getState(OMX_STATETYPE *state) = 0;
-
- // Wraps a given OMXComponentBase instance into an OMX_COMPONENTTYPE
- // as required by OpenMAX APIs.
- static OMX_COMPONENTTYPE *MakeComponent(OMXComponentBase *base);
-
-protected:
- void postEvent(OMX_EVENTTYPE event, OMX_U32 param1, OMX_U32 param2);
- void postFillBufferDone(OMX_BUFFERHEADERTYPE *bufHdr);
- void postEmptyBufferDone(OMX_BUFFERHEADERTYPE *bufHdr);
-
-private:
- void setComponentHandle(OMX_COMPONENTTYPE *handle);
-
- const OMX_CALLBACKTYPE *mCallbacks;
- OMX_PTR mAppData;
- OMX_COMPONENTTYPE *mComponentHandle;
-
- OMXComponentBase(const OMXComponentBase &);
- OMXComponentBase &operator=(const OMXComponentBase &);
-};
-
-} // namespace android
-
-#endif // OMX_COMPONENT_BASE_H_
diff --git a/media/libstagefright/omx/OMXMaster.h b/media/libstagefright/omx/OMXMaster.h
index feee1f9..6069741 100644
--- a/media/libstagefright/omx/OMXMaster.h
+++ b/media/libstagefright/omx/OMXMaster.h
@@ -18,7 +18,7 @@
#define OMX_MASTER_H_
-#include <media/stagefright/OMXPluginBase.h>
+#include <OMXPluginBase.h>
#include <utils/threads.h>
#include <utils/KeyedVector.h>
diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp
index 099c4f5..bff3def 100644
--- a/media/libstagefright/omx/OMXNodeInstance.cpp
+++ b/media/libstagefright/omx/OMXNodeInstance.cpp
@@ -24,8 +24,8 @@
#include <OMX_Component.h>
#include <binder/IMemory.h>
+#include <HardwareAPI.h>
#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/HardwareAPI.h>
#include <media/stagefright/MediaErrors.h>
namespace android {
diff --git a/media/libstagefright/omx/SoftOMXPlugin.h b/media/libstagefright/omx/SoftOMXPlugin.h
index f93c323..c89cd87 100644
--- a/media/libstagefright/omx/SoftOMXPlugin.h
+++ b/media/libstagefright/omx/SoftOMXPlugin.h
@@ -19,7 +19,7 @@
#define SOFT_OMX_PLUGIN_H_
#include <media/stagefright/foundation/ABase.h>
-#include <media/stagefright/OMXPluginBase.h>
+#include <OMXPluginBase.h>
namespace android {
diff --git a/media/libstagefright/omx/tests/Android.mk b/media/libstagefright/omx/tests/Android.mk
index 0c0a70c..07d47a8 100644
--- a/media/libstagefright/omx/tests/Android.mk
+++ b/media/libstagefright/omx/tests/Android.mk
@@ -10,7 +10,7 @@
LOCAL_C_INCLUDES := \
$(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
- $(TOP)/frameworks/base/include/media/stagefright/openmax
+ $(TOP)/frameworks/native/include/media/openmax
LOCAL_MODULE := omx_tests
diff --git a/media/libstagefright/rtsp/Android.mk b/media/libstagefright/rtsp/Android.mk
index 8230347..b3bc37c 100644
--- a/media/libstagefright/rtsp/Android.mk
+++ b/media/libstagefright/rtsp/Android.mk
@@ -19,9 +19,9 @@
LOCAL_C_INCLUDES:= \
$(JNI_H_INCLUDE) \
- $(TOP)/frameworks/base/include/media/stagefright/openmax \
- $(TOP)/frameworks/base/media/libstagefright/include \
- $(TOP)/external/openssl/include
+ $(TOP)/frameworks/base/media/libstagefright/include \
+ $(TOP)/frameworks/native/include/media/openmax \
+ $(TOP)/external/openssl/include
LOCAL_MODULE:= libstagefright_rtsp
@@ -47,7 +47,7 @@
LOCAL_C_INCLUDES:= \
$(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
- $(TOP)/frameworks/base/include/media/stagefright/openmax
+ $(TOP)/frameworks/native/include/media/openmax
LOCAL_CFLAGS += -Wno-multichar
diff --git a/media/libstagefright/tests/Android.mk b/media/libstagefright/tests/Android.mk
index 357feb1..656a630 100644
--- a/media/libstagefright/tests/Android.mk
+++ b/media/libstagefright/tests/Android.mk
@@ -38,7 +38,7 @@
external/stlport/stlport \
frameworks/base/media/libstagefright \
frameworks/base/media/libstagefright/include \
- $(TOP)/frameworks/base/include/media/stagefright/openmax \
+ $(TOP)/frameworks/native/include/media/openmax \
include $(BUILD_EXECUTABLE)
diff --git a/media/libstagefright/tests/SurfaceMediaSource_test.cpp b/media/libstagefright/tests/SurfaceMediaSource_test.cpp
index 3dcd9fc..fe77cf7 100644
--- a/media/libstagefright/tests/SurfaceMediaSource_test.cpp
+++ b/media/libstagefright/tests/SurfaceMediaSource_test.cpp
@@ -107,7 +107,7 @@
window.get(), NULL);
} else {
ALOGV("No actual display. Choosing EGLSurface based on SurfaceMediaSource");
- sp<SurfaceMediaSource> sms = new SurfaceMediaSource(
+ sp<ISurfaceTexture> sms = new SurfaceMediaSource(
getSurfaceWidth(), getSurfaceHeight());
sp<SurfaceTextureClient> stc = new SurfaceTextureClient(sms);
sp<ANativeWindow> window = stc;
@@ -360,7 +360,8 @@
android::ProcessState::self()->startThreadPool();
mSMS = new SurfaceMediaSource(mYuvTexWidth, mYuvTexHeight);
mSMS->setSynchronousMode(true);
- mSTC = new SurfaceTextureClient(mSMS);
+ // Manual cast is required to avoid constructor ambiguity
+ mSTC = new SurfaceTextureClient(static_cast<sp<ISurfaceTexture> >( mSMS));
mANW = mSTC;
}
@@ -395,7 +396,7 @@
ALOGV("SMS-GLTest::SetUp()");
android::ProcessState::self()->startThreadPool();
mSMS = new SurfaceMediaSource(mYuvTexWidth, mYuvTexHeight);
- mSTC = new SurfaceTextureClient(mSMS);
+ mSTC = new SurfaceTextureClient(static_cast<sp<ISurfaceTexture> >( mSMS));
mANW = mSTC;
// Doing the setup related to the GL Side
@@ -773,7 +774,7 @@
ALOGV("Verify creating a surface w/ right config + dummy writer*********");
mSMS = new SurfaceMediaSource(mYuvTexWidth, mYuvTexHeight);
- mSTC = new SurfaceTextureClient(mSMS);
+ mSTC = new SurfaceTextureClient(static_cast<sp<ISurfaceTexture> >( mSMS));
mANW = mSTC;
DummyRecorder writer(mSMS);
diff --git a/media/libstagefright/timedtext/TimedText3GPPSource.cpp b/media/libstagefright/timedtext/TimedText3GPPSource.cpp
index 4a3bfd3..c423ef0 100644
--- a/media/libstagefright/timedtext/TimedText3GPPSource.cpp
+++ b/media/libstagefright/timedtext/TimedText3GPPSource.cpp
@@ -110,4 +110,8 @@
return OK;
}
+sp<MetaData> TimedText3GPPSource::getFormat() {
+ return mSource->getFormat();
+}
+
} // namespace android
diff --git a/media/libstagefright/timedtext/TimedText3GPPSource.h b/media/libstagefright/timedtext/TimedText3GPPSource.h
index cb7e47c..4ec3d8a 100644
--- a/media/libstagefright/timedtext/TimedText3GPPSource.h
+++ b/media/libstagefright/timedtext/TimedText3GPPSource.h
@@ -28,26 +28,27 @@
class Parcel;
class TimedText3GPPSource : public TimedTextSource {
- public:
- TimedText3GPPSource(const sp<MediaSource>& mediaSource);
- virtual status_t start() { return mSource->start(); }
- virtual status_t stop() { return mSource->stop(); }
- virtual status_t read(
- int64_t *timeUs,
- Parcel *parcel,
- const MediaSource::ReadOptions *options = NULL);
- virtual status_t extractGlobalDescriptions(Parcel *parcel);
+public:
+ TimedText3GPPSource(const sp<MediaSource>& mediaSource);
+ virtual status_t start() { return mSource->start(); }
+ virtual status_t stop() { return mSource->stop(); }
+ virtual status_t read(
+ int64_t *timeUs,
+ Parcel *parcel,
+ const MediaSource::ReadOptions *options = NULL);
+ virtual status_t extractGlobalDescriptions(Parcel *parcel);
+ virtual sp<MetaData> getFormat();
- protected:
- virtual ~TimedText3GPPSource();
+protected:
+ virtual ~TimedText3GPPSource();
- private:
- sp<MediaSource> mSource;
+private:
+ sp<MediaSource> mSource;
- status_t extractAndAppendLocalDescriptions(
- int64_t timeUs, const MediaBuffer *textBuffer, Parcel *parcel);
+ status_t extractAndAppendLocalDescriptions(
+ int64_t timeUs, const MediaBuffer *textBuffer, Parcel *parcel);
- DISALLOW_EVIL_CONSTRUCTORS(TimedText3GPPSource);
+ DISALLOW_EVIL_CONSTRUCTORS(TimedText3GPPSource);
};
} // namespace android
diff --git a/media/libstagefright/timedtext/TimedTextDriver.cpp b/media/libstagefright/timedtext/TimedTextDriver.cpp
index c70870e..8ee15f8 100644
--- a/media/libstagefright/timedtext/TimedTextDriver.cpp
+++ b/media/libstagefright/timedtext/TimedTextDriver.cpp
@@ -20,10 +20,13 @@
#include <binder/IPCThreadState.h>
+#include <media/mediaplayer.h>
#include <media/MediaPlayerInterface.h>
+#include <media/stagefright/DataSource.h>
+#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/MediaErrors.h>
#include <media/stagefright/MediaSource.h>
-#include <media/stagefright/DataSource.h>
+#include <media/stagefright/MetaData.h>
#include <media/stagefright/Utils.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/ALooper.h>
@@ -47,24 +50,22 @@
}
TimedTextDriver::~TimedTextDriver() {
- mTextInBandVector.clear();
- mTextOutOfBandVector.clear();
+ mTextSourceVector.clear();
mLooper->stop();
}
-status_t TimedTextDriver::setTimedTextTrackIndex_l(int32_t index) {
- if (index >=
- (int)(mTextInBandVector.size() + mTextOutOfBandVector.size())) {
+status_t TimedTextDriver::selectTrack_l(int32_t index) {
+ if (index >= (int)(mTextSourceVector.size())) {
return BAD_VALUE;
}
sp<TimedTextSource> source;
- if (index < mTextInBandVector.size()) {
- source = mTextInBandVector.itemAt(index);
- } else {
- source = mTextOutOfBandVector.itemAt(index - mTextInBandVector.size());
- }
+ source = mTextSourceVector.itemAt(index);
mPlayer->setDataSource(source);
+ if (mState == UNINITIALIZED) {
+ mState = PAUSED;
+ }
+ mCurrentTrackIndex = index;
return OK;
}
@@ -73,13 +74,10 @@
switch (mState) {
case UNINITIALIZED:
return INVALID_OPERATION;
- case STOPPED:
- mPlayer->start();
- break;
case PLAYING:
return OK;
case PAUSED:
- mPlayer->resume();
+ mPlayer->start();
break;
default:
TRESPASS();
@@ -88,10 +86,6 @@
return OK;
}
-status_t TimedTextDriver::stop() {
- return pause();
-}
-
// TODO: Test if pause() works properly.
// Scenario 1: start - pause - resume
// Scenario 2: start - seek
@@ -101,8 +95,6 @@
switch (mState) {
case UNINITIALIZED:
return INVALID_OPERATION;
- case STOPPED:
- return OK;
case PLAYING:
mPlayer->pause();
break;
@@ -115,45 +107,17 @@
return OK;
}
-status_t TimedTextDriver::resume() {
- return start();
-}
-
-status_t TimedTextDriver::seekToAsync(int64_t timeUs) {
- mPlayer->seekToAsync(timeUs);
- return OK;
-}
-
-status_t TimedTextDriver::setTimedTextTrackIndex(int32_t index) {
- // TODO: This is current implementation for MediaPlayer::disableTimedText().
- // Find better way for readability.
- if (index < 0) {
- mPlayer->pause();
- return OK;
- }
-
+status_t TimedTextDriver::selectTrack(int32_t index) {
status_t ret = OK;
Mutex::Autolock autoLock(mLock);
switch (mState) {
case UNINITIALIZED:
- ret = INVALID_OPERATION;
- break;
case PAUSED:
- ret = setTimedTextTrackIndex_l(index);
+ ret = selectTrack_l(index);
break;
case PLAYING:
mPlayer->pause();
- ret = setTimedTextTrackIndex_l(index);
- if (ret != OK) {
- break;
- }
- mPlayer->start();
- break;
- case STOPPED:
- // TODO: The only difference between STOPPED and PAUSED is this
- // part. Revise the flow from "MediaPlayer::enableTimedText()" and
- // remove one of the status, PAUSED and STOPPED, if possible.
- ret = setTimedTextTrackIndex_l(index);
+ ret = selectTrack_l(index);
if (ret != OK) {
break;
}
@@ -165,6 +129,24 @@
return ret;
}
+status_t TimedTextDriver::unselectTrack(int32_t index) {
+ if (mCurrentTrackIndex != index) {
+ return INVALID_OPERATION;
+ }
+ status_t err = pause();
+ if (err != OK) {
+ return err;
+ }
+ Mutex::Autolock autoLock(mLock);
+ mState = UNINITIALIZED;
+ return OK;
+}
+
+status_t TimedTextDriver::seekToAsync(int64_t timeUs) {
+ mPlayer->seekToAsync(timeUs);
+ return OK;
+}
+
status_t TimedTextDriver::addInBandTextSource(
const sp<MediaSource>& mediaSource) {
sp<TimedTextSource> source =
@@ -173,25 +155,17 @@
return ERROR_UNSUPPORTED;
}
Mutex::Autolock autoLock(mLock);
- mTextInBandVector.add(source);
- if (mState == UNINITIALIZED) {
- mState = STOPPED;
- }
+ mTextSourceVector.add(source);
return OK;
}
status_t TimedTextDriver::addOutOfBandTextSource(
- const Parcel &request) {
+ const char *uri, const char *mimeType) {
// TODO: Define "TimedTextSource::CreateFromURI(uri)"
// and move below lines there..?
- // String values written in Parcel are UTF-16 values.
- const String16 uri16 = request.readString16();
- String8 uri = String8(request.readString16());
-
- uri.toLower();
// To support local subtitle file only for now
- if (strncasecmp("file://", uri.string(), 7)) {
+ if (strncasecmp("file://", uri, 7)) {
return ERROR_UNSUPPORTED;
}
sp<DataSource> dataSource =
@@ -201,7 +175,7 @@
}
sp<TimedTextSource> source;
- if (uri.getPathExtension() == String8(".srt")) {
+ if (strcasecmp(mimeType, MEDIA_MIMETYPE_TEXT_SUBRIP) == 0) {
source = TimedTextSource::CreateTimedTextSource(
dataSource, TimedTextSource::OUT_OF_BAND_FILE_SRT);
}
@@ -211,12 +185,38 @@
}
Mutex::Autolock autoLock(mLock);
-
- mTextOutOfBandVector.add(source);
- if (mState == UNINITIALIZED) {
- mState = STOPPED;
- }
+ mTextSourceVector.add(source);
return OK;
}
+status_t TimedTextDriver::addOutOfBandTextSource(
+ int fd, off64_t offset, size_t length, const char *mimeType) {
+ // Not supported yet. This requires DataSource::sniff to detect various text
+ // formats such as srt/smi/ttml.
+ return ERROR_UNSUPPORTED;
+}
+
+void TimedTextDriver::getTrackInfo(Parcel *parcel) {
+ Mutex::Autolock autoLock(mLock);
+ Vector<sp<TimedTextSource> >::const_iterator iter;
+ parcel->writeInt32(mTextSourceVector.size());
+ for (iter = mTextSourceVector.begin();
+ iter != mTextSourceVector.end(); ++iter) {
+ sp<MetaData> meta = (*iter)->getFormat();
+ if (meta != NULL) {
+ // There are two fields.
+ parcel->writeInt32(2);
+
+ // track type.
+ parcel->writeInt32(MEDIA_TRACK_TYPE_TIMEDTEXT);
+
+ const char *lang = "und";
+ meta->findCString(kKeyMediaLanguage, &lang);
+ parcel->writeString16(String16(lang));
+ } else {
+ parcel->writeInt32(0);
+ }
+ }
+}
+
} // namespace android
diff --git a/media/libstagefright/timedtext/TimedTextPlayer.cpp b/media/libstagefright/timedtext/TimedTextPlayer.cpp
index bda7b46..8717914 100644
--- a/media/libstagefright/timedtext/TimedTextPlayer.cpp
+++ b/media/libstagefright/timedtext/TimedTextPlayer.cpp
@@ -56,10 +56,6 @@
(new AMessage(kWhatPause, id()))->post();
}
-void TimedTextPlayer::resume() {
- start();
-}
-
void TimedTextPlayer::seekToAsync(int64_t timeUs) {
sp<AMessage> msg = new AMessage(kWhatSeek, id());
msg->setInt64("seekTimeUs", timeUs);
@@ -104,9 +100,9 @@
if (obj != NULL) {
sp<ParcelEvent> parcelEvent;
parcelEvent = static_cast<ParcelEvent*>(obj.get());
- notifyListener(MEDIA_TIMED_TEXT, &(parcelEvent->parcel));
+ notifyListener(&(parcelEvent->parcel));
} else {
- notifyListener(MEDIA_TIMED_TEXT);
+ notifyListener();
}
doRead();
break;
@@ -119,14 +115,18 @@
mSource->stop();
}
mSource = static_cast<TimedTextSource*>(obj.get());
- mSource->start();
- Parcel parcel;
- if (mSource->extractGlobalDescriptions(&parcel) == OK &&
- parcel.dataSize() > 0) {
- notifyListener(MEDIA_TIMED_TEXT, &parcel);
- } else {
- notifyListener(MEDIA_TIMED_TEXT);
+ status_t err = mSource->start();
+ if (err != OK) {
+ notifyError(err);
+ break;
}
+ Parcel parcel;
+ err = mSource->extractGlobalDescriptions(&parcel);
+ if (err != OK) {
+ notifyError(err);
+ break;
+ }
+ notifyListener(&parcel);
break;
}
}
@@ -141,8 +141,12 @@
void TimedTextPlayer::doRead(MediaSource::ReadOptions* options) {
int64_t timeUs = 0;
sp<ParcelEvent> parcelEvent = new ParcelEvent();
- mSource->read(&timeUs, &(parcelEvent->parcel), options);
- postTextEvent(parcelEvent, timeUs);
+ status_t err = mSource->read(&timeUs, &(parcelEvent->parcel), options);
+ if (err != OK) {
+ notifyError(err);
+ } else {
+ postTextEvent(parcelEvent, timeUs);
+ }
}
void TimedTextPlayer::postTextEvent(const sp<ParcelEvent>& parcel, int64_t timeUs) {
@@ -151,7 +155,7 @@
int64_t positionUs, delayUs;
int32_t positionMs = 0;
listener->getCurrentPosition(&positionMs);
- positionUs = positionMs * 1000;
+ positionUs = positionMs * 1000ll;
if (timeUs <= positionUs + kAdjustmentProcessingTimeUs) {
delayUs = 0;
@@ -167,13 +171,20 @@
}
}
-void TimedTextPlayer::notifyListener(int msg, const Parcel *parcel) {
+void TimedTextPlayer::notifyError(int error) {
+ sp<MediaPlayerBase> listener = mListener.promote();
+ if (listener != NULL) {
+ listener->sendEvent(MEDIA_INFO, MEDIA_INFO_TIMED_TEXT_ERROR, error);
+ }
+}
+
+void TimedTextPlayer::notifyListener(const Parcel *parcel) {
sp<MediaPlayerBase> listener = mListener.promote();
if (listener != NULL) {
if (parcel != NULL && (parcel->dataSize() > 0)) {
- listener->sendEvent(msg, 0, 0, parcel);
+ listener->sendEvent(MEDIA_TIMED_TEXT, 0, 0, parcel);
} else { // send an empty timed text to clear the screen
- listener->sendEvent(msg);
+ listener->sendEvent(MEDIA_TIMED_TEXT);
}
}
}
diff --git a/media/libstagefright/timedtext/TimedTextPlayer.h b/media/libstagefright/timedtext/TimedTextPlayer.h
index 837beeb..b869f18 100644
--- a/media/libstagefright/timedtext/TimedTextPlayer.h
+++ b/media/libstagefright/timedtext/TimedTextPlayer.h
@@ -40,7 +40,6 @@
void start();
void pause();
- void resume();
void seekToAsync(int64_t timeUs);
void setDataSource(sp<TimedTextSource> source);
@@ -68,7 +67,8 @@
void doRead(MediaSource::ReadOptions* options = NULL);
void onTextEvent();
void postTextEvent(const sp<ParcelEvent>& parcel = NULL, int64_t timeUs = -1);
- void notifyListener(int msg, const Parcel *parcel = NULL);
+ void notifyError(int error = 0);
+ void notifyListener(const Parcel *parcel = NULL);
DISALLOW_EVIL_CONSTRUCTORS(TimedTextPlayer);
};
diff --git a/media/libstagefright/timedtext/TimedTextSRTSource.cpp b/media/libstagefright/timedtext/TimedTextSRTSource.cpp
index 3752d34..c44a99b 100644
--- a/media/libstagefright/timedtext/TimedTextSRTSource.cpp
+++ b/media/libstagefright/timedtext/TimedTextSRTSource.cpp
@@ -21,8 +21,10 @@
#include <binder/Parcel.h>
#include <media/stagefright/foundation/AString.h>
#include <media/stagefright/DataSource.h>
+#include <media/stagefright/MediaDefs.h> // for MEDIA_MIMETYPE_xxx
#include <media/stagefright/MediaErrors.h>
#include <media/stagefright/MediaSource.h>
+#include <media/stagefright/MetaData.h>
#include "TimedTextSRTSource.h"
#include "TextDescriptions.h"
@@ -31,6 +33,7 @@
TimedTextSRTSource::TimedTextSRTSource(const sp<DataSource>& dataSource)
: mSource(dataSource),
+ mMetaData(new MetaData),
mIndex(0) {
}
@@ -42,10 +45,14 @@
if (err != OK) {
reset();
}
+ // TODO: Need to detect the language, because SRT doesn't give language
+ // information explicitly.
+ mMetaData->setCString(kKeyMediaLanguage, "");
return err;
}
void TimedTextSRTSource::reset() {
+ mMetaData->clear();
mTextVector.clear();
mIndex = 0;
}
@@ -272,4 +279,8 @@
return OK;
}
+sp<MetaData> TimedTextSRTSource::getFormat() {
+ return mMetaData;
+}
+
} // namespace android
diff --git a/media/libstagefright/timedtext/TimedTextSRTSource.h b/media/libstagefright/timedtext/TimedTextSRTSource.h
index a0734d9..62710a0 100644
--- a/media/libstagefright/timedtext/TimedTextSRTSource.h
+++ b/media/libstagefright/timedtext/TimedTextSRTSource.h
@@ -31,43 +31,45 @@
class Parcel;
class TimedTextSRTSource : public TimedTextSource {
- public:
- TimedTextSRTSource(const sp<DataSource>& dataSource);
- virtual status_t start();
- virtual status_t stop();
- virtual status_t read(
- int64_t *timeUs,
- Parcel *parcel,
- const MediaSource::ReadOptions *options = NULL);
+public:
+ TimedTextSRTSource(const sp<DataSource>& dataSource);
+ virtual status_t start();
+ virtual status_t stop();
+ virtual status_t read(
+ int64_t *timeUs,
+ Parcel *parcel,
+ const MediaSource::ReadOptions *options = NULL);
+ virtual sp<MetaData> getFormat();
- protected:
- virtual ~TimedTextSRTSource();
+protected:
+ virtual ~TimedTextSRTSource();
- private:
- sp<DataSource> mSource;
+private:
+ sp<DataSource> mSource;
+ sp<MetaData> mMetaData;
- struct TextInfo {
- int64_t endTimeUs;
- // The offset of the text in the original file.
- off64_t offset;
- int textLen;
- };
+ struct TextInfo {
+ int64_t endTimeUs;
+ // The offset of the text in the original file.
+ off64_t offset;
+ int textLen;
+ };
- int mIndex;
- KeyedVector<int64_t, TextInfo> mTextVector;
+ int mIndex;
+ KeyedVector<int64_t, TextInfo> mTextVector;
- void reset();
- status_t scanFile();
- status_t getNextSubtitleInfo(
- off64_t *offset, int64_t *startTimeUs, TextInfo *info);
- status_t readNextLine(off64_t *offset, AString *data);
- status_t getText(
- const MediaSource::ReadOptions *options,
- AString *text, int64_t *startTimeUs, int64_t *endTimeUs);
- status_t extractAndAppendLocalDescriptions(
- int64_t timeUs, const AString &text, Parcel *parcel);
+ void reset();
+ status_t scanFile();
+ status_t getNextSubtitleInfo(
+ off64_t *offset, int64_t *startTimeUs, TextInfo *info);
+ status_t readNextLine(off64_t *offset, AString *data);
+ status_t getText(
+ const MediaSource::ReadOptions *options,
+ AString *text, int64_t *startTimeUs, int64_t *endTimeUs);
+ status_t extractAndAppendLocalDescriptions(
+ int64_t timeUs, const AString &text, Parcel *parcel);
- DISALLOW_EVIL_CONSTRUCTORS(TimedTextSRTSource);
+ DISALLOW_EVIL_CONSTRUCTORS(TimedTextSRTSource);
};
} // namespace android
diff --git a/media/libstagefright/timedtext/TimedTextSource.cpp b/media/libstagefright/timedtext/TimedTextSource.cpp
index ffbe1c3..953f7b5 100644
--- a/media/libstagefright/timedtext/TimedTextSource.cpp
+++ b/media/libstagefright/timedtext/TimedTextSource.cpp
@@ -59,4 +59,8 @@
return NULL;
}
+sp<MetaData> TimedTextSource::getFormat() {
+ return NULL;
+}
+
} // namespace android
diff --git a/media/libstagefright/timedtext/TimedTextSource.h b/media/libstagefright/timedtext/TimedTextSource.h
index 06bae71..9349342 100644
--- a/media/libstagefright/timedtext/TimedTextSource.h
+++ b/media/libstagefright/timedtext/TimedTextSource.h
@@ -25,6 +25,7 @@
namespace android {
class DataSource;
+class MetaData;
class Parcel;
class TimedTextSource : public RefBase {
@@ -48,6 +49,7 @@
virtual status_t extractGlobalDescriptions(Parcel *parcel) {
return INVALID_OPERATION;
}
+ virtual sp<MetaData> getFormat();
protected:
virtual ~TimedTextSource() { }
diff --git a/media/mediaserver/Android.mk b/media/mediaserver/Android.mk
index 0559812..4e9b4cf 100644
--- a/media/mediaserver/Android.mk
+++ b/media/mediaserver/Android.mk
@@ -11,12 +11,12 @@
libutils \
libbinder
-base := $(LOCAL_PATH)/../..
-
+# FIXME The duplicate audioflinger is temporary
LOCAL_C_INCLUDES := \
- $(base)/services/audioflinger \
- $(base)/services/camera/libcameraservice \
- $(base)/media/libmediaplayerservice
+ frameworks/native/services/audioflinger \
+ frameworks/base/services/audioflinger \
+ frameworks/base/services/camera/libcameraservice \
+ frameworks/base/media/libmediaplayerservice
LOCAL_MODULE:= mediaserver
diff --git a/media/mediaserver/main_mediaserver.cpp b/media/mediaserver/main_mediaserver.cpp
index 1520c01..6b1abb1 100644
--- a/media/mediaserver/main_mediaserver.cpp
+++ b/media/mediaserver/main_mediaserver.cpp
@@ -16,16 +16,18 @@
*/
#define LOG_TAG "mediaserver"
+//#define LOG_NDEBUG 0
#include <binder/IPCThreadState.h>
#include <binder/ProcessState.h>
#include <binder/IServiceManager.h>
#include <utils/Log.h>
-#include <AudioFlinger.h>
-#include <CameraService.h>
-#include <MediaPlayerService.h>
-#include <AudioPolicyService.h>
+// from LOCAL_C_INCLUDES
+#include "AudioFlinger.h"
+#include "CameraService.h"
+#include "MediaPlayerService.h"
+#include "AudioPolicyService.h"
using namespace android;
diff --git a/media/tests/omxjpegdecoder/Android.mk b/media/tests/omxjpegdecoder/Android.mk
index 025a131..3e09a5f 100644
--- a/media/tests/omxjpegdecoder/Android.mk
+++ b/media/tests/omxjpegdecoder/Android.mk
@@ -40,9 +40,9 @@
$(TOP)/external/skia/include/utils \
$(TOP)/external/skia/include/effects \
$(TOP)/frameworks/base/media/libstagefright \
- $(TOP)/frameworks/base/include/media/stagefright/openmax \
$(TOP)/frameworks/base/include/ \
- $(TOP)/frameworks/base/
+ $(TOP)/frameworks/base/ \
+ $(TOP)/frameworks/native/include/media/openmax
LOCAL_MODULE := jpeg_bench
diff --git a/packages/SystemUI/res/values-in/strings.xml b/packages/SystemUI/res/values-in/strings.xml
index 93d8675..2acf554 100644
--- a/packages/SystemUI/res/values-in/strings.xml
+++ b/packages/SystemUI/res/values-in/strings.xml
@@ -56,8 +56,8 @@
<string name="usb_accessory_uri_prompt" msgid="513450621413733343">"Tidak ada apl terpasang yang bekerja dengan aksesori USB ini. Pelajari lebih lanjut tentang aksesori ini di <xliff:g id="URL">%1$s</xliff:g>"</string>
<string name="title_usb_accessory" msgid="4966265263465181372">"Aksesori USB"</string>
<string name="label_view" msgid="6304565553218192990">"Lihat"</string>
- <string name="always_use_device" msgid="1450287437017315906">"Gunakan secara bawaan untuk perangkat USB ini"</string>
- <string name="always_use_accessory" msgid="1210954576979621596">"Gunakan secara bawaan untuk aksesori USB ini"</string>
+ <string name="always_use_device" msgid="1450287437017315906">"Gunakan secara default untuk perangkat USB ini"</string>
+ <string name="always_use_accessory" msgid="1210954576979621596">"Gunakan secara default untuk aksesori USB ini"</string>
<string name="compat_mode_on" msgid="6623839244840638213">"Perbesar utk mengisi layar"</string>
<string name="compat_mode_off" msgid="4434467572461327898">"Rentangkn utk mngisi layar"</string>
<string name="compat_mode_help_header" msgid="7969493989397529910">"Perbesar/perkecil untuk kompatibilitas"</string>
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java b/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java
index 92f4ca9..f5894ea 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java
@@ -242,7 +242,7 @@
// We load in two stages: first, we update progress with just the first screenful
// of items. Then, we update with the rest of the items
final int origPri = Process.getThreadPriority(Process.myTid());
- Process.setThreadPriority(Process.THREAD_GROUP_BG_NONINTERACTIVE);
+ Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
final PackageManager pm = mContext.getPackageManager();
final ActivityManager am = (ActivityManager)
mContext.getSystemService(Context.ACTIVITY_SERVICE);
@@ -326,7 +326,7 @@
@Override
protected Void doInBackground(Void... params) {
final int origPri = Process.getThreadPriority(Process.myTid());
- Process.setThreadPriority(Process.THREAD_GROUP_BG_NONINTERACTIVE);
+ Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
while (true) {
if (isCancelled()) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java
index b794826..72fdfad 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java
@@ -31,9 +31,7 @@
public class BrightnessController implements ToggleSlider.Listener {
private static final String TAG = "StatusBar.BrightnessController";
- // Backlight range is from 0 - 255. Need to make sure that user
- // doesn't set the backlight to 0 and get stuck
- private static final int MINIMUM_BACKLIGHT = android.os.Power.BRIGHTNESS_DIM + 10;
+ private static final int MINIMUM_BACKLIGHT = android.os.Power.BRIGHTNESS_DIM;
private static final int MAXIMUM_BACKLIGHT = android.os.Power.BRIGHTNESS_ON;
private Context mContext;
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
index 9f3de69..25af2e6 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
@@ -22,6 +22,7 @@
import com.android.internal.widget.DigitalClock;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.TransportControlView;
+import com.android.internal.policy.impl.KeyguardUpdateMonitor.InfoCallbackImpl;
import com.android.internal.policy.impl.KeyguardUpdateMonitor.SimStateCallback;
import java.util.ArrayList;
@@ -625,9 +626,9 @@
}
}
- private KeyguardUpdateMonitor.InfoCallback mInfoCallback
- = new KeyguardUpdateMonitor.InfoCallback() {
+ private InfoCallbackImpl mInfoCallback = new InfoCallbackImpl() {
+ @Override
public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn,
int batteryLevel) {
mShowingBatteryInfo = showBatteryInfo;
@@ -637,33 +638,24 @@
update(BATTERY_INFO, getAltTextMessage(tmpIcon));
}
+ @Override
public void onTimeChanged() {
refreshDate();
}
+ @Override
public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) {
mPlmn = plmn;
mSpn = spn;
updateCarrierStateWithSimStatus(mSimState);
}
- public void onRingerModeChanged(int state) {
-
- }
-
+ @Override
public void onPhoneStateChanged(int phoneState) {
mPhoneState = phoneState;
updateEmergencyCallButtonState(phoneState);
}
- /** {@inheritDoc} */
- public void onClockVisibilityChanged() {
- // ignored
- }
-
- public void onDeviceProvisioned() {
- // ignored
- }
};
private SimStateCallback mSimStateCallback = new SimStateCallback() {
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
index 91ab053..804cd9e 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
@@ -16,6 +16,7 @@
package com.android.internal.policy.impl;
+import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -103,6 +104,7 @@
private static final int MSG_PHONE_STATE_CHANGED = 306;
private static final int MSG_CLOCK_VISIBILITY_CHANGED = 307;
private static final int MSG_DEVICE_PROVISIONED = 308;
+ protected static final int MSG_DPM_STATE_CHANGED = 309;
/**
* When we receive a
@@ -204,6 +206,9 @@
case MSG_DEVICE_PROVISIONED:
handleDeviceProvisioned();
break;
+ case MSG_DPM_STATE_CHANGED:
+ handleDevicePolicyManagerStateChanged();
+ break;
}
}
};
@@ -262,6 +267,7 @@
filter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
filter.addAction(SPN_STRINGS_UPDATED_ACTION);
filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
+ filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
context.registerReceiver(new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
@@ -293,11 +299,20 @@
} else if (TelephonyManager.ACTION_PHONE_STATE_CHANGED.equals(action)) {
String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
mHandler.sendMessage(mHandler.obtainMessage(MSG_PHONE_STATE_CHANGED, state));
+ } else if (DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED
+ .equals(action)) {
+ mHandler.sendMessage(mHandler.obtainMessage(MSG_DPM_STATE_CHANGED));
}
}
}, filter);
}
+ protected void handleDevicePolicyManagerStateChanged() {
+ for (int i = 0; i < mInfoCallbacks.size(); i++) {
+ mInfoCallbacks.get(i).onDevicePolicyManagerStateChanged();
+ }
+ }
+
protected void handleDeviceProvisioned() {
for (int i = 0; i < mInfoCallbacks.size(); i++) {
mInfoCallbacks.get(i).onDeviceProvisioned();
@@ -521,6 +536,40 @@
* Called when the device becomes provisioned
*/
void onDeviceProvisioned();
+
+ /**
+ * Called when the device policy changes.
+ * See {@link DevicePolicyManager#ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED}
+ */
+ void onDevicePolicyManagerStateChanged();
+ }
+
+ // Simple class that allows methods to easily be overwritten
+ public static class InfoCallbackImpl implements InfoCallback {
+ public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn,
+ int batteryLevel) {
+ }
+
+ public void onTimeChanged() {
+ }
+
+ public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) {
+ }
+
+ public void onRingerModeChanged(int state) {
+ }
+
+ public void onPhoneStateChanged(int phoneState) {
+ }
+
+ public void onClockVisibilityChanged() {
+ }
+
+ public void onDeviceProvisioned() {
+ }
+
+ public void onDevicePolicyManagerStateChanged() {
+ }
}
/**
@@ -653,4 +702,10 @@
public boolean getMaxFaceUnlockAttemptsReached() {
return mFailedFaceUnlockAttempts >= FAILED_FACE_UNLOCK_ATTEMPTS_BEFORE_BACKUP;
}
+
+ public boolean isSimLocked() {
+ return mSimState == IccCard.State.PIN_REQUIRED
+ || mSimState == IccCard.State.PUK_REQUIRED
+ || mSimState == IccCard.State.PERM_DISABLED;
+ }
}
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
index 52d6d24..377ea66 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -18,6 +18,7 @@
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
+import com.android.internal.policy.impl.KeyguardUpdateMonitor.InfoCallbackImpl;
import com.android.internal.telephony.IccCard;
import com.android.internal.widget.LockPatternUtils;
@@ -90,7 +91,7 @@
* thread of the keyguard.
*/
public class KeyguardViewMediator implements KeyguardViewCallback,
- KeyguardUpdateMonitor.InfoCallback, KeyguardUpdateMonitor.SimStateCallback {
+ KeyguardUpdateMonitor.SimStateCallback {
private static final int KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT = 30000;
private final static boolean DEBUG = false;
private final static boolean DBG_WAKE = false;
@@ -265,6 +266,20 @@
private int mLockSoundStreamId;
private int mMasterStreamMaxVolume;
+ InfoCallbackImpl mInfoCallback = new InfoCallbackImpl() {
+
+ @Override
+ public void onClockVisibilityChanged() {
+ adjustStatusBarLocked();
+ }
+
+ @Override
+ public void onDeviceProvisioned() {
+ mContext.sendBroadcast(mUserPresentIntent);
+ }
+
+ };
+
public KeyguardViewMediator(Context context, PhoneWindowManager callback,
LocalPowerManager powerManager) {
mContext = context;
@@ -293,7 +308,8 @@
mUpdateMonitor = new KeyguardUpdateMonitor(context);
- mUpdateMonitor.registerInfoCallback(this);
+ mUpdateMonitor.registerInfoCallback(mInfoCallback);
+
mUpdateMonitor.registerSimStateCallback(this);
mLockPatternUtils = new LockPatternUtils(mContext);
@@ -750,8 +766,8 @@
case PUK_REQUIRED:
synchronized (this) {
if (!isShowing()) {
- if (DEBUG) Log.d(TAG, "INTENT_VALUE_ICC_LOCKED and keygaurd isn't showing, we need "
- + "to show the keyguard so the user can enter their sim pin");
+ if (DEBUG) Log.d(TAG, "INTENT_VALUE_ICC_LOCKED and keygaurd isn't showing, "
+ + "we need to show keyguard so user can enter their sim pin");
doKeyguardLocked();
} else {
resetStateLocked();
@@ -1306,38 +1322,4 @@
}
}
- /** {@inheritDoc} */
- public void onClockVisibilityChanged() {
- adjustStatusBarLocked();
- }
-
- /** {@inheritDoc} */
- public void onPhoneStateChanged(int phoneState) {
- // ignored
- }
-
- /** {@inheritDoc} */
- public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn, int batteryLevel) {
- // ignored
- }
-
- /** {@inheritDoc} */
- public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) {
- // ignored
- }
-
- /** {@inheritDoc} */
- public void onRingerModeChanged(int state) {
- // ignored
- }
-
- /** {@inheritDoc} */
- public void onTimeChanged() {
- // ignored
- }
-
- /** {@inheritDoc} */
- public void onDeviceProvisioned() {
- mContext.sendBroadcast(mUserPresentIntent);
- }
}
diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
index 3ca57c6..2e7769b 100644
--- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
+++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
@@ -17,6 +17,8 @@
package com.android.internal.policy.impl;
import com.android.internal.R;
+import com.android.internal.policy.impl.KeyguardUpdateMonitor.InfoCallback;
+import com.android.internal.policy.impl.KeyguardUpdateMonitor.InfoCallbackImpl;
import com.android.internal.policy.impl.LockPatternKeyguardView.UnlockMode;
import com.android.internal.policy.IFaceLockCallback;
import com.android.internal.policy.IFaceLockInterface;
@@ -80,8 +82,7 @@
* {@link com.android.internal.policy.impl.KeyguardViewManager}
* via its {@link com.android.internal.policy.impl.KeyguardViewCallback}, as appropriate.
*/
-public class LockPatternKeyguardView extends KeyguardViewBase implements Handler.Callback,
- KeyguardUpdateMonitor.InfoCallback {
+public class LockPatternKeyguardView extends KeyguardViewBase implements Handler.Callback {
private static final int TRANSPORT_USERACTIVITY_TIMEOUT = 10000;
@@ -133,12 +134,6 @@
// So the user has a consistent amount of time when brought to the backup method from FaceLock
private final int BACKUP_LOCK_TIMEOUT = 5000;
- /**
- * The current {@link KeyguardScreen} will use this to communicate back to us.
- */
- KeyguardScreenCallback mKeyguardScreenCallback;
-
-
private boolean mRequiresSim;
//True if we have some sort of overlay on top of the Lockscreen
//Also true if we've activated a phone call, either emergency dialing or incoming
@@ -150,6 +145,10 @@
//True if this device is currently plugged in
private boolean mPluggedIn;
+ // The music control widget
+ private TransportControlView mTransportControlView;
+
+ private Parcelable mSavedState;
/**
* Either a lock screen (an informational keyguard screen), or an unlock
@@ -216,7 +215,6 @@
*/
private boolean mIsVerifyUnlockOnly = false;
-
/**
* Used to lookup the state of the lock pattern
*/
@@ -274,10 +272,6 @@
}
};
- private TransportControlView mTransportControlView;
-
- private Parcelable mSavedState;
-
/**
* @return Whether we are stuck on the lock screen because the sim is
* missing.
@@ -290,6 +284,160 @@
}
/**
+ * The current {@link KeyguardScreen} will use this to communicate back to us.
+ */
+ KeyguardScreenCallback mKeyguardScreenCallback = new KeyguardScreenCallback() {
+
+ public void goToLockScreen() {
+ mForgotPattern = false;
+ if (mIsVerifyUnlockOnly) {
+ // navigating away from unlock screen during verify mode means
+ // we are done and the user failed to authenticate.
+ mIsVerifyUnlockOnly = false;
+ getCallback().keyguardDone(false);
+ } else {
+ updateScreen(Mode.LockScreen, false);
+ }
+ }
+
+ public void goToUnlockScreen() {
+ final IccCard.State simState = mUpdateMonitor.getSimState();
+ if (stuckOnLockScreenBecauseSimMissing()
+ || (simState == IccCard.State.PUK_REQUIRED
+ && !mLockPatternUtils.isPukUnlockScreenEnable())){
+ // stuck on lock screen when sim missing or
+ // puk'd but puk unlock screen is disabled
+ return;
+ }
+ if (!isSecure()) {
+ getCallback().keyguardDone(true);
+ } else {
+ updateScreen(Mode.UnlockScreen, false);
+ }
+ }
+
+ public void forgotPattern(boolean isForgotten) {
+ if (mEnableFallback) {
+ mForgotPattern = isForgotten;
+ updateScreen(Mode.UnlockScreen, false);
+ }
+ }
+
+ public boolean isSecure() {
+ return LockPatternKeyguardView.this.isSecure();
+ }
+
+ public boolean isVerifyUnlockOnly() {
+ return mIsVerifyUnlockOnly;
+ }
+
+ public void recreateMe(Configuration config) {
+ removeCallbacks(mRecreateRunnable);
+ post(mRecreateRunnable);
+ }
+
+ public void takeEmergencyCallAction() {
+ mHasOverlay = true;
+
+ // Continue showing FaceLock area until dialer comes up or call is resumed
+ if (usingFaceLock() && mFaceLockServiceRunning) {
+ showFaceLockAreaWithTimeout(FACELOCK_VIEW_AREA_EMERGENCY_DIALER_TIMEOUT);
+ }
+
+ // FaceLock must be stopped if it is running when emergency call is pressed
+ stopAndUnbindFromFaceLock();
+
+ pokeWakelock(EMERGENCY_CALL_TIMEOUT);
+ if (TelephonyManager.getDefault().getCallState()
+ == TelephonyManager.CALL_STATE_OFFHOOK) {
+ mLockPatternUtils.resumeCall();
+ } else {
+ Intent intent = new Intent(ACTION_EMERGENCY_DIAL);
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+ | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+ getContext().startActivity(intent);
+ }
+ }
+
+ public void pokeWakelock() {
+ getCallback().pokeWakelock();
+ }
+
+ public void pokeWakelock(int millis) {
+ getCallback().pokeWakelock(millis);
+ }
+
+ public void keyguardDone(boolean authenticated) {
+ getCallback().keyguardDone(authenticated);
+ mSavedState = null; // clear state so we re-establish when locked again
+ }
+
+ public void keyguardDoneDrawing() {
+ // irrelevant to keyguard screen, they shouldn't be calling this
+ }
+
+ public void reportFailedUnlockAttempt() {
+ mUpdateMonitor.reportFailedAttempt();
+ final int failedAttempts = mUpdateMonitor.getFailedAttempts();
+ if (DEBUG) Log.d(TAG, "reportFailedPatternAttempt: #" + failedAttempts +
+ " (enableFallback=" + mEnableFallback + ")");
+
+ final boolean usingPattern = mLockPatternUtils.getKeyguardStoredPasswordQuality()
+ == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
+
+ final int failedAttemptsBeforeWipe = mLockPatternUtils.getDevicePolicyManager()
+ .getMaximumFailedPasswordsForWipe(null);
+
+ final int failedAttemptWarning = LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET
+ - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT;
+
+ final int remainingBeforeWipe = failedAttemptsBeforeWipe > 0 ?
+ (failedAttemptsBeforeWipe - failedAttempts)
+ : Integer.MAX_VALUE; // because DPM returns 0 if no restriction
+
+ if (remainingBeforeWipe < LockPatternUtils.FAILED_ATTEMPTS_BEFORE_WIPE_GRACE) {
+ // If we reach this code, it means the user has installed a DevicePolicyManager
+ // that requests device wipe after N attempts. Once we get below the grace
+ // period, we'll post this dialog every time as a clear warning until the
+ // bombshell hits and the device is wiped.
+ if (remainingBeforeWipe > 0) {
+ showAlmostAtWipeDialog(failedAttempts, remainingBeforeWipe);
+ } else {
+ // Too many attempts. The device will be wiped shortly.
+ Slog.i(TAG, "Too many unlock attempts; device will be wiped!");
+ showWipeDialog(failedAttempts);
+ }
+ } else {
+ boolean showTimeout =
+ (failedAttempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) == 0;
+ if (usingPattern && mEnableFallback) {
+ if (failedAttempts == failedAttemptWarning) {
+ showAlmostAtAccountLoginDialog();
+ showTimeout = false; // don't show both dialogs
+ } else if (failedAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET) {
+ mLockPatternUtils.setPermanentlyLocked(true);
+ updateScreen(mMode, false);
+ // don't show timeout dialog because we show account unlock screen next
+ showTimeout = false;
+ }
+ }
+ if (showTimeout) {
+ showTimeoutDialog();
+ }
+ }
+ mLockPatternUtils.reportFailedPasswordAttempt();
+ }
+
+ public boolean doesFallbackUnlockScreenExist() {
+ return mEnableFallback;
+ }
+
+ public void reportSuccessfulUnlockAttempt() {
+ mLockPatternUtils.reportSuccessfulPasswordAttempt();
+ }
+ };
+
+ /**
* @param context Used to inflate, and create views.
* @param callback Keyguard callback object for pokewakelock(), etc.
* @param updateMonitor Knows the state of the world, and passed along to each
@@ -313,158 +461,7 @@
mPluggedIn = mUpdateMonitor.isDevicePluggedIn();
mScreenOn = ((PowerManager)context.getSystemService(Context.POWER_SERVICE)).isScreenOn();
- mUpdateMonitor.registerInfoCallback(this);
-
- mKeyguardScreenCallback = new KeyguardScreenCallback() {
-
- public void goToLockScreen() {
- mForgotPattern = false;
- if (mIsVerifyUnlockOnly) {
- // navigating away from unlock screen during verify mode means
- // we are done and the user failed to authenticate.
- mIsVerifyUnlockOnly = false;
- getCallback().keyguardDone(false);
- } else {
- updateScreen(Mode.LockScreen, false);
- }
- }
-
- public void goToUnlockScreen() {
- final IccCard.State simState = mUpdateMonitor.getSimState();
- if (stuckOnLockScreenBecauseSimMissing()
- || (simState == IccCard.State.PUK_REQUIRED
- && !mLockPatternUtils.isPukUnlockScreenEnable())){
- // stuck on lock screen when sim missing or
- // puk'd but puk unlock screen is disabled
- return;
- }
- if (!isSecure()) {
- getCallback().keyguardDone(true);
- } else {
- updateScreen(Mode.UnlockScreen, false);
- }
- }
-
- public void forgotPattern(boolean isForgotten) {
- if (mEnableFallback) {
- mForgotPattern = isForgotten;
- updateScreen(Mode.UnlockScreen, false);
- }
- }
-
- public boolean isSecure() {
- return LockPatternKeyguardView.this.isSecure();
- }
-
- public boolean isVerifyUnlockOnly() {
- return mIsVerifyUnlockOnly;
- }
-
- public void recreateMe(Configuration config) {
- removeCallbacks(mRecreateRunnable);
- post(mRecreateRunnable);
- }
-
- public void takeEmergencyCallAction() {
- mHasOverlay = true;
-
- // Continue showing FaceLock area until dialer comes up or call is resumed
- if (usingFaceLock() && mFaceLockServiceRunning) {
- showFaceLockAreaWithTimeout(FACELOCK_VIEW_AREA_EMERGENCY_DIALER_TIMEOUT);
- }
-
- // FaceLock must be stopped if it is running when emergency call is pressed
- stopAndUnbindFromFaceLock();
-
- pokeWakelock(EMERGENCY_CALL_TIMEOUT);
- if (TelephonyManager.getDefault().getCallState()
- == TelephonyManager.CALL_STATE_OFFHOOK) {
- mLockPatternUtils.resumeCall();
- } else {
- Intent intent = new Intent(ACTION_EMERGENCY_DIAL);
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
- getContext().startActivity(intent);
- }
- }
-
- public void pokeWakelock() {
- getCallback().pokeWakelock();
- }
-
- public void pokeWakelock(int millis) {
- getCallback().pokeWakelock(millis);
- }
-
- public void keyguardDone(boolean authenticated) {
- getCallback().keyguardDone(authenticated);
- mSavedState = null; // clear state so we re-establish when locked again
- }
-
- public void keyguardDoneDrawing() {
- // irrelevant to keyguard screen, they shouldn't be calling this
- }
-
- public void reportFailedUnlockAttempt() {
- mUpdateMonitor.reportFailedAttempt();
- final int failedAttempts = mUpdateMonitor.getFailedAttempts();
- if (DEBUG) Log.d(TAG, "reportFailedPatternAttempt: #" + failedAttempts +
- " (enableFallback=" + mEnableFallback + ")");
-
- final boolean usingPattern = mLockPatternUtils.getKeyguardStoredPasswordQuality()
- == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
-
- final int failedAttemptsBeforeWipe = mLockPatternUtils.getDevicePolicyManager()
- .getMaximumFailedPasswordsForWipe(null);
-
- final int failedAttemptWarning = LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET
- - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT;
-
- final int remainingBeforeWipe = failedAttemptsBeforeWipe > 0 ?
- (failedAttemptsBeforeWipe - failedAttempts)
- : Integer.MAX_VALUE; // because DPM returns 0 if no restriction
-
- if (remainingBeforeWipe < LockPatternUtils.FAILED_ATTEMPTS_BEFORE_WIPE_GRACE) {
- // If we reach this code, it means the user has installed a DevicePolicyManager
- // that requests device wipe after N attempts. Once we get below the grace
- // period, we'll post this dialog every time as a clear warning until the
- // bombshell hits and the device is wiped.
- if (remainingBeforeWipe > 0) {
- showAlmostAtWipeDialog(failedAttempts, remainingBeforeWipe);
- } else {
- // Too many attempts. The device will be wiped shortly.
- Slog.i(TAG, "Too many unlock attempts; device will be wiped!");
- showWipeDialog(failedAttempts);
- }
- } else {
- boolean showTimeout =
- (failedAttempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) == 0;
- if (usingPattern && mEnableFallback) {
- if (failedAttempts == failedAttemptWarning) {
- showAlmostAtAccountLoginDialog();
- showTimeout = false; // don't show both dialogs
- } else if (failedAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET) {
- mLockPatternUtils.setPermanentlyLocked(true);
- updateScreen(mMode, false);
- // don't show timeout dialog because we show account unlock screen next
- showTimeout = false;
- }
- }
- if (showTimeout) {
- showTimeoutDialog();
- }
- }
- mLockPatternUtils.reportFailedPasswordAttempt();
- }
-
- public boolean doesFallbackUnlockScreenExist() {
- return mEnableFallback;
- }
-
- public void reportSuccessfulUnlockAttempt() {
- mLockPatternUtils.reportSuccessfulPasswordAttempt();
- }
- };
+ mUpdateMonitor.registerInfoCallback(mInfoCallback);
/**
* We'll get key events the current screen doesn't use. see
@@ -707,6 +704,8 @@
@Override
protected void onDetachedFromWindow() {
+ mUpdateMonitor.removeCallback(mInfoCallback);
+
removeCallbacks(mRecreateRunnable);
// When view is hidden, need to unbind from FaceLock service if we are using FaceLock
@@ -726,46 +725,39 @@
post(mRecreateRunnable);
}
- /** When somebody plugs in or unplugs the device, we don't want to display faceunlock */
- @Override
- public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn, int batteryLevel) {
- mHasOverlay |= mPluggedIn != pluggedIn;
- mPluggedIn = pluggedIn;
- //If it's already running, don't close it down: the unplug didn't start it
- if (!mFaceLockServiceRunning) {
- stopAndUnbindFromFaceLock();
- hideFaceLockArea();
+ InfoCallbackImpl mInfoCallback = new InfoCallbackImpl() {
+
+ /** When somebody plugs in or unplugs the device, we don't want to display faceunlock */
+ @Override
+ public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn,
+ int batteryLevel) {
+ mHasOverlay |= mPluggedIn != pluggedIn;
+ mPluggedIn = pluggedIn;
+ //If it's already running, don't close it down: the unplug didn't start it
+ if (!mFaceLockServiceRunning) {
+ stopAndUnbindFromFaceLock();
+ hideFaceLockArea();
+ }
}
- }
- //Ignore these events; they are implemented only because they come from the same interface
- @Override
- public void onTimeChanged() {}
- @Override
- public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) {}
- @Override
- public void onRingerModeChanged(int state) {}
-
- @Override
- public void onClockVisibilityChanged() {
- int visFlags = getSystemUiVisibility() & ~View.STATUS_BAR_DISABLE_CLOCK;
- setSystemUiVisibility(visFlags
- | (mUpdateMonitor.isClockVisible() ? View.STATUS_BAR_DISABLE_CLOCK : 0));
- }
-
- @Override
- public void onDeviceProvisioned() {}
-
- //We need to stop faceunlock when a phonecall comes in
- @Override
- public void onPhoneStateChanged(int phoneState) {
- if (DEBUG) Log.d(TAG, "phone state: " + phoneState);
- if(phoneState == TelephonyManager.CALL_STATE_RINGING) {
- mHasOverlay = true;
- stopAndUnbindFromFaceLock();
- hideFaceLockArea();
+ @Override
+ public void onClockVisibilityChanged() {
+ int visFlags = getSystemUiVisibility() & ~View.STATUS_BAR_DISABLE_CLOCK;
+ setSystemUiVisibility(visFlags
+ | (mUpdateMonitor.isClockVisible() ? View.STATUS_BAR_DISABLE_CLOCK : 0));
}
- }
+
+ //We need to stop faceunlock when a phonecall comes in
+ @Override
+ public void onPhoneStateChanged(int phoneState) {
+ if (DEBUG) Log.d(TAG, "phone state: " + phoneState);
+ if(phoneState == TelephonyManager.CALL_STATE_RINGING) {
+ mHasOverlay = true;
+ stopAndUnbindFromFaceLock();
+ hideFaceLockArea();
+ }
+ }
+ };
@Override
protected boolean dispatchHoverEvent(MotionEvent event) {
diff --git a/policy/src/com/android/internal/policy/impl/LockScreen.java b/policy/src/com/android/internal/policy/impl/LockScreen.java
index edf5199..c9a130b 100644
--- a/policy/src/com/android/internal/policy/impl/LockScreen.java
+++ b/policy/src/com/android/internal/policy/impl/LockScreen.java
@@ -17,6 +17,11 @@
package com.android.internal.policy.impl;
import com.android.internal.R;
+import com.android.internal.policy.impl.KeyguardUpdateMonitor.InfoCallback;
+import com.android.internal.policy.impl.KeyguardUpdateMonitor.InfoCallbackImpl;
+import com.android.internal.policy.impl.KeyguardUpdateMonitor.SimStateCallback;
+import com.android.internal.policy.impl.LockScreen.MultiWaveViewMethods;
+import com.android.internal.telephony.IccCard.State;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.SlidingTab;
import com.android.internal.widget.WaveView;
@@ -60,6 +65,9 @@
private KeyguardUpdateMonitor mUpdateMonitor;
private KeyguardScreenCallback mCallback;
+ // set to 'true' to show the ring/silence target when camera isn't available
+ private boolean mEnableRingSilenceFallback = false;
+
// current configuration state of keyboard and display
private int mKeyboardHidden;
private int mCreationOrientation;
@@ -71,6 +79,31 @@
private KeyguardStatusViewManager mStatusViewManager;
private UnlockWidgetCommonMethods mUnlockWidgetMethods;
private View mUnlockWidget;
+ public boolean mCameraDisabled;
+
+ InfoCallbackImpl mInfoCallback = new InfoCallbackImpl() {
+
+ @Override
+ public void onRingerModeChanged(int state) {
+ boolean silent = AudioManager.RINGER_MODE_NORMAL != state;
+ if (silent != mSilentMode) {
+ mSilentMode = silent;
+ mUnlockWidgetMethods.updateResources();
+ }
+ }
+
+ @Override
+ public void onDevicePolicyManagerStateChanged() {
+ updateCameraTarget();
+ }
+
+ };
+
+ SimStateCallback mSimStateCallback = new SimStateCallback() {
+ public void onSimStateChanged(State simState) {
+ updateCameraTarget();
+ }
+ };
private interface UnlockWidgetCommonMethods {
// Update resources based on phone state
@@ -84,6 +117,13 @@
// Animate the widget if it supports ping()
public void ping();
+
+ // Enable or disable a target. ResourceId is the id of the *drawable* associated with the
+ // target.
+ public void setEnabled(int resourceId, boolean enabled);
+
+ // Get the target position for the given resource. Returns -1 if not found.
+ public int getTargetPosition(int resourceId);
}
class SlidingTabMethods implements SlidingTab.OnTriggerListener, UnlockWidgetCommonMethods {
@@ -144,6 +184,14 @@
public void ping() {
}
+
+ public void setEnabled(int resourceId, boolean enabled) {
+ // Not used
+ }
+
+ public int getTargetPosition(int resourceId) {
+ return -1; // Not supported
+ }
}
class WaveViewMethods implements WaveView.OnTriggerListener, UnlockWidgetCommonMethods {
@@ -181,39 +229,40 @@
}
public void ping() {
}
+ public void setEnabled(int resourceId, boolean enabled) {
+ // Not used
+ }
+ public int getTargetPosition(int resourceId) {
+ return -1; // Not supported
+ }
}
class MultiWaveViewMethods implements MultiWaveView.OnTriggerListener,
UnlockWidgetCommonMethods {
-
private final MultiWaveView mMultiWaveView;
- private boolean mCameraDisabled;
MultiWaveViewMethods(MultiWaveView multiWaveView) {
mMultiWaveView = multiWaveView;
- final boolean cameraDisabled = mLockPatternUtils.getDevicePolicyManager()
- .getCameraDisabled(null);
- if (cameraDisabled) {
- Log.v(TAG, "Camera disabled by Device Policy");
- mCameraDisabled = true;
- } else {
- // Camera is enabled if resource is initially defined for MultiWaveView
- // in the lockscreen layout file
- mCameraDisabled = mMultiWaveView.getTargetResourceId()
- != R.array.lockscreen_targets_with_camera;
- }
+ }
+
+ public boolean isCameraTargetPresent() {
+ return mMultiWaveView
+ .getTargetPosition(com.android.internal.R.drawable.ic_lockscreen_camera) != -1;
}
public void updateResources() {
int resId;
- if (mCameraDisabled) {
- // Fall back to showing ring/silence if camera is disabled by DPM...
+ if (mCameraDisabled && mEnableRingSilenceFallback) {
+ // Fall back to showing ring/silence if camera is disabled...
resId = mSilentMode ? R.array.lockscreen_targets_when_silent
: R.array.lockscreen_targets_when_soundon;
} else {
resId = R.array.lockscreen_targets_with_camera;
}
- mMultiWaveView.setTargetResources(resId);
+ if (mMultiWaveView.getTargetResourceId() != resId) {
+ mMultiWaveView.setTargetResources(resId);
+ }
+ setEnabled(com.android.internal.R.drawable.ic_lockscreen_camera, !mCameraDisabled);
}
public void onGrabbed(View v, int handle) {
@@ -225,29 +274,39 @@
}
public void onTrigger(View v, int target) {
- if (target == 0 || target == 1) { // 0 = unlock/portrait, 1 = unlock/landscape
- mCallback.goToUnlockScreen();
- } else if (target == 2 || target == 3) { // 2 = alt/portrait, 3 = alt/landscape
- if (!mCameraDisabled) {
- // Start the Camera
- Intent intent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
- try {
- ActivityManagerNative.getDefault().dismissKeyguardOnNextActivity();
- } catch (RemoteException e) {
- Log.w(TAG, "can't dismiss keyguard on launch");
- }
- try {
- mContext.startActivity(intent);
- } catch (ActivityNotFoundException e) {
- Log.w(TAG, "Camera application not found");
- }
- } else {
- toggleRingMode();
- mUnlockWidgetMethods.updateResources();
+ final int resId = mMultiWaveView.getResourceIdForTarget(target);
+ switch (resId) {
+ case com.android.internal.R.drawable.ic_lockscreen_camera:
+ launchCamera();
mCallback.pokeWakelock();
- }
+ break;
+
+ case com.android.internal.R.drawable.ic_lockscreen_silent:
+ toggleRingMode();
+ mCallback.pokeWakelock();
+ break;
+
+ case com.android.internal.R.drawable.ic_lockscreen_unlock:
+ mCallback.goToUnlockScreen();
+ break;
+ }
+ }
+
+ private void launchCamera() {
+ Intent intent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
+ intent.setFlags(
+ Intent.FLAG_ACTIVITY_NEW_TASK
+ | Intent.FLAG_ACTIVITY_SINGLE_TOP
+ | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ try {
+ ActivityManagerNative.getDefault().dismissKeyguardOnNextActivity();
+ } catch (RemoteException e) {
+ Log.w(TAG, "can't dismiss keyguard on launch");
+ }
+ try {
+ mContext.startActivity(intent);
+ } catch (ActivityNotFoundException e) {
+ Log.w(TAG, "Camera application not found");
}
}
@@ -271,6 +330,14 @@
public void ping() {
mMultiWaveView.ping();
}
+
+ public void setEnabled(int resourceId, boolean enabled) {
+ mMultiWaveView.setEnableTarget(resourceId, enabled);
+ }
+
+ public int getTargetPosition(int resourceId) {
+ return mMultiWaveView.getTargetPosition(resourceId);
+ }
}
private void requestUnlockScreen() {
@@ -328,11 +395,8 @@
mLockPatternUtils = lockPatternUtils;
mUpdateMonitor = updateMonitor;
mCallback = callback;
-
mEnableMenuKeyInLockScreen = shouldEnableMenuKey();
-
mCreationOrientation = configuration.orientation;
-
mKeyboardHidden = configuration.hardKeyboardHidden;
if (LockPatternKeyguardView.DEBUG_CONFIGURATION) {
@@ -358,10 +422,16 @@
mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
mSilentMode = isSilentMode();
-
mUnlockWidget = findViewById(R.id.unlock_widget);
- if (mUnlockWidget instanceof SlidingTab) {
- SlidingTab slidingTabView = (SlidingTab) mUnlockWidget;
+ mUnlockWidgetMethods = createUnlockMethods(mUnlockWidget);
+
+ if (DBG) Log.v(TAG, "*** LockScreen accel is "
+ + (mUnlockWidget.isHardwareAccelerated() ? "on":"off"));
+ }
+
+ private UnlockWidgetCommonMethods createUnlockMethods(View unlockWidget) {
+ if (unlockWidget instanceof SlidingTab) {
+ SlidingTab slidingTabView = (SlidingTab) unlockWidget;
slidingTabView.setHoldAfterTrigger(true, false);
slidingTabView.setLeftHintText(R.string.lockscreen_unlock_label);
slidingTabView.setLeftTabResources(
@@ -371,26 +441,35 @@
R.drawable.jog_tab_left_unlock);
SlidingTabMethods slidingTabMethods = new SlidingTabMethods(slidingTabView);
slidingTabView.setOnTriggerListener(slidingTabMethods);
- mUnlockWidgetMethods = slidingTabMethods;
- } else if (mUnlockWidget instanceof WaveView) {
- WaveView waveView = (WaveView) mUnlockWidget;
+ return slidingTabMethods;
+ } else if (unlockWidget instanceof WaveView) {
+ WaveView waveView = (WaveView) unlockWidget;
WaveViewMethods waveViewMethods = new WaveViewMethods(waveView);
waveView.setOnTriggerListener(waveViewMethods);
- mUnlockWidgetMethods = waveViewMethods;
- } else if (mUnlockWidget instanceof MultiWaveView) {
- MultiWaveView multiWaveView = (MultiWaveView) mUnlockWidget;
+ return waveViewMethods;
+ } else if (unlockWidget instanceof MultiWaveView) {
+ MultiWaveView multiWaveView = (MultiWaveView) unlockWidget;
MultiWaveViewMethods multiWaveViewMethods = new MultiWaveViewMethods(multiWaveView);
multiWaveView.setOnTriggerListener(multiWaveViewMethods);
- mUnlockWidgetMethods = multiWaveViewMethods;
+ return multiWaveViewMethods;
} else {
- throw new IllegalStateException("Unrecognized unlock widget: " + mUnlockWidget);
+ throw new IllegalStateException("Unrecognized unlock widget: " + unlockWidget);
}
+ }
- // Update widget with initial ring state
+ private void updateCameraTarget() {
+ boolean disabledByAdmin = mLockPatternUtils.getDevicePolicyManager()
+ .getCameraDisabled(null);
+ boolean disabledBySimState = mUpdateMonitor.isSimLocked();
+ boolean targetPresent = (mUnlockWidgetMethods instanceof MultiWaveViewMethods)
+ ? ((MultiWaveViewMethods) mUnlockWidgetMethods).isCameraTargetPresent() : false;
+ if (disabledByAdmin) {
+ Log.v(TAG, "Camera disabled by Device Policy");
+ } else if (disabledBySimState) {
+ Log.v(TAG, "Camera disabled by Sim State");
+ }
+ mCameraDisabled = disabledByAdmin || disabledBySimState || !targetPresent;
mUnlockWidgetMethods.updateResources();
-
- if (DBG) Log.v(TAG, "*** LockScreen accel is "
- + (mUnlockWidget.isHardwareAccelerated() ? "on":"off"));
}
private boolean isSilentMode() {
@@ -448,6 +527,8 @@
/** {@inheritDoc} */
public void onPause() {
+ mUpdateMonitor.removeCallback(mInfoCallback);
+ mUpdateMonitor.removeCallback(mSimStateCallback);
mStatusViewManager.onPause();
mUnlockWidgetMethods.reset(false);
}
@@ -460,27 +541,21 @@
/** {@inheritDoc} */
public void onResume() {
+ // We don't want to show the camera target if SIM state prevents us from
+ // launching the camera. So watch for SIM changes...
+ mUpdateMonitor.registerSimStateCallback(mSimStateCallback);
+ mUpdateMonitor.registerInfoCallback(mInfoCallback);
+
mStatusViewManager.onResume();
postDelayed(mOnResumePing, ON_RESUME_PING_DELAY);
}
/** {@inheritDoc} */
public void cleanUp() {
- mUpdateMonitor.removeCallback(this); // this must be first
+ mUpdateMonitor.removeCallback(mInfoCallback); // this must be first
+ mUpdateMonitor.removeCallback(mSimStateCallback);
mLockPatternUtils = null;
mUpdateMonitor = null;
mCallback = null;
}
-
- /** {@inheritDoc} */
- public void onRingerModeChanged(int state) {
- boolean silent = AudioManager.RINGER_MODE_NORMAL != state;
- if (silent != mSilentMode) {
- mSilentMode = silent;
- mUnlockWidgetMethods.updateResources();
- }
- }
-
- public void onPhoneStateChanged(String newState) {
- }
}
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index e0a0d2d..a1f7316 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -17,8 +17,8 @@
package com.android.internal.policy.impl;
import android.app.Activity;
+import android.app.ActivityManager;
import android.app.ActivityManagerNative;
-import android.app.IActivityManager;
import android.app.IUiModeManager;
import android.app.ProgressDialog;
import android.app.UiModeManager;
@@ -3832,10 +3832,10 @@
int result = ActivityManagerNative.getDefault()
.startActivity(null, dock,
dock.resolveTypeIfNeeded(mContext.getContentResolver()),
- null, 0, null, null, 0, true /* onlyIfNeeded*/,
- false /* debug */, false /* openglTrace */,
- null, null, false);
- if (result == IActivityManager.START_RETURN_INTENT_TO_CALLER) {
+ null, null, 0,
+ ActivityManager.START_FLAG_ONLY_IF_NEEDED,
+ null, null, null);
+ if (result == ActivityManager.START_RETURN_INTENT_TO_CALLER) {
return false;
}
}
@@ -3843,10 +3843,10 @@
int result = ActivityManagerNative.getDefault()
.startActivity(null, mHomeIntent,
mHomeIntent.resolveTypeIfNeeded(mContext.getContentResolver()),
- null, 0, null, null, 0, true /* onlyIfNeeded*/,
- false /* debug */, false /* openglTrace */,
- null, null, false);
- if (result == IActivityManager.START_RETURN_INTENT_TO_CALLER) {
+ null, null, 0,
+ ActivityManager.START_FLAG_ONLY_IF_NEEDED,
+ null, null, null);
+ if (result == ActivityManager.START_RETURN_INTENT_TO_CALLER) {
return false;
}
} catch (RemoteException ex) {
diff --git a/services/audioflinger/Android.mk b/services/audioflinger/Android.mk
index 86692e7..1652cae 100644
--- a/services/audioflinger/Android.mk
+++ b/services/audioflinger/Android.mk
@@ -12,8 +12,8 @@
# AudioResamplerCubic.cpp.arm
LOCAL_C_INCLUDES := \
- system/media/audio_effects/include \
- system/media/audio_utils/include
+ $(call include-path-for, audio-effects) \
+ $(call include-path-for, audio-utils)
LOCAL_SHARED_LIBRARIES := \
libaudioutils \
@@ -22,6 +22,7 @@
libutils \
libbinder \
libmedia \
+ libmedia_native \
libhardware \
libhardware_legacy \
libeffects \
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 81b9464..d83d19a 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -37,8 +37,12 @@
#include <cutils/properties.h>
#include <cutils/compiler.h>
+#undef ADD_BATTERY_DATA
+
+#ifdef ADD_BATTERY_DATA
#include <media/IMediaPlayerService.h>
#include <media/IMediaDeathNotifier.h>
+#endif
#include <private/media/AudioTrackShared.h>
#include <private/media/AudioEffectShared.h>
@@ -57,9 +61,13 @@
#include <audio_utils/primitives.h>
-#include <cpustats/ThreadCpuUsage.h>
#include <powermanager/PowerManager.h>
+
// #define DEBUG_CPU_USAGE 10 // log statistics every n wall clock seconds
+#ifdef DEBUG_CPU_USAGE
+#include <cpustats/CentralTendencyStatistics.h>
+#include <cpustats/ThreadCpuUsage.h>
+#endif
#include <common_time/cc_helper.h>
#include <common_time/local_clock.h>
@@ -105,6 +113,7 @@
// ----------------------------------------------------------------------------
+#ifdef ADD_BATTERY_DATA
// To collect the amplifier usage
static void addBatteryData(uint32_t params) {
sp<IMediaPlayerService> service = IMediaDeathNotifier::getMediaPlayerService();
@@ -115,6 +124,7 @@
service->addBatteryData(params);
}
+#endif
static int load_audio_interface(const char *if_name, const hw_module_t **mod,
audio_hw_device_t **dev)
@@ -190,13 +200,13 @@
continue;
ALOGI("Loaded %s audio interface from %s (%s)", audio_interfaces[i],
- mod->name, mod->id);
+ mod->name, mod->id);
mAudioHwDevs.push(dev);
if (mPrimaryHardwareDev == NULL) {
mPrimaryHardwareDev = dev;
ALOGI("Using '%s' (%s.%s) as the primary audio interface",
- mod->name, mod->id, audio_interfaces[i]);
+ mod->name, mod->id, audio_interfaces[i]);
}
}
@@ -515,7 +525,7 @@
}
Exit:
- if(status) {
+ if (status != NULL) {
*status = lStatus;
}
return trackHandle;
@@ -610,7 +620,7 @@
mMasterVolume = value;
mMasterVolumeSW = swmv;
for (size_t i = 0; i < mPlaybackThreads.size(); i++)
- mPlaybackThreads.valueAt(i)->setMasterVolume(swmv);
+ mPlaybackThreads.valueAt(i)->setMasterVolume(swmv);
return NO_ERROR;
}
@@ -642,7 +652,7 @@
Mutex::Autolock _l(mLock);
mMode = mode;
for (size_t i = 0; i < mPlaybackThreads.size(); i++)
- mPlaybackThreads.valueAt(i)->setMode(mode);
+ mPlaybackThreads.valueAt(i)->setMode(mode);
}
return ret;
@@ -693,7 +703,7 @@
// This is an optimization, so PlaybackThread doesn't have to look at the one from AudioFlinger
mMasterMute = muted;
for (size_t i = 0; i < mPlaybackThreads.size(); i++)
- mPlaybackThreads.valueAt(i)->setMasterMute(muted);
+ mPlaybackThreads.valueAt(i)->setMasterMute(muted);
return NO_ERROR;
}
@@ -723,8 +733,9 @@
AutoMutex lock(mHardwareLock);
mHardwareStatus = AUDIO_HW_GET_MASTER_VOLUME;
- assert(NULL != mPrimaryHardwareDev);
- assert(NULL != mPrimaryHardwareDev->get_master_volume);
+ ALOG_ASSERT((NULL != mPrimaryHardwareDev) &&
+ (NULL != mPrimaryHardwareDev->get_master_volume),
+ "can't get master volume");
mPrimaryHardwareDev->get_master_volume(mPrimaryHardwareDev, &ret_val);
mHardwareStatus = AUDIO_HW_IDLE;
@@ -760,7 +771,7 @@
if (thread == NULL) {
for (size_t i = 0; i < mPlaybackThreads.size(); i++) {
- mPlaybackThreads.valueAt(i)->setStreamVolume(stream, value);
+ mPlaybackThreads.valueAt(i)->setStreamVolume(stream, value);
}
} else {
thread->setStreamVolume(stream, value);
@@ -785,7 +796,7 @@
AutoMutex lock(mLock);
mStreamTypes[stream].mute = muted;
for (uint32_t i = 0; i < mPlaybackThreads.size(); i++)
- mPlaybackThreads.valueAt(i)->setStreamMute(stream, muted);
+ mPlaybackThreads.valueAt(i)->setStreamMute(stream, muted);
return NO_ERROR;
}
@@ -1160,7 +1171,7 @@
void AudioFlinger::ThreadBase::processConfigEvents()
{
mLock.lock();
- while(!mConfigEvents.isEmpty()) {
+ while (!mConfigEvents.isEmpty()) {
ALOGV("processConfigEvents() remaining events %d", mConfigEvents.size());
ConfigEvent configEvent = mConfigEvents[0];
mConfigEvents.removeAt(0);
@@ -1187,6 +1198,10 @@
write(fd, buffer, strlen(buffer));
}
+ snprintf(buffer, SIZE, "io handle: %d\n", mId);
+ result.append(buffer);
+ snprintf(buffer, SIZE, "TID: %d\n", getTid());
+ result.append(buffer);
snprintf(buffer, SIZE, "standby: %d\n", mStandby);
result.append(buffer);
snprintf(buffer, SIZE, "Sample rate: %d\n", mSampleRate);
@@ -1344,13 +1359,13 @@
mSuspendedSessions.editValueAt(index);
for (size_t i = 0; i < sessionEffects.size(); i++) {
- sp <SuspendedSessionDesc> desc = sessionEffects.valueAt(i);
+ sp<SuspendedSessionDesc> desc = sessionEffects.valueAt(i);
for (int j = 0; j < desc->mRefCount; j++) {
if (sessionEffects.keyAt(i) == EffectChain::kKeyForSuspendAll) {
chain->setEffectSuspendedAll_l(true);
} else {
ALOGV("checkSuspendOnAddEffectChain_l() suspending effects %08x",
- desc->mType.timeLow);
+ desc->mType.timeLow);
chain->setEffectSuspended_l(&desc->mType, true);
}
}
@@ -1385,7 +1400,7 @@
}
index = sessionEffects.indexOfKey(key);
- sp <SuspendedSessionDesc> desc;
+ sp<SuspendedSessionDesc> desc;
if (suspend) {
if (index >= 0) {
desc = sessionEffects.valueAt(index);
@@ -1658,14 +1673,14 @@
// createTrack() was called by the client process.
if (!mStreamTypes[streamType].valid) {
ALOGW("createTrack_l() on thread %p: invalidating track on stream %d",
- this, streamType);
+ this, streamType);
android_atomic_or(CBLK_INVALID_ON, &track->mCblk->flags);
}
}
lStatus = NO_ERROR;
Exit:
- if(status) {
+ if (status) {
*status = lStatus;
}
return track;
@@ -1938,30 +1953,83 @@
class CpuStats {
public:
- void sample();
+ CpuStats();
+ void sample(const String8 &title);
#ifdef DEBUG_CPU_USAGE
private:
- ThreadCpuUsage mCpu;
+ ThreadCpuUsage mCpuUsage; // instantaneous thread CPU usage in wall clock ns
+ CentralTendencyStatistics mWcStats; // statistics on thread CPU usage in wall clock ns
+
+ CentralTendencyStatistics mHzStats; // statistics on thread CPU usage in cycles
+
+ int mCpuNum; // thread's current CPU number
+ int mCpukHz; // frequency of thread's current CPU in kHz
#endif
};
-void CpuStats::sample() {
+CpuStats::CpuStats()
#ifdef DEBUG_CPU_USAGE
- const CentralTendencyStatistics& stats = mCpu.statistics();
- mCpu.sampleAndEnable();
- unsigned n = stats.n();
- // mCpu.elapsed() is expensive, so don't call it every loop
+ : mCpuNum(-1), mCpukHz(-1)
+#endif
+{
+}
+
+void CpuStats::sample(const String8 &title) {
+#ifdef DEBUG_CPU_USAGE
+ // get current thread's delta CPU time in wall clock ns
+ double wcNs;
+ bool valid = mCpuUsage.sampleAndEnable(wcNs);
+
+ // record sample for wall clock statistics
+ if (valid) {
+ mWcStats.sample(wcNs);
+ }
+
+ // get the current CPU number
+ int cpuNum = sched_getcpu();
+
+ // get the current CPU frequency in kHz
+ int cpukHz = mCpuUsage.getCpukHz(cpuNum);
+
+ // check if either CPU number or frequency changed
+ if (cpuNum != mCpuNum || cpukHz != mCpukHz) {
+ mCpuNum = cpuNum;
+ mCpukHz = cpukHz;
+ // ignore sample for purposes of cycles
+ valid = false;
+ }
+
+ // if no change in CPU number or frequency, then record sample for cycle statistics
+ if (valid && mCpukHz > 0) {
+ double cycles = wcNs * cpukHz * 0.000001;
+ mHzStats.sample(cycles);
+ }
+
+ unsigned n = mWcStats.n();
+ // mCpuUsage.elapsed() is expensive, so don't call it every loop
if ((n & 127) == 1) {
- long long elapsed = mCpu.elapsed();
+ long long elapsed = mCpuUsage.elapsed();
if (elapsed >= DEBUG_CPU_USAGE * 1000000000LL) {
double perLoop = elapsed / (double) n;
double perLoop100 = perLoop * 0.01;
- double mean = stats.mean();
- double stddev = stats.stddev();
- double minimum = stats.minimum();
- double maximum = stats.maximum();
- mCpu.resetStatistics();
- ALOGI("CPU usage over past %.1f secs (%u mixer loops at %.1f mean ms per loop):\n us per mix loop: mean=%.0f stddev=%.0f min=%.0f max=%.0f\n %% of wall: mean=%.1f stddev=%.1f min=%.1f max=%.1f",
+ double perLoop1k = perLoop * 0.001;
+ double mean = mWcStats.mean();
+ double stddev = mWcStats.stddev();
+ double minimum = mWcStats.minimum();
+ double maximum = mWcStats.maximum();
+ double meanCycles = mHzStats.mean();
+ double stddevCycles = mHzStats.stddev();
+ double minCycles = mHzStats.minimum();
+ double maxCycles = mHzStats.maximum();
+ mCpuUsage.resetElapsed();
+ mWcStats.reset();
+ mHzStats.reset();
+ ALOGD("CPU usage for %s over past %.1f secs\n"
+ " (%u mixer loops at %.1f mean ms per loop):\n"
+ " us per mix loop: mean=%.0f stddev=%.0f min=%.0f max=%.0f\n"
+ " %% of wall: mean=%.1f stddev=%.1f min=%.1f max=%.1f\n"
+ " MHz: mean=%.1f, stddev=%.1f, min=%.1f max=%.1f",
+ title.string(),
elapsed * .000000001, n, perLoop * .000001,
mean * .001,
stddev * .001,
@@ -1970,7 +2038,12 @@
mean / perLoop100,
stddev / perLoop100,
minimum / perLoop100,
- maximum / perLoop100);
+ maximum / perLoop100,
+ meanCycles / perLoop1k,
+ stddevCycles / perLoop1k,
+ minCycles / perLoop1k,
+ maxCycles / perLoop1k);
+
}
}
#endif
@@ -2016,16 +2089,14 @@
sleepTimeShift = 0;
}
- // MIXER
CpuStats cpuStats;
+ const String8 myName(String8::format("thread %p type %d TID %d", this, mType, gettid()));
acquireWakeLock();
while (!exitPending())
{
-if (mType == MIXER) {
- cpuStats.sample();
-}
+ cpuStats.sample(myName);
Vector< sp<EffectChain> > effectChains;
@@ -2062,9 +2133,9 @@
releaseWakeLock_l();
// wait until we have something to do...
- ALOGV("Thread %p type %d TID %d going to sleep", this, mType, gettid());
+ ALOGV("%s going to sleep", myName.string());
mWaitWorkCV.wait(mLock);
- ALOGV("Thread %p type %d TID %d waking up", this, mType, gettid());
+ ALOGV("%s waking up", myName.string());
acquireWakeLock_l();
mPrevMixerStatus = MIXER_IDLE;
@@ -2611,6 +2682,7 @@
}
}
if (param.getInt(String8(AudioParameter::keyRouting), value) == NO_ERROR) {
+#ifdef ADD_BATTERY_DATA
// when changing the audio output device, call addBatteryData to notify
// the change
if ((int)mDevice != value) {
@@ -2631,6 +2703,7 @@
addBatteryData(params);
}
}
+#endif
// forward device change to effects that have requested to be
// aware of attached audio device.
@@ -2644,10 +2717,10 @@
status = mOutput->stream->common.set_parameters(&mOutput->stream->common,
keyValuePair.string());
if (!mStandby && status == INVALID_OPERATION) {
- mOutput->stream->common.standby(&mOutput->stream->common);
- mStandby = true;
- mBytesWritten = 0;
- status = mOutput->stream->common.set_parameters(&mOutput->stream->common,
+ mOutput->stream->common.standby(&mOutput->stream->common);
+ mStandby = true;
+ mBytesWritten = 0;
+ status = mOutput->stream->common.set_parameters(&mOutput->stream->common,
keyValuePair.string());
}
if (status == NO_ERROR && reconfig) {
@@ -2855,7 +2928,7 @@
tracksToRemove->add(trackToRemove);
mActiveTracks.remove(trackToRemove);
if (!mEffectChains.isEmpty()) {
- ALOGV("stopping track on chain %p for session Id: %d", effectChains[0].get(),
+ ALOGV("stopping track on chain %p for session Id: %d", mEffectChains[0].get(),
trackToRemove->sessionId());
mEffectChains[0]->decActiveTrackCnt();
}
@@ -2901,7 +2974,7 @@
size_t count = mFrameCount * mChannelCount;
uint8_t *src = (uint8_t *)mMixBuffer + count-1;
int16_t *dst = mMixBuffer + count-1;
- while(count--) {
+ while (count--) {
*dst-- = (int16_t)(*src--^0x80) << 8;
}
}
@@ -2954,7 +3027,7 @@
size_t count = mFrameCount * mChannelCount;
int16_t *src = mMixBuffer;
uint8_t *dst = (uint8_t *)mMixBuffer;
- while(count--) {
+ while (count--) {
*dst++ = (uint8_t)(((int32_t)*src++ + (1<<7)) >> 8)^0x80;
}
}
@@ -3013,10 +3086,10 @@
status = mOutput->stream->common.set_parameters(&mOutput->stream->common,
keyValuePair.string());
if (!mStandby && status == INVALID_OPERATION) {
- mOutput->stream->common.standby(&mOutput->stream->common);
- mStandby = true;
- mBytesWritten = 0;
- status = mOutput->stream->common.set_parameters(&mOutput->stream->common,
+ mOutput->stream->common.standby(&mOutput->stream->common);
+ mStandby = true;
+ mBytesWritten = 0;
+ status = mOutput->stream->common.set_parameters(&mOutput->stream->common,
keyValuePair.string());
}
if (status == NO_ERROR && reconfig) {
@@ -3207,7 +3280,7 @@
bool AudioFlinger::DuplicatingThread::outputsReady(const SortedVector< sp<OutputTrack> > &outputTracks)
{
for (size_t i = 0; i < outputTracks.size(); i++) {
- sp <ThreadBase> thread = outputTracks[i]->thread().promote();
+ sp<ThreadBase> thread = outputTracks[i]->thread().promote();
if (thread == 0) {
ALOGW("DuplicatingThread::outputsReady() could not promote thread on output track %p", outputTracks[i].get());
return false;
@@ -3263,14 +3336,14 @@
ALOGV_IF(sharedBuffer != 0, "sharedBuffer: %p, size: %d", sharedBuffer->pointer(), sharedBuffer->size());
// ALOGD("Creating track with %d buffers @ %d bytes", bufferCount, bufferSize);
- size_t size = sizeof(audio_track_cblk_t);
- uint8_t channelCount = popcount(channelMask);
- size_t bufferSize = frameCount*channelCount*sizeof(int16_t);
- if (sharedBuffer == 0) {
- size += bufferSize;
- }
+ size_t size = sizeof(audio_track_cblk_t);
+ uint8_t channelCount = popcount(channelMask);
+ size_t bufferSize = frameCount*channelCount*sizeof(int16_t);
+ if (sharedBuffer == 0) {
+ size += bufferSize;
+ }
- if (client != NULL) {
+ if (client != NULL) {
mCblkMemory = client->heap()->allocate(size);
if (mCblkMemory != 0) {
mCblk = static_cast<audio_track_cblk_t *>(mCblkMemory->pointer());
@@ -3297,22 +3370,22 @@
client->heap()->dump("AudioTrack");
return;
}
- } else {
- mCblk = (audio_track_cblk_t *)(new uint8_t[size]);
- // construct the shared structure in-place.
- new(mCblk) audio_track_cblk_t();
- // clear all buffers
- mCblk->frameCount = frameCount;
- mCblk->sampleRate = sampleRate;
- mChannelCount = channelCount;
- mChannelMask = channelMask;
- mBuffer = (char*)mCblk + sizeof(audio_track_cblk_t);
- memset(mBuffer, 0, frameCount*channelCount*sizeof(int16_t));
- // Force underrun condition to avoid false underrun callback until first data is
- // written to buffer (other flags are cleared)
- mCblk->flags = CBLK_UNDERRUN_ON;
- mBufferEnd = (uint8_t *)mBuffer + bufferSize;
- }
+ } else {
+ mCblk = (audio_track_cblk_t *)(new uint8_t[size]);
+ // construct the shared structure in-place.
+ new(mCblk) audio_track_cblk_t();
+ // clear all buffers
+ mCblk->frameCount = frameCount;
+ mCblk->sampleRate = sampleRate;
+ mChannelCount = channelCount;
+ mChannelMask = channelMask;
+ mBuffer = (char*)mCblk + sizeof(audio_track_cblk_t);
+ memset(mBuffer, 0, frameCount*channelCount*sizeof(int16_t));
+ // Force underrun condition to avoid false underrun callback until first data is
+ // written to buffer (other flags are cleared)
+ mCblk->flags = CBLK_UNDERRUN_ON;
+ mBufferEnd = (uint8_t *)mBuffer + bufferSize;
+ }
}
AudioFlinger::ThreadBase::TrackBase::~TrackBase()
@@ -3453,8 +3526,10 @@
if (mState == ACTIVE || mState == RESUMING) {
AudioSystem::stopOutput(thread->id(), mStreamType, mSessionId);
+#ifdef ADD_BATTERY_DATA
// to track the speaker usage
addBatteryData(IMediaPlayerService::kBatteryDataAudioFlingerStop);
+#endif
}
AudioSystem::releaseOutput(thread->id());
}
@@ -3490,22 +3565,22 @@
// AudioBufferProvider interface
status_t AudioFlinger::PlaybackThread::Track::getNextBuffer(
- AudioBufferProvider::Buffer* buffer, int64_t pts)
+ AudioBufferProvider::Buffer* buffer, int64_t pts)
{
- audio_track_cblk_t* cblk = this->cblk();
- uint32_t framesReady;
- uint32_t framesReq = buffer->frameCount;
+ audio_track_cblk_t* cblk = this->cblk();
+ uint32_t framesReady;
+ uint32_t framesReq = buffer->frameCount;
- // Check if last stepServer failed, try to step now
- if (mStepServerFailed) {
- if (!step()) goto getNextBuffer_exit;
- ALOGV("stepServer recovered");
- mStepServerFailed = false;
- }
+ // Check if last stepServer failed, try to step now
+ if (mStepServerFailed) {
+ if (!step()) goto getNextBuffer_exit;
+ ALOGV("stepServer recovered");
+ mStepServerFailed = false;
+ }
- framesReady = cblk->framesReady();
+ framesReady = cblk->framesReady();
- if (CC_LIKELY(framesReady)) {
+ if (CC_LIKELY(framesReady)) {
uint32_t s = cblk->server;
uint32_t bufferEnd = cblk->serverBase + cblk->frameCount;
@@ -3517,21 +3592,21 @@
framesReq = bufferEnd - s;
}
- buffer->raw = getBuffer(s, framesReq);
- if (buffer->raw == NULL) goto getNextBuffer_exit;
+ buffer->raw = getBuffer(s, framesReq);
+ if (buffer->raw == NULL) goto getNextBuffer_exit;
- buffer->frameCount = framesReq;
+ buffer->frameCount = framesReq;
return NO_ERROR;
- }
+ }
getNextBuffer_exit:
- buffer->raw = NULL;
- buffer->frameCount = 0;
- ALOGV("getNextBuffer() no more data for track %d on thread %p", mName, mThread.unsafe_get());
- return NOT_ENOUGH_DATA;
+ buffer->raw = NULL;
+ buffer->frameCount = 0;
+ ALOGV("getNextBuffer() no more data for track %d on thread %p", mName, mThread.unsafe_get());
+ return NOT_ENOUGH_DATA;
}
-uint32_t AudioFlinger::PlaybackThread::Track::framesReady() const{
+uint32_t AudioFlinger::PlaybackThread::Track::framesReady() const {
return mCblk->framesReady();
}
@@ -3571,10 +3646,12 @@
status = AudioSystem::startOutput(thread->id(), mStreamType, mSessionId);
thread->mLock.lock();
+#ifdef ADD_BATTERY_DATA
// to track the speaker usage
if (status == NO_ERROR) {
addBatteryData(IMediaPlayerService::kBatteryDataAudioFlingerStart);
}
+#endif
}
if (status == NO_ERROR) {
PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
@@ -3609,8 +3686,10 @@
AudioSystem::stopOutput(thread->id(), mStreamType, mSessionId);
thread->mLock.lock();
+#ifdef ADD_BATTERY_DATA
// to track the speaker usage
addBatteryData(IMediaPlayerService::kBatteryDataAudioFlingerStop);
+#endif
}
}
}
@@ -3629,8 +3708,10 @@
AudioSystem::stopOutput(thread->id(), mStreamType, mSessionId);
thread->mLock.lock();
+#ifdef ADD_BATTERY_DATA
// to track the speaker usage
addBatteryData(IMediaPlayerService::kBatteryDataAudioFlingerStop);
+#endif
}
}
}
@@ -3683,8 +3764,8 @@
status_t status = DEAD_OBJECT;
sp<ThreadBase> thread = mThread.promote();
if (thread != 0) {
- PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
- status = playbackThread->attachAuxEffect(this, EffectId);
+ PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
+ status = playbackThread->attachAuxEffect(this, EffectId);
}
return status;
}
@@ -3884,7 +3965,7 @@
{
Mutex::Autolock mttLock(mMediaTimeTransformLock);
- assert(mMediaTimeTransformValid);
+ ALOG_ASSERT(mMediaTimeTransformValid, "media time transform invalid");
if (mMediaTimeTransform.a_to_b_denom == 0) {
// the transform represents a pause, so yield silence
@@ -4103,14 +4184,14 @@
mOverflow(false)
{
if (mCblk != NULL) {
- ALOGV("RecordTrack constructor, size %d", (int)mBufferEnd - (int)mBuffer);
- if (format == AUDIO_FORMAT_PCM_16_BIT) {
- mCblk->frameSize = mChannelCount * sizeof(int16_t);
- } else if (format == AUDIO_FORMAT_PCM_8_BIT) {
- mCblk->frameSize = mChannelCount * sizeof(int8_t);
- } else {
- mCblk->frameSize = sizeof(int8_t);
- }
+ ALOGV("RecordTrack constructor, size %d", (int)mBufferEnd - (int)mBuffer);
+ if (format == AUDIO_FORMAT_PCM_16_BIT) {
+ mCblk->frameSize = mChannelCount * sizeof(int16_t);
+ } else if (format == AUDIO_FORMAT_PCM_8_BIT) {
+ mCblk->frameSize = mChannelCount * sizeof(int8_t);
+ } else {
+ mCblk->frameSize = sizeof(int8_t);
+ }
}
}
@@ -4129,7 +4210,7 @@
uint32_t framesAvail;
uint32_t framesReq = buffer->frameCount;
- // Check if last stepServer failed, try to step now
+ // Check if last stepServer failed, try to step now
if (mStepServerFailed) {
if (!step()) goto getNextBuffer_exit;
ALOGV("stepServer recovered");
@@ -4975,7 +5056,7 @@
status_t AudioFlinger::RecordThread::start(RecordThread::RecordTrack* recordTrack, pid_t tid)
{
ALOGV("RecordThread::start tid=%d", tid);
- sp <ThreadBase> strongMe = this;
+ sp<ThreadBase> strongMe = this;
status_t status = NO_ERROR;
{
AutoMutex lock(mLock);
@@ -5028,7 +5109,7 @@
void AudioFlinger::RecordThread::stop(RecordThread::RecordTrack* recordTrack) {
ALOGV("RecordThread::stop");
- sp <ThreadBase> strongMe = this;
+ sp<ThreadBase> strongMe = this;
{
AutoMutex lock(mLock);
if (mActiveTrack != 0 && recordTrack == mActiveTrack.get()) {
@@ -5195,8 +5276,9 @@
if (status == NO_ERROR) {
status = mInput->stream->common.set_parameters(&mInput->stream->common, keyValuePair.string());
if (status == INVALID_OPERATION) {
- mInput->stream->common.standby(&mInput->stream->common);
- status = mInput->stream->common.set_parameters(&mInput->stream->common, keyValuePair.string());
+ mInput->stream->common.standby(&mInput->stream->common);
+ status = mInput->stream->common.set_parameters(&mInput->stream->common,
+ keyValuePair.string());
}
if (reconfig) {
if (status == BAD_VALUE &&
@@ -5284,8 +5366,8 @@
if (mSampleRate != mReqSampleRate && mChannelCount <= FCC_2 && mReqChannelCount <= FCC_2)
{
int channelCount;
- // optmization: if mono to mono, use the resampler in stereo to stereo mode to avoid
- // stereo to mono post process as the resampler always outputs stereo.
+ // optimization: if mono to mono, use the resampler in stereo to stereo mode to avoid
+ // stereo to mono post process as the resampler always outputs stereo.
if (mChannelCount == 1 && mReqChannelCount == 2) {
channelCount = 1;
} else {
@@ -5459,7 +5541,7 @@
{
// keep strong reference on the playback thread so that
// it is not destroyed while exit() is executed
- sp <PlaybackThread> thread;
+ sp<PlaybackThread> thread;
{
Mutex::Autolock _l(mLock);
thread = checkPlaybackThread_l(output);
@@ -5486,7 +5568,7 @@
if (thread->type() != ThreadBase::DUPLICATING) {
AudioStreamOut *out = thread->clearOutput();
- assert(out != NULL);
+ ALOG_ASSERT(out != NULL, "out shouldn't be NULL");
// from now on thread->mOutput is NULL
out->hwDev->close_output_stream(out->hwDev, out->stream);
delete out;
@@ -5612,7 +5694,7 @@
{
// keep strong reference on the record thread so that
// it is not destroyed while exit() is executed
- sp <RecordThread> thread;
+ sp<RecordThread> thread;
{
Mutex::Autolock _l(mLock);
thread = checkRecordThread_l(input);
@@ -5629,7 +5711,7 @@
// but the ThreadBase container still exists.
AudioStreamIn *in = thread->clearInput();
- assert(in != NULL);
+ ALOG_ASSERT(in != NULL, "in shouldn't be NULL");
// from now on thread->mInput is NULL
in->hwDev->close_input_stream(in->hwDev, in->stream);
delete in;
@@ -5745,7 +5827,7 @@
AudioSessionRef *ref = mAudioSessionRefs.itemAt(k);
if (ref->mSessionid == sessionid) {
ALOGV(" session %d still exists for %d with %d refs",
- sessionid, ref->mPid, ref->mCnt);
+ sessionid, ref->mPid, ref->mCnt);
found = true;
break;
}
@@ -5978,7 +6060,7 @@
// because of code checking output when entering the function.
// Note: io is never 0 when creating an effect on an input
if (io == 0) {
- // look for the thread where the specified audio session is present
+ // look for the thread where the specified audio session is present
for (size_t i = 0; i < mPlaybackThreads.size(); i++) {
if (mPlaybackThreads.valueAt(i)->hasAudioSession(sessionId) != 0) {
io = mPlaybackThreads.keyAt(i);
@@ -5986,12 +6068,12 @@
}
}
if (io == 0) {
- for (size_t i = 0; i < mRecordThreads.size(); i++) {
- if (mRecordThreads.valueAt(i)->hasAudioSession(sessionId) != 0) {
- io = mRecordThreads.keyAt(i);
- break;
- }
- }
+ for (size_t i = 0; i < mRecordThreads.size(); i++) {
+ if (mRecordThreads.valueAt(i)->hasAudioSession(sessionId) != 0) {
+ io = mRecordThreads.keyAt(i);
+ break;
+ }
+ }
}
// If no output thread contains the requested session ID, default to
// first output. The effect chain will be moved to the correct output
@@ -6022,7 +6104,7 @@
}
Exit:
- if(status) {
+ if (status != NULL) {
*status = lStatus;
}
return handle;
@@ -6225,7 +6307,7 @@
handle.clear();
}
- if(status) {
+ if (status != NULL) {
*status = lStatus;
}
return handle;
@@ -6295,7 +6377,7 @@
}
void AudioFlinger::ThreadBase::lockEffectChains_l(
- Vector<sp <AudioFlinger::EffectChain> >& effectChains)
+ Vector< sp<AudioFlinger::EffectChain> >& effectChains)
{
effectChains = mEffectChains;
for (size_t i = 0; i < mEffectChains.size(); i++) {
@@ -6304,7 +6386,7 @@
}
void AudioFlinger::ThreadBase::unlockEffectChains(
- const Vector<sp <AudioFlinger::EffectChain> >& effectChains)
+ const Vector< sp<AudioFlinger::EffectChain> >& effectChains)
{
for (size_t i = 0; i < effectChains.size(); i++) {
effectChains[i]->unlock();
@@ -6480,7 +6562,7 @@
void AudioFlinger::PlaybackThread::detachAuxEffect_l(int effectId)
{
- for (size_t i = 0; i < mTracks.size(); ++i) {
+ for (size_t i = 0; i < mTracks.size(); ++i) {
sp<Track> track = mTracks[i];
if (track->auxEffectId() == effectId) {
attachAuxEffect_l(track, 0);
@@ -7264,7 +7346,7 @@
if (mCblk != NULL) {
new(mCblk) effect_param_cblk_t();
mBuffer = (uint8_t *)mCblk + bufOffset;
- }
+ }
} else {
ALOGE("not enough memory for Effect size=%u", EFFECT_PARAM_BUFFER_SIZE + sizeof(effect_param_cblk_t));
return;
@@ -8031,7 +8113,7 @@
}
}
ALOGV("checkSuspendOnEffectEnabled() enable suspending fx %08x",
- effect->desc().type.timeLow);
+ effect->desc().type.timeLow);
sp<SuspendedEffectDesc> desc = mSuspendedEffects.valueAt(index);
// if effect is requested to suspended but was not yet enabled, supend it now.
if (desc->mEffect == 0) {
@@ -8044,7 +8126,7 @@
return;
}
ALOGV("checkSuspendOnEffectEnabled() disable restoring fx %08x",
- effect->desc().type.timeLow);
+ effect->desc().type.timeLow);
sp<SuspendedEffectDesc> desc = mSuspendedEffects.valueAt(index);
desc->mEffect.clear();
effect->setSuspended(false);
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index f3c8dd2..0e4b24aa 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -465,9 +465,9 @@
// ThreadBase mutex before processing the mixer and effects. This guarantees the
// integrity of the chains during the process.
// Also sets the parameter 'effectChains' to current value of mEffectChains.
- void lockEffectChains_l(Vector<sp <EffectChain> >& effectChains);
+ void lockEffectChains_l(Vector< sp<EffectChain> >& effectChains);
// unlock effect chains after process
- void unlockEffectChains(const Vector<sp<EffectChain> >& effectChains);
+ void unlockEffectChains(const Vector< sp<EffectChain> >& effectChains);
// set audio mode to all effect chains
void setMode(audio_mode_t mode);
// get effect module with corresponding ID on specified audio session
@@ -1056,7 +1056,7 @@
virtual uint32_t activeSleepTimeUs();
private:
- bool outputsReady(const SortedVector<sp<OutputTrack> > &outputTracks);
+ bool outputsReady(const SortedVector< sp<OutputTrack> > &outputTracks);
protected:
// threadLoop snippets
virtual void threadLoop_mix();
@@ -1504,7 +1504,7 @@
uint32_t strategy() const { return mStrategy; }
void setStrategy(uint32_t strategy)
- { mStrategy = strategy; }
+ { mStrategy = strategy; }
// suspend effect of the given type
void setEffectSuspended_l(const effect_uuid_t *type,
@@ -1544,7 +1544,7 @@
wp<ThreadBase> mThread; // parent mixer thread
Mutex mLock; // mutex protecting effect list
- Vector<sp<EffectModule> > mEffects; // list of effect modules
+ Vector< sp<EffectModule> > mEffects; // list of effect modules
int mSessionId; // audio session ID
int16_t *mInBuffer; // chain input buffer
int16_t *mOutBuffer; // chain output buffer
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index 2cec525..1ec238b 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -18,7 +18,6 @@
#define LOG_TAG "AudioMixer"
//#define LOG_NDEBUG 0
-#include <assert.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
@@ -29,6 +28,7 @@
#include <cutils/bitops.h>
#include <cutils/compiler.h>
+#include <utils/Debug.h>
#include <system/audio.h>
@@ -46,7 +46,7 @@
: mTrackNames(0), mSampleRate(sampleRate)
{
// AudioMixer is not yet capable of multi-channel beyond stereo
- assert(2 == MAX_NUM_CHANNELS);
+ COMPILE_TIME_ASSERT_FUNCTION_SCOPE(2 == MAX_NUM_CHANNELS);
LocalClock lc;
@@ -124,7 +124,7 @@
void AudioMixer::deleteTrackName(int name)
{
name -= TRACK0;
- assert(uint32_t(name) < MAX_NUM_TRACKS);
+ ALOG_ASSERT(uint32_t(name) < MAX_NUM_TRACKS, "bad track name %d", name);
ALOGV("deleteTrackName(%d)", name);
track_t& track(mState.tracks[ name ]);
if (track.enabled) {
@@ -146,7 +146,7 @@
void AudioMixer::enable(int name)
{
name -= TRACK0;
- assert(uint32_t(name) < MAX_NUM_TRACKS);
+ ALOG_ASSERT(uint32_t(name) < MAX_NUM_TRACKS, "bad track name %d", name);
track_t& track = mState.tracks[name];
if (!track.enabled) {
@@ -159,7 +159,7 @@
void AudioMixer::disable(int name)
{
name -= TRACK0;
- assert(uint32_t(name) < MAX_NUM_TRACKS);
+ ALOG_ASSERT(uint32_t(name) < MAX_NUM_TRACKS, "bad track name %d", name);
track_t& track = mState.tracks[name];
if (track.enabled) {
@@ -172,7 +172,7 @@
void AudioMixer::setParameter(int name, int target, int param, void *value)
{
name -= TRACK0;
- assert(uint32_t(name) < MAX_NUM_TRACKS);
+ ALOG_ASSERT(uint32_t(name) < MAX_NUM_TRACKS, "bad track name %d", name);
track_t& track = mState.tracks[name];
int valueInt = (int)value;
@@ -185,8 +185,9 @@
case CHANNEL_MASK: {
uint32_t mask = (uint32_t)value;
if (track.channelMask != mask) {
- uint8_t channelCount = popcount(mask);
- assert((channelCount <= MAX_NUM_CHANNELS) && (channelCount));
+ uint32_t channelCount = popcount(mask);
+ ALOG_ASSERT((channelCount <= MAX_NUM_CHANNELS) && (channelCount),
+ "bad channel count %u", channelCount);
track.channelMask = mask;
track.channelCount = channelCount;
ALOGV("setParameter(TRACK, CHANNEL_MASK, %x)", mask);
@@ -208,15 +209,14 @@
}
break;
default:
- // bad param
- assert(false);
+ LOG_FATAL("bad param");
}
break;
case RESAMPLE:
switch (param) {
case SAMPLE_RATE:
- assert(valueInt > 0);
+ ALOG_ASSERT(valueInt > 0, "bad sample rate %d", valueInt);
if (track.setResampler(uint32_t(valueInt), mSampleRate)) {
ALOGV("setParameter(RESAMPLE, SAMPLE_RATE, %u)",
uint32_t(valueInt));
@@ -228,8 +228,7 @@
invalidateState(1 << name);
break;
default:
- // bad param
- assert(false);
+ LOG_FATAL("bad param");
}
break;
@@ -257,7 +256,7 @@
}
break;
case AUXLEVEL:
- //assert(0 <= valueInt && valueInt <= MAX_GAIN_INT);
+ //ALOG_ASSERT(0 <= valueInt && valueInt <= MAX_GAIN_INT, "bad aux level %d", valueInt);
if (track.auxLevel != valueInt) {
ALOGV("setParameter(VOLUME, AUXLEVEL: %04x)", valueInt);
track.prevAuxLevel = track.auxLevel << 16;
@@ -277,14 +276,12 @@
}
break;
default:
- // bad param
- assert(false);
+ LOG_FATAL("bad param");
}
break;
default:
- // bad target
- assert(false);
+ LOG_FATAL("bad target");
}
}
@@ -335,7 +332,7 @@
void AudioMixer::setBufferProvider(int name, AudioBufferProvider* bufferProvider)
{
name -= TRACK0;
- assert(uint32_t(name) < MAX_NUM_TRACKS);
+ ALOG_ASSERT(uint32_t(name) < MAX_NUM_TRACKS, "bad track name %d", name);
mState.tracks[name].bufferProvider = bufferProvider;
}
@@ -979,9 +976,9 @@
// This method is only called when state->enabledTracks has exactly
// one bit set. The asserts below would verify this, but are commented out
// since the whole point of this method is to optimize performance.
- //assert(0 != state->enabledTracks);
+ //ALOG_ASSERT(0 != state->enabledTracks, "no tracks enabled");
const int i = 31 - __builtin_clz(state->enabledTracks);
- //assert((1 << i) == state->enabledTracks);
+ //ALOG_ASSERT((1 << i) == state->enabledTracks, "more than 1 track enabled");
const track_t& t = state->tracks[i];
AudioBufferProvider::Buffer& b(t.buffer);
diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp
index d57326b..c23eb04 100644
--- a/services/audioflinger/AudioPolicyService.cpp
+++ b/services/audioflinger/AudioPolicyService.cpp
@@ -649,7 +649,7 @@
mLock.lock();
while (!exitPending())
{
- while(!mAudioCommands.isEmpty()) {
+ while (!mAudioCommands.isEmpty()) {
nsecs_t curTime = systemTime();
// commands are sorted by increasing time stamp: execute them from index 0 and up
if (mAudioCommands[0]->mTime <= curTime) {
@@ -693,16 +693,16 @@
delete data;
}break;
case SET_PARAMETERS: {
- ParametersData *data = (ParametersData *)command->mParam;
- ALOGV("AudioCommandThread() processing set parameters string %s, io %d",
- data->mKeyValuePairs.string(), data->mIO);
- command->mStatus = AudioSystem::setParameters(data->mIO, data->mKeyValuePairs);
- if (command->mWaitStatus) {
- command->mCond.signal();
- mWaitWorkCV.wait(mLock);
- }
- delete data;
- }break;
+ ParametersData *data = (ParametersData *)command->mParam;
+ ALOGV("AudioCommandThread() processing set parameters string %s, io %d",
+ data->mKeyValuePairs.string(), data->mIO);
+ command->mStatus = AudioSystem::setParameters(data->mIO, data->mKeyValuePairs);
+ if (command->mWaitStatus) {
+ command->mCond.signal();
+ mWaitWorkCV.wait(mLock);
+ }
+ delete data;
+ }break;
case SET_VOICE_VOLUME: {
VoiceVolumeData *data = (VoiceVolumeData *)command->mParam;
ALOGV("AudioCommandThread() processing set voice volume volume %f",
@@ -916,19 +916,19 @@
AudioParameter param = AudioParameter(data->mKeyValuePairs);
AudioParameter param2 = AudioParameter(data2->mKeyValuePairs);
for (size_t j = 0; j < param.size(); j++) {
- String8 key;
- String8 value;
- param.getAt(j, key, value);
- for (size_t k = 0; k < param2.size(); k++) {
- String8 key2;
- String8 value2;
- param2.getAt(k, key2, value2);
- if (key2 == key) {
- param2.remove(key2);
- ALOGV("Filtering out parameter %s", key2.string());
- break;
- }
- }
+ String8 key;
+ String8 value;
+ param.getAt(j, key, value);
+ for (size_t k = 0; k < param2.size(); k++) {
+ String8 key2;
+ String8 value2;
+ param2.getAt(k, key2, value2);
+ if (key2 == key) {
+ param2.remove(key2);
+ ALOGV("Filtering out parameter %s", key2.string());
+ break;
+ }
+ }
}
// if all keys have been filtered out, remove the command.
// otherwise, update the key value pairs
@@ -1020,7 +1020,7 @@
ALOGE("startTone: illegal tone requested (%d)", tone);
if (stream != AUDIO_STREAM_VOICE_CALL)
ALOGE("startTone: illegal stream (%d) requested for tone %d", stream,
- tone);
+ tone);
mTonePlaybackThread->startToneCommand(ToneGenerator::TONE_SUP_CALL_WAITING,
AUDIO_STREAM_VOICE_CALL);
return 0;
diff --git a/services/audioflinger/AudioPolicyService.h b/services/audioflinger/AudioPolicyService.h
index 7119b90..9ed905d 100644
--- a/services/audioflinger/AudioPolicyService.h
+++ b/services/audioflinger/AudioPolicyService.h
@@ -311,8 +311,8 @@
mutable Mutex mLock; // prevents concurrent access to AudioPolicy manager functions changing
// device connection state or routing
- sp <AudioCommandThread> mAudioCommandThread; // audio commands thread
- sp <AudioCommandThread> mTonePlaybackThread; // tone playback thread
+ sp<AudioCommandThread> mAudioCommandThread; // audio commands thread
+ sp<AudioCommandThread> mTonePlaybackThread; // tone playback thread
struct audio_policy_device *mpAudioPolicyDev;
struct audio_policy *mpAudioPolicy;
KeyedVector< audio_source_t, InputSourceDesc* > mInputSources;
diff --git a/services/audioflinger/AudioResampler.cpp b/services/audioflinger/AudioResampler.cpp
index 398ba0b..fbb54cf 100644
--- a/services/audioflinger/AudioResampler.cpp
+++ b/services/audioflinger/AudioResampler.cpp
@@ -227,7 +227,7 @@
mX0L = mBuffer.i16[mBuffer.frameCount*2-2];
mX0R = mBuffer.i16[mBuffer.frameCount*2-1];
provider->releaseBuffer(&mBuffer);
- // mBuffer.frameCount == 0 now so we reload a new buffer
+ // mBuffer.frameCount == 0 now so we reload a new buffer
}
int16_t *in = mBuffer.i16;
diff --git a/services/audioflinger/AudioResampler.h b/services/audioflinger/AudioResampler.h
index 9deb796..1610e00 100644
--- a/services/audioflinger/AudioResampler.h
+++ b/services/audioflinger/AudioResampler.h
@@ -33,7 +33,7 @@
// HIGH_QUALITY: fixed multi-tap FIR (e.g. 48KHz->44.1KHz)
// NOTE: high quality SRC will only be supported for
// certain fixed rate conversions. Sample rate cannot be
- // changed dynamically.
+ // changed dynamically.
enum src_quality {
DEFAULT=0,
LOW_QUALITY=1,
diff --git a/services/audioflinger/AudioResamplerCubic.h b/services/audioflinger/AudioResamplerCubic.h
index b72b62a..892785a 100644
--- a/services/audioflinger/AudioResamplerCubic.h
+++ b/services/audioflinger/AudioResamplerCubic.h
@@ -55,7 +55,7 @@
p->y1 = p->y2;
p->y2 = p->y3;
p->y3 = in;
- p->a = (3 * (p->y1 - p->y2) - p->y0 + p->y3) >> 1;
+ p->a = (3 * (p->y1 - p->y2) - p->y0 + p->y3) >> 1;
p->b = (p->y2 << 1) + p->y0 - (((5 * p->y1 + p->y3)) >> 1);
p->c = (p->y2 - p->y0) >> 1;
}
diff --git a/services/audioflinger/AudioResamplerSinc.cpp b/services/audioflinger/AudioResamplerSinc.cpp
index d373c08..76662d8 100644
--- a/services/audioflinger/AudioResamplerSinc.cpp
+++ b/services/audioflinger/AudioResamplerSinc.cpp
@@ -222,7 +222,7 @@
} else {
read<CHANNELS>(impulse, phaseFraction, mBuffer.i16, inputIndex);
}
- }
+ }
}
int16_t *in = mBuffer.i16;
const size_t frameCount = mBuffer.frameCount;
@@ -247,7 +247,7 @@
if (inputIndex >= frameCount)
break; // need a new buffer
read<CHANNELS>(impulse, phaseFraction, in, inputIndex);
- } else if(phaseIndex == 2) { // maximum value
+ } else if (phaseIndex == 2) { // maximum value
inputIndex++;
if (inputIndex >= frameCount)
break; // 0 frame available, 2 frames needed
diff --git a/services/camera/libcameraservice/Android.mk b/services/camera/libcameraservice/Android.mk
index e35435e..3cae1f5 100644
--- a/services/camera/libcameraservice/Android.mk
+++ b/services/camera/libcameraservice/Android.mk
@@ -15,6 +15,7 @@
libbinder \
libcutils \
libmedia \
+ libmedia_native \
libcamera_client \
libgui \
libhardware
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index adf1d49..22836e3 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <sys/types.h>
#include <pthread.h>
+#include <time.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
@@ -33,6 +34,7 @@
#include <hardware/hardware.h>
#include <media/AudioSystem.h>
#include <media/mediaplayer.h>
+#include <utils/Condition.h>
#include <utils/Errors.h>
#include <utils/Log.h>
#include <utils/String16.h>
@@ -42,6 +44,8 @@
namespace android {
+#define WAIT_RELEASE_TIMEOUT 250 // 250ms
+
// ----------------------------------------------------------------------------
// Logging support -- this is for debugging only
// Use "adb shell dumpsys media.camera -v 1" to change it.
@@ -64,6 +68,13 @@
return IPCThreadState::self()->getCallingUid();
}
+static long long getTimeInMs() {
+ struct timeval t;
+ t.tv_sec = t.tv_usec = 0;
+ gettimeofday(&t, NULL);
+ return t.tv_sec * 1000LL + t.tv_usec / 1000;
+}
+
// ----------------------------------------------------------------------------
// This is ugly and only safe if we never re-create the CameraService, but
@@ -131,7 +142,7 @@
}
sp<ICamera> CameraService::connect(
- const sp<ICameraClient>& cameraClient, int cameraId) {
+ const sp<ICameraClient>& cameraClient, int cameraId, bool force, bool keep) {
int callingPid = getCallingPid();
sp<CameraHardwareInterface> hardware = NULL;
@@ -157,27 +168,73 @@
return NULL;
}
- Mutex::Autolock lock(mServiceLock);
- if (mClient[cameraId] != 0) {
- client = mClient[cameraId].promote();
- if (client != 0) {
- if (cameraClient->asBinder() == client->getCameraClient()->asBinder()) {
- LOG1("CameraService::connect X (pid %d) (the same client)",
- callingPid);
- return client;
- } else {
- ALOGW("CameraService::connect X (pid %d) rejected (existing client).",
- callingPid);
- return NULL;
- }
- }
- mClient[cameraId].clear();
+ if (keep && !checkCallingPermission(String16("android.permission.KEEP_CAMERA"))) {
+ ALOGE("connect X (pid %d) rejected (no KEEP_CAMERA permission).", callingPid);
+ return NULL;
}
- if (mBusy[cameraId]) {
- ALOGW("CameraService::connect X (pid %d) rejected"
- " (camera %d is still busy).", callingPid, cameraId);
- return NULL;
+ Mutex::Autolock lock(mServiceLock);
+ // Check if there is an existing client.
+ client = mClient[cameraId].promote();
+ if (client != 0 &&
+ cameraClient->asBinder() == client->getCameraClient()->asBinder()) {
+ LOG1("connect X (pid %d) (the same client)", callingPid);
+ return client;
+ }
+
+ if (!force) {
+ if (mClient[cameraId].promote() != 0) {
+ ALOGW("connect X (pid %d) rejected (existing client).", callingPid);
+ return NULL;
+ }
+ mClient[cameraId].clear();
+ if (mBusy[cameraId]) {
+ ALOGW("connect X (pid %d) rejected (camera %d is still busy).",
+ callingPid, cameraId);
+ return NULL;
+ }
+ } else { // force == true
+ int i = 0;
+ long long start_time = getTimeInMs();
+ while (i < mNumberOfCameras) {
+ if (getTimeInMs() - start_time >= 3000LL) {
+ ALOGE("connect X (pid %d) rejected (timeout 3s)", callingPid);
+ return NULL;
+ }
+
+ client = mClient[i].promote();
+ if (client != 0) {
+ if (client->keep()) {
+ ALOGW("connect X (pid %d) rejected (existing client wants to keeps the camera)",
+ callingPid);
+ return NULL;
+ } else {
+ ALOGW("New client (pid %d, id=%d). Disconnect the existing client (id=%d).",
+ callingPid, cameraId, i);
+ // Do not hold mServiceLock because disconnect will try to get it.
+ mServiceLock.unlock();
+ client->notifyCallback(CAMERA_MSG_ERROR, CAMERA_ERROR_RELEASED, 0, &i);
+ client->waitRelease(WAIT_RELEASE_TIMEOUT);
+ client->disconnectInternal(false);
+ mServiceLock.lock();
+ // Restart from the first client because a new client may have connected
+ // when mServiceLock is unlocked.
+ i = 0;
+ continue;
+ }
+ }
+
+ if (mBusy[i]) {
+ // Give the client a chance to release the hardware.
+ mServiceLock.unlock();
+ usleep(10 * 1000);
+ mServiceLock.lock();
+ i = 0; // Restart from the first client
+ continue;
+ }
+
+ i++;
+ }
}
struct camera_info info;
@@ -195,9 +252,15 @@
return NULL;
}
- client = new Client(this, cameraClient, hardware, cameraId, info.facing, callingPid);
+ client = new Client(this, cameraClient, hardware, cameraId, info.facing,
+ callingPid, keep);
+ // We need to clear the hardware here. After the destructor of mServiceLock
+ // finishes, a new client may connect and disconnect this client. If this
+ // reference is not cleared, the destructor of CameraHardwareInterface
+ // cannot run. The new client will not be able to connect.
+ hardware.clear();
mClient[cameraId] = client;
- LOG1("CameraService::connect X");
+ LOG1("CameraService::connect X (id %d)", cameraId);
return client;
}
@@ -331,9 +394,9 @@
CameraService::Client::Client(const sp<CameraService>& cameraService,
const sp<ICameraClient>& cameraClient,
const sp<CameraHardwareInterface>& hardware,
- int cameraId, int cameraFacing, int clientPid) {
+ int cameraId, int cameraFacing, int clientPid, bool keep) {
int callingPid = getCallingPid();
- LOG1("Client::Client E (pid %d)", callingPid);
+ LOG1("Client::Client E (pid %d, id %d)", callingPid, cameraId);
mCameraService = cameraService;
mCameraClient = cameraClient;
@@ -341,6 +404,7 @@
mCameraId = cameraId;
mCameraFacing = cameraFacing;
mClientPid = clientPid;
+ mKeep = keep;
mMsgEnabled = 0;
mSurface = 0;
mPreviewWindow = 0;
@@ -359,7 +423,7 @@
mPlayShutterSound = true;
cameraService->setCameraBusy(cameraId);
cameraService->loadSound();
- LOG1("Client::Client X (pid %d)", callingPid);
+ LOG1("Client::Client X (pid %d, id %d)", callingPid, cameraId);
}
// tear down the client
@@ -468,18 +532,24 @@
}
void CameraService::Client::disconnect() {
+ disconnectInternal(true);
+}
+
+void CameraService::Client::disconnectInternal(bool needCheckPid) {
int callingPid = getCallingPid();
- LOG1("disconnect E (pid %d)", callingPid);
+ LOG1("disconnectInternal E (pid %d)", callingPid);
Mutex::Autolock lock(mLock);
- if (checkPid() != NO_ERROR) {
- ALOGW("different client - don't disconnect");
- return;
- }
+ if (needCheckPid) {
+ if (checkPid() != NO_ERROR) {
+ ALOGW("different client - don't disconnect");
+ return;
+ }
- if (mClientPid <= 0) {
- LOG1("camera is unlocked (mClientPid = %d), don't tear down hardware", mClientPid);
- return;
+ if (mClientPid <= 0) {
+ LOG1("camera is unlocked (mClientPid = %d), don't tear down hardware", mClientPid);
+ return;
+ }
}
// Make sure disconnect() is done once and once only, whether it is called
@@ -506,8 +576,16 @@
mCameraService->removeClient(mCameraClient);
mCameraService->setCameraFree(mCameraId);
+ mReleaseCondition.signal();
- LOG1("disconnect X (pid %d)", callingPid);
+ LOG1("disconnectInternal X (pid %d)", callingPid);
+}
+
+void CameraService::Client::waitRelease(int ms) {
+ Mutex::Autolock lock(mLock);
+ if (mHardware != 0) {
+ mReleaseCondition.waitRelative(mLock, ms * 1000000);
+ }
}
// ----------------------------------------------------------------------------
@@ -874,6 +952,9 @@
return OK;
} else if (cmd == CAMERA_CMD_PLAY_RECORDING_SOUND) {
mCameraService->playSound(SOUND_RECORDING);
+ } else if (cmd == CAMERA_CMD_PING) {
+ // If mHardware is 0, checkPidAndHardware will return error.
+ return OK;
}
return mHardware->sendCommand(cmd, arg1, arg2);
@@ -1217,6 +1298,10 @@
return -1;
}
+// Whether the client wants to keep the camera from taking
+bool CameraService::Client::keep() const {
+ return mKeep;
+}
// ----------------------------------------------------------------------------
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index bad41f5..457c79b 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -46,7 +46,8 @@
virtual int32_t getNumberOfCameras();
virtual status_t getCameraInfo(int cameraId,
struct CameraInfo* cameraInfo);
- virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient, int cameraId);
+ virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient, int cameraId,
+ bool force, bool keep);
virtual void removeClient(const sp<ICameraClient>& cameraClient);
virtual sp<Client> getClientById(int cameraId);
@@ -114,7 +115,8 @@
const sp<CameraHardwareInterface>& hardware,
int cameraId,
int cameraFacing,
- int clientPid);
+ int clientPid,
+ bool keep);
~Client();
// return our camera client
@@ -172,12 +174,19 @@
const sp<IBinder>& binder,
const sp<ANativeWindow>& window);
+ void disconnectInternal(bool needCheckPid);
+ bool keep() const;
+ void waitRelease(int ms);
+
+
// these are initialized in the constructor.
sp<CameraService> mCameraService; // immutable after constructor
sp<ICameraClient> mCameraClient;
int mCameraId; // immutable after constructor
int mCameraFacing; // immutable after constructor
pid_t mClientPid;
+ // Client wants to keep the camera from taking by other clients.
+ bool mKeep;
sp<CameraHardwareInterface> mHardware; // cleared after disconnect()
int mPreviewCallbackFlag;
int mOrientation; // Current display orientation
@@ -185,6 +194,8 @@
// Ensures atomicity among the public methods
mutable Mutex mLock;
+ // This will get notified when the hardware is released.
+ Condition mReleaseCondition;
// This is a binder of Surface or SurfaceTexture.
sp<IBinder> mSurface;
sp<ANativeWindow> mPreviewWindow;
diff --git a/services/java/com/android/server/NativeDaemonConnector.java b/services/java/com/android/server/NativeDaemonConnector.java
index 6593a0f..0b5eaff 100644
--- a/services/java/com/android/server/NativeDaemonConnector.java
+++ b/services/java/com/android/server/NativeDaemonConnector.java
@@ -200,17 +200,15 @@
/**
* Make command for daemon, escaping arguments as needed.
- *
- * @return the final command.
*/
- private StringBuilder makeCommand(String cmd, Object... args)
+ private void makeCommand(StringBuilder builder, String cmd, Object... args)
throws NativeDaemonConnectorException {
// TODO: eventually enforce that cmd doesn't contain arguments
if (cmd.indexOf('\0') >= 0) {
throw new IllegalArgumentException("unexpected command: " + cmd);
}
- final StringBuilder builder = new StringBuilder(cmd);
+ builder.append(cmd);
for (Object arg : args) {
final String argString = String.valueOf(arg);
if (argString.indexOf('\0') >= 0) {
@@ -220,34 +218,6 @@
builder.append(' ');
appendEscaped(builder, argString);
}
-
- return builder;
- }
-
- private int sendCommand(StringBuilder builder)
- throws NativeDaemonConnectorException {
-
- int sequenceNumber = mSequenceNumber.incrementAndGet();
-
- builder.insert(0, Integer.toString(sequenceNumber) + " ");
-
- log("SND -> {" + builder.toString() + "}");
-
- builder.append('\0');
-
- synchronized (mDaemonLock) {
- if (mOutputStream == null) {
- throw new NativeDaemonConnectorException("missing output stream");
- } else {
- try {
- mOutputStream.write(builder.toString().getBytes(Charsets.UTF_8));
- } catch (IOException e) {
- throw new NativeDaemonConnectorException("problem sending command", e);
- }
- }
- }
-
- return sequenceNumber;
}
/**
@@ -325,25 +295,46 @@
public NativeDaemonEvent[] execute(int timeout, String cmd, Object... args)
throws NativeDaemonConnectorException {
final ArrayList<NativeDaemonEvent> events = Lists.newArrayList();
- final StringBuilder sentCommand = makeCommand(cmd, args);
- final int cmdNumber = sendCommand(sentCommand);
+
+ final int sequenceNumber = mSequenceNumber.incrementAndGet();
+ final StringBuilder cmdBuilder =
+ new StringBuilder(Integer.toString(sequenceNumber)).append(' ');
+
+ makeCommand(cmdBuilder, cmd, args);
+
+ final String logCmd = cmdBuilder.toString(); /* includes cmdNum, cmd, args */
+ log("SND -> {" + logCmd + "}");
+
+ cmdBuilder.append('\0');
+ final String sentCmd = cmdBuilder.toString(); /* logCmd + \0 */
+
+ synchronized (mDaemonLock) {
+ if (mOutputStream == null) {
+ throw new NativeDaemonConnectorException("missing output stream");
+ } else {
+ try {
+ mOutputStream.write(sentCmd.getBytes(Charsets.UTF_8));
+ } catch (IOException e) {
+ throw new NativeDaemonConnectorException("problem sending command", e);
+ }
+ }
+ }
NativeDaemonEvent event = null;
- cmd = sentCommand.toString();
do {
- event = mResponseQueue.remove(cmdNumber, timeout, cmd);
+ event = mResponseQueue.remove(sequenceNumber, timeout, sentCmd);
if (event == null) {
- loge("timed-out waiting for response to " + cmdNumber + " " + cmd);
- throw new NativeDaemonFailureException(cmd, event);
+ loge("timed-out waiting for response to " + logCmd);
+ throw new NativeDaemonFailureException(logCmd, event);
}
events.add(event);
} while (event.isClassContinue());
if (event.isClassClientError()) {
- throw new NativeDaemonArgumentException(cmd, event);
+ throw new NativeDaemonArgumentException(logCmd, event);
}
if (event.isClassServerError()) {
- throw new NativeDaemonFailureException(cmd, event);
+ throw new NativeDaemonFailureException(logCmd, event);
}
return events.toArray(new NativeDaemonEvent[events.size()]);
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index 63418db..52a4110 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -1858,6 +1858,7 @@
} else {
// Update the lights *before* taking care of turning the
// screen off, so we can initiate any animations that are desired.
+ mScreenOffReason = reason;
if (stateChanged) {
updateLightsLocked(newState, 0);
}
@@ -1876,7 +1877,6 @@
Binder.restoreCallingIdentity(identity);
}
mPowerState &= ~SCREEN_ON_BIT;
- mScreenOffReason = reason;
if (!mScreenBrightnessAnimator.isAnimating()) {
err = screenOffFinishedAnimatingLocked(reason);
} else {
diff --git a/services/java/com/android/server/UiModeManagerService.java b/services/java/com/android/server/UiModeManagerService.java
index c5c2901..84daead 100644
--- a/services/java/com/android/server/UiModeManagerService.java
+++ b/services/java/com/android/server/UiModeManagerService.java
@@ -189,8 +189,8 @@
}
try {
ActivityManagerNative.getDefault().startActivityWithConfig(
- null, homeIntent, null, null, 0, null, null, 0, false, false,
- newConfig);
+ null, homeIntent, null, null, null, 0, 0,
+ newConfig, null);
mHoldingConfiguration = false;
} catch (RemoteException e) {
Slog.w(TAG, e.getCause());
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 94b9e91..d21212f 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -110,6 +110,7 @@
import android.os.SystemProperties;
import android.os.UserId;
import android.provider.Settings;
+import android.text.format.Time;
import android.util.EventLog;
import android.util.Pair;
import android.util.Slog;
@@ -197,6 +198,8 @@
private static final String SYSTEM_DEBUGGABLE = "ro.debuggable";
+ static final boolean IS_USER_BUILD = "user".equals(Build.TYPE);
+
// Maximum number of recent tasks that we can remember.
static final int MAX_RECENT_TASKS = 20;
@@ -286,9 +289,7 @@
static class PendingActivityLaunch {
ActivityRecord r;
ActivityRecord sourceRecord;
- Uri[] grantedUriPermissions;
- int grantedMode;
- boolean onlyIfNeeded;
+ int startFlags;
}
final ArrayList<PendingActivityLaunch> mPendingActivityLaunches
@@ -2095,8 +2096,8 @@
aInfo.applicationInfo.uid);
if (app == null || app.instrumentationClass == null) {
intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK);
- mMainStack.startActivityLocked(null, intent, null, null, 0, aInfo,
- null, null, 0, 0, 0, false, false, null);
+ mMainStack.startActivityLocked(null, intent, null, aInfo,
+ null, null, 0, 0, 0, 0, null, false, null);
}
}
@@ -2150,8 +2151,8 @@
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setComponent(new ComponentName(
ri.activityInfo.packageName, ri.activityInfo.name));
- mMainStack.startActivityLocked(null, intent, null, null, 0, ri.activityInfo,
- null, null, 0, 0, 0, false, false, null);
+ mMainStack.startActivityLocked(null, intent, null, ri.activityInfo,
+ null, null, 0, 0, 0, 0, null, false, null);
}
}
}
@@ -2257,18 +2258,15 @@
for (int i=0; i<N; i++) {
PendingActivityLaunch pal = mPendingActivityLaunches.get(i);
mMainStack.startActivityUncheckedLocked(pal.r, pal.sourceRecord,
- pal.grantedUriPermissions, pal.grantedMode, pal.onlyIfNeeded,
- doResume && i == (N-1));
+ pal.startFlags, doResume && i == (N-1), null);
}
mPendingActivityLaunches.clear();
}
public final int startActivity(IApplicationThread caller,
- Intent intent, String resolvedType, Uri[] grantedUriPermissions,
- int grantedMode, IBinder resultTo,
- String resultWho, int requestCode, boolean onlyIfNeeded, boolean debug,
- boolean openglTrace, String profileFile, ParcelFileDescriptor profileFd,
- boolean autoStopProfiler) {
+ Intent intent, String resolvedType, IBinder resultTo,
+ String resultWho, int requestCode, int startFlags,
+ String profileFile, ParcelFileDescriptor profileFd, Bundle options) {
enforceNotIsolatedCaller("startActivity");
int userId = 0;
if (intent.getCategories() != null && intent.getCategories().contains(Intent.CATEGORY_HOME)) {
@@ -2285,43 +2283,38 @@
}
}
return mMainStack.startActivityMayWait(caller, -1, intent, resolvedType,
- grantedUriPermissions, grantedMode, resultTo, resultWho, requestCode, onlyIfNeeded,
- debug, openglTrace, profileFile, profileFd, autoStopProfiler, null, null, userId);
+ resultTo, resultWho, requestCode, startFlags, profileFile, profileFd,
+ null, null, options, userId);
}
public final WaitResult startActivityAndWait(IApplicationThread caller,
- Intent intent, String resolvedType, Uri[] grantedUriPermissions,
- int grantedMode, IBinder resultTo,
- String resultWho, int requestCode, boolean onlyIfNeeded, boolean debug,
- boolean openglTrace, String profileFile, ParcelFileDescriptor profileFd,
- boolean autoStopProfiler) {
+ Intent intent, String resolvedType, IBinder resultTo,
+ String resultWho, int requestCode, int startFlags, String profileFile,
+ ParcelFileDescriptor profileFd, Bundle options) {
enforceNotIsolatedCaller("startActivityAndWait");
WaitResult res = new WaitResult();
int userId = Binder.getOrigCallingUser();
mMainStack.startActivityMayWait(caller, -1, intent, resolvedType,
- grantedUriPermissions, grantedMode, resultTo, resultWho,
- requestCode, onlyIfNeeded, debug, openglTrace, profileFile, profileFd, autoStopProfiler,
- res, null, userId);
+ resultTo, resultWho, requestCode, startFlags, profileFile, profileFd,
+ res, null, options, userId);
return res;
}
public final int startActivityWithConfig(IApplicationThread caller,
- Intent intent, String resolvedType, Uri[] grantedUriPermissions,
- int grantedMode, IBinder resultTo,
- String resultWho, int requestCode, boolean onlyIfNeeded,
- boolean debug, Configuration config) {
+ Intent intent, String resolvedType, IBinder resultTo,
+ String resultWho, int requestCode, int startFlags, Configuration config,
+ Bundle options) {
enforceNotIsolatedCaller("startActivityWithConfig");
int ret = mMainStack.startActivityMayWait(caller, -1, intent, resolvedType,
- grantedUriPermissions, grantedMode, resultTo, resultWho,
- requestCode, onlyIfNeeded,
- debug, false, null, null, false, null, config, Binder.getOrigCallingUser());
+ resultTo, resultWho, requestCode, startFlags,
+ null, null, null, config, options, Binder.getOrigCallingUser());
return ret;
}
public int startActivityIntentSender(IApplicationThread caller,
IntentSender intent, Intent fillInIntent, String resolvedType,
IBinder resultTo, String resultWho, int requestCode,
- int flagsMask, int flagsValues) {
+ int flagsMask, int flagsValues, Bundle options) {
enforceNotIsolatedCaller("startActivityIntentSender");
// Refuse possible leaked file descriptors
if (fillInIntent != null && fillInIntent.hasFileDescriptors()) {
@@ -2344,13 +2337,13 @@
mAppSwitchesAllowedTime = 0;
}
}
- int ret = pir.sendInner(0, fillInIntent, resolvedType, null,
- null, resultTo, resultWho, requestCode, flagsMask, flagsValues);
+ int ret = pir.sendInner(0, fillInIntent, resolvedType, null, null,
+ resultTo, resultWho, requestCode, flagsMask, flagsValues, options);
return ret;
}
public boolean startNextMatchingActivity(IBinder callingActivity,
- Intent intent) {
+ Intent intent, Bundle options) {
// Refuse possible leaked file descriptors
if (intent != null && intent.hasFileDescriptors() == true) {
throw new IllegalArgumentException("File descriptors passed in Intent");
@@ -2430,13 +2423,13 @@
// XXX we are not dealing with propagating grantedUriPermissions...
// those are not yet exposed to user code, so there is no need.
int res = mMainStack.startActivityLocked(r.app.thread, intent,
- r.resolvedType, null, 0, aInfo,
- resultTo != null ? resultTo.appToken : null, resultWho,
- requestCode, -1, r.launchedFromUid, false, false, null);
+ r.resolvedType, aInfo, resultTo != null ? resultTo.appToken : null,
+ resultWho, requestCode, -1, r.launchedFromUid, 0,
+ options, false, null);
Binder.restoreCallingIdentity(origId);
r.finishing = wasFinishing;
- if (res != START_SUCCESS) {
+ if (res != ActivityManager.START_SUCCESS) {
return false;
}
return true;
@@ -2445,7 +2438,7 @@
public final int startActivityInPackage(int uid,
Intent intent, String resolvedType, IBinder resultTo,
- String resultWho, int requestCode, boolean onlyIfNeeded) {
+ String resultWho, int requestCode, int startFlags, Bundle options) {
// This is so super not safe, that only the system (or okay root)
// can do it.
@@ -2457,21 +2450,22 @@
}
int ret = mMainStack.startActivityMayWait(null, uid, intent, resolvedType,
- null, 0, resultTo, resultWho, requestCode, onlyIfNeeded, false, false,
- null, null, false, null, null, userId);
+ resultTo, resultWho, requestCode, startFlags,
+ null, null, null, null, options, userId);
return ret;
}
public final int startActivities(IApplicationThread caller,
- Intent[] intents, String[] resolvedTypes, IBinder resultTo) {
+ Intent[] intents, String[] resolvedTypes, IBinder resultTo, Bundle options) {
enforceNotIsolatedCaller("startActivities");
int ret = mMainStack.startActivities(caller, -1, intents, resolvedTypes, resultTo,
- Binder.getOrigCallingUser());
+ options, Binder.getOrigCallingUser());
return ret;
}
public final int startActivitiesInPackage(int uid,
- Intent[] intents, String[] resolvedTypes, IBinder resultTo) {
+ Intent[] intents, String[] resolvedTypes, IBinder resultTo,
+ Bundle options) {
// This is so super not safe, that only the system (or okay root)
// can do it.
@@ -2481,7 +2475,7 @@
"startActivityInPackage only available to the system");
}
int ret = mMainStack.startActivities(null, uid, intents, resolvedTypes, resultTo,
- UserId.getUserId(uid));
+ options, UserId.getUserId(uid));
return ret;
}
@@ -2971,6 +2965,12 @@
return null;
}
+ dumpStackTraces(tracesPath, firstPids, processStats, lastPids);
+ return tracesFile;
+ }
+
+ private static void dumpStackTraces(String tracesPath, ArrayList<Integer> firstPids,
+ ProcessStats processStats, SparseArray<Boolean> lastPids) {
// Use a FileObserver to detect when traces finish writing.
// The order of traces is considered important to maintain for legibility.
FileObserver observer = new FileObserver(tracesPath, FileObserver.CLOSE_WRITE) {
@@ -2981,16 +2981,18 @@
observer.startWatching();
// First collect all of the stacks of the most important pids.
- try {
- int num = firstPids.size();
- for (int i = 0; i < num; i++) {
- synchronized (observer) {
- Process.sendSignal(firstPids.get(i), Process.SIGNAL_QUIT);
- observer.wait(200); // Wait for write-close, give up after 200msec
+ if (firstPids != null) {
+ try {
+ int num = firstPids.size();
+ for (int i = 0; i < num; i++) {
+ synchronized (observer) {
+ Process.sendSignal(firstPids.get(i), Process.SIGNAL_QUIT);
+ observer.wait(200); // Wait for write-close, give up after 200msec
+ }
}
+ } catch (InterruptedException e) {
+ Log.wtf(TAG, e);
}
- } catch (InterruptedException e) {
- Log.wtf(TAG, e);
}
// Next measure CPU usage.
@@ -3026,13 +3028,83 @@
}
}
- return tracesFile;
-
} finally {
observer.stopWatching();
}
}
+ final void logAppTooSlow(ProcessRecord app, long startTime, String msg) {
+ if (IS_USER_BUILD) {
+ return;
+ }
+ String tracesPath = SystemProperties.get("dalvik.vm.stack-trace-file", null);
+ if (tracesPath == null || tracesPath.length() == 0) {
+ return;
+ }
+
+ StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
+ StrictMode.allowThreadDiskWrites();
+ try {
+ final File tracesFile = new File(tracesPath);
+ final File tracesDir = tracesFile.getParentFile();
+ final File tracesTmp = new File(tracesDir, "__tmp__");
+ try {
+ if (!tracesDir.exists()) tracesFile.mkdirs();
+ FileUtils.setPermissions(tracesDir.getPath(), 0775, -1, -1); // drwxrwxr-x
+
+ if (tracesFile.exists()) {
+ tracesTmp.delete();
+ tracesFile.renameTo(tracesTmp);
+ }
+ StringBuilder sb = new StringBuilder();
+ Time tobj = new Time();
+ tobj.set(System.currentTimeMillis());
+ sb.append(tobj.format("%Y-%m-%d %H:%M:%S"));
+ sb.append(": ");
+ TimeUtils.formatDuration(SystemClock.uptimeMillis()-startTime, sb);
+ sb.append(" since ");
+ sb.append(msg);
+ FileOutputStream fos = new FileOutputStream(tracesFile);
+ fos.write(sb.toString().getBytes());
+ if (app == null) {
+ fos.write("\n*** No application process!".getBytes());
+ }
+ fos.close();
+ FileUtils.setPermissions(tracesFile.getPath(), 0666, -1, -1); // -rw-rw-rw-
+ } catch (IOException e) {
+ Slog.w(TAG, "Unable to prepare slow app traces file: " + tracesPath, e);
+ return;
+ }
+
+ if (app != null) {
+ ArrayList<Integer> firstPids = new ArrayList<Integer>();
+ firstPids.add(app.pid);
+ dumpStackTraces(tracesPath, firstPids, null, null);
+ }
+
+ File lastTracesFile = null;
+ File curTracesFile = null;
+ for (int i=9; i>=0; i--) {
+ String name = String.format("slow%02d.txt", i);
+ curTracesFile = new File(tracesDir, name);
+ if (curTracesFile.exists()) {
+ if (lastTracesFile != null) {
+ curTracesFile.renameTo(lastTracesFile);
+ } else {
+ curTracesFile.delete();
+ }
+ }
+ lastTracesFile = curTracesFile;
+ }
+ tracesFile.renameTo(curTracesFile);
+ if (tracesTmp.exists()) {
+ tracesTmp.renameTo(tracesFile);
+ }
+ } finally {
+ StrictMode.setThreadPolicy(oldPolicy);
+ }
+ }
+
final void appNotResponding(ProcessRecord app, ActivityRecord activity,
ActivityRecord parent, final String annotation) {
ArrayList<Integer> firstPids = new ArrayList<Integer>(5);
@@ -4180,7 +4252,8 @@
public IIntentSender getIntentSender(int type,
String packageName, IBinder token, String resultWho,
- int requestCode, Intent[] intents, String[] resolvedTypes, int flags) {
+ int requestCode, Intent[] intents, String[] resolvedTypes,
+ int flags, Bundle options) {
enforceNotIsolatedCaller("getIntentSender");
// Refuse possible leaked file descriptors
if (intents != null) {
@@ -4193,7 +4266,7 @@
if (intent.hasFileDescriptors()) {
throw new IllegalArgumentException("File descriptors passed in Intent");
}
- if (type == INTENT_SENDER_BROADCAST &&
+ if (type == ActivityManager.INTENT_SENDER_BROADCAST &&
(intent.getFlags()&Intent.FLAG_RECEIVER_BOOT_UPGRADE) != 0) {
throw new IllegalArgumentException(
"Can't use FLAG_RECEIVER_BOOT_UPGRADE here");
@@ -4206,6 +4279,11 @@
"Intent array length does not match resolvedTypes length");
}
}
+ if (options != null) {
+ if (options.hasFileDescriptors()) {
+ throw new IllegalArgumentException("File descriptors passed in options");
+ }
+ }
synchronized(this) {
int callingUid = Binder.getCallingUid();
@@ -4228,7 +4306,7 @@
Slog.i(TAG_MU, "Getting intent sender for origCallingUid="
+ Binder.getOrigCallingUid());
return getIntentSenderLocked(type, packageName, Binder.getOrigCallingUid(),
- token, resultWho, requestCode, intents, resolvedTypes, flags);
+ token, resultWho, requestCode, intents, resolvedTypes, flags, options);
} catch (RemoteException e) {
throw new SecurityException(e);
@@ -4238,11 +4316,12 @@
IIntentSender getIntentSenderLocked(int type,
String packageName, int callingUid, IBinder token, String resultWho,
- int requestCode, Intent[] intents, String[] resolvedTypes, int flags) {
+ int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
+ Bundle options) {
if (DEBUG_MU)
Slog.v(TAG_MU, "getIntentSenderLocked(): uid=" + callingUid);
ActivityRecord activity = null;
- if (type == INTENT_SENDER_ACTIVITY_RESULT) {
+ if (type == ActivityManager.INTENT_SENDER_ACTIVITY_RESULT) {
activity = mMainStack.isInStackLocked(token);
if (activity == null) {
return null;
@@ -4260,7 +4339,7 @@
PendingIntentRecord.Key key = new PendingIntentRecord.Key(
type, packageName, activity, resultWho,
- requestCode, intents, resolvedTypes, flags);
+ requestCode, intents, resolvedTypes, flags, options);
WeakReference<PendingIntentRecord> ref;
ref = mIntentSenderRecords.get(key);
PendingIntentRecord rec = ref != null ? ref.get() : null;
@@ -4289,7 +4368,7 @@
}
rec = new PendingIntentRecord(this, key, callingUid);
mIntentSenderRecords.put(key, rec.ref);
- if (type == INTENT_SENDER_ACTIVITY_RESULT) {
+ if (type == ActivityManager.INTENT_SENDER_ACTIVITY_RESULT) {
if (activity.pendingResults == null) {
activity.pendingResults
= new HashSet<WeakReference<PendingIntentRecord>>();
@@ -5452,15 +5531,16 @@
"removeSubTask()");
long ident = Binder.clearCallingIdentity();
try {
- return mMainStack.removeTaskActivitiesLocked(taskId, subTaskIndex) != null;
+ return mMainStack.removeTaskActivitiesLocked(taskId, subTaskIndex,
+ true) != null;
} finally {
Binder.restoreCallingIdentity(ident);
}
}
}
- private void cleanUpRemovedTaskLocked(ActivityRecord root, boolean killProcesses) {
- TaskRecord tr = root.task;
+ private void cleanUpRemovedTaskLocked(TaskRecord tr, int flags) {
+ final boolean killProcesses = (flags&ActivityManager.REMOVE_TASK_KILL_PROCESS) != 0;
Intent baseIntent = new Intent(
tr.intent != null ? tr.intent : tr.affinityIntent);
ComponentName component = baseIntent.getComponent();
@@ -5471,7 +5551,7 @@
// Find any running services associated with this app.
ArrayList<ServiceRecord> services = new ArrayList<ServiceRecord>();
- for (ServiceRecord sr : mServiceMap.getAllServices(root.userId)) {
+ for (ServiceRecord sr : mServiceMap.getAllServices(tr.userId)) {
if (sr.packageName.equals(component.getPackageName())) {
services.add(sr);
}
@@ -5526,11 +5606,11 @@
"removeTask()");
long ident = Binder.clearCallingIdentity();
try {
- ActivityRecord r = mMainStack.removeTaskActivitiesLocked(taskId, -1);
+ ActivityRecord r = mMainStack.removeTaskActivitiesLocked(taskId, -1,
+ false);
if (r != null) {
mRecentTasks.remove(r.task);
- cleanUpRemovedTaskLocked(r,
- (flags&ActivityManager.REMOVE_TASK_KILL_PROCESS) != 0);
+ cleanUpRemovedTaskLocked(r.task, flags);
return true;
} else {
TaskRecord tr = null;
@@ -5548,6 +5628,8 @@
// Caller is just removing a recent task that is
// not actively running. That is easy!
mRecentTasks.remove(i);
+ cleanUpRemovedTaskLocked(tr, flags);
+ return true;
} else {
Slog.w(TAG, "removeTask: task " + taskId
+ " does not have activities to remove, "
@@ -9369,7 +9451,7 @@
boolean dumpProvidersLocked(FileDescriptor fd, PrintWriter pw, String[] args,
int opti, boolean dumpAll, String dumpPackage) {
- boolean needSep = false;
+ boolean needSep = true;
ItemMatcher matcher = new ItemMatcher();
matcher.build(args, opti);
@@ -12454,7 +12536,7 @@
}
} catch (RemoteException e) {
Slog.w(TAG, "Remote exception", e);
- return BROADCAST_SUCCESS;
+ return ActivityManager.BROADCAST_SUCCESS;
}
}
@@ -12472,7 +12554,7 @@
if (requiredPermission != null) {
Slog.w(TAG, "Can't broadcast sticky intent " + intent
+ " and enforce permission " + requiredPermission);
- return BROADCAST_STICKY_CANT_HAVE_PERMISSION;
+ return ActivityManager.BROADCAST_STICKY_CANT_HAVE_PERMISSION;
}
if (intent.getComponent() != null) {
throw new SecurityException(
@@ -12646,7 +12728,7 @@
}
}
- return BROADCAST_SUCCESS;
+ return ActivityManager.BROADCAST_SUCCESS;
}
final Intent verifyBroadcastLocked(Intent intent) {
diff --git a/services/java/com/android/server/am/ActivityRecord.java b/services/java/com/android/server/am/ActivityRecord.java
index a337b40..53cb2b0 100644
--- a/services/java/com/android/server/am/ActivityRecord.java
+++ b/services/java/com/android/server/am/ActivityRecord.java
@@ -20,6 +20,7 @@
import com.android.server.am.ActivityStack.ActivityState;
import android.app.Activity;
+import android.app.ActivityOptions;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.ActivityInfo;
@@ -85,6 +86,8 @@
long startTime; // last time this activity was started
long lastVisibleTime; // last time this activity became visible
long cpuTimeAtResume; // the cpu time of host process at the time of resuming activity
+ long pauseTime; // last time we started pausing the activity
+ long launchTickTime; // base time for launch tick messages
Configuration configuration; // configuration activity was last running in
CompatibilityInfo compat;// last used compatibility mode
ActivityRecord resultTo; // who started this entry, so will get our reply
@@ -93,6 +96,7 @@
ArrayList results; // pending ActivityResult objs we have received
HashSet<WeakReference<PendingIntentRecord>> pendingResults; // all pending intents for this act
ArrayList newIntents; // any pending new intents for single-top mode
+ ActivityOptions pendingOptions; // most recently given options
HashSet<ConnectionRecord> connections; // All ConnectionRecord we hold
UriPermissionOwner uriPermissions; // current special URI access perms.
ProcessRecord app; // if non-null, hosting application
@@ -536,6 +540,28 @@
}
}
+ void updateOptionsLocked(Bundle options) {
+ if (options != null) {
+ pendingOptions = new ActivityOptions(options);
+ }
+ }
+
+ void applyOptionsLocked() {
+ if (pendingOptions != null) {
+ if (pendingOptions.isCustomAnimation()) {
+ service.mWindowManager.overridePendingAppTransition(
+ pendingOptions.getPackageName(),
+ pendingOptions.getCustomEnterResId(),
+ pendingOptions.getCustomExitResId());
+ }
+ pendingOptions = null;
+ }
+ }
+
+ void clearOptionsLocked() {
+ pendingOptions = null;
+ }
+
void removeUriPermissionsLocked() {
if (uriPermissions != null) {
uriPermissions.removeUriPermissionsLocked();
@@ -576,6 +602,32 @@
}
}
+ void startLaunchTickingLocked() {
+ if (ActivityManagerService.IS_USER_BUILD) {
+ return;
+ }
+ if (launchTickTime == 0) {
+ launchTickTime = SystemClock.uptimeMillis();
+ continueLaunchTickingLocked();
+ }
+ }
+
+ boolean continueLaunchTickingLocked() {
+ if (launchTickTime != 0) {
+ Message msg = stack.mHandler.obtainMessage(ActivityStack.LAUNCH_TICK_MSG);
+ msg.obj = this;
+ stack.mHandler.removeMessages(ActivityStack.LAUNCH_TICK_MSG);
+ stack.mHandler.sendMessageDelayed(msg, ActivityStack.LAUNCH_TICK);
+ return true;
+ }
+ return false;
+ }
+
+ void finishLaunchTickingLocked() {
+ launchTickTime = 0;
+ stack.mHandler.removeMessages(ActivityStack.LAUNCH_TICK_MSG);
+ }
+
// IApplicationToken
public boolean mayFreezeScreenLocked(ProcessRecord app) {
@@ -631,6 +683,7 @@
stack.mInitialStartTime = 0;
}
startTime = 0;
+ finishLaunchTickingLocked();
}
}
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index 64d52ed..7e8df35 100644
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -22,18 +22,10 @@
import android.app.Activity;
import android.app.ActivityManager;
+import android.app.ActivityOptions;
import android.app.AppGlobals;
import android.app.IActivityManager;
import android.app.IThumbnailRetriever;
-import static android.app.IActivityManager.START_CLASS_NOT_FOUND;
-import static android.app.IActivityManager.START_DELIVERED_TO_TOP;
-import static android.app.IActivityManager.START_FORWARD_AND_REQUEST_CONFLICT;
-import static android.app.IActivityManager.START_INTENT_NOT_RESOLVED;
-import static android.app.IActivityManager.START_PERMISSION_DENIED;
-import static android.app.IActivityManager.START_RETURN_INTENT_TO_CALLER;
-import static android.app.IActivityManager.START_SUCCESS;
-import static android.app.IActivityManager.START_SWITCHES_CANCELED;
-import static android.app.IActivityManager.START_TASK_TO_FRONT;
import android.app.IApplicationThread;
import android.app.PendingIntent;
import android.app.ResultInfo;
@@ -96,7 +88,10 @@
// How long we wait until giving up on the last activity telling us it
// is idle.
static final int IDLE_TIMEOUT = 10*1000;
-
+
+ // Ticks during which we check progress while waiting for an app to launch.
+ static final int LAUNCH_TICK = 500;
+
// How long we wait until giving up on the last activity to pause. This
// is short because it directly impacts the responsiveness of starting the
// next activity.
@@ -284,6 +279,7 @@
static final int LAUNCH_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 4;
static final int DESTROY_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 5;
static final int RESUME_TOP_ACTIVITY_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 6;
+ static final int LAUNCH_TICK_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 7;
final Handler mHandler = new Handler() {
//public Handler() {
@@ -306,6 +302,13 @@
// We don't at this point know if the activity is fullscreen,
// so we need to be conservative and assume it isn't.
Slog.w(TAG, "Activity pause timeout for " + r);
+ synchronized (mService) {
+ if (r.app != null) {
+ mService.logAppTooSlow(r.app, r.pauseTime,
+ "pausing " + r);
+ }
+ }
+
activityPaused(r != null ? r.appToken : null, true);
} break;
case IDLE_TIMEOUT_MSG: {
@@ -322,6 +325,15 @@
Slog.w(TAG, "Activity idle timeout for " + r);
activityIdleInternal(r != null ? r.appToken : null, true, null);
} break;
+ case LAUNCH_TICK_MSG: {
+ ActivityRecord r = (ActivityRecord)msg.obj;
+ synchronized (mService) {
+ if (r.continueLaunchTickingLocked()) {
+ mService.logAppTooSlow(r.app, r.launchTickTime,
+ "launching " + r);
+ }
+ }
+ } break;
case DESTROY_TIMEOUT_MSG: {
ActivityRecord r = (ActivityRecord)msg.obj;
// We don't at this point know if the activity is fullscreen,
@@ -563,6 +575,9 @@
r.startFreezingScreenLocked(app, 0);
mService.mWindowManager.setAppVisibility(r.appToken, true);
+ // schedule launch ticks to collect information about slow apps.
+ r.startLaunchTickingLocked();
+
// Have the window manager re-evaluate the orientation of
// the screen based on the new activity order. Note that
// as a result of this, it can call back into the activity
@@ -945,6 +960,7 @@
// responsiveness seen by the user.
Message msg = mHandler.obtainMessage(PAUSE_TIMEOUT_MSG);
msg.obj = prev;
+ prev.pauseTime = SystemClock.uptimeMillis();
mHandler.sendMessageDelayed(msg, PAUSE_TIMEOUT);
if (DEBUG_PAUSE) Slog.v(TAG, "Waiting for pause to complete...");
} else {
@@ -1441,6 +1457,7 @@
// We are starting up the next activity, so tell the window manager
// that the previous one will be hidden soon. This way it can know
// to ignore it when computing the desired screen orientation.
+ boolean noAnim = false;
if (prev != null) {
if (prev.finishing) {
if (DEBUG_TRANSITION) Slog.v(TAG,
@@ -1459,6 +1476,7 @@
if (DEBUG_TRANSITION) Slog.v(TAG,
"Prepare open transition: prev=" + prev);
if (mNoAnimActivities.contains(next)) {
+ noAnim = true;
mService.mWindowManager.prepareAppTransition(
WindowManagerPolicy.TRANSIT_NONE, false);
} else {
@@ -1475,6 +1493,7 @@
if (DEBUG_TRANSITION) Slog.v(TAG,
"Prepare open transition: no previous");
if (mNoAnimActivities.contains(next)) {
+ noAnim = true;
mService.mWindowManager.prepareAppTransition(
WindowManagerPolicy.TRANSIT_NONE, false);
} else {
@@ -1482,6 +1501,11 @@
WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN, false);
}
}
+ if (!noAnim) {
+ next.applyOptionsLocked();
+ } else {
+ next.clearOptionsLocked();
+ }
if (next.app != null && next.app.thread != null) {
if (DEBUG_SWITCH) Slog.v(TAG, "Resume running: " + next);
@@ -1489,6 +1513,9 @@
// This activity is now becoming visible.
mService.mWindowManager.setAppVisibility(next.appToken, true);
+ // schedule launch ticks to collect information about slow apps.
+ next.startLaunchTickingLocked();
+
ActivityRecord lastResumedActivity = mResumedActivity;
ActivityState lastState = next.state;
@@ -1637,7 +1664,7 @@
}
private final void startActivityLocked(ActivityRecord r, boolean newTask,
- boolean doResume, boolean keepCurTransition) {
+ boolean doResume, boolean keepCurTransition, Bundle options) {
final int NH = mHistory.size();
int addPos = -1;
@@ -1730,6 +1757,7 @@
: WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN, keepCurTransition);
mNoAnimActivities.remove(r);
}
+ r.updateOptionsLocked(options);
mService.mWindowManager.addAppToken(
addPos, r.appToken, r.task.taskId, r.info.screenOrientation, r.fullscreen);
boolean doShow = true;
@@ -2270,14 +2298,12 @@
}
final int startActivityLocked(IApplicationThread caller,
- Intent intent, String resolvedType,
- Uri[] grantedUriPermissions,
- int grantedMode, ActivityInfo aInfo, IBinder resultTo,
+ Intent intent, String resolvedType, ActivityInfo aInfo, IBinder resultTo,
String resultWho, int requestCode,
- int callingPid, int callingUid, boolean onlyIfNeeded,
+ int callingPid, int callingUid, int startFlags, Bundle options,
boolean componentSpecified, ActivityRecord[] outActivity) {
- int err = START_SUCCESS;
+ int err = ActivityManager.START_SUCCESS;
ProcessRecord callerApp = null;
if (caller != null) {
@@ -2289,11 +2315,11 @@
Slog.w(TAG, "Unable to find app for caller " + caller
+ " (pid=" + callingPid + ") when starting: "
+ intent.toString());
- err = START_PERMISSION_DENIED;
+ err = ActivityManager.START_PERMISSION_DENIED;
}
}
- if (err == START_SUCCESS) {
+ if (err == ActivityManager.START_SUCCESS) {
Slog.i(TAG, "START {" + intent.toShortString(true, true, true, false)
+ "} from pid " + (callerApp != null ? callerApp.pid : callingPid));
}
@@ -2319,7 +2345,7 @@
// Transfer the result target from the source activity to the new
// one being started, including any failures.
if (requestCode >= 0) {
- return START_FORWARD_AND_REQUEST_CONFLICT;
+ return ActivityManager.START_FORWARD_AND_REQUEST_CONFLICT;
}
resultRecord = sourceRecord.resultTo;
resultWho = sourceRecord.resultWho;
@@ -2331,19 +2357,19 @@
}
}
- if (err == START_SUCCESS && intent.getComponent() == null) {
+ if (err == ActivityManager.START_SUCCESS && intent.getComponent() == null) {
// We couldn't find a class that can handle the given Intent.
// That's the end of that!
- err = START_INTENT_NOT_RESOLVED;
+ err = ActivityManager.START_INTENT_NOT_RESOLVED;
}
- if (err == START_SUCCESS && aInfo == null) {
+ if (err == ActivityManager.START_SUCCESS && aInfo == null) {
// We couldn't find the specific class specified in the Intent.
// Also the end of the line.
- err = START_CLASS_NOT_FOUND;
+ err = ActivityManager.START_CLASS_NOT_FOUND;
}
- if (err != START_SUCCESS) {
+ if (err != ActivityManager.START_SUCCESS) {
if (resultRecord != null) {
sendActivityResultLocked(-1,
resultRecord, resultWho, requestCode,
@@ -2400,7 +2426,7 @@
// We pretend to the caller that it was really started, but
// they will just get a cancel result.
mDismissKeyguardOnNextActivity = false;
- return START_SUCCESS;
+ return ActivityManager.START_SUCCESS;
}
}
}
@@ -2419,12 +2445,10 @@
PendingActivityLaunch pal = new PendingActivityLaunch();
pal.r = r;
pal.sourceRecord = sourceRecord;
- pal.grantedUriPermissions = grantedUriPermissions;
- pal.grantedMode = grantedMode;
- pal.onlyIfNeeded = onlyIfNeeded;
+ pal.startFlags = startFlags;
mService.mPendingActivityLaunches.add(pal);
mDismissKeyguardOnNextActivity = false;
- return START_SWITCHES_CANCELED;
+ return ActivityManager.START_SWITCHES_CANCELED;
}
}
@@ -2443,7 +2467,7 @@
}
err = startActivityUncheckedLocked(r, sourceRecord,
- grantedUriPermissions, grantedMode, onlyIfNeeded, true);
+ startFlags, true, options);
if (mDismissKeyguardOnNextActivity && mPausingActivity == null) {
// Someone asked to have the keyguard dismissed on the next
// activity start, but we are not actually doing an activity
@@ -2466,8 +2490,8 @@
}
final int startActivityUncheckedLocked(ActivityRecord r,
- ActivityRecord sourceRecord, Uri[] grantedUriPermissions,
- int grantedMode, boolean onlyIfNeeded, boolean doResume) {
+ ActivityRecord sourceRecord, int startFlags, boolean doResume,
+ Bundle options) {
final Intent intent = r.intent;
final int callingUid = r.launchedFromUid;
final int userId = r.userId;
@@ -2494,14 +2518,14 @@
// being launched is the same as the one making the call... or, as
// a special case, if we do not know the caller then we count the
// current top activity as the caller.
- if (onlyIfNeeded) {
+ if ((startFlags&ActivityManager.START_FLAG_ONLY_IF_NEEDED) != 0) {
ActivityRecord checkedCaller = sourceRecord;
if (checkedCaller == null) {
checkedCaller = topRunningNonDelayedActivityLocked(notTop);
}
if (!checkedCaller.realActivity.equals(r.realActivity)) {
// Caller is not the same as launcher, so always needed.
- onlyIfNeeded = false;
+ startFlags &= ~ActivityManager.START_FLAG_ONLY_IF_NEEDED;
}
}
@@ -2578,6 +2602,7 @@
// We really do want to push this one into the
// user's face, right now.
moveHomeToFrontFromLaunchLocked(launchFlags);
+ r.updateOptionsLocked(options);
moveTaskToFrontLocked(taskTop.task, r);
}
}
@@ -2586,7 +2611,7 @@
if ((launchFlags&Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED) != 0) {
taskTop = resetTaskIfNeededLocked(taskTop, r);
}
- if (onlyIfNeeded) {
+ if ((startFlags&ActivityManager.START_FLAG_ONLY_IF_NEEDED) != 0) {
// We don't need to start a new activity, and
// the client said not to do anything if that
// is the case, so this is it! And for paranoia, make
@@ -2594,7 +2619,7 @@
if (doResume) {
resumeTopActivityLocked(null);
}
- return START_RETURN_INTENT_TO_CALLER;
+ return ActivityManager.START_RETURN_INTENT_TO_CALLER;
}
if ((launchFlags &
(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TASK))
@@ -2681,7 +2706,7 @@
if (doResume) {
resumeTopActivityLocked(null);
}
- return START_TASK_TO_FRONT;
+ return ActivityManager.START_TASK_TO_FRONT;
}
}
}
@@ -2710,14 +2735,14 @@
if (doResume) {
resumeTopActivityLocked(null);
}
- if (onlyIfNeeded) {
+ if ((startFlags&ActivityManager.START_FLAG_ONLY_IF_NEEDED) != 0) {
// We don't need to start a new activity, and
// the client said not to do anything if that
// is the case, so this is it!
- return START_RETURN_INTENT_TO_CALLER;
+ return ActivityManager.START_RETURN_INTENT_TO_CALLER;
}
top.deliverNewIntentLocked(callingUid, r.intent);
- return START_DELIVERED_TO_TOP;
+ return ActivityManager.START_DELIVERED_TO_TOP;
}
}
}
@@ -2729,7 +2754,7 @@
r.resultTo, r.resultWho, r.requestCode,
Activity.RESULT_CANCELED, null);
}
- return START_CLASS_NOT_FOUND;
+ return ActivityManager.START_CLASS_NOT_FOUND;
}
boolean newTask = false;
@@ -2770,7 +2795,7 @@
if (doResume) {
resumeTopActivityLocked(null);
}
- return START_DELIVERED_TO_TOP;
+ return ActivityManager.START_DELIVERED_TO_TOP;
}
} else if (!addingToTask &&
(launchFlags&Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) != 0) {
@@ -2781,11 +2806,12 @@
if (where >= 0) {
ActivityRecord top = moveActivityToFrontLocked(where);
logStartActivity(EventLogTags.AM_NEW_INTENT, r, top.task);
+ top.updateOptionsLocked(options);
top.deliverNewIntentLocked(callingUid, r.intent);
if (doResume) {
resumeTopActivityLocked(null);
}
- return START_DELIVERED_TO_TOP;
+ return ActivityManager.START_DELIVERED_TO_TOP;
}
}
// An existing activity is starting this new activity, so we want
@@ -2809,13 +2835,6 @@
+ " in new guessed " + r.task);
}
- if (grantedUriPermissions != null && callingUid > 0) {
- for (int i=0; i<grantedUriPermissions.length; i++) {
- mService.grantUriPermissionLocked(callingUid, r.packageName,
- grantedUriPermissions[i], grantedMode, r.getUriPermissionsLocked());
- }
- }
-
mService.grantUriPermissionFromIntentLocked(callingUid, r.packageName,
intent, r.getUriPermissionsLocked());
@@ -2823,13 +2842,12 @@
EventLog.writeEvent(EventLogTags.AM_CREATE_TASK, r.task.taskId);
}
logStartActivity(EventLogTags.AM_CREATE_ACTIVITY, r, r.task);
- startActivityLocked(r, newTask, doResume, keepCurTransition);
- return START_SUCCESS;
+ startActivityLocked(r, newTask, doResume, keepCurTransition, options);
+ return ActivityManager.START_SUCCESS;
}
- ActivityInfo resolveActivity(Intent intent, String resolvedType, boolean debug,
- boolean openglTrace, String profileFile, ParcelFileDescriptor profileFd,
- boolean autoStopProfiler) {
+ ActivityInfo resolveActivity(Intent intent, String resolvedType, int startFlags,
+ String profileFile, ParcelFileDescriptor profileFd) {
// Collect information about the target of the Intent.
ActivityInfo aInfo;
try {
@@ -2852,13 +2870,13 @@
aInfo.applicationInfo.packageName, aInfo.name));
// Don't debug things in the system process
- if (debug) {
+ if ((startFlags&ActivityManager.START_FLAG_DEBUG) != 0) {
if (!aInfo.processName.equals("system")) {
mService.setDebugApp(aInfo.processName, true, false);
}
}
- if (openglTrace) {
+ if ((startFlags&ActivityManager.START_FLAG_OPENGL_TRACES) != 0) {
if (!aInfo.processName.equals("system")) {
mService.setOpenGlTraceApp(aInfo.applicationInfo, aInfo.processName);
}
@@ -2867,7 +2885,8 @@
if (profileFile != null) {
if (!aInfo.processName.equals("system")) {
mService.setProfileApp(aInfo.applicationInfo, aInfo.processName,
- profileFile, profileFd, autoStopProfiler);
+ profileFile, profileFd,
+ (startFlags&ActivityManager.START_FLAG_AUTO_STOP_PROFILER) != 0);
}
}
}
@@ -2875,12 +2894,10 @@
}
final int startActivityMayWait(IApplicationThread caller, int callingUid,
- Intent intent, String resolvedType, Uri[] grantedUriPermissions,
- int grantedMode, IBinder resultTo,
- String resultWho, int requestCode, boolean onlyIfNeeded,
- boolean debug, boolean openglTrace, String profileFile, ParcelFileDescriptor profileFd,
- boolean autoStopProfiler,
- WaitResult outResult, Configuration config, int userId) {
+ Intent intent, String resolvedType, IBinder resultTo,
+ String resultWho, int requestCode, int startFlags, String profileFile,
+ ParcelFileDescriptor profileFd, WaitResult outResult, Configuration config,
+ Bundle options, int userId) {
// Refuse possible leaked file descriptors
if (intent != null && intent.hasFileDescriptors()) {
throw new IllegalArgumentException("File descriptors passed in Intent");
@@ -2891,8 +2908,8 @@
intent = new Intent(intent);
// Collect information about the target of the Intent.
- ActivityInfo aInfo = resolveActivity(intent, resolvedType, debug, openglTrace,
- profileFile, profileFd, autoStopProfiler);
+ ActivityInfo aInfo = resolveActivity(intent, resolvedType, startFlags,
+ profileFile, profileFd);
aInfo = mService.getActivityInfoForUser(aInfo, userId);
synchronized (mService) {
@@ -2932,15 +2949,15 @@
Slog.w(TAG, "Unable to find app for caller " + caller
+ " (pid=" + realCallingPid + ") when starting: "
+ intent.toString());
- return START_PERMISSION_DENIED;
+ return ActivityManager.START_PERMISSION_DENIED;
}
}
IIntentSender target = mService.getIntentSenderLocked(
- IActivityManager.INTENT_SENDER_ACTIVITY, "android",
+ ActivityManager.INTENT_SENDER_ACTIVITY, "android",
realCallingUid, null, null, 0, new Intent[] { intent },
new String[] { resolvedType }, PendingIntent.FLAG_CANCEL_CURRENT
- | PendingIntent.FLAG_ONE_SHOT);
+ | PendingIntent.FLAG_ONE_SHOT, null);
Intent newIntent = new Intent();
if (requestCode >= 0) {
@@ -2983,9 +3000,8 @@
}
int res = startActivityLocked(caller, intent, resolvedType,
- grantedUriPermissions, grantedMode, aInfo,
- resultTo, resultWho, requestCode, callingPid, callingUid,
- onlyIfNeeded, componentSpecified, null);
+ aInfo, resultTo, resultWho, requestCode, callingPid, callingUid,
+ startFlags, options, componentSpecified, null);
if (mConfigWillChange && mMainStack) {
// If the caller also wants to switch to a new configuration,
@@ -3004,7 +3020,7 @@
if (outResult != null) {
outResult.result = res;
- if (res == IActivityManager.START_SUCCESS) {
+ if (res == ActivityManager.START_SUCCESS) {
mWaitingActivityLaunched.add(outResult);
do {
try {
@@ -3012,7 +3028,7 @@
} catch (InterruptedException e) {
}
} while (!outResult.timeout && outResult.who == null);
- } else if (res == IActivityManager.START_TASK_TO_FRONT) {
+ } else if (res == ActivityManager.START_TASK_TO_FRONT) {
ActivityRecord r = this.topRunningActivityLocked(null);
if (r.nowVisible) {
outResult.timeout = false;
@@ -3037,8 +3053,8 @@
}
final int startActivities(IApplicationThread caller, int callingUid,
- Intent[] intents,
- String[] resolvedTypes, IBinder resultTo, int userId) {
+ Intent[] intents, String[] resolvedTypes, IBinder resultTo,
+ Bundle options, int userId) {
if (intents == null) {
throw new NullPointerException("intents is null");
}
@@ -3081,8 +3097,8 @@
intent = new Intent(intent);
// Collect information about the target of the Intent.
- ActivityInfo aInfo = resolveActivity(intent, resolvedTypes[i], false, false,
- null, null, false);
+ ActivityInfo aInfo = resolveActivity(intent, resolvedTypes[i],
+ 0, null, null);
// TODO: New, check if this is correct
aInfo = mService.getActivityInfoForUser(aInfo, userId);
@@ -3092,9 +3108,15 @@
"FLAG_CANT_SAVE_STATE not supported here");
}
+ Bundle theseOptions;
+ if (options != null && i == intents.length-1) {
+ theseOptions = options;
+ } else {
+ theseOptions = null;
+ }
int res = startActivityLocked(caller, intent, resolvedTypes[i],
- null, 0, aInfo, resultTo, null, -1, callingPid, callingUid,
- false, componentSpecified, outActivity);
+ aInfo, resultTo, null, -1, callingPid, callingUid,
+ 0, theseOptions, componentSpecified, outActivity);
if (res < 0) {
return res;
}
@@ -3106,7 +3128,7 @@
Binder.restoreCallingIdentity(origId);
}
- return IActivityManager.START_SUCCESS;
+ return ActivityManager.START_SUCCESS;
}
void reportActivityLaunchedLocked(boolean timeout, ActivityRecord r,
@@ -3281,6 +3303,7 @@
ActivityRecord r = ActivityRecord.forToken(token);
if (r != null) {
mHandler.removeMessages(IDLE_TIMEOUT_MSG, r);
+ r.finishLaunchTickingLocked();
}
// Get the activity record.
@@ -3651,6 +3674,7 @@
mHandler.removeMessages(PAUSE_TIMEOUT_MSG, r);
mHandler.removeMessages(IDLE_TIMEOUT_MSG, r);
mHandler.removeMessages(DESTROY_TIMEOUT_MSG, r);
+ r.finishLaunchTickingLocked();
}
final void removeActivityFromHistoryLocked(ActivityRecord r) {
@@ -4035,10 +4059,13 @@
return info;
}
- public ActivityRecord removeTaskActivitiesLocked(int taskId, int subTaskIndex) {
+ public ActivityRecord removeTaskActivitiesLocked(int taskId, int subTaskIndex,
+ boolean taskRequired) {
TaskAccessInfo info = getTaskAccessInfoLocked(taskId, false);
if (info.root == null) {
- Slog.w(TAG, "removeTaskLocked: unknown taskId " + taskId);
+ if (taskRequired) {
+ Slog.w(TAG, "removeTaskLocked: unknown taskId " + taskId);
+ }
return null;
}
@@ -4049,7 +4076,9 @@
}
if (subTaskIndex >= info.subtasks.size()) {
- Slog.w(TAG, "removeTaskLocked: unknown subTaskIndex " + subTaskIndex);
+ if (taskRequired) {
+ Slog.w(TAG, "removeTaskLocked: unknown subTaskIndex " + subTaskIndex);
+ }
return null;
}
diff --git a/services/java/com/android/server/am/ContentProviderRecord.java b/services/java/com/android/server/am/ContentProviderRecord.java
index f338cfc..608b09a 100644
--- a/services/java/com/android/server/am/ContentProviderRecord.java
+++ b/services/java/com/android/server/am/ContentProviderRecord.java
@@ -157,7 +157,7 @@
sb.append("ContentProviderRecord{");
sb.append(Integer.toHexString(System.identityHashCode(this)));
sb.append(' ');
- sb.append(info.name);
+ sb.append(name.flattenToShortString());
sb.append('}');
return stringName = sb.toString();
}
diff --git a/services/java/com/android/server/am/PendingIntentRecord.java b/services/java/com/android/server/am/PendingIntentRecord.java
index 0043874..ad15da1 100644
--- a/services/java/com/android/server/am/PendingIntentRecord.java
+++ b/services/java/com/android/server/am/PendingIntentRecord.java
@@ -16,12 +16,13 @@
package com.android.server.am;
-import android.app.IActivityManager;
+import android.app.ActivityManager;
import android.content.IIntentSender;
import android.content.IIntentReceiver;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Binder;
+import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.UserId;
@@ -48,6 +49,7 @@
final int requestCode;
final Intent requestIntent;
final String requestResolvedType;
+ final Bundle options;
Intent[] allIntents;
String[] allResolvedTypes;
final int flags;
@@ -56,7 +58,7 @@
private static final int ODD_PRIME_NUMBER = 37;
Key(int _t, String _p, ActivityRecord _a, String _w,
- int _r, Intent[] _i, String[] _it, int _f) {
+ int _r, Intent[] _i, String[] _it, int _f, Bundle _o) {
type = _t;
packageName = _p;
activity = _a;
@@ -67,6 +69,7 @@
allIntents = _i;
allResolvedTypes = _it;
flags = _f;
+ options = _o;
int hash = 23;
hash = (ODD_PRIME_NUMBER*hash) + _f;
@@ -158,13 +161,13 @@
String typeName() {
switch (type) {
- case IActivityManager.INTENT_SENDER_ACTIVITY:
+ case ActivityManager.INTENT_SENDER_ACTIVITY:
return "startActivity";
- case IActivityManager.INTENT_SENDER_BROADCAST:
+ case ActivityManager.INTENT_SENDER_BROADCAST:
return "broadcastIntent";
- case IActivityManager.INTENT_SENDER_SERVICE:
+ case ActivityManager.INTENT_SENDER_SERVICE:
return "startService";
- case IActivityManager.INTENT_SENDER_ACTIVITY_RESULT:
+ case ActivityManager.INTENT_SENDER_ACTIVITY_RESULT:
return "activityResult";
}
return Integer.toString(type);
@@ -181,13 +184,13 @@
public int send(int code, Intent intent, String resolvedType,
IIntentReceiver finishedReceiver, String requiredPermission) {
return sendInner(code, intent, resolvedType, finishedReceiver,
- requiredPermission, null, null, 0, 0, 0);
+ requiredPermission, null, null, 0, 0, 0, null);
}
int sendInner(int code, Intent intent, String resolvedType,
IIntentReceiver finishedReceiver, String requiredPermission,
IBinder resultTo, String resultWho, int requestCode,
- int flagsMask, int flagsValues) {
+ int flagsMask, int flagsValues, Bundle options) {
synchronized(owner) {
if (!canceled) {
sent = true;
@@ -213,7 +216,14 @@
boolean sendFinish = finishedReceiver != null;
switch (key.type) {
- case IActivityManager.INTENT_SENDER_ACTIVITY:
+ case ActivityManager.INTENT_SENDER_ACTIVITY:
+ if (options == null) {
+ options = key.options;
+ } else if (key.options != null) {
+ Bundle opts = new Bundle(key.options);
+ opts.putAll(options);
+ options = opts;
+ }
try {
if (key.allIntents != null && key.allIntents.length > 1) {
Intent[] allIntents = new Intent[key.allIntents.length];
@@ -227,22 +237,22 @@
allIntents[allIntents.length-1] = finalIntent;
allResolvedTypes[allResolvedTypes.length-1] = resolvedType;
owner.startActivitiesInPackage(uid, allIntents,
- allResolvedTypes, resultTo);
+ allResolvedTypes, resultTo, options);
} else {
owner.startActivityInPackage(uid,
finalIntent, resolvedType,
- resultTo, resultWho, requestCode, false);
+ resultTo, resultWho, requestCode, 0, options);
}
} catch (RuntimeException e) {
Slog.w(ActivityManagerService.TAG,
"Unable to send startActivity intent", e);
}
break;
- case IActivityManager.INTENT_SENDER_ACTIVITY_RESULT:
+ case ActivityManager.INTENT_SENDER_ACTIVITY_RESULT:
key.activity.stack.sendActivityResultLocked(-1, key.activity,
key.who, key.requestCode, code, finalIntent);
break;
- case IActivityManager.INTENT_SENDER_BROADCAST:
+ case ActivityManager.INTENT_SENDER_BROADCAST:
try {
// If a completion callback has been requested, require
// that the broadcast be delivered synchronously
@@ -257,7 +267,7 @@
"Unable to send startActivity intent", e);
}
break;
- case IActivityManager.INTENT_SENDER_SERVICE:
+ case ActivityManager.INTENT_SENDER_SERVICE:
try {
owner.startServiceInPackage(uid,
finalIntent, resolvedType);
@@ -281,7 +291,7 @@
return 0;
}
}
- return IActivityManager.START_CANCELED;
+ return ActivityManager.START_CANCELED;
}
protected void finalize() throws Throwable {
diff --git a/services/java/com/android/server/am/ProviderMap.java b/services/java/com/android/server/am/ProviderMap.java
index 2021e0d..ccc928f 100644
--- a/services/java/com/android/server/am/ProviderMap.java
+++ b/services/java/com/android/server/am/ProviderMap.java
@@ -183,16 +183,20 @@
r.dump(pw, " ");
} else {
pw.print(" * ");
- pw.print(r.name.toShortString());
- /*
- if (r.app != null) {
- pw.println(":");
- pw.print(" ");
- pw.println(r.app);
- } else {
- pw.println();
+ pw.println(r);
+ if (r.proc != null) {
+ pw.print(" proc=");
+ pw.println(r.proc);
}
- */
+ if (r.launchingApp != null) {
+ pw.print(" launchingApp=");
+ pw.println(r.launchingApp);
+ }
+ if (r.clients.size() > 0 || r.externalProcessNoHandleCount > 0) {
+ pw.print(" "); pw.print(r.clients.size());
+ pw.print(" clients, "); pw.print(r.externalProcessNoHandleCount);
+ pw.println(" external handles");
+ }
}
}
}
@@ -217,7 +221,7 @@
pw.println(" ");
pw.println(" Published content providers (by class):");
dumpProvidersByClassLocked(pw, dumpAll, mGlobalByClass);
- pw.println(" ");
+ pw.println("");
}
if (mProvidersByClassPerUser.size() > 1) {
diff --git a/services/java/com/android/server/am/TaskRecord.java b/services/java/com/android/server/am/TaskRecord.java
index 67873cc..e3ebcc61 100644
--- a/services/java/com/android/server/am/TaskRecord.java
+++ b/services/java/com/android/server/am/TaskRecord.java
@@ -39,7 +39,7 @@
boolean askedCompatMode;// Have asked the user about compat mode for this task.
String stringName; // caching of toString() result.
- int userId; // user for which this task was created
+ int userId; // user for which this task was created
TaskRecord(int _taskId, ActivityInfo info, Intent _intent) {
taskId = _taskId;
diff --git a/services/java/com/android/server/net/NetworkStatsService.java b/services/java/com/android/server/net/NetworkStatsService.java
index fd8d411..8796afc 100644
--- a/services/java/com/android/server/net/NetworkStatsService.java
+++ b/services/java/com/android/server/net/NetworkStatsService.java
@@ -26,6 +26,7 @@
import static android.content.Intent.EXTRA_UID;
import static android.net.ConnectivityManager.ACTION_TETHER_STATE_CHANGED;
import static android.net.ConnectivityManager.CONNECTIVITY_ACTION_IMMEDIATE;
+import static android.net.NetworkIdentity.COMBINE_SUBTYPE_ENABLED;
import static android.net.NetworkStats.IFACE_ALL;
import static android.net.NetworkStats.SET_ALL;
import static android.net.NetworkStats.SET_DEFAULT;
@@ -304,7 +305,9 @@
// watch for networkType changes that aren't broadcast through
// CONNECTIVITY_ACTION_IMMEDIATE above.
- mTeleManager.listen(mPhoneListener, LISTEN_DATA_CONNECTION_STATE);
+ if (!COMBINE_SUBTYPE_ENABLED) {
+ mTeleManager.listen(mPhoneListener, LISTEN_DATA_CONNECTION_STATE);
+ }
registerPollAlarmLocked();
registerGlobalAlert();
@@ -325,7 +328,9 @@
mContext.unregisterReceiver(mRemovedReceiver);
mContext.unregisterReceiver(mShutdownReceiver);
- mTeleManager.listen(mPhoneListener, LISTEN_NONE);
+ if (!COMBINE_SUBTYPE_ENABLED) {
+ mTeleManager.listen(mPhoneListener, LISTEN_NONE);
+ }
final long currentTime = mTime.hasCache() ? mTime.currentTimeMillis()
: System.currentTimeMillis();
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index 9f45eff..bc98f86 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -20,6 +20,10 @@
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
+import static android.content.pm.PackageManager.ENFORCEMENT_DEFAULT;
+import static android.content.pm.PackageManager.ENFORCEMENT_YES;
+import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
+import static android.Manifest.permission.GRANT_REVOKE_PERMISSIONS;
import static libcore.io.OsConstants.S_ISLNK;
import com.android.internal.app.IMediaContainerService;
@@ -1872,6 +1876,9 @@
return PackageManager.PERMISSION_GRANTED;
}
}
+ if (!isPermissionEnforcedLocked(permName)) {
+ return PackageManager.PERMISSION_GRANTED;
+ }
}
return PackageManager.PERMISSION_DENIED;
}
@@ -1890,6 +1897,9 @@
return PackageManager.PERMISSION_GRANTED;
}
}
+ if (!isPermissionEnforcedLocked(permName)) {
+ return PackageManager.PERMISSION_GRANTED;
+ }
}
return PackageManager.PERMISSION_DENIED;
}
@@ -8835,4 +8845,44 @@
public List<UserInfo> getUsers() {
return mUserManager.getUsers();
}
+
+ @Override
+ public void setPermissionEnforcement(String permission, int enforcement) {
+ mContext.enforceCallingOrSelfPermission(GRANT_REVOKE_PERMISSIONS, null);
+ if (READ_EXTERNAL_STORAGE.equals(permission)) {
+ synchronized (mPackages) {
+ if (mSettings.mReadExternalStorageEnforcement != enforcement) {
+ mSettings.mReadExternalStorageEnforcement = enforcement;
+ mSettings.writeLPr();
+ }
+ }
+ } else {
+ throw new IllegalArgumentException("No selective enforcement for " + permission);
+ }
+ }
+
+ @Override
+ public int getPermissionEnforcement(String permission) {
+ mContext.enforceCallingOrSelfPermission(GRANT_REVOKE_PERMISSIONS, null);
+ if (READ_EXTERNAL_STORAGE.equals(permission)) {
+ synchronized (mPackages) {
+ return mSettings.mReadExternalStorageEnforcement;
+ }
+ } else {
+ throw new IllegalArgumentException("No selective enforcement for " + permission);
+ }
+ }
+
+ private boolean isPermissionEnforcedLocked(String permission) {
+ if (READ_EXTERNAL_STORAGE.equals(permission)) {
+ switch (mSettings.mReadExternalStorageEnforcement) {
+ case ENFORCEMENT_DEFAULT:
+ return false;
+ case ENFORCEMENT_YES:
+ return true;
+ }
+ }
+
+ return true;
+ }
}
diff --git a/services/java/com/android/server/pm/Settings.java b/services/java/com/android/server/pm/Settings.java
index 5da6ac9..363d020 100644
--- a/services/java/com/android/server/pm/Settings.java
+++ b/services/java/com/android/server/pm/Settings.java
@@ -20,6 +20,7 @@
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
+import static android.content.pm.PackageManager.ENFORCEMENT_DEFAULT;
import com.android.internal.util.FastXmlSerializer;
import com.android.internal.util.JournaledFile;
@@ -74,6 +75,9 @@
private static final boolean DEBUG_STOPPED = false;
+ private static final String TAG_READ_EXTERNAL_STORAGE = "read-external-storage";
+ private static final String ATTR_ENFORCEMENT = "enforcement";
+
private final File mSettingsFilename;
private final File mBackupSettingsFilename;
private final File mPackageListFilename;
@@ -91,6 +95,8 @@
int mInternalSdkPlatform;
int mExternalSdkPlatform;
+ int mReadExternalStorageEnforcement = ENFORCEMENT_DEFAULT;
+
/** Device identity for the purpose of package verification. */
private VerifierDeviceIdentity mVerifierDeviceIdentity;
@@ -864,13 +870,20 @@
serializer.attribute(null, "internal", Integer.toString(mInternalSdkPlatform));
serializer.attribute(null, "external", Integer.toString(mExternalSdkPlatform));
serializer.endTag(null, "last-platform-version");
-
+
if (mVerifierDeviceIdentity != null) {
serializer.startTag(null, "verifier");
serializer.attribute(null, "device", mVerifierDeviceIdentity.toString());
serializer.endTag(null, "verifier");
}
+ if (mReadExternalStorageEnforcement != ENFORCEMENT_DEFAULT) {
+ serializer.startTag(null, TAG_READ_EXTERNAL_STORAGE);
+ serializer.attribute(
+ null, ATTR_ENFORCEMENT, Integer.toString(mReadExternalStorageEnforcement));
+ serializer.endTag(null, TAG_READ_EXTERNAL_STORAGE);
+ }
+
serializer.startTag(null, "permission-trees");
for (BasePermission bp : mPermissionTrees.values()) {
writePermissionLPr(serializer, bp);
@@ -1291,6 +1304,12 @@
Slog.w(PackageManagerService.TAG, "Discard invalid verifier device id: "
+ e.getMessage());
}
+ } else if (TAG_READ_EXTERNAL_STORAGE.equals(tagName)) {
+ final String enforcement = parser.getAttributeValue(null, ATTR_ENFORCEMENT);
+ try {
+ mReadExternalStorageEnforcement = Integer.parseInt(enforcement);
+ } catch (NumberFormatException e) {
+ }
} else {
Slog.w(PackageManagerService.TAG, "Unknown element under <packages>: "
+ parser.getName());
diff --git a/services/java/com/android/server/wm/AppWindowToken.java b/services/java/com/android/server/wm/AppWindowToken.java
index b84fbdb..67b667a 100644
--- a/services/java/com/android/server/wm/AppWindowToken.java
+++ b/services/java/com/android/server/wm/AppWindowToken.java
@@ -27,6 +27,7 @@
import android.view.IApplicationToken;
import android.view.View;
import android.view.WindowManager;
+import android.view.WindowManagerPolicy;
import android.view.animation.Animation;
import android.view.animation.Transformation;
@@ -37,7 +38,7 @@
* Version of WindowToken that is specifically for a particular application (or
* really activity) that is displaying windows.
*/
-class AppWindowToken extends WindowToken implements WindowManagerService.StepAnimator {
+class AppWindowToken extends WindowToken {
// Non-null only for application tokens.
final IApplicationToken appToken;
@@ -195,8 +196,8 @@
}
}
- @Override
- public boolean stepAnimation(long currentTime) {
+
+ private boolean stepAnimation(long currentTime) {
if (animation == null) {
return false;
}
@@ -216,7 +217,7 @@
}
// This must be called while inside a transaction.
- boolean startAndFinishAnimationLocked(long currentTime, int dw, int dh) {
+ boolean stepAnimationLocked(long currentTime, int dw, int dh) {
if (!service.mDisplayFrozen && service.mPolicy.isScreenOnFully()) {
// We will run animations as long as the display isn't frozen.
@@ -239,8 +240,10 @@
animation.setStartTime(currentTime);
animating = true;
}
- // we're done!
- return true;
+ if (stepAnimation(currentTime)) {
+ // we're done!
+ return true;
+ }
}
} else if (animation != null) {
// If the display is frozen, and there is a pending animation,
@@ -255,6 +258,7 @@
return false;
}
+ service.mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
clearAnimation();
animating = false;
if (animLayerAdjustment != 0) {
diff --git a/services/java/com/android/server/wm/BlackFrame.java b/services/java/com/android/server/wm/BlackFrame.java
index 26289c9..40e452a 100644
--- a/services/java/com/android/server/wm/BlackFrame.java
+++ b/services/java/com/android/server/wm/BlackFrame.java
@@ -157,6 +157,14 @@
}
}
+ public void setAlpha(float alpha) {
+ for (int i=0; i<mBlackSurfaces.length; i++) {
+ if (mBlackSurfaces[i] != null) {
+ mBlackSurfaces[i].surface.setAlpha(alpha);
+ }
+ }
+ }
+
public void clearMatrix() {
for (int i=0; i<mBlackSurfaces.length; i++) {
if (mBlackSurfaces[i] != null) {
diff --git a/services/java/com/android/server/wm/ScreenRotationAnimation.java b/services/java/com/android/server/wm/ScreenRotationAnimation.java
index 7b5bf08..e460f7fd 100644
--- a/services/java/com/android/server/wm/ScreenRotationAnimation.java
+++ b/services/java/com/android/server/wm/ScreenRotationAnimation.java
@@ -29,19 +29,21 @@
import android.view.animation.AnimationUtils;
import android.view.animation.Transformation;
-class ScreenRotationAnimation implements WindowManagerService.StepAnimator {
+class ScreenRotationAnimation {
static final String TAG = "ScreenRotationAnimation";
static final boolean DEBUG_STATE = false;
static final boolean DEBUG_TRANSFORMS = false;
+ static final boolean USE_CUSTOM_BLACK_FRAME = false;
static final int FREEZE_LAYER = WindowManagerService.TYPE_LAYER_MULTIPLIER * 200;
final Context mContext;
Surface mSurface;
- BlackFrame mBlackFrame;
+ BlackFrame mCustomBlackFrame;
+ BlackFrame mExitingBlackFrame;
+ BlackFrame mEnteringBlackFrame;
int mWidth, mHeight;
- int mSnapshotRotation;
int mSnapshotDeltaRotation;
int mOriginalRotation;
int mOriginalWidth, mOriginalHeight;
@@ -105,6 +107,7 @@
final Matrix mFrameInitialMatrix = new Matrix();
final Matrix mSnapshotInitialMatrix = new Matrix();
final Matrix mSnapshotFinalMatrix = new Matrix();
+ final Matrix mExitFrameFinalMatrix = new Matrix();
final Matrix mTmpMatrix = new Matrix();
final float[] mTmpFloats = new float[9];
private boolean mMoreRotateEnter;
@@ -121,12 +124,21 @@
pw.print(prefix); pw.print("mSurface="); pw.print(mSurface);
pw.print(" mWidth="); pw.print(mWidth);
pw.print(" mHeight="); pw.println(mHeight);
- pw.print(prefix); pw.print("mBlackFrame="); pw.println(mBlackFrame);
- if (mBlackFrame != null) {
- mBlackFrame.printTo(prefix + " ", pw);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ pw.print(prefix); pw.print("mCustomBlackFrame="); pw.println(mCustomBlackFrame);
+ if (mCustomBlackFrame != null) {
+ mCustomBlackFrame.printTo(prefix + " ", pw);
+ }
}
- pw.print(prefix); pw.print("mSnapshotRotation="); pw.print(mSnapshotRotation);
- pw.print(" mSnapshotDeltaRotation="); pw.print(mSnapshotDeltaRotation);
+ pw.print(prefix); pw.print("mExitingBlackFrame="); pw.println(mExitingBlackFrame);
+ if (mExitingBlackFrame != null) {
+ mExitingBlackFrame.printTo(prefix + " ", pw);
+ }
+ pw.print(prefix); pw.print("mEnteringBlackFrame="); pw.println(mEnteringBlackFrame);
+ if (mEnteringBlackFrame != null) {
+ mEnteringBlackFrame.printTo(prefix + " ", pw);
+ }
+ pw.print(prefix); pw.print(" mSnapshotDeltaRotation="); pw.print(mSnapshotDeltaRotation);
pw.print(" mCurRotation="); pw.println(mCurRotation);
pw.print(prefix); pw.print("mOriginalRotation="); pw.print(mOriginalRotation);
pw.print(" mOriginalWidth="); pw.print(mOriginalWidth);
@@ -166,6 +178,9 @@
mSnapshotInitialMatrix.printShortString(pw);
pw.print(" mSnapshotFinalMatrix="); mSnapshotFinalMatrix.printShortString(pw);
pw.println();
+ pw.print(prefix); pw.print("mExitFrameFinalMatrix=");
+ mExitFrameFinalMatrix.printShortString(pw);
+ pw.println();
}
public ScreenRotationAnimation(Context context, SurfaceSession session,
@@ -173,7 +188,6 @@
mContext = context;
// Screenshot does NOT include rotation!
- mSnapshotRotation = 0;
if (originalRotation == Surface.ROTATION_90
|| originalRotation == Surface.ROTATION_270) {
mWidth = originalHeight;
@@ -197,12 +211,12 @@
try {
mSurface = new Surface(session, 0, "FreezeSurface",
-1, mWidth, mHeight, PixelFormat.OPAQUE, Surface.FX_SURFACE_SCREENSHOT | Surface.HIDDEN);
- if (mSurface == null || !mSurface.isValid()) {
+ if (!mSurface.isValid()) {
// Screenshot failed, punt.
mSurface = null;
return;
}
- mSurface.setLayer(FREEZE_LAYER);
+ mSurface.setLayer(FREEZE_LAYER + 1);
mSurface.show();
} catch (Surface.OutOfResourcesException e) {
Slog.w(TAG, "Unable to allocate freeze surface", e);
@@ -281,7 +295,7 @@
// Compute the transformation matrix that must be applied
// to the snapshot to make it stay in the same original position
// with the current screen rotation.
- int delta = deltaRotation(rotation, mSnapshotRotation);
+ int delta = deltaRotation(rotation, Surface.ROTATION_0);
createRotationMatrix(delta, mWidth, mHeight, mSnapshotInitialMatrix);
if (DEBUG_STATE) Slog.v(TAG, "**** ROTATION: " + delta);
@@ -323,14 +337,18 @@
com.android.internal.R.anim.screen_rotate_start_exit);
mStartEnterAnimation = AnimationUtils.loadAnimation(mContext,
com.android.internal.R.anim.screen_rotate_start_enter);
- mStartFrameAnimation = AnimationUtils.loadAnimation(mContext,
- com.android.internal.R.anim.screen_rotate_start_frame);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ mStartFrameAnimation = AnimationUtils.loadAnimation(mContext,
+ com.android.internal.R.anim.screen_rotate_start_frame);
+ }
mFinishExitAnimation = AnimationUtils.loadAnimation(mContext,
com.android.internal.R.anim.screen_rotate_finish_exit);
mFinishEnterAnimation = AnimationUtils.loadAnimation(mContext,
com.android.internal.R.anim.screen_rotate_finish_enter);
- mFinishFrameAnimation = AnimationUtils.loadAnimation(mContext,
- com.android.internal.R.anim.screen_rotate_finish_frame);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ mFinishFrameAnimation = AnimationUtils.loadAnimation(mContext,
+ com.android.internal.R.anim.screen_rotate_finish_frame);
+ }
}
if (DEBUG_STATE) Slog.v(TAG, "Rotation delta: " + delta + " finalWidth="
@@ -343,16 +361,20 @@
com.android.internal.R.anim.screen_rotate_0_exit);
mRotateEnterAnimation = AnimationUtils.loadAnimation(mContext,
com.android.internal.R.anim.screen_rotate_0_enter);
- mRotateFrameAnimation = AnimationUtils.loadAnimation(mContext,
- com.android.internal.R.anim.screen_rotate_0_frame);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ mRotateFrameAnimation = AnimationUtils.loadAnimation(mContext,
+ com.android.internal.R.anim.screen_rotate_0_frame);
+ }
break;
case Surface.ROTATION_90:
mRotateExitAnimation = AnimationUtils.loadAnimation(mContext,
com.android.internal.R.anim.screen_rotate_plus_90_exit);
mRotateEnterAnimation = AnimationUtils.loadAnimation(mContext,
com.android.internal.R.anim.screen_rotate_plus_90_enter);
- mRotateFrameAnimation = AnimationUtils.loadAnimation(mContext,
- com.android.internal.R.anim.screen_rotate_plus_90_frame);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ mRotateFrameAnimation = AnimationUtils.loadAnimation(mContext,
+ com.android.internal.R.anim.screen_rotate_plus_90_frame);
+ }
break;
case Surface.ROTATION_180:
mRotateExitAnimation = AnimationUtils.loadAnimation(mContext,
@@ -367,8 +389,10 @@
com.android.internal.R.anim.screen_rotate_minus_90_exit);
mRotateEnterAnimation = AnimationUtils.loadAnimation(mContext,
com.android.internal.R.anim.screen_rotate_minus_90_enter);
- mRotateFrameAnimation = AnimationUtils.loadAnimation(mContext,
- com.android.internal.R.anim.screen_rotate_minus_90_frame);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ mRotateFrameAnimation = AnimationUtils.loadAnimation(mContext,
+ com.android.internal.R.anim.screen_rotate_minus_90_frame);
+ }
break;
}
@@ -388,18 +412,23 @@
halfWidth, halfHeight);
mStartExitAnimation.initialize(halfWidth, halfHeight,
mOriginalWidth, mOriginalHeight);
- mStartFrameAnimation.initialize(finalWidth, finalHeight,
- mOriginalWidth, mOriginalHeight);
mFinishEnterAnimation.initialize(finalWidth, finalHeight,
halfWidth, halfHeight);
mFinishExitAnimation.initialize(halfWidth, halfHeight,
mOriginalWidth, mOriginalHeight);
- mFinishFrameAnimation.initialize(finalWidth, finalHeight,
- mOriginalWidth, mOriginalHeight);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ mStartFrameAnimation.initialize(finalWidth, finalHeight,
+ mOriginalWidth, mOriginalHeight);
+ mFinishFrameAnimation.initialize(finalWidth, finalHeight,
+ mOriginalWidth, mOriginalHeight);
+ }
}
mRotateEnterAnimation.initialize(finalWidth, finalHeight, mOriginalWidth, mOriginalHeight);
mRotateExitAnimation.initialize(finalWidth, finalHeight, mOriginalWidth, mOriginalHeight);
- mRotateFrameAnimation.initialize(finalWidth, finalHeight, mOriginalWidth, mOriginalHeight);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ mRotateFrameAnimation.initialize(finalWidth, finalHeight, mOriginalWidth,
+ mOriginalHeight);
+ }
mAnimRunning = false;
mFinishAnimReady = false;
mFinishAnimStartTime = -1;
@@ -409,23 +438,27 @@
mStartExitAnimation.scaleCurrentDuration(animationScale);
mStartEnterAnimation.restrictDuration(maxAnimationDuration);
mStartEnterAnimation.scaleCurrentDuration(animationScale);
- mStartFrameAnimation.restrictDuration(maxAnimationDuration);
- mStartFrameAnimation.scaleCurrentDuration(animationScale);
mFinishExitAnimation.restrictDuration(maxAnimationDuration);
mFinishExitAnimation.scaleCurrentDuration(animationScale);
mFinishEnterAnimation.restrictDuration(maxAnimationDuration);
mFinishEnterAnimation.scaleCurrentDuration(animationScale);
- mFinishFrameAnimation.restrictDuration(maxAnimationDuration);
- mFinishFrameAnimation.scaleCurrentDuration(animationScale);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ mStartFrameAnimation.restrictDuration(maxAnimationDuration);
+ mStartFrameAnimation.scaleCurrentDuration(animationScale);
+ mFinishFrameAnimation.restrictDuration(maxAnimationDuration);
+ mFinishFrameAnimation.scaleCurrentDuration(animationScale);
+ }
}
mRotateExitAnimation.restrictDuration(maxAnimationDuration);
mRotateExitAnimation.scaleCurrentDuration(animationScale);
mRotateEnterAnimation.restrictDuration(maxAnimationDuration);
mRotateEnterAnimation.scaleCurrentDuration(animationScale);
- mRotateFrameAnimation.restrictDuration(maxAnimationDuration);
- mRotateFrameAnimation.scaleCurrentDuration(animationScale);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ mRotateFrameAnimation.restrictDuration(maxAnimationDuration);
+ mRotateFrameAnimation.scaleCurrentDuration(animationScale);
+ }
- if (mBlackFrame == null) {
+ if (USE_CUSTOM_BLACK_FRAME && mCustomBlackFrame == null) {
if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS || DEBUG_STATE) Slog.i(
WindowManagerService.TAG,
">>> OPEN TRANSACTION ScreenRotationAnimation.startAnimation");
@@ -443,8 +476,59 @@
Rect outer = new Rect(-mOriginalWidth*1, -mOriginalHeight*1,
mOriginalWidth*2, mOriginalHeight*2);
Rect inner = new Rect(0, 0, mOriginalWidth, mOriginalHeight);
- mBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER + 1);
- mBlackFrame.setMatrix(mFrameInitialMatrix);
+ mCustomBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER + 3);
+ mCustomBlackFrame.setMatrix(mFrameInitialMatrix);
+ } catch (Surface.OutOfResourcesException e) {
+ Slog.w(TAG, "Unable to allocate black surface", e);
+ } finally {
+ Surface.closeTransaction();
+ if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS || DEBUG_STATE) Slog.i(
+ WindowManagerService.TAG,
+ "<<< CLOSE TRANSACTION ScreenRotationAnimation.startAnimation");
+ }
+ }
+
+ if (mExitingBlackFrame == null) {
+ if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS || DEBUG_STATE) Slog.i(
+ WindowManagerService.TAG,
+ ">>> OPEN TRANSACTION ScreenRotationAnimation.startAnimation");
+ Surface.openTransaction();
+
+ // Compute the transformation matrix that must be applied
+ // the the black frame to make it stay in the initial position
+ // before the new screen rotation. This is different than the
+ // snapshot transformation because the snapshot is always based
+ // of the native orientation of the screen, not the orientation
+ // we were last in.
+ createRotationMatrix(delta, mOriginalWidth, mOriginalHeight, mFrameInitialMatrix);
+
+ try {
+ Rect outer = new Rect(-mOriginalWidth*1, -mOriginalHeight*1,
+ mOriginalWidth*2, mOriginalHeight*2);
+ Rect inner = new Rect(0, 0, mOriginalWidth, mOriginalHeight);
+ mExitingBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER + 2);
+ mExitingBlackFrame.setMatrix(mFrameInitialMatrix);
+ } catch (Surface.OutOfResourcesException e) {
+ Slog.w(TAG, "Unable to allocate black surface", e);
+ } finally {
+ Surface.closeTransaction();
+ if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS || DEBUG_STATE) Slog.i(
+ WindowManagerService.TAG,
+ "<<< CLOSE TRANSACTION ScreenRotationAnimation.startAnimation");
+ }
+ }
+
+ if (false && mEnteringBlackFrame == null) {
+ if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS || DEBUG_STATE) Slog.i(
+ WindowManagerService.TAG,
+ ">>> OPEN TRANSACTION ScreenRotationAnimation.startAnimation");
+ Surface.openTransaction();
+
+ try {
+ Rect outer = new Rect(-finalWidth*1, -finalHeight*1,
+ finalWidth*2, finalHeight*2);
+ Rect inner = new Rect(0, 0, finalWidth, finalHeight);
+ mEnteringBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER);
} catch (Surface.OutOfResourcesException e) {
Slog.w(TAG, "Unable to allocate black surface", e);
} finally {
@@ -489,9 +573,17 @@
mSurface.destroy();
mSurface = null;
}
- if (mBlackFrame != null) {
- mBlackFrame.kill();
- mBlackFrame = null;
+ if (mCustomBlackFrame != null) {
+ mCustomBlackFrame.kill();
+ mCustomBlackFrame = null;
+ }
+ if (mExitingBlackFrame != null) {
+ mExitingBlackFrame.kill();
+ mExitingBlackFrame = null;
+ }
+ if (mEnteringBlackFrame != null) {
+ mEnteringBlackFrame.kill();
+ mEnteringBlackFrame = null;
}
if (mStartExitAnimation != null) {
mStartExitAnimation.cancel();
@@ -540,131 +632,127 @@
|| mRotateFrameAnimation != null;
}
- @Override
- public boolean stepAnimation(long now) {
+ private boolean stepAnimation(long now) {
if (mFinishAnimReady && mFinishAnimStartTime < 0) {
if (DEBUG_STATE) Slog.v(TAG, "Step: finish anim now ready");
mFinishAnimStartTime = now;
}
- // If the start animation is no longer running, we want to keep its
- // transformation intact until the finish animation also completes.
-
mMoreStartExit = false;
if (mStartExitAnimation != null) {
- mStartExitTransformation.clear();
mMoreStartExit = mStartExitAnimation.getTransformation(now, mStartExitTransformation);
if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped start exit: " + mStartExitTransformation);
- if (!mMoreStartExit) {
- if (DEBUG_STATE) Slog.v(TAG, "Start exit animation done!");
- mStartExitAnimation.cancel();
- mStartExitAnimation = null;
- }
}
mMoreStartEnter = false;
if (mStartEnterAnimation != null) {
- mStartEnterTransformation.clear();
mMoreStartEnter = mStartEnterAnimation.getTransformation(now, mStartEnterTransformation);
if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped start enter: " + mStartEnterTransformation);
- if (!mMoreStartEnter) {
- if (DEBUG_STATE) Slog.v(TAG, "Start enter animation done!");
- mStartEnterAnimation.cancel();
- mStartEnterAnimation = null;
- }
}
mMoreStartFrame = false;
if (mStartFrameAnimation != null) {
- mStartFrameTransformation.clear();
mMoreStartFrame = mStartFrameAnimation.getTransformation(now, mStartFrameTransformation);
if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped start frame: " + mStartFrameTransformation);
- if (!mMoreStartFrame) {
- if (DEBUG_STATE) Slog.v(TAG, "Start frame animation done!");
- mStartFrameAnimation.cancel();
- mStartFrameAnimation = null;
- }
}
long finishNow = mFinishAnimReady ? (now - mFinishAnimStartTime) : 0;
if (DEBUG_STATE) Slog.v(TAG, "Step: finishNow=" + finishNow);
- mFinishExitTransformation.clear();
mMoreFinishExit = false;
if (mFinishExitAnimation != null) {
mMoreFinishExit = mFinishExitAnimation.getTransformation(finishNow, mFinishExitTransformation);
if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped finish exit: " + mFinishExitTransformation);
- if (!mMoreStartExit && !mMoreFinishExit) {
- if (DEBUG_STATE) Slog.v(TAG, "Finish exit animation done, clearing start/finish anims!");
- mStartExitTransformation.clear();
- mFinishExitAnimation.cancel();
- mFinishExitAnimation = null;
- mFinishExitTransformation.clear();
- }
}
- mFinishEnterTransformation.clear();
mMoreFinishEnter = false;
if (mFinishEnterAnimation != null) {
mMoreFinishEnter = mFinishEnterAnimation.getTransformation(finishNow, mFinishEnterTransformation);
if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped finish enter: " + mFinishEnterTransformation);
- if (!mMoreStartEnter && !mMoreFinishEnter) {
- if (DEBUG_STATE) Slog.v(TAG, "Finish enter animation done, clearing start/finish anims!");
- mStartEnterTransformation.clear();
- mFinishEnterAnimation.cancel();
- mFinishEnterAnimation = null;
- mFinishEnterTransformation.clear();
- }
}
- mFinishFrameTransformation.clear();
mMoreFinishFrame = false;
if (mFinishFrameAnimation != null) {
mMoreFinishFrame = mFinishFrameAnimation.getTransformation(finishNow, mFinishFrameTransformation);
if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped finish frame: " + mFinishFrameTransformation);
- if (!mMoreStartFrame && !mMoreFinishFrame) {
- if (DEBUG_STATE) Slog.v(TAG, "Finish frame animation done, clearing start/finish anims!");
- mStartFrameTransformation.clear();
- mFinishFrameAnimation.cancel();
- mFinishFrameAnimation = null;
- mFinishFrameTransformation.clear();
- }
}
- mRotateExitTransformation.clear();
mMoreRotateExit = false;
if (mRotateExitAnimation != null) {
mMoreRotateExit = mRotateExitAnimation.getTransformation(now, mRotateExitTransformation);
if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped rotate exit: " + mRotateExitTransformation);
- if (!mMoreFinishExit && !mMoreRotateExit) {
- if (DEBUG_STATE) Slog.v(TAG, "Rotate exit animation done!");
+ }
+
+ mMoreRotateEnter = false;
+ if (mRotateEnterAnimation != null) {
+ mMoreRotateEnter = mRotateEnterAnimation.getTransformation(now, mRotateEnterTransformation);
+ if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped rotate enter: " + mRotateEnterTransformation);
+ }
+
+ mMoreRotateFrame = false;
+ if (mRotateFrameAnimation != null) {
+ mMoreRotateFrame = mRotateFrameAnimation.getTransformation(now, mRotateFrameTransformation);
+ if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped rotate frame: " + mRotateFrameTransformation);
+ }
+
+ if (!mMoreStartExit && !mMoreRotateExit && !mMoreFinishExit) {
+ if (mStartExitAnimation != null) {
+ if (DEBUG_STATE) Slog.v(TAG, "Exit animations done, clearing start exit anim!");
+ mStartExitAnimation.cancel();
+ mStartExitAnimation = null;
+ mStartExitTransformation.clear();
+ }
+ if (mFinishExitAnimation != null) {
+ if (DEBUG_STATE) Slog.v(TAG, "Exit animations done, clearing finish exit anim!");
+ mFinishExitAnimation.cancel();
+ mFinishExitAnimation = null;
+ mFinishExitTransformation.clear();
+ }
+ if (mRotateExitAnimation != null) {
+ if (DEBUG_STATE) Slog.v(TAG, "Exit animations done, clearing rotate exit anim!");
mRotateExitAnimation.cancel();
mRotateExitAnimation = null;
mRotateExitTransformation.clear();
}
}
- mRotateEnterTransformation.clear();
- mMoreRotateEnter = false;
- if (mRotateEnterAnimation != null) {
- mMoreRotateEnter = mRotateEnterAnimation.getTransformation(now, mRotateEnterTransformation);
- if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped rotate enter: " + mRotateEnterTransformation);
- if (!mMoreFinishEnter && !mMoreRotateEnter) {
- if (DEBUG_STATE) Slog.v(TAG, "Rotate enter animation done!");
+ if (!mMoreStartEnter && !mMoreRotateEnter && !mMoreFinishEnter) {
+ if (mStartEnterAnimation != null) {
+ if (DEBUG_STATE) Slog.v(TAG, "Enter animations done, clearing start enter anim!");
+ mStartEnterAnimation.cancel();
+ mStartEnterAnimation = null;
+ mStartEnterTransformation.clear();
+ }
+ if (mFinishEnterAnimation != null) {
+ if (DEBUG_STATE) Slog.v(TAG, "Enter animations done, clearing finish enter anim!");
+ mFinishEnterAnimation.cancel();
+ mFinishEnterAnimation = null;
+ mFinishEnterTransformation.clear();
+ }
+ if (mRotateEnterAnimation != null) {
+ if (DEBUG_STATE) Slog.v(TAG, "Enter animations done, clearing rotate enter anim!");
mRotateEnterAnimation.cancel();
mRotateEnterAnimation = null;
mRotateEnterTransformation.clear();
}
}
- mRotateFrameTransformation.clear();
- mMoreRotateFrame = false;
- if (mRotateFrameAnimation != null) {
- mMoreRotateFrame = mRotateFrameAnimation.getTransformation(now, mRotateFrameTransformation);
- if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped rotate frame: " + mRotateFrameTransformation);
- if (!mMoreFinishFrame && !mMoreRotateFrame) {
- if (DEBUG_STATE) Slog.v(TAG, "Rotate frame animation done!");
+ if (USE_CUSTOM_BLACK_FRAME && !mMoreStartFrame && !mMoreRotateFrame && !mMoreFinishFrame) {
+ if (mStartFrameAnimation != null) {
+ if (DEBUG_STATE) Slog.v(TAG, "Frame animations done, clearing start frame anim!");
+ mStartFrameAnimation.cancel();
+ mStartFrameAnimation = null;
+ mStartFrameTransformation.clear();
+ }
+ if (mFinishFrameAnimation != null) {
+ if (DEBUG_STATE) Slog.v(TAG, "Frame animations done, clearing finish frame anim!");
+ mFinishFrameAnimation.cancel();
+ mFinishFrameAnimation = null;
+ mFinishFrameTransformation.clear();
+ }
+ if (mRotateFrameAnimation != null) {
+ if (DEBUG_STATE) Slog.v(TAG, "Frame animations done, clearing rotate frame anim!");
mRotateFrameAnimation.cancel();
mRotateFrameAnimation = null;
mRotateFrameTransformation.clear();
@@ -679,17 +767,19 @@
mEnterTransformation.compose(mStartEnterTransformation);
mEnterTransformation.compose(mFinishEnterTransformation);
- //mFrameTransformation.set(mRotateExitTransformation);
- //mFrameTransformation.compose(mStartExitTransformation);
- //mFrameTransformation.compose(mFinishExitTransformation);
- mFrameTransformation.set(mRotateFrameTransformation);
- mFrameTransformation.compose(mStartFrameTransformation);
- mFrameTransformation.compose(mFinishFrameTransformation);
- mFrameTransformation.getMatrix().preConcat(mFrameInitialMatrix);
-
if (DEBUG_TRANSFORMS) Slog.v(TAG, "Final exit: " + mExitTransformation);
if (DEBUG_TRANSFORMS) Slog.v(TAG, "Final enter: " + mEnterTransformation);
- if (DEBUG_TRANSFORMS) Slog.v(TAG, "Final frame: " + mFrameTransformation);
+
+ if (USE_CUSTOM_BLACK_FRAME) {
+ //mFrameTransformation.set(mRotateExitTransformation);
+ //mFrameTransformation.compose(mStartExitTransformation);
+ //mFrameTransformation.compose(mFinishExitTransformation);
+ mFrameTransformation.set(mRotateFrameTransformation);
+ mFrameTransformation.compose(mStartFrameTransformation);
+ mFrameTransformation.compose(mFinishFrameTransformation);
+ mFrameTransformation.getMatrix().preConcat(mFrameInitialMatrix);
+ if (DEBUG_TRANSFORMS) Slog.v(TAG, "Final frame: " + mFrameTransformation);
+ }
final boolean more = mMoreStartEnter || mMoreStartExit || mMoreStartFrame
|| mMoreFinishEnter || mMoreFinishExit || mMoreFinishFrame
@@ -704,28 +794,46 @@
}
void updateSurfaces() {
- if (!mMoreStartExit && !mMoreFinishExit && !mMoreRotateExit) {
- if (mSurface != null) {
+ if (mSurface != null) {
+ if (!mMoreStartExit && !mMoreFinishExit && !mMoreRotateExit) {
if (DEBUG_STATE) Slog.v(TAG, "Exit animations done, hiding screenshot surface");
mSurface.hide();
}
}
- if (!mMoreStartFrame && !mMoreFinishFrame && !mMoreRotateFrame) {
- if (mBlackFrame != null) {
+ if (mCustomBlackFrame != null) {
+ if (!mMoreStartFrame && !mMoreFinishFrame && !mMoreRotateFrame) {
if (DEBUG_STATE) Slog.v(TAG, "Frame animations done, hiding black frame");
- mBlackFrame.hide();
+ mCustomBlackFrame.hide();
+ } else {
+ mCustomBlackFrame.setMatrix(mFrameTransformation.getMatrix());
}
- } else {
- if (mBlackFrame != null) {
- mBlackFrame.setMatrix(mFrameTransformation.getMatrix());
+ }
+
+ if (mExitingBlackFrame != null) {
+ if (!mMoreStartExit && !mMoreFinishExit && !mMoreRotateExit) {
+ if (DEBUG_STATE) Slog.v(TAG, "Frame animations done, hiding exiting frame");
+ mExitingBlackFrame.hide();
+ } else {
+ mExitFrameFinalMatrix.setConcat(mExitTransformation.getMatrix(), mFrameInitialMatrix);
+ mExitingBlackFrame.setMatrix(mExitFrameFinalMatrix);
+ mExitingBlackFrame.setAlpha(mExitTransformation.getAlpha());
+ }
+ }
+
+ if (mEnteringBlackFrame != null) {
+ if (!mMoreStartEnter && !mMoreFinishEnter && !mMoreRotateEnter) {
+ if (DEBUG_STATE) Slog.v(TAG, "Frame animations done, hiding entering frame");
+ mEnteringBlackFrame.hide();
+ } else {
+ mEnteringBlackFrame.setMatrix(mEnterTransformation.getMatrix());
}
}
setSnapshotTransform(mSnapshotFinalMatrix, mExitTransformation.getAlpha());
}
- public boolean startAndFinishAnimationLocked(long now) {
+ public boolean stepAnimationLocked(long now) {
if (!isAnimating()) {
if (DEBUG_STATE) Slog.v(TAG, "Step: no animations running");
mFinishAnimReady = false;
@@ -763,8 +871,8 @@
}
mAnimRunning = true;
}
-
- return true;
+
+ return stepAnimation(now);
}
public Transformation getEnterTransformation() {
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 22949f3..6993657 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -461,6 +461,7 @@
= new ArrayList<IRotationWatcher>();
int mDeferredRotationPauseCount;
+ int mPendingLayoutChanges = 0;
boolean mLayoutNeeded = true;
boolean mTraversalScheduled = false;
boolean mDisplayFrozen = false;
@@ -617,18 +618,6 @@
final AnimationRunnable mAnimationRunnable = new AnimationRunnable();
boolean mAnimationScheduled;
- interface StepAnimator {
- /**
- * Continue the stepping of an ongoing animation. When the animation completes this method
- * must disable the animation on the StepAnimator.
- * @param currentTime Animation time in milliseconds. Use SystemClock.uptimeMillis().
- * @return True if the animation is still going on, false if the animation has completed
- * and stepAnimation has cleared the animation locally.
- */
- boolean stepAnimation(long currentTime);
- }
- final ArrayList<StepAnimator> mStepAnimators = new ArrayList<StepAnimator>();
-
final class DragInputEventReceiver extends InputEventReceiver {
public DragInputEventReceiver(InputChannel inputChannel, Looper looper) {
super(inputChannel, looper);
@@ -1592,8 +1581,7 @@
+ w.isReadyForDisplay() + " drawpending=" + w.mDrawPending
+ " commitdrawpending=" + w.mCommitDrawPending);
if ((w.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0 && w.isReadyForDisplay()
- && (mWallpaperTarget == w
- || (!w.mDrawPending && !w.mCommitDrawPending))) {
+ && (mWallpaperTarget == w || w.isDrawnLw())) {
if (DEBUG_WALLPAPER) Slog.v(TAG,
"Found wallpaper activity: #" + i + "=" + w);
foundW = w;
@@ -2699,8 +2687,7 @@
win.mEnterAnimationPending = true;
}
if (displayed) {
- if (win.mSurface != null && !win.mDrawPending
- && !win.mCommitDrawPending && !mDisplayFrozen
+ if (win.isDrawnLw() && !mDisplayFrozen
&& mDisplayEnabled && mPolicy.isScreenOnFully()) {
applyEnterAnimationLocked(win);
}
@@ -2995,15 +2982,27 @@
}
void applyEnterAnimationLocked(WindowState win) {
- int transit = WindowManagerPolicy.TRANSIT_SHOW;
+ final int transit;
if (win.mEnterAnimationPending) {
win.mEnterAnimationPending = false;
transit = WindowManagerPolicy.TRANSIT_ENTER;
+ } else {
+ transit = WindowManagerPolicy.TRANSIT_SHOW;
}
applyAnimationLocked(win, transit, true);
}
+ /**
+ * Choose the correct animation and set it to the passed WindowState.
+ * @param win The window to add the animation to.
+ * @param transit If WindowManagerPolicy.TRANSIT_PREVIEW_DONE and the app window has been drawn
+ * then the animation will be app_starting_exit. Any other value loads the animation from
+ * the switch statement below.
+ * @param isEntrance The animation type the last time this was called. Used to keep from
+ * loading the same animation twice.
+ * @return true if an animation has been loaded.
+ */
boolean applyAnimationLocked(WindowState win,
int transit, boolean isEntrance) {
if (win.mLocalAnimating && win.mAnimationIsEntrance == isEntrance) {
@@ -3982,8 +3981,7 @@
// If we are being set visible, and the starting window is
// not yet displayed, then make sure it doesn't get displayed.
WindowState swin = wtoken.startingWindow;
- if (swin != null && (swin.mDrawPending
- || swin.mCommitDrawPending)) {
+ if (swin != null && !swin.isDrawnLw()) {
swin.mPolicyVisibility = false;
swin.mPolicyVisibilityAfterAnim = false;
}
@@ -7643,20 +7641,6 @@
}
/**
- * Run through each of the animating objects saved in mStepAnimators.
- */
- private void stepAnimations() {
- final long currentTime = SystemClock.uptimeMillis();
- for (final StepAnimator stepAnimator : mStepAnimators) {
- final boolean more = stepAnimator.stepAnimation(currentTime);
- if (DEBUG_ANIM) {
- Slog.v(TAG, "stepAnimations: " + currentTime + ": Stepped " + stepAnimator
- + (more ? " more" : " done"));
- }
- }
- }
-
- /**
* Extracted from {@link #performLayoutAndPlaceSurfacesLockedInner} to reduce size of method.
* Update animations of all applications, including those associated with exiting/removed apps.
*
@@ -7670,36 +7654,88 @@
final int NAT = mAppTokens.size();
for (i=0; i<NAT; i++) {
final AppWindowToken appToken = mAppTokens.get(i);
- if (appToken.startAndFinishAnimationLocked(currentTime, innerDw, innerDh)) {
- mStepAnimators.add(appToken);
+ if (appToken.stepAnimationLocked(currentTime, innerDw, innerDh)) {
mInnerFields.mAnimating = true;
}
}
final int NEAT = mExitingAppTokens.size();
for (i=0; i<NEAT; i++) {
final AppWindowToken appToken = mExitingAppTokens.get(i);
- if (appToken.startAndFinishAnimationLocked(currentTime, innerDw, innerDh)) {
- mStepAnimators.add(appToken);
+ if (appToken.stepAnimationLocked(currentTime, innerDw, innerDh)) {
mInnerFields.mAnimating = true;
}
}
- if (mScreenRotationAnimation != null) {
- if (mScreenRotationAnimation.isAnimating() ||
- mScreenRotationAnimation.mFinishAnimReady) {
- if (mScreenRotationAnimation.startAndFinishAnimationLocked(currentTime)) {
- mInnerFields.mUpdateRotation = false;
- mInnerFields.mAnimating = true;
- mStepAnimators.add(mScreenRotationAnimation);
- } else {
- mInnerFields.mUpdateRotation = true;
- mScreenRotationAnimation.kill();
- mScreenRotationAnimation = null;
- }
+ if (mScreenRotationAnimation != null &&
+ (mScreenRotationAnimation.isAnimating() ||
+ mScreenRotationAnimation.mFinishAnimReady)) {
+ if (mScreenRotationAnimation.stepAnimationLocked(currentTime)) {
+ mInnerFields.mUpdateRotation = false;
+ mInnerFields.mAnimating = true;
+ } else {
+ mInnerFields.mUpdateRotation = true;
+ mScreenRotationAnimation.kill();
+ mScreenRotationAnimation = null;
}
}
}
+ private void animateAndUpdateSurfaces(final long currentTime, final int dw, final int dh,
+ final int innerDw, final int innerDh,
+ final boolean recoveringMemory) {
+ // Update animations of all applications, including those
+ // associated with exiting/removed apps
+ Surface.openTransaction();
+
+ try {
+ updateWindowsAppsAndRotationAnimationsLocked(currentTime, innerDw, innerDh);
+ mPendingLayoutChanges = performAnimationsLocked(currentTime, dw, dh,
+ innerDw, innerDh);
+
+ // THIRD LOOP: Update the surfaces of all windows.
+
+ if (mScreenRotationAnimation != null) {
+ mScreenRotationAnimation.updateSurfaces();
+ }
+
+ final int N = mWindows.size();
+ for (int i=N-1; i>=0; i--) {
+ WindowState w = mWindows.get(i);
+ prepareSurfaceLocked(w, recoveringMemory);
+ }
+
+ if (mDimAnimator != null && mDimAnimator.mDimShown) {
+ mInnerFields.mAnimating |=
+ mDimAnimator.updateSurface(mInnerFields.mDimming, currentTime,
+ mDisplayFrozen || !mDisplayEnabled || !mPolicy.isScreenOnFully());
+ }
+
+ if (!mInnerFields.mBlurring && mBlurShown) {
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, " BLUR " + mBlurSurface
+ + ": HIDE");
+ try {
+ mBlurSurface.hide();
+ } catch (IllegalArgumentException e) {
+ Slog.w(TAG, "Illegal argument exception hiding blur surface");
+ }
+ mBlurShown = false;
+ }
+
+ if (mBlackFrame != null) {
+ if (mScreenRotationAnimation != null) {
+ mBlackFrame.setMatrix(
+ mScreenRotationAnimation.getEnterTransformation().getMatrix());
+ } else {
+ mBlackFrame.clearMatrix();
+ }
+ }
+ } catch (RuntimeException e) {
+ Log.wtf(TAG, "Unhandled exception in Window Manager", e);
+ } finally {
+ Surface.closeTransaction();
+ }
+ }
+
/**
* Extracted from {@link #performLayoutAndPlaceSurfacesLockedInner} to reduce size of method.
*
@@ -7711,9 +7747,7 @@
*/
private int updateWindowsAndWallpaperLocked(final long currentTime, final int dw, final int dh,
final int innerDw, final int innerDh) {
-
- mPolicy.beginAnimationLw(dw, dh);
-
+ int changes = 0;
for (int i = mWindows.size() - 1; i >= 0; i--) {
WindowState w = mWindows.get(i);
@@ -7727,6 +7761,7 @@
if (DEBUG_WALLPAPER) Slog.v(TAG,
"First draw done in potential wallpaper target " + w);
mInnerFields.mWallpaperMayChange = true;
+ changes |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
}
}
@@ -7749,13 +7784,7 @@
}
final boolean wasAnimating = w.mWasAnimating;
-
-
- final boolean nowAnimating = w.startAndFinishAnimationLocked(currentTime);
- if (nowAnimating) {
- mStepAnimators.add(w);
- mInnerFields.mAnimating = true;
- }
+ final boolean nowAnimating = w.stepAnimationLocked(currentTime);
if (DEBUG_WALLPAPER) {
Slog.v(TAG, w + ": wasAnimating=" + wasAnimating +
@@ -7806,6 +7835,7 @@
if (wasAnimating && !w.mAnimating && mWallpaperTarget == w) {
mInnerFields.mWallpaperMayChange = true;
+ changes |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
}
if (mPolicy.doesForceHide(w, attrs)) {
@@ -7814,6 +7844,7 @@
"Animation started that could impact force hide: "
+ w);
mInnerFields.mWallpaperForceHidingChanged = true;
+ changes |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
mFocusMayChange = true;
} else if (w.isReadyForDisplay() && w.mAnimation == null) {
mInnerFields.mForceHiding = true;
@@ -7852,10 +7883,9 @@
if (changed && (attrs.flags
& WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER) != 0) {
mInnerFields.mWallpaperMayChange = true;
+ changes |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
}
}
-
- mPolicy.animatingWindowLw(w, attrs);
}
final AppWindowToken atoken = w.mAppToken;
@@ -7900,10 +7930,11 @@
}
} else if (w.mReadyToShow) {
w.performShowLocked();
+ changes |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
}
} // end forall windows
- return mPolicy.finishAnimationLw();
+ return changes;
}
/**
@@ -8322,6 +8353,72 @@
return changes;
}
+ private void updateResizingWindows(final WindowState w) {
+ if (!w.mAppFreezing && w.mLayoutSeq == mLayoutSeq) {
+ w.mContentInsetsChanged |=
+ !w.mLastContentInsets.equals(w.mContentInsets);
+ w.mVisibleInsetsChanged |=
+ !w.mLastVisibleInsets.equals(w.mVisibleInsets);
+ boolean configChanged =
+ w.mConfiguration != mCurConfiguration
+ && (w.mConfiguration == null
+ || mCurConfiguration.diff(w.mConfiguration) != 0);
+ if (DEBUG_CONFIGURATION && configChanged) {
+ Slog.v(TAG, "Win " + w + " config changed: "
+ + mCurConfiguration);
+ }
+ if (localLOGV) Slog.v(TAG, "Resizing " + w
+ + ": configChanged=" + configChanged
+ + " last=" + w.mLastFrame + " frame=" + w.mFrame);
+ w.mLastFrame.set(w.mFrame);
+ if (w.mContentInsetsChanged
+ || w.mVisibleInsetsChanged
+ || w.mSurfaceResized
+ || configChanged) {
+ if (DEBUG_RESIZE || DEBUG_ORIENTATION) {
+ Slog.v(TAG, "Resize reasons: "
+ + " contentInsetsChanged=" + w.mContentInsetsChanged
+ + " visibleInsetsChanged=" + w.mVisibleInsetsChanged
+ + " surfaceResized=" + w.mSurfaceResized
+ + " configChanged=" + configChanged);
+ }
+
+ w.mLastContentInsets.set(w.mContentInsets);
+ w.mLastVisibleInsets.set(w.mVisibleInsets);
+ makeWindowFreezingScreenIfNeededLocked(w);
+ // If the orientation is changing, then we need to
+ // hold off on unfreezing the display until this
+ // window has been redrawn; to do that, we need
+ // to go through the process of getting informed
+ // by the application when it has finished drawing.
+ if (w.mOrientationChanging) {
+ if (DEBUG_ORIENTATION) Slog.v(TAG,
+ "Orientation start waiting for draw in "
+ + w + ", surface " + w.mSurface);
+ w.mDrawPending = true;
+ w.mCommitDrawPending = false;
+ w.mReadyToShow = false;
+ if (w.mAppToken != null) {
+ w.mAppToken.allDrawn = false;
+ }
+ }
+ if (!mResizingWindows.contains(w)) {
+ if (DEBUG_RESIZE || DEBUG_ORIENTATION) Slog.v(TAG,
+ "Resizing window " + w + " to " + w.mSurfaceW
+ + "x" + w.mSurfaceH);
+ mResizingWindows.add(w);
+ }
+ } else if (w.mOrientationChanging) {
+ if (w.isDrawnLw()) {
+ if (DEBUG_ORIENTATION) Slog.v(TAG,
+ "Orientation not waiting for draw in "
+ + w + ", surface " + w.mSurface);
+ w.mOrientationChanging = false;
+ }
+ }
+ }
+ }
+
/**
* Extracted from {@link #performLayoutAndPlaceSurfacesLockedInner} to reduce size of method.
*
@@ -8343,6 +8440,16 @@
// cases while they are hidden such as when first showing a
// window.
+ if (w.mSurface == null) {
+ if (w.mOrientationChanging) {
+ if (DEBUG_ORIENTATION) {
+ Slog.v(TAG, "Orientation change skips hidden " + w);
+ }
+ w.mOrientationChanging = false;
+ }
+ return;
+ }
+
boolean displayed = false;
w.computeShownFrameLocked();
@@ -8407,69 +8514,7 @@
}
}
- if (!w.mAppFreezing && w.mLayoutSeq == mLayoutSeq) {
- w.mContentInsetsChanged |=
- !w.mLastContentInsets.equals(w.mContentInsets);
- w.mVisibleInsetsChanged |=
- !w.mLastVisibleInsets.equals(w.mVisibleInsets);
- boolean configChanged =
- w.mConfiguration != mCurConfiguration
- && (w.mConfiguration == null
- || mCurConfiguration.diff(w.mConfiguration) != 0);
- if (DEBUG_CONFIGURATION && configChanged) {
- Slog.v(TAG, "Win " + w + " config changed: "
- + mCurConfiguration);
- }
- if (localLOGV) Slog.v(TAG, "Resizing " + w
- + ": configChanged=" + configChanged
- + " last=" + w.mLastFrame + " frame=" + w.mFrame);
- w.mLastFrame.set(w.mFrame);
- if (w.mContentInsetsChanged
- || w.mVisibleInsetsChanged
- || w.mSurfaceResized
- || configChanged) {
- if (DEBUG_RESIZE || DEBUG_ORIENTATION) {
- Slog.v(TAG, "Resize reasons: "
- + " contentInsetsChanged=" + w.mContentInsetsChanged
- + " visibleInsetsChanged=" + w.mVisibleInsetsChanged
- + " surfaceResized=" + w.mSurfaceResized
- + " configChanged=" + configChanged);
- }
-
- w.mLastContentInsets.set(w.mContentInsets);
- w.mLastVisibleInsets.set(w.mVisibleInsets);
- makeWindowFreezingScreenIfNeededLocked(w);
- // If the orientation is changing, then we need to
- // hold off on unfreezing the display until this
- // window has been redrawn; to do that, we need
- // to go through the process of getting informed
- // by the application when it has finished drawing.
- if (w.mOrientationChanging) {
- if (DEBUG_ORIENTATION) Slog.v(TAG,
- "Orientation start waiting for draw in "
- + w + ", surface " + w.mSurface);
- w.mDrawPending = true;
- w.mCommitDrawPending = false;
- w.mReadyToShow = false;
- if (w.mAppToken != null) {
- w.mAppToken.allDrawn = false;
- }
- }
- if (!mResizingWindows.contains(w)) {
- if (DEBUG_RESIZE || DEBUG_ORIENTATION) Slog.v(TAG,
- "Resizing window " + w + " to " + w.mSurfaceW
- + "x" + w.mSurfaceH);
- mResizingWindows.add(w);
- }
- } else if (w.mOrientationChanging) {
- if (!w.mDrawPending && !w.mCommitDrawPending) {
- if (DEBUG_ORIENTATION) Slog.v(TAG,
- "Orientation not waiting for draw in "
- + w + ", surface " + w.mSurface);
- w.mOrientationChanging = false;
- }
- }
- }
+ updateResizingWindows(w);
if (w.mAttachedHidden || !w.isReadyForDisplay()) {
if (!w.mLastHidden) {
@@ -8538,8 +8583,7 @@
}
}
- if (w.mLastHidden && !w.mDrawPending
- && !w.mCommitDrawPending
+ if (w.mLastHidden && w.isDrawnLw()
&& !w.mReadyToShow) {
if (SHOW_TRANSACTIONS) logSurface(w,
"SHOW (performLayout)", null);
@@ -8561,7 +8605,7 @@
if (displayed) {
if (w.mOrientationChanging) {
- if (w.mDrawPending || w.mCommitDrawPending) {
+ if (!w.isDrawnLw()) {
mInnerFields.mOrientationChangeComplete = false;
if (DEBUG_ORIENTATION) Slog.v(TAG,
"Orientation continue waiting for draw in " + w);
@@ -8678,6 +8722,67 @@
}
}
+ private final int performAnimationsLocked(long currentTime, int dw, int dh,
+ int innerDw, int innerDh) {
+ ++mTransactionSequence;
+
+ if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "*** ANIM STEP: seq="
+ + mTransactionSequence + " mAnimating="
+ + mInnerFields.mAnimating);
+
+ mInnerFields.mTokenMayBeDrawn = false;
+ mInnerFields.mWallpaperMayChange = false;
+ mInnerFields.mForceHiding = false;
+ mInnerFields.mDetachedWallpaper = null;
+ mInnerFields.mWindowAnimationBackground = null;
+ mInnerFields.mWindowAnimationBackgroundColor = 0;
+
+ int changes = updateWindowsAndWallpaperLocked(currentTime, dw, dh, innerDw, innerDh);
+
+ if (mInnerFields.mTokenMayBeDrawn) {
+ changes |= testTokenMayBeDrawnLocked();
+ }
+
+ // If we are ready to perform an app transition, check through
+ // all of the app tokens to be shown and see if they are ready
+ // to go.
+ if (mAppTransitionReady) {
+ changes |= handleAppTransitionReadyLocked();
+ }
+
+ mInnerFields.mAdjResult = 0;
+
+ if (!mInnerFields.mAnimating && mAppTransitionRunning) {
+ // We have finished the animation of an app transition. To do
+ // this, we have delayed a lot of operations like showing and
+ // hiding apps, moving apps in Z-order, etc. The app token list
+ // reflects the correct Z-order, but the window list may now
+ // be out of sync with it. So here we will just rebuild the
+ // entire app window list. Fun!
+ changes |= handleAnimatingStoppedAndTransitionLocked();
+ }
+
+ if (mInnerFields.mWallpaperForceHidingChanged && changes == 0 && !mAppTransitionReady) {
+ // At this point, there was a window with a wallpaper that
+ // was force hiding other windows behind it, but now it
+ // is going away. This may be simple -- just animate
+ // away the wallpaper and its window -- or it may be
+ // hard -- the wallpaper now needs to be shown behind
+ // something that was hidden.
+ changes |= animateAwayWallpaperLocked();
+ }
+
+ changes |= testWallpaperAndBackgroundLocked();
+
+ if (mLayoutNeeded) {
+ changes |= PhoneWindowManager.FINISH_LAYOUT_REDO_LAYOUT;
+ }
+
+ if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "*** ANIM STEP: changes=0x"
+ + Integer.toHexString(changes));
+ return changes;
+ }
+
// "Something has changed! Let's make it correct now."
private final void performLayoutAndPlaceSurfacesLockedInner(
boolean recoveringMemory) {
@@ -8741,7 +8846,6 @@
try {
mInnerFields.mWallpaperForceHidingChanged = false;
int repeats = 0;
- int changes = 0;
do {
repeats++;
@@ -8751,20 +8855,20 @@
break;
}
- if ((changes & WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER) != 0) {
+ if ((mPendingLayoutChanges & WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER) != 0) {
if ((adjustWallpaperWindowsLocked()&ADJUST_WALLPAPER_LAYERS_CHANGED) != 0) {
assignLayersLocked();
mLayoutNeeded = true;
}
}
- if ((changes & WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG) != 0) {
+ if ((mPendingLayoutChanges & WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG) != 0) {
if (DEBUG_LAYOUT) Slog.v(TAG, "Computing new config from layout");
if (updateOrientationFromAppTokensLocked(true)) {
mLayoutNeeded = true;
mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION);
}
}
- if ((changes & WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT) != 0) {
+ if ((mPendingLayoutChanges & WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT) != 0) {
mLayoutNeeded = true;
}
@@ -8775,107 +8879,34 @@
Slog.w(TAG, "Layout repeat skipped after too many iterations");
}
- ++mTransactionSequence;
-
- if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "*** ANIM STEP: seq="
- + mTransactionSequence + " mAnimating="
- + mInnerFields.mAnimating);
-
- mInnerFields.mTokenMayBeDrawn = false;
- mInnerFields.mWallpaperMayChange = false;
- mInnerFields.mForceHiding = false;
- mInnerFields.mDetachedWallpaper = null;
- mInnerFields.mWindowAnimationBackground = null;
- mInnerFields.mWindowAnimationBackgroundColor = 0;
-
- mStepAnimators.clear();
- changes = updateWindowsAndWallpaperLocked(currentTime, dw, dh, innerDw, innerDh);
-
- if (mInnerFields.mTokenMayBeDrawn) {
- changes |= testTokenMayBeDrawnLocked();
+ // FIRST AND ONE HALF LOOP: Make WindowManagerPolicy think
+ // it is animating.
+ mPendingLayoutChanges = 0;
+ mPolicy.beginAnimationLw(dw, dh);
+ for (i = mWindows.size() - 1; i >= 0; i--) {
+ WindowState w = mWindows.get(i);
+ if (w.mSurface != null) {
+ mPolicy.animatingWindowLw(w, w.mAttrs);
+ }
}
+ mPendingLayoutChanges |= mPolicy.finishAnimationLw();
+
+ } while (mPendingLayoutChanges != 0);
- // If we are ready to perform an app transition, check through
- // all of the app tokens to be shown and see if they are ready
- // to go.
- if (mAppTransitionReady) {
- changes |= handleAppTransitionReadyLocked();
- }
-
- mInnerFields.mAdjResult = 0;
-
- if (!mInnerFields.mAnimating && mAppTransitionRunning) {
- // We have finished the animation of an app transition. To do
- // this, we have delayed a lot of operations like showing and
- // hiding apps, moving apps in Z-order, etc. The app token list
- // reflects the correct Z-order, but the window list may now
- // be out of sync with it. So here we will just rebuild the
- // entire app window list. Fun!
- changes |= handleAnimatingStoppedAndTransitionLocked();
- }
-
- if (mInnerFields.mWallpaperForceHidingChanged && changes == 0 && !mAppTransitionReady) {
- // At this point, there was a window with a wallpaper that
- // was force hiding other windows behind it, but now it
- // is going away. This may be simple -- just animate
- // away the wallpaper and its window -- or it may be
- // hard -- the wallpaper now needs to be shown behind
- // something that was hidden.
- changes |= animateAwayWallpaperLocked();
- }
-
- changes |= testWallpaperAndBackgroundLocked();
-
- if (mLayoutNeeded) {
- changes |= PhoneWindowManager.FINISH_LAYOUT_REDO_LAYOUT;
- }
-
- if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "*** ANIM STEP: changes=0x"
- + Integer.toHexString(changes));
- } while (changes != 0);
-
- // Update animations of all applications, including those
- // associated with exiting/removed apps
-
- updateWindowsAppsAndRotationAnimationsLocked(currentTime, innerDw, innerDh);
-
- stepAnimations();
-
- // THIRD LOOP: Update the surfaces of all windows.
-
- final boolean someoneLosingFocus = mLosingFocus.size() != 0;
+ final boolean someoneLosingFocus = !mLosingFocus.isEmpty();
mInnerFields.mObscured = false;
mInnerFields.mBlurring = false;
mInnerFields.mDimming = false;
mInnerFields.mSyswin = false;
-
- if (mScreenRotationAnimation != null) {
- mScreenRotationAnimation.updateSurfaces();
- }
-
+
final int N = mWindows.size();
-
for (i=N-1; i>=0; i--) {
WindowState w = mWindows.get(i);
+ //Slog.i(TAG, "Window " + this + " clearing mContentChanged - done placing");
+ w.mContentChanged = false;
- if (w.mSurface != null) {
- prepareSurfaceLocked(w, recoveringMemory);
- } else if (w.mOrientationChanging) {
- if (DEBUG_ORIENTATION) {
- Slog.v(TAG, "Orientation change skips hidden " + w);
- }
- w.mOrientationChanging = false;
- }
-
- if (w.mContentChanged) {
- //Slog.i(TAG, "Window " + this + " clearing mContentChanged - done placing");
- w.mContentChanged = false;
- }
-
- final boolean canBeSeen = w.isDisplayedLw();
-
- if (someoneLosingFocus && w == mCurrentFocus && canBeSeen) {
+ if (someoneLosingFocus && w == mCurrentFocus && w.isDisplayedLw()) {
focusDisplayed = true;
}
@@ -8894,37 +8925,15 @@
updateWallpaperVisibilityLocked();
}
}
-
- if (mDimAnimator != null && mDimAnimator.mDimShown) {
- mInnerFields.mAnimating |=
- mDimAnimator.updateSurface(mInnerFields.mDimming, currentTime,
- mDisplayFrozen || !mDisplayEnabled || !mPolicy.isScreenOnFully());
- }
-
- if (!mInnerFields.mBlurring && mBlurShown) {
- if (SHOW_TRANSACTIONS) Slog.i(TAG, " BLUR " + mBlurSurface
- + ": HIDE");
- try {
- mBlurSurface.hide();
- } catch (IllegalArgumentException e) {
- Slog.w(TAG, "Illegal argument exception hiding blur surface");
- }
- mBlurShown = false;
- }
-
- if (mBlackFrame != null) {
- if (mScreenRotationAnimation != null) {
- mBlackFrame.setMatrix(
- mScreenRotationAnimation.getEnterTransformation().getMatrix());
- } else {
- mBlackFrame.clearMatrix();
- }
- }
} catch (RuntimeException e) {
Log.wtf(TAG, "Unhandled exception in Window Manager", e);
+ } finally {
+ Surface.closeTransaction();
}
- Surface.closeTransaction();
+ // Update animations of all applications, including those
+ // associated with exiting/removed apps
+ animateAndUpdateSurfaces(currentTime, dw, dh, innerDw, innerDh, recoveringMemory);
if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
"<<< CLOSE TRANSACTION performLayoutAndPlaceSurfaces");
@@ -9049,6 +9058,13 @@
if (wallpaperDestroyed) {
needRelayout = adjustWallpaperWindowsLocked() != 0;
}
+ if ((mPendingLayoutChanges & (
+ WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER |
+ ADJUST_WALLPAPER_LAYERS_CHANGED |
+ WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG |
+ WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT)) != 0) {
+ needRelayout = true;
+ }
if (needRelayout) {
requestTraversalLocked();
} else if (mInnerFields.mAnimating) {
diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java
index e11c87a..57d0374 100644
--- a/services/java/com/android/server/wm/WindowState.java
+++ b/services/java/com/android/server/wm/WindowState.java
@@ -54,8 +54,7 @@
/**
* A window in the window manager.
*/
-final class WindowState implements WindowManagerPolicy.WindowState,
- WindowManagerService.StepAnimator {
+final class WindowState implements WindowManagerPolicy.WindowState {
static final boolean DEBUG_VISIBILITY = WindowManagerService.DEBUG_VISIBILITY;
static final boolean SHOW_TRANSACTIONS = WindowManagerService.SHOW_TRANSACTIONS;
static final boolean SHOW_LIGHT_TRANSACTIONS = WindowManagerService.SHOW_LIGHT_TRANSACTIONS;
@@ -306,11 +305,6 @@
int mAnimDw;
int mAnimDh;
- static final int ANIM_STATE_IDLE = 0;
- static final int ANIM_STATE_RUNNING = 1;
- static final int ANIM_STATE_STOPPING = 2;
- int mAnimState = ANIM_STATE_IDLE;
-
WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token,
WindowState attachedWindow, int seq, WindowManager.LayoutParams a,
int viewVisibility) {
@@ -654,7 +648,6 @@
mLocalAnimating = false;
mAnimation.cancel();
mAnimation = null;
- mAnimState = ANIM_STATE_IDLE;
}
}
@@ -666,7 +659,6 @@
mAnimation.cancel();
mAnimation = null;
destroySurfaceLocked();
- mAnimState = ANIM_STATE_IDLE;
}
mExiting = false;
}
@@ -972,7 +964,8 @@
mAppToken.firstWindowDrawn = true;
if (mAppToken.startingData != null) {
- if (WindowManagerService.DEBUG_STARTING_WINDOW || WindowManagerService.DEBUG_ANIM) Slog.v(WindowManagerService.TAG,
+ if (WindowManagerService.DEBUG_STARTING_WINDOW ||
+ WindowManagerService.DEBUG_ANIM) Slog.v(WindowManagerService.TAG,
"Finish starting " + mToken
+ ": first real window is shown, no animation");
// If this initial window is animating, stop it -- we
@@ -984,7 +977,6 @@
mAnimation = null;
// Make sure we clean up the animation.
mAnimating = true;
- mAnimState = ANIM_STATE_IDLE;
}
mService.mFinishedStarting.add(mAppToken);
mService.mH.sendEmptyMessage(H.FINISHED_STARTING);
@@ -995,9 +987,8 @@
return true;
}
- @Override
- public boolean stepAnimation(long currentTime) {
- if ((mAnimation == null) || !mLocalAnimating || (mAnimState != ANIM_STATE_RUNNING)) {
+ private boolean stepAnimation(long currentTime) {
+ if ((mAnimation == null) || !mLocalAnimating) {
return false;
}
mTransformation.clear();
@@ -1005,22 +996,19 @@
if (WindowManagerService.DEBUG_ANIM) Slog.v(
WindowManagerService.TAG, "Stepped animation in " + this +
": more=" + more + ", xform=" + mTransformation);
- if (!more) {
- mAnimState = ANIM_STATE_STOPPING;
- }
return more;
}
// This must be called while inside a transaction. Returns true if
// there is more animation to run.
- boolean startAndFinishAnimationLocked(long currentTime) {
+ boolean stepAnimationLocked(long currentTime) {
// Save the animation state as it was before this step so WindowManagerService can tell if
// we just started or just stopped animating by comparing mWasAnimating with isAnimating().
mWasAnimating = mAnimating;
if (!mService.mDisplayFrozen && mService.mPolicy.isScreenOnFully()) {
// We will run animations as long as the display isn't frozen.
- if (!mDrawPending && !mCommitDrawPending && mAnimation != null) {
+ if (isDrawnLw() && mAnimation != null) {
mHasTransformation = true;
mHasLocalTransformation = true;
if (!mLocalAnimating) {
@@ -1034,11 +1022,11 @@
mAnimation.setStartTime(currentTime);
mLocalAnimating = true;
mAnimating = true;
- mAnimState = ANIM_STATE_RUNNING;
}
- if ((mAnimation != null) && mLocalAnimating &&
- (mAnimState != ANIM_STATE_STOPPING)) {
- return true;
+ if ((mAnimation != null) && mLocalAnimating) {
+ if (stepAnimation(currentTime)) {
+ return true;
+ }
}
if (WindowManagerService.DEBUG_ANIM) Slog.v(
WindowManagerService.TAG, "Finished animation in " + this +
@@ -1133,12 +1121,12 @@
}
finishExit();
+ mService.mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
if (mAppToken != null) {
mAppToken.updateReportedVisibilityLocked();
}
- mAnimState = ANIM_STATE_IDLE;
return false;
}
@@ -1479,8 +1467,7 @@
*/
public boolean isDisplayedLw() {
final AppWindowToken atoken = mAppToken;
- return mSurface != null && mPolicyVisibility && !mDestroying
- && !mDrawPending && !mCommitDrawPending
+ return isDrawnLw() && mPolicyVisibility
&& ((!mAttachedHidden &&
(atoken == null || !atoken.hiddenRequested))
|| mAnimating);
@@ -1501,7 +1488,6 @@
* complete UI in to.
*/
public boolean isDrawnLw() {
- final AppWindowToken atoken = mAppToken;
return mSurface != null && !mDestroying
&& !mDrawPending && !mCommitDrawPending;
}
@@ -1513,9 +1499,8 @@
boolean isOpaqueDrawn() {
return (mAttrs.format == PixelFormat.OPAQUE
|| mAttrs.type == TYPE_WALLPAPER)
- && mSurface != null && mAnimation == null
- && (mAppToken == null || mAppToken.animation == null)
- && !mDrawPending && !mCommitDrawPending;
+ && isDrawnLw() && mAnimation == null
+ && (mAppToken == null || mAppToken.animation == null);
}
/**
@@ -1608,6 +1593,7 @@
boolean showLw(boolean doAnimation, boolean requestAnim) {
if (mPolicyVisibility && mPolicyVisibilityAfterAnim) {
+ // Already showing.
return false;
}
if (DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG, "Policy visibility true: " + this);
@@ -1647,6 +1633,7 @@
boolean current = doAnimation ? mPolicyVisibilityAfterAnim
: mPolicyVisibility;
if (!current) {
+ // Already hiding.
return false;
}
if (doAnimation) {
diff --git a/telephony/java/android/telephony/SmsCbCmasInfo.java b/telephony/java/android/telephony/SmsCbCmasInfo.java
new file mode 100644
index 0000000..7a89d94
--- /dev/null
+++ b/telephony/java/android/telephony/SmsCbCmasInfo.java
@@ -0,0 +1,308 @@
+/*
+ * 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 android.telephony;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Contains CMAS warning notification Type 1 elements for a {@link SmsCbMessage}.
+ * Supported values for each element are defined in TIA-1149-0-1 (CMAS over CDMA) and
+ * 3GPP TS 23.041 (for GSM/UMTS).
+ *
+ * {@hide}
+ */
+public class SmsCbCmasInfo implements Parcelable {
+
+ // CMAS message class (in GSM/UMTS message identifier or CDMA service category).
+
+ /** Presidential-level alert (Korean Public Alert System Class 0 message). */
+ public static final int CMAS_CLASS_PRESIDENTIAL_LEVEL_ALERT = 0x00;
+
+ /** Extreme threat to life and property (Korean Public Alert System Class 1 message). */
+ public static final int CMAS_CLASS_EXTREME_THREAT = 0x01;
+
+ /** Severe threat to life and property (Korean Public Alert System Class 1 message). */
+ public static final int CMAS_CLASS_SEVERE_THREAT = 0x02;
+
+ /** Child abduction emergency (AMBER Alert). */
+ public static final int CMAS_CLASS_CHILD_ABDUCTION_EMERGENCY = 0x03;
+
+ /** CMAS test message. */
+ public static final int CMAS_CLASS_REQUIRED_MONTHLY_TEST = 0x04;
+
+ /** CMAS exercise. */
+ public static final int CMAS_CLASS_CMAS_EXERCISE = 0x05;
+
+ /** CMAS category for operator defined use. */
+ public static final int CMAS_CLASS_OPERATOR_DEFINED_USE = 0x06;
+
+ /** CMAS category for warning types that are reserved for future extension. */
+ public static final int CMAS_CLASS_UNKNOWN = -1;
+
+ // CMAS alert category (in CDMA type 1 elements record).
+
+ /** CMAS alert category: Geophysical including landslide. */
+ public static final int CMAS_CATEGORY_GEO = 0x00;
+
+ /** CMAS alert category: Meteorological including flood. */
+ public static final int CMAS_CATEGORY_MET = 0x01;
+
+ /** CMAS alert category: General emergency and public safety. */
+ public static final int CMAS_CATEGORY_SAFETY = 0x02;
+
+ /** CMAS alert category: Law enforcement, military, homeland/local/private security. */
+ public static final int CMAS_CATEGORY_SECURITY = 0x03;
+
+ /** CMAS alert category: Rescue and recovery. */
+ public static final int CMAS_CATEGORY_RESCUE = 0x04;
+
+ /** CMAS alert category: Fire suppression and rescue. */
+ public static final int CMAS_CATEGORY_FIRE = 0x05;
+
+ /** CMAS alert category: Medical and public health. */
+ public static final int CMAS_CATEGORY_HEALTH = 0x06;
+
+ /** CMAS alert category: Pollution and other environmental. */
+ public static final int CMAS_CATEGORY_ENV = 0x07;
+
+ /** CMAS alert category: Public and private transportation. */
+ public static final int CMAS_CATEGORY_TRANSPORT = 0x08;
+
+ /** CMAS alert category: Utility, telecom, other non-transport infrastructure. */
+ public static final int CMAS_CATEGORY_INFRA = 0x09;
+
+ /** CMAS alert category: Chem, bio, radiological, nuclear, high explosive threat or attack. */
+ public static final int CMAS_CATEGORY_CBRNE = 0x0a;
+
+ /** CMAS alert category: Other events. */
+ public static final int CMAS_CATEGORY_OTHER = 0x0b;
+
+ /**
+ * CMAS alert category is unknown. The category is only available for CDMA broadcasts
+ * containing a type 1 elements record, so GSM and UMTS broadcasts always return unknown.
+ */
+ public static final int CMAS_CATEGORY_UNKNOWN = -1;
+
+ // CMAS response type (in CDMA type 1 elements record).
+
+ /** CMAS response type: Take shelter in place. */
+ public static final int CMAS_RESPONSE_TYPE_SHELTER = 0x00;
+
+ /** CMAS response type: Evacuate (Relocate). */
+ public static final int CMAS_RESPONSE_TYPE_EVACUATE = 0x01;
+
+ /** CMAS response type: Make preparations. */
+ public static final int CMAS_RESPONSE_TYPE_PREPARE = 0x02;
+
+ /** CMAS response type: Execute a pre-planned activity. */
+ public static final int CMAS_RESPONSE_TYPE_EXECUTE = 0x03;
+
+ /** CMAS response type: Attend to information sources. */
+ public static final int CMAS_RESPONSE_TYPE_MONITOR = 0x04;
+
+ /** CMAS response type: Avoid hazard. */
+ public static final int CMAS_RESPONSE_TYPE_AVOID = 0x05;
+
+ /** CMAS response type: Evaluate the information in this message (not for public warnings). */
+ public static final int CMAS_RESPONSE_TYPE_ASSESS = 0x06;
+
+ /** CMAS response type: No action recommended. */
+ public static final int CMAS_RESPONSE_TYPE_NONE = 0x07;
+
+ /**
+ * CMAS response type is unknown. The response type is only available for CDMA broadcasts
+ * containing a type 1 elements record, so GSM and UMTS broadcasts always return unknown.
+ */
+ public static final int CMAS_RESPONSE_TYPE_UNKNOWN = -1;
+
+ // 4-bit CMAS severity (in GSM/UMTS message identifier or CDMA type 1 elements record).
+
+ /** CMAS severity type: Extraordinary threat to life or property. */
+ public static final int CMAS_SEVERITY_EXTREME = 0x0;
+
+ /** CMAS severity type: Significant threat to life or property. */
+ public static final int CMAS_SEVERITY_SEVERE = 0x1;
+
+ /**
+ * CMAS alert severity is unknown. The severity is available for CDMA warning alerts
+ * containing a type 1 elements record and for all GSM and UMTS alerts except for the
+ * Presidential-level alert class (Korean Public Alert System Class 0).
+ */
+ public static final int CMAS_SEVERITY_UNKNOWN = -1;
+
+ // CMAS urgency (in GSM/UMTS message identifier or CDMA type 1 elements record).
+
+ /** CMAS urgency type: Responsive action should be taken immediately. */
+ public static final int CMAS_URGENCY_IMMEDIATE = 0x0;
+
+ /** CMAS urgency type: Responsive action should be taken within the next hour. */
+ public static final int CMAS_URGENCY_EXPECTED = 0x1;
+
+ /**
+ * CMAS alert urgency is unknown. The urgency is available for CDMA warning alerts
+ * containing a type 1 elements record and for all GSM and UMTS alerts except for the
+ * Presidential-level alert class (Korean Public Alert System Class 0).
+ */
+ public static final int CMAS_URGENCY_UNKNOWN = -1;
+
+ // CMAS certainty (in GSM/UMTS message identifier or CDMA type 1 elements record).
+
+ /** CMAS certainty type: Determined to have occurred or to be ongoing. */
+ public static final int CMAS_CERTAINTY_OBSERVED = 0x0;
+
+ /** CMAS certainty type: Likely (probability > ~50%). */
+ public static final int CMAS_CERTAINTY_LIKELY = 0x1;
+
+ /**
+ * CMAS alert certainty is unknown. The certainty is available for CDMA warning alerts
+ * containing a type 1 elements record and for all GSM and UMTS alerts except for the
+ * Presidential-level alert class (Korean Public Alert System Class 0).
+ */
+ public static final int CMAS_CERTAINTY_UNKNOWN = -1;
+
+ /** CMAS message class. */
+ private final int mMessageClass;
+
+ /** CMAS category. */
+ private final int mCategory;
+
+ /** CMAS response type. */
+ private final int mResponseType;
+
+ /** CMAS severity. */
+ private final int mSeverity;
+
+ /** CMAS urgency. */
+ private final int mUrgency;
+
+ /** CMAS certainty. */
+ private final int mCertainty;
+
+ /** Create a new SmsCbCmasInfo object with the specified values. */
+ public SmsCbCmasInfo(int messageClass, int category, int responseType, int severity,
+ int urgency, int certainty) {
+ mMessageClass = messageClass;
+ mCategory = category;
+ mResponseType = responseType;
+ mSeverity = severity;
+ mUrgency = urgency;
+ mCertainty = certainty;
+ }
+
+ /** Create a new SmsCbCmasInfo object from a Parcel. */
+ SmsCbCmasInfo(Parcel in) {
+ mMessageClass = in.readInt();
+ mCategory = in.readInt();
+ mResponseType = in.readInt();
+ mSeverity = in.readInt();
+ mUrgency = in.readInt();
+ mCertainty = in.readInt();
+ }
+
+ /**
+ * Flatten this object into a Parcel.
+ *
+ * @param dest The Parcel in which the object should be written.
+ * @param flags Additional flags about how the object should be written (ignored).
+ */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(mMessageClass);
+ dest.writeInt(mCategory);
+ dest.writeInt(mResponseType);
+ dest.writeInt(mSeverity);
+ dest.writeInt(mUrgency);
+ dest.writeInt(mCertainty);
+ }
+
+ /**
+ * Returns the CMAS message class, e.g. {@link #CMAS_CLASS_PRESIDENTIAL_LEVEL_ALERT}.
+ * @return one of the {@code CMAS_CLASS} values
+ */
+ public int getMessageClass() {
+ return mMessageClass;
+ }
+
+ /**
+ * Returns the CMAS category, e.g. {@link #CMAS_CATEGORY_GEO}.
+ * @return one of the {@code CMAS_CATEGORY} values
+ */
+ public int getCategory() {
+ return mCategory;
+ }
+
+ /**
+ * Returns the CMAS response type, e.g. {@link #CMAS_RESPONSE_TYPE_SHELTER}.
+ * @return one of the {@code CMAS_RESPONSE_TYPE} values
+ */
+ public int getResponseType() {
+ return mResponseType;
+ }
+
+ /**
+ * Returns the CMAS severity, e.g. {@link #CMAS_SEVERITY_EXTREME}.
+ * @return one of the {@code CMAS_SEVERITY} values
+ */
+ public int getSeverity() {
+ return mSeverity;
+ }
+
+ /**
+ * Returns the CMAS urgency, e.g. {@link #CMAS_URGENCY_IMMEDIATE}.
+ * @return one of the {@code CMAS_URGENCY} values
+ */
+ public int getUrgency() {
+ return mUrgency;
+ }
+
+ /**
+ * Returns the CMAS certainty, e.g. {@link #CMAS_CERTAINTY_OBSERVED}.
+ * @return one of the {@code CMAS_CERTAINTY} values
+ */
+ public int getCertainty() {
+ return mCertainty;
+ }
+
+ @Override
+ public String toString() {
+ return "SmsCbCmasInfo{messageClass=" + mMessageClass + ", category=" + mCategory
+ + ", responseType=" + mResponseType + ", severity=" + mSeverity
+ + ", urgency=" + mUrgency + ", certainty=" + mCertainty + '}';
+ }
+
+ /**
+ * Describe the kinds of special objects contained in the marshalled representation.
+ * @return a bitmask indicating this Parcelable contains no special objects
+ */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /** Creator for unparcelling objects. */
+ public static final Parcelable.Creator<SmsCbCmasInfo>
+ CREATOR = new Parcelable.Creator<SmsCbCmasInfo>() {
+ public SmsCbCmasInfo createFromParcel(Parcel in) {
+ return new SmsCbCmasInfo(in);
+ }
+
+ public SmsCbCmasInfo[] newArray(int size) {
+ return new SmsCbCmasInfo[size];
+ }
+ };
+}
diff --git a/telephony/java/android/telephony/SmsCbEtwsInfo.java b/telephony/java/android/telephony/SmsCbEtwsInfo.java
new file mode 100644
index 0000000..0890d52
--- /dev/null
+++ b/telephony/java/android/telephony/SmsCbEtwsInfo.java
@@ -0,0 +1,206 @@
+/*
+ * 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 android.telephony;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.text.format.Time;
+
+import com.android.internal.telephony.IccUtils;
+
+import java.util.Arrays;
+
+/**
+ * Contains information elements for a GSM or UMTS ETWS warning notification.
+ * Supported values for each element are defined in 3GPP TS 23.041.
+ *
+ * {@hide}
+ */
+public class SmsCbEtwsInfo implements Parcelable {
+
+ /** ETWS warning type for earthquake. */
+ public static final int ETWS_WARNING_TYPE_EARTHQUAKE = 0x00;
+
+ /** ETWS warning type for tsunami. */
+ public static final int ETWS_WARNING_TYPE_TSUNAMI = 0x01;
+
+ /** ETWS warning type for earthquake and tsunami. */
+ public static final int ETWS_WARNING_TYPE_EARTHQUAKE_AND_TSUNAMI = 0x02;
+
+ /** ETWS warning type for test messages. */
+ public static final int ETWS_WARNING_TYPE_TEST_MESSAGE = 0x03;
+
+ /** ETWS warning type for other emergency types. */
+ public static final int ETWS_WARNING_TYPE_OTHER_EMERGENCY = 0x04;
+
+ /** Unknown ETWS warning type. */
+ public static final int ETWS_WARNING_TYPE_UNKNOWN = -1;
+
+ /** One of the ETWS warning type constants defined in this class. */
+ private final int mWarningType;
+
+ /** Whether or not to activate the emergency user alert tone and vibration. */
+ private final boolean mEmergencyUserAlert;
+
+ /** Whether or not to activate a popup alert. */
+ private final boolean mActivatePopup;
+
+ /**
+ * 50-byte security information (ETWS primary notification for GSM only). As of Release 10,
+ * 3GPP TS 23.041 states that the UE shall ignore the ETWS primary notification timestamp
+ * and digital signature if received. Therefore it is treated as a raw byte array and
+ * parceled with the broadcast intent if present, but the timestamp is only computed if an
+ * application asks for the individual components.
+ */
+ private final byte[] mWarningSecurityInformation;
+
+ /** Create a new SmsCbEtwsInfo object with the specified values. */
+ public SmsCbEtwsInfo(int warningType, boolean emergencyUserAlert, boolean activatePopup,
+ byte[] warningSecurityInformation) {
+ mWarningType = warningType;
+ mEmergencyUserAlert = emergencyUserAlert;
+ mActivatePopup = activatePopup;
+ mWarningSecurityInformation = warningSecurityInformation;
+ }
+
+ /** Create a new SmsCbEtwsInfo object from a Parcel. */
+ SmsCbEtwsInfo(Parcel in) {
+ mWarningType = in.readInt();
+ mEmergencyUserAlert = (in.readInt() != 0);
+ mActivatePopup = (in.readInt() != 0);
+ mWarningSecurityInformation = in.createByteArray();
+ }
+
+ /**
+ * Flatten this object into a Parcel.
+ *
+ * @param dest The Parcel in which the object should be written.
+ * @param flags Additional flags about how the object should be written (ignored).
+ */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(mWarningType);
+ dest.writeInt(mEmergencyUserAlert ? 1 : 0);
+ dest.writeInt(mActivatePopup ? 1 : 0);
+ dest.writeByteArray(mWarningSecurityInformation);
+ }
+
+ /**
+ * Returns the ETWS warning type.
+ * @return a warning type such as {@link #ETWS_WARNING_TYPE_EARTHQUAKE}
+ */
+ public int getWarningType() {
+ return mWarningType;
+ }
+
+ /**
+ * Returns the ETWS emergency user alert flag.
+ * @return true to notify terminal to activate emergency user alert; false otherwise
+ */
+ public boolean isEmergencyUserAlert() {
+ return mEmergencyUserAlert;
+ }
+
+ /**
+ * Returns the ETWS activate popup flag.
+ * @return true to notify terminal to activate display popup; false otherwise
+ */
+ public boolean isPopupAlert() {
+ return mActivatePopup;
+ }
+
+ /**
+ * Returns the Warning-Security-Information timestamp (GSM primary notifications only).
+ * As of Release 10, 3GPP TS 23.041 states that the UE shall ignore this value if received.
+ * @return a UTC timestamp in System.currentTimeMillis() format, or 0 if not present
+ */
+ public long getPrimaryNotificationTimestamp() {
+ if (mWarningSecurityInformation == null || mWarningSecurityInformation.length < 7) {
+ return 0;
+ }
+
+ int year = IccUtils.gsmBcdByteToInt(mWarningSecurityInformation[0]);
+ int month = IccUtils.gsmBcdByteToInt(mWarningSecurityInformation[1]);
+ int day = IccUtils.gsmBcdByteToInt(mWarningSecurityInformation[2]);
+ int hour = IccUtils.gsmBcdByteToInt(mWarningSecurityInformation[3]);
+ int minute = IccUtils.gsmBcdByteToInt(mWarningSecurityInformation[4]);
+ int second = IccUtils.gsmBcdByteToInt(mWarningSecurityInformation[5]);
+
+ // For the timezone, the most significant bit of the
+ // least significant nibble is the sign byte
+ // (meaning the max range of this field is 79 quarter-hours,
+ // which is more than enough)
+
+ byte tzByte = mWarningSecurityInformation[6];
+
+ // Mask out sign bit.
+ int timezoneOffset = IccUtils.gsmBcdByteToInt((byte) (tzByte & (~0x08)));
+
+ timezoneOffset = ((tzByte & 0x08) == 0) ? timezoneOffset : -timezoneOffset;
+
+ Time time = new Time(Time.TIMEZONE_UTC);
+
+ // We only need to support years above 2000.
+ time.year = year + 2000;
+ time.month = month - 1;
+ time.monthDay = day;
+ time.hour = hour;
+ time.minute = minute;
+ time.second = second;
+
+ // Timezone offset is in quarter hours.
+ return time.toMillis(true) - (long) (timezoneOffset * 15 * 60 * 1000);
+ }
+
+ /**
+ * Returns the digital signature (GSM primary notifications only). As of Release 10,
+ * 3GPP TS 23.041 states that the UE shall ignore this value if received.
+ * @return a byte array containing a copy of the primary notification digital signature
+ */
+ public byte[] getPrimaryNotificationSignature() {
+ if (mWarningSecurityInformation == null || mWarningSecurityInformation.length < 50) {
+ return null;
+ }
+ return Arrays.copyOfRange(mWarningSecurityInformation, 7, 50);
+ }
+
+ @Override
+ public String toString() {
+ return "SmsCbEtwsInfo{warningType=" + mWarningType + ", emergencyUserAlert="
+ + mEmergencyUserAlert + ", activatePopup=" + mActivatePopup + '}';
+ }
+
+ /**
+ * Describe the kinds of special objects contained in the marshalled representation.
+ * @return a bitmask indicating this Parcelable contains no special objects
+ */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /** Creator for unparcelling objects. */
+ public static final Creator<SmsCbEtwsInfo> CREATOR = new Creator<SmsCbEtwsInfo>() {
+ public SmsCbEtwsInfo createFromParcel(Parcel in) {
+ return new SmsCbEtwsInfo(in);
+ }
+
+ public SmsCbEtwsInfo[] newArray(int size) {
+ return new SmsCbEtwsInfo[size];
+ }
+ };
+}
diff --git a/telephony/java/android/telephony/SmsCbLocation.java b/telephony/java/android/telephony/SmsCbLocation.java
new file mode 100644
index 0000000..7b5bd0d
--- /dev/null
+++ b/telephony/java/android/telephony/SmsCbLocation.java
@@ -0,0 +1,202 @@
+/*
+ * 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 android.telephony;
+
+import android.os.Bundle;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.telephony.gsm.GsmCellLocation;
+
+/**
+ * Represents the location and geographical scope of a cell broadcast message.
+ * For GSM/UMTS, the Location Area and Cell ID are set when the broadcast
+ * geographical scope is cell wide or Location Area wide. For CDMA, the
+ * broadcast geographical scope is always PLMN wide.
+ *
+ * @hide
+ */
+public class SmsCbLocation implements Parcelable {
+
+ /** The PLMN. Note that this field may be an empty string, but isn't allowed to be null. */
+ private final String mPlmn;
+
+ private final int mLac;
+ private final int mCid;
+
+ /**
+ * Construct an empty location object. This is used for some test cases, and for
+ * cell broadcasts saved in older versions of the database without location info.
+ */
+ public SmsCbLocation() {
+ mPlmn = "";
+ mLac = -1;
+ mCid = -1;
+ }
+
+ /**
+ * Construct a location object for the PLMN. This class is immutable, so
+ * the same object can be reused for multiple broadcasts.
+ */
+ public SmsCbLocation(String plmn) {
+ mPlmn = plmn;
+ mLac = -1;
+ mCid = -1;
+ }
+
+ /**
+ * Construct a location object for the PLMN, LAC, and Cell ID. This class is immutable, so
+ * the same object can be reused for multiple broadcasts.
+ */
+ public SmsCbLocation(String plmn, int lac, int cid) {
+ mPlmn = plmn;
+ mLac = lac;
+ mCid = cid;
+ }
+
+ /**
+ * Initialize the object from a Parcel.
+ */
+ public SmsCbLocation(Parcel in) {
+ mPlmn = in.readString();
+ mLac = in.readInt();
+ mCid = in.readInt();
+ }
+
+ /**
+ * Returns the MCC/MNC of the network as a String.
+ * @return the PLMN identifier (MCC+MNC) as a String
+ */
+ public String getPlmn() {
+ return mPlmn;
+ }
+
+ /**
+ * Returns the GSM location area code, or UMTS service area code.
+ * @return location area code, -1 if unknown, 0xffff max legal value
+ */
+ public int getLac() {
+ return mLac;
+ }
+
+ /**
+ * Returns the GSM or UMTS cell ID.
+ * @return gsm cell id, -1 if unknown, 0xffff max legal value
+ */
+ public int getCid() {
+ return mCid;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = mPlmn.hashCode();
+ hash = hash * 31 + mLac;
+ hash = hash * 31 + mCid;
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) {
+ return true;
+ }
+ if (o == null || !(o instanceof SmsCbLocation)) {
+ return false;
+ }
+ SmsCbLocation other = (SmsCbLocation) o;
+ return mPlmn.equals(other.mPlmn) && mLac == other.mLac && mCid == other.mCid;
+ }
+
+ @Override
+ public String toString() {
+ return '[' + mPlmn + ',' + mLac + ',' + mCid + ']';
+ }
+
+ /**
+ * Test whether this location is within the location area of the specified object.
+ *
+ * @param area the location area to compare with this location
+ * @return true if this location is contained within the specified location area
+ */
+ public boolean isInLocationArea(SmsCbLocation area) {
+ if (mCid != -1 && mCid != area.mCid) {
+ return false;
+ }
+ if (mLac != -1 && mLac != area.mLac) {
+ return false;
+ }
+ return mPlmn.equals(area.mPlmn);
+ }
+
+ /**
+ * Test whether this location is within the location area of the CellLocation.
+ *
+ * @param plmn the PLMN to use for comparison
+ * @param lac the Location Area (GSM) or Service Area (UMTS) to compare with
+ * @param cid the Cell ID to compare with
+ * @return true if this location is contained within the specified PLMN, LAC, and Cell ID
+ */
+ public boolean isInLocationArea(String plmn, int lac, int cid) {
+ if (!mPlmn.equals(plmn)) {
+ return false;
+ }
+
+ if (mLac != -1 && mLac != lac) {
+ return false;
+ }
+
+ if (mCid != -1 && mCid != cid) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Flatten this object into a Parcel.
+ *
+ * @param dest The Parcel in which the object should be written.
+ * @param flags Additional flags about how the object should be written (ignored).
+ */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeString(mPlmn);
+ dest.writeInt(mLac);
+ dest.writeInt(mCid);
+ }
+
+ public static final Parcelable.Creator<SmsCbLocation> CREATOR
+ = new Parcelable.Creator<SmsCbLocation>() {
+ @Override
+ public SmsCbLocation createFromParcel(Parcel in) {
+ return new SmsCbLocation(in);
+ }
+
+ @Override
+ public SmsCbLocation[] newArray(int size) {
+ return new SmsCbLocation[size];
+ }
+ };
+
+ /**
+ * Describe the kinds of special objects contained in the marshalled representation.
+ * @return a bitmask indicating this Parcelable contains no special objects
+ */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+}
diff --git a/telephony/java/android/telephony/SmsCbMessage.java b/telephony/java/android/telephony/SmsCbMessage.java
index 383e0f9..046bf8c 100644
--- a/telephony/java/android/telephony/SmsCbMessage.java
+++ b/telephony/java/android/telephony/SmsCbMessage.java
@@ -16,118 +16,262 @@
package android.telephony;
-import android.text.format.Time;
-import android.util.Log;
-
-import com.android.internal.telephony.GsmAlphabet;
-import com.android.internal.telephony.IccUtils;
-import com.android.internal.telephony.gsm.SmsCbHeader;
-
-import java.io.UnsupportedEncodingException;
+import android.os.Parcel;
+import android.os.Parcelable;
/**
- * Describes an SMS-CB message.
+ * Parcelable object containing a received cell broadcast message. There are four different types
+ * of Cell Broadcast messages:
*
- * {@hide}
+ * <ul>
+ * <li>opt-in informational broadcasts, e.g. news, weather, stock quotes, sports scores</li>
+ * <li>cell information messages, broadcast on channel 50, indicating the current cell name for
+ * roaming purposes (required to display on the idle screen in Brazil)</li>
+ * <li>emergency broadcasts for the Japanese Earthquake and Tsunami Warning System (ETWS)</li>
+ * <li>emergency broadcasts for the American Commercial Mobile Alert Service (CMAS)</li>
+ * </ul>
+ *
+ * <p>There are also four different CB message formats: GSM, ETWS Primary Notification (GSM only),
+ * UMTS, and CDMA. Some fields are only applicable for some message formats. Other fields were
+ * unified under a common name, avoiding some names, such as "Message Identifier", that refer to
+ * two completely different concepts in 3GPP and CDMA.
+ *
+ * <p>The GSM/UMTS Message Identifier field is available via {@link #getServiceCategory}, the name
+ * of the equivalent field in CDMA. In both cases the service category is a 16-bit value, but 3GPP
+ * and 3GPP2 have completely different meanings for the respective values. For ETWS and CMAS, the
+ * application should
+ *
+ * <p>The CDMA Message Identifier field is available via {@link #getSerialNumber}, which is used
+ * to detect the receipt of a duplicate message to be discarded. In CDMA, the message ID is
+ * unique to the current PLMN. In GSM/UMTS, there is a 16-bit serial number containing a 2-bit
+ * Geographical Scope field which indicates whether the 10-bit message code and 4-bit update number
+ * are considered unique to the PLMN, to the current cell, or to the current Location Area (or
+ * Service Area in UMTS). The relevant values are concatenated into a single String which will be
+ * unique if the messages are not duplicates.
+ *
+ * <p>The SMS dispatcher does not detect duplicate messages. However, it does concatenate the
+ * pages of a GSM multi-page cell broadcast into a single SmsCbMessage object.
+ *
+ * <p>Interested applications with {@code RECEIVE_SMS_PERMISSION} can register to receive
+ * {@code SMS_CB_RECEIVED_ACTION} broadcast intents for incoming non-emergency broadcasts.
+ * Only system applications such as the CellBroadcastReceiver may receive notifications for
+ * emergency broadcasts (ETWS and CMAS). This is intended to prevent any potential for delays or
+ * interference with the immediate display of the alert message and playing of the alert sound and
+ * vibration pattern, which could be caused by poorly written or malicious non-system code.
+ *
+ * @hide
*/
-public class SmsCbMessage {
+public class SmsCbMessage implements Parcelable {
- /**
- * Cell wide immediate geographical scope
- */
+ protected static final String LOG_TAG = "SMSCB";
+
+ /** Cell wide geographical scope with immediate display (GSM/UMTS only). */
public static final int GEOGRAPHICAL_SCOPE_CELL_WIDE_IMMEDIATE = 0;
- /**
- * PLMN wide geographical scope
- */
+ /** PLMN wide geographical scope (GSM/UMTS and all CDMA broadcasts). */
public static final int GEOGRAPHICAL_SCOPE_PLMN_WIDE = 1;
- /**
- * Location / service area wide geographical scope
- */
+ /** Location / service area wide geographical scope (GSM/UMTS only). */
public static final int GEOGRAPHICAL_SCOPE_LA_WIDE = 2;
- /**
- * Cell wide geographical scope
- */
+ /** Cell wide geographical scope (GSM/UMTS only). */
public static final int GEOGRAPHICAL_SCOPE_CELL_WIDE = 3;
+ /** GSM or UMTS format cell broadcast. */
+ public static final int MESSAGE_FORMAT_3GPP = 1;
+
+ /** CDMA format cell broadcast. */
+ public static final int MESSAGE_FORMAT_3GPP2 = 2;
+
+ /** Normal message priority. */
+ public static final int MESSAGE_PRIORITY_NORMAL = 0;
+
+ /** Interactive message priority. */
+ public static final int MESSAGE_PRIORITY_INTERACTIVE = 1;
+
+ /** Urgent message priority. */
+ public static final int MESSAGE_PRIORITY_URGENT = 2;
+
+ /** Emergency message priority. */
+ public static final int MESSAGE_PRIORITY_EMERGENCY = 3;
+
+ /** Format of this message (for interpretation of service category values). */
+ private final int mMessageFormat;
+
+ /** Geographical scope of broadcast. */
+ private final int mGeographicalScope;
+
/**
- * Create an instance of this class from a received PDU
+ * Serial number of broadcast (message identifier for CDMA, geographical scope + message code +
+ * update number for GSM/UMTS). The serial number plus the location code uniquely identify
+ * a cell broadcast for duplicate detection.
+ */
+ private final int mSerialNumber;
+
+ /**
+ * Location identifier for this message. It consists of the current operator MCC/MNC as a
+ * 5 or 6-digit decimal string. In addition, for GSM/UMTS, if the Geographical Scope of the
+ * message is not binary 01, the Location Area is included for comparison. If the GS is
+ * 00 or 11, the Cell ID is also included. LAC and Cell ID are -1 if not specified.
+ */
+ private final SmsCbLocation mLocation;
+
+ /**
+ * 16-bit CDMA service category or GSM/UMTS message identifier. For ETWS and CMAS warnings,
+ * the information provided by the category is also available via {@link #getEtwsWarningInfo()}
+ * or {@link #getCmasWarningInfo()}.
+ */
+ private final int mServiceCategory;
+
+ /** Message language, as a two-character string, e.g. "en". */
+ private final String mLanguage;
+
+ /** Message body, as a String. */
+ private final String mBody;
+
+ /** Message priority (including emergency priority). */
+ private final int mPriority;
+
+ /** ETWS warning notification information (ETWS warnings only). */
+ private final SmsCbEtwsInfo mEtwsWarningInfo;
+
+ /** CMAS warning notification information (CMAS warnings only). */
+ private final SmsCbCmasInfo mCmasWarningInfo;
+
+ /**
+ * Create a new SmsCbMessage with the specified data.
+ */
+ public SmsCbMessage(int messageFormat, int geographicalScope, int serialNumber,
+ SmsCbLocation location, int serviceCategory, String language, String body,
+ int priority, SmsCbEtwsInfo etwsWarningInfo, SmsCbCmasInfo cmasWarningInfo) {
+ mMessageFormat = messageFormat;
+ mGeographicalScope = geographicalScope;
+ mSerialNumber = serialNumber;
+ mLocation = location;
+ mServiceCategory = serviceCategory;
+ mLanguage = language;
+ mBody = body;
+ mPriority = priority;
+ mEtwsWarningInfo = etwsWarningInfo;
+ mCmasWarningInfo = cmasWarningInfo;
+ }
+
+ /** Create a new SmsCbMessage object from a Parcel. */
+ public SmsCbMessage(Parcel in) {
+ mMessageFormat = in.readInt();
+ mGeographicalScope = in.readInt();
+ mSerialNumber = in.readInt();
+ mLocation = new SmsCbLocation(in);
+ mServiceCategory = in.readInt();
+ mLanguage = in.readString();
+ mBody = in.readString();
+ mPriority = in.readInt();
+ int type = in.readInt();
+ switch (type) {
+ case 'E':
+ // unparcel ETWS warning information
+ mEtwsWarningInfo = new SmsCbEtwsInfo(in);
+ mCmasWarningInfo = null;
+ break;
+
+ case 'C':
+ // unparcel CMAS warning information
+ mEtwsWarningInfo = null;
+ mCmasWarningInfo = new SmsCbCmasInfo(in);
+ break;
+
+ default:
+ mEtwsWarningInfo = null;
+ mCmasWarningInfo = null;
+ }
+ }
+
+ /**
+ * Flatten this object into a Parcel.
*
- * @param pdu PDU bytes
- * @return An instance of this class, or null if invalid pdu
+ * @param dest The Parcel in which the object should be written.
+ * @param flags Additional flags about how the object should be written (ignored).
*/
- public static SmsCbMessage createFromPdu(byte[] pdu) {
- try {
- return new SmsCbMessage(pdu);
- } catch (IllegalArgumentException e) {
- Log.w(LOG_TAG, "Failed parsing SMS-CB pdu", e);
- return null;
- }
- }
-
- private static final String LOG_TAG = "SMSCB";
-
- /**
- * Languages in the 0000xxxx DCS group as defined in 3GPP TS 23.038, section 5.
- */
- private static final String[] LANGUAGE_CODES_GROUP_0 = {
- "de", "en", "it", "fr", "es", "nl", "sv", "da", "pt", "fi", "no", "el", "tr", "hu",
- "pl", null
- };
-
- /**
- * Languages in the 0010xxxx DCS group as defined in 3GPP TS 23.038, section 5.
- */
- private static final String[] LANGUAGE_CODES_GROUP_2 = {
- "cs", "he", "ar", "ru", "is", null, null, null, null, null, null, null, null, null,
- null, null
- };
-
- private static final char CARRIAGE_RETURN = 0x0d;
-
- private static final int PDU_BODY_PAGE_LENGTH = 82;
-
- private SmsCbHeader mHeader;
-
- private String mLanguage;
-
- private String mBody;
-
- /** Timestamp of ETWS primary notification with security. */
- private long mPrimaryNotificationTimestamp;
-
- /** 43 byte digital signature of ETWS primary notification with security. */
- private byte[] mPrimaryNotificationDigitalSignature;
-
- private SmsCbMessage(byte[] pdu) throws IllegalArgumentException {
- mHeader = new SmsCbHeader(pdu);
- if (mHeader.format == SmsCbHeader.FORMAT_ETWS_PRIMARY) {
- mBody = "ETWS";
- // ETWS primary notification with security is 56 octets in length
- if (pdu.length >= SmsCbHeader.PDU_LENGTH_ETWS) {
- mPrimaryNotificationTimestamp = getTimestampMillis(pdu);
- mPrimaryNotificationDigitalSignature = new byte[43];
- // digital signature starts after 6 byte header and 7 byte timestamp
- System.arraycopy(pdu, 13, mPrimaryNotificationDigitalSignature, 0, 43);
- }
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(mMessageFormat);
+ dest.writeInt(mGeographicalScope);
+ dest.writeInt(mSerialNumber);
+ mLocation.writeToParcel(dest, flags);
+ dest.writeInt(mServiceCategory);
+ dest.writeString(mLanguage);
+ dest.writeString(mBody);
+ dest.writeInt(mPriority);
+ if (mEtwsWarningInfo != null) {
+ // parcel ETWS warning information
+ dest.writeInt('E');
+ mEtwsWarningInfo.writeToParcel(dest, flags);
+ } else if (mCmasWarningInfo != null) {
+ // parcel CMAS warning information
+ dest.writeInt('C');
+ mCmasWarningInfo.writeToParcel(dest, flags);
} else {
- parseBody(pdu);
+ // no ETWS or CMAS warning information
+ dest.writeInt('0');
}
}
+ public static final Parcelable.Creator<SmsCbMessage> CREATOR
+ = new Parcelable.Creator<SmsCbMessage>() {
+ @Override
+ public SmsCbMessage createFromParcel(Parcel in) {
+ return new SmsCbMessage(in);
+ }
+
+ @Override
+ public SmsCbMessage[] newArray(int size) {
+ return new SmsCbMessage[size];
+ }
+ };
+
/**
- * Return the geographical scope of this message, one of
- * {@link #GEOGRAPHICAL_SCOPE_CELL_WIDE_IMMEDIATE},
- * {@link #GEOGRAPHICAL_SCOPE_PLMN_WIDE},
- * {@link #GEOGRAPHICAL_SCOPE_LA_WIDE},
- * {@link #GEOGRAPHICAL_SCOPE_CELL_WIDE}
+ * Return the geographical scope of this message (GSM/UMTS only).
*
* @return Geographical scope
*/
public int getGeographicalScope() {
- return mHeader.geographicalScope;
+ return mGeographicalScope;
+ }
+
+ /**
+ * Return the broadcast serial number of broadcast (message identifier for CDMA, or
+ * geographical scope + message code + update number for GSM/UMTS). The serial number plus
+ * the location code uniquely identify a cell broadcast for duplicate detection.
+ *
+ * @return the 16-bit CDMA message identifier or GSM/UMTS serial number
+ */
+ public int getSerialNumber() {
+ return mSerialNumber;
+ }
+
+ /**
+ * Return the location identifier for this message, consisting of the MCC/MNC as a
+ * 5 or 6-digit decimal string. In addition, for GSM/UMTS, if the Geographical Scope of the
+ * message is not binary 01, the Location Area is included. If the GS is 00 or 11, the
+ * cell ID is also included. The {@link SmsCbLocation} object includes a method to test
+ * if the location is included within another location area or within a PLMN and CellLocation.
+ *
+ * @return the geographical location code for duplicate message detection
+ */
+ public SmsCbLocation getLocation() {
+ return mLocation;
+ }
+
+ /**
+ * Return the 16-bit CDMA service category or GSM/UMTS message identifier. The interpretation
+ * of the category is radio technology specific. For ETWS and CMAS warnings, the information
+ * provided by the category is available via {@link #getEtwsWarningInfo()} or
+ * {@link #getCmasWarningInfo()} in a radio technology independent format.
+ *
+ * @return the radio technology specific service category
+ */
+ public int getServiceCategory() {
+ return mServiceCategory;
}
/**
@@ -149,311 +293,90 @@
}
/**
- * Get the message identifier of this message (0-65535)
- *
- * @return Message identifier
- */
- public int getMessageIdentifier() {
- return mHeader.messageIdentifier;
- }
-
- /**
- * Get the message code of this message (0-1023)
- *
- * @return Message code
- */
- public int getMessageCode() {
- return mHeader.messageCode;
- }
-
- /**
- * Get the update number of this message (0-15)
- *
- * @return Update number
- */
- public int getUpdateNumber() {
- return mHeader.updateNumber;
- }
-
- /**
- * Get the format of this message.
- * @return {@link SmsCbHeader#FORMAT_GSM}, {@link SmsCbHeader#FORMAT_UMTS}, or
- * {@link SmsCbHeader#FORMAT_ETWS_PRIMARY}
+ * Get the message format ({@link #MESSAGE_FORMAT_3GPP} or {@link #MESSAGE_FORMAT_3GPP2}).
+ * @return an integer representing 3GPP or 3GPP2 message format
*/
public int getMessageFormat() {
- return mHeader.format;
+ return mMessageFormat;
}
/**
- * For ETWS primary notifications, return the emergency user alert flag.
- * @return true to notify terminal to activate emergency user alert; false otherwise
+ * Get the message priority. Normal broadcasts return {@link #MESSAGE_PRIORITY_NORMAL}
+ * and emergency broadcasts return {@link #MESSAGE_PRIORITY_EMERGENCY}. CDMA also may return
+ * {@link #MESSAGE_PRIORITY_INTERACTIVE} or {@link #MESSAGE_PRIORITY_URGENT}.
+ * @return an integer representing the message priority
*/
- public boolean getEtwsEmergencyUserAlert() {
- return mHeader.etwsEmergencyUserAlert;
+ public int getMessagePriority() {
+ return mPriority;
}
/**
- * For ETWS primary notifications, return the popup flag.
- * @return true to notify terminal to activate display popup; false otherwise
- */
- public boolean getEtwsPopup() {
- return mHeader.etwsPopup;
- }
-
- /**
- * For ETWS primary notifications, return the warning type.
- * @return a value such as {@link SmsCbConstants#ETWS_WARNING_TYPE_EARTHQUAKE}
- */
- public int getEtwsWarningType() {
- return mHeader.etwsWarningType;
- }
-
- /**
- * For ETWS primary notifications, return the Warning-Security-Information timestamp.
- * @return a timestamp in System.currentTimeMillis() format.
- */
- public long getEtwsSecurityTimestamp() {
- return mPrimaryNotificationTimestamp;
- }
-
- /**
- * For ETWS primary notifications, return the 43 byte digital signature.
- * @return a byte array containing a copy of the digital signature
- */
- public byte[] getEtwsSecuritySignature() {
- return mPrimaryNotificationDigitalSignature.clone();
- }
-
- /**
- * Parse and unpack the body text according to the encoding in the DCS.
- * After completing successfully this method will have assigned the body
- * text into mBody, and optionally the language code into mLanguage
+ * If this is an ETWS warning notification then this method will return an object containing
+ * the ETWS warning type, the emergency user alert flag, and the popup flag. If this is an
+ * ETWS primary notification (GSM only), there will also be a 7-byte timestamp and 43-byte
+ * digital signature. As of Release 10, 3GPP TS 23.041 states that the UE shall ignore the
+ * ETWS primary notification timestamp and digital signature if received.
*
- * @param pdu The pdu
+ * @return an SmsCbEtwsInfo object, or null if this is not an ETWS warning notification
*/
- private void parseBody(byte[] pdu) {
- int encoding;
- boolean hasLanguageIndicator = false;
-
- // Extract encoding and language from DCS, as defined in 3gpp TS 23.038,
- // section 5.
- switch ((mHeader.dataCodingScheme & 0xf0) >> 4) {
- case 0x00:
- encoding = SmsMessage.ENCODING_7BIT;
- mLanguage = LANGUAGE_CODES_GROUP_0[mHeader.dataCodingScheme & 0x0f];
- break;
-
- case 0x01:
- hasLanguageIndicator = true;
- if ((mHeader.dataCodingScheme & 0x0f) == 0x01) {
- encoding = SmsMessage.ENCODING_16BIT;
- } else {
- encoding = SmsMessage.ENCODING_7BIT;
- }
- break;
-
- case 0x02:
- encoding = SmsMessage.ENCODING_7BIT;
- mLanguage = LANGUAGE_CODES_GROUP_2[mHeader.dataCodingScheme & 0x0f];
- break;
-
- case 0x03:
- encoding = SmsMessage.ENCODING_7BIT;
- break;
-
- case 0x04:
- case 0x05:
- switch ((mHeader.dataCodingScheme & 0x0c) >> 2) {
- case 0x01:
- encoding = SmsMessage.ENCODING_8BIT;
- break;
-
- case 0x02:
- encoding = SmsMessage.ENCODING_16BIT;
- break;
-
- case 0x00:
- default:
- encoding = SmsMessage.ENCODING_7BIT;
- break;
- }
- break;
-
- case 0x06:
- case 0x07:
- // Compression not supported
- case 0x09:
- // UDH structure not supported
- case 0x0e:
- // Defined by the WAP forum not supported
- encoding = SmsMessage.ENCODING_UNKNOWN;
- break;
-
- case 0x0f:
- if (((mHeader.dataCodingScheme & 0x04) >> 2) == 0x01) {
- encoding = SmsMessage.ENCODING_8BIT;
- } else {
- encoding = SmsMessage.ENCODING_7BIT;
- }
- break;
-
- default:
- // Reserved values are to be treated as 7-bit
- encoding = SmsMessage.ENCODING_7BIT;
- break;
- }
-
- if (mHeader.format == SmsCbHeader.FORMAT_UMTS) {
- // Payload may contain multiple pages
- int nrPages = pdu[SmsCbHeader.PDU_HEADER_LENGTH];
-
- if (pdu.length < SmsCbHeader.PDU_HEADER_LENGTH + 1 + (PDU_BODY_PAGE_LENGTH + 1)
- * nrPages) {
- throw new IllegalArgumentException("Pdu length " + pdu.length + " does not match "
- + nrPages + " pages");
- }
-
- StringBuilder sb = new StringBuilder();
-
- for (int i = 0; i < nrPages; i++) {
- // Each page is 82 bytes followed by a length octet indicating
- // the number of useful octets within those 82
- int offset = SmsCbHeader.PDU_HEADER_LENGTH + 1 + (PDU_BODY_PAGE_LENGTH + 1) * i;
- int length = pdu[offset + PDU_BODY_PAGE_LENGTH];
-
- if (length > PDU_BODY_PAGE_LENGTH) {
- throw new IllegalArgumentException("Page length " + length
- + " exceeds maximum value " + PDU_BODY_PAGE_LENGTH);
- }
-
- sb.append(unpackBody(pdu, encoding, offset, length, hasLanguageIndicator));
- }
- mBody = sb.toString();
- } else {
- // Payload is one single page
- int offset = SmsCbHeader.PDU_HEADER_LENGTH;
- int length = pdu.length - offset;
-
- mBody = unpackBody(pdu, encoding, offset, length, hasLanguageIndicator);
- }
+ public SmsCbEtwsInfo getEtwsWarningInfo() {
+ return mEtwsWarningInfo;
}
/**
- * Unpack body text from the pdu using the given encoding, position and
- * length within the pdu
+ * If this is a CMAS warning notification then this method will return an object containing
+ * the CMAS message class, category, response type, severity, urgency and certainty.
+ * The message class is always present. Severity, urgency and certainty are present for CDMA
+ * warning notifications containing a type 1 elements record and for GSM and UMTS warnings
+ * except for the Presidential-level alert category. Category and response type are only
+ * available for CDMA notifications containing a type 1 elements record.
*
- * @param pdu The pdu
- * @param encoding The encoding, as derived from the DCS
- * @param offset Position of the first byte to unpack
- * @param length Number of bytes to unpack
- * @param hasLanguageIndicator true if the body text is preceded by a
- * language indicator. If so, this method will as a side-effect
- * assign the extracted language code into mLanguage
- * @return Body text
+ * @return an SmsCbCmasInfo object, or null if this is not a CMAS warning notification
*/
- private String unpackBody(byte[] pdu, int encoding, int offset, int length,
- boolean hasLanguageIndicator) {
- String body = null;
-
- switch (encoding) {
- case SmsMessage.ENCODING_7BIT:
- body = GsmAlphabet.gsm7BitPackedToString(pdu, offset, length * 8 / 7);
-
- if (hasLanguageIndicator && body != null && body.length() > 2) {
- // Language is two GSM characters followed by a CR.
- // The actual body text is offset by 3 characters.
- mLanguage = body.substring(0, 2);
- body = body.substring(3);
- }
- break;
-
- case SmsMessage.ENCODING_16BIT:
- if (hasLanguageIndicator && pdu.length >= offset + 2) {
- // Language is two GSM characters.
- // The actual body text is offset by 2 bytes.
- mLanguage = GsmAlphabet.gsm7BitPackedToString(pdu, offset, 2);
- offset += 2;
- length -= 2;
- }
-
- try {
- body = new String(pdu, offset, (length & 0xfffe), "utf-16");
- } catch (UnsupportedEncodingException e) {
- // Eeeek
- }
- break;
-
- default:
- break;
- }
-
- if (body != null) {
- // Remove trailing carriage return
- for (int i = body.length() - 1; i >= 0; i--) {
- if (body.charAt(i) != CARRIAGE_RETURN) {
- body = body.substring(0, i + 1);
- break;
- }
- }
- } else {
- body = "";
- }
-
- return body;
+ public SmsCbCmasInfo getCmasWarningInfo() {
+ return mCmasWarningInfo;
}
/**
- * Parses an ETWS primary notification timestamp and returns a currentTimeMillis()-style
- * timestamp. Copied from com.android.internal.telephony.gsm.SmsMessage.
- * @param pdu the ETWS primary notification PDU to decode
- * @return the UTC timestamp from the Warning-Security-Information parameter
+ * Return whether this message is an emergency (PWS) message type.
+ * @return true if the message is a public warning notification; false otherwise
*/
- private long getTimestampMillis(byte[] pdu) {
- // Timestamp starts after CB header, in pdu[6]
- int year = IccUtils.gsmBcdByteToInt(pdu[6]);
- int month = IccUtils.gsmBcdByteToInt(pdu[7]);
- int day = IccUtils.gsmBcdByteToInt(pdu[8]);
- int hour = IccUtils.gsmBcdByteToInt(pdu[9]);
- int minute = IccUtils.gsmBcdByteToInt(pdu[10]);
- int second = IccUtils.gsmBcdByteToInt(pdu[11]);
-
- // For the timezone, the most significant bit of the
- // least significant nibble is the sign byte
- // (meaning the max range of this field is 79 quarter-hours,
- // which is more than enough)
-
- byte tzByte = pdu[12];
-
- // Mask out sign bit.
- int timezoneOffset = IccUtils.gsmBcdByteToInt((byte) (tzByte & (~0x08)));
-
- timezoneOffset = ((tzByte & 0x08) == 0) ? timezoneOffset : -timezoneOffset;
-
- Time time = new Time(Time.TIMEZONE_UTC);
-
- // It's 2006. Should I really support years < 2000?
- time.year = year >= 90 ? year + 1900 : year + 2000;
- time.month = month - 1;
- time.monthDay = day;
- time.hour = hour;
- time.minute = minute;
- time.second = second;
-
- // Timezone offset is in quarter hours.
- return time.toMillis(true) - (timezoneOffset * 15 * 60 * 1000);
+ public boolean isEmergencyMessage() {
+ return mPriority == MESSAGE_PRIORITY_EMERGENCY;
}
/**
- * Append text to the message body. This is used to concatenate multi-page GSM broadcasts.
- * @param body the text to append to this message
+ * Return whether this message is an ETWS warning alert.
+ * @return true if the message is an ETWS warning notification; false otherwise
*/
- public void appendToBody(String body) {
- mBody = mBody + body;
+ public boolean isEtwsMessage() {
+ return mEtwsWarningInfo != null;
+ }
+
+ /**
+ * Return whether this message is a CMAS warning alert.
+ * @return true if the message is a CMAS warning notification; false otherwise
+ */
+ public boolean isCmasMessage() {
+ return mCmasWarningInfo != null;
}
@Override
public String toString() {
- return "SmsCbMessage{" + mHeader.toString() + ", language=" + mLanguage +
- ", body=\"" + mBody + "\"}";
+ return "SmsCbMessage{geographicalScope=" + mGeographicalScope + ", serialNumber="
+ + mSerialNumber + ", location=" + mLocation + ", serviceCategory="
+ + mServiceCategory + ", language=" + mLanguage + ", body=" + mBody
+ + ", priority=" + mPriority
+ + (mEtwsWarningInfo != null ? (", " + mEtwsWarningInfo.toString()) : "")
+ + (mCmasWarningInfo != null ? (", " + mCmasWarningInfo.toString()) : "") + '}';
+ }
+
+ /**
+ * Describe the kinds of special objects contained in the marshalled representation.
+ * @return a bitmask indicating this Parcelable contains no special objects
+ */
+ @Override
+ public int describeContents() {
+ return 0;
}
}
diff --git a/telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.java b/telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.java
new file mode 100644
index 0000000..f94efd8
--- /dev/null
+++ b/telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.java
@@ -0,0 +1,210 @@
+/*
+ * 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 android.telephony.cdma;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * CDMA Service Category Program Data from SCPT teleservice SMS.
+ * The CellBroadcastReceiver app receives an Intent with action
+ * {@link android.provider.Telephony.Sms.Intents#SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED_ACTION}
+ * containing an array of these objects to update its list of cell broadcast service categories
+ * to display.
+ *
+ * {@hide}
+ */
+public class CdmaSmsCbProgramData implements Parcelable {
+
+ /** Delete the specified service category from the list of enabled categories. */
+ public static final int OPERATION_DELETE_CATEGORY = 0;
+
+ /** Add the specified service category to the list of enabled categories. */
+ public static final int OPERATION_ADD_CATEGORY = 1;
+
+ /** Clear all service categories from the list of enabled categories. */
+ public static final int OPERATION_CLEAR_CATEGORIES = 2;
+
+ /** Alert option: no alert. */
+ public static final int ALERT_OPTION_NO_ALERT = 0;
+
+ /** Alert option: default alert. */
+ public static final int ALERT_OPTION_DEFAULT_ALERT = 1;
+
+ /** Alert option: vibrate alert once. */
+ public static final int ALERT_OPTION_VIBRATE_ONCE = 2;
+
+ /** Alert option: vibrate alert - repeat. */
+ public static final int ALERT_OPTION_VIBRATE_REPEAT = 3;
+
+ /** Alert option: visual alert once. */
+ public static final int ALERT_OPTION_VISUAL_ONCE = 4;
+
+ /** Alert option: visual alert - repeat. */
+ public static final int ALERT_OPTION_VISUAL_REPEAT = 5;
+
+ /** Alert option: low-priority alert once. */
+ public static final int ALERT_OPTION_LOW_PRIORITY_ONCE = 6;
+
+ /** Alert option: low-priority alert - repeat. */
+ public static final int ALERT_OPTION_LOW_PRIORITY_REPEAT = 7;
+
+ /** Alert option: medium-priority alert once. */
+ public static final int ALERT_OPTION_MED_PRIORITY_ONCE = 8;
+
+ /** Alert option: medium-priority alert - repeat. */
+ public static final int ALERT_OPTION_MED_PRIORITY_REPEAT = 9;
+
+ /** Alert option: high-priority alert once. */
+ public static final int ALERT_OPTION_HIGH_PRIORITY_ONCE = 10;
+
+ /** Alert option: high-priority alert - repeat. */
+ public static final int ALERT_OPTION_HIGH_PRIORITY_REPEAT = 11;
+
+ /** Service category operation (add/delete/clear). */
+ private final int mOperation;
+
+ /** Service category to modify. */
+ private final int mCategory;
+
+ /** Language used for service category name (ISO 639 two character code). */
+ private final String mLanguage;
+
+ /** Maximum number of messages to store for this service category. */
+ private final int mMaxMessages;
+
+ /** Service category alert option. */
+ private final int mAlertOption;
+
+ /** Name of service category. */
+ private final String mCategoryName;
+
+ /** Create a new CdmaSmsCbProgramData object with the specified values. */
+ public CdmaSmsCbProgramData(int operation, int category, String language, int maxMessages,
+ int alertOption, String categoryName) {
+ mOperation = operation;
+ mCategory = category;
+ mLanguage = language;
+ mMaxMessages = maxMessages;
+ mAlertOption = alertOption;
+ mCategoryName = categoryName;
+ }
+
+ /** Create a new CdmaSmsCbProgramData object from a Parcel. */
+ CdmaSmsCbProgramData(Parcel in) {
+ mOperation = in.readInt();
+ mCategory = in.readInt();
+ mLanguage = in.readString();
+ mMaxMessages = in.readInt();
+ mAlertOption = in.readInt();
+ mCategoryName = in.readString();
+ }
+
+ /**
+ * Flatten this object into a Parcel.
+ *
+ * @param dest The Parcel in which the object should be written.
+ * @param flags Additional flags about how the object should be written (ignored).
+ */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(mOperation);
+ dest.writeInt(mCategory);
+ dest.writeString(mLanguage);
+ dest.writeInt(mMaxMessages);
+ dest.writeInt(mAlertOption);
+ dest.writeString(mCategoryName);
+ }
+
+ /**
+ * Returns the service category operation, e.g. {@link #OPERATION_ADD_CATEGORY}.
+ * @return one of the {@code OPERATION_*} values
+ */
+ public int getOperation() {
+ return mOperation;
+ }
+
+ /**
+ * Returns the CDMA service category to modify.
+ * @return a 16-bit CDMA service category value
+ */
+ public int getCategory() {
+ return mCategory;
+ }
+
+ /**
+ * Returns the ISO-639-1 language code for the service category name, or null if not present.
+ * @return a two-digit ISO-639-1 language code, e.g. "en" for English
+ */
+ public String getLanguageCode() {
+ return mLanguage;
+ }
+
+ /**
+ * Returns the maximum number of messages to store for this service category.
+ * @return the maximum number of messages to store for this service category
+ */
+ public int getMaxMessages() {
+ return mMaxMessages;
+ }
+
+ /**
+ * Returns the service category alert option, e.g. {@link #ALERT_OPTION_DEFAULT_ALERT}.
+ * @return one of the {@code ALERT_OPTION_*} values
+ */
+ public int getAlertOption() {
+ return mAlertOption;
+ }
+
+ /**
+ * Returns the service category name, in the language specified by {@link #getLanguageCode()}.
+ * @return an optional service category name
+ */
+ public String getCategoryName() {
+ return mCategoryName;
+ }
+
+ @Override
+ public String toString() {
+ return "CdmaSmsCbProgramData{operation=" + mOperation + ", category=" + mCategory
+ + ", language=" + mLanguage + ", max messages=" + mMaxMessages
+ + ", alert option=" + mAlertOption + ", category name=" + mCategoryName + '}';
+ }
+
+ /**
+ * Describe the kinds of special objects contained in the marshalled representation.
+ * @return a bitmask indicating this Parcelable contains no special objects
+ */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /** Creator for unparcelling objects. */
+ public static final Parcelable.Creator<CdmaSmsCbProgramData>
+ CREATOR = new Parcelable.Creator<CdmaSmsCbProgramData>() {
+ @Override
+ public CdmaSmsCbProgramData createFromParcel(Parcel in) {
+ return new CdmaSmsCbProgramData(in);
+ }
+
+ @Override
+ public CdmaSmsCbProgramData[] newArray(int size) {
+ return new CdmaSmsCbProgramData[size];
+ }
+ };
+}
diff --git a/telephony/java/com/android/internal/telephony/IccCard.java b/telephony/java/com/android/internal/telephony/IccCard.java
index fe80fdf..965bafa 100644
--- a/telephony/java/com/android/internal/telephony/IccCard.java
+++ b/telephony/java/com/android/internal/telephony/IccCard.java
@@ -186,10 +186,12 @@
if (phone.mCM.getLteOnCdmaMode() == Phone.LTE_ON_CDMA_TRUE
&& phone instanceof CDMALTEPhone) {
mIccRecords = new CdmaLteUiccRecords(phone);
- mIccFileHandler = new CdmaLteUiccFileHandler((CDMALTEPhone)phone);
+ mIccFileHandler = new CdmaLteUiccFileHandler(this, "", mPhone.mCM);
} else {
mIccRecords = is3gpp ? new SIMRecords(phone) : new RuimRecords(phone);
- mIccFileHandler = is3gpp ? new SIMFileHandler(phone) : new RuimFileHandler(phone);
+ // Correct aid will be set later (when GET_SIM_STATUS returns)
+ mIccFileHandler = is3gpp ? new SIMFileHandler(this, "", mPhone.mCM) :
+ new RuimFileHandler(this, "", mPhone.mCM);
}
mPhone.mCM.registerForOffOrNotAvailable(mHandler, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
mPhone.mCM.registerForOn(mHandler, EVENT_RADIO_ON, null);
@@ -572,6 +574,7 @@
}
if (oldState != State.READY && newState == State.READY) {
+ mIccFileHandler.setAid(getAid());
mIccRecords.onReady();
}
}
diff --git a/telephony/java/com/android/internal/telephony/IccFileHandler.java b/telephony/java/com/android/internal/telephony/IccFileHandler.java
index 380bfd1..70d8f7a 100644
--- a/telephony/java/com/android/internal/telephony/IccFileHandler.java
+++ b/telephony/java/com/android/internal/telephony/IccFileHandler.java
@@ -90,7 +90,9 @@
static protected final int EVENT_READ_ICON_DONE = 10;
// member variables
- protected PhoneBase phone;
+ protected final CommandsInterface mCi;
+ protected final IccCard mParentCard;
+ protected String mAid;
static class LoadLinearFixedContext {
@@ -120,9 +122,10 @@
/**
* Default constructor
*/
- protected IccFileHandler(PhoneBase phone) {
- super();
- this.phone = phone;
+ protected IccFileHandler(IccCard card, String aid, CommandsInterface ci) {
+ mParentCard = card;
+ mAid = aid;
+ mCi = ci;
}
public void dispose() {
@@ -145,9 +148,8 @@
= obtainMessage(EVENT_GET_RECORD_SIZE_DONE,
new LoadLinearFixedContext(fileid, recordNum, onLoaded));
- phone.mCM.iccIOForApp(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
- 0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null,
- phone.getIccCard().getAid(), response);
+ mCi.iccIOForApp(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
+ 0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, mAid, response);
}
/**
@@ -165,10 +167,9 @@
onLoaded));
// TODO(): Verify when path changes are done.
- phone.mCM.iccIOForApp(COMMAND_GET_RESPONSE, IccConstants.EF_IMG, "img",
+ mCi.iccIOForApp(COMMAND_GET_RESPONSE, IccConstants.EF_IMG, "img",
recordNum, READ_RECORD_MODE_ABSOLUTE,
- GET_RESPONSE_EF_IMG_SIZE_BYTES, null, null,
- phone.getIccCard().getAid(), response);
+ GET_RESPONSE_EF_IMG_SIZE_BYTES, null, null, mAid, response);
}
/**
@@ -184,9 +185,8 @@
Message response
= obtainMessage(EVENT_GET_EF_LINEAR_RECORD_SIZE_DONE,
new LoadLinearFixedContext(fileid, onLoaded));
- phone.mCM.iccIOForApp(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
- 0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, phone.getIccCard().getAid(),
- response);
+ mCi.iccIOForApp(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
+ 0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, mAid, response);
}
/**
@@ -202,9 +202,8 @@
Message response = obtainMessage(EVENT_GET_RECORD_SIZE_DONE,
new LoadLinearFixedContext(fileid,onLoaded));
- phone.mCM.iccIOForApp(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
- 0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null,
- phone.getIccCard().getAid(), response);
+ mCi.iccIOForApp(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
+ 0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, mAid, response);
}
/**
@@ -221,9 +220,8 @@
Message response = obtainMessage(EVENT_GET_BINARY_SIZE_DONE,
fileid, 0, onLoaded);
- phone.mCM.iccIOForApp(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
- 0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null,
- phone.getIccCard().getAid(), response);
+ mCi.iccIOForApp(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
+ 0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, mAid, response);
}
/**
@@ -241,8 +239,8 @@
Message response = obtainMessage(EVENT_READ_ICON_DONE, fileid, 0,
onLoaded);
- phone.mCM.iccIOForApp(COMMAND_READ_BINARY, fileid, "img", highOffset, lowOffset,
- length, null, null, phone.getIccCard().getAid(), response);
+ mCi.iccIOForApp(COMMAND_READ_BINARY, fileid, "img", highOffset, lowOffset,
+ length, null, null, mAid, response);
}
/**
@@ -256,10 +254,9 @@
*/
public void updateEFLinearFixed(int fileid, int recordNum, byte[] data,
String pin2, Message onComplete) {
- phone.mCM.iccIOForApp(COMMAND_UPDATE_RECORD, fileid, getEFPath(fileid),
+ mCi.iccIOForApp(COMMAND_UPDATE_RECORD, fileid, getEFPath(fileid),
recordNum, READ_RECORD_MODE_ABSOLUTE, data.length,
- IccUtils.bytesToHexString(data), pin2,
- phone.getIccCard().getAid(), onComplete);
+ IccUtils.bytesToHexString(data), pin2, mAid, onComplete);
}
/**
@@ -268,10 +265,9 @@
* @param data must be exactly as long as the EF
*/
public void updateEFTransparent(int fileid, byte[] data, Message onComplete) {
- phone.mCM.iccIOForApp(COMMAND_UPDATE_BINARY, fileid, getEFPath(fileid),
+ mCi.iccIOForApp(COMMAND_UPDATE_BINARY, fileid, getEFPath(fileid),
0, 0, data.length,
- IccUtils.bytesToHexString(data), null,
- phone.getIccCard().getAid(), onComplete);
+ IccUtils.bytesToHexString(data), null, mAid, onComplete);
}
@@ -402,11 +398,10 @@
lc.results = new ArrayList<byte[]>(lc.countRecords);
}
- phone.mCM.iccIOForApp(COMMAND_READ_RECORD, lc.efid, getEFPath(lc.efid),
+ mCi.iccIOForApp(COMMAND_READ_RECORD, lc.efid, getEFPath(lc.efid),
lc.recordNum,
READ_RECORD_MODE_ABSOLUTE,
- lc.recordSize, null, null,
- phone.getIccCard().getAid(),
+ lc.recordSize, null, null, mAid,
obtainMessage(EVENT_READ_RECORD_DONE, lc));
break;
case EVENT_GET_BINARY_SIZE_DONE:
@@ -441,9 +436,8 @@
size = ((data[RESPONSE_DATA_FILE_SIZE_1] & 0xff) << 8)
+ (data[RESPONSE_DATA_FILE_SIZE_2] & 0xff);
- phone.mCM.iccIOForApp(COMMAND_READ_BINARY, fileid, getEFPath(fileid),
- 0, 0, size, null, null,
- phone.getIccCard().getAid(),
+ mCi.iccIOForApp(COMMAND_READ_BINARY, fileid, getEFPath(fileid),
+ 0, 0, size, null, null, mAid,
obtainMessage(EVENT_READ_BINARY_DONE,
fileid, 0, response));
break;
@@ -477,11 +471,10 @@
if (lc.recordNum > lc.countRecords) {
sendResult(response, lc.results, null);
} else {
- phone.mCM.iccIOForApp(COMMAND_READ_RECORD, lc.efid, getEFPath(lc.efid),
+ mCi.iccIOForApp(COMMAND_READ_RECORD, lc.efid, getEFPath(lc.efid),
lc.recordNum,
READ_RECORD_MODE_ABSOLUTE,
- lc.recordSize, null, null,
- phone.getIccCard().getAid(),
+ lc.recordSize, null, null, mAid,
obtainMessage(EVENT_READ_RECORD_DONE, lc));
}
}
@@ -551,5 +544,8 @@
protected abstract void logd(String s);
protected abstract void loge(String s);
+ protected void setAid(String aid) {
+ mAid = aid;
+ }
}
diff --git a/telephony/java/com/android/internal/telephony/SMSDispatcher.java b/telephony/java/com/android/internal/telephony/SMSDispatcher.java
index a42a267..d6f96ff 100644
--- a/telephony/java/com/android/internal/telephony/SMSDispatcher.java
+++ b/telephony/java/com/android/internal/telephony/SMSDispatcher.java
@@ -39,6 +39,7 @@
import android.provider.Telephony;
import android.provider.Telephony.Sms.Intents;
import android.provider.Settings;
+import android.telephony.SmsCbMessage;
import android.telephony.SmsMessage;
import android.telephony.ServiceState;
import android.util.Log;
@@ -339,7 +340,7 @@
* @param intent intent to broadcast
* @param permission Receivers are required to have this permission
*/
- void dispatch(Intent intent, String permission) {
+ public void dispatch(Intent intent, String permission) {
// Hold a wake lock for WAKE_LOCK_TIMEOUT seconds, enough to give any
// receivers time to take their own wake locks.
mWakeLock.acquire(WAKE_LOCK_TIMEOUT);
@@ -1078,16 +1079,16 @@
}
};
- protected void dispatchBroadcastPdus(byte[][] pdus, boolean isEmergencyMessage) {
- if (isEmergencyMessage) {
+ protected void dispatchBroadcastMessage(SmsCbMessage message) {
+ if (message.isEmergencyMessage()) {
Intent intent = new Intent(Intents.SMS_EMERGENCY_CB_RECEIVED_ACTION);
- intent.putExtra("pdus", pdus);
- Log.d(TAG, "Dispatching " + pdus.length + " emergency SMS CB pdus");
+ intent.putExtra("message", message);
+ Log.d(TAG, "Dispatching emergency SMS CB");
dispatch(intent, RECEIVE_EMERGENCY_BROADCAST_PERMISSION);
} else {
Intent intent = new Intent(Intents.SMS_CB_RECEIVED_ACTION);
- intent.putExtra("pdus", pdus);
- Log.d(TAG, "Dispatching " + pdus.length + " SMS CB pdus");
+ intent.putExtra("message", message);
+ Log.d(TAG, "Dispatching SMS CB");
dispatch(intent, RECEIVE_SMS_PERMISSION);
}
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaLteUiccFileHandler.java b/telephony/java/com/android/internal/telephony/cdma/CdmaLteUiccFileHandler.java
index e195ff2..93a6290 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaLteUiccFileHandler.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaLteUiccFileHandler.java
@@ -17,6 +17,9 @@
package com.android.internal.telephony.cdma;
import android.util.Log;
+
+import com.android.internal.telephony.CommandsInterface;
+import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.IccConstants;
import com.android.internal.telephony.IccFileHandler;
import android.os.Message;
@@ -27,8 +30,8 @@
public final class CdmaLteUiccFileHandler extends IccFileHandler {
static final String LOG_TAG = "CDMA";
- public CdmaLteUiccFileHandler(CDMALTEPhone phone) {
- super(phone);
+ public CdmaLteUiccFileHandler(IccCard card, String aid, CommandsInterface ci) {
+ super(card, aid, ci);
}
protected String getEFPath(int efid) {
@@ -55,8 +58,8 @@
if (fileid == EF_CSIM_EPRL) {
// Entire PRL could be huge. We are only interested in
// the first 4 bytes of the record.
- phone.mCM.iccIOForApp(COMMAND_READ_BINARY, fileid, getEFPath(fileid),
- 0, 0, 4, null, null, phone.getIccCard().getAid(),
+ mCi.iccIOForApp(COMMAND_READ_BINARY, fileid, getEFPath(fileid),
+ 0, 0, 4, null, null, mAid,
obtainMessage(EVENT_READ_BINARY_DONE,
fileid, 0, onLoaded));
} else {
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java b/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
index ca8d9ae..bfa23e7 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
@@ -30,8 +30,10 @@
import android.preference.PreferenceManager;
import android.provider.Telephony;
import android.provider.Telephony.Sms.Intents;
+import android.telephony.SmsCbMessage;
import android.telephony.SmsManager;
import android.telephony.SmsMessage.MessageClass;
+import android.telephony.cdma.CdmaSmsCbProgramData;
import android.util.Log;
import com.android.internal.telephony.CommandsInterface;
@@ -50,6 +52,7 @@
import java.io.ByteArrayOutputStream;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.List;
import android.content.res.Resources;
@@ -97,6 +100,24 @@
}
}
+ /**
+ * Dispatch service category program data to the CellBroadcastReceiver app, which filters
+ * the broadcast alerts to display.
+ * @param sms the SMS message containing one or more
+ * {@link android.telephony.cdma.CdmaSmsCbProgramData} objects.
+ */
+ private void handleServiceCategoryProgramData(SmsMessage sms) {
+ List<CdmaSmsCbProgramData> programDataList = sms.getSmsCbProgramData();
+ if (programDataList == null) {
+ Log.e(TAG, "handleServiceCategoryProgramData: program data list is null!");
+ return;
+ }
+
+ Intent intent = new Intent(Intents.SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED_ACTION);
+ intent.putExtra("program_data_list", (CdmaSmsCbProgramData[]) programDataList.toArray());
+ dispatch(intent, RECEIVE_SMS_PERMISSION);
+ }
+
/** {@inheritDoc} */
@Override
public int dispatchMessage(SmsMessageBase smsb) {
@@ -119,8 +140,19 @@
return Intents.RESULT_SMS_HANDLED;
}
- // See if we have a network duplicate SMS.
SmsMessage sms = (SmsMessage) smsb;
+
+ // Handle CMAS emergency broadcast messages.
+ if (SmsEnvelope.MESSAGE_TYPE_BROADCAST == sms.getMessageType()) {
+ Log.d(TAG, "Broadcast type message");
+ SmsCbMessage message = sms.parseBroadcastSms();
+ if (message != null) {
+ dispatchBroadcastMessage(message);
+ }
+ return Intents.RESULT_SMS_HANDLED;
+ }
+
+ // See if we have a network duplicate SMS.
mLastDispatchedSmsFingerprint = sms.getIncomingSmsFingerprint();
if (mLastAcknowledgedSmsFingerprint != null &&
Arrays.equals(mLastDispatchedSmsFingerprint, mLastAcknowledgedSmsFingerprint)) {
@@ -149,6 +181,9 @@
sms.isStatusReportMessage()) {
handleCdmaStatusReport(sms);
handled = true;
+ } else if (SmsEnvelope.TELESERVICE_SCPT == teleService) {
+ handleServiceCategoryProgramData(sms);
+ handled = true;
} else if ((sms.getUserData() == null)) {
if (false) {
Log.d(TAG, "Received SMS without user data");
diff --git a/telephony/java/com/android/internal/telephony/cdma/RuimFileHandler.java b/telephony/java/com/android/internal/telephony/cdma/RuimFileHandler.java
index e854d7f..9f30d36 100644
--- a/telephony/java/com/android/internal/telephony/cdma/RuimFileHandler.java
+++ b/telephony/java/com/android/internal/telephony/cdma/RuimFileHandler.java
@@ -19,6 +19,8 @@
import android.os.*;
import android.util.Log;
+import com.android.internal.telephony.CommandsInterface;
+import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.IccConstants;
import com.android.internal.telephony.IccException;
import com.android.internal.telephony.IccFileHandler;
@@ -39,8 +41,8 @@
//***** Instance Variables
//***** Constructor
- public RuimFileHandler(PhoneBase phone) {
- super(phone);
+ public RuimFileHandler(IccCard card, String aid, CommandsInterface ci) {
+ super(card, aid, ci);
}
public void dispose() {
@@ -58,9 +60,9 @@
Message response = obtainMessage(EVENT_READ_ICON_DONE, fileid, 0,
onLoaded);
- phone.mCM.iccIOForApp(COMMAND_GET_RESPONSE, fileid, "img", 0, 0,
+ mCi.iccIOForApp(COMMAND_GET_RESPONSE, fileid, "img", 0, 0,
GET_RESPONSE_EF_IMG_SIZE_BYTES, null, null,
- phone.getIccCard().getAid(), response);
+ mAid, response);
}
@Override
diff --git a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
index 1409cab..a723de3 100644
--- a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
+++ b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
@@ -19,7 +19,11 @@
import android.os.Parcel;
import android.os.SystemProperties;
import android.telephony.PhoneNumberUtils;
+import android.telephony.SmsCbLocation;
+import android.telephony.SmsCbMessage;
+import android.telephony.cdma.CdmaSmsCbProgramData;
import android.util.Log;
+
import com.android.internal.telephony.IccUtils;
import com.android.internal.telephony.SmsHeader;
import com.android.internal.telephony.SmsMessageBase;
@@ -38,6 +42,9 @@
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
+import java.util.List;
+
+import static android.telephony.SmsMessage.MessageClass;
/**
* TODO(cleanup): these constants are disturbing... are they not just
@@ -47,12 +54,6 @@
* named CdmaSmsMessage, could it not?
*/
-import static android.telephony.SmsMessage.MAX_USER_DATA_BYTES;
-import static android.telephony.SmsMessage.MAX_USER_DATA_BYTES_WITH_HEADER;
-import static android.telephony.SmsMessage.MAX_USER_DATA_SEPTETS;
-import static android.telephony.SmsMessage.MAX_USER_DATA_SEPTETS_WITH_HEADER;
-import static android.telephony.SmsMessage.MessageClass;
-
/**
* TODO(cleanup): internally returning null in many places makes
* debugging very hard (among many other reasons) and should be made
@@ -192,16 +193,17 @@
// bearer data
countInt = p.readInt(); //p_cur->uBearerDataLen
- if (countInt >0) {
- data = new byte[countInt];
- //p_cur->aBearerData[digitCount] :
- for (int index=0; index < countInt; index++) {
- data[index] = p.readByte();
- }
- env.bearerData = data;
- // BD gets further decoded when accessed in SMSDispatcher
+ if (countInt < 0) {
+ countInt = 0;
}
+ data = new byte[countInt];
+ for (int index=0; index < countInt; index++) {
+ data[index] = p.readByte();
+ }
+ // BD gets further decoded when accessed in SMSDispatcher
+ env.bearerData = data;
+
// link the the filled objects to the SMS
env.origAddress = addr;
env.origSubaddress = subaddr;
@@ -732,6 +734,29 @@
}
/**
+ * Parses a broadcast SMS, possibly containing a CMAS alert.
+ */
+ SmsCbMessage parseBroadcastSms() {
+ BearerData bData = BearerData.decode(mEnvelope.bearerData, mEnvelope.serviceCategory);
+ if (bData == null) {
+ Log.w(LOG_TAG, "BearerData.decode() returned null");
+ return null;
+ }
+
+ if (Log.isLoggable(LOGGABLE_TAG, Log.VERBOSE)) {
+ Log.d(LOG_TAG, "MT raw BearerData = " + HexDump.toHexString(mEnvelope.bearerData));
+ }
+
+ String plmn = SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC);
+ SmsCbLocation location = new SmsCbLocation(plmn);
+
+ return new SmsCbMessage(SmsCbMessage.MESSAGE_FORMAT_3GPP2,
+ SmsCbMessage.GEOGRAPHICAL_SCOPE_PLMN_WIDE, bData.messageId, location,
+ mEnvelope.serviceCategory, bData.getLanguage(), bData.userData.payloadStr,
+ bData.priority, null, bData.cmasWarningInfo);
+ }
+
+ /**
* {@inheritDoc}
*/
public MessageClass getMessageClass() {
@@ -961,4 +986,12 @@
return output.toByteArray();
}
+
+ /**
+ * Returns the list of service category program data, if present.
+ * @return a list of CdmaSmsCbProgramData objects, or null if not present
+ */
+ List<CdmaSmsCbProgramData> getSmsCbProgramData() {
+ return mBearerData.serviceCategoryProgramData;
+ }
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java b/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
index 6743da0..e70ff18 100755
--- a/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
+++ b/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
@@ -16,28 +16,29 @@
package com.android.internal.telephony.cdma.sms;
-import static android.telephony.SmsMessage.ENCODING_16BIT;
-import static android.telephony.SmsMessage.MAX_USER_DATA_BYTES;
-import static android.telephony.SmsMessage.MAX_USER_DATA_BYTES_WITH_HEADER;
-
+import android.content.res.Resources;
+import android.telephony.SmsCbCmasInfo;
+import android.telephony.SmsCbMessage;
+import android.telephony.SmsMessage;
+import android.telephony.cdma.CdmaSmsCbProgramData;
+import android.text.format.Time;
import android.util.Log;
-import android.telephony.SmsMessage;
-
-import android.text.format.Time;
-
-import com.android.internal.telephony.IccUtils;
import com.android.internal.telephony.GsmAlphabet;
+import com.android.internal.telephony.IccUtils;
import com.android.internal.telephony.SmsHeader;
import com.android.internal.telephony.SmsMessageBase.TextEncodingDetails;
-
import com.android.internal.util.BitwiseInputStream;
import com.android.internal.util.BitwiseOutputStream;
-import android.content.res.Resources;
-
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
import java.util.TimeZone;
+import static android.telephony.SmsMessage.ENCODING_16BIT;
+import static android.telephony.SmsMessage.MAX_USER_DATA_BYTES;
+import static android.telephony.SmsMessage.MAX_USER_DATA_BYTES_WITH_HEADER;
/**
* An object to encode and decode CDMA SMS bearer data.
@@ -68,8 +69,8 @@
private final static byte SUBPARAM_MESSAGE_DISPLAY_MODE = 0x0F;
//private final static byte SUBPARAM_MULTIPLE_ENCODING_USER_DATA = 0x10;
private final static byte SUBPARAM_MESSAGE_DEPOSIT_INDEX = 0x11;
- //private final static byte SUBPARAM_SERVICE_CATEGORY_PROGRAM_DATA = 0x12;
- //private final static byte SUBPARAM_SERVICE_CATEGORY_PROGRAM_RESULTS = 0x13;
+ private final static byte SUBPARAM_SERVICE_CATEGORY_PROGRAM_DATA = 0x12;
+ private final static byte SUBPARAM_SERVICE_CATEGORY_PROGRAM_RESULTS = 0x13;
private final static byte SUBPARAM_MESSAGE_STATUS = 0x14;
//private final static byte SUBPARAM_TP_FAILURE_CAUSE = 0x15;
//private final static byte SUBPARAM_ENHANCED_VMN = 0x16;
@@ -339,12 +340,68 @@
*/
public CdmaSmsAddress callbackNumber;
+ /**
+ * CMAS warning notification information.
+ * @see #decodeCmasUserData(BearerData, int)
+ */
+ public SmsCbCmasInfo cmasWarningInfo;
+
+ /**
+ * The Service Category Program Data subparameter is used to enable and disable
+ * SMS broadcast service categories to display. If this subparameter is present,
+ * this field will contain a list of one or more
+ * {@link android.telephony.cdma.CdmaSmsCbProgramData} objects containing the
+ * operation(s) to perform.
+ */
+ public List<CdmaSmsCbProgramData> serviceCategoryProgramData;
+
private static class CodingException extends Exception {
public CodingException(String s) {
super(s);
}
}
+ /**
+ * Returns the language indicator as a two-character ISO 639 string.
+ * @return a two character ISO 639 language code
+ */
+ public String getLanguage() {
+ return getLanguageCodeForValue(language);
+ }
+
+ /**
+ * Converts a CDMA language indicator value to an ISO 639 two character language code.
+ * @param languageValue the CDMA language value to convert
+ * @return the two character ISO 639 language code for the specified value, or null if unknown
+ */
+ private static String getLanguageCodeForValue(int languageValue) {
+ switch (languageValue) {
+ case LANGUAGE_ENGLISH:
+ return "en";
+
+ case LANGUAGE_FRENCH:
+ return "fr";
+
+ case LANGUAGE_SPANISH:
+ return "es";
+
+ case LANGUAGE_JAPANESE:
+ return "ja";
+
+ case LANGUAGE_KOREAN:
+ return "ko";
+
+ case LANGUAGE_CHINESE:
+ return "zh";
+
+ case LANGUAGE_HEBREW:
+ return "he";
+
+ default:
+ return null;
+ }
+ }
+
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
@@ -916,6 +973,9 @@
private static String decodeUtf8(byte[] data, int offset, int numFields)
throws CodingException
{
+ if (numFields < 0 || (numFields + offset) > data.length) {
+ throw new CodingException("UTF-8 decode failed: offset or length out of range");
+ }
try {
return new String(data, offset, numFields, "UTF-8");
} catch (java.io.UnsupportedEncodingException ex) {
@@ -926,11 +986,12 @@
private static String decodeUtf16(byte[] data, int offset, int numFields)
throws CodingException
{
- // Start reading from the next 16-bit aligned boundary after offset.
- int padding = offset % 2;
- numFields -= (offset + padding) / 2;
+ int byteCount = numFields * 2;
+ if (byteCount < 0 || (byteCount + offset) > data.length) {
+ throw new CodingException("UTF-16 decode failed: offset or length out of range");
+ }
try {
- return new String(data, offset, numFields * 2, "utf-16be");
+ return new String(data, offset, byteCount, "utf-16be");
} catch (java.io.UnsupportedEncodingException ex) {
throw new CodingException("UTF-16 decode failed: " + ex);
}
@@ -988,8 +1049,11 @@
private static String decodeLatin(byte[] data, int offset, int numFields)
throws CodingException
{
+ if (numFields < 0 || (numFields + offset) > data.length) {
+ throw new CodingException("ISO-8859-1 decode failed: offset or length out of range");
+ }
try {
- return new String(data, offset, numFields - offset, "ISO-8859-1");
+ return new String(data, offset, numFields, "ISO-8859-1");
} catch (java.io.UnsupportedEncodingException ex) {
throw new CodingException("ISO-8859-1 decode failed: " + ex);
}
@@ -1032,6 +1096,7 @@
userData.payloadStr = decodeUtf8(userData.payload, offset, userData.numFields);
}
break;
+
case UserData.ENCODING_IA5:
case UserData.ENCODING_7BIT_ASCII:
userData.payloadStr = decode7bitAscii(userData.payload, offset, userData.numFields);
@@ -1114,8 +1179,9 @@
BitwiseInputStream inStream = new BitwiseInputStream(bData.userData.payload);
int dataLen = inStream.available() / 6; // 6-bit packed character encoding.
int numFields = bData.userData.numFields;
- if ((dataLen > 14) || (dataLen < numFields)) {
- throw new CodingException("IS-91 voicemail status decoding failed");
+ // dataLen may be > 14 characters due to octet padding
+ if ((numFields > 14) || (dataLen < numFields)) {
+ throw new CodingException("IS-91 short message decoding failed");
}
StringBuffer strbuf = new StringBuffer(dataLen);
for (int i = 0; i < numFields; i++) {
@@ -1539,7 +1605,7 @@
bData.userResponseCode = inStream.read(8);
}
if ((! decodeSuccess) || (paramBits > 0)) {
- Log.d(LOG_TAG, "USER_REPONSE_CODE decode " +
+ Log.d(LOG_TAG, "USER_RESPONSE_CODE decode " +
(decodeSuccess ? "succeeded" : "failed") +
" (extra bits = " + paramBits + ")");
}
@@ -1548,27 +1614,240 @@
return decodeSuccess;
}
+ private static boolean decodeServiceCategoryProgramData(BearerData bData,
+ BitwiseInputStream inStream) throws BitwiseInputStream.AccessException, CodingException
+ {
+ if (inStream.available() < 13) {
+ throw new CodingException("SERVICE_CATEGORY_PROGRAM_DATA decode failed: only "
+ + inStream.available() + " bits available");
+ }
+
+ int paramBits = inStream.read(8) * 8;
+ int msgEncoding = inStream.read(5);
+ paramBits -= 5;
+
+ if (inStream.available() < paramBits) {
+ throw new CodingException("SERVICE_CATEGORY_PROGRAM_DATA decode failed: only "
+ + inStream.available() + " bits available (" + paramBits + " bits expected)");
+ }
+
+ ArrayList<CdmaSmsCbProgramData> programDataList = new ArrayList<CdmaSmsCbProgramData>();
+
+ final int CATEGORY_FIELD_MIN_SIZE = 6 * 8;
+ boolean decodeSuccess = false;
+ while (paramBits >= CATEGORY_FIELD_MIN_SIZE) {
+ int operation = inStream.read(4);
+ int category = (inStream.read(8) << 8) | inStream.read(8);
+ String language = getLanguageCodeForValue(inStream.read(8));
+ int maxMessages = inStream.read(8);
+ int alertOption = inStream.read(4);
+ int numFields = inStream.read(8);
+ paramBits -= CATEGORY_FIELD_MIN_SIZE;
+
+ int textBits = getBitsForNumFields(msgEncoding, numFields);
+ if (paramBits < textBits) {
+ throw new CodingException("category name is " + textBits + " bits in length,"
+ + " but there are only " + paramBits + " bits available");
+ }
+
+ UserData userData = new UserData();
+ userData.msgEncoding = msgEncoding;
+ userData.msgEncodingSet = true;
+ userData.numFields = numFields;
+ userData.payload = inStream.readByteArray(textBits);
+ paramBits -= textBits;
+
+ decodeUserDataPayload(userData, false);
+ String categoryName = userData.payloadStr;
+ CdmaSmsCbProgramData programData = new CdmaSmsCbProgramData(operation, category,
+ language, maxMessages, alertOption, categoryName);
+ programDataList.add(programData);
+
+ decodeSuccess = true;
+ }
+
+ if ((! decodeSuccess) || (paramBits > 0)) {
+ Log.d(LOG_TAG, "SERVICE_CATEGORY_PROGRAM_DATA decode " +
+ (decodeSuccess ? "succeeded" : "failed") +
+ " (extra bits = " + paramBits + ')');
+ }
+
+ inStream.skip(paramBits);
+ bData.serviceCategoryProgramData = programDataList;
+ return decodeSuccess;
+ }
+
+ private static int serviceCategoryToCmasMessageClass(int serviceCategory) {
+ switch (serviceCategory) {
+ case SmsEnvelope.SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT:
+ return SmsCbCmasInfo.CMAS_CLASS_PRESIDENTIAL_LEVEL_ALERT;
+
+ case SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT:
+ return SmsCbCmasInfo.CMAS_CLASS_EXTREME_THREAT;
+
+ case SmsEnvelope.SERVICE_CATEGORY_CMAS_SEVERE_THREAT:
+ return SmsCbCmasInfo.CMAS_CLASS_SEVERE_THREAT;
+
+ case SmsEnvelope.SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY:
+ return SmsCbCmasInfo.CMAS_CLASS_CHILD_ABDUCTION_EMERGENCY;
+
+ case SmsEnvelope.SERVICE_CATEGORY_CMAS_TEST_MESSAGE:
+ return SmsCbCmasInfo.CMAS_CLASS_REQUIRED_MONTHLY_TEST;
+
+ default:
+ return SmsCbCmasInfo.CMAS_CLASS_UNKNOWN;
+ }
+ }
+
+ /**
+ * Calculates the number of bits to read for the specified number of encoded characters.
+ * @param msgEncoding the message encoding to use
+ * @param numFields the number of characters to read. For Shift-JIS and Korean encodings,
+ * this is the number of bytes to read.
+ * @return the number of bits to read from the stream
+ * @throws CodingException if the specified encoding is not supported
+ */
+ private static int getBitsForNumFields(int msgEncoding, int numFields)
+ throws CodingException {
+ switch (msgEncoding) {
+ case UserData.ENCODING_OCTET:
+ case UserData.ENCODING_SHIFT_JIS:
+ case UserData.ENCODING_KOREAN:
+ case UserData.ENCODING_LATIN:
+ case UserData.ENCODING_LATIN_HEBREW:
+ return numFields * 8;
+
+ case UserData.ENCODING_IA5:
+ case UserData.ENCODING_7BIT_ASCII:
+ case UserData.ENCODING_GSM_7BIT_ALPHABET:
+ return numFields * 7;
+
+ case UserData.ENCODING_UNICODE_16:
+ return numFields * 16;
+
+ default:
+ throw new CodingException("unsupported message encoding (" + msgEncoding + ')');
+ }
+ }
+
+ /**
+ * CMAS message decoding.
+ * (See TIA-1149-0-1, CMAS over CDMA)
+ *
+ * @param serviceCategory is the service category from the SMS envelope
+ */
+ private static void decodeCmasUserData(BearerData bData, int serviceCategory)
+ throws BitwiseInputStream.AccessException, CodingException {
+ BitwiseInputStream inStream = new BitwiseInputStream(bData.userData.payload);
+ if (inStream.available() < 8) {
+ throw new CodingException("emergency CB with no CMAE_protocol_version");
+ }
+ int protocolVersion = inStream.read(8);
+ if (protocolVersion != 0) {
+ throw new CodingException("unsupported CMAE_protocol_version " + protocolVersion);
+ }
+
+ int messageClass = serviceCategoryToCmasMessageClass(serviceCategory);
+ int category = SmsCbCmasInfo.CMAS_CATEGORY_UNKNOWN;
+ int responseType = SmsCbCmasInfo.CMAS_RESPONSE_TYPE_UNKNOWN;
+ int severity = SmsCbCmasInfo.CMAS_SEVERITY_UNKNOWN;
+ int urgency = SmsCbCmasInfo.CMAS_URGENCY_UNKNOWN;
+ int certainty = SmsCbCmasInfo.CMAS_CERTAINTY_UNKNOWN;
+
+ while (inStream.available() >= 16) {
+ int recordType = inStream.read(8);
+ int recordLen = inStream.read(8);
+ switch (recordType) {
+ case 0: // Type 0 elements (Alert text)
+ UserData alertUserData = new UserData();
+ alertUserData.msgEncoding = inStream.read(5);
+ alertUserData.msgEncodingSet = true;
+ alertUserData.msgType = 0;
+
+ int numFields; // number of chars to decode
+ switch (alertUserData.msgEncoding) {
+ case UserData.ENCODING_OCTET:
+ case UserData.ENCODING_LATIN:
+ numFields = recordLen - 1; // subtract 1 byte for encoding
+ break;
+
+ case UserData.ENCODING_IA5:
+ case UserData.ENCODING_7BIT_ASCII:
+ case UserData.ENCODING_GSM_7BIT_ALPHABET:
+ numFields = ((recordLen * 8) - 5) / 7; // subtract 5 bits for encoding
+ break;
+
+ case UserData.ENCODING_UNICODE_16:
+ numFields = (recordLen - 1) / 2;
+ break;
+
+ default:
+ numFields = 0; // unsupported encoding
+ }
+
+ alertUserData.numFields = numFields;
+ alertUserData.payload = inStream.readByteArray(recordLen * 8 - 5);
+ decodeUserDataPayload(alertUserData, false);
+ bData.userData = alertUserData;
+ break;
+
+ case 1: // Type 1 elements
+ category = inStream.read(8);
+ responseType = inStream.read(8);
+ severity = inStream.read(4);
+ urgency = inStream.read(4);
+ certainty = inStream.read(4);
+ inStream.skip(recordLen * 8 - 28);
+ break;
+
+ default:
+ Log.w(LOG_TAG, "skipping unsupported CMAS record type " + recordType);
+ inStream.skip(recordLen * 8);
+ break;
+ }
+ }
+
+ bData.cmasWarningInfo = new SmsCbCmasInfo(messageClass, category, responseType, severity,
+ urgency, certainty);
+ }
+
/**
* Create BearerData object from serialized representation.
* (See 3GPP2 C.R1001-F, v1.0, section 4.5 for layout details)
*
* @param smsData byte array of raw encoded SMS bearer data.
- *
* @return an instance of BearerData.
*/
public static BearerData decode(byte[] smsData) {
+ return decode(smsData, 0);
+ }
+
+ private static boolean isCmasAlertCategory(int category) {
+ return category >= SmsEnvelope.SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT
+ && category <= SmsEnvelope.SERVICE_CATEGORY_CMAS_LAST_RESERVED_VALUE;
+ }
+
+ /**
+ * Create BearerData object from serialized representation.
+ * (See 3GPP2 C.R1001-F, v1.0, section 4.5 for layout details)
+ *
+ * @param smsData byte array of raw encoded SMS bearer data.
+ * @param serviceCategory the envelope service category (for CMAS alert handling)
+ * @return an instance of BearerData.
+ */
+ public static BearerData decode(byte[] smsData, int serviceCategory) {
try {
BitwiseInputStream inStream = new BitwiseInputStream(smsData);
BearerData bData = new BearerData();
int foundSubparamMask = 0;
while (inStream.available() > 0) {
- boolean decodeSuccess = false;
int subparamId = inStream.read(8);
int subparamIdBit = 1 << subparamId;
if ((foundSubparamMask & subparamIdBit) != 0) {
throw new CodingException("illegal duplicate subparameter (" +
subparamId + ")");
}
+ boolean decodeSuccess;
switch (subparamId) {
case SUBPARAM_MESSAGE_IDENTIFIER:
decodeSuccess = decodeMessageId(bData, inStream);
@@ -1624,6 +1903,9 @@
case SUBPARAM_MESSAGE_DEPOSIT_INDEX:
decodeSuccess = decodeDepositIndex(bData, inStream);
break;
+ case SUBPARAM_SERVICE_CATEGORY_PROGRAM_DATA:
+ decodeSuccess = decodeServiceCategoryProgramData(bData, inStream);
+ break;
default:
throw new CodingException("unsupported bearer data subparameter ("
+ subparamId + ")");
@@ -1634,7 +1916,10 @@
throw new CodingException("missing MESSAGE_IDENTIFIER subparam");
}
if (bData.userData != null) {
- if (bData.userData.msgEncoding == UserData.ENCODING_IS91_EXTENDED_PROTOCOL) {
+ if (isCmasAlertCategory(serviceCategory) && bData.priorityIndicatorSet
+ && bData.priority == SmsCbMessage.MESSAGE_PRIORITY_EMERGENCY) {
+ decodeCmasUserData(bData, serviceCategory);
+ } else if (bData.userData.msgEncoding == UserData.ENCODING_IS91_EXTENDED_PROTOCOL) {
if ((foundSubparamMask ^
(1 << SUBPARAM_MESSAGE_IDENTIFIER) ^
(1 << SUBPARAM_USER_DATA))
diff --git a/telephony/java/com/android/internal/telephony/cdma/sms/SmsEnvelope.java b/telephony/java/com/android/internal/telephony/cdma/sms/SmsEnvelope.java
index 4a60231..f73df56 100644
--- a/telephony/java/com/android/internal/telephony/cdma/sms/SmsEnvelope.java
+++ b/telephony/java/com/android/internal/telephony/cdma/sms/SmsEnvelope.java
@@ -37,6 +37,7 @@
static public final int TELESERVICE_VMN = 0x1003;
static public final int TELESERVICE_WAP = 0x1004;
static public final int TELESERVICE_WEMT = 0x1005;
+ static public final int TELESERVICE_SCPT = 0x1006;
/**
* The following are defined as extensions to the standard teleservices
@@ -46,14 +47,17 @@
// number of messages waiting, it's used by some CDMA carriers for a voice mail count.
static public final int TELESERVICE_MWI = 0x40000;
- // ServiceCategories for Cell Broadcast, see 3GPP2 C.R1001 table 9.3.1-1
- //static public final int SERVICECATEGORY_EMERGENCY = 0x0010;
+ // Service Categories for Cell Broadcast, see 3GPP2 C.R1001 table 9.3.1-1
+ // static final int SERVICE_CATEGORY_EMERGENCY = 0x0001;
//...
- /**
- * maximum lengths for fields as defined in ril_cdma_sms.h
- */
- static public final int SMS_BEARER_DATA_MAX = 255;
+ // CMAS alert service category assignments, see 3GPP2 C.R1001 table 9.3.3-1
+ public static final int SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT = 0x1000;
+ public static final int SERVICE_CATEGORY_CMAS_EXTREME_THREAT = 0x1001;
+ public static final int SERVICE_CATEGORY_CMAS_SEVERE_THREAT = 0x1002;
+ public static final int SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY = 0x1003;
+ public static final int SERVICE_CATEGORY_CMAS_TEST_MESSAGE = 0x1004;
+ public static final int SERVICE_CATEGORY_CMAS_LAST_RESERVED_VALUE = 0x10ff;
/**
* Provides the type of a SMS message like point to point, broadcast or acknowledge
diff --git a/telephony/java/com/android/internal/telephony/cdma/sms/UserData.java b/telephony/java/com/android/internal/telephony/cdma/sms/UserData.java
index 189d97d..599c2b3 100644
--- a/telephony/java/com/android/internal/telephony/cdma/sms/UserData.java
+++ b/telephony/java/com/android/internal/telephony/cdma/sms/UserData.java
@@ -32,9 +32,9 @@
public static final int ENCODING_7BIT_ASCII = 0x02;
public static final int ENCODING_IA5 = 0x03;
public static final int ENCODING_UNICODE_16 = 0x04;
- //public static final int ENCODING_SHIFT_JIS = 0x05;
- //public static final int ENCODING_KOREAN = 0x06;
- //public static final int ENCODING_LATIN_HEBREW = 0x07;
+ public static final int ENCODING_SHIFT_JIS = 0x05;
+ public static final int ENCODING_KOREAN = 0x06;
+ public static final int ENCODING_LATIN_HEBREW = 0x07;
public static final int ENCODING_LATIN = 0x08;
public static final int ENCODING_GSM_7BIT_ALPHABET = 0x09;
public static final int ENCODING_GSM_DCS = 0x0A;
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java b/telephony/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java
index 8a75f51..931c662 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java
@@ -26,6 +26,7 @@
import android.provider.Telephony.Sms;
import android.provider.Telephony.Sms.Intents;
import android.telephony.PhoneNumberUtils;
+import android.telephony.SmsCbLocation;
import android.telephony.SmsCbMessage;
import android.telephony.SmsManager;
import android.telephony.gsm.GsmCellLocation;
@@ -318,24 +319,18 @@
* concatenated message
*/
private static final class SmsCbConcatInfo {
+
private final SmsCbHeader mHeader;
+ private final SmsCbLocation mLocation;
- private final String mPlmn;
-
- private final int mLac;
-
- private final int mCid;
-
- public SmsCbConcatInfo(SmsCbHeader header, String plmn, int lac, int cid) {
+ public SmsCbConcatInfo(SmsCbHeader header, SmsCbLocation location) {
mHeader = header;
- mPlmn = plmn;
- mLac = lac;
- mCid = cid;
+ mLocation = location;
}
@Override
public int hashCode() {
- return mHeader.messageIdentifier * 31 + mHeader.updateNumber;
+ return (mHeader.getSerialNumber() * 31) + mLocation.hashCode();
}
@Override
@@ -343,49 +338,28 @@
if (obj instanceof SmsCbConcatInfo) {
SmsCbConcatInfo other = (SmsCbConcatInfo)obj;
- // Two pages match if all header attributes (except the page
- // index) are identical, and both pages belong to the same
- // location (which is also determined by the scope parameter)
- if (mHeader.geographicalScope == other.mHeader.geographicalScope
- && mHeader.messageCode == other.mHeader.messageCode
- && mHeader.updateNumber == other.mHeader.updateNumber
- && mHeader.messageIdentifier == other.mHeader.messageIdentifier
- && mHeader.dataCodingScheme == other.mHeader.dataCodingScheme
- && mHeader.nrOfPages == other.mHeader.nrOfPages) {
- return matchesLocation(other.mPlmn, other.mLac, other.mCid);
- }
+ // Two pages match if they have the same serial number (which includes the
+ // geographical scope and update number), and both pages belong to the same
+ // location (PLMN, plus LAC and CID if these are part of the geographical scope).
+ return mHeader.getSerialNumber() == other.mHeader.getSerialNumber()
+ && mLocation.equals(other.mLocation);
}
return false;
}
/**
- * Checks if this concatenation info matches the given location. The
- * granularity of the match depends on the geographical scope.
+ * Compare the location code for this message to the current location code. The match is
+ * relative to the geographical scope of the message, which determines whether the LAC
+ * and Cell ID are saved in mLocation or set to -1 to match all values.
*
- * @param plmn PLMN
- * @param lac Location area code
- * @param cid Cell ID
- * @return true if matching, false otherwise
+ * @param plmn the current PLMN
+ * @param lac the current Location Area (GSM) or Service Area (UMTS)
+ * @param cid the current Cell ID
+ * @return true if this message is valid for the current location; false otherwise
*/
public boolean matchesLocation(String plmn, int lac, int cid) {
- switch (mHeader.geographicalScope) {
- case SmsCbMessage.GEOGRAPHICAL_SCOPE_CELL_WIDE:
- case SmsCbMessage.GEOGRAPHICAL_SCOPE_CELL_WIDE_IMMEDIATE:
- if (mCid != cid) {
- return false;
- }
- // deliberate fall-through
- case SmsCbMessage.GEOGRAPHICAL_SCOPE_LA_WIDE:
- if (mLac != lac) {
- return false;
- }
- // deliberate fall-through
- case SmsCbMessage.GEOGRAPHICAL_SCOPE_PLMN_WIDE:
- return mPlmn != null && mPlmn.equals(plmn);
- }
-
- return false;
+ return mLocation.isInLocationArea(plmn, lac, cid);
}
}
@@ -421,24 +395,42 @@
int lac = cellLocation.getLac();
int cid = cellLocation.getCid();
+ SmsCbLocation location;
+ switch (header.getGeographicalScope()) {
+ case SmsCbMessage.GEOGRAPHICAL_SCOPE_LA_WIDE:
+ location = new SmsCbLocation(plmn, lac, -1);
+ break;
+
+ case SmsCbMessage.GEOGRAPHICAL_SCOPE_CELL_WIDE:
+ case SmsCbMessage.GEOGRAPHICAL_SCOPE_CELL_WIDE_IMMEDIATE:
+ location = new SmsCbLocation(plmn, lac, cid);
+ break;
+
+ case SmsCbMessage.GEOGRAPHICAL_SCOPE_PLMN_WIDE:
+ default:
+ location = new SmsCbLocation(plmn);
+ break;
+ }
+
byte[][] pdus;
- if (header.nrOfPages > 1) {
+ int pageCount = header.getNumberOfPages();
+ if (pageCount > 1) {
// Multi-page message
- SmsCbConcatInfo concatInfo = new SmsCbConcatInfo(header, plmn, lac, cid);
+ SmsCbConcatInfo concatInfo = new SmsCbConcatInfo(header, location);
// Try to find other pages of the same message
pdus = mSmsCbPageMap.get(concatInfo);
if (pdus == null) {
- // This it the first page of this message, make room for all
+ // This is the first page of this message, make room for all
// pages and keep until complete
- pdus = new byte[header.nrOfPages][];
+ pdus = new byte[pageCount][];
mSmsCbPageMap.put(concatInfo, pdus);
}
// Page parameter is one-based
- pdus[header.pageIndex - 1] = receivedPdu;
+ pdus[header.getPageIndex() - 1] = receivedPdu;
for (int i = 0; i < pdus.length; i++) {
if (pdus[i] == null) {
@@ -455,8 +447,8 @@
pdus[0] = receivedPdu;
}
- boolean isEmergencyMessage = SmsCbHeader.isEmergencyMessage(header.messageIdentifier);
- dispatchBroadcastPdus(pdus, isEmergencyMessage);
+ SmsCbMessage message = GsmSmsCbMessage.createSmsCbMessage(header, location, pdus);
+ dispatchBroadcastMessage(message);
// Remove messages that are out of scope to prevent the map from
// growing indefinitely, containing incomplete messages that were
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmSmsCbMessage.java b/telephony/java/com/android/internal/telephony/gsm/GsmSmsCbMessage.java
new file mode 100644
index 0000000..dc9554a
--- /dev/null
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmSmsCbMessage.java
@@ -0,0 +1,286 @@
+/*
+ * 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.internal.telephony.gsm;
+
+import android.telephony.SmsCbLocation;
+import android.telephony.SmsCbMessage;
+import android.util.Pair;
+
+import com.android.internal.telephony.GsmAlphabet;
+
+import java.io.UnsupportedEncodingException;
+
+/**
+ * Parses a GSM or UMTS format SMS-CB message into an {@link SmsCbMessage} object. The class is
+ * public because {@link #createSmsCbMessage(SmsCbLocation, byte[][])} is used by some test cases.
+ */
+public class GsmSmsCbMessage {
+
+ /**
+ * Languages in the 0000xxxx DCS group as defined in 3GPP TS 23.038, section 5.
+ */
+ private static final String[] LANGUAGE_CODES_GROUP_0 = {
+ "de", "en", "it", "fr", "es", "nl", "sv", "da", "pt", "fi", "no", "el", "tr", "hu",
+ "pl", null
+ };
+
+ /**
+ * Languages in the 0010xxxx DCS group as defined in 3GPP TS 23.038, section 5.
+ */
+ private static final String[] LANGUAGE_CODES_GROUP_2 = {
+ "cs", "he", "ar", "ru", "is", null, null, null, null, null, null, null, null, null,
+ null, null
+ };
+
+ private static final char CARRIAGE_RETURN = 0x0d;
+
+ private static final int PDU_BODY_PAGE_LENGTH = 82;
+
+ /** Utility class with only static methods. */
+ private GsmSmsCbMessage() { }
+
+ /**
+ * Create a new SmsCbMessage object from a header object plus one or more received PDUs.
+ *
+ * @param pdus PDU bytes
+ */
+ static SmsCbMessage createSmsCbMessage(SmsCbHeader header, SmsCbLocation location,
+ byte[][] pdus) throws IllegalArgumentException {
+ if (header.isEtwsPrimaryNotification()) {
+ return new SmsCbMessage(SmsCbMessage.MESSAGE_FORMAT_3GPP,
+ header.getGeographicalScope(), header.getSerialNumber(),
+ location, header.getServiceCategory(),
+ null, "ETWS", SmsCbMessage.MESSAGE_PRIORITY_EMERGENCY,
+ header.getEtwsInfo(), header.getCmasInfo());
+ } else {
+ String language = null;
+ StringBuilder sb = new StringBuilder();
+ for (byte[] pdu : pdus) {
+ Pair<String, String> p = parseBody(header, pdu);
+ language = p.first;
+ sb.append(p.second);
+ }
+ int priority = header.isEmergencyMessage() ? SmsCbMessage.MESSAGE_PRIORITY_EMERGENCY
+ : SmsCbMessage.MESSAGE_PRIORITY_NORMAL;
+
+ return new SmsCbMessage(SmsCbMessage.MESSAGE_FORMAT_3GPP,
+ header.getGeographicalScope(), header.getSerialNumber(), location,
+ header.getServiceCategory(), language, sb.toString(), priority,
+ header.getEtwsInfo(), header.getCmasInfo());
+ }
+ }
+
+ /**
+ * Create a new SmsCbMessage object from one or more received PDUs. This is used by some
+ * CellBroadcastReceiver test cases, because SmsCbHeader is now package local.
+ *
+ * @param location the location (geographical scope) for the message
+ * @param pdus PDU bytes
+ */
+ public static SmsCbMessage createSmsCbMessage(SmsCbLocation location, byte[][] pdus)
+ throws IllegalArgumentException {
+ SmsCbHeader header = new SmsCbHeader(pdus[0]);
+ return createSmsCbMessage(header, location, pdus);
+ }
+
+ /**
+ * Parse and unpack the body text according to the encoding in the DCS.
+ * After completing successfully this method will have assigned the body
+ * text into mBody, and optionally the language code into mLanguage
+ *
+ * @param header the message header to use
+ * @param pdu the PDU to decode
+ * @return a Pair of Strings containing the language and body of the message
+ */
+ private static Pair<String, String> parseBody(SmsCbHeader header, byte[] pdu) {
+ int encoding;
+ String language = null;
+ boolean hasLanguageIndicator = false;
+ int dataCodingScheme = header.getDataCodingScheme();
+
+ // Extract encoding and language from DCS, as defined in 3gpp TS 23.038,
+ // section 5.
+ switch ((dataCodingScheme & 0xf0) >> 4) {
+ case 0x00:
+ encoding = android.telephony.SmsMessage.ENCODING_7BIT;
+ language = LANGUAGE_CODES_GROUP_0[dataCodingScheme & 0x0f];
+ break;
+
+ case 0x01:
+ hasLanguageIndicator = true;
+ if ((dataCodingScheme & 0x0f) == 0x01) {
+ encoding = android.telephony.SmsMessage.ENCODING_16BIT;
+ } else {
+ encoding = android.telephony.SmsMessage.ENCODING_7BIT;
+ }
+ break;
+
+ case 0x02:
+ encoding = android.telephony.SmsMessage.ENCODING_7BIT;
+ language = LANGUAGE_CODES_GROUP_2[dataCodingScheme & 0x0f];
+ break;
+
+ case 0x03:
+ encoding = android.telephony.SmsMessage.ENCODING_7BIT;
+ break;
+
+ case 0x04:
+ case 0x05:
+ switch ((dataCodingScheme & 0x0c) >> 2) {
+ case 0x01:
+ encoding = android.telephony.SmsMessage.ENCODING_8BIT;
+ break;
+
+ case 0x02:
+ encoding = android.telephony.SmsMessage.ENCODING_16BIT;
+ break;
+
+ case 0x00:
+ default:
+ encoding = android.telephony.SmsMessage.ENCODING_7BIT;
+ break;
+ }
+ break;
+
+ case 0x06:
+ case 0x07:
+ // Compression not supported
+ case 0x09:
+ // UDH structure not supported
+ case 0x0e:
+ // Defined by the WAP forum not supported
+ throw new IllegalArgumentException("Unsupported GSM dataCodingScheme "
+ + dataCodingScheme);
+
+ case 0x0f:
+ if (((dataCodingScheme & 0x04) >> 2) == 0x01) {
+ encoding = android.telephony.SmsMessage.ENCODING_8BIT;
+ } else {
+ encoding = android.telephony.SmsMessage.ENCODING_7BIT;
+ }
+ break;
+
+ default:
+ // Reserved values are to be treated as 7-bit
+ encoding = android.telephony.SmsMessage.ENCODING_7BIT;
+ break;
+ }
+
+ if (header.isUmtsFormat()) {
+ // Payload may contain multiple pages
+ int nrPages = pdu[SmsCbHeader.PDU_HEADER_LENGTH];
+
+ if (pdu.length < SmsCbHeader.PDU_HEADER_LENGTH + 1 + (PDU_BODY_PAGE_LENGTH + 1)
+ * nrPages) {
+ throw new IllegalArgumentException("Pdu length " + pdu.length + " does not match "
+ + nrPages + " pages");
+ }
+
+ StringBuilder sb = new StringBuilder();
+
+ for (int i = 0; i < nrPages; i++) {
+ // Each page is 82 bytes followed by a length octet indicating
+ // the number of useful octets within those 82
+ int offset = SmsCbHeader.PDU_HEADER_LENGTH + 1 + (PDU_BODY_PAGE_LENGTH + 1) * i;
+ int length = pdu[offset + PDU_BODY_PAGE_LENGTH];
+
+ if (length > PDU_BODY_PAGE_LENGTH) {
+ throw new IllegalArgumentException("Page length " + length
+ + " exceeds maximum value " + PDU_BODY_PAGE_LENGTH);
+ }
+
+ Pair<String, String> p = unpackBody(pdu, encoding, offset, length,
+ hasLanguageIndicator, language);
+ language = p.first;
+ sb.append(p.second);
+ }
+ return new Pair<String, String>(language, sb.toString());
+ } else {
+ // Payload is one single page
+ int offset = SmsCbHeader.PDU_HEADER_LENGTH;
+ int length = pdu.length - offset;
+
+ return unpackBody(pdu, encoding, offset, length, hasLanguageIndicator, language);
+ }
+ }
+
+ /**
+ * Unpack body text from the pdu using the given encoding, position and
+ * length within the pdu
+ *
+ * @param pdu The pdu
+ * @param encoding The encoding, as derived from the DCS
+ * @param offset Position of the first byte to unpack
+ * @param length Number of bytes to unpack
+ * @param hasLanguageIndicator true if the body text is preceded by a
+ * language indicator. If so, this method will as a side-effect
+ * assign the extracted language code into mLanguage
+ * @param language the language to return if hasLanguageIndicator is false
+ * @return a Pair of Strings containing the language and body of the message
+ */
+ private static Pair<String, String> unpackBody(byte[] pdu, int encoding, int offset, int length,
+ boolean hasLanguageIndicator, String language) {
+ String body = null;
+
+ switch (encoding) {
+ case android.telephony.SmsMessage.ENCODING_7BIT:
+ body = GsmAlphabet.gsm7BitPackedToString(pdu, offset, length * 8 / 7);
+
+ if (hasLanguageIndicator && body != null && body.length() > 2) {
+ // Language is two GSM characters followed by a CR.
+ // The actual body text is offset by 3 characters.
+ language = body.substring(0, 2);
+ body = body.substring(3);
+ }
+ break;
+
+ case android.telephony.SmsMessage.ENCODING_16BIT:
+ if (hasLanguageIndicator && pdu.length >= offset + 2) {
+ // Language is two GSM characters.
+ // The actual body text is offset by 2 bytes.
+ language = GsmAlphabet.gsm7BitPackedToString(pdu, offset, 2);
+ offset += 2;
+ length -= 2;
+ }
+
+ try {
+ body = new String(pdu, offset, (length & 0xfffe), "utf-16");
+ } catch (UnsupportedEncodingException e) {
+ // Apparently it wasn't valid UTF-16.
+ throw new IllegalArgumentException("Error decoding UTF-16 message", e);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (body != null) {
+ // Remove trailing carriage return
+ for (int i = body.length() - 1; i >= 0; i--) {
+ if (body.charAt(i) != CARRIAGE_RETURN) {
+ body = body.substring(0, i + 1);
+ break;
+ }
+ }
+ } else {
+ body = "";
+ }
+
+ return new Pair<String, String>(language, body);
+ }
+}
diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java b/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java
index 8c3bc0e..455ee74 100644
--- a/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java
+++ b/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java
@@ -19,6 +19,7 @@
import android.os.Message;
import android.util.Log;
+import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.IccCardApplication;
import com.android.internal.telephony.IccConstants;
@@ -35,8 +36,8 @@
//***** Constructor
- public SIMFileHandler(PhoneBase phone) {
- super(phone);
+ public SIMFileHandler(IccCard card, String aid, CommandsInterface ci) {
+ super(card, aid, ci);
}
public void dispose() {
@@ -91,8 +92,8 @@
// The EFids in USIM phone book entries are decided by the card manufacturer.
// So if we don't match any of the cases above and if its a USIM return
// the phone book path.
- IccCard card = phone.getIccCard();
- if (card != null && card.isApplicationOnIcc(IccCardApplication.AppType.APPTYPE_USIM)) {
+ if (mParentCard != null
+ && mParentCard.isApplicationOnIcc(IccCardApplication.AppType.APPTYPE_USIM)) {
return MF_SIM + DF_TELECOM + DF_PHONEBOOK;
}
Log.e(LOG_TAG, "Error: EF Path being returned in null");
diff --git a/telephony/java/android/telephony/SmsCbConstants.java b/telephony/java/com/android/internal/telephony/gsm/SmsCbConstants.java
similarity index 84%
rename from telephony/java/android/telephony/SmsCbConstants.java
rename to telephony/java/com/android/internal/telephony/gsm/SmsCbConstants.java
index a1b4adf..ebb4666 100644
--- a/telephony/java/android/telephony/SmsCbConstants.java
+++ b/telephony/java/com/android/internal/telephony/gsm/SmsCbConstants.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 The Android Open Source Project
+ * 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.
@@ -14,14 +14,22 @@
* limitations under the License.
*/
-package android.telephony;
+package com.android.internal.telephony.gsm;
/**
- * Constants used in SMS Cell Broadcast messages.
+ * Constants used in SMS Cell Broadcast messages (see 3GPP TS 23.041). This class is used by the
+ * boot-time broadcast channel enable and database upgrade code in CellBroadcastReceiver, so it
+ * is public, but should be avoided in favor of the radio technology independent constants in
+ * {@link android.telephony.SmsCbMessage}, {@link android.telephony.SmsCbEtwsInfo}, and
+ * {@link android.telephony.SmsCbCmasInfo} classes.
*
* {@hide}
*/
-public interface SmsCbConstants {
+public class SmsCbConstants {
+
+ /** Private constructor for utility class. */
+ private SmsCbConstants() { }
+
/** Start of PWS Message Identifier range (includes ETWS and CMAS). */
public static final int MESSAGE_ID_PWS_FIRST_IDENTIFIER = 0x1100;
@@ -94,11 +102,11 @@
/** End of PWS Message Identifier range (includes ETWS, CMAS, and future extensions). */
public static final int MESSAGE_ID_PWS_LAST_IDENTIFIER = 0x18FF;
- /** ETWS message code flag to activate the popup display. */
- public static final int MESSAGE_CODE_ETWS_ACTIVATE_POPUP = 0x100;
+ /** ETWS serial number flag to activate the popup display. */
+ public static final int SERIAL_NUMBER_ETWS_ACTIVATE_POPUP = 0x1000;
- /** ETWS message code flag to activate the emergency user alert. */
- public static final int MESSAGE_CODE_ETWS_EMERGENCY_USER_ALERT = 0x200;
+ /** ETWS serial number flag to activate the emergency user alert. */
+ public static final int SERIAL_NUMBER_ETWS_EMERGENCY_USER_ALERT = 0x2000;
/** ETWS warning type value for earthquake. */
public static final int ETWS_WARNING_TYPE_EARTHQUAKE = 0x00;
diff --git a/telephony/java/com/android/internal/telephony/gsm/SmsCbHeader.java b/telephony/java/com/android/internal/telephony/gsm/SmsCbHeader.java
index 8e6b79b..5692044 100644
--- a/telephony/java/com/android/internal/telephony/gsm/SmsCbHeader.java
+++ b/telephony/java/com/android/internal/telephony/gsm/SmsCbHeader.java
@@ -16,28 +16,42 @@
package com.android.internal.telephony.gsm;
-import android.telephony.SmsCbConstants;
+import android.telephony.SmsCbCmasInfo;
+import android.telephony.SmsCbEtwsInfo;
-public class SmsCbHeader implements SmsCbConstants {
+import java.util.Arrays;
+
+/**
+ * Parses a 3GPP TS 23.041 cell broadcast message header. This class is public for use by
+ * CellBroadcastReceiver test cases, but should not be used by applications.
+ *
+ * All relevant header information is now sent as a Parcelable
+ * {@link android.telephony.SmsCbMessage} object in the "message" extra of the
+ * {@link android.provider.Telephony.Sms.Intents#SMS_CB_RECEIVED_ACTION} or
+ * {@link android.provider.Telephony.Sms.Intents#SMS_EMERGENCY_CB_RECEIVED_ACTION} intent.
+ * The raw PDU is no longer sent to SMS CB applications.
+ */
+class SmsCbHeader {
+
/**
* Length of SMS-CB header
*/
- public static final int PDU_HEADER_LENGTH = 6;
+ static final int PDU_HEADER_LENGTH = 6;
/**
* GSM pdu format, as defined in 3gpp TS 23.041, section 9.4.1
*/
- public static final int FORMAT_GSM = 1;
+ static final int FORMAT_GSM = 1;
/**
* UMTS pdu format, as defined in 3gpp TS 23.041, section 9.4.2
*/
- public static final int FORMAT_UMTS = 2;
+ static final int FORMAT_UMTS = 2;
/**
* GSM pdu format, as defined in 3gpp TS 23.041, section 9.4.1.3
*/
- public static final int FORMAT_ETWS_PRIMARY = 3;
+ static final int FORMAT_ETWS_PRIMARY = 3;
/**
* Message type value as defined in 3gpp TS 25.324, section 11.1.
@@ -47,34 +61,34 @@
/**
* Length of GSM pdus
*/
- public static final int PDU_LENGTH_GSM = 88;
+ private static final int PDU_LENGTH_GSM = 88;
/**
* Maximum length of ETWS primary message GSM pdus
*/
- public static final int PDU_LENGTH_ETWS = 56;
+ private static final int PDU_LENGTH_ETWS = 56;
- public final int geographicalScope;
+ private final int geographicalScope;
- public final int messageCode;
+ /** The serial number combines geographical scope, message code, and update number. */
+ private final int serialNumber;
- public final int updateNumber;
+ /** The Message Identifier in 3GPP is the same as the Service Category in CDMA. */
+ private final int messageIdentifier;
- public final int messageIdentifier;
+ private final int dataCodingScheme;
- public final int dataCodingScheme;
+ private final int pageIndex;
- public final int pageIndex;
+ private final int nrOfPages;
- public final int nrOfPages;
+ private final int format;
- public final int format;
+ /** ETWS warning notification info. */
+ private final SmsCbEtwsInfo mEtwsInfo;
- public final boolean etwsEmergencyUserAlert;
-
- public final boolean etwsPopup;
-
- public final int etwsWarningType;
+ /** CMAS warning notification info. */
+ private final SmsCbCmasInfo mCmasInfo;
public SmsCbHeader(byte[] pdu) throws IllegalArgumentException {
if (pdu == null || pdu.length < PDU_HEADER_LENGTH) {
@@ -83,22 +97,31 @@
if (pdu.length <= PDU_LENGTH_ETWS) {
format = FORMAT_ETWS_PRIMARY;
- geographicalScope = -1; //not applicable
- messageCode = -1;
- updateNumber = -1;
+ geographicalScope = (pdu[0] & 0xc0) >> 6;
+ serialNumber = ((pdu[0] & 0xff) << 8) | (pdu[1] & 0xff);
messageIdentifier = ((pdu[2] & 0xff) << 8) | (pdu[3] & 0xff);
dataCodingScheme = -1;
pageIndex = -1;
nrOfPages = -1;
- etwsEmergencyUserAlert = (pdu[4] & 0x1) != 0;
- etwsPopup = (pdu[5] & 0x80) != 0;
- etwsWarningType = (pdu[4] & 0xfe) >> 1;
+ boolean emergencyUserAlert = (pdu[4] & 0x1) != 0;
+ boolean activatePopup = (pdu[5] & 0x80) != 0;
+ int warningType = (pdu[4] & 0xfe) >> 1;
+ byte[] warningSecurityInfo;
+ // copy the Warning-Security-Information, if present
+ if (pdu.length > PDU_HEADER_LENGTH) {
+ warningSecurityInfo = Arrays.copyOfRange(pdu, 6, pdu.length);
+ } else {
+ warningSecurityInfo = null;
+ }
+ mEtwsInfo = new SmsCbEtwsInfo(warningType, emergencyUserAlert, activatePopup,
+ warningSecurityInfo);
+ mCmasInfo = null;
+ return; // skip the ETWS/CMAS initialization code for regular notifications
} else if (pdu.length <= PDU_LENGTH_GSM) {
// GSM pdus are no more than 88 bytes
format = FORMAT_GSM;
geographicalScope = (pdu[0] & 0xc0) >> 6;
- messageCode = ((pdu[0] & 0x3f) << 4) | ((pdu[1] & 0xf0) >> 4);
- updateNumber = pdu[1] & 0x0f;
+ serialNumber = ((pdu[0] & 0xff) << 8) | (pdu[1] & 0xff);
messageIdentifier = ((pdu[2] & 0xff) << 8) | (pdu[3] & 0xff);
dataCodingScheme = pdu[4] & 0xff;
@@ -113,9 +136,6 @@
this.pageIndex = pageIndex;
this.nrOfPages = nrOfPages;
- etwsEmergencyUserAlert = false;
- etwsPopup = false;
- etwsWarningType = -1;
} else {
// UMTS pdus are always at least 90 bytes since the payload includes
// a number-of-pages octet and also one length octet per page
@@ -129,8 +149,7 @@
messageIdentifier = ((pdu[1] & 0xff) << 8) | pdu[2] & 0xff;
geographicalScope = (pdu[3] & 0xc0) >> 6;
- messageCode = ((pdu[3] & 0x3f) << 4) | ((pdu[4] & 0xf0) >> 4);
- updateNumber = pdu[4] & 0x0f;
+ serialNumber = ((pdu[3] & 0xff) << 8) | (pdu[4] & 0xff);
dataCodingScheme = pdu[5] & 0xff;
// We will always consider a UMTS message as having one single page
@@ -138,75 +157,251 @@
// actual payload may contain several pages.
pageIndex = 1;
nrOfPages = 1;
- etwsEmergencyUserAlert = false;
- etwsPopup = false;
- etwsWarningType = -1;
+ }
+
+ if (isEtwsMessage()) {
+ boolean emergencyUserAlert = isEtwsEmergencyUserAlert();
+ boolean activatePopup = isEtwsPopupAlert();
+ int warningType = getEtwsWarningType();
+ mEtwsInfo = new SmsCbEtwsInfo(warningType, emergencyUserAlert, activatePopup, null);
+ mCmasInfo = null;
+ } else if (isCmasMessage()) {
+ int messageClass = getCmasMessageClass();
+ int severity = getCmasSeverity();
+ int urgency = getCmasUrgency();
+ int certainty = getCmasCertainty();
+ mEtwsInfo = null;
+ mCmasInfo = new SmsCbCmasInfo(messageClass, SmsCbCmasInfo.CMAS_CATEGORY_UNKNOWN,
+ SmsCbCmasInfo.CMAS_RESPONSE_TYPE_UNKNOWN, severity, urgency, certainty);
+ } else {
+ mEtwsInfo = null;
+ mCmasInfo = null;
+ }
+ }
+
+ int getGeographicalScope() {
+ return geographicalScope;
+ }
+
+ int getSerialNumber() {
+ return serialNumber;
+ }
+
+ int getServiceCategory() {
+ return messageIdentifier;
+ }
+
+ int getDataCodingScheme() {
+ return dataCodingScheme;
+ }
+
+ int getPageIndex() {
+ return pageIndex;
+ }
+
+ int getNumberOfPages() {
+ return nrOfPages;
+ }
+
+ SmsCbEtwsInfo getEtwsInfo() {
+ return mEtwsInfo;
+ }
+
+ SmsCbCmasInfo getCmasInfo() {
+ return mCmasInfo;
+ }
+
+ /**
+ * Return whether this broadcast is an emergency (PWS) message type.
+ * @return true if this message is emergency type; false otherwise
+ */
+ boolean isEmergencyMessage() {
+ return messageIdentifier >= SmsCbConstants.MESSAGE_ID_PWS_FIRST_IDENTIFIER
+ && messageIdentifier <= SmsCbConstants.MESSAGE_ID_PWS_LAST_IDENTIFIER;
+ }
+
+ /**
+ * Return whether this broadcast is an ETWS emergency message type.
+ * @return true if this message is ETWS emergency type; false otherwise
+ */
+ private boolean isEtwsMessage() {
+ return (messageIdentifier & SmsCbConstants.MESSAGE_ID_ETWS_TYPE_MASK)
+ == SmsCbConstants.MESSAGE_ID_ETWS_TYPE;
+ }
+
+ /**
+ * Return whether this broadcast is an ETWS primary notification.
+ * @return true if this message is an ETWS primary notification; false otherwise
+ */
+ boolean isEtwsPrimaryNotification() {
+ return format == FORMAT_ETWS_PRIMARY;
+ }
+
+ /**
+ * Return whether this broadcast is in UMTS format.
+ * @return true if this message is in UMTS format; false otherwise
+ */
+ boolean isUmtsFormat() {
+ return format == FORMAT_UMTS;
+ }
+
+ /**
+ * Return whether this message is a CMAS emergency message type.
+ * @return true if this message is CMAS emergency type; false otherwise
+ */
+ private boolean isCmasMessage() {
+ return messageIdentifier >= SmsCbConstants.MESSAGE_ID_CMAS_FIRST_IDENTIFIER
+ && messageIdentifier <= SmsCbConstants.MESSAGE_ID_CMAS_LAST_IDENTIFIER;
+ }
+
+ /**
+ * Return whether the popup alert flag is set for an ETWS warning notification.
+ * This method assumes that the message ID has already been checked for ETWS type.
+ *
+ * @return true if the message code indicates a popup alert should be displayed
+ */
+ private boolean isEtwsPopupAlert() {
+ return (serialNumber & SmsCbConstants.SERIAL_NUMBER_ETWS_ACTIVATE_POPUP) != 0;
+ }
+
+ /**
+ * Return whether the emergency user alert flag is set for an ETWS warning notification.
+ * This method assumes that the message ID has already been checked for ETWS type.
+ *
+ * @return true if the message code indicates an emergency user alert
+ */
+ private boolean isEtwsEmergencyUserAlert() {
+ return (serialNumber & SmsCbConstants.SERIAL_NUMBER_ETWS_EMERGENCY_USER_ALERT) != 0;
+ }
+
+ /**
+ * Returns the warning type for an ETWS warning notification.
+ * This method assumes that the message ID has already been checked for ETWS type.
+ *
+ * @return the ETWS warning type defined in 3GPP TS 23.041 section 9.3.24
+ */
+ private int getEtwsWarningType() {
+ return messageIdentifier - SmsCbConstants.MESSAGE_ID_ETWS_EARTHQUAKE_WARNING;
+ }
+
+ /**
+ * Returns the message class for a CMAS warning notification.
+ * This method assumes that the message ID has already been checked for CMAS type.
+ * @return the CMAS message class as defined in {@link SmsCbCmasInfo}
+ */
+ private int getCmasMessageClass() {
+ switch (messageIdentifier) {
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_PRESIDENTIAL_LEVEL:
+ return SmsCbCmasInfo.CMAS_CLASS_PRESIDENTIAL_LEVEL_ALERT;
+
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_OBSERVED:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_LIKELY:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_EXPECTED_OBSERVED:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_EXPECTED_LIKELY:
+ return SmsCbCmasInfo.CMAS_CLASS_EXTREME_THREAT;
+
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_IMMEDIATE_OBSERVED:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_IMMEDIATE_LIKELY:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_EXPECTED_OBSERVED:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_EXPECTED_LIKELY:
+ return SmsCbCmasInfo.CMAS_CLASS_SEVERE_THREAT;
+
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_CHILD_ABDUCTION_EMERGENCY:
+ return SmsCbCmasInfo.CMAS_CLASS_CHILD_ABDUCTION_EMERGENCY;
+
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_REQUIRED_MONTHLY_TEST:
+ return SmsCbCmasInfo.CMAS_CLASS_REQUIRED_MONTHLY_TEST;
+
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXERCISE:
+ return SmsCbCmasInfo.CMAS_CLASS_CMAS_EXERCISE;
+
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_OPERATOR_DEFINED_USE:
+ return SmsCbCmasInfo.CMAS_CLASS_OPERATOR_DEFINED_USE;
+
+ default:
+ return SmsCbCmasInfo.CMAS_CLASS_UNKNOWN;
}
}
/**
- * Return whether the specified message ID is an emergency (PWS) message type.
- * This method is static and takes an argument so that it can be used by
- * CellBroadcastReceiver, which stores message ID's in SQLite rather than PDU.
- * @param id the message identifier to check
- * @return true if the message is emergency type; false otherwise
+ * Returns the severity for a CMAS warning notification. This is only available for extreme
+ * and severe alerts, not for other types such as Presidential Level and AMBER alerts.
+ * This method assumes that the message ID has already been checked for CMAS type.
+ * @return the CMAS severity as defined in {@link SmsCbCmasInfo}
*/
- public static boolean isEmergencyMessage(int id) {
- return id >= MESSAGE_ID_PWS_FIRST_IDENTIFIER && id <= MESSAGE_ID_PWS_LAST_IDENTIFIER;
+ private int getCmasSeverity() {
+ switch (messageIdentifier) {
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_OBSERVED:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_LIKELY:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_EXPECTED_OBSERVED:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_EXPECTED_LIKELY:
+ return SmsCbCmasInfo.CMAS_SEVERITY_EXTREME;
+
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_IMMEDIATE_OBSERVED:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_IMMEDIATE_LIKELY:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_EXPECTED_OBSERVED:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_EXPECTED_LIKELY:
+ return SmsCbCmasInfo.CMAS_SEVERITY_SEVERE;
+
+ default:
+ return SmsCbCmasInfo.CMAS_SEVERITY_UNKNOWN;
+ }
}
/**
- * Return whether the specified message ID is an ETWS emergency message type.
- * This method is static and takes an argument so that it can be used by
- * CellBroadcastReceiver, which stores message ID's in SQLite rather than PDU.
- * @param id the message identifier to check
- * @return true if the message is ETWS emergency type; false otherwise
+ * Returns the urgency for a CMAS warning notification. This is only available for extreme
+ * and severe alerts, not for other types such as Presidential Level and AMBER alerts.
+ * This method assumes that the message ID has already been checked for CMAS type.
+ * @return the CMAS urgency as defined in {@link SmsCbCmasInfo}
*/
- public static boolean isEtwsMessage(int id) {
- return (id & MESSAGE_ID_ETWS_TYPE_MASK) == MESSAGE_ID_ETWS_TYPE;
+ private int getCmasUrgency() {
+ switch (messageIdentifier) {
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_OBSERVED:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_LIKELY:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_IMMEDIATE_OBSERVED:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_IMMEDIATE_LIKELY:
+ return SmsCbCmasInfo.CMAS_URGENCY_IMMEDIATE;
+
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_EXPECTED_OBSERVED:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_EXPECTED_LIKELY:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_EXPECTED_OBSERVED:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_EXPECTED_LIKELY:
+ return SmsCbCmasInfo.CMAS_URGENCY_EXPECTED;
+
+ default:
+ return SmsCbCmasInfo.CMAS_URGENCY_UNKNOWN;
+ }
}
/**
- * Return whether the specified message ID is a CMAS emergency message type.
- * This method is static and takes an argument so that it can be used by
- * CellBroadcastReceiver, which stores message ID's in SQLite rather than PDU.
- * @param id the message identifier to check
- * @return true if the message is CMAS emergency type; false otherwise
+ * Returns the certainty for a CMAS warning notification. This is only available for extreme
+ * and severe alerts, not for other types such as Presidential Level and AMBER alerts.
+ * This method assumes that the message ID has already been checked for CMAS type.
+ * @return the CMAS certainty as defined in {@link SmsCbCmasInfo}
*/
- public static boolean isCmasMessage(int id) {
- return id >= MESSAGE_ID_CMAS_FIRST_IDENTIFIER && id <= MESSAGE_ID_CMAS_LAST_IDENTIFIER;
- }
+ private int getCmasCertainty() {
+ switch (messageIdentifier) {
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_OBSERVED:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_EXPECTED_OBSERVED:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_IMMEDIATE_OBSERVED:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_EXPECTED_OBSERVED:
+ return SmsCbCmasInfo.CMAS_CERTAINTY_OBSERVED;
- /**
- * Return whether the specified message code indicates an ETWS popup alert.
- * This method is static and takes an argument so that it can be used by
- * CellBroadcastReceiver, which stores message codes in SQLite rather than PDU.
- * This method assumes that the message ID has already been checked for ETWS type.
- *
- * @param messageCode the message code to check
- * @return true if the message code indicates a popup alert should be displayed
- */
- public static boolean isEtwsPopupAlert(int messageCode) {
- return (messageCode & MESSAGE_CODE_ETWS_ACTIVATE_POPUP) != 0;
- }
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_LIKELY:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_EXPECTED_LIKELY:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_IMMEDIATE_LIKELY:
+ case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_EXPECTED_LIKELY:
+ return SmsCbCmasInfo.CMAS_CERTAINTY_LIKELY;
- /**
- * Return whether the specified message code indicates an ETWS emergency user alert.
- * This method is static and takes an argument so that it can be used by
- * CellBroadcastReceiver, which stores message codes in SQLite rather than PDU.
- * This method assumes that the message ID has already been checked for ETWS type.
- *
- * @param messageCode the message code to check
- * @return true if the message code indicates an emergency user alert
- */
- public static boolean isEtwsEmergencyUserAlert(int messageCode) {
- return (messageCode & MESSAGE_CODE_ETWS_EMERGENCY_USER_ALERT) != 0;
+ default:
+ return SmsCbCmasInfo.CMAS_CERTAINTY_UNKNOWN;
+ }
}
@Override
public String toString() {
- return "SmsCbHeader{GS=" + geographicalScope + ", messageCode=0x" +
- Integer.toHexString(messageCode) + ", updateNumber=" + updateNumber +
+ return "SmsCbHeader{GS=" + geographicalScope + ", serialNumber=0x" +
+ Integer.toHexString(serialNumber) +
", messageIdentifier=0x" + Integer.toHexString(messageIdentifier) +
", DCS=0x" + Integer.toHexString(dataCodingScheme) +
", page " + pageIndex + " of " + nrOfPages + '}';
diff --git a/telephony/tests/telephonytests/src/com/android/internal/telephony/cdma/CdmaSmsCbTest.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/cdma/CdmaSmsCbTest.java
new file mode 100644
index 0000000..3c9c0b2
--- /dev/null
+++ b/telephony/tests/telephonytests/src/com/android/internal/telephony/cdma/CdmaSmsCbTest.java
@@ -0,0 +1,708 @@
+/*
+ * 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.internal.telephony.cdma;
+
+import android.os.Parcel;
+import android.telephony.SmsCbCmasInfo;
+import android.telephony.SmsCbMessage;
+import android.telephony.cdma.CdmaSmsCbProgramData;
+import android.test.AndroidTestCase;
+import android.util.Log;
+
+import com.android.internal.telephony.GsmAlphabet;
+import com.android.internal.telephony.IccUtils;
+import com.android.internal.telephony.cdma.sms.BearerData;
+import com.android.internal.telephony.cdma.sms.CdmaSmsAddress;
+import com.android.internal.telephony.cdma.sms.SmsEnvelope;
+import com.android.internal.telephony.cdma.sms.UserData;
+import com.android.internal.util.BitwiseOutputStream;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Test cases for basic SmsCbMessage operation for CDMA.
+ */
+public class CdmaSmsCbTest extends AndroidTestCase {
+
+ /* Copy of private subparameter identifier constants from BearerData class. */
+ private static final byte SUBPARAM_MESSAGE_IDENTIFIER = (byte) 0x00;
+ private static final byte SUBPARAM_USER_DATA = (byte) 0x01;
+ private static final byte SUBPARAM_PRIORITY_INDICATOR = (byte) 0x08;
+ private static final byte SUBPARAM_LANGUAGE_INDICATOR = (byte) 0x0D;
+ private static final byte SUBPARAM_SERVICE_CATEGORY_PROGRAM_DATA = 0x12;
+
+ /**
+ * Initialize a Parcel for an incoming CDMA cell broadcast. The caller will write the
+ * bearer data and then convert it to an SmsMessage.
+ * @param serviceCategory the CDMA service category
+ * @return the initialized Parcel
+ */
+ private static Parcel createBroadcastParcel(int serviceCategory) {
+ Parcel p = Parcel.obtain();
+
+ p.writeInt(SmsEnvelope.TELESERVICE_NOT_SET);
+ p.writeByte((byte) 1); // non-zero for MESSAGE_TYPE_BROADCAST
+ p.writeInt(serviceCategory);
+
+ // dummy address (RIL may generate a different dummy address for broadcasts)
+ p.writeInt(CdmaSmsAddress.DIGIT_MODE_4BIT_DTMF); // sAddress.digit_mode
+ p.writeInt(CdmaSmsAddress.NUMBER_MODE_NOT_DATA_NETWORK); // sAddress.number_mode
+ p.writeInt(CdmaSmsAddress.TON_UNKNOWN); // sAddress.number_type
+ p.writeInt(CdmaSmsAddress.NUMBERING_PLAN_ISDN_TELEPHONY); // sAddress.number_plan
+ p.writeByte((byte) 0); // sAddress.number_of_digits
+ p.writeInt((byte) 0); // sSubAddress.subaddressType
+ p.writeByte((byte) 0); // sSubAddress.odd
+ p.writeByte((byte) 0); // sSubAddress.number_of_digits
+ return p;
+ }
+
+ /**
+ * Initialize a BitwiseOutputStream with the CDMA bearer data subparameters except for
+ * user data. The caller will append the user data and add it to the parcel.
+ * @param messageId the 16-bit message identifier
+ * @param priority message priority
+ * @param language message language code
+ * @return the initialized BitwiseOutputStream
+ */
+ private static BitwiseOutputStream createBearerDataStream(int messageId, int priority,
+ int language) throws BitwiseOutputStream.AccessException {
+ BitwiseOutputStream bos = new BitwiseOutputStream(10);
+ bos.write(8, SUBPARAM_MESSAGE_IDENTIFIER);
+ bos.write(8, 3); // length: 3 bytes
+ bos.write(4, BearerData.MESSAGE_TYPE_DELIVER);
+ bos.write(8, ((messageId >>> 8) & 0xff));
+ bos.write(8, (messageId & 0xff));
+ bos.write(1, 0); // no User Data Header
+ bos.write(3, 0); // reserved
+
+ if (priority != -1) {
+ bos.write(8, SUBPARAM_PRIORITY_INDICATOR);
+ bos.write(8, 1); // length: 1 byte
+ bos.write(2, (priority & 0x03));
+ bos.write(6, 0); // reserved
+ }
+
+ if (language != -1) {
+ bos.write(8, SUBPARAM_LANGUAGE_INDICATOR);
+ bos.write(8, 1); // length: 1 byte
+ bos.write(8, (language & 0xff));
+ }
+
+ return bos;
+ }
+
+ /**
+ * Write the bearer data array to the parcel, then return a new SmsMessage from the parcel.
+ * @param p the parcel containing the CDMA SMS headers
+ * @param bearerData the bearer data byte array to append to the parcel
+ * @return the new SmsMessage created from the parcel
+ */
+ private static SmsMessage createMessageFromParcel(Parcel p, byte[] bearerData) {
+ p.writeInt(bearerData.length);
+ for (byte b : bearerData) {
+ p.writeByte(b);
+ }
+ p.setDataPosition(0); // reset position for reading
+ SmsMessage message = SmsMessage.newFromParcel(p);
+ p.recycle();
+ return message;
+ }
+
+ /**
+ * Create a parcel for an incoming CMAS broadcast, then return a new SmsMessage created
+ * from the parcel.
+ * @param serviceCategory the CDMA service category
+ * @param messageId the 16-bit message identifier
+ * @param priority message priority
+ * @param language message language code
+ * @param body message body
+ * @param cmasCategory CMAS category (or -1 to skip adding CMAS type 1 elements record)
+ * @param responseType CMAS response type
+ * @param severity CMAS severity
+ * @param urgency CMAS urgency
+ * @param certainty CMAS certainty
+ * @return the newly created SmsMessage object
+ */
+ private static SmsMessage createCmasSmsMessage(int serviceCategory, int messageId, int priority,
+ int language, int encoding, String body, int cmasCategory, int responseType,
+ int severity, int urgency, int certainty) throws Exception {
+ BitwiseOutputStream cmasBos = new BitwiseOutputStream(10);
+ cmasBos.write(8, 0); // CMAE protocol version 0
+
+ if (body != null) {
+ cmasBos.write(8, 0); // Type 0 elements (alert text)
+ encodeBody(encoding, body, true, cmasBos);
+ }
+
+ if (cmasCategory != SmsCbCmasInfo.CMAS_CATEGORY_UNKNOWN) {
+ cmasBos.write(8, 1); // Type 1 elements
+ cmasBos.write(8, 4); // length: 4 bytes
+ cmasBos.write(8, (cmasCategory & 0xff));
+ cmasBos.write(8, (responseType & 0xff));
+ cmasBos.write(4, (severity & 0x0f));
+ cmasBos.write(4, (urgency & 0x0f));
+ cmasBos.write(4, (certainty & 0x0f));
+ cmasBos.write(4, 0); // pad to octet boundary
+ }
+
+ byte[] cmasUserData = cmasBos.toByteArray();
+
+ Parcel p = createBroadcastParcel(serviceCategory);
+ BitwiseOutputStream bos = createBearerDataStream(messageId, priority, language);
+
+ bos.write(8, SUBPARAM_USER_DATA);
+ bos.write(8, cmasUserData.length + 2); // add 2 bytes for msg_encoding and num_fields
+ bos.write(5, UserData.ENCODING_OCTET);
+ bos.write(8, cmasUserData.length);
+ bos.writeByteArray(cmasUserData.length * 8, cmasUserData);
+ bos.write(3, 0); // pad to byte boundary
+
+ return createMessageFromParcel(p, bos.toByteArray());
+ }
+
+ /**
+ * Create a parcel for an incoming CDMA cell broadcast, then return a new SmsMessage created
+ * from the parcel.
+ * @param serviceCategory the CDMA service category
+ * @param messageId the 16-bit message identifier
+ * @param priority message priority
+ * @param language message language code
+ * @param encoding user data encoding method
+ * @param body the message body
+ * @return the newly created SmsMessage object
+ */
+ private static SmsMessage createBroadcastSmsMessage(int serviceCategory, int messageId,
+ int priority, int language, int encoding, String body) throws Exception {
+ Parcel p = createBroadcastParcel(serviceCategory);
+ BitwiseOutputStream bos = createBearerDataStream(messageId, priority, language);
+
+ bos.write(8, SUBPARAM_USER_DATA);
+ encodeBody(encoding, body, false, bos);
+
+ return createMessageFromParcel(p, bos.toByteArray());
+ }
+
+ /**
+ * Append the message length, encoding, and body to the BearerData output stream.
+ * This is used for writing the User Data subparameter for non-CMAS broadcasts and for
+ * writing the alert text for CMAS broadcasts.
+ * @param encoding one of the CDMA UserData encoding values
+ * @param body the message body
+ * @param isCmasRecord true if this is a CMAS type 0 elements record; false for user data
+ * @param bos the BitwiseOutputStream to write to
+ * @throws Exception on any encoding error
+ */
+ private static void encodeBody(int encoding, String body, boolean isCmasRecord,
+ BitwiseOutputStream bos) throws Exception {
+ if (encoding == UserData.ENCODING_7BIT_ASCII || encoding == UserData.ENCODING_IA5) {
+ int charCount = body.length();
+ int recordBits = (charCount * 7) + 5; // add 5 bits for char set field
+ int recordOctets = (recordBits + 7) / 8; // round up to octet boundary
+ int padBits = (recordOctets * 8) - recordBits;
+
+ if (!isCmasRecord) {
+ recordOctets++; // add 8 bits for num_fields
+ }
+
+ bos.write(8, recordOctets);
+ bos.write(5, (encoding & 0x1f));
+
+ if (!isCmasRecord) {
+ bos.write(8, charCount);
+ }
+
+ for (int i = 0; i < charCount; i++) {
+ bos.write(7, body.charAt(i));
+ }
+
+ bos.write(padBits, 0); // pad to octet boundary
+ } else if (encoding == UserData.ENCODING_GSM_7BIT_ALPHABET
+ || encoding == UserData.ENCODING_GSM_DCS) {
+ // convert to 7-bit packed encoding with septet count in index 0 of byte array
+ byte[] encodedBody = GsmAlphabet.stringToGsm7BitPacked(body);
+
+ int charCount = encodedBody[0]; // septet count
+ int recordBits = (charCount * 7) + 5; // add 5 bits for char set field
+ int recordOctets = (recordBits + 7) / 8; // round up to octet boundary
+ int padBits = (recordOctets * 8) - recordBits;
+
+ if (!isCmasRecord) {
+ recordOctets++; // add 8 bits for num_fields
+ if (encoding == UserData.ENCODING_GSM_DCS) {
+ recordOctets++; // add 8 bits for DCS (message type)
+ }
+ }
+
+ bos.write(8, recordOctets);
+ bos.write(5, (encoding & 0x1f));
+
+ if (!isCmasRecord && encoding == UserData.ENCODING_GSM_DCS) {
+ bos.write(8, 0); // GSM DCS: 7 bit default alphabet, no msg class
+ }
+
+ if (!isCmasRecord) {
+ bos.write(8, charCount);
+ }
+ byte[] bodySeptets = Arrays.copyOfRange(encodedBody, 1, encodedBody.length);
+ bos.writeByteArray(charCount * 7, bodySeptets);
+ bos.write(padBits, 0); // pad to octet boundary
+ } else if (encoding == UserData.ENCODING_IS91_EXTENDED_PROTOCOL) {
+ // 6 bit packed encoding with 0x20 offset (ASCII 0x20 - 0x60)
+ int charCount = body.length();
+ int recordBits = (charCount * 6) + 21; // add 21 bits for header fields
+ int recordOctets = (recordBits + 7) / 8; // round up to octet boundary
+ int padBits = (recordOctets * 8) - recordBits;
+
+ bos.write(8, recordOctets);
+
+ bos.write(5, (encoding & 0x1f));
+ bos.write(8, UserData.IS91_MSG_TYPE_SHORT_MESSAGE);
+ bos.write(8, charCount);
+
+ for (int i = 0; i < charCount; i++) {
+ bos.write(6, ((int) body.charAt(i) - 0x20));
+ }
+
+ bos.write(padBits, 0); // pad to octet boundary
+ } else {
+ byte[] encodedBody;
+ switch (encoding) {
+ case UserData.ENCODING_UNICODE_16:
+ encodedBody = body.getBytes("UTF-16BE");
+ break;
+
+ case UserData.ENCODING_SHIFT_JIS:
+ encodedBody = body.getBytes("Shift_JIS");
+ break;
+
+ case UserData.ENCODING_KOREAN:
+ encodedBody = body.getBytes("KSC5601");
+ break;
+
+ case UserData.ENCODING_LATIN_HEBREW:
+ encodedBody = body.getBytes("ISO-8859-8");
+ break;
+
+ case UserData.ENCODING_LATIN:
+ default:
+ encodedBody = body.getBytes("ISO-8859-1");
+ break;
+ }
+ int charCount = body.length(); // use actual char count for num fields
+ int recordOctets = encodedBody.length + 1; // add 1 byte for encoding and pad bits
+ if (!isCmasRecord) {
+ recordOctets++; // add 8 bits for num_fields
+ }
+ bos.write(8, recordOctets);
+ bos.write(5, (encoding & 0x1f));
+ if (!isCmasRecord) {
+ bos.write(8, charCount);
+ }
+ bos.writeByteArray(encodedBody.length * 8, encodedBody);
+ bos.write(3, 0); // pad to octet boundary
+ }
+ }
+
+ private static final String TEST_TEXT = "This is a test CDMA cell broadcast message..."
+ + "678901234567890123456789012345678901234567890";
+
+ private static final String PRES_ALERT =
+ "THE PRESIDENT HAS ISSUED AN EMERGENCY ALERT. CHECK LOCAL MEDIA FOR MORE DETAILS";
+
+ private static final String EXTREME_ALERT = "FLASH FLOOD WARNING FOR SOUTH COCONINO COUNTY"
+ + " - NORTH CENTRAL ARIZONA UNTIL 415 PM MST";
+
+ private static final String SEVERE_ALERT = "SEVERE WEATHER WARNING FOR SOMERSET COUNTY"
+ + " - NEW JERSEY UNTIL 415 PM MST";
+
+ private static final String AMBER_ALERT =
+ "AMBER ALERT:Mountain View,CA VEH'07 Blue Honda Civic CA LIC 5ABC123";
+
+ private static final String MONTHLY_TEST_ALERT = "This is a test of the emergency alert system."
+ + " This is only a test. 89012345678901234567890";
+
+ private static final String IS91_TEXT = "IS91 SHORT MSG"; // max length 14 chars
+
+ /**
+ * Verify that the SmsCbMessage has the correct values for CDMA.
+ * @param cbMessage the message to test
+ */
+ private static void verifyCbValues(SmsCbMessage cbMessage) {
+ assertEquals(SmsCbMessage.MESSAGE_FORMAT_3GPP2, cbMessage.getMessageFormat());
+ assertEquals(SmsCbMessage.GEOGRAPHICAL_SCOPE_PLMN_WIDE, cbMessage.getGeographicalScope());
+ assertEquals(false, cbMessage.isEtwsMessage()); // ETWS on CDMA not currently supported
+ }
+
+ private static void doTestNonEmergencyBroadcast(int encoding) throws Exception {
+ SmsMessage msg = createBroadcastSmsMessage(123, 456, BearerData.PRIORITY_NORMAL,
+ BearerData.LANGUAGE_ENGLISH, encoding, TEST_TEXT);
+
+ SmsCbMessage cbMessage = msg.parseBroadcastSms();
+ verifyCbValues(cbMessage);
+ assertEquals(123, cbMessage.getServiceCategory());
+ assertEquals(456, cbMessage.getSerialNumber());
+ assertEquals(SmsCbMessage.MESSAGE_PRIORITY_NORMAL, cbMessage.getMessagePriority());
+ assertEquals("en", cbMessage.getLanguageCode());
+ assertEquals(TEST_TEXT, cbMessage.getMessageBody());
+ assertEquals(false, cbMessage.isEmergencyMessage());
+ assertEquals(false, cbMessage.isCmasMessage());
+ }
+
+ public void testNonEmergencyBroadcast7bitAscii() throws Exception {
+ doTestNonEmergencyBroadcast(UserData.ENCODING_7BIT_ASCII);
+ }
+
+ public void testNonEmergencyBroadcast7bitGsm() throws Exception {
+ doTestNonEmergencyBroadcast(UserData.ENCODING_GSM_7BIT_ALPHABET);
+ }
+
+ public void testNonEmergencyBroadcast16bitUnicode() throws Exception {
+ doTestNonEmergencyBroadcast(UserData.ENCODING_UNICODE_16);
+ }
+
+ public void testNonEmergencyBroadcastIs91Extended() throws Exception {
+ // IS-91 doesn't support language or priority subparameters, max 14 chars text
+ SmsMessage msg = createBroadcastSmsMessage(987, 654, -1, -1,
+ UserData.ENCODING_IS91_EXTENDED_PROTOCOL, IS91_TEXT);
+
+ SmsCbMessage cbMessage = msg.parseBroadcastSms();
+ verifyCbValues(cbMessage);
+ assertEquals(987, cbMessage.getServiceCategory());
+ assertEquals(654, cbMessage.getSerialNumber());
+ assertEquals(SmsCbMessage.MESSAGE_PRIORITY_NORMAL, cbMessage.getMessagePriority());
+ assertEquals(null, cbMessage.getLanguageCode());
+ assertEquals(IS91_TEXT, cbMessage.getMessageBody());
+ assertEquals(false, cbMessage.isEmergencyMessage());
+ assertEquals(false, cbMessage.isCmasMessage());
+ }
+
+ private static void doTestCmasBroadcast(int serviceCategory, int messageClass, String body)
+ throws Exception {
+ SmsMessage msg = createCmasSmsMessage(
+ serviceCategory, 1234, BearerData.PRIORITY_EMERGENCY, BearerData.LANGUAGE_ENGLISH,
+ UserData.ENCODING_7BIT_ASCII, body, -1, -1, -1, -1, -1);
+
+ SmsCbMessage cbMessage = msg.parseBroadcastSms();
+ verifyCbValues(cbMessage);
+ assertEquals(serviceCategory, cbMessage.getServiceCategory());
+ assertEquals(1234, cbMessage.getSerialNumber());
+ assertEquals(SmsCbMessage.MESSAGE_PRIORITY_EMERGENCY, cbMessage.getMessagePriority());
+ assertEquals("en", cbMessage.getLanguageCode());
+ assertEquals(body, cbMessage.getMessageBody());
+ assertEquals(true, cbMessage.isEmergencyMessage());
+ assertEquals(true, cbMessage.isCmasMessage());
+ SmsCbCmasInfo cmasInfo = cbMessage.getCmasWarningInfo();
+ assertEquals(messageClass, cmasInfo.getMessageClass());
+ assertEquals(SmsCbCmasInfo.CMAS_CATEGORY_UNKNOWN, cmasInfo.getCategory());
+ assertEquals(SmsCbCmasInfo.CMAS_RESPONSE_TYPE_UNKNOWN, cmasInfo.getResponseType());
+ assertEquals(SmsCbCmasInfo.CMAS_SEVERITY_UNKNOWN, cmasInfo.getSeverity());
+ assertEquals(SmsCbCmasInfo.CMAS_URGENCY_UNKNOWN, cmasInfo.getUrgency());
+ assertEquals(SmsCbCmasInfo.CMAS_CERTAINTY_UNKNOWN, cmasInfo.getCertainty());
+ }
+
+ public void testCmasPresidentialAlert() throws Exception {
+ doTestCmasBroadcast(SmsEnvelope.SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT,
+ SmsCbCmasInfo.CMAS_CLASS_PRESIDENTIAL_LEVEL_ALERT, PRES_ALERT);
+ }
+
+ public void testCmasExtremeAlert() throws Exception {
+ doTestCmasBroadcast(SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT,
+ SmsCbCmasInfo.CMAS_CLASS_EXTREME_THREAT, EXTREME_ALERT);
+ }
+
+ public void testCmasSevereAlert() throws Exception {
+ doTestCmasBroadcast(SmsEnvelope.SERVICE_CATEGORY_CMAS_SEVERE_THREAT,
+ SmsCbCmasInfo.CMAS_CLASS_SEVERE_THREAT, SEVERE_ALERT);
+ }
+
+ public void testCmasAmberAlert() throws Exception {
+ doTestCmasBroadcast(SmsEnvelope.SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY,
+ SmsCbCmasInfo.CMAS_CLASS_CHILD_ABDUCTION_EMERGENCY, AMBER_ALERT);
+ }
+
+ public void testCmasTestMessage() throws Exception {
+ doTestCmasBroadcast(SmsEnvelope.SERVICE_CATEGORY_CMAS_TEST_MESSAGE,
+ SmsCbCmasInfo.CMAS_CLASS_REQUIRED_MONTHLY_TEST, MONTHLY_TEST_ALERT);
+ }
+
+ public void testCmasExtremeAlertType1Elements() throws Exception {
+ SmsMessage msg = createCmasSmsMessage(SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT,
+ 5678, BearerData.PRIORITY_EMERGENCY, BearerData.LANGUAGE_ENGLISH,
+ UserData.ENCODING_7BIT_ASCII, EXTREME_ALERT, SmsCbCmasInfo.CMAS_CATEGORY_ENV,
+ SmsCbCmasInfo.CMAS_RESPONSE_TYPE_MONITOR, SmsCbCmasInfo.CMAS_SEVERITY_SEVERE,
+ SmsCbCmasInfo.CMAS_URGENCY_EXPECTED, SmsCbCmasInfo.CMAS_CERTAINTY_LIKELY);
+
+ SmsCbMessage cbMessage = msg.parseBroadcastSms();
+ verifyCbValues(cbMessage);
+ assertEquals(SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT,
+ cbMessage.getServiceCategory());
+ assertEquals(5678, cbMessage.getSerialNumber());
+ assertEquals(SmsCbMessage.MESSAGE_PRIORITY_EMERGENCY, cbMessage.getMessagePriority());
+ assertEquals("en", cbMessage.getLanguageCode());
+ assertEquals(EXTREME_ALERT, cbMessage.getMessageBody());
+ assertEquals(true, cbMessage.isEmergencyMessage());
+ assertEquals(true, cbMessage.isCmasMessage());
+ SmsCbCmasInfo cmasInfo = cbMessage.getCmasWarningInfo();
+ assertEquals(SmsCbCmasInfo.CMAS_CLASS_EXTREME_THREAT, cmasInfo.getMessageClass());
+ assertEquals(SmsCbCmasInfo.CMAS_CATEGORY_ENV, cmasInfo.getCategory());
+ assertEquals(SmsCbCmasInfo.CMAS_RESPONSE_TYPE_MONITOR, cmasInfo.getResponseType());
+ assertEquals(SmsCbCmasInfo.CMAS_SEVERITY_SEVERE, cmasInfo.getSeverity());
+ assertEquals(SmsCbCmasInfo.CMAS_URGENCY_EXPECTED, cmasInfo.getUrgency());
+ assertEquals(SmsCbCmasInfo.CMAS_CERTAINTY_LIKELY, cmasInfo.getCertainty());
+ }
+
+ // VZW requirement is to discard message with unsupported charset. Verify that we return null
+ // for this unsupported character set.
+ public void testCmasUnsupportedCharSet() throws Exception {
+ SmsMessage msg = createCmasSmsMessage(SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT,
+ 12345, BearerData.PRIORITY_EMERGENCY, BearerData.LANGUAGE_ENGLISH,
+ UserData.ENCODING_GSM_DCS, EXTREME_ALERT, -1, -1, -1, -1, -1);
+
+ SmsCbMessage cbMessage = msg.parseBroadcastSms();
+ assertNull("expected null for unsupported charset", cbMessage);
+ }
+
+ // VZW requirement is to discard message with unsupported charset. Verify that we return null
+ // for this unsupported character set.
+ public void testCmasUnsupportedCharSet2() throws Exception {
+ SmsMessage msg = createCmasSmsMessage(SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT,
+ 67890, BearerData.PRIORITY_EMERGENCY, BearerData.LANGUAGE_ENGLISH,
+ UserData.ENCODING_KOREAN, EXTREME_ALERT, -1, -1, -1, -1, -1);
+
+ SmsCbMessage cbMessage = msg.parseBroadcastSms();
+ assertNull("expected null for unsupported charset", cbMessage);
+ }
+
+ // VZW requirement is to discard message without record type 0. The framework will decode it
+ // and the app will discard it.
+ public void testCmasNoRecordType0() throws Exception {
+ SmsMessage msg = createCmasSmsMessage(
+ SmsEnvelope.SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT, 1234,
+ BearerData.PRIORITY_EMERGENCY, BearerData.LANGUAGE_ENGLISH,
+ UserData.ENCODING_7BIT_ASCII, null, -1, -1, -1, -1, -1);
+
+ SmsCbMessage cbMessage = msg.parseBroadcastSms();
+ verifyCbValues(cbMessage);
+ assertEquals(SmsEnvelope.SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT,
+ cbMessage.getServiceCategory());
+ assertEquals(1234, cbMessage.getSerialNumber());
+ assertEquals(SmsCbMessage.MESSAGE_PRIORITY_EMERGENCY, cbMessage.getMessagePriority());
+ assertEquals("en", cbMessage.getLanguageCode());
+ assertEquals(null, cbMessage.getMessageBody());
+ assertEquals(true, cbMessage.isEmergencyMessage());
+ assertEquals(true, cbMessage.isCmasMessage());
+ SmsCbCmasInfo cmasInfo = cbMessage.getCmasWarningInfo();
+ assertEquals(SmsCbCmasInfo.CMAS_CLASS_PRESIDENTIAL_LEVEL_ALERT, cmasInfo.getMessageClass());
+ assertEquals(SmsCbCmasInfo.CMAS_CATEGORY_UNKNOWN, cmasInfo.getCategory());
+ assertEquals(SmsCbCmasInfo.CMAS_RESPONSE_TYPE_UNKNOWN, cmasInfo.getResponseType());
+ assertEquals(SmsCbCmasInfo.CMAS_SEVERITY_UNKNOWN, cmasInfo.getSeverity());
+ assertEquals(SmsCbCmasInfo.CMAS_URGENCY_UNKNOWN, cmasInfo.getUrgency());
+ assertEquals(SmsCbCmasInfo.CMAS_CERTAINTY_UNKNOWN, cmasInfo.getCertainty());
+ }
+
+ // Make sure we don't throw an exception if we feed completely random data to BearerStream.
+ public void testRandomBearerStreamData() {
+ Random r = new Random(54321);
+ for (int run = 0; run < 1000; run++) {
+ int len = r.nextInt(140);
+ byte[] data = new byte[len];
+ for (int i = 0; i < len; i++) {
+ data[i] = (byte) r.nextInt(256);
+ }
+ // Log.d("CdmaSmsCbTest", "trying random bearer data run " + run + " length " + len);
+ try {
+ int category = 0x0ff0 + r.nextInt(32); // half CMAS, half non-CMAS
+ Parcel p = createBroadcastParcel(category);
+ SmsMessage msg = createMessageFromParcel(p, data);
+ SmsCbMessage cbMessage = msg.parseBroadcastSms();
+ // with random input, cbMessage will almost always be null (log when it isn't)
+ if (cbMessage != null) {
+ Log.d("CdmaSmsCbTest", "success: " + cbMessage);
+ }
+ } catch (Exception e) {
+ Log.d("CdmaSmsCbTest", "exception thrown", e);
+ fail("Exception in decoder at run " + run + " length " + len + ": " + e);
+ }
+ }
+ }
+
+ // Make sure we don't throw an exception if we put random data in the UserData subparam.
+ public void testRandomUserData() {
+ Random r = new Random(94040);
+ for (int run = 0; run < 1000; run++) {
+ int category = 0x0ff0 + r.nextInt(32); // half CMAS, half non-CMAS
+ Parcel p = createBroadcastParcel(category);
+ int len = r.nextInt(140);
+ // Log.d("CdmaSmsCbTest", "trying random user data run " + run + " length " + len);
+
+ try {
+ BitwiseOutputStream bos = createBearerDataStream(r.nextInt(65536), r.nextInt(4),
+ r.nextInt(256));
+
+ bos.write(8, SUBPARAM_USER_DATA);
+ bos.write(8, len);
+
+ for (int i = 0; i < len; i++) {
+ bos.write(8, r.nextInt(256));
+ }
+
+ SmsMessage msg = createMessageFromParcel(p, bos.toByteArray());
+ SmsCbMessage cbMessage = msg.parseBroadcastSms();
+ } catch (Exception e) {
+ Log.d("CdmaSmsCbTest", "exception thrown", e);
+ fail("Exception in decoder at run " + run + " length " + len + ": " + e);
+ }
+ }
+ }
+
+ /**
+ * Initialize a Parcel for incoming Service Category Program Data teleservice. The caller will
+ * write the bearer data and then convert it to an SmsMessage.
+ * @return the initialized Parcel
+ */
+ private static Parcel createServiceCategoryProgramDataParcel() {
+ Parcel p = Parcel.obtain();
+
+ p.writeInt(SmsEnvelope.TELESERVICE_SCPT);
+ p.writeByte((byte) 0); // non-zero for MESSAGE_TYPE_BROADCAST
+ p.writeInt(0);
+
+ // dummy address (RIL may generate a different dummy address for broadcasts)
+ p.writeInt(CdmaSmsAddress.DIGIT_MODE_4BIT_DTMF); // sAddress.digit_mode
+ p.writeInt(CdmaSmsAddress.NUMBER_MODE_NOT_DATA_NETWORK); // sAddress.number_mode
+ p.writeInt(CdmaSmsAddress.TON_UNKNOWN); // sAddress.number_type
+ p.writeInt(CdmaSmsAddress.NUMBERING_PLAN_ISDN_TELEPHONY); // sAddress.number_plan
+ p.writeByte((byte) 0); // sAddress.number_of_digits
+ p.writeInt((byte) 0); // sSubAddress.subaddressType
+ p.writeByte((byte) 0); // sSubAddress.odd
+ p.writeByte((byte) 0); // sSubAddress.number_of_digits
+ return p;
+ }
+
+ private static final String CAT_EXTREME_THREAT = "Extreme Threat to Life and Property";
+ private static final String CAT_SEVERE_THREAT = "Severe Threat to Life and Property";
+ private static final String CAT_AMBER_ALERTS = "AMBER Alerts";
+
+ public void testServiceCategoryProgramDataAddCategory() throws Exception {
+ Parcel p = createServiceCategoryProgramDataParcel();
+ BitwiseOutputStream bos = createBearerDataStream(123, -1, -1);
+
+ int categoryNameLength = CAT_EXTREME_THREAT.length();
+ int subparamLengthBits = (53 + (categoryNameLength * 7));
+ int subparamLengthBytes = (subparamLengthBits + 7) / 8;
+ int subparamPadBits = (subparamLengthBytes * 8) - subparamLengthBits;
+
+ bos.write(8, SUBPARAM_SERVICE_CATEGORY_PROGRAM_DATA);
+ bos.write(8, subparamLengthBytes);
+ bos.write(5, UserData.ENCODING_7BIT_ASCII);
+
+ bos.write(4, CdmaSmsCbProgramData.OPERATION_ADD_CATEGORY);
+ bos.write(8, (SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT >>> 8));
+ bos.write(8, (SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT & 0xff));
+ bos.write(8, BearerData.LANGUAGE_ENGLISH);
+ bos.write(8, 100); // max messages
+ bos.write(4, CdmaSmsCbProgramData.ALERT_OPTION_DEFAULT_ALERT);
+
+ bos.write(8, categoryNameLength);
+ for (int i = 0; i < categoryNameLength; i++) {
+ bos.write(7, CAT_EXTREME_THREAT.charAt(i));
+ }
+ bos.write(subparamPadBits, 0);
+
+ SmsMessage msg = createMessageFromParcel(p, bos.toByteArray());
+ assertNotNull(msg);
+ msg.parseSms();
+ List<CdmaSmsCbProgramData> programDataList = msg.getSmsCbProgramData();
+ assertNotNull(programDataList);
+ assertEquals(1, programDataList.size());
+ CdmaSmsCbProgramData programData = programDataList.get(0);
+ assertEquals(CdmaSmsCbProgramData.OPERATION_ADD_CATEGORY, programData.getOperation());
+ assertEquals(SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT, programData.getCategory());
+ assertEquals(CAT_EXTREME_THREAT, programData.getCategoryName());
+ assertEquals("en", programData.getLanguageCode());
+ assertEquals(100, programData.getMaxMessages());
+ assertEquals(CdmaSmsCbProgramData.ALERT_OPTION_DEFAULT_ALERT, programData.getAlertOption());
+ }
+
+ public void testServiceCategoryProgramDataDeleteTwoCategories() throws Exception {
+ Parcel p = createServiceCategoryProgramDataParcel();
+ BitwiseOutputStream bos = createBearerDataStream(456, -1, -1);
+
+ int category1NameLength = CAT_SEVERE_THREAT.length();
+ int category2NameLength = CAT_AMBER_ALERTS.length();
+
+ int subparamLengthBits = (101 + (category1NameLength * 7) + (category2NameLength * 7));
+ int subparamLengthBytes = (subparamLengthBits + 7) / 8;
+ int subparamPadBits = (subparamLengthBytes * 8) - subparamLengthBits;
+
+ bos.write(8, SUBPARAM_SERVICE_CATEGORY_PROGRAM_DATA);
+ bos.write(8, subparamLengthBytes);
+ bos.write(5, UserData.ENCODING_7BIT_ASCII);
+
+ bos.write(4, CdmaSmsCbProgramData.OPERATION_DELETE_CATEGORY);
+ bos.write(8, (SmsEnvelope.SERVICE_CATEGORY_CMAS_SEVERE_THREAT >>> 8));
+ bos.write(8, (SmsEnvelope.SERVICE_CATEGORY_CMAS_SEVERE_THREAT & 0xff));
+ bos.write(8, BearerData.LANGUAGE_ENGLISH);
+ bos.write(8, 0); // max messages
+ bos.write(4, CdmaSmsCbProgramData.ALERT_OPTION_NO_ALERT);
+
+ bos.write(8, category1NameLength);
+ for (int i = 0; i < category1NameLength; i++) {
+ bos.write(7, CAT_SEVERE_THREAT.charAt(i));
+ }
+
+ bos.write(4, CdmaSmsCbProgramData.OPERATION_DELETE_CATEGORY);
+ bos.write(8, (SmsEnvelope.SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY >>> 8));
+ bos.write(8, (SmsEnvelope.SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY & 0xff));
+ bos.write(8, BearerData.LANGUAGE_ENGLISH);
+ bos.write(8, 0); // max messages
+ bos.write(4, CdmaSmsCbProgramData.ALERT_OPTION_NO_ALERT);
+
+ bos.write(8, category2NameLength);
+ for (int i = 0; i < category2NameLength; i++) {
+ bos.write(7, CAT_AMBER_ALERTS.charAt(i));
+ }
+
+ bos.write(subparamPadBits, 0);
+
+ SmsMessage msg = createMessageFromParcel(p, bos.toByteArray());
+ assertNotNull(msg);
+ msg.parseSms();
+ List<CdmaSmsCbProgramData> programDataList = msg.getSmsCbProgramData();
+ assertNotNull(programDataList);
+ assertEquals(2, programDataList.size());
+
+ CdmaSmsCbProgramData programData = programDataList.get(0);
+ assertEquals(CdmaSmsCbProgramData.OPERATION_DELETE_CATEGORY, programData.getOperation());
+ assertEquals(SmsEnvelope.SERVICE_CATEGORY_CMAS_SEVERE_THREAT, programData.getCategory());
+ assertEquals(CAT_SEVERE_THREAT, programData.getCategoryName());
+ assertEquals("en", programData.getLanguageCode());
+ assertEquals(0, programData.getMaxMessages());
+ assertEquals(CdmaSmsCbProgramData.ALERT_OPTION_NO_ALERT, programData.getAlertOption());
+
+ programData = programDataList.get(1);
+ assertEquals(CdmaSmsCbProgramData.OPERATION_DELETE_CATEGORY, programData.getOperation());
+ assertEquals(SmsEnvelope.SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY,
+ programData.getCategory());
+ assertEquals(CAT_AMBER_ALERTS, programData.getCategoryName());
+ assertEquals("en", programData.getLanguageCode());
+ assertEquals(0, programData.getMaxMessages());
+ assertEquals(CdmaSmsCbProgramData.ALERT_OPTION_NO_ALERT, programData.getAlertOption());
+ }
+}
diff --git a/telephony/tests/telephonytests/src/com/android/internal/telephony/GsmSmsCbTest.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/gsm/GsmSmsCbTest.java
similarity index 89%
rename from telephony/tests/telephonytests/src/com/android/internal/telephony/GsmSmsCbTest.java
rename to telephony/tests/telephonytests/src/com/android/internal/telephony/gsm/GsmSmsCbTest.java
index 417aac4..82c6944 100644
--- a/telephony/tests/telephonytests/src/com/android/internal/telephony/GsmSmsCbTest.java
+++ b/telephony/tests/telephonytests/src/com/android/internal/telephony/gsm/GsmSmsCbTest.java
@@ -14,34 +14,54 @@
* limitations under the License.
*/
-package com.android.internal.telephony;
+package com.android.internal.telephony.gsm;
+import android.telephony.SmsCbEtwsInfo;
+import android.telephony.SmsCbLocation;
import android.telephony.SmsCbMessage;
import android.test.AndroidTestCase;
import android.util.Log;
+import com.android.internal.telephony.IccUtils;
+
+import java.util.Random;
+
/**
* Test cases for basic SmsCbMessage operations
*/
public class GsmSmsCbTest extends AndroidTestCase {
- private void doTestGeographicalScopeValue(byte[] pdu, byte b, int expectedGs) {
+ private static final String TAG = "GsmSmsCbTest";
+
+ private static final SmsCbLocation sTestLocation = new SmsCbLocation("94040", 1234, 5678);
+
+ private static SmsCbMessage createFromPdu(byte[] pdu) {
+ try {
+ SmsCbHeader header = new SmsCbHeader(pdu);
+ byte[][] pdus = new byte[1][];
+ pdus[0] = pdu;
+ return GsmSmsCbMessage.createSmsCbMessage(header, sTestLocation, pdus);
+ } catch (IllegalArgumentException e) {
+ return null;
+ }
+ }
+
+ private static void doTestGeographicalScopeValue(byte[] pdu, byte b, int expectedGs) {
pdu[0] = b;
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
assertEquals("Unexpected geographical scope decoded", expectedGs, msg
.getGeographicalScope());
}
public void testCreateNullPdu() {
- SmsCbMessage msg = SmsCbMessage.createFromPdu(null);
-
+ SmsCbMessage msg = createFromPdu(null);
assertNull("createFromPdu(byte[] with null pdu should return null", msg);
}
public void testCreateTooShortPdu() {
byte[] pdu = new byte[4];
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
assertNull("createFromPdu(byte[] with too short pdu should return null", msg);
}
@@ -94,7 +114,7 @@
(byte)0x34
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
assertEquals("Unexpected geographical scope decoded",
SmsCbMessage.GEOGRAPHICAL_SCOPE_CELL_WIDE, msg.getGeographicalScope());
@@ -116,7 +136,7 @@
(byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D,
(byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
assertEquals("Unexpected 7-bit string decoded",
"A GSM default alphabet message with carriage return padding",
@@ -146,7 +166,7 @@
(byte)0x34
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
assertEquals("Unexpected 7-bit string decoded",
"A GSM default alphabet message with carriage return padding",
@@ -193,7 +213,7 @@
(byte)0x0A
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
assertEquals("Unexpected multipage 7-bit string decoded",
"First page+Second page",
@@ -216,7 +236,7 @@
(byte)0x90, (byte)0xFB, (byte)0x0D, (byte)0x82, (byte)0x87, (byte)0xC9, (byte)0xE4,
(byte)0xB4, (byte)0xFB, (byte)0x1C, (byte)0x02
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
assertEquals(
"Unexpected 7-bit string decoded",
@@ -248,7 +268,7 @@
(byte)0x52
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
assertEquals(
"Unexpected 7-bit string decoded",
@@ -273,7 +293,7 @@
(byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D,
(byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
assertEquals("Unexpected 7-bit string decoded",
"A GSM default alphabet message with carriage return padding",
@@ -298,7 +318,7 @@
(byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D,
(byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
assertEquals("Unexpected 7-bit string decoded",
"A GSM default alphabet message with carriage return padding",
@@ -330,7 +350,7 @@
(byte)0x37
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
assertEquals("Unexpected 7-bit string decoded",
"A GSM default alphabet message with carriage return padding",
@@ -355,7 +375,7 @@
(byte)0x42, (byte)0x43, (byte)0x44, (byte)0x45, (byte)0x46, (byte)0x47, (byte)0x41,
(byte)0x42, (byte)0x43, (byte)0x44, (byte)0x45
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
assertEquals("8-bit message body should be empty", "", msg.getMessageBody());
}
@@ -376,7 +396,7 @@
(byte)0x63, (byte)0x00, (byte)0x74, (byte)0x00, (byte)0x65, (byte)0x00, (byte)0x72,
(byte)0x00, (byte)0x0D, (byte)0x00, (byte)0x0D
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
assertEquals("Unexpected 7-bit string decoded",
"A UCS2 message containing a \u0434 character", msg.getMessageBody());
@@ -405,7 +425,7 @@
(byte)0x4E
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
assertEquals("Unexpected 7-bit string decoded",
"A UCS2 message containing a \u0434 character", msg.getMessageBody());
@@ -451,7 +471,7 @@
(byte)0x06
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
assertEquals("Unexpected multipage UCS2 string decoded",
"AAABBB", msg.getMessageBody());
@@ -473,7 +493,7 @@
(byte)0x61, (byte)0x00, (byte)0x63, (byte)0x00, (byte)0x74, (byte)0x00, (byte)0x65,
(byte)0x00, (byte)0x72, (byte)0x00, (byte)0x0D
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
assertEquals("Unexpected 7-bit string decoded",
"A UCS2 message containing a \u0434 character", msg.getMessageBody());
@@ -504,7 +524,7 @@
(byte)0x50
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
assertEquals("Unexpected 7-bit string decoded",
"A UCS2 message containing a \u0434 character", msg.getMessageBody());
@@ -529,9 +549,9 @@
(byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
- assertEquals("Unexpected message identifier decoded", 12345, msg.getMessageIdentifier());
+ assertEquals("Unexpected message identifier decoded", 12345, msg.getServiceCategory());
}
public void testGetMessageIdentifierUmts() {
@@ -558,9 +578,9 @@
(byte)0x34
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
- assertEquals("Unexpected message identifier decoded", 12345, msg.getMessageIdentifier());
+ assertEquals("Unexpected message identifier decoded", 12345, msg.getServiceCategory());
}
public void testGetMessageCode() {
@@ -580,9 +600,10 @@
(byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
+ int messageCode = (msg.getSerialNumber() & 0x3ff0) >> 4;
- assertEquals("Unexpected message code decoded", 682, msg.getMessageCode());
+ assertEquals("Unexpected message code decoded", 682, messageCode);
}
public void testGetMessageCodeUmts() {
@@ -609,9 +630,10 @@
(byte)0x34
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
+ int messageCode = (msg.getSerialNumber() & 0x3ff0) >> 4;
- assertEquals("Unexpected message code decoded", 682, msg.getMessageCode());
+ assertEquals("Unexpected message code decoded", 682, messageCode);
}
public void testGetUpdateNumber() {
@@ -631,9 +653,10 @@
(byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
+ int updateNumber = msg.getSerialNumber() & 0x000f;
- assertEquals("Unexpected update number decoded", 5, msg.getUpdateNumber());
+ assertEquals("Unexpected update number decoded", 5, updateNumber);
}
public void testGetUpdateNumberUmts() {
@@ -660,9 +683,10 @@
(byte)0x34
};
- SmsCbMessage msg = SmsCbMessage.createFromPdu(pdu);
+ SmsCbMessage msg = createFromPdu(pdu);
+ int updateNumber = msg.getSerialNumber() & 0x000f;
- assertEquals("Unexpected update number decoded", 5, msg.getUpdateNumber());
+ assertEquals("Unexpected update number decoded", 5, updateNumber);
}
/* ETWS Test message including header */
@@ -684,29 +708,51 @@
// FIXME: add example of ETWS primary notification PDU
public void testEtwsMessageNormal() {
- SmsCbMessage msg = SmsCbMessage.createFromPdu(etwsMessageNormal);
- Log.d("GsmSmsCbTest", msg.toString());
+ SmsCbMessage msg = createFromPdu(etwsMessageNormal);
+ Log.d(TAG, msg.toString());
assertEquals("GS mismatch", 0, msg.getGeographicalScope());
- assertEquals("message code mismatch", 0, msg.getMessageCode());
- assertEquals("update number mismatch", 0, msg.getUpdateNumber());
- assertEquals("message ID mismatch", 0x1100, msg.getMessageIdentifier());
+ assertEquals("serial number mismatch", 0, msg.getSerialNumber());
+ assertEquals("message ID mismatch", 0x1100, msg.getServiceCategory());
+ assertEquals("warning type mismatch", SmsCbEtwsInfo.ETWS_WARNING_TYPE_EARTHQUAKE,
+ msg.getEtwsWarningInfo().getWarningType());
}
public void testEtwsMessageCancel() {
- SmsCbMessage msg = SmsCbMessage.createFromPdu(etwsMessageCancel);
- Log.d("GsmSmsCbTest", msg.toString());
+ SmsCbMessage msg = createFromPdu(etwsMessageCancel);
+ Log.d(TAG, msg.toString());
assertEquals("GS mismatch", 0, msg.getGeographicalScope());
- assertEquals("message code mismatch", 0, msg.getMessageCode());
- assertEquals("update number mismatch", 0, msg.getUpdateNumber());
- assertEquals("message ID mismatch", 0x1100, msg.getMessageIdentifier());
+ assertEquals("serial number mismatch", 0, msg.getSerialNumber());
+ assertEquals("message ID mismatch", 0x1100, msg.getServiceCategory());
+ assertEquals("warning type mismatch", SmsCbEtwsInfo.ETWS_WARNING_TYPE_EARTHQUAKE,
+ msg.getEtwsWarningInfo().getWarningType());
}
public void testEtwsMessageTest() {
- SmsCbMessage msg = SmsCbMessage.createFromPdu(etwsMessageTest);
- Log.d("GsmSmsCbTest", msg.toString());
+ SmsCbMessage msg = createFromPdu(etwsMessageTest);
+ Log.d(TAG, msg.toString());
assertEquals("GS mismatch", 0, msg.getGeographicalScope());
- assertEquals("message code mismatch", 0, msg.getMessageCode());
- assertEquals("update number mismatch", 0, msg.getUpdateNumber());
- assertEquals("message ID mismatch", 0x1103, msg.getMessageIdentifier());
+ assertEquals("serial number mismatch", 0, msg.getSerialNumber());
+ assertEquals("message ID mismatch", 0x1103, msg.getServiceCategory());
+ assertEquals("warning type mismatch", SmsCbEtwsInfo.ETWS_WARNING_TYPE_TEST_MESSAGE,
+ msg.getEtwsWarningInfo().getWarningType());
+ }
+
+ // Make sure we don't throw an exception if we feed random data to the PDU parser.
+ public void testRandomPdus() {
+ Random r = new Random(94040);
+ for (int run = 0; run < 10000; run++) {
+ int len = r.nextInt(140);
+ byte[] data = new byte[len];
+ for (int i = 0; i < len; i++) {
+ data[i] = (byte) r.nextInt(256);
+ }
+ try {
+ // this should return a SmsCbMessage object or null for invalid data
+ SmsCbMessage msg = createFromPdu(data);
+ } catch (Exception e) {
+ Log.d(TAG, "exception thrown", e);
+ fail("Exception in decoder at run " + run + " length " + len + ": " + e);
+ }
+ }
}
}
diff --git a/test-runner/src/android/test/mock/MockContext.java b/test-runner/src/android/test/mock/MockContext.java
index 5fab2bb..bf583e1 100644
--- a/test-runner/src/android/test/mock/MockContext.java
+++ b/test-runner/src/android/test/mock/MockContext.java
@@ -251,16 +251,33 @@
}
@Override
+ public void startActivity(Intent intent, Bundle options) {
+ startActivity(intent);
+ }
+
+ @Override
public void startActivities(Intent[] intents) {
throw new UnsupportedOperationException();
}
@Override
+ public void startActivities(Intent[] intents, Bundle options) {
+ startActivities(intents);
+ }
+
+ @Override
public void startIntentSender(IntentSender intent,
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
throws IntentSender.SendIntentException {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public void startIntentSender(IntentSender intent,
+ Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags,
+ Bundle options) throws IntentSender.SendIntentException {
+ startIntentSender(intent, fillInIntent, flagsMask, flagsValues, extraFlags);
+ }
@Override
public void sendBroadcast(Intent intent) {
diff --git a/tests/RenderScriptTests/SampleTest/src/com/android/rs/sample/sample.rs b/tests/RenderScriptTests/SampleTest/src/com/android/rs/sample/sample.rs
index 0f3c0a7..e2bf43d 100644
--- a/tests/RenderScriptTests/SampleTest/src/com/android/rs/sample/sample.rs
+++ b/tests/RenderScriptTests/SampleTest/src/com/android/rs/sample/sample.rs
@@ -28,176 +28,6 @@
allocSampler = sampler;
}
-static int32_t wrapI(rs_sampler_value wrap, int32_t coord, int32_t size) {
- if (wrap == RS_SAMPLER_WRAP) {
- coord = coord % size;
- if (coord < 0) {
- coord += size;
- }
- }
- return max(0, min(coord, size - 1));
-}
-
-#define convert_float(v) (float)v
-#define SAMPLE_1D_FUNC(vecsize) \
- static float##vecsize get1DSample##vecsize(rs_allocation a, float2 weights, \
- int iPixel, int next) { \
- uchar##vecsize *p0c = (uchar##vecsize*)rsGetElementAt(a, iPixel); \
- uchar##vecsize *p1c = (uchar##vecsize*)rsGetElementAt(a, next); \
- float##vecsize p0 = convert_float##vecsize(*p0c); \
- float##vecsize p1 = convert_float##vecsize(*p1c); \
- return p0 * weights.x + p1 * weights.y; \
- }
-#define SAMPLE_2D_FUNC(vecsize) \
- static float##vecsize get2DSample##vecsize(rs_allocation a, float4 weights, \
- int2 iPixel, int nextX, int nextY) { \
- uchar##vecsize *p0c = (uchar##vecsize*)rsGetElementAt(a, iPixel.x, iPixel.y); \
- uchar##vecsize *p1c = (uchar##vecsize*)rsGetElementAt(a, nextX, iPixel.y); \
- uchar##vecsize *p2c = (uchar##vecsize*)rsGetElementAt(a, iPixel.x, nextY); \
- uchar##vecsize *p3c = (uchar##vecsize*)rsGetElementAt(a, nextX, nextY); \
- float##vecsize p0 = convert_float##vecsize(*p0c); \
- float##vecsize p1 = convert_float##vecsize(*p1c); \
- float##vecsize p2 = convert_float##vecsize(*p2c); \
- float##vecsize p3 = convert_float##vecsize(*p3c); \
- return p0 * weights.x + p1 * weights.y + p2 * weights.z + p3 * weights.w; \
- }
-
-SAMPLE_1D_FUNC()
-SAMPLE_1D_FUNC(2)
-SAMPLE_1D_FUNC(3)
-SAMPLE_1D_FUNC(4)
-
-SAMPLE_2D_FUNC()
-SAMPLE_2D_FUNC(2)
-SAMPLE_2D_FUNC(3)
-SAMPLE_2D_FUNC(4)
-
-static float4 getBilinearSample565(rs_allocation a, float4 weights,
- int2 iPixel, int nextX, int nextY) {
- float4 zero = {0.0f, 0.0f, 0.0f, 0.0f};
- return zero;
-}
-
-static float4 getBilinearSample(rs_allocation a, float4 weights,
- int2 iPixel, int nextX, int nextY,
- uint32_t vecSize, rs_data_type dt) {
- if (dt == RS_TYPE_UNSIGNED_5_6_5) {
- return getBilinearSample565(a, weights, iPixel, nextX, nextY);
- }
-
- float4 result;
- switch(vecSize) {
- case 1:
- result.x = get2DSample(a, weights, iPixel, nextX, nextY);
- result.yzw = 0.0f;
- break;
- case 2:
- result.xy = get2DSample2(a, weights, iPixel, nextX, nextY);
- result.zw = 0.0f;
- break;
- case 3:
- result.xyz = get2DSample3(a, weights, iPixel, nextX, nextY);
- result.w = 0.0f;
- break;
- case 4:
- result = get2DSample4(a, weights, iPixel, nextX, nextY);
- break;
- }
-
- return result;
-}
-
-static float4 getNearestSample(rs_allocation a, int2 iPixel, uint32_t vecSize, rs_data_type dt) {
- if (dt == RS_TYPE_UNSIGNED_5_6_5) {
- float4 zero = {0.0f, 0.0f, 0.0f, 0.0f};
- return zero;
- }
-
- float4 result;
- switch(vecSize) {
- case 1:
- result.x = convert_float(*((uchar*)rsGetElementAt(a, iPixel.x, iPixel.y)));
- result.yzw = 0.0f;
- case 2:
- result.xy = convert_float2(*((uchar2*)rsGetElementAt(a, iPixel.x, iPixel.y)));
- result.zw = 0.0f;
- case 3:
- result.xyz = convert_float3(*((uchar3*)rsGetElementAt(a, iPixel.x, iPixel.y)));
- result.w = 0.0f;
- case 4:
- result = convert_float4(*((uchar4*)rsGetElementAt(a, iPixel.x, iPixel.y)));
- }
-
- return result;
-}
-
-
-// Naive implementation of texture filtering for prototyping purposes
-static float4 sample(rs_allocation a, rs_sampler s, float2 uv) {
-
- // Find out what kind of input data we are sampling
- rs_element elem = rsAllocationGetElement(a);
- uint32_t vecSize = rsElementGetVectorSize(elem);
- rs_data_kind dk = rsElementGetDataKind(elem);
- rs_data_type dt = rsElementGetDataType(elem);
-
- if (dk == RS_KIND_USER || (dt != RS_TYPE_UNSIGNED_8 && dt != RS_TYPE_UNSIGNED_5_6_5)) {
- float4 zero = {0.0f, 0.0f, 0.0f, 0.0f};
- return zero;
- }
- //rsDebug("*****************************************", 0);
- rs_sampler_value wrapS = rsgSamplerGetWrapS(s);
- rs_sampler_value wrapT = rsgSamplerGetWrapT(s);
-
- rs_sampler_value sampleMin = rsgSamplerGetMinification(s);
- rs_sampler_value sampleMag = rsgSamplerGetMagnification(s);
-
- int32_t sourceW = rsAllocationGetDimX(a);
- int32_t sourceH = rsAllocationGetDimY(a);
-
- float2 dimF;
- dimF.x = (float)(sourceW);
- dimF.y = (float)(sourceH);
- float2 pixelUV = uv * dimF;
- int2 iPixel = convert_int2(pixelUV);
-
- if (sampleMin == RS_SAMPLER_NEAREST ||
- sampleMag == RS_SAMPLER_NEAREST) {
- iPixel.x = wrapI(wrapS, iPixel.x, sourceW);
- iPixel.y = wrapI(wrapT, iPixel.y, sourceH);
- return getNearestSample(a, iPixel, vecSize, dt);
- }
-
- float2 frac = pixelUV - convert_float2(iPixel);
-
- if (frac.x < 0.5f) {
- iPixel.x -= 1;
- frac.x += 0.5f;
- } else {
- frac.x -= 0.5f;
- }
- if (frac.y < 0.5f) {
- iPixel.y -= 1;
- frac.y += 0.5f;
- } else {
- frac.y -= 0.5f;
- }
- float2 oneMinusFrac = 1.0f - frac;
-
- float4 weights;
- weights.x = oneMinusFrac.x * oneMinusFrac.y;
- weights.y = frac.x * oneMinusFrac.y;
- weights.z = oneMinusFrac.x * frac.y;
- weights.w = frac.x * frac.y;
-
- int32_t nextX = wrapI(wrapS, iPixel.x + 1, sourceW);
- int32_t nextY = wrapI(wrapT, iPixel.y + 1, sourceH);
- iPixel.x = wrapI(wrapS, iPixel.x, sourceW);
- iPixel.y = wrapI(wrapT, iPixel.y, sourceH);
-
- return getBilinearSample(a, weights, iPixel, nextX, nextY, vecSize, dt);
-}
-
void root(uchar4 *out, uint32_t x, uint32_t y) {
float destX = (float)rsAllocationGetDimX(destAlloc) - 1.0f;
@@ -207,7 +37,7 @@
uv.x = (float)x / destX;
uv.y = (float)y / destY;
- out->xyz = convert_uchar3(sample(sourceAlloc, allocSampler, uv*2.0f).xyz);
+ out->xyz = convert_uchar3(rsSample(sourceAlloc, allocSampler, uv*2.0f).xyz);
out->w = 0xff;
}
diff --git a/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java b/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java
index 3efd658..b3a2600 100644
--- a/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java
+++ b/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java
@@ -120,13 +120,20 @@
* The method will launch the app, wait for 7 seconds, check for apps in the error state, send
* the Home intent, wait for 2 seconds, and then return.
*/
- public Collection<ProcessErrorStateInfo> runOneActivity(ResolveInfo app) {
+ public Collection<ProcessError> runOneActivity(ResolveInfo app) {
final long appLaunchWait = 7000;
final long homeLaunchWait = 2000;
Log.i(TAG, String.format("Running activity %s/%s", app.activityInfo.packageName,
app.activityInfo.name));
+ // We check for any Crash or ANR dialogs that are already up, and we ignore them. This is
+ // so that we don't report crashes that were caused by prior apps (which those particular
+ // tests should have caught and reported already). Otherwise, test failures would cascade
+ // from the initial broken app to many/all of the tests following that app's launch.
+ final Collection<ProcessError> preErrProcs =
+ ProcessError.fromCollection(mActivityManager.getProcessesInErrorState());
+
// launch app, and wait 7 seconds for it to start/settle
final Intent intent = intentForActivity(app);
getContext().startActivity(intent);
@@ -136,10 +143,6 @@
// ignore
}
- // See if there are any errors
- final Collection<ProcessErrorStateInfo> errProcs =
- mActivityManager.getProcessesInErrorState();
-
// Send the "home" intent and wait 2 seconds for us to get there
getContext().startActivity(mHomeIntent);
try {
@@ -148,28 +151,35 @@
// ignore
}
+ // See if there are any errors. We wait until down here to give ANRs as much time as
+ // possible to occur.
+ final Collection<ProcessError> errProcs =
+ ProcessError.fromCollection(mActivityManager.getProcessesInErrorState());
+ // Take the difference between the error processes we see now, and the ones that were
+ // present when we started
+ if (errProcs != null && preErrProcs != null) {
+ errProcs.removeAll(preErrProcs);
+ }
+
return errProcs;
}
/**
* A test that runs all Launcher-launchable activities and verifies that no ANRs or crashes
* happened while doing so.
- * <p />
- * FIXME: Doesn't detect multiple crashing apps properly, since the crash dialog for the
- * FIXME: first app doesn't go away.
*/
public void testRunAllActivities() throws Exception {
final Set<ProcessError> errSet = new HashSet<ProcessError>();
for (ResolveInfo app : getLauncherActivities(mPackageManager)) {
- final Collection<ProcessErrorStateInfo> errProcs = runOneActivity(app);
+ final Collection<ProcessError> errProcs = runOneActivity(app);
if (errProcs != null) {
- errSet.addAll(ProcessError.fromCollection(errProcs));
+ errSet.addAll(errProcs);
}
}
if (!errSet.isEmpty()) {
- fail(String.format("Got %d errors: %s", errSet.size(),
+ fail(String.format("Got %d errors:\n%s", errSet.size(),
reportWrappedListContents(errSet)));
}
}
@@ -200,19 +210,21 @@
String condition;
switch (entry.condition) {
case ActivityManager.ProcessErrorStateInfo.CRASHED:
- condition = "CRASHED";
+ condition = "a CRASH";
break;
case ActivityManager.ProcessErrorStateInfo.NOT_RESPONDING:
- condition = "ANR";
+ condition = "an ANR";
break;
default:
- condition = "<unknown>";
+ condition = "an unknown error";
break;
}
- builder.append("Process error ").append(condition).append(" ");
- builder.append(" ").append(entry.shortMsg);
- builder.append(" detected in ").append(entry.processName).append(" ").append(entry.tag);
+ builder.append(String.format("Process %s encountered %s (%s)", entry.processName,
+ condition, entry.shortMsg));
+ if (entry.condition == ActivityManager.ProcessErrorStateInfo.CRASHED) {
+ builder.append(String.format(" with stack trace:\n%s\n", entry.stackTrace));
+ }
builder.append("\n");
}
return builder.toString();
@@ -231,6 +243,10 @@
public static Collection<ProcessError> fromCollection(Collection<ProcessErrorStateInfo> in)
{
+ if (in == null) {
+ return null;
+ }
+
List<ProcessError> out = new ArrayList<ProcessError>(in.size());
for (ProcessErrorStateInfo info : in) {
out.add(new ProcessError(info));
diff --git a/tests/SmokeTest/tests/src/com/android/smoketest/SmokeTestRunner.java b/tests/SmokeTest/tests/src/com/android/smoketest/SmokeTestRunner.java
index 40b11c5..51331fe 100644
--- a/tests/SmokeTest/tests/src/com/android/smoketest/SmokeTestRunner.java
+++ b/tests/SmokeTest/tests/src/com/android/smoketest/SmokeTestRunner.java
@@ -73,13 +73,13 @@
@Override
public void runTest() throws Exception {
final Set<ProcessError> errSet = new HashSet<ProcessError>();
- final Collection<ProcessErrorStateInfo> errProcs = runOneActivity(app);
+ final Collection<ProcessError> errProcs = runOneActivity(app);
if (errProcs != null) {
- errSet.addAll(ProcessError.fromCollection(errProcs));
+ errSet.addAll(errProcs);
}
if (!errSet.isEmpty()) {
- fail(String.format("Got %d errors: %s", errSet.size(),
+ fail(String.format("Got %d errors:\n%s", errSet.size(),
reportWrappedListContents(errSet)));
}
}
diff --git a/tools/aapt/Bundle.h b/tools/aapt/Bundle.h
index 8e3a1c9..daeadc0 100644
--- a/tools/aapt/Bundle.h
+++ b/tools/aapt/Bundle.h
@@ -83,7 +83,7 @@
bool getForce(void) const { return mForce; }
void setForce(bool val) { mForce = val; }
void setGrayscaleTolerance(int val) { mGrayscaleTolerance = val; }
- int getGrayscaleTolerance() { return mGrayscaleTolerance; }
+ int getGrayscaleTolerance() const { return mGrayscaleTolerance; }
bool getMakePackageDirs(void) const { return mMakePackageDirs; }
void setMakePackageDirs(bool val) { mMakePackageDirs = val; }
bool getUpdate(void) const { return mUpdate; }
@@ -166,14 +166,14 @@
void setExtraPackages(const char* val) { mExtraPackages = val; }
const char* getMaxResVersion() const { return mMaxResVersion; }
void setMaxResVersion(const char * val) { mMaxResVersion = val; }
- bool getDebugMode() { return mDebugMode; }
+ bool getDebugMode() const { return mDebugMode; }
void setDebugMode(bool val) { mDebugMode = val; }
- bool getNonConstantId() { return mNonConstantId; }
+ bool getNonConstantId() const { return mNonConstantId; }
void setNonConstantId(bool val) { mNonConstantId = val; }
const char* getProduct() const { return mProduct; }
void setProduct(const char * val) { mProduct = val; }
void setUseCrunchCache(bool val) { mUseCrunchCache = val; }
- bool getUseCrunchCache() { return mUseCrunchCache; }
+ bool getUseCrunchCache() const { return mUseCrunchCache; }
/*
* Set and get the file specification.
diff --git a/tools/aapt/Images.cpp b/tools/aapt/Images.cpp
index 6402e3c..2b9b056 100644
--- a/tools/aapt/Images.cpp
+++ b/tools/aapt/Images.cpp
@@ -964,7 +964,7 @@
compression_type));
}
-status_t preProcessImage(Bundle* bundle, const sp<AaptAssets>& assets,
+status_t preProcessImage(const Bundle* bundle, const sp<AaptAssets>& assets,
const sp<AaptFile>& file, String8* outNewLeafName)
{
String8 ext(file->getPath().getPathExtension());
@@ -1084,7 +1084,7 @@
return error;
}
-status_t preProcessImageToCache(Bundle* bundle, String8 source, String8 dest)
+status_t preProcessImageToCache(const Bundle* bundle, const String8& source, const String8& dest)
{
png_structp read_ptr = NULL;
png_infop read_info = NULL;
diff --git a/tools/aapt/Images.h b/tools/aapt/Images.h
index 4816905..91b6554 100644
--- a/tools/aapt/Images.h
+++ b/tools/aapt/Images.h
@@ -15,10 +15,10 @@
using android::String8;
-status_t preProcessImage(Bundle* bundle, const sp<AaptAssets>& assets,
+status_t preProcessImage(const Bundle* bundle, const sp<AaptAssets>& assets,
const sp<AaptFile>& file, String8* outNewLeafName);
-status_t preProcessImageToCache(Bundle* bundle, String8 source, String8 dest);
+status_t preProcessImageToCache(const Bundle* bundle, const String8& source, const String8& dest);
status_t postProcessImage(const sp<AaptAssets>& assets,
ResourceTable* table, const sp<AaptFile>& file);
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index 7eaf528..b9ec30c 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -14,6 +14,8 @@
#include "FileFinder.h"
#include "CacheUpdater.h"
+#include <utils/WorkQueue.h>
+
#if HAVE_PRINTF_ZD
# define ZD "%zd"
# define ZD_TYPE ssize_t
@@ -24,6 +26,9 @@
#define NOISY(x) // x
+// Number of threads to use for preprocessing images.
+static const size_t MAX_THREADS = 4;
+
// ==========================================================================
// ==========================================================================
// ==========================================================================
@@ -302,21 +307,52 @@
return hasErrors ? UNKNOWN_ERROR : NO_ERROR;
}
-static status_t preProcessImages(Bundle* bundle, const sp<AaptAssets>& assets,
+class PreProcessImageWorkUnit : public WorkQueue::WorkUnit {
+public:
+ PreProcessImageWorkUnit(const Bundle* bundle, const sp<AaptAssets>& assets,
+ const sp<AaptFile>& file, volatile bool* hasErrors) :
+ mBundle(bundle), mAssets(assets), mFile(file), mHasErrors(hasErrors) {
+ }
+
+ virtual bool run() {
+ status_t status = preProcessImage(mBundle, mAssets, mFile, NULL);
+ if (status) {
+ *mHasErrors = true;
+ }
+ return true; // continue even if there are errors
+ }
+
+private:
+ const Bundle* mBundle;
+ sp<AaptAssets> mAssets;
+ sp<AaptFile> mFile;
+ volatile bool* mHasErrors;
+};
+
+static status_t preProcessImages(const Bundle* bundle, const sp<AaptAssets>& assets,
const sp<ResourceTypeSet>& set, const char* type)
{
- bool hasErrors = false;
+ volatile bool hasErrors = false;
ssize_t res = NO_ERROR;
if (bundle->getUseCrunchCache() == false) {
+ WorkQueue wq(MAX_THREADS, false);
ResourceDirIterator it(set, String8(type));
- Vector<sp<AaptFile> > newNameFiles;
- Vector<String8> newNamePaths;
while ((res=it.next()) == NO_ERROR) {
- res = preProcessImage(bundle, assets, it.getFile(), NULL);
- if (res < NO_ERROR) {
+ PreProcessImageWorkUnit* w = new PreProcessImageWorkUnit(
+ bundle, assets, it.getFile(), &hasErrors);
+ status_t status = wq.schedule(w);
+ if (status) {
+ fprintf(stderr, "preProcessImages failed: schedule() returned %d\n", status);
hasErrors = true;
+ delete w;
+ break;
}
}
+ status_t status = wq.finish();
+ if (status) {
+ fprintf(stderr, "preProcessImages failed: finish() returned %d\n", status);
+ hasErrors = true;
+ }
}
return (hasErrors || (res < NO_ERROR)) ? UNKNOWN_ERROR : NO_ERROR;
}
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index df6abe8..0195727 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -2598,7 +2598,7 @@
// Iterate through all data, collecting all values (strings,
// references, etc).
- StringPool valueStrings = StringPool(false, useUTF8);
+ StringPool valueStrings(useUTF8);
Vector<sp<Entry> > allEntries;
for (pi=0; pi<N; pi++) {
sp<Package> p = mOrderedPackages.itemAt(pi);
@@ -2607,8 +2607,8 @@
continue;
}
- StringPool typeStrings = StringPool(false, useUTF8);
- StringPool keyStrings = StringPool(false, useUTF8);
+ StringPool typeStrings(useUTF8);
+ StringPool keyStrings(useUTF8);
const size_t N = p->getOrderedTypes().size();
for (size_t ti=0; ti<N; ti++) {
diff --git a/tools/aapt/StringPool.cpp b/tools/aapt/StringPool.cpp
index 7f137ce..839eda5 100644
--- a/tools/aapt/StringPool.cpp
+++ b/tools/aapt/StringPool.cpp
@@ -9,6 +9,7 @@
#include <utils/ByteOrder.h>
#include <utils/SortedVector.h>
+#include <cutils/qsort_r_compat.h>
#if HAVE_PRINTF_ZD
# define ZD "%zd"
@@ -71,14 +72,16 @@
}
int StringPool::entry::compare(const entry& o) const {
- // Strings with styles go first, to reduce the size of the
- // styles array.
+ // Strings with styles go first, to reduce the size of the styles array.
+ // We don't care about the relative order of these strings.
if (hasStyles) {
return o.hasStyles ? 0 : -1;
}
if (o.hasStyles) {
return 1;
}
+
+ // Sort unstyled strings by type, then by logical configuration.
int comp = configTypeName.compare(o.configTypeName);
if (comp != 0) {
return comp;
@@ -98,39 +101,24 @@
return 0;
}
-StringPool::StringPool(bool sorted, bool utf8)
- : mSorted(sorted), mUTF8(utf8), mValues(-1), mIdents(-1)
+StringPool::StringPool(bool utf8) :
+ mUTF8(utf8), mValues(-1)
{
}
-ssize_t StringPool::add(const String16& value, bool mergeDuplicates,
- const String8* configTypeName, const ResTable_config* config)
-{
- return add(String16(), value, mergeDuplicates, configTypeName, config);
-}
-
ssize_t StringPool::add(const String16& value, const Vector<entry_style_span>& spans,
const String8* configTypeName, const ResTable_config* config)
{
- ssize_t res = add(String16(), value, false, configTypeName, config);
+ ssize_t res = add(value, false, configTypeName, config);
if (res >= 0) {
addStyleSpans(res, spans);
}
return res;
}
-ssize_t StringPool::add(const String16& ident, const String16& value,
+ssize_t StringPool::add(const String16& value,
bool mergeDuplicates, const String8* configTypeName, const ResTable_config* config)
{
- if (ident.size() > 0) {
- ssize_t idx = mIdents.valueFor(ident);
- if (idx >= 0) {
- fprintf(stderr, "ERROR: Duplicate string identifier %s\n",
- String8(mEntries[idx].value).string());
- return UNKNOWN_ERROR;
- }
- }
-
ssize_t vidx = mValues.indexOfKey(value);
ssize_t pos = vidx >= 0 ? mValues.valueAt(vidx) : -1;
ssize_t eidx = pos >= 0 ? mEntryArray.itemAt(pos) : -1;
@@ -181,14 +169,8 @@
if (first) {
vidx = mValues.add(value, pos);
}
- if (!mSorted) {
- entry& ent = mEntries.editItemAt(eidx);
- ent.indices.add(pos);
- }
- }
-
- if (ident.size() > 0) {
- mIdents.add(ident, vidx);
+ entry& ent = mEntries.editItemAt(eidx);
+ ent.indices.add(pos);
}
NOISY(printf("Adding string %s to pool: pos=%d eidx=%d vidx=%d\n",
@@ -221,8 +203,6 @@
status_t StringPool::addStyleSpan(size_t idx, const entry_style_span& span)
{
- LOG_ALWAYS_FATAL_IF(mSorted, "Can't use styles with sorted string pools.");
-
// Place blank entries in the span array up to this index.
while (mEntryStyleArray.size() <= idx) {
mEntryStyleArray.add();
@@ -234,37 +214,16 @@
return NO_ERROR;
}
-size_t StringPool::size() const
-{
- return mSorted ? mValues.size() : mEntryArray.size();
-}
-
-const StringPool::entry& StringPool::entryAt(size_t idx) const
-{
- if (!mSorted) {
- return mEntries[mEntryArray[idx]];
- } else {
- return mEntries[mEntryArray[mValues.valueAt(idx)]];
- }
-}
-
-size_t StringPool::countIdentifiers() const
-{
- return mIdents.size();
-}
-
-int StringPool::config_sort(const size_t* lhs, const size_t* rhs, void* state)
+int StringPool::config_sort(void* state, const void* lhs, const void* rhs)
{
StringPool* pool = (StringPool*)state;
- const entry& lhe = pool->mEntries[pool->mEntryArray[*lhs]];
- const entry& rhe = pool->mEntries[pool->mEntryArray[*rhs]];
+ const entry& lhe = pool->mEntries[pool->mEntryArray[*static_cast<const size_t*>(lhs)]];
+ const entry& rhe = pool->mEntries[pool->mEntryArray[*static_cast<const size_t*>(rhs)]];
return lhe.compare(rhe);
}
void StringPool::sortByConfig()
{
- LOG_ALWAYS_FATAL_IF(mSorted, "Can't sort string pool containing identifiers.");
- LOG_ALWAYS_FATAL_IF(mIdents.size() > 0, "Can't sort string pool containing identifiers.");
LOG_ALWAYS_FATAL_IF(mOriginalPosToNewPos.size() > 0, "Can't sort string pool after already sorted.");
const size_t N = mEntryArray.size();
@@ -274,13 +233,17 @@
// At that point it maps from the new position in the array to the
// original position the entry appeared.
Vector<size_t> newPosToOriginalPos;
- for (size_t i=0; i<mEntryArray.size(); i++) {
+ newPosToOriginalPos.setCapacity(N);
+ for (size_t i=0; i < N; i++) {
newPosToOriginalPos.add(i);
}
// Sort the array.
NOISY(printf("SORTING STRINGS BY CONFIGURATION...\n"));
- newPosToOriginalPos.sort(config_sort, this);
+ // Vector::sort uses insertion sort, which is very slow for this data set.
+ // Use quicksort instead because we don't need a stable sort here.
+ qsort_r_compat(newPosToOriginalPos.editArray(), N, sizeof(size_t), this, config_sort);
+ //newPosToOriginalPos.sort(config_sort, this);
NOISY(printf("DONE SORTING STRINGS BY CONFIGURATION.\n"));
// Create the reverse mapping from the original position in the array
@@ -432,7 +395,7 @@
}
}
- const size_t ENTRIES = size();
+ const size_t ENTRIES = mEntryArray.size();
// Now build the pool of unique strings.
@@ -566,9 +529,6 @@
header->header.size = htodl(pool->getSize());
header->stringCount = htodl(ENTRIES);
header->styleCount = htodl(STYLES);
- if (mSorted) {
- header->flags |= htodl(ResStringPool_header::SORTED_FLAG);
- }
if (mUTF8) {
header->flags |= htodl(ResStringPool_header::UTF8_FLAG);
}
@@ -578,33 +538,18 @@
// Write string index array.
uint32_t* index = (uint32_t*)(header+1);
- if (mSorted) {
- for (i=0; i<ENTRIES; i++) {
- entry& ent = const_cast<entry&>(entryAt(i));
- ent.indices.clear();
- ent.indices.add(i);
- *index++ = htodl(ent.offset);
- }
- } else {
- for (i=0; i<ENTRIES; i++) {
- entry& ent = mEntries.editItemAt(mEntryArray[i]);
- *index++ = htodl(ent.offset);
- NOISY(printf("Writing entry #%d: \"%s\" ent=%d off=%d\n", i,
- String8(ent.value).string(),
- mEntryArray[i], ent.offset));
- }
+ for (i=0; i<ENTRIES; i++) {
+ entry& ent = mEntries.editItemAt(mEntryArray[i]);
+ *index++ = htodl(ent.offset);
+ NOISY(printf("Writing entry #%d: \"%s\" ent=%d off=%d\n", i,
+ String8(ent.value).string(),
+ mEntryArray[i], ent.offset));
}
// Write style index array.
- if (mSorted) {
- for (i=0; i<STYLES; i++) {
- LOG_ALWAYS_FATAL("Shouldn't be here!");
- }
- } else {
- for (i=0; i<STYLES; i++) {
- *index++ = htodl(mEntryStyleArray[i].offset);
- }
+ for (i=0; i<STYLES; i++) {
+ *index++ = htodl(mEntryStyleArray[i].offset);
}
return NO_ERROR;
diff --git a/tools/aapt/StringPool.h b/tools/aapt/StringPool.h
index 86044ed..d501008 100644
--- a/tools/aapt/StringPool.h
+++ b/tools/aapt/StringPool.h
@@ -13,6 +13,7 @@
#include <androidfw/ResourceTypes.h>
#include <utils/String16.h>
#include <utils/TextOutput.h>
+#include <utils/TypeHelpers.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -79,16 +80,10 @@
};
/**
- * If 'sorted' is true, then the final strings in the resource data
- * structure will be generated in sorted order. This allow for fast
- * lookup with ResStringPool::indexOfString() (O(log n)), at the expense
- * of support for styled string entries (which requires the same string
- * be included multiple times in the pool).
- *
* If 'utf8' is true, strings will be encoded with UTF-8 instead of
* left in Java's native UTF-16.
*/
- explicit StringPool(bool sorted = false, bool utf8 = false);
+ explicit StringPool(bool utf8 = false);
/**
* Add a new string to the pool. If mergeDuplicates is true, thenif
@@ -96,9 +91,7 @@
* otherwise, or if the value doesn't already exist, a new entry is
* created.
*
- * Returns the index in the entry array of the new string entry. Note that
- * if this string pool is sorted, the returned index will not be valid
- * when the pool is finally written.
+ * Returns the index in the entry array of the new string entry.
*/
ssize_t add(const String16& value, bool mergeDuplicates = false,
const String8* configTypeName = NULL, const ResTable_config* config = NULL);
@@ -106,24 +99,14 @@
ssize_t add(const String16& value, const Vector<entry_style_span>& spans,
const String8* configTypeName = NULL, const ResTable_config* config = NULL);
- ssize_t add(const String16& ident, const String16& value,
- bool mergeDuplicates = false,
- const String8* configTypeName = NULL, const ResTable_config* config = NULL);
-
status_t addStyleSpan(size_t idx, const String16& name,
uint32_t start, uint32_t end);
status_t addStyleSpans(size_t idx, const Vector<entry_style_span>& spans);
status_t addStyleSpan(size_t idx, const entry_style_span& span);
- size_t size() const;
-
- const entry& entryAt(size_t idx) const;
-
- size_t countIdentifiers() const;
-
// Sort the contents of the string block by the configuration associated
// with each item. After doing this you can use mapOriginalPosToNewPos()
- // to find out the new position given the position originall returned by
+ // to find out the new position given the position originally returned by
// add().
void sortByConfig();
@@ -156,9 +139,8 @@
const Vector<size_t>* offsetsForString(const String16& val) const;
private:
- static int config_sort(const size_t* lhs, const size_t* rhs, void* state);
+ static int config_sort(void* state, const void* lhs, const void* rhs);
- const bool mSorted;
const bool mUTF8;
// The following data structures represent the actual structures
@@ -185,13 +167,18 @@
// Unique set of all the strings added to the pool, mapped to
// the first index of mEntryArray where the value was added.
DefaultKeyedVector<String16, ssize_t> mValues;
- // Unique set of all (optional) identifiers of strings in the
- // pool, mapping to indices in mEntries.
- DefaultKeyedVector<String16, ssize_t> mIdents;
// This array maps from the original position a string was placed at
// in mEntryArray to its new position after being sorted with sortByConfig().
Vector<size_t> mOriginalPosToNewPos;
};
+// The entry types are trivially movable because all fields they contain, including
+// the vectors and strings, are trivially movable.
+namespace android {
+ ANDROID_TRIVIAL_MOVE_TRAIT(StringPool::entry);
+ ANDROID_TRIVIAL_MOVE_TRAIT(StringPool::entry_style_span);
+ ANDROID_TRIVIAL_MOVE_TRAIT(StringPool::entry_style);
+};
+
#endif
diff --git a/tools/aapt/XMLNode.cpp b/tools/aapt/XMLNode.cpp
index 8d7acee..0dba950 100644
--- a/tools/aapt/XMLNode.cpp
+++ b/tools/aapt/XMLNode.cpp
@@ -973,7 +973,7 @@
status_t XMLNode::flatten(const sp<AaptFile>& dest,
bool stripComments, bool stripRawValues) const
{
- StringPool strings = StringPool(false, mUTF8);
+ StringPool strings(mUTF8);
Vector<uint32_t> resids;
// First collect just the strings for attribute names that have a
diff --git a/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java b/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java
index 7b672da..8794452 100644
--- a/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java
+++ b/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java
@@ -120,10 +120,8 @@
mProjectCallback = projectCallback;
}
- public BridgeTypedArray newTypeArray(int numEntries, boolean platformFile,
- boolean platformStyleable, String styleableName) {
- return new BridgeTypedArray(this, mContext, numEntries, platformFile,
- platformStyleable, styleableName);
+ public BridgeTypedArray newTypeArray(int numEntries, boolean platformFile) {
+ return new BridgeTypedArray(this, mContext, numEntries, platformFile);
}
private Pair<String, ResourceValue> getResourceValue(int id, boolean[] platformResFlag_out) {
diff --git a/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java b/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java
index 8fdac02..cbc199a 100644
--- a/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java
+++ b/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java
@@ -16,7 +16,7 @@
package android.content.res;
-import com.android.ide.common.rendering.api.DeclareStyleableResourceValue;
+import com.android.ide.common.rendering.api.AttrResourceValue;
import com.android.ide.common.rendering.api.LayoutLog;
import com.android.ide.common.rendering.api.RenderResources;
import com.android.ide.common.rendering.api.ResourceValue;
@@ -51,28 +51,33 @@
private final BridgeResources mBridgeResources;
private final BridgeContext mContext;
private final boolean mPlatformFile;
- private final boolean mPlatformStyleable;
- private final String mStyleableName;
private ResourceValue[] mResourceData;
private String[] mNames;
+ private boolean[] mIsFramework;
public BridgeTypedArray(BridgeResources resources, BridgeContext context, int len,
- boolean platformFile, boolean platformStyleable, String styleableName) {
+ boolean platformFile) {
super(null, null, null, 0);
mBridgeResources = resources;
mContext = context;
mPlatformFile = platformFile;
- mPlatformStyleable = platformStyleable;
- mStyleableName = styleableName;
mResourceData = new ResourceValue[len];
mNames = new String[len];
+ mIsFramework = new boolean[len];
}
- /** A bridge-specific method that sets a value in the type array */
- public void bridgeSetValue(int index, String name, ResourceValue value) {
+ /**
+ * A bridge-specific method that sets a value in the type array
+ * @param index the index of the value in the TypedArray
+ * @param name the name of the attribute
+ * @param isFramework whether the attribute is in the android namespace.
+ * @param value the value of the attribute
+ */
+ public void bridgeSetValue(int index, String name, boolean isFramework, ResourceValue value) {
mResourceData[index] = value;
mNames[index] = name;
+ mIsFramework[index] = isFramework;
}
/**
@@ -213,8 +218,12 @@
return defValue;
}
+ if (s == null) {
+ return defValue;
+ }
+
try {
- return (s == null) ? defValue : XmlUtils.convertValueToInt(s, defValue);
+ return XmlUtils.convertValueToInt(s, defValue);
} catch (NumberFormatException e) {
// pass
}
@@ -223,15 +232,14 @@
// Check for possible constants and try to find them.
// Get the map of attribute-constant -> IntegerValue
Map<String, Integer> map = null;
- if (mPlatformStyleable) {
+ if (mIsFramework[index]) {
map = Bridge.getEnumValues(mNames[index]);
- } else if (mStyleableName != null) {
+ } else {
// get the styleable matching the resolved name
RenderResources res = mContext.getRenderResources();
- ResourceValue styleable = res.getProjectResource(ResourceType.DECLARE_STYLEABLE,
- mStyleableName);
- if (styleable instanceof DeclareStyleableResourceValue) {
- map = ((DeclareStyleableResourceValue) styleable).getAttributeValues(mNames[index]);
+ ResourceValue attr = res.getProjectResource(ResourceType.ATTR, mNames[index]);
+ if (attr instanceof AttrResourceValue) {
+ map = ((AttrResourceValue) attr).getAttributeValues();
}
}
diff --git a/tools/layoutlib/bridge/src/com/android/internal/policy/PolicyManager.java b/tools/layoutlib/bridge/src/com/android/internal/policy/PolicyManager.java
new file mode 100644
index 0000000..0100dc5
--- /dev/null
+++ b/tools/layoutlib/bridge/src/com/android/internal/policy/PolicyManager.java
@@ -0,0 +1,72 @@
+/*
+ * 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.internal.policy;
+
+import com.android.ide.common.rendering.api.LayoutLog;
+import com.android.layoutlib.bridge.Bridge;
+import com.android.layoutlib.bridge.impl.RenderAction;
+
+import android.content.Context;
+import android.view.BridgeInflater;
+import android.view.FallbackEventHandler;
+import android.view.KeyEvent;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManagerPolicy;
+
+/**
+ * Custom implementation of PolicyManager that does nothing to run in LayoutLib.
+ *
+ */
+public class PolicyManager {
+
+ public static Window makeNewWindow(Context context) {
+ // this will likely crash somewhere beyond so we log it.
+ Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
+ "Call to PolicyManager.makeNewWindow is not supported", null);
+ return null;
+ }
+
+ public static LayoutInflater makeNewLayoutInflater(Context context) {
+ return new BridgeInflater(context, RenderAction.getCurrentContext().getProjectCallback());
+ }
+
+ public static WindowManagerPolicy makeNewWindowManager() {
+ // this will likely crash somewhere beyond so we log it.
+ Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
+ "Call to PolicyManager.makeNewWindowManager is not supported", null);
+ return null;
+ }
+
+ public static FallbackEventHandler makeNewFallbackEventHandler(Context context) {
+ return new FallbackEventHandler() {
+ @Override
+ public void setView(View v) {
+ }
+
+ @Override
+ public void preDispatchKeyEvent(KeyEvent event) {
+ }
+
+ @Override
+ public boolean dispatchKeyEvent(KeyEvent event) {
+ return false;
+ }
+ };
+ }
+}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
index ff88209..66481fd 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
@@ -29,6 +29,7 @@
import com.android.layoutlib.bridge.impl.FontLoader;
import com.android.layoutlib.bridge.impl.RenderDrawable;
import com.android.layoutlib.bridge.impl.RenderSessionImpl;
+import com.android.layoutlib.bridge.util.DynamicIdMap;
import com.android.ninepatch.NinePatchChunk;
import com.android.resources.ResourceType;
import com.android.tools.layoutlib.create.MethodAdapter;
@@ -78,7 +79,7 @@
private final static ReentrantLock sLock = new ReentrantLock();
/**
- * Maps from id to resource type/name. This is for android.R only.
+ * Maps from id to resource type/name. This is for com.android.internal.R
*/
private final static Map<Integer, Pair<ResourceType, String>> sRMap =
new HashMap<Integer, Pair<ResourceType, String>>();
@@ -89,11 +90,17 @@
private final static Map<IntArray, String> sRArrayMap = new HashMap<IntArray, String>();
/**
* Reverse map compared to sRMap, resource type -> (resource name -> id).
- * This is for android.R only.
+ * This is for com.android.internal.R.
*/
- private final static Map<ResourceType, Map<String, Integer>> sRFullMap =
+ private final static Map<ResourceType, Map<String, Integer>> sRevRMap =
new EnumMap<ResourceType, Map<String,Integer>>(ResourceType.class);
+ // framework resources are defined as 0x01XX#### where XX is the resource type (layout,
+ // drawable, etc...). Using FF as the type allows for 255 resource types before we get a
+ // collision which should be fine.
+ private final static int DYNAMIC_ID_SEED_START = 0x01ff0000;
+ private final static DynamicIdMap sDynamicIds = new DynamicIdMap(DYNAMIC_ID_SEED_START);
+
private final static Map<Object, Map<String, SoftReference<Bitmap>>> sProjectBitmapCache =
new HashMap<Object, Map<String, SoftReference<Bitmap>>>();
private final static Map<Object, Map<String, SoftReference<NinePatchChunk>>> sProject9PatchCache =
@@ -257,7 +264,7 @@
ResourceType resType = ResourceType.getEnum(resTypeName);
if (resType != null) {
Map<String, Integer> fullMap = new HashMap<String, Integer>();
- sRFullMap.put(resType, fullMap);
+ sRevRMap.put(resType, fullMap);
for (Field f : inner.getDeclaredFields()) {
// only process static final fields. Since the final attribute may have
@@ -459,7 +466,14 @@
* does not match any resource.
*/
public static Pair<ResourceType, String> resolveResourceId(int value) {
- return sRMap.get(value);
+ Pair<ResourceType, String> pair = sRMap.get(value);
+ if (pair == null) {
+ pair = sDynamicIds.resolveId(value);
+ if (pair == null) {
+ System.out.println(String.format("Missing id: %1$08X (%1$d)", value));
+ }
+ }
+ return pair;
}
/**
@@ -478,12 +492,17 @@
* @return an {@link Integer} containing the resource id, or null if no resource were found.
*/
public static Integer getResourceId(ResourceType type, String name) {
- Map<String, Integer> map = sRFullMap.get(type);
+ Map<String, Integer> map = sRevRMap.get(type);
+ Integer value = null;
if (map != null) {
- return map.get(name);
+ value = map.get(name);
}
- return null;
+ if (value == null) {
+ value = sDynamicIds.getId(type, name);
+ }
+
+ return value;
}
/**
@@ -598,6 +617,4 @@
sFramework9PatchCache.put(value, new SoftReference<NinePatchChunk>(ninePatch));
}
}
-
-
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
index 529be97..f9f4b3a 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
@@ -70,13 +70,13 @@
@Override
public Result getProperty(Object objectView, String propertyName) {
- // TODO Auto-generated method stub
+ // pass
return super.getProperty(objectView, propertyName);
}
@Override
public Result setProperty(Object objectView, String propertyName, String propertyValue) {
- // TODO Auto-generated method stub
+ // pass
return super.setProperty(objectView, propertyName, propertyValue);
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
index 58dc2d4..f9e48e2b 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
@@ -60,6 +60,7 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
+import android.os.PowerManager;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.TypedValue;
@@ -75,13 +76,11 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.IdentityHashMap;
+import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
-import java.util.TreeMap;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
/**
* Custom implementation of Context/Activity to handle non compiled resources.
@@ -246,15 +245,18 @@
public boolean resolveThemeAttribute(int resid, TypedValue outValue, boolean resolveRefs) {
Pair<ResourceType, String> resourceInfo = Bridge.resolveResourceId(resid);
+ boolean isFrameworkRes = true;
if (resourceInfo == null) {
resourceInfo = mProjectCallback.resolveResourceId(resid);
+ isFrameworkRes = false;
}
if (resourceInfo == null) {
return false;
}
- ResourceValue value = mRenderResources.findItemInTheme(resourceInfo.getSecond());
+ ResourceValue value = mRenderResources.findItemInTheme(resourceInfo.getSecond(),
+ isFrameworkRes);
if (resolveRefs) {
value = mRenderResources.resolveResValue(value);
}
@@ -314,12 +316,7 @@
if (isPlatformLayout == false && skipCallbackParser == false) {
// check if the project callback can provide us with a custom parser.
- ILayoutPullParser parser;
- if (resource instanceof ResourceValue) {
- parser = mProjectCallback.getParser((ResourceValue) resource);
- } else {
- parser = mProjectCallback.getParser(resource.getName());
- }
+ ILayoutPullParser parser = getParser(resource);
if (parser != null) {
BridgeXmlBlockParser blockParser = new BridgeXmlBlockParser(parser,
@@ -392,6 +389,17 @@
return Pair.of(null, false);
}
+ @SuppressWarnings("deprecation")
+ private ILayoutPullParser getParser(ResourceReference resource) {
+ ILayoutPullParser parser;
+ if (resource instanceof ResourceValue) {
+ parser = mProjectCallback.getParser((ResourceValue) resource);
+ } else {
+ parser = mProjectCallback.getParser(resource.getName());
+ }
+ return parser;
+ }
+
// ------------ Context methods
@Override
@@ -431,6 +439,10 @@
return null;
}
+ if (POWER_SERVICE.equals(service)) {
+ return new PowerManager(new BridgePowerManager(), new Handler());
+ }
+
throw new UnsupportedOperationException("Unsupported Service: " + service);
}
@@ -519,12 +531,10 @@
return null;
}
- AtomicBoolean frameworkAttributes = new AtomicBoolean();
- AtomicReference<String> attrName = new AtomicReference<String>();
- TreeMap<Integer, String> styleNameMap = searchAttrs(attrs, frameworkAttributes, attrName);
+ List<Pair<String, Boolean>> attributeList = searchAttrs(attrs);
BridgeTypedArray ta = ((BridgeResources) mSystemResources).newTypeArray(attrs.length,
- isPlatformFile, frameworkAttributes.get(), attrName.get());
+ isPlatformFile);
// look for a custom style.
String customStyle = null;
@@ -550,14 +560,19 @@
if (defStyleAttr != 0) {
// get the name from the int.
- String defStyleName = searchAttr(defStyleAttr);
+ Pair<String, Boolean> defStyleAttribute = searchAttr(defStyleAttr);
if (defaultPropMap != null) {
+ String defStyleName = defStyleAttribute.getFirst();
+ if (defStyleAttribute.getSecond()) {
+ defStyleName = "android:" + defStyleName;
+ }
defaultPropMap.put("style", defStyleName);
}
// look for the style in the current theme, and its parent:
- ResourceValue item = mRenderResources.findItemInTheme(defStyleName);
+ ResourceValue item = mRenderResources.findItemInTheme(defStyleAttribute.getFirst(),
+ defStyleAttribute.getSecond());
if (item != null) {
// item is a reference to a style entry. Search for it.
@@ -570,19 +585,23 @@
} else {
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_RESOLVE_THEME_ATTR,
String.format(
- "Failed to find style '%s' in current theme", defStyleName),
+ "Failed to find style '%s' in current theme",
+ defStyleAttribute.getFirst()),
null /*data*/);
}
} else if (defStyleRes != 0) {
+ boolean isFrameworkRes = true;
Pair<ResourceType, String> value = Bridge.resolveResourceId(defStyleRes);
if (value == null) {
value = mProjectCallback.resolveResourceId(defStyleRes);
+ isFrameworkRes = false;
}
if (value != null) {
if (value.getFirst() == ResourceType.STYLE) {
// look for the style in the current theme, and its parent:
- ResourceValue item = mRenderResources.findItemInTheme(value.getSecond());
+ ResourceValue item = mRenderResources.findItemInTheme(value.getSecond(),
+ isFrameworkRes);
if (item != null) {
if (item instanceof StyleResourceValue) {
if (defaultPropMap != null) {
@@ -614,26 +633,28 @@
}
}
- String namespace = BridgeConstants.NS_RESOURCES;
- boolean useFrameworkNS = frameworkAttributes.get();
- if (useFrameworkNS == false) {
- // need to use the application namespace
- namespace = mProjectCallback.getNamespace();
- }
+ String appNamespace = mProjectCallback.getNamespace();
- if (styleNameMap != null) {
- for (Entry<Integer, String> styleAttribute : styleNameMap.entrySet()) {
- int index = styleAttribute.getKey().intValue();
+ if (attributeList != null) {
+ for (int index = 0 ; index < attributeList.size() ; index++) {
+ Pair<String, Boolean> attribute = attributeList.get(index);
- String name = styleAttribute.getValue();
+ if (attribute == null) {
+ continue;
+ }
+
+ String attrName = attribute.getFirst();
+ boolean frameworkAttr = attribute.getSecond().booleanValue();
String value = null;
if (set != null) {
- value = set.getAttributeValue(namespace, name);
+ value = set.getAttributeValue(
+ frameworkAttr ? BridgeConstants.NS_RESOURCES : appNamespace,
+ attrName);
// if this is an app attribute, and the first get fails, try with the
// new res-auto namespace as well
- if (useFrameworkNS == false && value == null) {
- value = set.getAttributeValue(BridgeConstants.NS_APP_RES_AUTO, name);
+ if (frameworkAttr == false && value == null) {
+ value = set.getAttributeValue(BridgeConstants.NS_APP_RES_AUTO, attrName);
}
}
@@ -644,18 +665,20 @@
// look for the value in the custom style first (and its parent if needed)
if (customStyleValues != null) {
- resValue = mRenderResources.findItemInStyle(customStyleValues, name);
+ resValue = mRenderResources.findItemInStyle(customStyleValues,
+ attrName, frameworkAttr);
}
// then look for the value in the default Style (and its parent if needed)
if (resValue == null && defStyleValues != null) {
- resValue = mRenderResources.findItemInStyle(defStyleValues, name);
+ resValue = mRenderResources.findItemInStyle(defStyleValues,
+ attrName, frameworkAttr);
}
// if the item is not present in the defStyle, we look in the main theme (and
// its parent themes)
if (resValue == null) {
- resValue = mRenderResources.findItemInTheme(name);
+ resValue = mRenderResources.findItemInTheme(attrName, frameworkAttr);
}
// if we found a value, we make sure this doesn't reference another value.
@@ -663,18 +686,18 @@
if (resValue != null) {
// put the first default value, before the resolution.
if (defaultPropMap != null) {
- defaultPropMap.put(name, resValue.getValue());
+ defaultPropMap.put(attrName, resValue.getValue());
}
resValue = mRenderResources.resolveResValue(resValue);
}
- ta.bridgeSetValue(index, name, resValue);
+ ta.bridgeSetValue(index, attrName, frameworkAttr, resValue);
} else {
// there is a value in the XML, but we need to resolve it in case it's
// referencing another resource or a theme value.
- ta.bridgeSetValue(index, name,
- mRenderResources.resolveValue(null, name, value, isPlatformFile));
+ ta.bridgeSetValue(index, attrName, frameworkAttr,
+ mRenderResources.resolveValue(null, attrName, value, isPlatformFile));
}
}
}
@@ -700,23 +723,23 @@
private BridgeTypedArray createStyleBasedTypedArray(StyleResourceValue style, int[] attrs)
throws Resources.NotFoundException {
+ List<Pair<String, Boolean>> attributes = searchAttrs(attrs);
+
BridgeTypedArray ta = ((BridgeResources) mSystemResources).newTypeArray(attrs.length,
- false, true, null);
+ false);
// for each attribute, get its name so that we can search it in the style
for (int i = 0 ; i < attrs.length ; i++) {
- Pair<ResourceType, String> resolvedResource = Bridge.resolveResourceId(attrs[i]);
- if (resolvedResource != null) {
- String attrName = resolvedResource.getSecond();
- // look for the value in the given style
- ResourceValue resValue = mRenderResources.findItemInStyle(style, attrName);
+ Pair<String, Boolean> attribute = attributes.get(i);
- if (resValue != null) {
- // resolve it to make sure there are no references left.
- ta.bridgeSetValue(i, attrName, mRenderResources.resolveResValue(resValue));
+ // look for the value in the given style
+ ResourceValue resValue = mRenderResources.findItemInStyle(style, attribute.getFirst(),
+ attribute.getSecond());
- resValue = mRenderResources.resolveResValue(resValue);
- }
+ if (resValue != null) {
+ // resolve it to make sure there are no references left.
+ ta.bridgeSetValue(i, attribute.getFirst(), attribute.getSecond(),
+ mRenderResources.resolveResValue(resValue));
}
}
@@ -727,91 +750,52 @@
/**
- * The input int[] attrs is one of com.android.internal.R.styleable fields where the name
- * of the field is the style being referenced and the array contains one index per attribute.
+ * The input int[] attrs is a list of attributes. The returns a list of information about
+ * each attributes. The information is (name, isFramework)
* <p/>
- * searchAttrs() finds all the names of the attributes referenced so for example if
- * attrs == com.android.internal.R.styleable.View, this returns the list of the "xyz" where
- * there's a field com.android.internal.R.styleable.View_xyz and the field value is the index
- * that is used to reference the attribute later in the TypedArray.
*
* @param attrs An attribute array reference given to obtainStyledAttributes.
- * @param outFrameworkFlag out value indicating if the attr array is a framework value
- * @param outAttrName out value for the resolved attr name.
- * @return A sorted map Attribute-Value to Attribute-Name for all attributes declared by the
- * attribute array. Returns null if nothing is found.
+ * @return List of attribute information.
*/
- private TreeMap<Integer,String> searchAttrs(int[] attrs, AtomicBoolean outFrameworkFlag,
- AtomicReference<String> outAttrName) {
- // get the name of the array from the framework resources
- String arrayName = Bridge.resolveResourceId(attrs);
- if (arrayName != null) {
- // if we found it, get the name of each of the int in the array.
- TreeMap<Integer,String> attributes = new TreeMap<Integer, String>();
- for (int i = 0 ; i < attrs.length ; i++) {
- Pair<ResourceType, String> info = Bridge.resolveResourceId(attrs[i]);
- if (info != null) {
- attributes.put(i, info.getSecond());
- } else {
- // FIXME Not sure what we should be doing here...
- attributes.put(i, null);
- }
+ private List<Pair<String, Boolean>> searchAttrs(int[] attrs) {
+ List<Pair<String, Boolean>> results = new ArrayList<Pair<String, Boolean>>(attrs.length);
+
+ // for each attribute, get its name so that we can search it in the style
+ for (int i = 0 ; i < attrs.length ; i++) {
+ Pair<ResourceType, String> resolvedResource = Bridge.resolveResourceId(attrs[i]);
+ boolean isFramework = false;
+ if (resolvedResource != null) {
+ isFramework = true;
+ } else {
+ resolvedResource = mProjectCallback.resolveResourceId(attrs[i]);
}
- if (outFrameworkFlag != null) {
- outFrameworkFlag.set(true);
+ if (resolvedResource != null) {
+ results.add(Pair.of(resolvedResource.getSecond(), isFramework));
+ } else {
+ results.add(null);
}
- if (outAttrName != null) {
- outAttrName.set(arrayName);
- }
-
- return attributes;
}
- // if the name was not found in the framework resources, look in the project
- // resources
- arrayName = mProjectCallback.resolveResourceId(attrs);
- if (arrayName != null) {
- TreeMap<Integer,String> attributes = new TreeMap<Integer, String>();
- for (int i = 0 ; i < attrs.length ; i++) {
- Pair<ResourceType, String> info = mProjectCallback.resolveResourceId(attrs[i]);
- if (info != null) {
- attributes.put(i, info.getSecond());
- } else {
- // FIXME Not sure what we should be doing here...
- attributes.put(i, null);
- }
- }
-
- if (outFrameworkFlag != null) {
- outFrameworkFlag.set(false);
- }
- if (outAttrName != null) {
- outAttrName.set(arrayName);
- }
-
- return attributes;
- }
-
- return null;
+ return results;
}
/**
* Searches for the attribute referenced by its internal id.
*
* @param attr An attribute reference given to obtainStyledAttributes such as defStyle.
- * @return The unique name of the attribute, if found, e.g. "buttonStyle". Returns null
+ * @return A (name, isFramework) pair describing the attribute if found. Returns null
* if nothing is found.
*/
- public String searchAttr(int attr) {
+ public Pair<String, Boolean> searchAttr(int attr) {
Pair<ResourceType, String> info = Bridge.resolveResourceId(attr);
if (info != null) {
- return info.getSecond();
+ return Pair.of(info.getSecond(), Boolean.TRUE);
}
info = mProjectCallback.resolveResourceId(attr);
if (info != null) {
- return info.getSecond();
+ return Pair.of(info.getSecond(), Boolean.FALSE);
}
return null;
@@ -871,149 +855,149 @@
@Override
public boolean bindService(Intent arg0, ServiceConnection arg1, int arg2) {
- // TODO Auto-generated method stub
+ // pass
return false;
}
@Override
public int checkCallingOrSelfPermission(String arg0) {
- // TODO Auto-generated method stub
+ // pass
return 0;
}
@Override
public int checkCallingOrSelfUriPermission(Uri arg0, int arg1) {
- // TODO Auto-generated method stub
+ // pass
return 0;
}
@Override
public int checkCallingPermission(String arg0) {
- // TODO Auto-generated method stub
+ // pass
return 0;
}
@Override
public int checkCallingUriPermission(Uri arg0, int arg1) {
- // TODO Auto-generated method stub
+ // pass
return 0;
}
@Override
public int checkPermission(String arg0, int arg1, int arg2) {
- // TODO Auto-generated method stub
+ // pass
return 0;
}
@Override
public int checkUriPermission(Uri arg0, int arg1, int arg2, int arg3) {
- // TODO Auto-generated method stub
+ // pass
return 0;
}
@Override
public int checkUriPermission(Uri arg0, String arg1, String arg2, int arg3,
int arg4, int arg5) {
- // TODO Auto-generated method stub
+ // pass
return 0;
}
@Override
public void clearWallpaper() {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public Context createPackageContext(String arg0, int arg1) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public String[] databaseList() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public boolean deleteDatabase(String arg0) {
- // TODO Auto-generated method stub
+ // pass
return false;
}
@Override
public boolean deleteFile(String arg0) {
- // TODO Auto-generated method stub
+ // pass
return false;
}
@Override
public void enforceCallingOrSelfPermission(String arg0, String arg1) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void enforceCallingOrSelfUriPermission(Uri arg0, int arg1,
String arg2) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void enforceCallingPermission(String arg0, String arg1) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void enforceCallingUriPermission(Uri arg0, int arg1, String arg2) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void enforcePermission(String arg0, int arg1, int arg2, String arg3) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void enforceUriPermission(Uri arg0, int arg1, int arg2, int arg3,
String arg4) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void enforceUriPermission(Uri arg0, String arg1, String arg2,
int arg3, int arg4, int arg5, String arg6) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public String[] fileList() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public AssetManager getAssets() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public File getCacheDir() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public File getExternalCacheDir() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@@ -1027,49 +1011,49 @@
@Override
public File getDatabasePath(String arg0) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public File getDir(String arg0, int arg1) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public File getFileStreamPath(String arg0) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public File getFilesDir() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public File getExternalFilesDir(String type) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public String getPackageCodePath() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public PackageManager getPackageManager() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public String getPackageName() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@@ -1080,25 +1064,25 @@
@Override
public String getPackageResourcePath() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public File getSharedPrefsFile(String name) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public SharedPreferences getSharedPreferences(String arg0, int arg1) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public Drawable getWallpaper() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@@ -1114,81 +1098,81 @@
@Override
public void grantUriPermission(String arg0, Uri arg1, int arg2) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public FileInputStream openFileInput(String arg0) throws FileNotFoundException {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public FileOutputStream openFileOutput(String arg0, int arg1) throws FileNotFoundException {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public SQLiteDatabase openOrCreateDatabase(String arg0, int arg1, CursorFactory arg2) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public SQLiteDatabase openOrCreateDatabase(String arg0, int arg1,
CursorFactory arg2, DatabaseErrorHandler arg3) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public Drawable peekWallpaper() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public Intent registerReceiver(BroadcastReceiver arg0, IntentFilter arg1) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public Intent registerReceiver(BroadcastReceiver arg0, IntentFilter arg1,
String arg2, Handler arg3) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public void removeStickyBroadcast(Intent arg0) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void revokeUriPermission(Uri arg0, int arg1) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void sendBroadcast(Intent arg0) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void sendBroadcast(Intent arg0, String arg1) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void sendOrderedBroadcast(Intent arg0, String arg1) {
- // TODO Auto-generated method stub
+ // pass
}
@@ -1196,13 +1180,13 @@
public void sendOrderedBroadcast(Intent arg0, String arg1,
BroadcastReceiver arg2, Handler arg3, int arg4, String arg5,
Bundle arg6) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void sendStickyBroadcast(Intent arg0) {
- // TODO Auto-generated method stub
+ // pass
}
@@ -1210,68 +1194,79 @@
public void sendStickyOrderedBroadcast(Intent intent,
BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData,
Bundle initialExtras) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void setTheme(int arg0) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void setWallpaper(Bitmap arg0) throws IOException {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void setWallpaper(InputStream arg0) throws IOException {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void startActivity(Intent arg0) {
- // TODO Auto-generated method stub
+ // pass
+ }
+ @Override
+ public void startActivity(Intent arg0, Bundle arg1) {
+ // pass
}
@Override
public void startIntentSender(IntentSender intent,
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
throws IntentSender.SendIntentException {
- // TODO Auto-generated method stub
+ // pass
+ }
+
+ @Override
+ public void startIntentSender(IntentSender intent,
+ Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags,
+ Bundle options) throws IntentSender.SendIntentException {
+ // pass
}
@Override
public boolean startInstrumentation(ComponentName arg0, String arg1,
Bundle arg2) {
- // TODO Auto-generated method stub
+ // pass
return false;
}
@Override
public ComponentName startService(Intent arg0) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public boolean stopService(Intent arg0) {
- // TODO Auto-generated method stub
+ // pass
return false;
}
@Override
public void unbindService(ServiceConnection arg0) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void unregisterReceiver(BroadcastReceiver arg0) {
- // TODO Auto-generated method stub
+ // pass
}
@@ -1282,7 +1277,13 @@
@Override
public void startActivities(Intent[] arg0) {
- // TODO Auto-generated method stub
+ // pass
+
+ }
+
+ @Override
+ public void startActivities(Intent[] arg0, Bundle arg1) {
+ // pass
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java
new file mode 100644
index 0000000..6071a6b
--- /dev/null
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.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.layoutlib.bridge.android;
+
+import android.os.IBinder;
+import android.os.IPowerManager;
+import android.os.RemoteException;
+import android.os.WorkSource;
+
+/**
+ * Fake implementation of IPowerManager.
+ *
+ */
+public class BridgePowerManager implements IPowerManager {
+
+ @Override
+ public boolean isScreenOn() throws RemoteException {
+ return true;
+ }
+
+ @Override
+ public IBinder asBinder() {
+ // pass for now.
+ return null;
+ }
+
+ @Override
+ public void acquireWakeLock(int arg0, IBinder arg1, String arg2, WorkSource arg3)
+ throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void clearUserActivityTimeout(long arg0, long arg1) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void crash(String arg0) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public int getSupportedWakeLockFlags() throws RemoteException {
+ // pass for now.
+ return 0;
+ }
+
+ @Override
+ public void goToSleep(long arg0) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void goToSleepWithReason(long arg0, int arg1) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void preventScreenOn(boolean arg0) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void reboot(String arg0) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void releaseWakeLock(IBinder arg0, int arg1) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void setAttentionLight(boolean arg0, int arg1) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void setAutoBrightnessAdjustment(float arg0) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void setBacklightBrightness(int arg0) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void setMaximumScreenOffTimeount(int arg0) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void setPokeLock(int arg0, IBinder arg1, String arg2) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void setStayOnSetting(int arg0) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void updateWakeLockWorkSource(IBinder arg0, WorkSource arg1) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void userActivity(long arg0, boolean arg1) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void userActivityWithForce(long arg0, boolean arg1, boolean arg2) throws RemoteException {
+ // pass for now.
+ }
+}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/DynamicIdMap.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/DynamicIdMap.java
new file mode 100644
index 0000000..a1fae95
--- /dev/null
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/DynamicIdMap.java
@@ -0,0 +1,76 @@
+/*
+ * 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.layoutlib.bridge.util;
+
+import com.android.resources.ResourceType;
+import com.android.util.Pair;
+
+import android.util.SparseArray;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class DynamicIdMap {
+
+ private final Map<Pair<ResourceType, String>, Integer> mDynamicIds = new HashMap<Pair<ResourceType, String>, Integer>();
+ private final SparseArray<Pair<ResourceType, String>> mRevDynamicIds = new SparseArray<Pair<ResourceType, String>>();
+ private int mDynamicSeed;
+
+ public DynamicIdMap(int seed) {
+ mDynamicSeed = seed;
+ }
+
+ public void reset(int seed) {
+ mDynamicIds.clear();
+ mRevDynamicIds.clear();
+ mDynamicSeed = seed;
+ }
+
+ /**
+ * Returns a dynamic integer for the given resource type/name, creating it if it doesn't
+ * already exist.
+ *
+ * @param type the type of the resource
+ * @param name the name of the resource
+ * @return an integer.
+ */
+ public Integer getId(ResourceType type, String name) {
+ return getId(Pair.of(type, name));
+ }
+
+ /**
+ * Returns a dynamic integer for the given resource type/name, creating it if it doesn't
+ * already exist.
+ *
+ * @param resource the type/name of the resource
+ * @return an integer.
+ */
+ public Integer getId(Pair<ResourceType, String> resource) {
+ Integer value = mDynamicIds.get(resource);
+ if (value == null) {
+ value = Integer.valueOf(++mDynamicSeed);
+ mDynamicIds.put(resource, value);
+ mRevDynamicIds.put(value, resource);
+ }
+
+ return value;
+ }
+
+ public Pair<ResourceType, String> resolveId(int id) {
+ return mRevDynamicIds.get(id);
+ }
+}
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
index 4b33474..170cd6a 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
@@ -183,10 +183,11 @@
*/
private final static String[] RENAMED_CLASSES =
new String[] {
- "android.os.ServiceManager", "android.os._Original_ServiceManager",
- "android.view.SurfaceView", "android.view._Original_SurfaceView",
+ "android.os.ServiceManager", "android.os._Original_ServiceManager",
+ "android.view.SurfaceView", "android.view._Original_SurfaceView",
"android.view.accessibility.AccessibilityManager", "android.view.accessibility._Original_AccessibilityManager",
- "android.webkit.WebView", "android.webkit._Original_WebView",
+ "android.webkit.WebView", "android.webkit._Original_WebView",
+ "com.android.internal.policy.PolicyManager", "com.android.internal.policy._Original_PolicyManager",
};
/**
diff --git a/voip/jni/rtp/Android.mk b/voip/jni/rtp/Android.mk
index 0815294..d725713 100644
--- a/voip/jni/rtp/Android.mk
+++ b/voip/jni/rtp/Android.mk
@@ -37,6 +37,7 @@
libcutils \
libutils \
libmedia \
+ libmedia_native \
libstagefright_amrnb_common
LOCAL_STATIC_LIBRARIES := libgsm libstagefright_amrnbdec libstagefright_amrnbenc
@@ -50,7 +51,7 @@
frameworks/base/media/libstagefright/codecs/amrnb/enc/src \
frameworks/base/media/libstagefright/codecs/amrnb/dec/include \
frameworks/base/media/libstagefright/codecs/amrnb/dec/src \
- system/media/audio_effects/include
+ $(call include-path-for, audio-effects)
LOCAL_CFLAGS += -fvisibility=hidden
diff --git a/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java b/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java
index 5c9bef9..f31ee68 100644
--- a/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java
@@ -113,11 +113,14 @@
private static final int RSSI_MONITOR_COUNT = 5;
private int mRssiMonitorCount = 0;
- /* Avoid flapping */
- private static final int MIN_INTERVAL_AVOID_BSSID_MS = 60 * 1000;
- private String mLastAvoidedBssid;
- /* a -ve interval to allow avoidance at boot */
- private long mLastBssidAvoidedTime = -MIN_INTERVAL_AVOID_BSSID_MS;
+ /* Avoid flapping. The interval is changed over time as long as we continue to avoid
+ * under the max interval after which we reset the interval again */
+ private static final int MIN_INTERVAL_AVOID_BSSID_MS[] = {0, 30 * 1000, 60 * 1000,
+ 5 * 60 * 1000, 30 * 60 * 1000};
+ /* Index into the interval array MIN_INTERVAL_AVOID_BSSID_MS */
+ private int mMinIntervalArrayIndex = 0;
+
+ private long mLastBssidAvoidedTime;
private int mCurrentSignalLevel;
@@ -744,11 +747,13 @@
mCurrentSignalLevel = calculateSignalLevel(msg.arg1);
//Ready to avoid bssid again ?
long time = android.os.SystemClock.elapsedRealtime();
- if (time - mLastBssidAvoidedTime > MIN_INTERVAL_AVOID_BSSID_MS) {
+ if (time - mLastBssidAvoidedTime > MIN_INTERVAL_AVOID_BSSID_MS[
+ mMinIntervalArrayIndex]) {
handleRssiChange();
} else {
if (DBG) log("Early to avoid " + mWifiInfo + " time: " + time +
- " last avoided: " + mLastBssidAvoidedTime);
+ " last avoided: " + mLastBssidAvoidedTime +
+ " mMinIntervalArrayIndex: " + mMinIntervalArrayIndex);
}
break;
default:
@@ -892,7 +897,20 @@
private void sendPoorLinkDetected() {
if (DBG) log("send POOR_LINK_DETECTED " + mWifiInfo);
mWsmChannel.sendMessage(POOR_LINK_DETECTED);
- mLastAvoidedBssid = mWifiInfo.getBSSID();
+
+ long time = android.os.SystemClock.elapsedRealtime();
+ if (time - mLastBssidAvoidedTime > MIN_INTERVAL_AVOID_BSSID_MS[
+ MIN_INTERVAL_AVOID_BSSID_MS.length - 1]) {
+ mMinIntervalArrayIndex = 1;
+ if (DBG) log("set mMinIntervalArrayIndex to 1");
+ } else {
+
+ if (mMinIntervalArrayIndex < MIN_INTERVAL_AVOID_BSSID_MS.length - 1) {
+ mMinIntervalArrayIndex++;
+ }
+ if (DBG) log("mMinIntervalArrayIndex: " + mMinIntervalArrayIndex);
+ }
+
mLastBssidAvoidedTime = android.os.SystemClock.elapsedRealtime();
}