diff options
179 files changed, 2536 insertions, 249 deletions
diff --git a/api/current.xml b/api/current.xml index bb1f871..ce1b726 100644 --- a/api/current.xml +++ b/api/current.xml @@ -71065,6 +71065,17 @@ visibility="public" > </constructor> +<method name="getAudioSourceMax" + return="int" + abstract="false" + native="false" + synchronized="false" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</method> <method name="getMaxAmplitude" return="int" abstract="false" @@ -71466,6 +71477,39 @@ visibility="public" > </field> +<field name="VOICE_CALL" + type="int" + transient="false" + volatile="false" + value="4" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="VOICE_DOWNLINK" + type="int" + transient="false" + volatile="false" + value="3" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="VOICE_UPLINK" + type="int" + transient="false" + volatile="false" + value="2" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> </class> <interface name="MediaRecorder.OnErrorListener" abstract="true" diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 1e15d14..06e0a45 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -1513,6 +1513,18 @@ public final class ActivityThread { queueOrSendMessage(H.PROFILER_CONTROL, path, start ? 1 : 0); } + public void setSchedulingGroup(int group) { + // Note: do this immediately, since going into the foreground + // should happen regardless of what pending work we have to do + // and the activity manager will wait for us to report back that + // we are done before sending us to the background. + try { + Process.setProcessGroup(Process.myPid(), group); + } catch (Exception e) { + Log.w(TAG, "Failed setting process group to " + group, e); + } + } + @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { long nativeMax = Debug.getNativeHeapSize() / 1024; diff --git a/core/java/android/app/ApplicationErrorReport.java b/core/java/android/app/ApplicationErrorReport.java index 72cbff4..0c8f95d 100644 --- a/core/java/android/app/ApplicationErrorReport.java +++ b/core/java/android/app/ApplicationErrorReport.java @@ -18,7 +18,6 @@ package android.app; import android.os.Parcel; import android.os.Parcelable; -import android.util.Log; import android.util.Printer; /** @@ -103,20 +102,7 @@ public class ApplicationErrorReport implements Parcelable { * a parcel. */ ApplicationErrorReport(Parcel in) { - type = in.readInt(); - packageName = in.readString(); - installerPackageName = in.readString(); - processName = in.readString(); - time = in.readLong(); - - switch (type) { - case TYPE_CRASH: - crashInfo = new CrashInfo(in); - break; - case TYPE_ANR: - anrInfo = new AnrInfo(in); - break; - } + readFromParcel(in); } public void writeToParcel(Parcel dest, int flags) { @@ -136,6 +122,25 @@ public class ApplicationErrorReport implements Parcelable { } } + public void readFromParcel(Parcel in) { + type = in.readInt(); + packageName = in.readString(); + installerPackageName = in.readString(); + processName = in.readString(); + time = in.readLong(); + + switch (type) { + case TYPE_CRASH: + crashInfo = new CrashInfo(in); + anrInfo = null; + break; + case TYPE_ANR: + anrInfo = new AnrInfo(in); + crashInfo = null; + break; + } + } + /** * Describes an application crash. */ diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java index bcc9302..f243185 100644 --- a/core/java/android/app/ApplicationThreadNative.java +++ b/core/java/android/app/ApplicationThreadNative.java @@ -331,6 +331,14 @@ public abstract class ApplicationThreadNative extends Binder profilerControl(start, path); return true; } + + case SET_SCHEDULING_GROUP_TRANSACTION: + { + data.enforceInterface(IApplicationThread.descriptor); + int group = data.readInt(); + setSchedulingGroup(group); + return true; + } } return super.onTransact(code, data, reply, flags); @@ -672,5 +680,14 @@ class ApplicationThreadProxy implements IApplicationThread { IBinder.FLAG_ONEWAY); data.recycle(); } + + public void setSchedulingGroup(int group) throws RemoteException { + Parcel data = Parcel.obtain(); + data.writeInterfaceToken(IApplicationThread.descriptor); + data.writeInt(group); + mRemote.transact(SET_SCHEDULING_GROUP_TRANSACTION, data, null, + IBinder.FLAG_ONEWAY); + data.recycle(); + } } diff --git a/core/java/android/app/IApplicationThread.java b/core/java/android/app/IApplicationThread.java index 9f3534b..ec03d3a 100644 --- a/core/java/android/app/IApplicationThread.java +++ b/core/java/android/app/IApplicationThread.java @@ -87,7 +87,8 @@ public interface IApplicationThread extends IInterface { void scheduleActivityConfigurationChanged(IBinder token) throws RemoteException; void requestPss() throws RemoteException; void profilerControl(boolean start, String path) throws RemoteException; - + void setSchedulingGroup(int group) throws RemoteException; + String descriptor = "android.app.IApplicationThread"; int SCHEDULE_PAUSE_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION; @@ -117,4 +118,5 @@ public interface IApplicationThread extends IInterface { int SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+25; int REQUEST_PSS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+26; int PROFILER_CONTROL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+27; + int SET_SCHEDULING_GROUP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+28; } diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java index aaaf7bf..ff110c8 100644 --- a/core/java/android/app/SearchDialog.java +++ b/core/java/android/app/SearchDialog.java @@ -49,6 +49,7 @@ import android.text.TextUtils; import android.text.TextWatcher; import android.util.AttributeSet; import android.util.Log; +import android.view.ContextThemeWrapper; import android.view.Gravity; import android.view.KeyEvent; import android.view.MotionEvent; @@ -165,7 +166,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS * @param context Application Context we can use for system acess */ public SearchDialog(Context context) { - super(context, com.android.internal.R.style.Theme_SearchBar); + super(context, com.android.internal.R.style.Theme_GlobalSearchBar); } /** @@ -393,6 +394,21 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS getContext().getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInputUnchecked(0, null); } + + // The Dialog uses a ContextThemeWrapper for the context; use this to change the + // theme out from underneath us, between the global search theme and the in-app + // search theme. They are identical except that the global search theme does not + // dim the background of the window (because global search is full screen so it's + // not needed and this should save a little bit of time on global search invocation). + Object context = getContext(); + if (context instanceof ContextThemeWrapper) { + ContextThemeWrapper wrapper = (ContextThemeWrapper) context; + if (globalSearch) { + wrapper.setTheme(com.android.internal.R.style.Theme_GlobalSearchBar); + } else { + wrapper.setTheme(com.android.internal.R.style.Theme_SearchBar); + } + } show(); } diff --git a/core/java/android/app/SuggestionsAdapter.java b/core/java/android/app/SuggestionsAdapter.java index 2fe9a8d..aeb96b4 100644 --- a/core/java/android/app/SuggestionsAdapter.java +++ b/core/java/android/app/SuggestionsAdapter.java @@ -240,6 +240,14 @@ class SuggestionsAdapter extends ResourceCursorAdapter { v.setVisibility(View.GONE); } else { v.setVisibility(View.VISIBLE); + + // This is a hack to get any animated drawables (like a 'working' spinner) + // to animate. You have to setVisible true on an AnimationDrawable to get + // it to start animating, but it must first have been false or else the + // call to setVisible will be ineffective. We need to clear up the story + // about animated drawables in the future, see http://b/1878430. + drawable.setVisible(false, false); + drawable.setVisible(true, false); } } diff --git a/core/java/android/database/sqlite/SQLiteQueryBuilder.java b/core/java/android/database/sqlite/SQLiteQueryBuilder.java index ab7c827..8a63919 100644 --- a/core/java/android/database/sqlite/SQLiteQueryBuilder.java +++ b/core/java/android/database/sqlite/SQLiteQueryBuilder.java @@ -18,16 +18,15 @@ package android.database.sqlite; import android.database.Cursor; import android.database.DatabaseUtils; -import android.database.sqlite.SQLiteDatabase; import android.provider.BaseColumns; import android.text.TextUtils; -import android.util.Config; import android.util.Log; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.Map.Entry; +import java.util.regex.Pattern; /** * This is a convience class that helps build SQL queries to be sent to @@ -36,10 +35,12 @@ import java.util.Map.Entry; public class SQLiteQueryBuilder { private static final String TAG = "SQLiteQueryBuilder"; + private static final Pattern sLimitPattern = + Pattern.compile("\\s*\\d+\\s*(,\\s*\\d+\\s*)?"); private Map<String, String> mProjectionMap = null; private String mTables = ""; - private StringBuilder mWhereClause = new StringBuilder(64); + private final StringBuilder mWhereClause = new StringBuilder(64); private boolean mDistinct; private SQLiteDatabase.CursorFactory mFactory; @@ -169,6 +170,9 @@ public class SQLiteQueryBuilder throw new IllegalArgumentException( "HAVING clauses are only permitted when using a groupBy clause"); } + if (!TextUtils.isEmpty(limit) && !sLimitPattern.matcher(limit).matches()) { + throw new IllegalArgumentException("invalid LIMIT clauses:" + limit); + } StringBuilder query = new StringBuilder(120); @@ -187,7 +191,7 @@ public class SQLiteQueryBuilder appendClause(query, " GROUP BY ", groupBy); appendClause(query, " HAVING ", having); appendClause(query, " ORDER BY ", orderBy); - appendClauseEscapeClause(query, " LIMIT ", limit); + appendClause(query, " LIMIT ", limit); return query.toString(); } diff --git a/core/java/android/gesture/LetterRecognizer.java b/core/java/android/gesture/LetterRecognizer.java index b26b3f2..9e801ed 100644 --- a/core/java/android/gesture/LetterRecognizer.java +++ b/core/java/android/gesture/LetterRecognizer.java @@ -153,6 +153,10 @@ public class LetterRecognizer { case 1: classifier = readV1(in); break; + default: + Log.d(LOG_TAG, "Couldn't load handwriting data: version " + version + + " not supported"); + break; } } catch (IOException e) { diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index bd45978..559f224 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -2593,6 +2593,16 @@ public final class Settings { public static final String GTALK_COMPRESS = "gtalk_compress"; /** + * This is the timeout for which Google Talk will send the message using bareJID. In a + * established chat between two XMPP endpoints, Google Talk uses fullJID in the format + * of user@domain/resource in order to send the message to the specific client. However, + * if Google Talk hasn't received a message from that client after some time, it would + * fall back to use the bareJID, which would broadcast the message to all clients for + * the other user. + */ + public static final String GTALK_USE_BARE_JID_TIMEOUT_MS = "gtalk_use_barejid_timeout_ms"; + + /** * Enable use of ssl session caching. * 'db' - save each session in a (per process) database * 'file' - save each session in a (per process) file diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index ccb876f..3c827a0 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -755,19 +755,21 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te if (ev.getAction() != MotionEvent.ACTION_DOWN || mFastScroller == null || !mFastScroller.isPointInside(ev.getX(), ev.getY())) { - mGesturesOverlay.dispatchTouchEvent(ev); - - final boolean isGesturing = mGesturesOverlay.isGesturing(); - - if (!isGesturing) { - mPreviousGesturing = isGesturing; - return super.dispatchTouchEvent(ev); - } else if (!mPreviousGesturing){ - mPreviousGesturing = isGesturing; - final MotionEvent event = MotionEvent.obtain(ev); - event.setAction(MotionEvent.ACTION_CANCEL); - super.dispatchTouchEvent(event); - return true; + if (mGesturesPopup.isShowing()) { + mGesturesOverlay.dispatchTouchEvent(ev); + + final boolean isGesturing = mGesturesOverlay.isGesturing(); + + if (!isGesturing) { + mPreviousGesturing = isGesturing; + return super.dispatchTouchEvent(ev); + } else if (!mPreviousGesturing){ + mPreviousGesturing = isGesturing; + final MotionEvent event = MotionEvent.obtain(ev); + event.setAction(MotionEvent.ACTION_CANCEL); + super.dispatchTouchEvent(event); + return true; + } } } } @@ -1927,6 +1929,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te final int longPressPosition, final long longPressId) { boolean handled = false; + dismissGesturesPopup(); + if (mOnItemLongClickListener != null) { handled = mOnItemLongClickListener.onItemLongClick(AbsListView.this, child, longPressPosition, longPressId); @@ -3860,6 +3864,10 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te GesturesProcessor() { mRecognizer = LetterRecognizer.getLetterRecognizer(getContext(), LetterRecognizer.RECOGNIZER_LATIN_LOWERCASE); + if (mRecognizer == null) { + dismissGesturesPopup(); + mGestures = GESTURES_NONE; + } if (mGestures == GESTURES_FILTER) { mKeyMap = KeyCharacterMap.load(KeyCharacterMap.BUILT_IN_KEYBOARD); mHolder = new char[1]; diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java index a448ac6..51f3b02 100644 --- a/core/java/com/android/internal/os/BatteryStatsImpl.java +++ b/core/java/com/android/internal/os/BatteryStatsImpl.java @@ -53,7 +53,7 @@ public final class BatteryStatsImpl extends BatteryStats { private static final int MAGIC = 0xBA757475; // 'BATSTATS' // Current on-disk Parcel version - private static final int VERSION = 36; + private static final int VERSION = 37; private final File mFile; private final File mBackupFile; @@ -3014,6 +3014,8 @@ public final class BatteryStatsImpl extends BatteryStats { u.mWifiTurnedOnTimer.writeSummaryFromParcelLocked(out, NOWREAL); u.mFullWifiLockTimer.writeSummaryFromParcelLocked(out, NOWREAL); + u.mAudioTurnedOnTimer.writeSummaryFromParcelLocked(out, NOWREAL); + u.mVideoTurnedOnTimer.writeSummaryFromParcelLocked(out, NOWREAL); u.mScanWifiLockTimer.writeSummaryFromParcelLocked(out, NOWREAL); u.mWifiMulticastTimer.writeSummaryFromParcelLocked(out, NOWREAL); diff --git a/core/jni/Android.mk b/core/jni/Android.mk index d46dd80..ed8deb1 100644 --- a/core/jni/Android.mk +++ b/core/jni/Android.mk @@ -165,8 +165,7 @@ LOCAL_SHARED_LIBRARIES := \ libicui18n \ libicudata \ libmedia \ - libwpa_client \ - libemoji + libwpa_client ifeq ($(BOARD_HAVE_BLUETOOTH),true) LOCAL_C_INCLUDES += \ diff --git a/core/jni/android_emoji_EmojiFactory.cpp b/core/jni/android_emoji_EmojiFactory.cpp index 59f63a8..7d6e24f 100644 --- a/core/jni/android_emoji_EmojiFactory.cpp +++ b/core/jni/android_emoji_EmojiFactory.cpp @@ -1,7 +1,7 @@ #include "SkTypes.h" #include "SkImageDecoder.h" -#define LOG_TAG "DoCoMoEmojiFactory_jni" +#define LOG_TAG "EmojiFactory_jni" #include <utils/Log.h> #include <utils/String8.h> @@ -13,15 +13,11 @@ namespace android { -// Note: This class is originally developed so that libandroid_runtime does -// not have to depend on libemoji which is optional library. However, we -// cannot use this class, since current (2009-02-16) bionic libc does not allow -// dlopen()-ing inside dlopen(), while not only this class but also libemoji -// uses dlopen(). class EmojiFactoryCaller { public: - EmojiFactoryCaller(); + EmojiFactoryCaller() {} virtual ~EmojiFactoryCaller(); + bool Init(); EmojiFactory *TryCallGetImplementation(const char* name); EmojiFactory *TryCallGetAvailableImplementation(); private: @@ -30,35 +26,45 @@ class EmojiFactoryCaller { EmojiFactory *(*m_get_available_implementation)(); }; -EmojiFactoryCaller::EmojiFactoryCaller() { +bool EmojiFactoryCaller::Init() { + const char* error_msg; m_handle = dlopen("libemoji.so", RTLD_LAZY | RTLD_LOCAL); - const char* error_str = dlerror(); - if (error_str) { - LOGI("Failed to load libemoji.so: %s", error_str); - return; + + if (m_handle == NULL) { + error_msg = "Failed to load libemoji.so"; + goto FAIL; } m_get_implementation = reinterpret_cast<EmojiFactory *(*)(const char*)>( dlsym(m_handle, "GetImplementation")); - error_str = dlerror(); - if (error_str) { - LOGE("Failed to get symbol of GetImplementation: %s", error_str); - dlclose(m_handle); - m_handle = NULL; - return; + if (m_get_implementation == NULL) { + error_msg = "Failed to get symbol of GetImplementation"; + goto FAIL; } m_get_available_implementation = reinterpret_cast<EmojiFactory *(*)()>( dlsym(m_handle,"GetAvailableImplementation")); - error_str = dlerror(); - if (error_str) { - LOGE("Failed to get symbol of GetAvailableImplementation: %s", error_str); + if (m_get_available_implementation == NULL) { + error_msg = "Failed to get symbol of GetAvailableImplementation"; + goto FAIL; + } + + return true; + +FAIL: + const char* error_str = dlerror(); + if (error_str == NULL) { + error_str = "unknown reason"; + } + + LOGE("%s: %s", error_msg, error_str); + if (m_handle != NULL) { dlclose(m_handle); m_handle = NULL; - return; } + return false; } EmojiFactoryCaller::~EmojiFactoryCaller() { @@ -82,10 +88,9 @@ EmojiFactory *EmojiFactoryCaller::TryCallGetAvailableImplementation() { return m_get_available_implementation(); } -// Note: bionic libc's dlopen() does not allow recursive dlopen(). So currently -// we cannot use EmojiFactoryCaller here. -// static EmojiFactoryCaller* gCaller; -// static pthread_once_t g_once = PTHREAD_ONCE_INIT; +static EmojiFactoryCaller* gCaller; +static pthread_once_t g_once = PTHREAD_ONCE_INIT; +static bool lib_emoji_factory_is_ready; static jclass gString_class; @@ -95,9 +100,10 @@ static jmethodID gBitmap_constructorMethodID; static jclass gEmojiFactory_class; static jmethodID gEmojiFactory_constructorMethodID; -// static void InitializeCaller() { -// gCaller = new EmojiFactoryCaller(); -// } +static void InitializeCaller() { + gCaller = new EmojiFactoryCaller(); + lib_emoji_factory_is_ready = gCaller->Init(); +} static jobject create_java_EmojiFactory( JNIEnv* env, EmojiFactory* factory, jstring name) { @@ -116,19 +122,23 @@ static jobject create_java_EmojiFactory( static jobject android_emoji_EmojiFactory_newInstance( JNIEnv* env, jobject clazz, jstring name) { - // pthread_once(&g_once, InitializeCaller); - if (NULL == name) { return NULL; } + pthread_once(&g_once, InitializeCaller); + if (!lib_emoji_factory_is_ready) { + return NULL; + } const jchar* jchars = env->GetStringChars(name, NULL); jsize len = env->GetStringLength(name); String8 str(String16(jchars, len)); - // EmojiFactory *factory = gCaller->TryCallGetImplementation(str.string()); - EmojiFactory *factory = EmojiFactory::GetImplementation(str.string()); - + EmojiFactory *factory = gCaller->TryCallGetImplementation(str.string()); + // EmojiFactory *factory = EmojiFactory::GetImplementation(str.string()); + if (NULL == factory) { + return NULL; + } env->ReleaseStringChars(name, jchars); return create_java_EmojiFactory(env, factory, name); @@ -136,10 +146,13 @@ static jobject android_emoji_EmojiFactory_newInstance( static jobject android_emoji_EmojiFactory_newAvailableInstance( JNIEnv* env, jobject clazz) { - // pthread_once(&g_once, InitializeCaller); + pthread_once(&g_once, InitializeCaller); + if (!lib_emoji_factory_is_ready) { + return NULL; + } - // EmojiFactory *factory = gCaller->TryCallGetAvailableImplementation(); - EmojiFactory *factory = EmojiFactory::GetAvailableImplementation(); + EmojiFactory *factory = gCaller->TryCallGetAvailableImplementation(); + // EmojiFactory *factory = EmojiFactory::GetAvailableImplementation(); if (NULL == factory) { return NULL; } diff --git a/core/jni/android_media_AudioRecord.cpp b/core/jni/android_media_AudioRecord.cpp index 288433a..e71e348 100644 --- a/core/jni/android_media_AudioRecord.cpp +++ b/core/jni/android_media_AudioRecord.cpp @@ -45,8 +45,6 @@ struct fields_t { jmethodID postNativeEventInJava; //... event post callback method int PCM16; //... format constants int PCM8; //... format constants - int SOURCE_DEFAULT; //... record source constants - int SOURCE_MIC; //... record source constants jfieldID nativeRecorderInJavaObj; // provides access to the C++ AudioRecord object jfieldID nativeCallbackCookie; // provides access to the AudioRecord callback data }; @@ -66,7 +64,7 @@ struct audiorecord_callback_cookie { #define AUDIORECORD_ERROR_SETUP_ZEROFRAMECOUNT -16 #define AUDIORECORD_ERROR_SETUP_INVALIDCHANNELCOUNT -17 #define AUDIORECORD_ERROR_SETUP_INVALIDFORMAT -18 -#define AUDIORECORD_ERROR_SETUP_INVALIDSTREAMTYPE -19 +#define AUDIORECORD_ERROR_SETUP_INVALIDSOURCE -19 #define AUDIORECORD_ERROR_SETUP_NATIVEINITFAILED -20 jint android_media_translateRecorderErrorCode(int code) { @@ -154,17 +152,16 @@ android_media_AudioRecord_setup(JNIEnv *env, jobject thiz, jobject weak_this, int frameSize = nbChannels * bytesPerSample; size_t frameCount = buffSizeInBytes / frameSize; - // compare the source against the Java constants - AudioRecord::stream_type arSource; - if (source == javaAudioRecordFields.SOURCE_DEFAULT) { - arSource = AudioRecord::DEFAULT_INPUT; - } else if (source == javaAudioRecordFields.SOURCE_MIC) { - arSource = AudioRecord::MIC_INPUT; - } else { + // convert and check input source value + // input_source values defined in AudioRecord.h are equal to + // JAVA MediaRecord.AudioSource values minus 1. + AudioRecord::input_source arSource = (AudioRecord::input_source)(source - 1); + if (arSource < AudioRecord::DEFAULT_INPUT || + arSource >= AudioRecord::NUM_INPUT_SOURCES) { LOGE("Error creating AudioRecord: unknown source."); - return AUDIORECORD_ERROR_SETUP_INVALIDSTREAMTYPE; + return AUDIORECORD_ERROR_SETUP_INVALIDSOURCE; } - + audiorecord_callback_cookie *lpCallbackData = NULL; AudioRecord* lpRecorder = NULL; @@ -511,8 +508,6 @@ static JNINativeMethod gMethods[] = { #define JAVA_POSTEVENT_CALLBACK_NAME "postEventFromNative" #define JAVA_CONST_PCM16_NAME "ENCODING_PCM_16BIT" #define JAVA_CONST_PCM8_NAME "ENCODING_PCM_8BIT" -#define JAVA_CONST_SOURCEDEFAULT_NAME "SOURCE_DEFAULT" -#define JAVA_CONST_SOURCEMIC_NAME "SOURCE_MIC" #define JAVA_NATIVERECORDERINJAVAOBJ_FIELD_NAME "mNativeRecorderInJavaObj" #define JAVA_NATIVECALLBACKINFO_FIELD_NAME "mNativeCallbackCookie" @@ -583,17 +578,6 @@ int register_android_media_AudioRecord(JNIEnv *env) return -1; } - // Get the recording source constants from the AudioRecord class - if ( !android_media_getIntConstantFromClass(env, javaAudioRecordFields.audioRecordClass, - kClassPathName, - JAVA_CONST_SOURCEDEFAULT_NAME, &(javaAudioRecordFields.SOURCE_DEFAULT)) - || !android_media_getIntConstantFromClass(env, javaAudioRecordFields.audioRecordClass, - kClassPathName, - JAVA_CONST_SOURCEMIC_NAME, &(javaAudioRecordFields.SOURCE_MIC)) ) { - // error log performed in getIntConstantFromClass() - return -1; - } - return AndroidRuntime::registerNativeMethods(env, kClassPathName, gMethods, NELEM(gMethods)); } diff --git a/core/jni/android_net_wifi_Wifi.cpp b/core/jni/android_net_wifi_Wifi.cpp index 25670df..9f93e2f 100644 --- a/core/jni/android_net_wifi_Wifi.cpp +++ b/core/jni/android_net_wifi_Wifi.cpp @@ -317,8 +317,13 @@ static jint android_net_wifi_getRssiCommand(JNIEnv* env, jobject clazz) } // reply comes back in the form "<SSID> rssi XX" where XX is the // number we're interested in. if we're associating, it returns "OK". + // beware - <SSID> can contain spaces. if (strcmp(reply, "OK") != 0) { - sscanf(reply, "%*s %*s %d", &rssi); + char* lastSpace = strrchr(reply, ' '); + // lastSpace should be preceded by "rssi" and followed by the value + if (lastSpace && !strncmp(lastSpace - 4, "rssi", 4)) { + sscanf(lastSpace + 1, "%d", &rssi); + } } return (jint)rssi; } diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml index 00dc6fa..1c87220 100644 --- a/core/res/res/values/themes.xml +++ b/core/res/res/values/themes.xml @@ -368,6 +368,12 @@ <item name="android:backgroundDimEnabled">true</item> <item name="windowContentOverlay">@null</item> </style> + + <!-- Theme for the search input bar when doing global search. The only + difference from non-global search is that we do not dim the background. --> + <style name="Theme.GlobalSearchBar" parent="Theme.Panel"> + <item name="windowContentOverlay">@null</item> + </style> <!-- Menu Themes --> <eat-comment /> diff --git a/docs/html/guide/guide_toc.cs b/docs/html/guide/guide_toc.cs index a044cea..da5192a 100644 --- a/docs/html/guide/guide_toc.cs +++ b/docs/html/guide/guide_toc.cs @@ -146,6 +146,7 @@ <li class="toggle-list"> <div><a href="<?cs var:toroot ?>guide/practices/ui_guidelines/index.html">UI Guidelines</a></div> <ul> + <li><a href="<?cs var:toroot ?>guide/practices/ui_guidelines/icon_design.html">Icon Design</a></li> <li><a href="<?cs var:toroot ?>guide/practices/ui_guidelines/widget_design.html">App Widget Design</a></li> </ul> </li> diff --git a/docs/html/guide/practices/ui_guidelines/icon_design.jd b/docs/html/guide/practices/ui_guidelines/icon_design.jd new file mode 100644 index 0000000..155684a --- /dev/null +++ b/docs/html/guide/practices/ui_guidelines/icon_design.jd @@ -0,0 +1,1406 @@ +page.title=Icon Design Guidelines +@jd:body + +<div id="qv-wrapper"> +<div id="qv"> + +<h2>Icon design quickview</h2> + +<ul> +<li>You can use several types of icons in an Android application.</li> +<li>Your icons should follow the specification in this document.</li> +<li>A set of standard icons is provided by the Android platform. Your +application can use the standard icons by referencing them as resources.</li> +</ul> + +<h2>In this document</h2> + +<ol> +<li><a href="#launcherstructure">Launcher icon</a></li> +<li><a href="#menustructure">Menu icon</a></li> +<li><a href="#statusbarstructure">Status bar icon</a></li> +<li><a href="#tabstructure">Tab icon</a></li> +<li><a href="#dialogstructure">Dialog icon</a></li> +<li><a href="#listviewstructure">List view icon</a></li> + +<li style="margin-top:4px;"><a href="#dodonts">General guidelines</a></li> +<li><a href="#templatespack">Using the Icon Templates Pack</a></li> +<li><a href="#file">Icon appendix</a> + <ol> + <li><a href="#launcherapx">Launcher icons</a></li> + <li><a href="#menuapx">Menu icons</a></li> + <li><a href="#statusbarapx">Status bar icons</a></li> + </ol> +</li> + +</ol> + +<h2>See also</h2> + +<ol> +<li><a href="{@docRoot}shareables/icon_templates-v1.0.zip">Android Icon +Templates Pack »</a></li> +</ol> + +</div> +</div> + +<p>Creating a unified look and feel throughout a user interface adds value to +your product. Streamlining the graphic style will also make the UI seem more +professional to the user.</p> + +<p>This document shows you how to create icons for various parts +of your application’s user interface that fit the style set by the Android UI +team. Following these guidelines will help you to create a polished and unified +experience for the user.</p> + +<p>To get started creating conforming icons more quickly, you can download +the Android Icon Templates Pack. For more information, see +<a href="#templatespack">Using the Android Icon Template Pack</a>.</p> + +<h2 id="launcherstructure">Launcher icon</h2> + +<p>A launcher icon is the graphic that represents your application on an Android +device’s Home screen. It is a simplified 3D icon with a fixed perspective. The +required perspective is shown in Figure 1.</p> + +<h4 id="launcherstructure">Structure</h4> + +<ul> +<li>The base of a launcher icon can face either the top view or the front +view.</li> + +<li>The majority of a launcher icon’s surface should be created using the +launcher icon <a href="#launcherpalette">color palette</a>. To add emphasis, use +one or more bright accent colors to highlight specific characteristics.</li> + +<li>All launcher icons must be created with rounded corners to make them look +friendly and simple—as shown in Figure 2.</li> + +<li>All dimensions specified are based on a 250x250 pixel artboard size +in a vector graphics editor like Adobe Illustrator, where the icon fits within +the artboard boundaries.</li> + +<li><strong>Final art must be scaled down and exported as a transparent 48x48 px +PNG file using a raster image editor such as Adobe Photoshop.</strong></li> + +<li>Templates for creating launcher icons in Adobe Illustrator and Photoshop are +available in the Icon Templates Pack.</li> +</ul> + +<table class="image-caption"> +<tr> +<td class="image-caption-i" style="padding-right:0"> + <img src="{@docRoot}images/icon_design/launcher_structure.png" alt="A view of +launcher icon corners and perspective angles" /> +</td> +<td class="image-caption-c"> + <div class="caption grad-rule-top"> + <p><strong>Figure 1.</strong> Perspective angles for launcher icons (90° is +vertical).</p> + <div class="image-caption-nested"> + <table style="margin-top:0;"> + <tr><td style="padding-right:1em"><em>1.</em></td><td>92°</td></tr> + <tr><td><em>2.</em></td><td>92°</td></tr> + <tr><td><em>3.</em></td><td>173°</td></tr> + <tr><td><em>4.</em></td><td>171°</td></tr> + <tr><td><em>5.</em></td><td>49°</td></tr> + <tr><td><em>6.</em></td><td>171°</td></tr> + <tr><td><em>7.</em></td><td>64°</td></tr> + <tr><td><em>8.</em></td><td>97°</td></tr> + <tr><td><em>9.</em></td><td>75°</td></tr> + <tr><td><em>10.</em></td><td>93°</td></tr> + <tr><td><em>11.</em></td><td>169°</td></tr> + </table> + </div> + </div> + <div class="caption grad-rule-top"> + <p><strong>Figure 2.</strong> Rounded corners for launcher icons.</p> + </div> +</td> +</tr> +</table> + +<h4 id="launcherlight">Light, effects, and shadows</h4> + +<p>Launcher icons are simplified 3D icons using light and shadows for +definition. A light source is placed slightly to the left in front of the icon, +and therefore the shadow expands to the right and back.</p> + +<table class="image-caption"> +<tr> +<td class="image-caption-i"> + <img src="{@docRoot}images/icon_design/launcher_light.png" alt="A view of +light, effects, and shadows for launcher icons."/> +</td> +<td class="image-caption-c"> + <div class="caption grad-rule-top"> + <p><strong>Figure 3. </strong>Light, effects, and shadows for launcher icons.</p> + <div class="image-caption-nested"> + <table style="margin-top:0;"> + <tr><td style="padding-right:1em"><em>1.</em></td><td>Edge highlight:</td><td>white</td></tr> + <tr><td><em>2.</em></td><td>Icon shadow:</td><td>black | 20px blur<br>50% opacity | angle 67°</td></tr> + <tr><td><em>3.</em></td><td>Front part:</td><td>Use light gradient from color palette</td></tr> + <tr><td><em>4.</em></td><td>Detail shadow:</td><td>black | 10px blur<br>75% opacity</td></tr> + <tr><td><em>5.</em></td><td> Side part:</td><td>Use medium gradient from color palette</td></tr> + </table> + </div> + </div> +</td> +</tr> +</table> + +<table style="margin:0px;padding:0px;"> +<tr> +<td style="border:0;width:350px;"> + +<h4 id="launcherpalette">Launcher icon color palette</h4> + +<table style="margin:0px;padding:0px;"> +<tr> +<td class="image-caption-i"><img src="{@docRoot}images/icon_design/launcher_palette_white.png" alt="Color palette, white" style="margin:.5em 0 0 0;" /></td> +<td class="image-caption-c" style="padding-top:.5em;">White<br>r 0 | g 0 | b 0<br>Used for highlights on edges.</td> +</tr> + +<tr> +<td class="image-caption-i"><img src="{@docRoot}images/icon_design/launcher_palette_gradient_light.png" alt="Color palette, light gradient" style="margin:.5em 0 0 0;" /></td> +<td class="image-caption-c" style="padding-top:.5em;">Light gradient<br><em>1: </em>r 0 | g 0 | b 0<br><em>2: </em>r 217 | g 217 | b 217<br>Used on the front (lit) part of the icon.</td> +</tr> + +<tr> +<td class="image-caption-i"><img src="{@docRoot}images/icon_design/launcher_palette_gradient_medium.png" alt="Color palette, medium gradien" style="margin:.5em 0 0 0;" /></td> +<td class="image-caption-c" style="padding-top:.5em;">Medium gradient<br><em>1: </em>r 190 | g 190 | b 190<br><em>2: </em>r 115 | g 115 | b 115<br>Used on the side (shaded) part of the icon.</td> +</tr> + +<tr> +<td class="image-caption-i"><img src="{@docRoot}images/icon_design/launcher_palette_gradient_dark.png" alt="Color palette, dark gradient" style="margin:.5em 0 0 0;" /></td> +<td class="image-caption-c" style="padding-top:.5em;">Dark gradient<br><em>1: </em>r 100 | g 100 | b 100<br><em>2: </em>r 25 | g 25 | b 25<br>Used on details and parts in the shade of the icon.</td> +</tr> + +<tr> +<td class="image-caption-i"><img src="{@docRoot}images/icon_design/launcher_palette_black.png" alt="Color palette, black" style="margin:.5em 0 0 0;" /></td> +<td class="image-caption-c" style="padding-top:.5em;">Black<br>r 255 | g 255 | b 255<br>Used as base color in shadows.</td> +</tr> + +</table> + +</td> + +<td style="border:0;width:350px"> + +<h4 id="launchersteps">Step by step</h4> + +<ol> + <li>Create the basic shapes with a tool like Adobe Illustrator, using the +angles described in <a href="#launcherstructure">Launcher icon: structure</a>. +The shapes and effects must fit within a 250x250 pixel artboard.</li> + <li>Add depth to shapes by extruding them and create the rounded corners as +described for the launcher icon structure.</li> + <li>Add details and colors. Gradients should be treated as if there is a light +source placed slightly to the left in front of the icon.</li> + <li>Create the shadows with the correct angle and blur effect.</li> + <li>Import the icon into a tool like Adobe Photoshop and scale to fit an image +size of 48x48 px on a transparent background.</li> + <li>Export the icon at 48x48 as a PNG file with transparency enabled.</li> +</ol> + +</td> +</tr> +</table> + +<h2 id="menustructure">Menu icon</h2> + +<p>Menu icons are graphical elements placed in the pop-up menu shown to users +when they press the Menu button. They are drawn in a flat-front perspective. +Elements in a menu icon must not be visualized in 3D or perspective.</p> + +<h4>Structure</h4> + +<ul> +<li>In order to maintain consistency, all menu icons must use the same +primary palette and the same effects. For more information, see the +menu icon <a href="#menupalette">color palette</a>. </li> + +<li>Menu icons should include rounded corners, but only when logically +appropriate. For example, in Figure 3 the logical place for rounded corners is +the roof and not the rest of the building.</span></li> + +<li>All dimensions specified on this page are based on a 48x48 pixel artboard +size with a 6 pixel safeframe.</li> + +<li>The menu icon effect (the outer glow) described in <a +href="#menulight">Light, effects, and shadows</a> can overlap the 6px safeframe, +but only when necessary. The base shape must always stay inside the +safeframe.</li> + +<li><strong>Final art must be exported as a transparent PNG file.</strong></li> + +<li>Templates for creating menu icons in Adobe Photoshop are available in the +Icon Templates Pack.</li> +</ul> + +<table class="image-caption"> +<tr> +<td class="image-caption-i" style="padding-right:0"> + <img src="{@docRoot}images/icon_design/menu_structure.png" alt="A view of menu +icon structure." /> +</td> +<td class="image-caption-c"> + <div class="caption grad-rule-top"> + <p><strong>Figure 4. </strong>Safeframe and corner-rounding for menu +icons. Icon size is 48x48.</p> + </div> +</td> +</tr> +</table> + + +<h4 id="menulight">Light, effects, and shadows</h4> + +<p>Menu icons are flat and pictured face on. A slight deboss and some other +effects, which are shown below, are used to create depth.</p> + +<table class="image-caption"> +<tr> +<td class="image-caption-i"> + <img src="{@docRoot}images/icon_design/menu_light.png" alt="A view of light, effects, and shadows for launcher icons."/> +</td> +<td class="image-caption-c"> + <div class="caption grad-rule-top"> + <p><strong>Figure 5. </strong>Light, effects, and shadows for launcher icons.</p> + <div class="image-caption-nested"> + <table style="margin-top:0;"> + <tr><td style="padding-right:1em"><em>1.</em></td><td>Front part:</td><td>Use fill gradient from primary color palette</td></tr> + <tr><td><em>2.</em></td><td>Inner shadow:</td><td>black | 20 % opacity<br>angle 90° | distance 2px<br>size 2px</td></tr> + <tr><td><em>3.</em></td><td>Outer glow:</td><td>white | 55% opacity <br>spread 10% | size 3px</td></tr> + <tr><td><em>5.</em></td><td>Inner bevel:</td><td>depth 1% | direction down size 0px<br>angle 90° | altitude 10°<br>highlight white 70% opacity<br>shadow black 25% opacity</td></tr> + </table> + </div> + </div> +</td> +</tr> +</table> + +<table style="margin:0px;padding:0px;"> +<tr> +<td style="border:0;width:350px;"> + +<h4 id="menupalette">Color palette</h4> + +<table style="margin:0px;padding:0px;"> +<tr> +<td class="image-caption-i"><img src="{@docRoot}images/icon_design/menu_palette_white.png" alt="Color palette, white" style="margin:.5em 0 0 0;" /></td> +<td class="image-caption-c" style="padding-top:.5em;">White<br>r 0 | g 0 | b 0<br>Used for outer glow and bevel highlight.</td> +</tr> + +<tr> +<td class="image-caption-i"><img src="{@docRoot}images/icon_design/menu_palette_gradient_medium.png" alt="Color palette, medium gradient" style="margin:.5em 0 0 0;" /></td> +<td class="image-caption-c" style="padding-top:.5em;">Fill gradient<br><em>1: </em>r 163 | g 163 | b 163<br><em>2: </em>r 120 | g 120 | b 120<br>Used as color fill.</td> +</tr> + +<tr> +<td class="image-caption-i"><img src="{@docRoot}images/icon_design/menu_palette_black.png" alt="Color palette, black" style="margin:.5em 0 0 0;" /></td> +<td class="image-caption-c" style="padding-top:.5em;">Black<br>r 255 | g 255 | b 255<br>Used for inner shadow and bevel shadow.</td> +</tr> + +</table> + +</td> + +<td style="border:0;width:350px"> + +<h4 id="menusteps">Step by step</h4> + +<ol> +<li>Create the basic shapes using a tool like Adobe Illustrator.</li> +<li>Import the shape into a tool like Adobe Photoshop and scale to fit an image +of 48x48 px on a transparent background. Mind the safeframe.</li> +<li>Add the effects seen as described in Figure 5.</li> +<li>Export the icon at 48x48 as a PNG file with transparency enabled.</li> +</ol> + +</td> +</tr> +</table> + + +<h2 id="statusbarstructure">Status bar icon</h2> + +<p>Status bar icons are used to represent notifications from your application in +the status bar. Graphically, they are very similar to menu icons, but are +smaller and higher in contrast.</p> + +<h4>Structure</h4> + +<ul> +<li>Rounded corners must always be applied to the base shape and to the details +of a status bar icon shown Figure 7.</li> + +<li>All dimensions specified are based on a 25x25 pixel artboard size with a 2 +pixel safeframe.</li> + +<li>Status bar icons can overlap the safeframe to the left and right when +necessary, but must not overlap the safeframe at the top and bottom.</li> + +<li><strong>Final art must be exported as a transparent PNG file.</strong></li> + +<li>Templates for creating status bar icons using Adobe Photoshop are available +in the Icon Templates Pack.</li> +</ul> + +<table class="image-caption"> +<tr> +<td class="image-caption-i" style="padding-right:0"> + <img src="{@docRoot}images/icon_design/statusbar_structure.png" alt="A view of +status bar icon structure." /> +</td> +<td class="image-caption-c"> + <div class="caption grad-rule-top"> + <p><strong>Figure 6. </strong>Safeframe and corner-rounding for status bar +icons. Icon size is 25x25.</p> + </div> +</td> +</tr> +</table> + + +<h4 id="statusbarlight">Light, effects, and shadows</h4> + +<p>Status bar icons are slightly debossed, high in contrast, and pictured +face-on to enhance clarity at small sizes.</p> + +<table class="image-caption"> +<tr> +<td class="image-caption-i"> + <img src="{@docRoot}images/icon_design/statusbar_light.png" alt="A view of +light, effects, and shadows for launcher icons."/> +</td> +<td class="image-caption-c"> + <div class="caption grad-rule-top"> + <p><strong>Figure 7. </strong>Light, effects, and shadows for launcher icons.</p> + <div class="image-caption-nested"> + <table style="margin-top:0;"> + <tr><td style="padding-right:1em"><em>1.</em></td><td>Front part:</td><td>Use fill gradient from primary color palette</td></tr> + <tr><td><em>2.</em></td><td>Inner bevel:</td><td>depth 100% | direction down<br>size 0px | angle 90° |<br>altitude 30°<br>highlight white 75% opacity<br>shadow black 75% opacity</td></tr> + <tr><td><em>3.</em></td><td>Detail:</td><td>white</td></tr> + <tr><td><em>4.</em></td><td>Disabled detail:</td><td>grey gradient from palette<br>+ inner bevel: smooth | depth 1% | direction down | size 0px | angle 117° | <br>altitude 42° | highlight white 70% | no shadow</td></tr> + </table> + </div> + </div> +</td> +</tr> +</table> + +<table style="margin:0px;padding:0px;"> +<tr> +<td style="border:0;width:350px;"> + +<h4 id="menupalette">Color palette</h4> + +<p>Only status bar icons related to the phone function use full color; all other status bar icons should remain monochromatic.</p> + +<table style="margin:0px;padding:0px;"> +<tr> +<td class="image-caption-i"><img src="{@docRoot}images/icon_design/statusbar_palette_white.png" alt="Color palette, white" style="margin:.5em 0 0 0;" /></td> +<td class="image-caption-c" style="padding-top:.5em;">White<br>r 0 | g 0 | b 0<br>Used for details within the icons and bevel highlight.</td> +</tr> + +<tr> +<td class="image-caption-i"><img src="{@docRoot}images/icon_design/statusbar_palette_fill.png" alt="Color palette, grey gradient" style="margin:.5em 0 0 0;" /></td> +<td class="image-caption-c" style="padding-top:.5em;">Grey gradient<br><em>1: </em>r 169 | g 169 | b 169<br><em>2: </em>r 126 | g 126 | b 126<br>Used for disabled details within the icon.</td> +</tr> + +<tr> +<td class="image-caption-i"><img src="{@docRoot}images/icon_design/statusbar_palette_grey.png" alt="Color palette, fill gradient" style="margin:.5em 0 0 0;" /></td> +<td class="image-caption-c" style="padding-top:.5em;">Fill gradient<br><em>1: </em>1 r 105 | g 105 | b 105<br><em>2: </em>r 10 | g 10 | b 10<br>Used as color fill.</td> +</tr> + +<tr> +<td class="image-caption-i"><img src="{@docRoot}images/icon_design/statusbar_palette_black.png" alt="Color palette, black" style="margin:.5em 0 0 0;" /></td> +<td class="image-caption-c" style="padding-top:.5em;">Black<br>r 255 | g 255 | b 255<br>Used for bevel shadow.</td> +</tr> + +</table> + +</td> + +<td style="border:0;width:350px"> + +<h4 id="menusteps">Step by step</h4> + +<ol> +<li>In a tool like Adobe Photoshop, create the base shape within a 25x25 px +image on a transparent background. Mind the safeframe, and keep the upper and +lower 2 pixels free.</li> +<li>Add rounded corners as specified in Figure 6.</li> +<li>Add light, effects, and shadows as specified in Figure 7.</li> +<li>Export the icon at 25x25 as a PNG file with transparency enabled.</li> +</ol> + +</td> +</tr> +</table> + + +<h2 id="tabstructure">Tab icon</h2> + +<p>Tab icons are graphical elements used to represent individual tabs in a +multi-tab interface. Each tab icon has two states: unselected and selected.</p> + +<h4>Structure</h4> + +<ul> +<li>Unselected tab icons have the same fill gradient and effects as menu icons, +but with no outer glow.</li> + +<li>Selected tab icons look just like unselected tab icons, but with a fainter +inner shadow, and have the same front part gradient as dialog icons.</li> + +<li>Tab icons have a 1 px safeframe which should only be overlapped for the edge +of the anti-alias of a round shape.</li> + +<li>All dimensions specified on this page are based on a 32x32 px artboard size. +Keep 1 px of padding around the bounding box inside the Photoshop template.</li> + +<li><strong>Final art must be exported as a 32x32 px transparent PNG +file.</strong></li> + +<li>Templates for creating tab icons in Adobe Photoshop are available in the +Icon Templates Pack.</li> +</ul> + +<table class="image-caption"> +<tr> +<td class="image-caption-i" style="padding-right:0"> + <img src="{@docRoot}images/icon_design/tab_icon_unselected.png" alt="A view of +unselected tab icon structure." /> +</td> +<td class="image-caption-c"> + <div class="caption grad-rule-top"> + <p><strong>Figure 8. </strong>Safeframe and fill gradient for unselected tab +icons. Icon size is 32x32.</p> + </div> +</td> +</tr> +<tr> +<td class="image-caption-i" style="padding-right:0"> + <img src="{@docRoot}images/icon_design/tab_icon_selected.png" alt="A view of +selected tab icon structure." /> +</td> +<td class="image-caption-c"> + <div class="caption grad-rule-top"> + <p><strong>Figure 9. </strong>Safeframe and fill gradient for tab icons in +selected state. Icon size is 32x32.</p> + </div> +</td> +</tr> +</table> + +<h3 id="unselectedtabdetails">Unselected tab icon</h3> + +<h4 id="unselectedtablight">Light, effects, and shadows</h4> + +<p>Unselected tab icons look just like the selected tab icons, but with a +fainter inner shadow, and the same front part gradient as the dialog icons.</p> + +<table class="image-caption"> +<tr> +<td class="image-caption-i"> + <img src="{@docRoot}images/icon_design/tab_unselected_light.png" alt="A view +of light, effects, and shadows for unselected tab icons."/> +</td> +<td class="image-caption-c"> + <div class="caption grad-rule-top"> + <p><strong>Figure 10. </strong>Light, effects, and shadows for unselected +tab icons.</p> + <div class="image-caption-nested"> + <table style="margin-top:0;"> + <tr><td style="padding-right:1em"><em>1.</em></td><td>Front part:</td><td>gradient overlay | angle 90°<br>bottom color: r 223 | g 223 | b 223<br>top color: r 249 | g 249 | b 249<br>bottom color location: 0%<br>top color location: 75%</td></tr> + <tr><td><em>2.</em></td><td>Inner shadow:</td><td>black | 10 % opacity | angle 90° distance 2px | size 2px</td></tr> + <tr><td><em>3.</em></td><td>Inner bevel:</td><td>depth 1% | direction down | size 0px | angle 90° | altitude 10°<br>highlight white 70% opacity<br>shadow black 25% opacity</td></tr> + </table> + </div> + </div> +</td> +</tr> +</table> + + +<table style="margin:0px;padding:0px;"> +<tr> +<td style="border:0;width:350px;"> + +<h4 id="menusteps">Step by step</h4> + +<ol> +<li>Create the basic shapes using a tool like Adobe Illustrator.</li> +<li>Import the shape to a tool like Adobe Photoshop and scale to fit an image of +32x32 px on a transparent background.</li> +<li>Add the effects seen in Figure 10 for the unselected state filter.</li> +<li>Export the icon at 32x32 as a PNG file with transparency enabled.</li> +</ol> + +</td> +</tr> +</table> + +<h3 id="selectedtabdetails">Selected tab icon</h3> + +<p>The selected tab icons have the same fill gradient and effects as the menu +icon, but with no outer glow.</p> + +<table class="image-caption"> +<tr> +<td class="image-caption-i"> + <img src="{@docRoot}images/icon_design/tab_selected_light.png" alt="A view of +light, effects, and shadows for selected tab icons."/> +</td> +<td class="image-caption-c"> + <div class="caption grad-rule-top"> + <p><strong>Figure 11. </strong>Light, effects, and shadows for selected tab +icons.</p> + <div class="image-caption-nested"> + <table style="margin-top:0;"> + <tr><td style="padding-right:1em"><em>1.</em></td><td>Front part:</td><td>Use fill gradient from color palette.</td></tr> + <tr><td><em>2.</em></td><td>Inner shadow:</td><td>black | 20% opacity | <br>angle 90° | distance 2px | <br>size 2px</td></tr> + <tr><td><em>3.</em></td><td>Inner bevel:</td><td>depth 1% | direction down | size 0px | angle 90° | <br>altitude 10°<br>highlight white 70% opacity<br>shadow black 25% opacity</td></tr> + </table> + </div> + </div> +</td> +</tr> +</table> + +<table style="margin:0px;padding:0px;"> +<tr> +<td style="border:0;width:350px;"> + +<h4 id="menupalette">Color palette</h4> + +<table style="margin:0px;padding:0px;"> +<tr> +<td class="image-caption-i"><img src="{@docRoot}images/icon_design/menu_palette_gradient_medium.png" alt="Color palette, fill gradient" style="margin:.5em 0 0 0;" /></td> +<td class="image-caption-c" style="padding-top:.5em;">Fill gradient<br><em>1: </em>r 163 | g 163 | b 163<br><em>2: </em>r 120 | g 120 | b 120<br>Used as color fill on unselected tab icons.</td> +</tr> + +</table> + +</td> + +<td style="border:0;width:350px"> + +<h4 id="menusteps">Step by step</h4> + +<ol> +<li>Create the basic shape using a tool like Adobe Illustrator.</li> +<li>Import the shape into a tool like Adobe Photoshop and scale to fit a 32x32 +px artboard with a transparent background. </li> +<li>Add the effects seen in Figure 11 for the selected state filter.</li> +<li>Export the icon at 32x32 as a PNG file with transparency enabled.</li> +</ol> + +</td> +</tr> +</table> + + +<h2 id="dialogstructure">Dialog icon</h2> + +<p>Dialog icons are shown in pop-up dialog boxes that prompt the user for +interaction. They use a light gradient and inner +shadow in order to stand out against a dark background.</p> + +<h4>Structure</h4> + +<ul> +<li>Dialog icons have a 1 pixel safeframe. The base shape must fit within the +safeframe, but the anti-alias of a round shape can overlap the safeframe. <span +class="body-copy"></li> + +<li>All dimensions specified on this page are based on a 32x32 pixel artboard size +in Adobe Photoshop. Keep 1 pixel of padding around the bounding box inside the +Photoshop template.</li> + +<li><strong>Final art must be exported as a transparent PNG file.</strong></li> + +<li>Templates for creating dialog icons in Adobe Photoshop are available in the +Icon Templates Pack.</li> +</ul> + +<table class="image-caption"> +<tr> +<td class="image-caption-i" style="padding-right:0"> + <img src="{@docRoot}images/icon_design/dialog_icon.png" alt="A view of dialog +icon structure." /> +</td> +<td class="image-caption-c"> + <div class="caption grad-rule-top"> + <p><strong>Figure 12. </strong>Safeframe and fill gradient for dialog icons. +Icon size is 32x32.</p> + </div> +</td> +</tr> +</table> + + +<h4 id="dialoglight">Light, effects, and shadows</h4> + +<p>Dialog icons are flat and pictured face-on. In order to stand out against a +dark background, they are built up using a light gradient and inner shadow.</p> + +<table class="image-caption"> +<tr> +<td class="image-caption-i"> + <img src="{@docRoot}images/icon_design/dialog_light.png" alt="A view of light, +effects, and shadows for dialog icons."/> +</td> +<td class="image-caption-c"> + <div class="caption grad-rule-top"> + <p><strong>Figure 13. </strong>Light, effects, and shadows for dialog +icons.</p> + <div class="image-caption-nested"> + <table style="margin-top:0;"> + <tr><td style="padding-right:1em"><em>1.</em></td><td>Front part:</td><td>gradient overlay | angle 90°<br>bottom: r 223 | g 223 | b 223<br>top: r 249 | g 249 | b 249<br>bottom color location: 0%<br>top color location: 75%</td></tr> + <tr><td><em>2.</em></td><td>Inner shadow:</td><td>black | 25% opacity | <br>angle -90° | distance 1px | size 0px</td></tr> + </table> + </div> + </div> +</td> +</tr> +</table> + + +<table style="margin:0px;padding:0px;"> +<tr> +<td style="border:0;width:350px;"> + +<h4 id="menusteps">Step by step</h4> + +<ol> +<li>Create the basic shapes using a tool like Adobe Illustrator.</li> +<li>Import the shape into a tool like Adobe Photoshop and scale to fit an image +of 32x32 px on a transparent background. </li> +<li>Add the effects seen in Figure 13 for the proper filter.</li> +<li>Export the icon at 32x32 as a PNG file with transparency enabled.</li> +</ol> + +</td> +</tr> +</table> + + +<h2 id="listviewstructure">List view icon</h2> + +<p>List view icons look a lot like dialog icons, but they use an inner shadow +effect where the light source is above the object. They are also designed to be +used only in a list view. Examples include the Android Market application home +screen and the driving directions screen in the Maps application.</p> + +<h4>Structure</h4> + +<ul> +<li>A list view icon normally has a 1 px safeframe, but it is OK to use the +safeframe area for the edge of the anti-alias of a round shape. </li> + +<li>All dimensions specified are based on a 32x32 pixel artboard size in +Photoshop. Keep 1 pixel of padding around the bounding box inside the template. + </li> + +<li><strong>Final art must be exported as a transparent PNG file.</strong></li> + +<li>Templates for creating list view icons in Adobe Photoshop are available in +the Icon Templates Pack. </li> +</ul> + +<table class="image-caption"> +<tr> +<td class="image-caption-i" style="padding-right:0"> + <img src="{@docRoot}images/icon_design/listview_icon.png" alt="A view of list +view icon structure." /> +</td> +<td class="image-caption-c"> + <div class="caption grad-rule-top"> + <p><strong>Figure 14. </strong>Safeframe and fill gradient for list view +icons. Icon size is 32x32.</p> + </div> +</td> +</tr> +</table> + +<h4 id="listviewlight">Light, effects, and shadows</h4> + +<p>List view icons are flat and pictured face-on with an inner shadow. Built up +by a light gradient and inner shadow, they stand out well on a dark +background.</p> + +<table class="image-caption"> +<tr> +<td class="image-caption-i"> + <img src="{@docRoot}images/icon_design/listview_icon_details.png" alt="A view +of light, effects, and shadows for list view icons."/> +</td> +<td class="image-caption-c"> + <div class="caption grad-rule-top"> + <p><strong>Figure 15. </strong>Light, effects, and shadows for list view +icons.</p> + <div class="image-caption-nested"> + <table style="margin-top:0;"> + <tr><td style="padding-right:1em"><em>1.</em></td><td>Inner shadow:</td><td>black | 57 % opacity | angle 120° | blend mode normal | distance 1px | size 1px <td></tr> + <tr><td><em>2.</em></td><td>Background:</td><td>black | standard system color <br>These icons are displayed in list views only.</td></tr> + <tr><td colspan="2">Note: The list view icon sits on 32x32 px artboard in Photoshop, without a safeframe.</td></tr> + </table> + </div> + </div> +</td> +</tr> +</table> + +<table style="margin:0px;padding:0px;"> +<tr> +<td style="border:0;width:350px;"> + +<h4 id="menusteps">Step by step</h4> + +<ol> +<li>Add the effects seen in Figure 15 for the proper filter.</li> +<li>Export the icon at 32x32 as a PNG file with transparency enabled.</li> +<li>Create the basic shapes using a tool like Adobe Illustrator.</li> +<li>Import the shape into a tool like Adobe Photoshop and scale to fit an image +of 32x32 px on a transparent background. </li> +</ol> + +</td> +</tr> +</table> + + +<h2 id="dodonts">General guidelines</h2> + +<p>Below are some "do and don't" guidelines to consider when creating icons for +your application. By following the guidelines, you can ensure that your icons +will work well with other parts of the Android platform UI and will meet the +expectations of your application's users. </p> + +<table style="margin:0px;padding:0px;"> +<tr> +<td style="border:0;width:350px;"> + +<h4>Do...</h4> + +<ul> +<li>Use a normal perspective. The depth of an object should be realistic.</li> +<li>Keep it simple! By overdoing an icon, it loses it purpose and +readability.</li> +<li>Use colors only when necessary. Mind that the base of a launcher icon should +be grey and feel solid. </li> +<li>Use the correct angles for the specific icon types.</li> +</ul> +</td> +<td style="border:0;width:350px;"> + +<h4>Don’t...</h4> + +<ul> +<li>Use open elements like text alone as icons. Instead place those elements on +a base shape.</li> +<li>Use colors for your status bar notifications. Those are reserved for +specific phone-only functions.</li> +</ul> +</td> +</tr> +<tr> +<td colspan="2" style="border:0;"> +<img src="{@docRoot}images/icon_design/do_dont.png" alt="Side-by-side examples +of good/bad icon design."/> +</td> +</table> + +<h2 id="templatespack">Using the Android Icon Templates Pack</h2> + +<p>The Android Icon Templates Pack is a collection of template designs, filters, +and settings that make it easier for you to create icons that conform to the +general specifications given in this document. We recommend downloading the +template pack archive before you get started with your icon design.</p> + +<p>The icon templates are provided in Adobe Photoshop and Adobe Illustrator file +formats, which preserves the layers and design treatments we used when creating the +standard icons for the Android platform. You can load the template files into any +compatible image-editing program, although your ability to work directly with the +layers and treatments may vary based on the program you are using.</p> + +<p>You can obtain the Icon Templates Pack archive using the link below: </p> + +<p style="margin-left:2em"><a +href="{@docRoot}shareables/icon_templates-v1.0.zip">Download the Icon Templates +Pack »</a> + + +<h2 id="iconappendix">Icon appendix</p> + +<h3 id="launcherapx">Standard launcher icons</h3> + +<p>Shown below are examples of launcher icons used by Android applications. The +icons are provided for your reference only — please do not reuse these +icons in your applications.</code>. + +<table class="image-caption"> +<tr> + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_alarmclock.png" alt="Android asset" /> + <div class="caption">Alarm Clock</div></td> + + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_browser.png" alt="Android asset" /> + <div class="caption">Browser</div></td> + + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_calculator.png" alt="Android asset" /> + <div class="caption">Calculator</div></td> + + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_calendar.png" alt="Android asset" /> + <div class="caption">Calendar</div></td> + + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_video_camera.png" alt="Android asset" /> + <div class="caption">Camcorder</div></td> + + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_camera.png" alt="Android asset" /> + <div class="caption">Camera</div></td> + + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_contacts.png" alt="Android asset" /> + <div class="caption">Contacts</div></td> + +</tr> +<tr> + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_phone_dialer.png" alt="Android asset" /> + <div class="caption">Dialer</div></td> + + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_email_generic.png" alt="Android asset" /> + <div class="caption">Email</div></td> + + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_gallery.png" alt="Android asset" /> + <div class="caption">Gallery</div></td> + + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_generic_application.png" alt="Android asset" /> + <div class="caption">Generic application</div></td> + + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_email.png" alt="Android asset" /> + <div class="caption">Gmail</div></td> + + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_google_talk.png" alt="Android asset" /> + <div class="caption">Google Talk</div></td> + + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_IM.png" alt="Android asset" /> + <div class="caption">IM</div></td> + +</tr> +<tr> + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_maps.png" alt="Android asset" /> + <div class="caption">Maps</div></td> + + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_marketplace.png" alt="Android asset" /> + <div class="caption">Market </div></td> + + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_sms_mms.png" alt="Android asset" /> + <div class="caption">Messaging </div></td> + + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_musicplayer_2.png" alt="Android asset" /> + <div class="caption">Music</div></td> + + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_settings.png" alt="Android asset" /> + <div class="caption">Settings</div></td> + + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_voicedial.png" alt="Android asset" /> + <div class="caption">Voice Dialer</div></td> + + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_voicesearch.png" alt="Android asset" /> + <div class="caption">Voice Search</div></td> + +</tr> +<tr> + +<td class="image-caption-i image-list"> + <img src="/images/icon_design/ic_launcher_youtube.png" alt="Android asset" /> + <div class="caption">YouTube</div></td> +</tr> +</table> + +<h3 id="menuapx">Standard menu icons</h3> + +<p>Shown below are standard menu icons that are included in the Android platform +(as of Android 1.5). You can reference any of these icon resources from your +application as needed, but make sure that the action you assign to the icon is +consistent with that listed. Note that this is not a complete list of icons and +that the actual appearance of standard icons may change across platform +versions.</p> + +<p>To reference one of the icons from your code, use +<code>android.R.drawable.<icon_resource_identifier></code>. For example, +you can call a menu item's {@link android.view.MenuItem#setIcon(android.graphics.drawable.Drawable) setIcon()} +method and pass the resource name:</p> + +<p style="margin-left:2em"><code>.setIcon(android.R.drawable.ic_menu_more);</code>. + +<p>You could reference the same icon from a layout file using +<code>android:icon="@android:drawable/ic_menu_more"></code>.</p> + +<p>To determine the resource ID for an icon listed below, hover over the icon or +simply look at image filenames, which use the format +"<icon_resource_identifier>.png".</p> + +<table class="image-caption"> +<tr> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_add.png" title="ic_menu_add" alt="Android asset" /> + <div class="caption">Add</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_archive.png" title="ic_menu_archive" alt="Android asset" /> + <div class="caption">Archive</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_attachment.png" title="ic_menu_attachment" alt="Android asset" /> + <div class="caption">Attach</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_back.png" title="ic_menu_back" alt="Android asset" /> + <div class="caption">Back</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_call.png" title="ic_menu_call" alt="Android asset" /> + <div class="caption">Call</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_camera.png" title="ic_menu_camera" alt="Android asset" /> + <div class="caption">Camera</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_close_clear_cancel.png" title="ic_menu_close_clear_cancel" alt="Android asset" /> + <div class="caption">Clear / Close / Cancel / Discard </div></td> + +</tr> +<tr> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_compass.png" title="ic_menu_compass" alt="Android asset" /> + <div class="caption">Compass</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_delete.png" title="ic_menu_delete" alt="Android asset" /> + <div class="caption">Delete</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_directions.png" title="ic_menu_directions" alt="Android asset" /> + <div class="caption">Directions</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_edit.png" title="ic_menu_edit" alt="Android asset" /> + <div class="caption">Edit</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_favorite.png" title="ic_menu_favorite" alt="Android asset" /> + <div class="caption">Favorite</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_forward.png" title="ic_menu_forward" alt="Android asset" /> + <div class="caption">Forward</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_gallery.png" title="ic_menu_gallery" alt="Android asset" /> + <div class="caption">Gallery</div></td> + +</tr> +<tr> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_goto.png" title="ic_menu_goto" alt="Android asset" /> + <div class="caption">Go to</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_help.png" title="ic_menu_help" alt="Android asset" /> + <div class="caption">Help</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_recent_history.png" title="ic_menu_recent_history" alt="Android asset" /> + <div class="caption">History</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_home.png" title="ic_menu_home" alt="Android asset" /> + <div class="caption">Home</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_info_details.png" title="ic_menu_info_details" alt="Android asset" /> + <div class="caption">Info / details</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_mapmode.png" title="ic_menu_mapmode" alt="Android asset" /> + <div class="caption">Map mode</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_mark.png" title="ic_menu_mark" alt="Android asset" /> + <div class="caption">Mark</div></td> + +</tr> +<tr> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_mylocation.png" title="ic_menu_mylocation" alt="Android asset" /> + <div class="caption">My Location</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_more.png" title="ic_menu_more" alt="Android asset" /> + <div class="caption">More</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_play_clip.png" title="ic_menu_play_clip" alt="Android asset" /> + <div class="caption">Play</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_preferences.png" title="ic_menu_preferences" alt="Android asset" /> + <div class="caption">Preferences</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_refresh.png" title="ic_menu_refresh" alt="Android asset" /> + <div class="caption">Refresh</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_rotate.png" title="ic_menu_rotate" alt="Android asset" /> + <div class="caption">Rotate</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_save.png" title="ic_menu_save" alt="Android asset" /> + <div class="caption">Save</div></td> + +</tr> +<tr> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_send.png" title="ic_menu_send" alt="Android asset" /> + <div class="caption">Send</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_search.png" title="ic_menu_search" alt="Android asset" /> + <div class="caption">Search</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_share.png" title="ic_menu_share" alt="Android asset" /> + <div class="caption">Share</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_shuffle.png" title="ic_menu_shuffle" alt="Android asset" /> + <div class="caption">Shuffle</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_upload.png" title="ic_menu_upload" alt="Android asset" /> + <div class="caption">Upload</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_view.png" title="ic_menu_view" alt="Android asset" /> + <div class="caption">View</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_camera_video_view.png" title="ic_menu_camera_video_view" alt="Android asset" /> + <div class="caption">Video</div></td> + +</tr> +<tr> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/ic_menu_zoom.png" title="ic_menu_zoom" alt="Android asset" /> + <div class="caption">Zoom</div></td> + +</tr> +</table> + + +<h3 id="statusbarapx">Standard status bar icons</h3> + +<p>Shown below are standard status bar icons included in the Android platform +(as of Android 1.5). You can reference any of these icon resources from your +application as needed, but make sure that the meaning of the icon is consistent +with the standard meaning listed. Note that this is not a complete list of icons +and that the actual appearance of standard icons may change across platform +versions.</p> + +<p>To reference one of the icons from your code, use +<code>android.R.drawable.<icon_resource_identifier></code>. For example, +you can construct a simple notification that references one of the icons like +this: </p> + +<p style="margin-left:2em"><code>new Notification(R.drawable.stat_notify_calendar, +"sample text", System.currentTimeMillis());</code></p> + +<p>To determine the resource ID for an icon listed below, hover over the icon +or simply look at the image filename, which use the format +"<icon_resource_identifier>.png".</p> + + +<table class="image-caption"> +<tr> + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_data_connected_3g.png" title="stat_sys_data_connected_3g" alt="Android asset" /> + <div class="caption">3G</div></td> + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_signal_flightmode.png" title="stat_sys_signal_flightmode" alt="Android asset" /> + <div class="caption">Airplane mode</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_notify_alarm.png" title="stat_notify_alarm" alt="Android asset" /> + <div class="caption">Alarm</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_data_bluetooth.png" title="stat_sys_data_bluetooth" alt="Android asset" /> + <div class="caption">Bluetooth</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_data_bluetooth_connected.png" title="stat_sys_data_bluetooth_connected" alt="Android asset" /> + <div class="caption">Bluetooth connected</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_notify_calendar.png" title="stat_notify_calendar" alt="Android asset" /> + <div class="caption">Calendar</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_notify_disk_full.png" title="stat_notify_disk_full" alt="Android asset" /> + <div class="caption">Disk full</div></td> + +</tr> +<tr> + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_data_connected_e.png" title="stat_sys_data_connected_e" alt="Android asset" /> + <div class="caption">EDGE</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_notify_email_generic.png" title="stat_notify_email_generic" alt="Android asset" /> + <div class="caption">Email</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_notify_email.png" title="stat_notify_email" alt="Android asset" /> + <div class="caption">Gmail</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_data_connected_g.png" title="stat_sys_data_connected_g" alt="Android asset" /> + <div class="caption">GPRS</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_notify_chat.png" title="stat_notify_chat" alt="Android asset" /> + <div class="caption">IM</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_install_complete.png" title="stat_sys_install_complete" alt="Android asset" /> + <div class="caption">Installation complete</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_notify_musicplayer.png" title="stat_notify_musicplayer" alt="Android asset" /> + <div class="caption">Music</div></td> + +</tr> +<tr> + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_r_signal_4.png" title="stat_sys_r_signal_4" alt="Android asset" /> + <div class="caption">Roaming</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_signal_4.png" title="stat_sys_signal_4" alt="Android asset" /> + <div class="caption">Signal</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_signal_null.png" title="stat_sys_signal_null" alt="Android asset" /> + <div class="caption">Signal unavailable</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_ringer_silent_old.png" title="stat_sys_ringer_silent_old" alt="Android asset" /> + <div class="caption">Silent mode</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_notify_sms.png" title="stat_notify_sms" alt="Android asset" /> + <div class="caption">SMS/MMS</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_speakerphone.png" title="stat_sys_speakerphone" alt="Android asset" /> + <div class="caption">Speaker phone</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_notify_sync_anim0.png" title="stat_notify_sync_anim0" alt="Android asset" /> + <div class="caption">Sync</div></td> + +</tr> +<tr> + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_notify_sync_error.png" title="stat_notify_sync_error" alt="Android asset" /> + <div class="caption">Sync error</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_data_usb.png" title="stat_sys_data_usb" alt="Android asset" /> + <div class="caption">USB connected</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_ringer_vibrate.png" title="stat_sys_ringer_vibrate" alt="Android asset" /> + <div class="caption">Vibrate</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_notify_voicemail.png" title="stat_notify_voicemail" alt="Android asset" /> + <div class="caption">Voicemail</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_warning.png" title="stat_sys_warning" alt="Android asset" /> + <div class="caption">Warning</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_wifi_signal_4.png" title="stat_sys_wifi_signal_4" alt="Android asset" /> + <div class="caption">WiFi</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_notify_wifi_in_range.png" title="stat_notify_wifi_in_range" alt="Android asset" /> + <div class="caption">WiFi network available</div></td> + +</tr> +<tr> + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_wifi_unavailable.png" title="stat_sys_wifi_unavailable" alt="Android asset" /> + <div class="caption">WiFi unavailable</div></td> + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_battery_100.png" title="stat_sys_battery_100" alt="Android asset" /> + <div class="caption">Battery 100%</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_battery_empty.png" title="stat_sys_battery_empty" alt="Android asset" /> + <div class="caption">Battery empty</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_phone_call.png" title="stat_sys_phone_call" alt="Android asset" /> + <div class="caption">Call</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_phone_call_forward.png" title="stat_sys_phone_call_forward" alt="Android asset" /> + <div class="caption">Call forward</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_phone_call_on_hold.png" title="stat_sys_phone_call_on_hold" alt="Android asset" /> + <div class="caption">Call on hold</div></td> + + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_sys_gps_on.png" title="stat_sys_gps_on" alt="Android asset" /> + <div class="caption">GPS on</div></td> + +</tr> +<tr> + +<td class="image-caption-i image-list"> + <img src="{@docRoot}images/icon_design/stat_notify_missed_call.png" title="stat_notify_missed_call" alt="Android asset" /> + <div class="caption">Missed call</div></td> + +</tr> +</table> + + diff --git a/docs/html/guide/practices/ui_guidelines/index.jd b/docs/html/guide/practices/ui_guidelines/index.jd index e19d5b4..61e310a 100644 --- a/docs/html/guide/practices/ui_guidelines/index.jd +++ b/docs/html/guide/practices/ui_guidelines/index.jd @@ -6,18 +6,27 @@ page.title=User Interface Guidelines <p>The Android UI team has begun developing guidelines for the interaction and -design of Android applications. Look here for articles that describe these -visual guidelines as we release them.</p> +visual design of Android applications. Look here for articles that describe +these guidelines as we release them.</p> - + <dl> + <dt><a href="{@docRoot}guide/practices/ui_guidelines/icon_design.html">Icon +Design Guidelines</a> and <a +href="{@docRoot}shareables/icon_templates-v1.0.zip">Android Icon Templates Pack +» </a></dt> + <dd>Your applications need a wide variety of icons, from a launcher icon to +icons in menus, dialogs, tabs, the status bar, and lists. The Icon Guidelines +describe each kind of icon in detail, with specifications for the size, color, +shading, and other details for making all your icons fit in the Android system. +The Icon Templates Pack is an archive of Photoshop and Illustrator templates and +filters that make it much simpler to create conforming icons.</dd> +</dl> <dl> <dt><a href="widget_design.html">Widget Design Guidelines</a> </dt> - <dd>Widgets are a new feature introduced in Cupcake. A widget displays -an application's most important or timely information at a glance, on a user's -Home screen. These design guidelines describe how to design widgets that fit -with others on the Home screen. They include links to graphics files and -templates that will make your designer's life easier.</dd> - + <dd>A widget displays an application's most important or timely information +at a glance, on a user's Home screen. These design guidelines describe how to +design widgets that fit with others on the Home screen. They include links to +graphics files and templates that will make your designer's life easier.</dd> </dl> diff --git a/docs/html/images/icon_design/dialog_icon.png b/docs/html/images/icon_design/dialog_icon.png Binary files differnew file mode 100644 index 0000000..9f92422 --- /dev/null +++ b/docs/html/images/icon_design/dialog_icon.png diff --git a/docs/html/images/icon_design/dialog_light.png b/docs/html/images/icon_design/dialog_light.png Binary files differnew file mode 100644 index 0000000..85056a9 --- /dev/null +++ b/docs/html/images/icon_design/dialog_light.png diff --git a/docs/html/images/icon_design/do_dont.png b/docs/html/images/icon_design/do_dont.png Binary files differnew file mode 100644 index 0000000..bc6d649 --- /dev/null +++ b/docs/html/images/icon_design/do_dont.png diff --git a/docs/html/images/icon_design/ic_launcher_IM.png b/docs/html/images/icon_design/ic_launcher_IM.png Binary files differnew file mode 100644 index 0000000..afc35a2 --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_IM.png diff --git a/docs/html/images/icon_design/ic_launcher_alarmclock.png b/docs/html/images/icon_design/ic_launcher_alarmclock.png Binary files differnew file mode 100644 index 0000000..30ff267 --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_alarmclock.png diff --git a/docs/html/images/icon_design/ic_launcher_browser.png b/docs/html/images/icon_design/ic_launcher_browser.png Binary files differnew file mode 100644 index 0000000..f58b84a --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_browser.png diff --git a/docs/html/images/icon_design/ic_launcher_calculator.png b/docs/html/images/icon_design/ic_launcher_calculator.png Binary files differnew file mode 100644 index 0000000..298c267 --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_calculator.png diff --git a/docs/html/images/icon_design/ic_launcher_calendar.png b/docs/html/images/icon_design/ic_launcher_calendar.png Binary files differnew file mode 100644 index 0000000..9241090 --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_calendar.png diff --git a/docs/html/images/icon_design/ic_launcher_camera.png b/docs/html/images/icon_design/ic_launcher_camera.png Binary files differnew file mode 100644 index 0000000..c2d7606 --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_camera.png diff --git a/docs/html/images/icon_design/ic_launcher_contacts.png b/docs/html/images/icon_design/ic_launcher_contacts.png Binary files differnew file mode 100644 index 0000000..826656f --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_contacts.png diff --git a/docs/html/images/icon_design/ic_launcher_email.png b/docs/html/images/icon_design/ic_launcher_email.png Binary files differnew file mode 100644 index 0000000..2fb2637 --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_email.png diff --git a/docs/html/images/icon_design/ic_launcher_email_generic.png b/docs/html/images/icon_design/ic_launcher_email_generic.png Binary files differnew file mode 100644 index 0000000..590ed70 --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_email_generic.png diff --git a/docs/html/images/icon_design/ic_launcher_gallery.png b/docs/html/images/icon_design/ic_launcher_gallery.png Binary files differnew file mode 100644 index 0000000..965fb71 --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_gallery.png diff --git a/docs/html/images/icon_design/ic_launcher_generic_application.png b/docs/html/images/icon_design/ic_launcher_generic_application.png Binary files differnew file mode 100644 index 0000000..7502484 --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_generic_application.png diff --git a/docs/html/images/icon_design/ic_launcher_google_talk.png b/docs/html/images/icon_design/ic_launcher_google_talk.png Binary files differnew file mode 100644 index 0000000..1618eb3 --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_google_talk.png diff --git a/docs/html/images/icon_design/ic_launcher_maps.png b/docs/html/images/icon_design/ic_launcher_maps.png Binary files differnew file mode 100644 index 0000000..f436b56 --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_maps.png diff --git a/docs/html/images/icon_design/ic_launcher_marketplace.png b/docs/html/images/icon_design/ic_launcher_marketplace.png Binary files differnew file mode 100644 index 0000000..f1f578d --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_marketplace.png diff --git a/docs/html/images/icon_design/ic_launcher_musicplayer_2.png b/docs/html/images/icon_design/ic_launcher_musicplayer_2.png Binary files differnew file mode 100644 index 0000000..0353b91 --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_musicplayer_2.png diff --git a/docs/html/images/icon_design/ic_launcher_phone_dialer.png b/docs/html/images/icon_design/ic_launcher_phone_dialer.png Binary files differnew file mode 100644 index 0000000..4e613ec --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_phone_dialer.png diff --git a/docs/html/images/icon_design/ic_launcher_settings.png b/docs/html/images/icon_design/ic_launcher_settings.png Binary files differnew file mode 100644 index 0000000..16db056 --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_settings.png diff --git a/docs/html/images/icon_design/ic_launcher_sms_mms.png b/docs/html/images/icon_design/ic_launcher_sms_mms.png Binary files differnew file mode 100644 index 0000000..e2ac784 --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_sms_mms.png diff --git a/docs/html/images/icon_design/ic_launcher_video_camera.png b/docs/html/images/icon_design/ic_launcher_video_camera.png Binary files differnew file mode 100644 index 0000000..e80255a --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_video_camera.png diff --git a/docs/html/images/icon_design/ic_launcher_voicedial.png b/docs/html/images/icon_design/ic_launcher_voicedial.png Binary files differnew file mode 100644 index 0000000..0c84fba --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_voicedial.png diff --git a/docs/html/images/icon_design/ic_launcher_voicesearch.png b/docs/html/images/icon_design/ic_launcher_voicesearch.png Binary files differnew file mode 100644 index 0000000..09d5199 --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_voicesearch.png diff --git a/docs/html/images/icon_design/ic_launcher_youtube.png b/docs/html/images/icon_design/ic_launcher_youtube.png Binary files differnew file mode 100644 index 0000000..48d268d --- /dev/null +++ b/docs/html/images/icon_design/ic_launcher_youtube.png diff --git a/docs/html/images/icon_design/ic_menu_add.png b/docs/html/images/icon_design/ic_menu_add.png Binary files differnew file mode 100644 index 0000000..6752bfd --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_add.png diff --git a/docs/html/images/icon_design/ic_menu_archive.png b/docs/html/images/icon_design/ic_menu_archive.png Binary files differnew file mode 100644 index 0000000..a4599e3 --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_archive.png diff --git a/docs/html/images/icon_design/ic_menu_attachment.png b/docs/html/images/icon_design/ic_menu_attachment.png Binary files differnew file mode 100644 index 0000000..89d626f --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_attachment.png diff --git a/docs/html/images/icon_design/ic_menu_back.png b/docs/html/images/icon_design/ic_menu_back.png Binary files differnew file mode 100644 index 0000000..5ce50eb --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_back.png diff --git a/docs/html/images/icon_design/ic_menu_call.png b/docs/html/images/icon_design/ic_menu_call.png Binary files differnew file mode 100644 index 0000000..a63f86b --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_call.png diff --git a/docs/html/images/icon_design/ic_menu_camera.png b/docs/html/images/icon_design/ic_menu_camera.png Binary files differnew file mode 100644 index 0000000..cdf7ca3 --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_camera.png diff --git a/docs/html/images/icon_design/ic_menu_camera_video_view.png b/docs/html/images/icon_design/ic_menu_camera_video_view.png Binary files differnew file mode 100644 index 0000000..f7e52c2 --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_camera_video_view.png diff --git a/docs/html/images/icon_design/ic_menu_close_clear_cancel.png b/docs/html/images/icon_design/ic_menu_close_clear_cancel.png Binary files differnew file mode 100644 index 0000000..619858c --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_close_clear_cancel.png diff --git a/docs/html/images/icon_design/ic_menu_compass.png b/docs/html/images/icon_design/ic_menu_compass.png Binary files differnew file mode 100644 index 0000000..7717dde --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_compass.png diff --git a/docs/html/images/icon_design/ic_menu_delete.png b/docs/html/images/icon_design/ic_menu_delete.png Binary files differnew file mode 100644 index 0000000..7d95494 --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_delete.png diff --git a/docs/html/images/icon_design/ic_menu_directions.png b/docs/html/images/icon_design/ic_menu_directions.png Binary files differnew file mode 100644 index 0000000..67d3ff2 --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_directions.png diff --git a/docs/html/images/icon_design/ic_menu_edit.png b/docs/html/images/icon_design/ic_menu_edit.png Binary files differnew file mode 100644 index 0000000..41a9c2e --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_edit.png diff --git a/docs/html/images/icon_design/ic_menu_favorite.png b/docs/html/images/icon_design/ic_menu_favorite.png Binary files differnew file mode 100644 index 0000000..527d74a --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_favorite.png diff --git a/docs/html/images/icon_design/ic_menu_forward.png b/docs/html/images/icon_design/ic_menu_forward.png Binary files differnew file mode 100644 index 0000000..0936fac --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_forward.png diff --git a/docs/html/images/icon_design/ic_menu_gallery.png b/docs/html/images/icon_design/ic_menu_gallery.png Binary files differnew file mode 100644 index 0000000..f61bbd8 --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_gallery.png diff --git a/docs/html/images/icon_design/ic_menu_goto.png b/docs/html/images/icon_design/ic_menu_goto.png Binary files differnew file mode 100644 index 0000000..40183eb --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_goto.png diff --git a/docs/html/images/icon_design/ic_menu_help.png b/docs/html/images/icon_design/ic_menu_help.png Binary files differnew file mode 100644 index 0000000..7c55dfd --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_help.png diff --git a/docs/html/images/icon_design/ic_menu_home.png b/docs/html/images/icon_design/ic_menu_home.png Binary files differnew file mode 100644 index 0000000..34943f6 --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_home.png diff --git a/docs/html/images/icon_design/ic_menu_info_details.png b/docs/html/images/icon_design/ic_menu_info_details.png Binary files differnew file mode 100644 index 0000000..1786d1e --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_info_details.png diff --git a/docs/html/images/icon_design/ic_menu_mapmode.png b/docs/html/images/icon_design/ic_menu_mapmode.png Binary files differnew file mode 100644 index 0000000..d85cab5 --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_mapmode.png diff --git a/docs/html/images/icon_design/ic_menu_mark.png b/docs/html/images/icon_design/ic_menu_mark.png Binary files differnew file mode 100644 index 0000000..5e95da7 --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_mark.png diff --git a/docs/html/images/icon_design/ic_menu_more.png b/docs/html/images/icon_design/ic_menu_more.png Binary files differnew file mode 100644 index 0000000..2091527 --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_more.png diff --git a/docs/html/images/icon_design/ic_menu_mylocation.png b/docs/html/images/icon_design/ic_menu_mylocation.png Binary files differnew file mode 100644 index 0000000..14b0af8 --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_mylocation.png diff --git a/docs/html/images/icon_design/ic_menu_play_clip.png b/docs/html/images/icon_design/ic_menu_play_clip.png Binary files differnew file mode 100644 index 0000000..4669947 --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_play_clip.png diff --git a/docs/html/images/icon_design/ic_menu_preferences.png b/docs/html/images/icon_design/ic_menu_preferences.png Binary files differnew file mode 100644 index 0000000..b8e7141 --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_preferences.png diff --git a/docs/html/images/icon_design/ic_menu_recent_history.png b/docs/html/images/icon_design/ic_menu_recent_history.png Binary files differnew file mode 100644 index 0000000..4ccae5d --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_recent_history.png diff --git a/docs/html/images/icon_design/ic_menu_refresh.png b/docs/html/images/icon_design/ic_menu_refresh.png Binary files differnew file mode 100644 index 0000000..77d70dd --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_refresh.png diff --git a/docs/html/images/icon_design/ic_menu_rotate.png b/docs/html/images/icon_design/ic_menu_rotate.png Binary files differnew file mode 100644 index 0000000..27368b2 --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_rotate.png diff --git a/docs/html/images/icon_design/ic_menu_save.png b/docs/html/images/icon_design/ic_menu_save.png Binary files differnew file mode 100644 index 0000000..36d50b3 --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_save.png diff --git a/docs/html/images/icon_design/ic_menu_search.png b/docs/html/images/icon_design/ic_menu_search.png Binary files differnew file mode 100644 index 0000000..94446db --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_search.png diff --git a/docs/html/images/icon_design/ic_menu_send.png b/docs/html/images/icon_design/ic_menu_send.png Binary files differnew file mode 100644 index 0000000..74c096d --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_send.png diff --git a/docs/html/images/icon_design/ic_menu_share.png b/docs/html/images/icon_design/ic_menu_share.png Binary files differnew file mode 100644 index 0000000..44db9b1 --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_share.png diff --git a/docs/html/images/icon_design/ic_menu_shuffle.png b/docs/html/images/icon_design/ic_menu_shuffle.png Binary files differnew file mode 100644 index 0000000..cb7009d --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_shuffle.png diff --git a/docs/html/images/icon_design/ic_menu_upload.png b/docs/html/images/icon_design/ic_menu_upload.png Binary files differnew file mode 100644 index 0000000..1c0dd3f --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_upload.png diff --git a/docs/html/images/icon_design/ic_menu_view.png b/docs/html/images/icon_design/ic_menu_view.png Binary files differnew file mode 100644 index 0000000..69828a9 --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_view.png diff --git a/docs/html/images/icon_design/ic_menu_zoom.png b/docs/html/images/icon_design/ic_menu_zoom.png Binary files differnew file mode 100644 index 0000000..0b8c4e8 --- /dev/null +++ b/docs/html/images/icon_design/ic_menu_zoom.png diff --git a/docs/html/images/icon_design/icon_guidelines_logo.png b/docs/html/images/icon_design/icon_guidelines_logo.png Binary files differnew file mode 100644 index 0000000..9362c8f --- /dev/null +++ b/docs/html/images/icon_design/icon_guidelines_logo.png diff --git a/docs/html/images/icon_design/launcher_light.png b/docs/html/images/icon_design/launcher_light.png Binary files differnew file mode 100644 index 0000000..8a94e1d --- /dev/null +++ b/docs/html/images/icon_design/launcher_light.png diff --git a/docs/html/images/icon_design/launcher_palette_black.png b/docs/html/images/icon_design/launcher_palette_black.png Binary files differnew file mode 100644 index 0000000..fba096f --- /dev/null +++ b/docs/html/images/icon_design/launcher_palette_black.png diff --git a/docs/html/images/icon_design/launcher_palette_dark.png b/docs/html/images/icon_design/launcher_palette_dark.png Binary files differnew file mode 100644 index 0000000..3735542 --- /dev/null +++ b/docs/html/images/icon_design/launcher_palette_dark.png diff --git a/docs/html/images/icon_design/launcher_palette_gradient_dark.png b/docs/html/images/icon_design/launcher_palette_gradient_dark.png Binary files differnew file mode 100644 index 0000000..3735542 --- /dev/null +++ b/docs/html/images/icon_design/launcher_palette_gradient_dark.png diff --git a/docs/html/images/icon_design/launcher_palette_gradient_light.png b/docs/html/images/icon_design/launcher_palette_gradient_light.png Binary files differnew file mode 100644 index 0000000..f1121eb --- /dev/null +++ b/docs/html/images/icon_design/launcher_palette_gradient_light.png diff --git a/docs/html/images/icon_design/launcher_palette_gradient_medium.png b/docs/html/images/icon_design/launcher_palette_gradient_medium.png Binary files differnew file mode 100644 index 0000000..1442b17 --- /dev/null +++ b/docs/html/images/icon_design/launcher_palette_gradient_medium.png diff --git a/docs/html/images/icon_design/launcher_palette_light.png b/docs/html/images/icon_design/launcher_palette_light.png Binary files differnew file mode 100644 index 0000000..f1121eb --- /dev/null +++ b/docs/html/images/icon_design/launcher_palette_light.png diff --git a/docs/html/images/icon_design/launcher_palette_medium.png b/docs/html/images/icon_design/launcher_palette_medium.png Binary files differnew file mode 100644 index 0000000..1442b17 --- /dev/null +++ b/docs/html/images/icon_design/launcher_palette_medium.png diff --git a/docs/html/images/icon_design/launcher_palette_white.png b/docs/html/images/icon_design/launcher_palette_white.png Binary files differnew file mode 100644 index 0000000..8d7ac41 --- /dev/null +++ b/docs/html/images/icon_design/launcher_palette_white.png diff --git a/docs/html/images/icon_design/launcher_structure.png b/docs/html/images/icon_design/launcher_structure.png Binary files differnew file mode 100644 index 0000000..53e4d9a --- /dev/null +++ b/docs/html/images/icon_design/launcher_structure.png diff --git a/docs/html/images/icon_design/listview_icon.png b/docs/html/images/icon_design/listview_icon.png Binary files differnew file mode 100644 index 0000000..5711d88 --- /dev/null +++ b/docs/html/images/icon_design/listview_icon.png diff --git a/docs/html/images/icon_design/listview_icon_details.png b/docs/html/images/icon_design/listview_icon_details.png Binary files differnew file mode 100644 index 0000000..5a68416 --- /dev/null +++ b/docs/html/images/icon_design/listview_icon_details.png diff --git a/docs/html/images/icon_design/menu_light.png b/docs/html/images/icon_design/menu_light.png Binary files differnew file mode 100644 index 0000000..93ed38b --- /dev/null +++ b/docs/html/images/icon_design/menu_light.png diff --git a/docs/html/images/icon_design/menu_palette_black.png b/docs/html/images/icon_design/menu_palette_black.png Binary files differnew file mode 100644 index 0000000..fba096f --- /dev/null +++ b/docs/html/images/icon_design/menu_palette_black.png diff --git a/docs/html/images/icon_design/menu_palette_fill.png b/docs/html/images/icon_design/menu_palette_fill.png Binary files differnew file mode 100644 index 0000000..7079bda --- /dev/null +++ b/docs/html/images/icon_design/menu_palette_fill.png diff --git a/docs/html/images/icon_design/menu_palette_gradient_medium.png b/docs/html/images/icon_design/menu_palette_gradient_medium.png Binary files differnew file mode 100644 index 0000000..a806adb --- /dev/null +++ b/docs/html/images/icon_design/menu_palette_gradient_medium.png diff --git a/docs/html/images/icon_design/menu_palette_white.png b/docs/html/images/icon_design/menu_palette_white.png Binary files differnew file mode 100644 index 0000000..8d7ac41 --- /dev/null +++ b/docs/html/images/icon_design/menu_palette_white.png diff --git a/docs/html/images/icon_design/menu_structure.png b/docs/html/images/icon_design/menu_structure.png Binary files differnew file mode 100644 index 0000000..ab14015 --- /dev/null +++ b/docs/html/images/icon_design/menu_structure.png diff --git a/docs/html/images/icon_design/stat_notify_alarm.png b/docs/html/images/icon_design/stat_notify_alarm.png Binary files differnew file mode 100644 index 0000000..1b01b85 --- /dev/null +++ b/docs/html/images/icon_design/stat_notify_alarm.png diff --git a/docs/html/images/icon_design/stat_notify_calendar.png b/docs/html/images/icon_design/stat_notify_calendar.png Binary files differnew file mode 100644 index 0000000..4433a16 --- /dev/null +++ b/docs/html/images/icon_design/stat_notify_calendar.png diff --git a/docs/html/images/icon_design/stat_notify_chat.png b/docs/html/images/icon_design/stat_notify_chat.png Binary files differnew file mode 100644 index 0000000..238f043 --- /dev/null +++ b/docs/html/images/icon_design/stat_notify_chat.png diff --git a/docs/html/images/icon_design/stat_notify_disk_full.png b/docs/html/images/icon_design/stat_notify_disk_full.png Binary files differnew file mode 100644 index 0000000..9120f00 --- /dev/null +++ b/docs/html/images/icon_design/stat_notify_disk_full.png diff --git a/docs/html/images/icon_design/stat_notify_email.png b/docs/html/images/icon_design/stat_notify_email.png Binary files differnew file mode 100644 index 0000000..d84a247 --- /dev/null +++ b/docs/html/images/icon_design/stat_notify_email.png diff --git a/docs/html/images/icon_design/stat_notify_email_generic.png b/docs/html/images/icon_design/stat_notify_email_generic.png Binary files differnew file mode 100644 index 0000000..686033f --- /dev/null +++ b/docs/html/images/icon_design/stat_notify_email_generic.png diff --git a/docs/html/images/icon_design/stat_notify_missed_call.png b/docs/html/images/icon_design/stat_notify_missed_call.png Binary files differnew file mode 100644 index 0000000..fe746b3 --- /dev/null +++ b/docs/html/images/icon_design/stat_notify_missed_call.png diff --git a/docs/html/images/icon_design/stat_notify_musicplayer.png b/docs/html/images/icon_design/stat_notify_musicplayer.png Binary files differnew file mode 100644 index 0000000..fd92c18 --- /dev/null +++ b/docs/html/images/icon_design/stat_notify_musicplayer.png diff --git a/docs/html/images/icon_design/stat_notify_sms.png b/docs/html/images/icon_design/stat_notify_sms.png Binary files differnew file mode 100644 index 0000000..b437d5b --- /dev/null +++ b/docs/html/images/icon_design/stat_notify_sms.png diff --git a/docs/html/images/icon_design/stat_notify_sync_anim0.png b/docs/html/images/icon_design/stat_notify_sync_anim0.png Binary files differnew file mode 100644 index 0000000..0edf692 --- /dev/null +++ b/docs/html/images/icon_design/stat_notify_sync_anim0.png diff --git a/docs/html/images/icon_design/stat_notify_sync_error.png b/docs/html/images/icon_design/stat_notify_sync_error.png Binary files differnew file mode 100644 index 0000000..3078b8c --- /dev/null +++ b/docs/html/images/icon_design/stat_notify_sync_error.png diff --git a/docs/html/images/icon_design/stat_notify_voicemail.png b/docs/html/images/icon_design/stat_notify_voicemail.png Binary files differnew file mode 100644 index 0000000..658fa05 --- /dev/null +++ b/docs/html/images/icon_design/stat_notify_voicemail.png diff --git a/docs/html/images/icon_design/stat_notify_wifi_in_range.png b/docs/html/images/icon_design/stat_notify_wifi_in_range.png Binary files differnew file mode 100644 index 0000000..e9c74b4 --- /dev/null +++ b/docs/html/images/icon_design/stat_notify_wifi_in_range.png diff --git a/docs/html/images/icon_design/stat_sys_battery_100.png b/docs/html/images/icon_design/stat_sys_battery_100.png Binary files differnew file mode 100644 index 0000000..d280aeb --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_battery_100.png diff --git a/docs/html/images/icon_design/stat_sys_battery_empty.png b/docs/html/images/icon_design/stat_sys_battery_empty.png Binary files differnew file mode 100644 index 0000000..4a5e99e --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_battery_empty.png diff --git a/docs/html/images/icon_design/stat_sys_data_bluetooth.png b/docs/html/images/icon_design/stat_sys_data_bluetooth.png Binary files differnew file mode 100644 index 0000000..7a8b78f --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_data_bluetooth.png diff --git a/docs/html/images/icon_design/stat_sys_data_bluetooth_connected.png b/docs/html/images/icon_design/stat_sys_data_bluetooth_connected.png Binary files differnew file mode 100644 index 0000000..f09b83b --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_data_bluetooth_connected.png diff --git a/docs/html/images/icon_design/stat_sys_data_connected_3g.png b/docs/html/images/icon_design/stat_sys_data_connected_3g.png Binary files differnew file mode 100644 index 0000000..a109280 --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_data_connected_3g.png diff --git a/docs/html/images/icon_design/stat_sys_data_connected_e.png b/docs/html/images/icon_design/stat_sys_data_connected_e.png Binary files differnew file mode 100644 index 0000000..c552644 --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_data_connected_e.png diff --git a/docs/html/images/icon_design/stat_sys_data_connected_g.png b/docs/html/images/icon_design/stat_sys_data_connected_g.png Binary files differnew file mode 100644 index 0000000..f7edb49 --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_data_connected_g.png diff --git a/docs/html/images/icon_design/stat_sys_data_usb.png b/docs/html/images/icon_design/stat_sys_data_usb.png Binary files differnew file mode 100644 index 0000000..2d0da4c --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_data_usb.png diff --git a/docs/html/images/icon_design/stat_sys_gps_on.png b/docs/html/images/icon_design/stat_sys_gps_on.png Binary files differnew file mode 100644 index 0000000..a2c677d --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_gps_on.png diff --git a/docs/html/images/icon_design/stat_sys_install_complete.png b/docs/html/images/icon_design/stat_sys_install_complete.png Binary files differnew file mode 100644 index 0000000..62dba5b --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_install_complete.png diff --git a/docs/html/images/icon_design/stat_sys_phone_call.png b/docs/html/images/icon_design/stat_sys_phone_call.png Binary files differnew file mode 100644 index 0000000..ad53693 --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_phone_call.png diff --git a/docs/html/images/icon_design/stat_sys_phone_call_forward.png b/docs/html/images/icon_design/stat_sys_phone_call_forward.png Binary files differnew file mode 100644 index 0000000..ed4b6ec --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_phone_call_forward.png diff --git a/docs/html/images/icon_design/stat_sys_phone_call_on_hold.png b/docs/html/images/icon_design/stat_sys_phone_call_on_hold.png Binary files differnew file mode 100644 index 0000000..9216447 --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_phone_call_on_hold.png diff --git a/docs/html/images/icon_design/stat_sys_r_signal_4.png b/docs/html/images/icon_design/stat_sys_r_signal_4.png Binary files differnew file mode 100644 index 0000000..f04fb11 --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_r_signal_4.png diff --git a/docs/html/images/icon_design/stat_sys_ringer_silent_old.png b/docs/html/images/icon_design/stat_sys_ringer_silent_old.png Binary files differnew file mode 100644 index 0000000..d125ce5 --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_ringer_silent_old.png diff --git a/docs/html/images/icon_design/stat_sys_ringer_vibrate.png b/docs/html/images/icon_design/stat_sys_ringer_vibrate.png Binary files differnew file mode 100644 index 0000000..665ca38 --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_ringer_vibrate.png diff --git a/docs/html/images/icon_design/stat_sys_signal_4.png b/docs/html/images/icon_design/stat_sys_signal_4.png Binary files differnew file mode 100644 index 0000000..a3320cb --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_signal_4.png diff --git a/docs/html/images/icon_design/stat_sys_signal_flightmode.png b/docs/html/images/icon_design/stat_sys_signal_flightmode.png Binary files differnew file mode 100644 index 0000000..516ec2f --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_signal_flightmode.png diff --git a/docs/html/images/icon_design/stat_sys_signal_null.png b/docs/html/images/icon_design/stat_sys_signal_null.png Binary files differnew file mode 100644 index 0000000..5aa23f6 --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_signal_null.png diff --git a/docs/html/images/icon_design/stat_sys_speakerphone.png b/docs/html/images/icon_design/stat_sys_speakerphone.png Binary files differnew file mode 100644 index 0000000..642dfd4 --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_speakerphone.png diff --git a/docs/html/images/icon_design/stat_sys_warning.png b/docs/html/images/icon_design/stat_sys_warning.png Binary files differnew file mode 100644 index 0000000..be00f47 --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_warning.png diff --git a/docs/html/images/icon_design/stat_sys_wifi_signal_4.png b/docs/html/images/icon_design/stat_sys_wifi_signal_4.png Binary files differnew file mode 100644 index 0000000..2062aad --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_wifi_signal_4.png diff --git a/docs/html/images/icon_design/stat_sys_wifi_unavailable.png b/docs/html/images/icon_design/stat_sys_wifi_unavailable.png Binary files differnew file mode 100644 index 0000000..53dd45b --- /dev/null +++ b/docs/html/images/icon_design/stat_sys_wifi_unavailable.png diff --git a/docs/html/images/icon_design/statusbar_light.png b/docs/html/images/icon_design/statusbar_light.png Binary files differnew file mode 100644 index 0000000..ddebc2d --- /dev/null +++ b/docs/html/images/icon_design/statusbar_light.png diff --git a/docs/html/images/icon_design/statusbar_palette_black.png b/docs/html/images/icon_design/statusbar_palette_black.png Binary files differnew file mode 100644 index 0000000..fba096f --- /dev/null +++ b/docs/html/images/icon_design/statusbar_palette_black.png diff --git a/docs/html/images/icon_design/statusbar_palette_fill.png b/docs/html/images/icon_design/statusbar_palette_fill.png Binary files differnew file mode 100644 index 0000000..bbf652c --- /dev/null +++ b/docs/html/images/icon_design/statusbar_palette_fill.png diff --git a/docs/html/images/icon_design/statusbar_palette_grey.png b/docs/html/images/icon_design/statusbar_palette_grey.png Binary files differnew file mode 100644 index 0000000..0abb7f4 --- /dev/null +++ b/docs/html/images/icon_design/statusbar_palette_grey.png diff --git a/docs/html/images/icon_design/statusbar_palette_white.png b/docs/html/images/icon_design/statusbar_palette_white.png Binary files differnew file mode 100644 index 0000000..8d7ac41 --- /dev/null +++ b/docs/html/images/icon_design/statusbar_palette_white.png diff --git a/docs/html/images/icon_design/statusbar_structure.png b/docs/html/images/icon_design/statusbar_structure.png Binary files differnew file mode 100644 index 0000000..e7243ee --- /dev/null +++ b/docs/html/images/icon_design/statusbar_structure.png diff --git a/docs/html/images/icon_design/tab_icon_selected.png b/docs/html/images/icon_design/tab_icon_selected.png Binary files differnew file mode 100644 index 0000000..66a8475 --- /dev/null +++ b/docs/html/images/icon_design/tab_icon_selected.png diff --git a/docs/html/images/icon_design/tab_icon_unselected.png b/docs/html/images/icon_design/tab_icon_unselected.png Binary files differnew file mode 100644 index 0000000..80ae9c1 --- /dev/null +++ b/docs/html/images/icon_design/tab_icon_unselected.png diff --git a/docs/html/images/icon_design/tab_palette_selected_fill.png b/docs/html/images/icon_design/tab_palette_selected_fill.png Binary files differnew file mode 100644 index 0000000..7079bda --- /dev/null +++ b/docs/html/images/icon_design/tab_palette_selected_fill.png diff --git a/docs/html/images/icon_design/tab_selected_light.png b/docs/html/images/icon_design/tab_selected_light.png Binary files differnew file mode 100644 index 0000000..3a87c5b --- /dev/null +++ b/docs/html/images/icon_design/tab_selected_light.png diff --git a/docs/html/images/icon_design/tab_unselected_light.png b/docs/html/images/icon_design/tab_unselected_light.png Binary files differnew file mode 100644 index 0000000..f888161 --- /dev/null +++ b/docs/html/images/icon_design/tab_unselected_light.png diff --git a/docs/html/robots.txt b/docs/html/robots.txt index 085b79d..7046373 100644 --- a/docs/html/robots.txt +++ b/docs/html/robots.txt @@ -1,7 +1,8 @@ -User-Agent: *
-Allow: /
-Disallow: /gae_shell/
-Disallow: /assets/
-Disallow: /images/
-Disallow: /sdk/preview/
-Sitemap: http://developer.android.com/sitemap.txt
+User-Agent: * +Allow: / +Disallow: /gae_shell/ +Disallow: /assets/ +Disallow: /images/ +Disallow: /sdk/preview/ +Disallow: /shareables/ +Sitemap: http://developer.android.com/sitemap.txt diff --git a/docs/html/sdk/1.5_r1/index.jd b/docs/html/sdk/1.5_r1/index.jd index 438ee4b..405f56c 100644 --- a/docs/html/sdk/1.5_r1/index.jd +++ b/docs/html/sdk/1.5_r1/index.jd @@ -1,6 +1,7 @@ sdk.version=1.5 sdk.rel.id=1 sdk.date=April 2009 +sdk.not_latest_version=true sdk.win_download=android-sdk-windows-1.5_r1.zip sdk.win_bytes=176263368 diff --git a/docs/html/shareables/icon_templates-v1.0.zip b/docs/html/shareables/icon_templates-v1.0.zip Binary files differnew file mode 100644 index 0000000..3e64f9a --- /dev/null +++ b/docs/html/shareables/icon_templates-v1.0.zip diff --git a/docs/html/sitemap.txt b/docs/html/sitemap.txt index 5bb8cae..a227d09 100644 --- a/docs/html/sitemap.txt +++ b/docs/html/sitemap.txt @@ -75,6 +75,7 @@ http://developer.android.com/guide/publishing/versioning.html http://developer.android.com/guide/publishing/preparing.html http://developer.android.com/guide/publishing/publishing.html http://developer.android.com/guide/practices/ui_guidelines/index.html +http://developer.android.com/guide/practices/ui_guidelines/icon_design.html http://developer.android.com/guide/practices/ui_guidelines/widget_design.html http://developer.android.com/guide/practices/design/performance.html http://developer.android.com/guide/practices/design/responsiveness.html diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h index 6aa40d00..3694803 100644 --- a/include/media/AudioRecord.h +++ b/include/media/AudioRecord.h @@ -39,10 +39,15 @@ class AudioRecord { public: - enum stream_type { + // input sources values must always be defined in the range + // [AudioRecord::DEFAULT_INPUT, AudioRecord::NUM_INPUT_SOURCES[ + enum input_source { DEFAULT_INPUT =-1, MIC_INPUT = 0, - NUM_STREAM_TYPES + VOICE_UPLINK_INPUT = 1, + VOICE_DOWNLINK_INPUT = 2, + VOICE_CALL_INPUT = 3, + NUM_INPUT_SOURCES }; static const int DEFAULT_SAMPLE_RATE = 8000; @@ -118,7 +123,7 @@ public: * * Parameters: * - * streamType: Select the audio input to record to (e.g. AudioRecord::MIC_INPUT). + * inputSource: Select the audio input to record to (e.g. AudioRecord::MIC_INPUT). * sampleRate: Track sampling rate in Hz. * format: PCM sample format (e.g AudioSystem::PCM_16_BIT for signed * 16 bits per sample). @@ -140,7 +145,7 @@ public: RECORD_IIR_ENABLE = AudioSystem::TX_IIR_ENABLE }; - AudioRecord(int streamType, + AudioRecord(int inputSource, uint32_t sampleRate = 0, int format = 0, int channelCount = 0, @@ -165,7 +170,7 @@ public: * - NO_INIT: audio server or audio hardware not initialized * - PERMISSION_DENIED: recording is not allowed for the requesting process * */ - status_t set(int streamType = 0, + status_t set(int inputSource = 0, uint32_t sampleRate = 0, int format = 0, int channelCount = 0, @@ -197,6 +202,7 @@ public: int channelCount() const; uint32_t frameCount() const; int frameSize() const; + int inputSource() const; /* After it's created the track is not active. Call start() to @@ -323,7 +329,8 @@ private: audio_track_cblk_t* mCblk; uint8_t mFormat; uint8_t mChannelCount; - uint8_t mReserved[2]; + uint8_t mInputSource; + uint8_t mReserved; status_t mStatus; uint32_t mLatency; diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h index 6f13fe0..3e59d85 100644 --- a/include/media/IAudioFlinger.h +++ b/include/media/IAudioFlinger.h @@ -54,7 +54,7 @@ public: virtual sp<IAudioRecord> openRecord( pid_t pid, - int streamType, + int inputSource, uint32_t sampleRate, int format, int channelCount, diff --git a/include/media/mediarecorder.h b/include/media/mediarecorder.h index b9ea0c6..aebe191 100644 --- a/include/media/mediarecorder.h +++ b/include/media/mediarecorder.h @@ -35,6 +35,10 @@ typedef void (*media_completion_f)(status_t status, void *cookie); enum audio_source { AUDIO_SOURCE_DEFAULT = 0, AUDIO_SOURCE_MIC = 1, + AUDIO_SOURCE_VOICE_UPLINK = 2, + AUDIO_SOURCE_VOICE_DOWNLINK = 3, + AUDIO_SOURCE_VOICE_CALL = 4, + AUDIO_SOURCE_MAX = AUDIO_SOURCE_VOICE_CALL }; enum video_source { diff --git a/include/ui/Point.h b/include/ui/Point.h index dbbad1e..1653120 100644 --- a/include/ui/Point.h +++ b/include/ui/Point.h @@ -31,12 +31,9 @@ public: // because we want the compiler generated versions // Default constructor doesn't initialize the Point - inline Point() - { + inline Point() { } - - inline Point(int _x, int _y) : x(_x), y(_y) - { + inline Point(int x, int y) : x(x), y(y) { } inline bool operator == (const Point& rhs) const { @@ -57,8 +54,8 @@ public: } inline Point& operator - () { - x=-x; - y=-y; + x = -x; + y = -y; return *this; } @@ -73,11 +70,13 @@ public: return *this; } - Point operator + (const Point& rhs) const { - return Point(x+rhs.x, y+rhs.y); + const Point operator + (const Point& rhs) const { + const Point result(x+rhs.x, y+rhs.y); + return result; } - Point operator - (const Point& rhs) const { - return Point(x-rhs.x, y-rhs.y); + const Point operator - (const Point& rhs) const { + const Point result(x-rhs.x, y-rhs.y); + return result; } }; diff --git a/include/ui/Rect.h b/include/ui/Rect.h index d232847..da72944 100644 --- a/include/ui/Rect.h +++ b/include/ui/Rect.h @@ -33,23 +33,16 @@ public: // we don't provide copy-ctor and operator= on purpose // because we want the compiler generated versions - inline Rect() - { + inline Rect() { } - inline Rect(int w, int h) - : left(0), top(0), right(w), bottom(h) - { + : left(0), top(0), right(w), bottom(h) { } - inline Rect(int l, int t, int r, int b) - : left(l), top(t), right(r), bottom(b) - { + : left(l), top(t), right(r), bottom(b) { } - inline Rect(const Point& lt, const Point& rb) - : left(lt.x), top(lt.y), right(rb.x), bottom(rb.y) - { + : left(lt.x), top(lt.y), right(rb.x), bottom(rb.y) { } void makeInvalid(); @@ -78,21 +71,22 @@ public: return bottom-top; } - // returns left-top Point non-const reference, can be assigned - inline Point& leftTop() { - return reinterpret_cast<Point&>(left); + void setLeftTop(const Point& lt) { + left = lt.x; + top = lt.y; } - // returns right bottom non-const reference, can be assigned - inline Point& rightBottom() { - return reinterpret_cast<Point&>(right); + + void setRightBottom(const Point& rb) { + right = rb.x; + bottom = rb.y; } // the following 4 functions return the 4 corners of the rect as Point - inline const Point& leftTop() const { - return reinterpret_cast<const Point&>(left); + Point leftTop() const { + return Point(left, top); } - inline const Point& rightBottom() const { - return reinterpret_cast<const Point&>(right); + Point rightBottom() const { + return Point(right, bottom); } Point rightTop() const { return Point(right, top); @@ -133,8 +127,8 @@ public: Rect& operator -= (const Point& rhs) { return offsetBy(-rhs.x, -rhs.y); } - Rect operator + (const Point& rhs) const; - Rect operator - (const Point& rhs) const; + const Rect operator + (const Point& rhs) const; + const Rect operator - (const Point& rhs) const; void translate(int dx, int dy) { // legacy, don't use. offsetBy(dx, dy); diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp index e4f4aad..13e457f 100644 --- a/libs/audioflinger/AudioFlinger.cpp +++ b/libs/audioflinger/AudioFlinger.cpp @@ -1553,7 +1553,6 @@ size_t AudioFlinger::MixerThread::getOutputFrameCount() AudioFlinger::MixerThread::TrackBase::TrackBase( const sp<MixerThread>& mixerThread, const sp<Client>& client, - int streamType, uint32_t sampleRate, int format, int channelCount, @@ -1563,7 +1562,6 @@ AudioFlinger::MixerThread::TrackBase::TrackBase( : RefBase(), mMixerThread(mixerThread), mClient(client), - mStreamType(streamType), mFrameCount(0), mState(IDLE), mClientTid(-1), @@ -1713,12 +1711,13 @@ AudioFlinger::MixerThread::Track::Track( int channelCount, int frameCount, const sp<IMemory>& sharedBuffer) - : TrackBase(mixerThread, client, streamType, sampleRate, format, channelCount, frameCount, 0, sharedBuffer) + : TrackBase(mixerThread, client, sampleRate, format, channelCount, frameCount, 0, sharedBuffer) { mVolume[0] = 1.0f; mVolume[1] = 1.0f; mMute = false; mSharedBuffer = sharedBuffer; + mStreamType = streamType; } AudioFlinger::MixerThread::Track::~Track() @@ -1902,15 +1901,15 @@ void AudioFlinger::MixerThread::Track::setVolume(float left, float right) AudioFlinger::MixerThread::RecordTrack::RecordTrack( const sp<MixerThread>& mixerThread, const sp<Client>& client, - int streamType, + int inputSource, uint32_t sampleRate, int format, int channelCount, int frameCount, uint32_t flags) - : TrackBase(mixerThread, client, streamType, sampleRate, format, + : TrackBase(mixerThread, client, sampleRate, format, channelCount, frameCount, flags, 0), - mOverflow(false) + mOverflow(false), mInputSource(inputSource) { } @@ -2235,7 +2234,7 @@ status_t AudioFlinger::TrackHandle::onTransact( sp<IAudioRecord> AudioFlinger::openRecord( pid_t pid, - int streamType, + int inputSource, uint32_t sampleRate, int format, int channelCount, @@ -2258,7 +2257,7 @@ sp<IAudioRecord> AudioFlinger::openRecord( goto Exit; } - if (uint32_t(streamType) >= AudioRecord::NUM_STREAM_TYPES) { + if (uint32_t(inputSource) >= AudioRecord::NUM_INPUT_SOURCES) { LOGE("invalid stream type"); lStatus = BAD_VALUE; goto Exit; @@ -2301,7 +2300,7 @@ sp<IAudioRecord> AudioFlinger::openRecord( frameCount = ((frameCount - 1)/inFrameCount + 1) * inFrameCount; // create new record track. The record track uses one track in mHardwareMixerThread by convention. - recordTrack = new MixerThread::RecordTrack(mHardwareMixerThread, client, streamType, sampleRate, + recordTrack = new MixerThread::RecordTrack(mHardwareMixerThread, client, inputSource, sampleRate, format, channelCount, frameCount, flags); } if (recordTrack->getCblk() == NULL) { @@ -2408,7 +2407,7 @@ bool AudioFlinger::AudioRecordThread::threadLoop() LOGV("AudioRecordThread: loop starting"); if (mRecordTrack != 0) { input = mAudioHardware->openInputStream( - mRecordTrack->type(), + mRecordTrack->inputSource(), mRecordTrack->format(), mRecordTrack->channelCount(), mRecordTrack->sampleRate(), diff --git a/libs/audioflinger/AudioFlinger.h b/libs/audioflinger/AudioFlinger.h index c7ca9ec..8e47b29 100644 --- a/libs/audioflinger/AudioFlinger.h +++ b/libs/audioflinger/AudioFlinger.h @@ -139,7 +139,7 @@ public: // record interface virtual sp<IAudioRecord> openRecord( pid_t pid, - int streamType, + int inputSource, uint32_t sampleRate, int format, int channelCount, @@ -232,7 +232,6 @@ private: TrackBase(const sp<MixerThread>& mixerThread, const sp<Client>& client, - int streamType, uint32_t sampleRate, int format, int channelCount, @@ -260,10 +259,6 @@ private: return mCblk; } - int type() const { - return mStreamType; - } - int format() const { return mFormat; } @@ -293,7 +288,6 @@ private: sp<Client> mClient; sp<IMemory> mCblkMemory; audio_track_cblk_t* mCblk; - int mStreamType; void* mBuffer; void* mBufferEnd; uint32_t mFrameCount; @@ -328,6 +322,11 @@ private: void mute(bool); void setVolume(float left, float right); + int type() const { + return mStreamType; + } + + protected: friend class MixerThread; friend class AudioFlinger; @@ -364,6 +363,7 @@ private: int8_t mRetryCount; sp<IMemory> mSharedBuffer; bool mResetDone; + int mStreamType; }; // end of Track // record track @@ -371,7 +371,7 @@ private: public: RecordTrack(const sp<MixerThread>& mixerThread, const sp<Client>& client, - int streamType, + int inputSource, uint32_t sampleRate, int format, int channelCount, @@ -385,6 +385,8 @@ private: bool overflow() { bool tmp = mOverflow; mOverflow = false; return tmp; } bool setOverflow() { bool tmp = mOverflow; mOverflow = true; return tmp; } + int inputSource() const { return mInputSource; } + private: friend class AudioFlinger; friend class AudioFlinger::RecordHandle; @@ -397,6 +399,7 @@ private: virtual status_t getNextBuffer(AudioBufferProvider::Buffer* buffer); bool mOverflow; + int mInputSource; }; // playback track diff --git a/libs/audioflinger/AudioHardwareGeneric.cpp b/libs/audioflinger/AudioHardwareGeneric.cpp index a97c0bc..1e159b8 100644 --- a/libs/audioflinger/AudioHardwareGeneric.cpp +++ b/libs/audioflinger/AudioHardwareGeneric.cpp @@ -98,8 +98,8 @@ AudioStreamIn* AudioHardwareGeneric::openInputStream( status_t *status, AudioSystem::audio_in_acoustics acoustics) { // check for valid input source - if ((inputSource != AudioRecord::DEFAULT_INPUT) && - (inputSource != AudioRecord::MIC_INPUT)) { + if ((inputSource < AudioRecord::DEFAULT_INPUT) || + (inputSource >= AudioRecord::NUM_INPUT_SOURCES)) { return 0; } diff --git a/libs/audioflinger/AudioHardwareStub.cpp b/libs/audioflinger/AudioHardwareStub.cpp index c61e6e6..0ab4c60 100644 --- a/libs/audioflinger/AudioHardwareStub.cpp +++ b/libs/audioflinger/AudioHardwareStub.cpp @@ -61,8 +61,8 @@ AudioStreamIn* AudioHardwareStub::openInputStream( status_t *status, AudioSystem::audio_in_acoustics acoustics) { // check for valid input source - if ((inputSource != AudioRecord::DEFAULT_INPUT) && - (inputSource != AudioRecord::MIC_INPUT)) { + if ((inputSource < AudioRecord::DEFAULT_INPUT) || + (inputSource >= AudioRecord::NUM_INPUT_SOURCES)) { return 0; } diff --git a/libs/ui/Android.mk b/libs/ui/Android.mk index f944357..b3b2104 100644 --- a/libs/ui/Android.mk +++ b/libs/ui/Android.mk @@ -20,7 +20,6 @@ LOCAL_SRC_FILES:= \ LayerState.cpp \ Overlay.cpp \ PixelFormat.cpp \ - Point.cpp \ Rect.cpp \ Region.cpp \ Surface.cpp \ diff --git a/libs/ui/Point.cpp b/libs/ui/Point.cpp deleted file mode 100644 index 438d49f..0000000 --- a/libs/ui/Point.cpp +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Point.cpp - * Android - * - * Created on 11/16/2006. - * Copyright 2005 The Android Open Source Project - * - */ - -#include <ui/Point.h> - diff --git a/libs/ui/Rect.cpp b/libs/ui/Rect.cpp index 99e68bb..66b9576 100644 --- a/libs/ui/Rect.cpp +++ b/libs/ui/Rect.cpp @@ -1,21 +1,28 @@ /* - * Rect.cpp - * Android + * Copyright (C) 2009 The Android Open Source Project * - * Created on 10/14/05. - * Copyright 2005 The Android Open Source Project + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 <ui/Rect.h> namespace android { -inline int min(int a, int b) { +static inline int min(int a, int b) { return (a<b) ? a : b; } -inline int max(int a, int b) { +static inline int max(int a, int b) { return (a>b) ? a : b; } @@ -64,14 +71,16 @@ Rect& Rect::offsetBy(int x, int y) return *this; } -Rect Rect::operator + (const Point& rhs) const +const Rect Rect::operator + (const Point& rhs) const { - return Rect(left+rhs.x, top+rhs.y, right+rhs.x, bottom+rhs.y); + const Rect result(left+rhs.x, top+rhs.y, right+rhs.x, bottom+rhs.y); + return result; } -Rect Rect::operator - (const Point& rhs) const +const Rect Rect::operator - (const Point& rhs) const { - return Rect(left-rhs.x, top-rhs.y, right-rhs.x, bottom-rhs.y); + const Rect result(left-rhs.x, top-rhs.y, right-rhs.x, bottom-rhs.y); + return result; } bool Rect::intersect(const Rect& with, Rect* result) const diff --git a/media/java/android/media/AudioRecord.java b/media/java/android/media/AudioRecord.java index 3346bed..4d1535f 100644 --- a/media/java/android/media/AudioRecord.java +++ b/media/java/android/media/AudioRecord.java @@ -88,7 +88,7 @@ public class AudioRecord private static final int AUDIORECORD_ERROR_SETUP_ZEROFRAMECOUNT = -16; private static final int AUDIORECORD_ERROR_SETUP_INVALIDCHANNELCOUNT = -17; private static final int AUDIORECORD_ERROR_SETUP_INVALIDFORMAT = -18; - private static final int AUDIORECORD_ERROR_SETUP_INVALIDSTREAMTYPE = -19; + private static final int AUDIORECORD_ERROR_SETUP_INVALIDSOURCE = -19; private static final int AUDIORECORD_ERROR_SETUP_NATIVEINITFAILED = -20; // Events: @@ -113,13 +113,7 @@ public class AudioRecord */ @SuppressWarnings("unused") private int mNativeRecorderInJavaObj; - /** - * Accessed by native methods: provides access to record source constants - */ - @SuppressWarnings("unused") - private final static int SOURCE_DEFAULT = MediaRecorder.AudioSource.DEFAULT; - @SuppressWarnings("unused") - private final static int SOURCE_MIC = MediaRecorder.AudioSource.MIC; + /** * Accessed by native methods: provides access to the callback data. */ @@ -252,8 +246,8 @@ public class AudioRecord //-------------- // audio source - if ( (audioSource != MediaRecorder.AudioSource.DEFAULT) - && (audioSource != MediaRecorder.AudioSource.MIC) ) { + if ( (audioSource < MediaRecorder.AudioSource.DEFAULT) || + (audioSource > MediaRecorder.getAudioSourceMax()) ) { throw (new IllegalArgumentException("Invalid audio source.")); } else { mRecordSource = audioSource; diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java index 5d90e62..44f21c8 100644 --- a/media/java/android/media/MediaRecorder.java +++ b/media/java/android/media/MediaRecorder.java @@ -125,6 +125,15 @@ public class MediaRecorder public static final int DEFAULT = 0; /** Microphone audio source */ public static final int MIC = 1; + + /** Voice call uplink (Tx) audio source */ + public static final int VOICE_UPLINK = 2; + + /** Voice call downlink (Rx) audio source */ + public static final int VOICE_DOWNLINK = 3; + + /** Voice call uplink + downlink audio source */ + public static final int VOICE_CALL = 4; } /** @@ -203,6 +212,12 @@ public class MediaRecorder throws IllegalStateException; /** + * Gets the maximum value for audio sources. + * @see android.media.MediaRecorder.AudioSource + */ + public static final int getAudioSourceMax() { return AudioSource.VOICE_CALL; } + + /** * Sets the video source to be used for recording. If this method is not * called, the output file will not contain an video track. The source needs * to be specified before setting recording-parameters or encoders. Call diff --git a/media/jni/android_media_MediaRecorder.cpp b/media/jni/android_media_MediaRecorder.cpp index cac65d6..7561af1 100644 --- a/media/jni/android_media_MediaRecorder.cpp +++ b/media/jni/android_media_MediaRecorder.cpp @@ -177,7 +177,7 @@ static void android_media_MediaRecorder_setAudioSource(JNIEnv *env, jobject thiz, jint as) { LOGV("setAudioSource(%d)", as); - if (as < AUDIO_SOURCE_DEFAULT || as > AUDIO_SOURCE_MIC) { + if (as < AUDIO_SOURCE_DEFAULT || as > AUDIO_SOURCE_MAX) { jniThrowException(env, "java/lang/IllegalArgumentException", "Invalid audio source"); return; } diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp index 1720af0..4c8b02a 100644 --- a/media/libmedia/AudioRecord.cpp +++ b/media/libmedia/AudioRecord.cpp @@ -50,7 +50,7 @@ AudioRecord::AudioRecord() } AudioRecord::AudioRecord( - int streamType, + int inputSource, uint32_t sampleRate, int format, int channelCount, @@ -61,7 +61,7 @@ AudioRecord::AudioRecord( int notificationFrames) : mStatus(NO_INIT) { - mStatus = set(streamType, sampleRate, format, channelCount, + mStatus = set(inputSource, sampleRate, format, channelCount, frameCount, flags, cbf, user, notificationFrames); } @@ -82,7 +82,7 @@ AudioRecord::~AudioRecord() } status_t AudioRecord::set( - int streamType, + int inputSource, uint32_t sampleRate, int format, int channelCount, @@ -104,8 +104,8 @@ status_t AudioRecord::set( return NO_INIT; } - if (streamType == DEFAULT_INPUT) { - streamType = MIC_INPUT; + if (inputSource == DEFAULT_INPUT) { + inputSource = MIC_INPUT; } if (sampleRate == 0) { @@ -157,7 +157,7 @@ status_t AudioRecord::set( // open record channel status_t status; - sp<IAudioRecord> record = audioFlinger->openRecord(getpid(), streamType, + sp<IAudioRecord> record = audioFlinger->openRecord(getpid(), inputSource, sampleRate, format, channelCount, frameCount, @@ -201,6 +201,7 @@ status_t AudioRecord::set( mMarkerReached = false; mNewPosition = 0; mUpdatePeriod = 0; + mInputSource = (uint8_t)inputSource; return NO_ERROR; } @@ -242,6 +243,11 @@ int AudioRecord::frameSize() const return channelCount()*((format() == AudioSystem::PCM_8_BIT) ? sizeof(uint8_t) : sizeof(int16_t)); } +int AudioRecord::inputSource() const +{ + return (int)mInputSource; +} + // ------------------------------------------------------------------------- status_t AudioRecord::start() diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp index 52bd7d4..eeaa54f 100644 --- a/media/libmedia/IAudioFlinger.cpp +++ b/media/libmedia/IAudioFlinger.cpp @@ -99,7 +99,7 @@ public: virtual sp<IAudioRecord> openRecord( pid_t pid, - int streamType, + int inputSource, uint32_t sampleRate, int format, int channelCount, @@ -110,7 +110,7 @@ public: Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32(pid); - data.writeInt32(streamType); + data.writeInt32(inputSource); data.writeInt32(sampleRate); data.writeInt32(format); data.writeInt32(channelCount); @@ -384,14 +384,14 @@ status_t BnAudioFlinger::onTransact( case OPEN_RECORD: { CHECK_INTERFACE(IAudioFlinger, data, reply); pid_t pid = data.readInt32(); - int streamType = data.readInt32(); + int inputSource = data.readInt32(); uint32_t sampleRate = data.readInt32(); int format = data.readInt32(); int channelCount = data.readInt32(); size_t bufferCount = data.readInt32(); uint32_t flags = data.readInt32(); status_t status; - sp<IAudioRecord> record = openRecord(pid, streamType, + sp<IAudioRecord> record = openRecord(pid, inputSource, sampleRate, format, channelCount, bufferCount, flags, &status); reply->writeInt32(status); reply->writeStrongBinder(record->asBinder()); diff --git a/media/libmedia/IMediaPlayer.cpp b/media/libmedia/IMediaPlayer.cpp index f37519f..f18765a 100644 --- a/media/libmedia/IMediaPlayer.cpp +++ b/media/libmedia/IMediaPlayer.cpp @@ -164,6 +164,7 @@ public: status_t setVolume(float leftVolume, float rightVolume) { Parcel data, reply; + data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); data.writeFloat(leftVolume); data.writeFloat(rightVolume); remote()->transact(SET_VOLUME, data, &reply); @@ -261,6 +262,7 @@ status_t BnMediaPlayer::onTransact( return NO_ERROR; } break; case SET_VOLUME: { + CHECK_INTERFACE(IMediaPlayer, data, reply); reply->writeInt32(setVolume(data.readFloat(), data.readFloat())); return NO_ERROR; } break; diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index f2959e3..d1c40b4 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -4733,6 +4733,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen app.thread = thread; app.curAdj = app.setAdj = -100; + app.curSchedGroup = app.setSchedGroup = Process.THREAD_GROUP_DEFAULT; app.forcingToForeground = null; app.foregroundServices = false; app.debugging = false; @@ -8802,9 +8803,9 @@ public final class ActivityManagerService extends ActivityManagerNative implemen + " #" + i + ":"); r.dump(pw, prefix + " "); } else if (inclOomAdj) { - pw.println(String.format("%s%s #%2d: oom_adj=%3d %s", + pw.println(String.format("%s%s #%2d: adj=%3d/%d %s", prefix, (r.persistent ? persistentLabel : normalLabel), - i, r.setAdj, r.toString())); + i, r.setAdj, r.setSchedGroup, r.toString())); } else { pw.println(String.format("%s%s #%2d: %s", prefix, (r.persistent ? persistentLabel : normalLabel), @@ -11830,7 +11831,10 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } app.curAdj = adj; - + app.curSchedGroup = (adj > VISIBLE_APP_ADJ && !app.persistent) + ? Process.THREAD_GROUP_BG_NONINTERACTIVE + : Process.THREAD_GROUP_DEFAULT; + return adj; } @@ -11975,6 +11979,28 @@ public final class ActivityManagerService extends ActivityManagerNative implemen return false; } } + if (app.setSchedGroup != app.curSchedGroup) { + app.setSchedGroup = app.curSchedGroup; + if (DEBUG_SWITCH || DEBUG_OOM_ADJ) Log.v(TAG, + "Setting process group of " + app.processName + + " to " + app.curSchedGroup); + if (true) { + try { + Process.setProcessGroup(app.pid, app.curSchedGroup); + } catch (Exception e) { + Log.w(TAG, "Failed setting process group of " + app.pid + + " to " + app.curSchedGroup); + } + } + if (false) { + if (app.thread != null) { + try { + app.thread.setSchedulingGroup(app.curSchedGroup); + } catch (RemoteException e) { + } + } + } + } } return true; diff --git a/services/java/com/android/server/am/ProcessRecord.java b/services/java/com/android/server/am/ProcessRecord.java index 419dadf..3f59710 100644 --- a/services/java/com/android/server/am/ProcessRecord.java +++ b/services/java/com/android/server/am/ProcessRecord.java @@ -56,6 +56,8 @@ class ProcessRecord implements Watchdog.PssRequestor { int setRawAdj; // Last set OOM unlimited adjustment for this process int curAdj; // Current OOM adjustment for this process int setAdj; // Last set OOM adjustment for this process + int curSchedGroup; // Currently desired scheduling class + int setSchedGroup; // Last set to background scheduling class boolean isForeground; // Is this app running the foreground UI? boolean setIsForeground; // Running foreground UI when last set? boolean foregroundServices; // Running any services that are foreground? @@ -147,6 +149,8 @@ class ProcessRecord implements Watchdog.PssRequestor { pw.print(" setRaw="); pw.print(setRawAdj); pw.print(" cur="); pw.print(curAdj); pw.print(" set="); pw.println(setAdj); + pw.print(prefix); pw.print("curSchedGroup="); pw.print(curSchedGroup); + pw.print(" setSchedGroup="); pw.println(setSchedGroup); pw.print(prefix); pw.print("isForeground="); pw.print(isForeground); pw.print(" setIsForeground="); pw.print(setIsForeground); pw.print(" foregroundServices="); pw.print(foregroundServices); diff --git a/telephony/java/com/android/internal/telephony/ServiceStateTracker.java b/telephony/java/com/android/internal/telephony/ServiceStateTracker.java index 5112ba0..bdcf3f7 100644 --- a/telephony/java/com/android/internal/telephony/ServiceStateTracker.java +++ b/telephony/java/com/android/internal/telephony/ServiceStateTracker.java @@ -156,6 +156,9 @@ public abstract class ServiceStateTracker extends Handler { } + public boolean getDesiredPowerState() { + return mDesiredPowerState; + } /** * Registration point for combined roaming on diff --git a/telephony/java/com/android/internal/telephony/SmsHeader.java b/telephony/java/com/android/internal/telephony/SmsHeader.java index d220648..7872eec 100644 --- a/telephony/java/com/android/internal/telephony/SmsHeader.java +++ b/telephony/java/com/android/internal/telephony/SmsHeader.java @@ -111,7 +111,10 @@ public class SmsHeader { /** * NOTE: as defined in the spec, ConcatRef and PortAddr * fields should not reoccur, but if they do the last - * occurrence is to be used. + * occurrence is to be used. Also, for ConcatRef + * elements, if the count is zero, sequence is zero, or + * sequence is larger than count, the entire element is to + * be ignored. */ int id = inStream.read(); int length = inStream.read(); @@ -124,7 +127,10 @@ public class SmsHeader { concatRef.msgCount = inStream.read(); concatRef.seqNumber = inStream.read(); concatRef.isEightBits = true; - smsHeader.concatRef = concatRef; + if (concatRef.msgCount != 0 && concatRef.seqNumber != 0 && + concatRef.seqNumber <= concatRef.msgCount) { + smsHeader.concatRef = concatRef; + } break; case ELT_ID_CONCATENATED_16_BIT_REFERENCE: concatRef = new ConcatRef(); @@ -132,7 +138,10 @@ public class SmsHeader { concatRef.msgCount = inStream.read(); concatRef.seqNumber = inStream.read(); concatRef.isEightBits = false; - smsHeader.concatRef = concatRef; + if (concatRef.msgCount != 0 && concatRef.seqNumber != 0 && + concatRef.seqNumber <= concatRef.msgCount) { + smsHeader.concatRef = concatRef; + } break; case ELT_ID_APPLICATION_PORT_ADDRESSING_8_BIT: portAddrs = new PortAddrs(); diff --git a/telephony/java/com/android/internal/telephony/TelephonyEventLog.java b/telephony/java/com/android/internal/telephony/TelephonyEventLog.java index 97f9d7d..cdce488 100644 --- a/telephony/java/com/android/internal/telephony/TelephonyEventLog.java +++ b/telephony/java/com/android/internal/telephony/TelephonyEventLog.java @@ -30,4 +30,6 @@ public final class TelephonyEventLog { public static final int EVENT_LOG_CGREG_FAIL = 50107; public static final int EVENT_LOG_DATA_STATE_RADIO_OFF = 50108; public static final int EVENT_LOG_PDP_NETWORK_DROP = 50109; + public static final int EVENT_LOG_CDMA_DATA_SETUP_FAILED = 50110; + public static final int EVENT_LOG_CDMA_DATA_DROP = 50111; } diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java index 2cbad78..a9c0f46 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java @@ -146,12 +146,16 @@ public class CdmaDataConnection extends DataConnection { null, obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE)); } + private void tearDownData(Message msg) { + if (phone.mCM.getRadioState().isOn()) { + phone.mCM.deactivateDataCall(cid, obtainMessage(EVENT_DEACTIVATE_DONE, msg)); + } + } + protected void disconnect(Message msg) { onDisconnect = msg; if (state == State.ACTIVE) { - if (phone.mCM.getRadioState().isOn()) { - phone.mCM.deactivateDataCall(cid, obtainMessage(EVENT_DEACTIVATE_DONE, msg)); - } + tearDownData(msg); } else if (state == State.ACTIVATING) { receivedDisconnectReq = true; } else { @@ -280,7 +284,7 @@ public class CdmaDataConnection extends DataConnection { // Don't bother reporting success if there's already a // pending disconnect request, since DataConnectionTracker // has already updated its state. - disconnect(onDisconnect); + tearDownData(onDisconnect); } else { String[] response = ((String[]) ar.result); cid = Integer.parseInt(response[0]); diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java index 64f9387..bf58ab7 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java @@ -39,6 +39,7 @@ import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; import android.telephony.ServiceState; import android.telephony.TelephonyManager; +import android.telephony.cdma.CdmaCellLocation; import android.util.EventLog; import android.text.TextUtils; import android.util.Log; @@ -55,10 +56,6 @@ import com.android.internal.telephony.TelephonyEventLog; import java.util.ArrayList; /** - * WINK:TODO: In GsmDataConnectionTracker there are - * EventLog's used quite a few places maybe - * more need to be added in this file? - * * {@hide} */ public final class CdmaDataConnectionTracker extends DataConnectionTracker { @@ -312,13 +309,11 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { Log.d(LOG_TAG, "setDataEnabled("+enable+") isEnabled=" + isEnabled); if (!isEnabled && enable) { setEnabled(EXTERNAL_NETWORK_DEFAULT_ID, true); - return trySetupData(Phone.REASON_DATA_ENABLED); + sendMessage(obtainMessage(EVENT_TRY_SETUP_DATA)); } else if (!enable) { setEnabled(EXTERNAL_NETWORK_DEFAULT_ID, false); cleanUpConnection(true, Phone.REASON_DATA_DISABLED); - return true; - } else // isEnabled && enable - + } return true; } @@ -363,6 +358,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { int psState = mCdmaPhone.mSST.getCurrentCdmaDataConnectionState(); boolean roaming = phone.getServiceState().getRoaming(); + boolean desiredPowerState = mCdmaPhone.mSST.getDesiredPowerState(); if ((state == State.IDLE || state == State.SCANNING) && (psState == ServiceState.RADIO_TECHNOLOGY_1xRTT || @@ -372,7 +368,8 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { mCdmaPhone.mRuimRecords.getRecordsLoaded()) && (mCdmaPhone.mSST.isConcurrentVoiceAndData() || phone.getState() == Phone.State.IDLE ) - && isDataAllowed()) { + && isDataAllowed() + && desiredPowerState) { return setupData(reason); @@ -387,7 +384,8 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { " phoneState=" + phone.getState() + " dataEnabled=" + getAnyDataEnabled() + " roaming=" + roaming + - " dataOnRoamingEnable=" + getDataOnRoamingEnabled()); + " dataOnRoamingEnable=" + getDataOnRoamingEnabled() + + " desiredPowerState=" + desiredPowerState); } return false; } @@ -578,7 +576,14 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { } if (sentSinceLastRecv >= NUMBER_SENT_PACKETS_OF_HANG) { - // we already have NUMBER_SENT_PACKETS sent without ack + // Packets sent without ack exceeded threshold. + + if (mNoRecvPollCount == 0) { + EventLog.writeEvent( + TelephonyEventLog.EVENT_LOG_RADIO_RESET_COUNTDOWN_TRIGGERED, + sentSinceLastRecv); + } + if (mNoRecvPollCount < NO_RECV_POLL_LIMIT) { mNoRecvPollCount++; // Slow down the poll interval to let things happen @@ -590,6 +595,8 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { netStatPollEnabled = false; stopNetStatPoll(); restartRadio(); + EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_RADIO_RESET, + NO_RECV_POLL_LIMIT); } } else { mNoRecvPollCount = 0; @@ -845,6 +852,13 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { if (state == State.FAILED) { cleanUpConnection(false, Phone.REASON_CDMA_DATA_DETACHED); nextReconnectDelay = RECONNECT_DELAY_INITIAL_MILLIS; + + CdmaCellLocation loc = (CdmaCellLocation)(phone.getCellLocation()); + int bsid = (loc != null) ? loc.getBaseStationId() : -1; + + EventLog.List val = new EventLog.List(bsid, + TelephonyManager.getDefault().getNetworkType()); + EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_CDMA_DATA_SETUP_FAILED, val); } trySetupData(Phone.REASON_CDMA_DATA_DETACHED); } @@ -870,10 +884,11 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { } } else { - int cid = -1; - EventLog.List val = new EventLog.List(cid, + CdmaCellLocation loc = (CdmaCellLocation)(phone.getCellLocation()); + int bsid = (loc != null) ? loc.getBaseStationId() : -1; + EventLog.List val = new EventLog.List(bsid, TelephonyManager.getDefault().getNetworkType()); - EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_PDP_NETWORK_DROP, val); + EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_CDMA_DATA_DROP, val); cleanUpConnection(true, null); } diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index 1d7aaf1..49e2daf 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -478,7 +478,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { setEnabled(Phone.APN_TYPE_DEFAULT, true); // trySetupData() will be a no-op if we are currently // connected to the MMS APN - return trySetupData(Phone.REASON_DATA_ENABLED); + sendMessage(obtainMessage(EVENT_TRY_SETUP_DATA)); + return true; } else if (!enable) { setEnabled(Phone.APN_TYPE_DEFAULT, false); // Don't tear down if there is an active APN and it handles MMS or SUPL. @@ -579,6 +580,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { int gprsState = ((GSMPhone) phone).mSST.getCurrentGprsState(); boolean roaming = phone.getServiceState().getRoaming(); + boolean desiredPowerState = ((GSMPhone) phone).mSST.getDesiredPowerState(); if ((state == State.IDLE || state == State.SCANNING) && (gprsState == ServiceState.STATE_IN_SERVICE || noAutoAttach) @@ -586,7 +588,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { && ( ((GSMPhone) phone).mSST.isConcurrentVoiceAndData() || phone.getState() == Phone.State.IDLE ) && isDataAllowed() - && !mIsPsRestricted ) { + && !mIsPsRestricted + && desiredPowerState ) { if (state == State.IDLE) { waitingApns = buildWaitingApns(); @@ -614,7 +617,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { " dataEnabled=" + getAnyDataEnabled() + " roaming=" + roaming + " dataOnRoamingEnable=" + getDataOnRoamingEnabled() + - " ps restricted=" + mIsPsRestricted); + " ps restricted=" + mIsPsRestricted + + " desiredPowerState=" + desiredPowerState); return false; } } diff --git a/tests/AndroidTests/src/com/android/unit_tests/CdmaSmsTest.java b/tests/AndroidTests/src/com/android/unit_tests/CdmaSmsTest.java index f8d5d4d..75fd157 100644 --- a/tests/AndroidTests/src/com/android/unit_tests/CdmaSmsTest.java +++ b/tests/AndroidTests/src/com/android/unit_tests/CdmaSmsTest.java @@ -169,6 +169,43 @@ public class CdmaSmsTest extends AndroidTestCase { } @SmallTest + public void testUserDataHeaderIllegalConcatRef() throws Exception { + BearerData bearerData = new BearerData(); + bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; + bearerData.messageId = 55; + SmsHeader.ConcatRef concatRef = new SmsHeader.ConcatRef(); + concatRef.refNumber = 0x10; + concatRef.msgCount = 0; + concatRef.seqNumber = 2; + concatRef.isEightBits = true; + SmsHeader smsHeader = new SmsHeader(); + smsHeader.concatRef = concatRef; + byte[] encodedHeader = SmsHeader.toByteArray(smsHeader); + SmsHeader decodedHeader = SmsHeader.fromByteArray(encodedHeader); + assertEquals(decodedHeader.concatRef, null); + concatRef.isEightBits = false; + encodedHeader = SmsHeader.toByteArray(smsHeader); + decodedHeader = SmsHeader.fromByteArray(encodedHeader); + assertEquals(decodedHeader.concatRef, null); + concatRef.msgCount = 1; + concatRef.seqNumber = 2; + encodedHeader = SmsHeader.toByteArray(smsHeader); + decodedHeader = SmsHeader.fromByteArray(encodedHeader); + assertEquals(decodedHeader.concatRef, null); + concatRef.msgCount = 1; + concatRef.seqNumber = 0; + encodedHeader = SmsHeader.toByteArray(smsHeader); + decodedHeader = SmsHeader.fromByteArray(encodedHeader); + assertEquals(decodedHeader.concatRef, null); + concatRef.msgCount = 2; + concatRef.seqNumber = 1; + encodedHeader = SmsHeader.toByteArray(smsHeader); + decodedHeader = SmsHeader.fromByteArray(encodedHeader); + assertEquals(decodedHeader.concatRef.msgCount, 2); + assertEquals(decodedHeader.concatRef.seqNumber, 1); + } + + @SmallTest public void testUserDataHeaderMixedFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; diff --git a/tts/java/android/tts/Tts.java b/tts/java/android/tts/Tts.java new file mode 100755 index 0000000..6c8b36d --- /dev/null +++ b/tts/java/android/tts/Tts.java @@ -0,0 +1,605 @@ +/* + * Copyright (C) 2009 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package android.tts; + +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.ServiceConnection; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.os.IBinder; +import android.os.RemoteException; +import android.util.Log; + +/** + * @hide + * + * Synthesizes speech from text. This abstracts away the complexities of using + * the TTS service such as setting up the IBinder connection and handling + * RemoteExceptions, etc. + * + * The TTS should always be safe the use; if the user does not have the + * necessary TTS apk installed, the behavior is that all calls to the TTS act as + * no-ops. + * + */ +//FIXME #TTS# review + complete javadoc +public class Tts { + + + /** + * Called when the TTS has initialized + * + * The InitListener must implement the onInit function. onInit is passed the + * version number of the TTS library that the user has installed; since this + * is called when the TTS has started, it is a good time to make sure that + * the user's TTS library is up to date. + */ + public interface OnInitListener { + public void onInit(int version); + } + + /** + * Called when the TTS has finished speaking by itself (speaking + * finished without being canceled). + * + */ + public interface OnSpeechCompletedListener { + public void onSpeechCompleted(); + } + + /** + * Connection needed for the TTS + */ + private ServiceConnection serviceConnection; + + private ITts itts = null; + private Context ctx = null; + private OnInitListener cb = null; + private int version = -1; + private boolean started = false; + private final Object startLock = new Object(); + private boolean showInstaller = false; + private ITtsCallback ittscallback; + private OnSpeechCompletedListener speechCompletedCallback = null; + + + /** + * The constructor for the TTS. + * + * @param context + * The context + * @param callback + * The InitListener that should be called when the TTS has + * initialized successfully. + * @param displayInstallMessage + * Boolean indicating whether or not an installation prompt + * should be displayed to users who do not have the TTS library. + * If this is true, a generic alert asking the user to install + * the TTS will be used. If you wish to specify the exact message + * of that prompt, please use TTS(Context context, InitListener + * callback, TTSVersionAlert alert) as the constructor instead. + */ + public Tts(Context context, OnInitListener callback, + boolean displayInstallMessage) { + showInstaller = displayInstallMessage; + ctx = context; + cb = callback; + if (dataFilesCheck()) { + initTts(); + } + } + + /** + * The constructor for the TTS. + * + * @param context + * The context + * @param callback + * The InitListener that should be called when the TTS has + * initialized successfully. + */ + public Tts(Context context, OnInitListener callback) { + // FIXME #TTS# support TtsVersionAlert + // showInstaller = true; + // versionAlert = alert; + ctx = context; + cb = callback; + if (dataFilesCheck()) { + initTts(); + } + } + + + public void setOnSpeechCompletedListener( + final OnSpeechCompletedListener listener) { + speechCompletedCallback = listener; + } + + + private boolean dataFilesCheck() { + // FIXME #TTS# config manager will be in settings + Log.i("TTS_FIXME", "FIXME in Tts: config manager will be in settings"); + // FIXME #TTS# implement checking of the correct installation of + // the data files. + + return true; + } + + + private void initTts() { + started = false; + + // Initialize the TTS, run the callback after the binding is successful + serviceConnection = new ServiceConnection() { + public void onServiceConnected(ComponentName name, IBinder service) { + synchronized(startLock) { + itts = ITts.Stub.asInterface(service); + try { + ittscallback = new ITtsCallback.Stub() { + //@Override + public void markReached(String mark) + throws RemoteException { + if (speechCompletedCallback != null) { + speechCompletedCallback.onSpeechCompleted(); + } + } + }; + itts.registerCallback(ittscallback); + + } catch (RemoteException e) { + initTts(); + return; + } + + started = true; + // The callback can become null if the Android OS decides to + // restart the TTS process as well as whatever is using it. + // In such cases, do nothing - the error handling from the + // speaking calls will kick in and force a proper restart of + // the TTS. + if (cb != null) { + cb.onInit(version); + } + } + } + + public void onServiceDisconnected(ComponentName name) { + synchronized(startLock) { + itts = null; + cb = null; + started = false; + } + } + }; + + Intent intent = new Intent("android.intent.action.USE_TTS"); + intent.addCategory("android.intent.category.TTS"); + // Binding will fail only if the TTS doesn't exist; + // the TTSVersionAlert will give users a chance to install + // the needed TTS. + if (!ctx.bindService(intent, serviceConnection, + Context.BIND_AUTO_CREATE)) { + if (showInstaller) { + // FIXME #TTS# show version alert + } + } + } + + + /** + * Shuts down the TTS. It is good practice to call this in the onDestroy + * method of the Activity that is using the TTS so that the TTS is stopped + * cleanly. + */ + public void shutdown() { + try { + ctx.unbindService(serviceConnection); + } catch (IllegalArgumentException e) { + // Do nothing and fail silently since an error here indicates that + // binding never succeeded in the first place. + } + } + + + /** + * Adds a mapping between a string of text and a sound resource in a + * package. + * + * @see #TTS.speak(String text, int queueMode, String[] params) + * + * @param text + * Example: <b><code>"south_south_east"</code></b><br/> + * + * @param packagename + * Pass the packagename of the application that contains the + * resource. If the resource is in your own application (this is + * the most common case), then put the packagename of your + * application here.<br/> + * Example: <b>"com.google.marvin.compass"</b><br/> + * The packagename can be found in the AndroidManifest.xml of + * your application. + * <p> + * <code><manifest xmlns:android="..." + * package="<b>com.google.marvin.compass</b>"></code> + * </p> + * + * @param resourceId + * Example: <b><code>R.raw.south_south_east</code></b> + */ + public void addSpeech(String text, String packagename, int resourceId) { + synchronized(startLock) { + if (!started) { + return; + } + try { + itts.addSpeech(text, packagename, resourceId); + } catch (RemoteException e) { + // TTS died; restart it. + started = false; + initTts(); + } catch (NullPointerException e) { + // TTS died; restart it. + started = false; + initTts(); + } catch (IllegalStateException e) { + // TTS died; restart it. + started = false; + initTts(); + } + } + } + + + /** + * Adds a mapping between a string of text and a sound file. Using this, it + * is possible to add custom pronounciations for text. + * + * @param text + * The string of text + * @param filename + * The full path to the sound file (for example: + * "/sdcard/mysounds/hello.wav") + */ + public void addSpeech(String text, String filename) { + synchronized (startLock) { + if (!started) { + return; + } + try { + itts.addSpeechFile(text, filename); + } catch (RemoteException e) { + // TTS died; restart it. + started = false; + initTts(); + } catch (NullPointerException e) { + // TTS died; restart it. + started = false; + initTts(); + } catch (IllegalStateException e) { + // TTS died; restart it. + started = false; + initTts(); + } + } + } + + + /** + * Speaks the string using the specified queuing strategy and speech + * parameters. Note that the speech parameters are not universally supported + * by all engines and will be treated as a hint. The TTS library will try to + * fulfill these parameters as much as possible, but there is no guarantee + * that the voice used will have the properties specified. + * + * @param text + * The string of text to be spoken. + * @param queueMode + * The queuing strategy to use. Use 0 for no queuing, and 1 for + * queuing. + * @param params + * The array of speech parameters to be used. Currently, only + * params[0] is defined - it is for setting the type of voice if + * the engine allows it. Possible values are "VOICE_MALE", + * "VOICE_FEMALE", and "VOICE_ROBOT". Note that right now only + * the pre-recorded voice has this support - this setting has no + * effect on eSpeak. + */ + public void speak(String text, int queueMode, String[] params) { + synchronized (startLock) { + Log.i("TTS received: ", text); + if (!started) { + return; + } + try { + itts.speak(text, queueMode, params); + } catch (RemoteException e) { + // TTS died; restart it. + started = false; + initTts(); + } catch (NullPointerException e) { + // TTS died; restart it. + started = false; + initTts(); + } catch (IllegalStateException e) { + // TTS died; restart it. + started = false; + initTts(); + } + } + } + + + /** + * Plays the earcon using the specified queueing mode and parameters. + * + * @param earcon + * The earcon that should be played + * @param queueMode + * 0 for no queue (interrupts all previous utterances), 1 for + * queued + * @param params + * An ArrayList of parameters. + */ + public void playEarcon(String earcon, int queueMode, String[] params) { + synchronized (startLock) { + if (!started) { + return; + } + try { + itts.playEarcon(earcon, queueMode, params); + } catch (RemoteException e) { + // TTS died; restart it. + started = false; + initTts(); + } catch (NullPointerException e) { + // TTS died; restart it. + started = false; + initTts(); + } catch (IllegalStateException e) { + // TTS died; restart it. + started = false; + initTts(); + } + } + } + + + /** + * Returns whether or not the TTS is busy speaking. + * + * @return Whether or not the TTS is busy speaking. + */ + public boolean isSpeaking() { + synchronized (startLock) { + if (!started) { + return false; + } + try { + return itts.isSpeaking(); + } catch (RemoteException e) { + // TTS died; restart it. + started = false; + initTts(); + } catch (NullPointerException e) { + // TTS died; restart it. + started = false; + initTts(); + } catch (IllegalStateException e) { + // TTS died; restart it. + started = false; + initTts(); + } + return false; + } + } + + + /** + * Stops speech from the TTS. + */ + public void stop() { + synchronized (startLock) { + if (!started) { + return; + } + try { + itts.stop(); + } catch (RemoteException e) { + // TTS died; restart it. + started = false; + initTts(); + } catch (NullPointerException e) { + // TTS died; restart it. + started = false; + initTts(); + } catch (IllegalStateException e) { + // TTS died; restart it. + started = false; + initTts(); + } + } + } + + + /** + * Returns the version number of the TTS library that the user has + * installed. + * + * @return The version number of the TTS library that the user has + * installed. + */ + public int getVersion() { + return version; + } + + + /** + * Sets the TTS engine to be used. + * + * @param selectedEngine + * The TTS engine that should be used. + */ + public void setEngine(String engineName, String[] requestedLanguages, int strictness) { + synchronized (startLock) { + if (!started) { + return; + } + try { + itts.setEngine(engineName, requestedLanguages, strictness); + } catch (RemoteException e) { + // TTS died; restart it. + started = false; + initTts(); + } + } + } + + + /** + * Sets the speech rate for the TTS engine. + * + * Note that the speech rate is not universally supported by all engines and + * will be treated as a hint. The TTS library will try to use the specified + * speech rate, but there is no guarantee. + * + * Currently, this will change the speech rate for the espeak engine, but it + * has no effect on any pre-recorded speech. + * + * @param speechRate + * The speech rate for the TTS engine. + */ + public void setSpeechRate(int speechRate) { + synchronized (startLock) { + if (!started) { + return; + } + try { + itts.setSpeechRate(speechRate); + } catch (RemoteException e) { + // TTS died; restart it. + started = false; + initTts(); + } + } + } + + + /** + * Sets the language for the TTS engine. + * + * Note that the language is not universally supported by all engines and + * will be treated as a hint. The TTS library will try to use the specified + * language, but there is no guarantee. + * + * Currently, this will change the language for the espeak engine, but it + * has no effect on any pre-recorded speech. + * + * @param language + * The language to be used. The languages are specified by their + * IETF language tags as defined by BCP 47. This is the same + * standard used for the lang attribute in HTML. See: + * http://en.wikipedia.org/wiki/IETF_language_tag + */ + public void setLanguage(String language) { + synchronized (startLock) { + if (!started) { + return; + } + try { + itts.setLanguage(language); + } catch (RemoteException e) { + // TTS died; restart it. + started = false; + initTts(); + } + } + } + + + /** + * Speaks the given text using the specified queueing mode and parameters. + * + * @param text + * The String of text that should be synthesized + * @param params + * An ArrayList of parameters. The first element of this array + * controls the type of voice to use. + * @param filename + * The string that gives the full output filename; it should be + * something like "/sdcard/myappsounds/mysound.wav". + * @return A boolean that indicates if the synthesis succeeded + */ + public boolean synthesizeToFile(String text, String[] params, + String filename) { + synchronized (startLock) { + if (!started) { + return false; + } + try { + return itts.synthesizeToFile(text, params, filename); + } catch (RemoteException e) { + // TTS died; restart it. + started = false; + initTts(); + } catch (NullPointerException e) { + // TTS died; restart it. + started = false; + initTts(); + } catch (IllegalStateException e) { + // TTS died; restart it. + started = false; + initTts(); + } + return false; + } + } + + + /** + * Displays an alert that prompts users to install the TTS engine. + * This is useful if the application expects a newer version + * of the TTS than what the user has. + */ + public void showVersionAlert() { + if (!started) { + return; + } + // FIXME #TTS# implement show version alert + } + + + /** + * Checks if the TTS service is installed or not + * + * @return A boolean that indicates whether the TTS service is installed + */ + // TODO: TTS Service itself will always be installed. Factor this out + // (may need to add another method to see if there are any working + // TTS engines on the device). + public static boolean isInstalled(Context ctx) { + PackageManager pm = ctx.getPackageManager(); + Intent intent = new Intent("android.intent.action.USE_TTS"); + intent.addCategory("android.intent.category.TTS"); + ResolveInfo info = pm.resolveService(intent, 0); + if (info == null) { + return false; + } + return true; + } + +} |