Merge "Secure a handful of framework broadcasts" into jb-mr1.1-dev
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 456d757..d880817 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -4421,12 +4421,14 @@
new ArrayList<IActivityManager.ContentProviderHolder>();
for (ProviderInfo cpi : providers) {
- StringBuilder buf = new StringBuilder(128);
- buf.append("Pub ");
- buf.append(cpi.authority);
- buf.append(": ");
- buf.append(cpi.name);
- Log.i(TAG, buf.toString());
+ if (DEBUG_PROVIDER) {
+ StringBuilder buf = new StringBuilder(128);
+ buf.append("Pub ");
+ buf.append(cpi.authority);
+ buf.append(": ");
+ buf.append(cpi.name);
+ Log.i(TAG, buf.toString());
+ }
IActivityManager.ContentProviderHolder cph = installProvider(context, null, cpi,
false /*noisy*/, true /*noReleaseNeeded*/, true /*stable*/);
if (cph != null) {
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 95b6bed..f895ccc 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -168,7 +168,7 @@
* context object for Activity and other application components.
*/
class ContextImpl extends Context {
- private final static String TAG = "ApplicationContext";
+ private final static String TAG = "ContextImpl";
private final static boolean DEBUG = false;
private static final HashMap<String, SharedPreferencesImpl> sSharedPrefs =
@@ -1715,7 +1715,7 @@
private void warnIfCallingFromSystemProcess() {
if (Process.myUid() == Process.SYSTEM_UID) {
Slog.w(TAG, "Calling a method in the system process without a qualified user: "
- + Debug.getCallers(3));
+ + Debug.getCallers(5));
}
}
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 2c92d093..8f8df0a 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -388,8 +388,8 @@
* Priority is an indication of how much of the user's valuable attention should be consumed by
* this notification. Low-priority notifications may be hidden from the user in certain
* situations, while the user might be interrupted for a higher-priority notification. The
- * system will make a determination about how to interpret notification priority as described in
- * MUMBLE MUMBLE.
+ * system will make a determination about how to interpret this priority when presenting
+ * the notification.
*/
public int priority;
@@ -846,7 +846,9 @@
}
// TODO(dsandler): defaults take precedence over local values, so reorder the branches below
sb.append(" vibrate=");
- if (this.vibrate != null) {
+ if ((this.defaults & DEFAULT_VIBRATE) != 0) {
+ sb.append("default");
+ } else if (this.vibrate != null) {
int N = this.vibrate.length-1;
sb.append("[");
for (int i=0; i<N; i++) {
@@ -857,16 +859,14 @@
sb.append(this.vibrate[N]);
}
sb.append("]");
- } else if ((this.defaults & DEFAULT_VIBRATE) != 0) {
- sb.append("default");
} else {
sb.append("null");
}
sb.append(" sound=");
- if (this.sound != null) {
- sb.append(this.sound.toString());
- } else if ((this.defaults & DEFAULT_SOUND) != 0) {
+ if ((this.defaults & DEFAULT_SOUND) != 0) {
sb.append("default");
+ } else if (this.sound != null) {
+ sb.append(this.sound.toString());
} else {
sb.append("null");
}
diff --git a/core/java/android/content/SyncStorageEngine.java b/core/java/android/content/SyncStorageEngine.java
index bdc5a3f..1ecab09 100644
--- a/core/java/android/content/SyncStorageEngine.java
+++ b/core/java/android/content/SyncStorageEngine.java
@@ -64,6 +64,7 @@
public class SyncStorageEngine extends Handler {
private static final String TAG = "SyncManager";
+ private static final boolean DEBUG = false;
private static final boolean DEBUG_FILE = false;
private static final String XML_ATTR_NEXT_AUTHORITY_ID = "nextAuthorityId";
@@ -443,7 +444,7 @@
mChangeListeners.finishBroadcast();
}
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ if (DEBUG) {
Log.v(TAG, "reportChange " + which + " to: " + reports);
}
@@ -484,13 +485,17 @@
public void setSyncAutomatically(Account account, int userId, String providerName,
boolean sync) {
- Log.d(TAG, "setSyncAutomatically: " + /* account + */" provider " + providerName
- + ", user " + userId + " -> " + sync);
+ if (DEBUG) {
+ Log.d(TAG, "setSyncAutomatically: " + /* account + */" provider " + providerName
+ + ", user " + userId + " -> " + sync);
+ }
synchronized (mAuthorities) {
AuthorityInfo authority = getOrCreateAuthorityLocked(account, userId, providerName, -1,
false);
if (authority.enabled == sync) {
- Log.d(TAG, "setSyncAutomatically: already set to " + sync + ", doing nothing");
+ if (DEBUG) {
+ Log.d(TAG, "setSyncAutomatically: already set to " + sync + ", doing nothing");
+ }
return;
}
authority.enabled = sync;
@@ -532,13 +537,17 @@
} else if (syncable < -1) {
syncable = -1;
}
- Log.d(TAG, "setIsSyncable: " + account + ", provider " + providerName
- + ", user " + userId + " -> " + syncable);
+ if (DEBUG) {
+ Log.d(TAG, "setIsSyncable: " + account + ", provider " + providerName
+ + ", user " + userId + " -> " + syncable);
+ }
synchronized (mAuthorities) {
AuthorityInfo authority = getOrCreateAuthorityLocked(account, userId, providerName, -1,
false);
if (authority.syncable == syncable) {
- Log.d(TAG, "setIsSyncable: already set to " + syncable + ", doing nothing");
+ if (DEBUG) {
+ Log.d(TAG, "setIsSyncable: already set to " + syncable + ", doing nothing");
+ }
return;
}
authority.syncable = syncable;
@@ -564,7 +573,7 @@
public void setBackoff(Account account, int userId, String providerName,
long nextSyncTime, long nextDelay) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ if (DEBUG) {
Log.v(TAG, "setBackoff: " + account + ", provider " + providerName
+ ", user " + userId
+ " -> nextSyncTime " + nextSyncTime + ", nextDelay " + nextDelay);
@@ -615,7 +624,7 @@
for (AuthorityInfo authorityInfo : accountInfo.authorities.values()) {
if (authorityInfo.backoffTime != NOT_IN_BACKOFF_MODE
|| authorityInfo.backoffDelay != NOT_IN_BACKOFF_MODE) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ if (DEBUG) {
Log.v(TAG, "clearAllBackoffs:"
+ " authority:" + authorityInfo.authority
+ " account:" + accountInfo.accountAndUser.account.name
@@ -641,7 +650,7 @@
public void setDelayUntilTime(Account account, int userId, String providerName,
long delayUntil) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ if (DEBUG) {
Log.v(TAG, "setDelayUntil: " + account + ", provider " + providerName
+ ", user " + userId + " -> delayUntil " + delayUntil);
}
@@ -677,7 +686,7 @@
if (extras == null) {
extras = new Bundle();
}
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ if (DEBUG) {
Log.v(TAG, "addOrRemovePeriodicSync: " + account + ", user " + userId
+ ", provider " + providerName
+ " -> period " + period + ", extras " + extras);
@@ -833,7 +842,7 @@
public PendingOperation insertIntoPending(PendingOperation op) {
synchronized (mAuthorities) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ if (DEBUG) {
Log.v(TAG, "insertIntoPending: account=" + op.account
+ " user=" + op.userId
+ " auth=" + op.authority
@@ -865,7 +874,7 @@
public boolean deleteFromPending(PendingOperation op) {
boolean res = false;
synchronized (mAuthorities) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ if (DEBUG) {
Log.v(TAG, "deleteFromPending: account=" + op.account
+ " user=" + op.userId
+ " auth=" + op.authority
@@ -884,7 +893,7 @@
AuthorityInfo authority = getAuthorityLocked(op.account, op.userId, op.authority,
"deleteFromPending");
if (authority != null) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "removing - " + authority);
+ if (DEBUG) Log.v(TAG, "removing - " + authority);
final int N = mPendingOperations.size();
boolean morePending = false;
for (int i=0; i<N; i++) {
@@ -898,7 +907,7 @@
}
if (!morePending) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "no more pending!");
+ if (DEBUG) Log.v(TAG, "no more pending!");
SyncStatusInfo status = getOrCreateSyncStatusLocked(authority.ident);
status.pending = false;
}
@@ -938,7 +947,7 @@
*/
public void doDatabaseCleanup(Account[] accounts, int userId) {
synchronized (mAuthorities) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) Log.w(TAG, "Updating for new accounts...");
+ if (DEBUG) Log.v(TAG, "Updating for new accounts...");
SparseArray<AuthorityInfo> removing = new SparseArray<AuthorityInfo>();
Iterator<AccountInfo> accIt = mAccounts.values().iterator();
while (accIt.hasNext()) {
@@ -946,8 +955,8 @@
if (!ArrayUtils.contains(accounts, acc.accountAndUser.account)
&& acc.accountAndUser.userId == userId) {
// This account no longer exists...
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.w(TAG, "Account removed: " + acc.accountAndUser);
+ if (DEBUG) {
+ Log.v(TAG, "Account removed: " + acc.accountAndUser);
}
for (AuthorityInfo auth : acc.authorities.values()) {
removing.put(auth.ident, auth);
@@ -993,7 +1002,7 @@
public SyncInfo addActiveSync(SyncManager.ActiveSyncContext activeSyncContext) {
final SyncInfo syncInfo;
synchronized (mAuthorities) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ if (DEBUG) {
Log.v(TAG, "setActiveSync: account="
+ activeSyncContext.mSyncOperation.account
+ " auth=" + activeSyncContext.mSyncOperation.authority
@@ -1021,7 +1030,7 @@
*/
public void removeActiveSync(SyncInfo syncInfo, int userId) {
synchronized (mAuthorities) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ if (DEBUG) {
Log.v(TAG, "removeActiveSync: account=" + syncInfo.account
+ " user=" + userId
+ " auth=" + syncInfo.authority);
@@ -1046,7 +1055,7 @@
long now, int source, boolean initialization) {
long id;
synchronized (mAuthorities) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ if (DEBUG) {
Log.v(TAG, "insertStartSyncEvent: account=" + accountName + "user=" + userId
+ " auth=" + authorityName + " source=" + source);
}
@@ -1068,7 +1077,7 @@
mSyncHistory.remove(mSyncHistory.size()-1);
}
id = item.historyId;
- if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "returning historyId " + id);
+ if (DEBUG) Log.v(TAG, "returning historyId " + id);
}
reportChange(ContentResolver.SYNC_OBSERVER_TYPE_STATUS);
@@ -1096,7 +1105,7 @@
public void stopSyncEvent(long historyId, long elapsedTime, String resultMessage,
long downstreamActivity, long upstreamActivity) {
synchronized (mAuthorities) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ if (DEBUG) {
Log.v(TAG, "stopSyncEvent: historyId=" + historyId);
}
SyncHistoryItem item = null;
@@ -1358,7 +1367,7 @@
AccountInfo accountInfo = mAccounts.get(au);
if (accountInfo == null) {
if (tag != null) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ if (DEBUG) {
Log.v(TAG, tag + ": unknown account " + au);
}
}
@@ -1367,7 +1376,7 @@
AuthorityInfo authority = accountInfo.authorities.get(authorityName);
if (authority == null) {
if (tag != null) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ if (DEBUG) {
Log.v(TAG, tag + ": unknown authority " + authorityName);
}
}
@@ -1392,7 +1401,7 @@
mNextAuthorityId++;
doWrite = true;
}
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ if (DEBUG) {
Log.v(TAG, "created a new AuthorityInfo for " + accountName
+ ", user " + userId
+ ", provider " + authorityName);
diff --git a/core/java/android/content/pm/RegisteredServicesCache.java b/core/java/android/content/pm/RegisteredServicesCache.java
index a07a865..aaa0917 100644
--- a/core/java/android/content/pm/RegisteredServicesCache.java
+++ b/core/java/android/content/pm/RegisteredServicesCache.java
@@ -69,6 +69,7 @@
*/
public abstract class RegisteredServicesCache<V> {
private static final String TAG = "PackageManager";
+ private static final boolean DEBUG = false;
public final Context mContext;
private final String mInterfaceName;
@@ -195,7 +196,7 @@
}
private void notifyListener(final V type, final int userId, final boolean removed) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ if (DEBUG) {
Log.d(TAG, "notifyListener: " + type + " is " + (removed ? "removed" : "added"));
}
RegisteredServicesCacheListener<V> listener;
@@ -291,7 +292,9 @@
* given {@link UserHandle}.
*/
private void generateServicesMap(int userId) {
- Slog.d(TAG, "generateServicesMap() for " + userId);
+ if (DEBUG) {
+ Slog.d(TAG, "generateServicesMap() for " + userId);
+ }
final PackageManager pm = mContext.getPackageManager();
final ArrayList<ServiceInfo<V>> serviceInfos = new ArrayList<ServiceInfo<V>>();
@@ -322,6 +325,7 @@
}
StringBuilder changes = new StringBuilder();
+ boolean changed = false;
for (ServiceInfo<V> info : serviceInfos) {
// four cases:
// - doesn't exist yet
@@ -334,33 +338,41 @@
// - add, notify user that it was added
Integer previousUid = user.persistentServices.get(info.type);
if (previousUid == null) {
- changes.append(" New service added: ").append(info).append("\n");
+ if (DEBUG) {
+ changes.append(" New service added: ").append(info).append("\n");
+ }
+ changed = true;
user.services.put(info.type, info);
user.persistentServices.put(info.type, info.uid);
if (!(mPersistentServicesFileDidNotExist && firstScan)) {
notifyListener(info.type, userId, false /* removed */);
}
} else if (previousUid == info.uid) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ if (DEBUG) {
changes.append(" Existing service (nop): ").append(info).append("\n");
}
user.services.put(info.type, info);
} else if (inSystemImage(info.uid)
|| !containsTypeAndUid(serviceInfos, info.type, previousUid)) {
- if (inSystemImage(info.uid)) {
- changes.append(" System service replacing existing: ").append(info)
- .append("\n");
- } else {
- changes.append(" Existing service replacing a removed service: ")
- .append(info).append("\n");
+ if (DEBUG) {
+ if (inSystemImage(info.uid)) {
+ changes.append(" System service replacing existing: ").append(info)
+ .append("\n");
+ } else {
+ changes.append(" Existing service replacing a removed service: ")
+ .append(info).append("\n");
+ }
}
+ changed = true;
user.services.put(info.type, info);
user.persistentServices.put(info.type, info.uid);
notifyListener(info.type, userId, false /* removed */);
} else {
// ignore
- changes.append(" Existing service with new uid ignored: ").append(info)
- .append("\n");
+ if (DEBUG) {
+ changes.append(" Existing service with new uid ignored: ").append(info)
+ .append("\n");
+ }
}
}
@@ -371,22 +383,25 @@
}
}
for (V v1 : toBeRemoved) {
+ if (DEBUG) {
+ changes.append(" Service removed: ").append(v1).append("\n");
+ }
+ changed = true;
user.persistentServices.remove(v1);
- changes.append(" Service removed: ").append(v1).append("\n");
notifyListener(v1, userId, true /* removed */);
}
- if (changes.length() > 0) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ if (DEBUG) {
+ if (changes.length() > 0) {
Log.d(TAG, "generateServicesMap(" + mInterfaceName + "): " +
serviceInfos.size() + " services:\n" + changes);
- }
- writePersistentServicesLocked();
- } else {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ } else {
Log.d(TAG, "generateServicesMap(" + mInterfaceName + "): " +
serviceInfos.size() + " services unchanged");
}
}
+ if (changed) {
+ writePersistentServicesLocked();
+ }
}
}
diff --git a/core/java/android/server/search/SearchManagerService.java b/core/java/android/server/search/SearchManagerService.java
index 4a21374..46f2723 100644
--- a/core/java/android/server/search/SearchManagerService.java
+++ b/core/java/android/server/search/SearchManagerService.java
@@ -92,7 +92,7 @@
Searchables searchables = mSearchables.get(userId);
if (searchables == null) {
- Log.i(TAG, "Building list of searchable activities for userId=" + userId);
+ //Log.i(TAG, "Building list of searchable activities for userId=" + userId);
searchables = new Searchables(mContext, userId);
searchables.buildSearchableList();
mSearchables.append(userId, searchables);
diff --git a/core/java/android/service/dreams/DreamService.java b/core/java/android/service/dreams/DreamService.java
index 6c9290b..f6b6c89 100644
--- a/core/java/android/service/dreams/DreamService.java
+++ b/core/java/android/service/dreams/DreamService.java
@@ -44,13 +44,13 @@
import com.android.internal.policy.PolicyManager;
/**
- * Extend this class to implement a custom Dream (displayed to the user as a "Sleep Mode").
+ * Extend this class to implement a custom dream (available to the user as a "Daydream").
*
* <p>Dreams are interactive screensavers launched when a charging device is idle, or docked in a
* desk dock. Dreams provide another modality for apps to express themselves, tailored for
* an exhibition/lean-back experience.</p>
*
- * <p>The Dream lifecycle is as follows:</p>
+ * <p>The {@code DreamService} lifecycle is as follows:</p>
* <ol>
* <li>{@link #onAttachedToWindow}
* <p>Use this for initial setup, such as calling {@link #setContentView setContentView()}.</li>
@@ -59,14 +59,15 @@
* <li>{@link #onDreamingStopped}
* <p>Use this to stop the things you started in {@link #onDreamingStarted}.</li>
* <li>{@link #onDetachedFromWindow}
- * <p>Use this to dismantle resources your dream set up. For example, detach from handlers
- * and listeners.</li>
+ * <p>Use this to dismantle resources (for example, detach from handlers
+ * and listeners).</li>
* </ol>
*
* <p>In addition, onCreate and onDestroy (from the Service interface) will also be called, but
* initialization and teardown should be done by overriding the hooks above.</p>
*
- * <p>To be available to the system, Dreams should be declared in the manifest as follows:</p>
+ * <p>To be available to the system, your {@code DreamService} should be declared in the
+ * manifest as follows:</p>
* <pre>
* <service
* android:name=".MyDream"
diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java
index 421a324..452ad1b 100644
--- a/core/java/android/widget/CompoundButton.java
+++ b/core/java/android/widget/CompoundButton.java
@@ -248,6 +248,15 @@
return padding;
}
+ /**
+ * @hide
+ */
+ @Override
+ public int getHorizontalOffsetForDrawables() {
+ final Drawable buttonDrawable = mButtonDrawable;
+ return (buttonDrawable != null) ? buttonDrawable.getIntrinsicWidth() : 0;
+ }
+
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 0a16a66..22bfadb 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -4863,6 +4863,13 @@
return highlight;
}
+ /**
+ * @hide
+ */
+ public int getHorizontalOffsetForDrawables() {
+ return 0;
+ }
+
@Override
protected void onDraw(Canvas canvas) {
restartMarqueeIfNeeded();
@@ -4880,6 +4887,10 @@
final int left = mLeft;
final int bottom = mBottom;
final int top = mTop;
+ final boolean isLayoutRtl = isLayoutRtl();
+ final int offset = getHorizontalOffsetForDrawables();
+ final int leftOffset = isLayoutRtl ? 0 : offset;
+ final int rightOffset = isLayoutRtl ? offset : 0 ;
final Drawables dr = mDrawables;
if (dr != null) {
@@ -4895,7 +4906,7 @@
// Make sure to update invalidateDrawable() when changing this code.
if (dr.mDrawableLeft != null) {
canvas.save();
- canvas.translate(scrollX + mPaddingLeft,
+ canvas.translate(scrollX + mPaddingLeft + leftOffset,
scrollY + compoundPaddingTop +
(vspace - dr.mDrawableHeightLeft) / 2);
dr.mDrawableLeft.draw(canvas);
@@ -4906,7 +4917,8 @@
// Make sure to update invalidateDrawable() when changing this code.
if (dr.mDrawableRight != null) {
canvas.save();
- canvas.translate(scrollX + right - left - mPaddingRight - dr.mDrawableSizeRight,
+ canvas.translate(scrollX + right - left - mPaddingRight
+ - dr.mDrawableSizeRight - rightOffset,
scrollY + compoundPaddingTop + (vspace - dr.mDrawableHeightRight) / 2);
dr.mDrawableRight.draw(canvas);
canvas.restore();
@@ -4991,8 +5003,6 @@
}
canvas.translate(compoundPaddingLeft, extendedPaddingTop + voffsetText);
- final boolean isLayoutRtl = isLayoutRtl();
-
final int layoutDirection = getLayoutDirection();
final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
if (mEllipsize == TextUtils.TruncateAt.MARQUEE &&
diff --git a/core/java/android/widget/VideoView.java b/core/java/android/widget/VideoView.java
index 7c8196d..329b0df 100644
--- a/core/java/android/widget/VideoView.java
+++ b/core/java/android/widget/VideoView.java
@@ -54,7 +54,6 @@
// settable by the client
private Uri mUri;
private Map<String, String> mHeaders;
- private int mDuration;
// all possible internal states
private static final int STATE_ERROR = -1;
@@ -229,7 +228,6 @@
mMediaPlayer = new MediaPlayer();
mMediaPlayer.setOnPreparedListener(mPreparedListener);
mMediaPlayer.setOnVideoSizeChangedListener(mSizeChangedListener);
- mDuration = -1;
mMediaPlayer.setOnCompletionListener(mCompletionListener);
mMediaPlayer.setOnErrorListener(mErrorListener);
mMediaPlayer.setOnInfoListener(mOnInfoListener);
@@ -608,17 +606,12 @@
openVideo();
}
- // cache duration as mDuration for faster access
public int getDuration() {
if (isInPlaybackState()) {
- if (mDuration > 0) {
- return mDuration;
- }
- mDuration = mMediaPlayer.getDuration();
- return mDuration;
+ return mMediaPlayer.getDuration();
}
- mDuration = -1;
- return mDuration;
+
+ return -1;
}
public int getCurrentPosition() {
diff --git a/core/java/com/android/internal/content/PackageHelper.java b/core/java/com/android/internal/content/PackageHelper.java
index c5e7d9d..1a4835b 100644
--- a/core/java/com/android/internal/content/PackageHelper.java
+++ b/core/java/com/android/internal/content/PackageHelper.java
@@ -51,7 +51,7 @@
public static final int RECOMMEND_FAILED_INVALID_URI = -6;
public static final int RECOMMEND_FAILED_VERSION_DOWNGRADE = -7;
- private static final boolean localLOGV = true;
+ private static final boolean localLOGV = false;
private static final String TAG = "PackageHelper";
// App installation location settings values
public static final int APP_INSTALL_AUTO = 0;
diff --git a/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml
index 1e966f7..f7ff77b 100644
--- a/core/res/res/values/arrays.xml
+++ b/core/res/res/values/arrays.xml
@@ -143,10 +143,6 @@
<item>@drawable/menu_dropdown_panel_holo_dark</item>
<item>@drawable/overscroll_edge</item>
<item>@drawable/overscroll_glow</item>
- <item>@drawable/popup_inline_error_above_holo_dark</item>
- <item>@drawable/popup_inline_error_above_holo_light</item>
- <item>@drawable/popup_inline_error_holo_dark</item>
- <item>@drawable/popup_inline_error_holo_light</item>
<item>@drawable/spinner_16_outer_holo</item>
<item>@drawable/spinner_16_inner_holo</item>
<item>@drawable/spinner_48_outer_holo</item>
@@ -257,8 +253,6 @@
<item>@drawable/ab_solid_shadow_holo</item>
<item>@drawable/item_background_holo_dark</item>
<item>@drawable/item_background_holo_light</item>
- <item>@drawable/ic_ab_back_holo_dark</item>
- <item>@drawable/ic_ab_back_holo_light</item>
<item>@drawable/fastscroll_thumb_holo</item>
<item>@drawable/fastscroll_thumb_pressed_holo</item>
<item>@drawable/fastscroll_thumb_default_holo</item>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index ea28a51..66c23a0 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -1006,9 +1006,9 @@
-->
<integer-array name="config_defaultNotificationVibePattern">
<item>0</item>
- <item>150</item>
- <item>200</item>
+ <item>350</item>
<item>250</item>
+ <item>350</item>
</integer-array>
<!-- Vibrator pattern to be used as the default for notifications
@@ -1017,8 +1017,8 @@
-->
<integer-array name="config_notificationFallbackVibePattern">
<item>0</item>
- <item>33</item>
+ <item>100</item>
<item>150</item>
- <item>50</item>
+ <item>100</item>
</integer-array>
</resources>
diff --git a/docs/downloads/training/NotifyUser.zip b/docs/downloads/training/NotifyUser.zip
new file mode 100644
index 0000000..c335157
--- /dev/null
+++ b/docs/downloads/training/NotifyUser.zip
Binary files differ
diff --git a/docs/html/distribute/googleplay/promote/brand.jd b/docs/html/distribute/googleplay/promote/brand.jd
index cb6bf48..834f8a9 100644
--- a/docs/html/distribute/googleplay/promote/brand.jd
+++ b/docs/html/distribute/googleplay/promote/brand.jd
@@ -51,7 +51,7 @@
<p style="text-align:center">
<a href="{@docRoot}images/brand/Android_Robot_100.png">100x118</a> |
<a href="{@docRoot}images/brand/Android_Robot_200.png">200x237</a><br>
- <a href="{@docRoot}images/brand/Android_Robot_outlined.ai">Illustrator (.ai)</a></p>
+ <a href="{@docRoot}downloads/brand/Android_Robot_outlined.ai">Illustrator (.ai)</a></p>
</div>
<p>The Android robot can be used, reproduced, and modified freely in marketing
diff --git a/docs/html/google/play-services/maps.jd b/docs/html/google/play-services/maps.jd
index eea17e9..85a745d 100644
--- a/docs/html/google/play-services/maps.jd
+++ b/docs/html/google/play-services/maps.jd
@@ -1,73 +1,86 @@
page.title=Google Maps
-page.landing=true
-page.landing.intro=Add Google maps to your Android apps and let your users explore the world. Give your users all of the benefits of the Google Maps, but with the customizations that you need for your app and users.
-page.landing.link=https://developers.google.com/maps/documentation/android/
-page.landing.link.text=developers.google.com/maps
-page.landing.image=images/gps-maps.png
+header.hide=1
@jd:body
+
+<div class="landing-banner">
+
+<div class="col-6">
+ <img src="{@docRoot}images/google/gps-maps.png" alt="">
+</div>
+<div class="col-6">
+
+ <h1 itemprop="name" style="margin-bottom:0;">Google Maps</h1>
+ <p itemprop="description">Allow your users explore the world with rich maps provided by
+ Google. Identify locations with <b>custom markers</b>, augment the map data
+ with <b>image overlays</b>, embed <b>one or more maps</b> as fragments,
+ and much more.</p>
+ <p>The <a
+href="{@docRoot}google/play-services/reference/com/google/android/gms/maps/package-summary.html"
+>Google Maps Android API reference</a> is available here on developer.android.com, but for more
+information about adding maps to your app, visit:</p>
+ <p><a class="external-link"
+href="https://developers.google.com/maps/documentation/android/">developers.google.com/maps</a></p>
+</div>
+</div>
+
+
+
<div class="landing-docs">
- <div class="col-6">
+ <div class="col-6 normal-links">
<h3 style="clear:left">Key Developer Features</h3>
- <a href="https://developers.google.com/maps/documentation/android/map">
- <h4>Bring Maps to your Mobile Apps</h4>
- The Google Maps APIs let you embed Google Maps into an Activity with a simple XML snippet
- in the form of a fragment. With MapFragment, you can take advantage of exciting features such as 3D maps;
- indoor, satellite, terrain, and hybrid maps; and vector-based tiles for efficient caching and drawing.
+ <h4>Add Maps in a fragment</h4>
+ <p>With version 2 of the Google Maps Android API, you can embed maps into an activity
+ as a fragment with a simple XML snippet. The new Maps offer exciting features such as 3D maps;
+ indoor, satellite, terrain, and hybrid maps;
+ vector-based tiles for efficient caching and drawing; animated transitions; and much more.
+ <a class="external-link" href="https://developers.google.com/maps/documentation/android/map">Add
+ a map object</a>.</p>
+
+ <h4>Customize the map</h4>
+ <p>Add markers onto the map to indicate special points of interest for your users.
+ You can define custom colors or icons for your map markers to
+ match your app's look and feel. To further enhance the app, draw polylines
+ and polygons to indicate paths or regions, or provide complete image overlays.
+ <a class="external-link" href="https://developers.google.com/maps/documentation/android/marker">Draw
+ markers</a>.</p>
</a>
- <a href="https://developers.google.com/maps/documentation/android/marker">
- <h4>Highlight important places and routes</h4>
- <p>
- Overlay markers onto your maps to highlight places your users are interested
- in. You can also define custom colors or icons for your map markers to
- coincide with the look and feel of your app.</p>
-
- <p>In addition, you can draw polylines, a set of connected line segments on a map
- and polygons, a set of polylines in a closed loop.</p>
- </a>
-
- <a href="https://developers.google.com/maps/documentation/android/views">
- <h4>Change views and perspectives</h4>
- Give your users a different view of the world with the ability to control rotation, tilting,
- zooming, and panning properties of the maps you are displaying. Show 3D views of maps,
- zoom in on terrain maps, allow users to swipe across areas, and much more.
- </a>
-
+ <h4>Control the user's view</h4>
+ <p>Give your users a different view of the world with the ability to control the rotation, tilt,
+ zoom, and pan properties of the "camera" perspective of the map.
+ <a class="external-link" href="https://developers.google.com/maps/documentation/android/views">Change
+ the view</a>.</p>
</div>
+
<div class="col-6 normal-links">
<h3 style="clear:left">Getting Started</h3>
- <h4>Configure Maps</h4>
+ <h4>1. Get the Google Play services SDK</h4>
<p>The Google Maps Android APIs are part of the Google Play services platform.</p>
<p>To use Google Maps, <a href="{@docRoot}google/play-services/download.html">download and configure</a>
- the Google Play services SDK and see the <a href="https://developers.google.com/maps/documentation/android/start#installing_the_google_maps_android_v2_api">
- Getting Started guide</a> on how to configure Google Maps for your app.
+ the Google Play services SDK from the SDK Manager. Then see the <a class="external-link"
+ href="https://developers.google.com/maps/documentation/android/start#installing_the_google_maps_android_v2_api">
+ Getting Started guide</a> to get your API key for Maps and set up your app.
</p>
- <h4>Run the sample</h4>
- <p>
- The Google Maps sample is located in <code><android-sdk>/extras/google-play-services/samples/maps</code>
- and shows you how to use the major components of the Google Maps Android APIs.
+ <h4>2. Run the sample</h4>
+ <p>Once you've installed the Google Play services package, the Google Maps sample is located in
+ <code><android-sdk>/extras/google-play-services/samples/maps</code> and shows you
+ how to use the major components of the Google Maps Android APIs.
</p>
- <h4>Visit the Google Maps developer site</h4>
- <p>
- For instructions on how to fully integrate Google+ into your app, with code snippets, visit the
- <a href="https://developers.google.com/maps/documentation/android/intro">Google Maps developer documentation</a>
- located at developers.google.com.
- </p>
-
- <h4>See the reference documentation</h4>
- <p>
- The <a href="{@docRoot}google/play-services/reference/com/google/android/gms/maps/package-summary.html">Google Maps API reference</a>
- is provided for you on this site and is also available at <a href="https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/package-summary">developers.google.com</a> if you
- prefer to read them there.</p>
- <p>
- In addition, the entire <a href="{@docRoot}google/play-services/reference/packages.html">Google Play
- services platform reference</a> is hosted on this site for your convenience.
+ <h4>3. Read the documentation</h4>
+ <p>For quick access while developing your Android apps, the
+ <a href="{@docRoot}google/play-services/reference/com/google/android/gms/maps/package-summary.html">Google Maps
+ Android API reference</a> is available here on developer.android.com.</p>
+ <p>Extended documentation for the Google Maps Android APIs is provided with the rest of the
+ Google Maps developer documents at <a class="external-link"
+ href="https://developers.google.com/maps/documentation/android/">developers.google.com/maps</a>.
</p>
</div>
+
+
</div>
</div>
\ No newline at end of file
diff --git a/docs/html/google/play-services/plus.jd b/docs/html/google/play-services/plus.jd
index 7742318..571360b 100644
--- a/docs/html/google/play-services/plus.jd
+++ b/docs/html/google/play-services/plus.jd
@@ -1,65 +1,83 @@
page.title=Google+
-page.landing=true
-page.landing.intro=Create an engaging social experience and connect with more users by integrating G+ into your app.
-page.landing.link=https://developers.google.com/+/mobile/android/
-page.landing.link.text=developers.google.com/+
-page.landing.image=images/gps-plus.png
+header.hide=1
@jd:body
+
+<div class="landing-banner">
+
+<div class="col-6">
+ <img src="{@docRoot}images/google/gps-googleplus.png" alt="">
+</div>
+<div class="col-6">
+
+ <h1 itemprop="name" style="margin-bottom:0;">Google+</h1>
+ <p itemprop="description">Create an engaging social experience
+ by integrating Google+ features in your app. You can <b>authenticate users</b> and allow them to
+ <b>sign in</b>, add +1 buttons so users can <b>recommend your app content</b>,
+ and allow users to <b>share rich content</b> with Google+.</p>
+
+ <p>The <a
+href="{@docRoot}google/play-services/reference/com/google/android/gms/plus/package-summary.html"
+>Google+ Android API reference</a> is available here on developer.android.com, but for more
+information about integrating Google+, visit:</p>
+<p><a class="external-link"
+href="https://developers.google.com/+/mobile/android/">developers.google.com/+</a></p>
+</div>
+</div>
+
<div class="landing-docs">
- <div class="col-6">
+ <div class="col-6 normal-links">
<h3 style="clear:left">Key Developer Features</h3>
- <a href="https://developers.google.com/+/mobile/android/share">
- <h4>Share to Google+</h4>
- Display a Share dialog that lets your users share rich content from your app, including text,
- photos, URL attachments, and location, into the Google+ stream.
- </a>
-
- <a href="https://developers.google.com/+/mobile/android/recommend">
- <h4>Recommend content</h4>
- Add a native +1 button so users can recommend content from your app. When users +1, they can
- also share content with their circles. These endorsements can give your app more
- credibility and help it grow faster.
- </a>
-
- <a href="https://developers.google.com/+/mobile/android/sign-in">
<h4>Sign in with Google+</h4>
- Allow users to easily and securely sign in to your app using their Google+ credentials.
- This allows you to know who they are on Google+ and to build a more personalized experience in your app.
- </a>
- <a href="https://developers.google.com/+/mobile/android/write-moments">
+ <p>Allow users to easily and securely sign in to your app using their Google+ credentials.
+ This allows you to know who they are on Google+ and to build a more personalized experience in
+ your app. <a href="https://developers.google.com/+/mobile/android/sign-in"
+ class="external-link">Add sign in</a>.</p>
+
+ <h4>Share to Google+</h4>
+ <p>Display a Share dialog that lets your users share rich content from your app,
+ including text, photos, URL attachments, and location, into the Google+ stream.
+ <a href="https://developers.google.com/+/mobile/android/share"
+ class="external-link">Add sharing with Google+</a>.</p>
+
+ <h4>Recommend content</h4>
+ <p>Add a native +1 button so users can recommend content from your app. When users +1, they
+ can also share content with their circles. These endorsements can give your app more
+ credibility and help it grow faster. <a class="external-link"
+ href="https://developers.google.com/+/mobile/android/recommend">Add the +1 button</a>.</p>
+
<h4>Save moments</h4>
- Save user actions from your app such as check-ins, reviews, video views, comments, and more,
- to your users' private Google+ history. From there, users can share these moments with others.
- </a>
+ <p>Save user actions from your app such as check-ins, reviews, video views, comments,
+ and more, to your users' private Google+ history. From there, users can share these
+ moments with others. <a class="external-link"
+ href="https://developers.google.com/+/mobile/android/write-moments">Save user
+ moments</a>.</p>
</div>
+
<div class="col-6 normal-links">
<h3 style="clear:left">Getting Started</h3>
- <h4>Get the Google Play services SDK</h4>
+ <h4>1. Get the Google Play services SDK</h4>
<p>The Google+ Android APIs are part of the Google Play services platform.</p>
- <p><a href="{@docRoot}google/play-services/download.html">Download and configure</a>
- the SDK to begin integrating Google+ into your app.
+ <p>To get started, <a href="{@docRoot}google/play-services/download.html">download and configure</a>
+ the Google Play services SDK from the SDK Manager.
</p>
- <h4>Run the sample</h4>
- <p>
- The Google+ sample is located in <code><android-sdk>/extras/google-play-services/samples/plus</code> and shows you
+ <h4>2. Run the sample</h4>
+ <p>Once you've installed the Google Play services package, the Google+ sample is located in
+ <code><android-sdk>/extras/google-play-services/samples/plus</code> and shows you
how to use the major components of the Google+ Android APIs.
</p>
- <h4>Visit the Google+ developer site</h4>
- <p>For instructions on how to fully integrate Google+ into your app, with code snippets, visit the
- <a href="https://developers.google.com/+/mobile/android/">Google+ developer documentation</a> located at
- developers.google.com.
- </p>
+ <h4>3. Read the documentation</h4>
+ <p>For quick access while developing your Android apps, the
+ <a href="{@docRoot}google/play-services/reference/com/google/android/gms/plus/package-summary.html">Google+
+ API reference</a> is available here on developer.android.com.</p>
+ <p>Extended documentation for the Google+ Android APIs is provided with the rest of the
+ Google+ developer documents at <a class="external-link"
+ href="https://developers.google.com/+/mobile/android/">developers.google.com/+</a>.</p>
- <h4>See the reference documentation</h4>
- <p>The <a href="{@docRoot}google/play-services/reference/com/google/android/gms/plus/package-summary.html">Google+ API reference</a>
- as well as the entire <a href="{@docRoot}google/play-services/reference/packages.html">Google Play services platform reference</a>
- is provided for you on this site.
- </p>
</div>
</div>
\ No newline at end of file
diff --git a/docs/html/images/google/gps-googleplus.png b/docs/html/images/google/gps-googleplus.png
new file mode 100644
index 0000000..383445b
--- /dev/null
+++ b/docs/html/images/google/gps-googleplus.png
Binary files differ
diff --git a/docs/html/images/google/gps-maps.png b/docs/html/images/google/gps-maps.png
new file mode 100644
index 0000000..2500f14
--- /dev/null
+++ b/docs/html/images/google/gps-maps.png
Binary files differ
diff --git a/docs/html/images/training/notifications-bigview.png b/docs/html/images/training/notifications-bigview.png
new file mode 100644
index 0000000..83a5610
--- /dev/null
+++ b/docs/html/images/training/notifications-bigview.png
Binary files differ
diff --git a/docs/html/images/training/notifications-normalview.png b/docs/html/images/training/notifications-normalview.png
new file mode 100644
index 0000000..06ea970
--- /dev/null
+++ b/docs/html/images/training/notifications-normalview.png
Binary files differ
diff --git a/docs/html/sdk/images/4.0/folders.xcf b/docs/html/sdk/images/4.0/folders.xcf
deleted file mode 100644
index 66cc02c..0000000
--- a/docs/html/sdk/images/4.0/folders.xcf
+++ /dev/null
Binary files differ
diff --git a/docs/html/shareables/README b/docs/html/shareables/README.txt
similarity index 100%
rename from docs/html/shareables/README
rename to docs/html/shareables/README.txt
diff --git a/docs/html/tools/sdk/images/4.0/folders.xcf b/docs/html/tools/sdk/images/4.0/folders.xcf
deleted file mode 100644
index 66cc02c..0000000
--- a/docs/html/tools/sdk/images/4.0/folders.xcf
+++ /dev/null
Binary files differ
diff --git a/docs/html/training/notify-user/build-notification.jd b/docs/html/training/notify-user/build-notification.jd
new file mode 100644
index 0000000..ba66028
--- /dev/null
+++ b/docs/html/training/notify-user/build-notification.jd
@@ -0,0 +1,160 @@
+page.title=Building a Notification
+parent.title=Notifying the User
+parent.link=index.html
+
+trainingnavtop=true
+next.title=Preserving Navigation when Starting an Activity
+next.link=navigation.html
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<!-- table of contents -->
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="#builder">Create a Notification Builder</a></li>
+ <li><a href="#action">Define the Notification's Action</a></li>
+ <li><a href="#click">Set the Notification's Click Behavior</a></li>
+ <li><a href="#notify">Issue the Notification</a></li>
+</ol>
+
+<!-- other docs (NOT javadocs) -->
+<h2>You should also read</h2>
+
+<ul>
+ <li>
+ <a href="{@docRoot}guide/topics/ui/notifiers/notifications.html">Notifications</a> API Guide
+ </li>
+ <li>
+ <a href="{@docRoot}guide/components/intents-filters.html">
+ Intents and Intent Filters
+ </a>
+ </li>
+ <li>
+ <a href="{@docRoot}design/patterns/notifications.html">Notifications</a> Design Guide
+ </li>
+</ul>
+
+
+</div>
+</div>
+
+
+<p>This lesson explains how to create and issue a notification.</p>
+
+<p>The examples in this class are based on the
+{@link android.support.v4.app.NotificationCompat.Builder} class.
+{@link android.support.v4.app.NotificationCompat.Builder}
+is in the <a href="{@docRoot}">Support Library</a>. You should use
+{@link android.support.v4.app.NotificationCompat} and its subclasses,
+particularly {@link android.support.v4.app.NotificationCompat.Builder}, to
+provide the best notification support for a wide range of platforms. </p>
+
+<h2 id="builder">Create a Notification Builder</h2>
+
+<p>When creating a notification, specify the UI content and actions with a
+{@link android.support.v4.app.NotificationCompat.Builder} object. At bare minimum,
+a {@link android.support.v4.app.NotificationCompat.Builder Builder}
+object must include the following:</p>
+
+<ul>
+ <li>
+ A small icon, set by
+ {@link android.support.v4.app.NotificationCompat.Builder#setSmallIcon setSmallIcon()}
+ </li>
+ <li>
+ A title, set by
+ {@link android.support.v4.app.NotificationCompat.Builder#setContentTitle setContentTitle()}
+ </li>
+ <li>
+ Detail text, set by
+ {@link android.support.v4.app.NotificationCompat.Builder#setContentText setContentText()}
+ </li>
+</ul>
+<p> For example: </p>
+<pre>
+NotificationCompat.Builder mBuilder =
+ new NotificationCompat.Builder(this)
+ .setSmallIcon(R.drawable.notification_icon)
+ .setContentTitle("My notification")
+ .setContentText("Hello World!");
+</pre>
+
+<h2 id="action">Define the Notification's Action</h2>
+
+
+<p>Although actions are optional, you should add at least one action to your
+notification. An action takes users directly from the notification to an
+{@link android.app.Activity} in your application, where they can look at the
+event that caused the notification or do further work. Inside a notification, the action itself is
+defined by a {@link android.app.PendingIntent} containing an {@link
+android.content.Intent} that starts an {@link android.app.Activity} in your
+application.</p>
+
+<p>How you construct the {@link android.app.PendingIntent} depends on what type
+of {@link android.app.Activity} you're starting. When you start an {@link
+android.app.Activity} from a notification, you must preserve the user's expected
+navigation experience. In the snippet below, clicking the notification opens a
+new activity that effectively extends the behavior of the notification. In this
+case there is no need to create an artificial back stack (see
+<a href="navigation.html">Preserving Navigation when Starting an Activity</a> for
+more information):</p>
+
+<pre>Intent resultIntent = new Intent(this, ResultActivity.class);
+...
+// Because clicking the notification opens a new ("special") activity, there's
+// no need to create an artificial back stack.
+PendingIntent resultPendingIntent =
+ PendingIntent.getActivity(
+ this,
+ 0,
+ resultIntent,
+ PendingIntent.FLAG_UPDATE_CURRENT
+);
+</pre>
+
+<h2 id="click">Set the Notification's Click Behavior</h2>
+
+<p>
+To associate the {@link android.app.PendingIntent} created in the previous
+step with a gesture, call the appropriate method of {@link
+android.support.v4.app.NotificationCompat.Builder}. For example, to start an
+activity when the user clicks the notification text in the notification drawer,
+add the {@link android.app.PendingIntent} by calling {@link
+android.support.v4.app.NotificationCompat.Builder#setContentIntent
+setContentIntent()}. For example:</p>
+
+<pre>PendingIntent resultPendingIntent;
+...
+mBuilder.setContentIntent(resultPendingIntent);</pre>
+
+<h2 id="notify">Issue the Notification</h2>
+
+<p>To issue the notification:</p>
+<ul>
+<li>Get an instance of {@link android.app.NotificationManager}.</li>
+
+<li>Use the {@link android.app.NotificationManager#notify notify()} method to issue the
+notification. When you call {@link android.app.NotificationManager#notify notify()}, specify a notification ID.
+You can use this ID to update the notification later on. This is described in more detail in
+<a href="managing.html">Managing Notifications</a>.</li>
+
+<li>Call {@link
+android.support.v4.app.NotificationCompat.Builder#build() build()}, which
+returns a {@link android.app.Notification} object containing your
+specifications.</li>
+
+<p>For example:</p>
+
+<pre>
+// Sets an ID for the notification
+int mNotificationId = 001;
+// Gets an instance of the NotificationManager service
+NotificationManager mNotifyMgr =
+ (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+// Builds the notification and issues it.
+mNotifyMgr.notify(mNotificationId, builder.build());
+</pre>
+
diff --git a/docs/html/training/notify-user/display-progress.jd b/docs/html/training/notify-user/display-progress.jd
new file mode 100644
index 0000000..2b2b3ae
--- /dev/null
+++ b/docs/html/training/notify-user/display-progress.jd
@@ -0,0 +1,182 @@
+page.title=Displaying Progress in a Notification
+parent.title=Notifying the User
+parent.link=index.html
+
+trainingnavtop=true
+previous.title=Using Expanded Notification Styles
+previous.link=expanded.html
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<!-- table of contents -->
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="#FixedProgress">Display a Fixed-duration progress Indicator</a></li>
+ <li><a href="#ActivityIndicator">Display a Continuing Activity Indicator</a></li>
+</ol>
+
+<!-- other docs (NOT javadocs) -->
+<h2>You should also read</h2>
+
+<ul>
+ <li>
+ <a href="{@docRoot}guide/topics/ui/notifiers/notifications.html">Notifications</a> API Guide
+ </li>
+ <li>
+ <a href="{@docRoot}guide/components/intents-filters.html">
+ Intents and Intent Filters
+ </a>
+ </li>
+ <li>
+ <a href="{@docRoot}design/patterns/notifications.html">Notifications</a> Design Guide
+ </li>
+</ul>
+
+
+</div>
+</div>
+
+
+
+<p>
+ Notifications can include an animated progress indicator that shows users the status
+ of an ongoing operation. If you can estimate how long the operation takes and how much of it
+ is complete at any time, use the "determinate" form of the indicator
+ (a progress bar). If you can't estimate the length of the operation, use the
+ "indeterminate" form of the indicator (an activity indicator).
+</p>
+<p>
+ Progress indicators are displayed with the platform's implementation of the
+ {@link android.widget.ProgressBar} class.
+</p>
+<p>
+ To use a progress indicator, call
+ {@link android.support.v4.app.NotificationCompat.Builder#setProgress setProgress()}. The
+ determinate and indeterminate forms are described in the following sections.
+</p>
+<!-- ------------------------------------------------------------------------------------------ -->
+<h2 id="FixedProgress">Display a Fixed-duration Progress Indicator</h2>
+<p>
+ To display a determinate progress bar, add the bar to your notification by calling
+ {@link android.support.v4.app.NotificationCompat.Builder#setProgress
+ setProgress(max, progress, false)} and then issue the notification.
+ The third argument is a boolean that indicates whether the
+ progress bar is indeterminate (<strong>true</strong>) or determinate (<strong>false</strong>).
+ As your operation proceeds,
+ increment <code>progress</code>, and update the notification. At the end of the operation,
+ <code>progress</code> should equal <code>max</code>. A common way to call
+ {@link android.support.v4.app.NotificationCompat.Builder#setProgress setProgress()}
+ is to set <code>max</code> to 100 and then increment <code>progress</code> as a
+ "percent complete" value for the operation.
+</p>
+<p>
+ You can either leave the progress bar showing when the operation is done, or remove it. In
+ either case, remember to update the notification text to show that the operation is complete.
+ To remove the progress bar, call
+ {@link android.support.v4.app.NotificationCompat.Builder#setProgress
+ setProgress(0, 0, false)}. For example:
+</p>
+<pre>
+...
+mNotifyManager =
+ (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+mBuilder = new NotificationCompat.Builder(this);
+mBuilder.setContentTitle("Picture Download")
+ .setContentText("Download in progress")
+ .setSmallIcon(R.drawable.ic_notification);
+// Start a lengthy operation in a background thread
+new Thread(
+ new Runnable() {
+ @Override
+ public void run() {
+ int incr;
+ // Do the "lengthy" operation 20 times
+ for (incr = 0; incr <= 100; incr+=5) {
+ // Sets the progress indicator to a max value, the
+ // current completion percentage, and "determinate"
+ // state
+ mBuilder.setProgress(100, incr, false);
+ // Displays the progress bar for the first time.
+ mNotifyManager.notify(0, mBuilder.build());
+ // Sleeps the thread, simulating an operation
+ // that takes time
+ try {
+ // Sleep for 5 seconds
+ Thread.sleep(5*1000);
+ } catch (InterruptedException e) {
+ Log.d(TAG, "sleep failure");
+ }
+ }
+ // When the loop is finished, updates the notification
+ mBuilder.setContentText("Download complete")
+ // Removes the progress bar
+ .setProgress(0,0,false);
+ mNotifyManager.notify(ID, mBuilder.build());
+ }
+ }
+// Starts the thread by calling the run() method in its Runnable
+).start();
+</pre>
+<p>
+ The resulting notifications are shown in figure 1. On the left side is a snapshot of the
+ notification during the operation; on the right side is a snapshot of it after the operation
+ has finished.
+</p>
+<img
+ id="figure1"
+ src="{@docRoot}images/ui/notifications/progress_bar_summary.png"
+ height="84"
+ alt="" />
+<p class="img-caption">
+<strong>Figure 1.</strong> The progress bar during and after the operation.</p>
+<!-- ------------------------------------------------------------------------------------------ -->
+<h2 id="ActivityIndicator">Display a Continuing Activity Indicator</h2>
+<p>
+ To display a continuing (indeterminate) activity indicator, add it to your notification with
+ {@link android.support.v4.app.NotificationCompat.Builder#setProgress setProgress(0, 0, true)}
+ and issue the notification. The first two arguments are ignored, and the third argument
+ declares that the indicator is indeterminate. The result is an indicator
+ that has the same style as a progress bar, except that its animation is ongoing.
+</p>
+<p>
+ Issue the notification at the beginning of the operation. The animation will run until you
+ modify your notification. When the operation is done, call
+ {@link android.support.v4.app.NotificationCompat.Builder#setProgress
+ setProgress(0, 0, false)} and then update the notification to remove the activity indicator.
+ Always do this; otherwise, the animation will run even when the operation is complete. Also
+ remember to change the notification text to indicate that the operation is complete.
+</p>
+<p>
+ To see how continuing activity indicators work, refer to the preceding snippet. Locate the following lines:
+</p>
+<pre>
+// Sets the progress indicator to a max value, the current completion
+// percentage, and "determinate" state
+mBuilder.setProgress(100, incr, false);
+// Issues the notification
+mNotifyManager.notify(0, mBuilder.build());
+</pre>
+<p>
+ Replace the lines you've found with the following lines. Notice that the third parameter
+ in the {@link android.support.v4.app.NotificationCompat.Builder#setProgress setProgress()}
+ call is set to {@code true} to indicate that the progress bar is
+ indeterminate:
+</p>
+<pre>
+ // Sets an activity indicator for an operation of indeterminate length
+mBuilder.setProgress(0, 0, true);
+// Issues the notification
+mNotifyManager.notify(0, mBuilder.build());
+</pre>
+<p>
+ The resulting indicator is shown in figure 2:
+</p>
+<img
+ id="figure2"
+ src="{@docRoot}images/ui/notifications/activity_indicator.png"
+ height="99"
+ alt="" />
+<p class="img-caption"><strong>Figure 2.</strong> An ongoing activity indicator.</p>
diff --git a/docs/html/training/notify-user/expanded.jd b/docs/html/training/notify-user/expanded.jd
new file mode 100644
index 0000000..a3cc6ad
--- /dev/null
+++ b/docs/html/training/notify-user/expanded.jd
@@ -0,0 +1,167 @@
+page.title=Using Big View Styles
+Styles parent.title=Notifying the User
+parent.link=index.html
+
+trainingnavtop=true
+next.title=Displaying Progress in a Notification
+next.link=display-progress.html
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<!-- table of contents -->
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="#activity">Set Up the Notification to Launch a New Activity</a></li>
+ <li><a href="#big-view">Construct the Big View</a></li>
+</ol>
+
+<!-- other docs (NOT javadocs) -->
+<h2>You should also read</h2>
+
+<ul>
+ <li>
+ <a href="{@docRoot}guide/topics/ui/notifiers/notifications.html">Notifications</a> API Guide
+ </li>
+ <li>
+ <a href="{@docRoot}guide/components/intents-filters.html">
+ Intents and Intent Filters
+ </a>
+ </li>
+ <li>
+ <a href="{@docRoot}design/patterns/notifications.html">Notifications</a> Design Guide
+ </li>
+</ul>
+
+
+</div>
+</div>
+
+<p>Notifications in the notification drawer appear in two main visual styles,
+normal view and big view. The big view of a notification only appears when the
+notification is expanded. This happens when the notification is at the top of
+the drawer, or the user clicks the notification. </p>
+
+<p>Big views were introduced in
+Android 4.1, and they're not supported on older devices. This lesson describes
+how to incorporate big view notifications into your app while still providing
+full functionality via the normal view. See the <a
+href="{@docRoot}guide/topics/ui/notifiers/notifications.html#BigNotify">
+Notifications API guide</a> for more discussion of big views.</p>
+
+<p>Here is an example of a normal view: </p>
+
+<img src="{@docRoot}images/training/notifications-normalview.png" width="300" height="58" alt="normal view" />
+
+<p class="img-caption">
+ <strong>Figure 1.</strong> Normal view notification.
+</p>
+
+
+<p>Here is an example of a big view:</p>
+
+<img src="{@docRoot}images/training/notifications-bigview.png" width="300" height="143" alt="big view" />
+<p class="img-caption">
+ <strong>Figure 2.</strong> Big view notification.
+</p>
+
+
+<p> In the sample application shown in this lesson, both the normal view and the
+big view give users access to same functionality:</p>
+
+<ul>
+ <li>The ability to snooze or dismiss the notification.</li>
+ <li>A way to view the reminder text the user set as part of the timer.</li>
+</ul>
+
+<p>The normal view provides these features through a new activity that launches
+when the user clicks the notification. Keep this in mind as you design your notifications—first
+provide the functionality in the normal view, since
+this is how many users will interact with the notification.</p>
+
+<h2 id="activity">Set Up the Notification to Launch a New Activity</h2>
+
+<p>The sample application uses an {@link android.app.IntentService} subclass ({@code PingService})
+to construct and issue the notification.</p>
+
+
+<p>In this snippet, the
+{@link android.app.IntentService} method
+{@link android.app.IntentService#onHandleIntent onHandleIntent()} specifies the new activity
+that will be launched if the user
+clicks the notification itself. The method
+{@link android.support.v4.app.NotificationCompat.Builder#setContentIntent setContentIntent()}
+defines a pending intent that should be fired when the user
+clicks the notification, thereby launching the activity.</p>
+
+<pre>Intent resultIntent = new Intent(this, ResultActivity.class);
+resultIntent.putExtra(CommonConstants.EXTRA_MESSAGE, msg);
+resultIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
+ Intent.FLAG_ACTIVITY_CLEAR_TASK);
+
+// Because clicking the notification launches a new ("special") activity,
+// there's no need to create an artificial back stack.
+PendingIntent resultPendingIntent =
+ PendingIntent.getActivity(
+ this,
+ 0,
+ resultIntent,
+ PendingIntent.FLAG_UPDATE_CURRENT
+);
+
+// This sets the pending intent that should be fired when the user clicks the
+// notification. Clicking the notification launches a new activity.
+builder.setContentIntent(resultPendingIntent);
+</pre>
+
+<h2 id="big-view">Construct the Big View</h2>
+
+<p>This snippet shows how to set up the buttons that will appear in the big view:</p>
+
+<pre>
+// Sets up the Snooze and Dismiss action buttons that will appear in the
+// big view of the notification.
+Intent dismissIntent = new Intent(this, PingService.class);
+dismissIntent.setAction(CommonConstants.ACTION_DISMISS);
+PendingIntent piDismiss = PendingIntent.getService(this, 0, dismissIntent, 0);
+
+Intent snoozeIntent = new Intent(this, PingService.class);
+snoozeIntent.setAction(CommonConstants.ACTION_SNOOZE);
+PendingIntent piSnooze = PendingIntent.getService(this, 0, snoozeIntent, 0);
+</pre>
+
+<p>This snippet shows how to construct the
+{@link android.support.v4.app.NotificationCompat.Builder Builder} object.
+It sets the style for the big
+view to be "big text," and sets its content to be the reminder message. It uses
+{@link android.support.v4.app.NotificationCompat.Builder#addAction addAction()}
+to add the <strong>Snooze</strong> and <strong>Dismiss</strong> buttons (and
+their associated pending intents) that will appear in the notification's
+big view:</p>
+
+<pre>// Constructs the Builder object.
+NotificationCompat.Builder builder =
+ new NotificationCompat.Builder(this)
+ .setSmallIcon(R.drawable.ic_stat_notification)
+ .setContentTitle(getString(R.string.notification))
+ .setContentText(getString(R.string.ping))
+ .setDefaults(Notification.DEFAULT_ALL) // requires VIBRATE permission
+ /*
+ * Sets the big view "big text" style and supplies the
+ * text (the user's reminder message) that will be displayed
+ * in the detail area of the expanded notification.
+ * These calls are ignored by the support library for
+ * pre-4.1 devices.
+ */
+ .setStyle(new NotificationCompat.BigTextStyle()
+ .bigText(msg))
+ .addAction (R.drawable.ic_stat_dismiss,
+ getString(R.string.dismiss), piDismiss)
+ .addAction (R.drawable.ic_stat_snooze,
+ getString(R.string.snooze), piSnooze);
+</pre>
+
+
+
diff --git a/docs/html/training/notify-user/index.jd b/docs/html/training/notify-user/index.jd
new file mode 100644
index 0000000..510f2c4
--- /dev/null
+++ b/docs/html/training/notify-user/index.jd
@@ -0,0 +1,102 @@
+page.title=Notifying the User
+trainingnavtop=true
+startpage=true
+next.title=Build a Notification
+next.link=build-notification.html
+
+
+@jd:body
+<div id="tb-wrapper">
+<div id="tb">
+
+<!-- Required platform, tools, add-ons, devices, knowledge, etc. -->
+<h2>Dependencies and prerequisites</h2>
+
+<ul>
+ <li>Android 1.6 (API Level 4) or higher</li>
+</ul>
+<h2>You should also read</h2>
+<ul>
+ <li>
+ <a href="{@docRoot}guide/topics/ui/notifiers/notifications.html">Notifications</a> API Guide
+ </li>
+ <li>
+ <a href="{@docRoot}guide/components/intents-filters.html">
+ Intents and Intent Filters
+ </a>
+ </li>
+ <li>
+ <a href="{@docRoot}design/patterns/notifications.html">Notifications</a> Design Guide
+ </li>
+</ul>
+
+<h2>Try it out</h2>
+
+<div class="download-box">
+ <a href="{@docRoot}shareables/training/NotifyUser.zip"
+class="button">Download the sample</a>
+ <p class="filename">NotifyUser.zip</p>
+</div>
+
+</div>
+</div>
+
+<p>
+ A notification is a user interface element that you display outside your app's normal UI to indicate
+ that an event has occurred. Users can choose to view the notification while using other apps and respond
+ to it when it's convenient for them.
+
+</p>
+
+<p>
+ The <a href="{@docRoot}design/patterns/notifications.html">Notifications design guide</a> shows
+ you how to design effective notifications and when to use them. This class shows you how to
+ implement the most common notification designs.
+</p>
+<h2>Lessons</h2>
+
+<dl>
+ <dt>
+ <strong><a href="build-notification.html">Building a Notification</a></strong>
+ </dt>
+ <dd>
+ Learn how to create a notification
+ {@link android.support.v4.app.NotificationCompat.Builder Builder}, set the
+ required features, and issue the notification.
+ </dd>
+ <dt>
+ <strong><a href="navigation.html">Preserving Navigation when Starting an Activity</a></strong>
+ </dt>
+ <dd>
+ Learn how to enforce the proper
+ navigation for an {@link android.app.Activity} started from a notification.
+ </dd>
+ <dt>
+ <strong>
+ <a href="managing.html">Updating Notifications</a>
+ </strong>
+ </dt>
+ <dd>
+ Learn how to update and remove notifications.
+ </dd>
+ <dt>
+ <strong>
+ <a href="expanded.html">Using Big View Styles</a>
+ </strong>
+ </dt>
+ <dd>
+ Learn how to create a big view within an expanded notification, while still maintaining
+ backward compatibility.
+ </dd>
+
+ <dt>
+ <strong>
+ <a href="display-progress.html">Displaying Progress in a Notification</a>
+ </strong>
+ </dt>
+ <dd>
+ Learn how to display the progress of an operation in a notification, both for
+ operations where you can estimate how much has been completed (determinate progress) and
+ operations where you don't know how much has been completed (indefinite progress).
+ </dd>
+</dl>
diff --git a/docs/html/training/notify-user/managing.jd b/docs/html/training/notify-user/managing.jd
new file mode 100644
index 0000000..4782734
--- /dev/null
+++ b/docs/html/training/notify-user/managing.jd
@@ -0,0 +1,107 @@
+page.title=Updating Notifications
+parent.title=Notifying the User
+parent.link=index.html
+
+trainingnavtop=true
+next.title=Creating Expanded Notifications
+next.link=expanded.html
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<!-- table of contents -->
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="#Updating">Modify a Notification</a></li>
+ <li><a href="#Removing">Remove Notifications</a></li>
+</ol>
+
+<!-- other docs (NOT javadocs) -->
+<h2>You should also read</h2>
+
+<ul>
+ <li>
+ <a href="{@docRoot}guide/topics/ui/notifiers/notifications.html">Notifications</a> API Guide
+ </li>
+ <li>
+ <a href="{@docRoot}guide/components/intents-filters.html">
+ Intents and Intent Filters
+ </a>
+ </li>
+ <li>
+ <a href="{@docRoot}design/patterns/notifications.html">Notifications</a> Design Guide
+ </li>
+</ul>
+
+
+</div>
+</div>
+<p>
+ When you need to issue a notification multiple times for the same type of event, you
+ should avoid making a completely new notification. Instead, you should consider updating a
+ previous notification, either by changing some of its values or by adding to it, or both.
+</p>
+
+<p>
+ The following section describes how to update notifications and also how to remove them.
+</p>
+<h2 id="Updating">Modify a Notification</h2>
+<p>
+ To set up a notification so it can be updated, issue it with a notification ID by
+ calling {@link android.app.NotificationManager#notify(int, Notification)
+ NotificationManager.notify(ID, notification)}. To update this notification once you've issued
+ it, update or create a {@link android.support.v4.app.NotificationCompat.Builder} object,
+ build a {@link android.app.Notification} object from it, and issue the
+ {@link android.app.Notification} with the same ID you used previously.
+</p>
+<p>
+ The following snippet demonstrates a notification that is updated to reflect the
+ number of events that have occurred. It stacks the notification, showing a summary:
+</p>
+<pre>
+mNotificationManager =
+ (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+// Sets an ID for the notification, so it can be updated
+int notifyID = 1;
+mNotifyBuilder = new NotificationCompat.Builder(this)
+ .setContentTitle("New Message")
+ .setContentText("You've received new messages.")
+ .setSmallIcon(R.drawable.ic_notify_status)
+numMessages = 0;
+// Start of a loop that processes data and then notifies the user
+...
+ mNotifyBuilder.setContentText(currentText)
+ .setNumber(++numMessages);
+ // Because the ID remains unchanged, the existing notification is
+ // updated.
+ mNotificationManager.notify(
+ notifyID,
+ mNotifyBuilder.build());
+...
+</pre>
+
+<!-- ------------------------------------------------------------------------------------------ -->
+<h2 id="Removing">Remove Notifications</h2>
+<p>
+ Notifications remain visible until one of the following happens:
+</p>
+<ul>
+ <li>
+ The user dismisses the notification either individually or by using "Clear All" (if
+ the notification can be cleared).
+ </li>
+ <li>
+ The user touches the notification, and you called
+ {@link android.support.v4.app.NotificationCompat.Builder#setAutoCancel setAutoCancel()} when
+ you created the notification.
+ </li>
+ <li>
+ You call {@link android.app.NotificationManager#cancel(int) cancel()} for a specific
+ notification ID. This method also deletes ongoing notifications.
+ </li>
+ <li>
+ You call {@link android.app.NotificationManager#cancelAll() cancelAll()}, which removes
+ all of the notifications you previously issued.
+ </li>
diff --git a/docs/html/training/notify-user/navigation.jd b/docs/html/training/notify-user/navigation.jd
new file mode 100644
index 0000000..ac4689a
--- /dev/null
+++ b/docs/html/training/notify-user/navigation.jd
@@ -0,0 +1,228 @@
+page.title=Preserving Navigation when Starting an Activity
+parent.title=Notifying the User
+parent.link=index.html
+
+trainingnavtop=true
+next.title=Updating Notifications
+next.link=managing.html
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<!-- table of contents -->
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="#DirectEntry">Set up a regular activity PendingIntent</a></li>
+ <li><a href="#ExtendedNotification">Set up a special activity PendingIntent</a></li>
+</ol>
+
+<!-- other docs (NOT javadocs) -->
+<h2>You should also read</h2>
+
+<ul>
+ <li>
+ <a href="{@docRoot}guide/topics/ui/notifiers/notifications.html">Notifications</a> API Guide
+ </li>
+ <li>
+ <a href="{@docRoot}guide/components/intents-filters.html">
+ Intents and Intent Filters
+ </a>
+ </li>
+ <li>
+ <a href="{@docRoot}design/patterns/notifications.html">Notifications</a> Design Guide
+ </li>
+</ul>
+
+
+</div>
+</div>
+<p>
+ Part of designing a notification is preserving the user's expected navigation experience.
+ For a detailed discussion of this topic, see the
+ <a href="{@docRoot}guide/topics/ui/notifiers/notifications.html#NotificationResponse">Notifications</a>
+ API guide.
+ There are two general situations:
+</p>
+<dl>
+ <dt>
+ Regular activity
+ </dt>
+ <dd>
+ You're starting an {@link android.app.Activity} that's part of the application's normal
+ workflow.
+ </dd>
+ <dt>
+ Special activity
+ </dt>
+ <dd>
+ The user only sees this {@link android.app.Activity} if it's started from a notification.
+ In a sense, the {@link android.app.Activity} extends the notification by providing
+ information that would be hard to display in the notification itself.
+ </dd>
+</dl>
+<!-- ------------------------------------------------------------------------------------------ -->
+<h2 id="DirectEntry">Set Up a Regular Activity PendingIntent</h2>
+<p>
+ To set up a {@link android.app.PendingIntent} that starts a direct entry
+ {@link android.app.Activity}, follow these steps:
+</p>
+<ol>
+ <li>
+ Define your application's {@link android.app.Activity} hierarchy in the manifest. The final XML should look like this:
+ </p>
+<pre>
+<activity
+ android:name=".MainActivity"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+</activity>
+<activity
+ android:name=".ResultActivity"
+ android:parentActivityName=".MainActivity">
+ <meta-data
+ android:name="android.support.PARENT_ACTIVITY"
+ android:value=".MainActivity"/>
+</activity>
+</pre>
+ </li>
+ <li>
+ Create a back stack based on the {@link android.content.Intent} that starts the
+ {@link android.app.Activity}. For example:
+</p>
+<pre>
+...
+Intent resultIntent = new Intent(this, ResultActivity.class);
+TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
+// Adds the back stack
+stackBuilder.addParentStack(ResultActivity.class);
+// Adds the Intent to the top of the stack
+stackBuilder.addNextIntent(resultIntent);
+// Gets a PendingIntent containing the entire back stack
+PendingIntent resultPendingIntent =
+ stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
+...
+NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
+builder.setContentIntent(resultPendingIntent);
+NotificationManager mNotificationManager =
+ (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+mNotificationManager.notify(id, builder.build());
+</pre>
+<!-- ------------------------------------------------------------------------------------------ -->
+<h2 id="ExtendedNotification">Set Up a Special Activity PendingIntent</h2>
+
+<p>
+ A special {@link android.app.Activity} doesn't need a back stack, so you don't have to
+ define its {@link android.app.Activity} hierarchy in the manifest, and you don't have
+ to call
+ {@link android.support.v4.app.TaskStackBuilder#addParentStack addParentStack()} to build a
+ back stack. Instead, use the manifest to set up the {@link android.app.Activity} task options,
+ and create the {@link android.app.PendingIntent} by calling
+ {@link android.app.PendingIntent#getActivity getActivity()}:
+</p>
+<ol>
+ <li>
+ In your manifest, add the following attributes to the
+<code><a href="{@docRoot}guide/topics/manifest/activity-element.html"><activity></a></code>
+ element for the {@link android.app.Activity}:
+ <dl>
+ <dt>
+<code><a href="{@docRoot}guide/topics/manifest/activity-element.html#nm">android:name</a>="<i>activityclass</i>"</code>
+ </dt>
+ <dd>
+ The activity's fully-qualified class name.
+ </dd>
+ <dt>
+<code><a href="{@docRoot}guide/topics/manifest/activity-element.html#aff">android:taskAffinity</a>=""</code>
+ </dt>
+ <dd>
+ Combined with the
+ {@link android.content.Intent#FLAG_ACTIVITY_NEW_TASK FLAG_ACTIVITY_NEW_TASK} flag
+ that you set in code, this ensures that this {@link android.app.Activity} doesn't
+ go into the application's default task. Any existing tasks that have the
+ application's default affinity are not affected.
+ </dd>
+ <dt>
+<code><a href="{@docRoot}guide/topics/manifest/activity-element.html#exclude">android:excludeFromRecents</a>="true"</code>
+ </dt>
+ <dd>
+ Excludes the new task from <i>Recents</i>, so that the user can't accidentally
+ navigate back to it.
+ </dd>
+ </dl>
+ <p>
+ This snippet shows the element:
+ </p>
+<pre>
+<activity
+ android:name=".ResultActivity"
+...
+ android:launchMode="singleTask"
+ android:taskAffinity=""
+ android:excludeFromRecents="true">
+</activity>
+...
+</pre>
+ </li>
+ <li>
+ Build and issue the notification:
+ <ol style="list-style-type: lower-alpha;">
+ <li>
+ Create an {@link android.content.Intent} that starts the
+ {@link android.app.Activity}.
+ </li>
+ <li>
+ Set the {@link android.app.Activity} to start in a new, empty task by calling
+ {@link android.content.Intent#setFlags setFlags()} with the flags
+ {@link android.content.Intent#FLAG_ACTIVITY_NEW_TASK FLAG_ACTIVITY_NEW_TASK}
+ and
+ {@link android.content.Intent#FLAG_ACTIVITY_CLEAR_TASK FLAG_ACTIVITY_CLEAR_TASK}.
+ </li>
+ <li>
+ Set any other options you need for the {@link android.content.Intent}.
+ </li>
+ <li>
+ Create a {@link android.app.PendingIntent} from the {@link android.content.Intent}
+ by calling {@link android.app.PendingIntent#getActivity getActivity()}.
+ You can then use this {@link android.app.PendingIntent} as the argument to
+ {@link android.support.v4.app.NotificationCompat.Builder#setContentIntent
+ setContentIntent()}.
+ </li>
+ </ol>
+ <p>
+ The following code snippet demonstrates the process:
+ </p>
+<pre>
+// Instantiate a Builder object.
+NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
+// Creates an Intent for the Activity
+Intent notifyIntent =
+ new Intent(new ComponentName(this, ResultActivity.class));
+// Sets the Activity to start in a new, empty task
+notifyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
+ Intent.FLAG_ACTIVITY_CLEAR_TASK);
+// Creates the PendingIntent
+PendingIntent notifyIntent =
+ PendingIntent.getActivity(
+ this,
+ 0,
+ notifyIntent,
+ PendingIntent.FLAG_UPDATE_CURRENT
+);
+
+// Puts the PendingIntent into the notification builder
+builder.setContentIntent(notifyIntent);
+// Notifications are issued by sending them to the
+// NotificationManager system service.
+NotificationManager mNotificationManager =
+ (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+// Builds an anonymous Notification object from the builder, and
+// passes it to the NotificationManager
+mNotificationManager.notify(id, builder.build());
+</pre>
+ </li>
+</ol>
diff --git a/docs/html/training/training_toc.cs b/docs/html/training/training_toc.cs
index abce37a..88ecaec 100644
--- a/docs/html/training/training_toc.cs
+++ b/docs/html/training/training_toc.cs
@@ -417,7 +417,6 @@
</li>
</ul>
</li>
-
<li class="nav-section">
<div class="nav-section-header">
<a href="<?cs var:toroot ?>training/efficient-downloads/index.html"
@@ -601,6 +600,66 @@
</li>
</ul>
</li>
+
+ <li class="nav-section">
+ <div class="nav-section-header">
+ <a href="<?cs var:toroot ?>training/notify-user/index.html"
+ description=
+ "How to display messages called notifications outside of
+ your application's UI."
+ >Notifying the User</a>
+ </div>
+ <ul>
+ <li>
+ <a href="<?cs var:toroot ?>training/notify-user/build-notification.html">
+ Building a Notification
+ </a>
+ </li>
+ <li>
+ <a href="<?cs var:toroot ?>training/notify-user/navigation.html">
+ Preserving Navigation when Starting an Activity
+ </a>
+ </li>
+ <li>
+ <a href="<?cs var:toroot ?>training/notify-user/managing.html">
+ Updating Notifications
+ </a>
+ </li>
+ <li>
+ <a href="<?cs var:toroot ?>training/notify-user/expanded.html">
+ Using Big View Styles
+ </a>
+ </li>
+ <li>
+ <a href="<?cs var:toroot ?>training/notify-user/display-progress.html">
+ Displaying Progress in a Notification
+ </a>
+ </li>
+ </ul>
+ </li>
+
+ <li class="nav-section">
+ <div class="nav-section-header">
+ <a href="<?cs var:toroot ?>training/search/index.html"
+ description=
+ "How to properly add a search interface to your app and create a searchable database."
+ >Adding Search Functionality</a>
+ </div>
+ <ul>
+ <li><a href="<?cs var:toroot ?>training/search/setup.html">
+ Setting up the Search Interface
+ </a>
+ </li>
+ <li><a href="<?cs var:toroot ?>training/search/search.html">
+ Storing and Searching for Data
+ </a>
+ </li>
+ <li><a href="<?cs var:toroot ?>training/search/backward-compat.html">
+ Remaining Backward Compatible
+ </a>
+ </li>
+ </ul>
+ </li>
<li class="nav-section">
@@ -660,29 +719,6 @@
</li>
</ul>
</li>
-
- <li class="nav-section">
- <div class="nav-section-header">
- <a href="<?cs var:toroot ?>training/search/index.html"
- description=
- "How to properly add a search interface to your app and create a searchable database."
- >Adding Search Functionality</a>
- </div>
- <ul>
- <li><a href="<?cs var:toroot ?>training/search/setup.html">
- Setting up the Search Interface
- </a>
- </li>
- <li><a href="<?cs var:toroot ?>training/search/search.html">
- Storing and Searching for Data
- </a>
- </li>
- <li><a href="<?cs var:toroot ?>training/search/backward-compat.html">
- Remaining Backward Compatible
- </a>
- </li>
- </ul>
- </li>
<li class="nav-section">
<div class="nav-section-header">
diff --git a/docs/html/images/activity_lifecycle.graffle b/docs/image_sources/activity_lifecycle.graffle
similarity index 100%
rename from docs/html/images/activity_lifecycle.graffle
rename to docs/image_sources/activity_lifecycle.graffle
diff --git a/docs/html/images/brand/Android_Robot_outlined.ai b/docs/image_sources/brand/Android_Robot_outlined.ai
similarity index 100%
rename from docs/html/images/brand/Android_Robot_outlined.ai
rename to docs/image_sources/brand/Android_Robot_outlined.ai
Binary files differ
diff --git a/docs/html/images/brand/Google_Play_Store.ai b/docs/image_sources/brand/Google_Play_Store.ai
similarity index 100%
rename from docs/html/images/brand/Google_Play_Store.ai
rename to docs/image_sources/brand/Google_Play_Store.ai
Binary files differ
diff --git a/docs/html/images/brand/en_app_rgb_wo.ai b/docs/image_sources/brand/en_app_rgb_wo.ai
similarity index 100%
rename from docs/html/images/brand/en_app_rgb_wo.ai
rename to docs/image_sources/brand/en_app_rgb_wo.ai
Binary files differ
diff --git a/docs/html/images/brand/en_generic_rgb_wo.ai b/docs/image_sources/brand/en_generic_rgb_wo.ai
similarity index 100%
rename from docs/html/images/brand/en_generic_rgb_wo.ai
rename to docs/image_sources/brand/en_generic_rgb_wo.ai
Binary files differ
diff --git a/docs/html/images/fundamentals/fragments.graffle b/docs/image_sources/fundamentals/fragments.graffle
similarity index 100%
rename from docs/html/images/fundamentals/fragments.graffle
rename to docs/image_sources/fundamentals/fragments.graffle
diff --git a/docs/html/images/fundamentals/restore_instance.graffle b/docs/image_sources/fundamentals/restore_instance.graffle
similarity index 100%
rename from docs/html/images/fundamentals/restore_instance.graffle
rename to docs/image_sources/fundamentals/restore_instance.graffle
diff --git a/docs/html/images/fundamentals/service_lifecycle.graffle b/docs/image_sources/fundamentals/service_lifecycle.graffle
similarity index 100%
rename from docs/html/images/fundamentals/service_lifecycle.graffle
rename to docs/image_sources/fundamentals/service_lifecycle.graffle
diff --git a/docs/html/images/providers/datamodel.graffle b/docs/image_sources/providers/datamodel.graffle
similarity index 100%
rename from docs/html/images/providers/datamodel.graffle
rename to docs/image_sources/providers/datamodel.graffle
diff --git a/docs/html/images/resources/res-selection-flowchart.graffle b/docs/image_sources/resources/res-selection-flowchart.graffle
similarity index 100%
rename from docs/html/images/resources/res-selection-flowchart.graffle
rename to docs/image_sources/resources/res-selection-flowchart.graffle
diff --git a/docs/html/images/resources/resource_devices_diagram.graffle b/docs/image_sources/resources/resource_devices_diagram.graffle
similarity index 100%
rename from docs/html/images/resources/resource_devices_diagram.graffle
rename to docs/image_sources/resources/resource_devices_diagram.graffle
diff --git a/docs/html/images/rs_compute.graffle b/docs/image_sources/rs_compute.graffle
similarity index 100%
rename from docs/html/images/rs_compute.graffle
rename to docs/image_sources/rs_compute.graffle
diff --git a/docs/html/images/rs_graphics.graffle b/docs/image_sources/rs_graphics.graffle
similarity index 100%
rename from docs/html/images/rs_graphics.graffle
rename to docs/image_sources/rs_graphics.graffle
diff --git a/docs/html/images/rs_overview.graffle b/docs/image_sources/rs_overview.graffle
similarity index 100%
rename from docs/html/images/rs_overview.graffle
rename to docs/image_sources/rs_overview.graffle
diff --git a/docs/html/images/training/basics/basic-lifecycle.graffle/QuickLook/Preview.pdf b/docs/image_sources/training/basics/basic-lifecycle.graffle/QuickLook/Preview.pdf
similarity index 100%
rename from docs/html/images/training/basics/basic-lifecycle.graffle/QuickLook/Preview.pdf
rename to docs/image_sources/training/basics/basic-lifecycle.graffle/QuickLook/Preview.pdf
Binary files differ
diff --git a/docs/html/images/training/basics/basic-lifecycle.graffle/QuickLook/Thumbnail.tiff b/docs/image_sources/training/basics/basic-lifecycle.graffle/QuickLook/Thumbnail.tiff
similarity index 100%
rename from docs/html/images/training/basics/basic-lifecycle.graffle/QuickLook/Thumbnail.tiff
rename to docs/image_sources/training/basics/basic-lifecycle.graffle/QuickLook/Thumbnail.tiff
Binary files differ
diff --git a/docs/html/images/training/basics/basic-lifecycle.graffle/data.plist b/docs/image_sources/training/basics/basic-lifecycle.graffle/data.plist
similarity index 100%
rename from docs/html/images/training/basics/basic-lifecycle.graffle/data.plist
rename to docs/image_sources/training/basics/basic-lifecycle.graffle/data.plist
diff --git a/docs/html/images/training/basics/basic-lifecycle.graffle/image1.png b/docs/image_sources/training/basics/basic-lifecycle.graffle/image1.png
similarity index 100%
rename from docs/html/images/training/basics/basic-lifecycle.graffle/image1.png
rename to docs/image_sources/training/basics/basic-lifecycle.graffle/image1.png
Binary files differ
diff --git a/docs/html/images/training/basic-simple-screen-mock.graffle/QuickLook/Preview.pdf b/docs/image_sources/training/basics/basic-simple-screen-mock.graffle/QuickLook/Preview.pdf
similarity index 100%
rename from docs/html/images/training/basic-simple-screen-mock.graffle/QuickLook/Preview.pdf
rename to docs/image_sources/training/basics/basic-simple-screen-mock.graffle/QuickLook/Preview.pdf
Binary files differ
diff --git a/docs/html/images/training/basic-simple-screen-mock.graffle/QuickLook/Thumbnail.tiff b/docs/image_sources/training/basics/basic-simple-screen-mock.graffle/QuickLook/Thumbnail.tiff
similarity index 100%
rename from docs/html/images/training/basic-simple-screen-mock.graffle/QuickLook/Thumbnail.tiff
rename to docs/image_sources/training/basics/basic-simple-screen-mock.graffle/QuickLook/Thumbnail.tiff
Binary files differ
diff --git a/docs/html/images/training/basic-simple-screen-mock.graffle/data.plist b/docs/image_sources/training/basics/basic-simple-screen-mock.graffle/data.plist
similarity index 100%
rename from docs/html/images/training/basic-simple-screen-mock.graffle/data.plist
rename to docs/image_sources/training/basics/basic-simple-screen-mock.graffle/data.plist
diff --git a/docs/html/images/training/basic-simple-screen-mock.graffle/image1.png b/docs/image_sources/training/basics/basic-simple-screen-mock.graffle/image1.png
similarity index 100%
rename from docs/html/images/training/basic-simple-screen-mock.graffle/image1.png
rename to docs/image_sources/training/basics/basic-simple-screen-mock.graffle/image1.png
Binary files differ
diff --git a/docs/html/images/training/basic-simple-screen-mock.graffle/image2.png b/docs/image_sources/training/basics/basic-simple-screen-mock.graffle/image2.png
similarity index 100%
rename from docs/html/images/training/basic-simple-screen-mock.graffle/image2.png
rename to docs/image_sources/training/basics/basic-simple-screen-mock.graffle/image2.png
Binary files differ
diff --git a/docs/html/images/training/basics/fragments-screen-mock.graffle/QuickLook/Preview.pdf b/docs/image_sources/training/fragments-screen-mock.graffle/QuickLook/Preview.pdf
similarity index 100%
rename from docs/html/images/training/basics/fragments-screen-mock.graffle/QuickLook/Preview.pdf
rename to docs/image_sources/training/fragments-screen-mock.graffle/QuickLook/Preview.pdf
Binary files differ
diff --git a/docs/html/images/training/basics/fragments-screen-mock.graffle/QuickLook/Thumbnail.tiff b/docs/image_sources/training/fragments-screen-mock.graffle/QuickLook/Thumbnail.tiff
similarity index 100%
rename from docs/html/images/training/basics/fragments-screen-mock.graffle/QuickLook/Thumbnail.tiff
rename to docs/image_sources/training/fragments-screen-mock.graffle/QuickLook/Thumbnail.tiff
Binary files differ
diff --git a/docs/html/images/training/basics/fragments-screen-mock.graffle/data.plist b/docs/image_sources/training/fragments-screen-mock.graffle/data.plist
similarity index 100%
rename from docs/html/images/training/basics/fragments-screen-mock.graffle/data.plist
rename to docs/image_sources/training/fragments-screen-mock.graffle/data.plist
diff --git a/docs/html/images/training/basics/fragments-screen-mock.graffle/image1.png b/docs/image_sources/training/fragments-screen-mock.graffle/image1.png
similarity index 100%
rename from docs/html/images/training/basics/fragments-screen-mock.graffle/image1.png
rename to docs/image_sources/training/fragments-screen-mock.graffle/image1.png
Binary files differ
diff --git a/docs/html/images/training/basics/fragments-screen-mock.graffle/image2.png b/docs/image_sources/training/fragments-screen-mock.graffle/image2.png
similarity index 100%
rename from docs/html/images/training/basics/fragments-screen-mock.graffle/image2.png
rename to docs/image_sources/training/fragments-screen-mock.graffle/image2.png
Binary files differ
diff --git a/docs/html/images/ui/actionbar-navigate-up.xcf b/docs/image_sources/ui/actionbar-navigate-up.xcf
similarity index 100%
rename from docs/html/images/ui/actionbar-navigate-up.xcf
rename to docs/image_sources/ui/actionbar-navigate-up.xcf
Binary files differ
diff --git a/graphics/java/android/graphics/drawable/LayerDrawable.java b/graphics/java/android/graphics/drawable/LayerDrawable.java
index 0351b71..dd692c6 100644
--- a/graphics/java/android/graphics/drawable/LayerDrawable.java
+++ b/graphics/java/android/graphics/drawable/LayerDrawable.java
@@ -575,10 +575,6 @@
@Override
public Drawable mutate() {
if (!mMutated && super.mutate() == this) {
- if (!mLayerState.canConstantState()) {
- throw new IllegalStateException("One or more children of this LayerDrawable does " +
- "not have constant state; this drawable cannot be mutated.");
- }
mLayerState = new LayerState(mLayerState, this, null);
final ChildDrawable[] array = mLayerState.mChildren;
final int N = mLayerState.mNum;
diff --git a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
index cf56cba..731a09c 100644
--- a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
+++ b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
@@ -80,7 +80,7 @@
*/
public class DefaultContainerService extends IntentService {
private static final String TAG = "DefContainer";
- private static final boolean localLOGV = true;
+ private static final boolean localLOGV = false;
private static final String LIB_DIR_NAME = "lib";
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 8086bbc..f18338a 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -455,8 +455,8 @@
cache.setFullyMatchesDisk(false);
Log.d(TAG, "row count exceeds max cache entries for table " + table);
}
- Log.d(TAG, "cache for settings table '" + table + "' rows=" + rows + "; fullycached=" +
- cache.fullyMatchesDisk());
+ if (LOCAL_LOGV) Log.d(TAG, "cache for settings table '" + table
+ + "' rows=" + rows + "; fullycached=" + cache.fullyMatchesDisk());
}
} finally {
c.close();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
index ffc18c7..8f2a4eb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
@@ -45,8 +45,7 @@
import com.android.internal.R;
/**
- * This widget display an analogic clock with two hands for hours and
- * minutes.
+ * Digital clock for the status bar.
*/
public class Clock extends TextView {
private boolean mAttached;
@@ -84,6 +83,7 @@
filter.addAction(Intent.ACTION_TIME_CHANGED);
filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
+ filter.addAction(Intent.ACTION_USER_SWITCHED);
getContext().registerReceiver(mIntentReceiver, filter, null, getHandler());
}
diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
index 91fc67a..06696fe 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
@@ -33,6 +33,7 @@
public class StorageNotification extends StorageEventListener {
private static final String TAG = "StorageNotification";
+ private static final boolean DEBUG = false;
private static final boolean POP_UMS_ACTIVITY_ON_CONNECT = true;
@@ -70,8 +71,8 @@
mStorageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
final boolean connected = mStorageManager.isUsbMassStorageConnected();
- Slog.d(TAG, String.format( "Startup with UMS connection %s (media state %s)", mUmsAvailable,
- Environment.getExternalStorageState()));
+ if (DEBUG) Slog.d(TAG, String.format( "Startup with UMS connection %s (media state %s)",
+ mUmsAvailable, Environment.getExternalStorageState()));
HandlerThread thr = new HandlerThread("SystemUI StorageNotification");
thr.start();
@@ -101,7 +102,8 @@
*/
String st = Environment.getExternalStorageState();
- Slog.i(TAG, String.format("UMS connection changed to %s (media state %s)", connected, st));
+ if (DEBUG) Slog.i(TAG, String.format("UMS connection changed to %s (media state %s)",
+ connected, st));
if (connected && (st.equals(
Environment.MEDIA_REMOVED) || st.equals(Environment.MEDIA_CHECKING))) {
@@ -127,7 +129,7 @@
}
private void onStorageStateChangedAsync(String path, String oldState, String newState) {
- Slog.i(TAG, String.format(
+ if (DEBUG) Slog.i(TAG, String.format(
"Media {%s} state changed from {%s} -> {%s}", path, oldState, newState));
if (newState.equals(Environment.MEDIA_SHARED)) {
/*
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/FaceUnlock.java b/policy/src/com/android/internal/policy/impl/keyguard/FaceUnlock.java
index 259f1e4..830471a 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/FaceUnlock.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/FaceUnlock.java
@@ -31,6 +31,7 @@
import android.os.Message;
import android.os.PowerManager;
import android.os.RemoteException;
+import android.os.UserHandle;
import android.util.Log;
import android.view.View;
@@ -214,7 +215,7 @@
handleServiceDisconnected();
break;
case MSG_UNLOCK:
- handleUnlock();
+ handleUnlock(msg.arg1);
break;
case MSG_CANCEL:
handleCancel();
@@ -297,11 +298,18 @@
/**
* Stops the Face Unlock service and tells the device to grant access to the user.
*/
- void handleUnlock() {
+ void handleUnlock(int authenticatedUserId) {
if (DEBUG) Log.d(TAG, "handleUnlock()");
stop();
- mKeyguardScreenCallback.reportSuccessfulUnlockAttempt();
- mKeyguardScreenCallback.dismiss(true);
+ int currentUserId = mLockPatternUtils.getCurrentUser();
+ if (authenticatedUserId == currentUserId) {
+ if (DEBUG) Log.d(TAG, "Unlocking for user " + authenticatedUserId);
+ mKeyguardScreenCallback.reportSuccessfulUnlockAttempt();
+ mKeyguardScreenCallback.dismiss(true);
+ } else {
+ Log.d(TAG, "Ignoring unlock for authenticated user (" + authenticatedUserId +
+ ") because the current user is " + currentUserId);
+ }
}
/**
@@ -420,7 +428,8 @@
*/
public void unlock() {
if (DEBUG) Log.d(TAG, "unlock()");
- mHandler.sendEmptyMessage(MSG_UNLOCK);
+ Message message = mHandler.obtainMessage(MSG_UNLOCK, UserHandle.getCallingUserId(), -1);
+ mHandler.sendMessage(message);
}
/**
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardCircleFramedDrawable.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardCircleFramedDrawable.java
index 29124c4..79b66f4 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardCircleFramedDrawable.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardCircleFramedDrawable.java
@@ -134,7 +134,6 @@
}
public void setScale(float scale) {
- Log.i("KFD", "scale: " + scale);
mScale = scale;
}
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java
index d284602..ffa88d5 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java
@@ -189,7 +189,7 @@
public KeyguardTransportControlView(Context context, AttributeSet attrs) {
super(context, attrs);
- Log.v(TAG, "Create TCV " + this);
+ if (DEBUG) Log.v(TAG, "Create TCV " + this);
mAudioManager = new AudioManager(mContext);
mCurrentPlayState = RemoteControlClient.PLAYSTATE_NONE; // until we get a callback
mIRCD = new IRemoteControlDisplayWeak(mHandler);
diff --git a/services/java/com/android/server/BluetoothManagerService.java b/services/java/com/android/server/BluetoothManagerService.java
index 69ccbc7..ea91875 100755
--- a/services/java/com/android/server/BluetoothManagerService.java
+++ b/services/java/com/android/server/BluetoothManagerService.java
@@ -775,8 +775,18 @@
// Send BT state broadcast to update
// the BT icon correctly
- bluetoothStateChangeHandler(BluetoothAdapter.STATE_ON,
- BluetoothAdapter.STATE_TURNING_OFF);
+ if ((mState == BluetoothAdapter.STATE_TURNING_ON) ||
+ (mState == BluetoothAdapter.STATE_ON)) {
+ bluetoothStateChangeHandler(BluetoothAdapter.STATE_ON,
+ BluetoothAdapter.STATE_TURNING_OFF);
+ mState = BluetoothAdapter.STATE_TURNING_OFF;
+ }
+ if (mState == BluetoothAdapter.STATE_TURNING_OFF) {
+ bluetoothStateChangeHandler(BluetoothAdapter.STATE_TURNING_OFF,
+ BluetoothAdapter.STATE_OFF);
+ }
+
+ mHandler.removeMessages(MESSAGE_BLUETOOTH_STATE_CHANGE);
mState = BluetoothAdapter.STATE_OFF;
}
break;
@@ -820,20 +830,33 @@
}
}
}
- mHandler.removeMessages(MESSAGE_BLUETOOTH_STATE_CHANGE);
+
+ if (mState == BluetoothAdapter.STATE_TURNING_OFF) {
+ // MESSAGE_USER_SWITCHED happened right after MESSAGE_ENABLE
+ bluetoothStateChangeHandler(mState, BluetoothAdapter.STATE_OFF);
+ mState = BluetoothAdapter.STATE_OFF;
+ }
+ if (mState == BluetoothAdapter.STATE_OFF) {
+ bluetoothStateChangeHandler(mState, BluetoothAdapter.STATE_TURNING_ON);
+ mState = BluetoothAdapter.STATE_TURNING_ON;
+ }
waitForOnOff(true, false);
- bluetoothStateChangeHandler(mState, BluetoothAdapter.STATE_ON);
+ if (mState == BluetoothAdapter.STATE_TURNING_ON) {
+ bluetoothStateChangeHandler(mState, BluetoothAdapter.STATE_ON);
+ }
// disable
handleDisable(false);
+ // Pbap service need receive STATE_TURNING_OFF intent to close
+ bluetoothStateChangeHandler(BluetoothAdapter.STATE_ON,
+ BluetoothAdapter.STATE_TURNING_OFF);
waitForOnOff(false, true);
- bluetoothStateChangeHandler(BluetoothAdapter.STATE_ON,
+ bluetoothStateChangeHandler(BluetoothAdapter.STATE_TURNING_OFF,
BluetoothAdapter.STATE_OFF);
- mState = BluetoothAdapter.STATE_OFF;
sendBluetoothServiceDownCallback();
synchronized (mConnection) {
if (mBluetooth != null) {
@@ -844,6 +867,8 @@
}
SystemClock.sleep(100);
+ mHandler.removeMessages(MESSAGE_BLUETOOTH_STATE_CHANGE);
+ mState = BluetoothAdapter.STATE_OFF;
// enable
handleEnable(false, mQuietEnable);
} else if (mBinding || mBluetooth != null) {
@@ -982,14 +1007,9 @@
sendBluetoothStateCallback(isUp);
//If Bluetooth is off, send service down event to proxy objects, and unbind
- if (!isUp) {
- //Only unbind with mEnable flag not set
- //For race condition: disable and enable back-to-back
- //Avoid unbind right after enable due to callback from disable
- if ((!mEnable) && (mBluetooth != null)) {
- sendBluetoothServiceDownCallback();
- unbindAndFinish();
- }
+ if (!isUp && canUnbindBluetoothService()) {
+ sendBluetoothServiceDownCallback();
+ unbindAndFinish();
}
}
@@ -1037,4 +1057,22 @@
Log.e(TAG,"waitForOnOff time out");
return false;
}
+
+ private boolean canUnbindBluetoothService() {
+ synchronized(mConnection) {
+ //Only unbind with mEnable flag not set
+ //For race condition: disable and enable back-to-back
+ //Avoid unbind right after enable due to callback from disable
+ //Only unbind with Bluetooth at OFF state
+ //Only unbind without any MESSAGE_BLUETOOTH_STATE_CHANGE message
+ try {
+ if (mEnable || (mBluetooth == null)) return false;
+ if (mHandler.hasMessages(MESSAGE_BLUETOOTH_STATE_CHANGE)) return false;
+ return (mBluetooth.getState() == BluetoothAdapter.STATE_OFF);
+ } catch (RemoteException e) {
+ Log.e(TAG, "getState()", e);
+ }
+ }
+ return false;
+ }
}
diff --git a/services/java/com/android/server/DevicePolicyManagerService.java b/services/java/com/android/server/DevicePolicyManagerService.java
index 5ba71a4..6a62809 100644
--- a/services/java/com/android/server/DevicePolicyManagerService.java
+++ b/services/java/com/android/server/DevicePolicyManagerService.java
@@ -146,8 +146,8 @@
getSendingUserId());
if (Intent.ACTION_BOOT_COMPLETED.equals(action)
|| ACTION_EXPIRED_PASSWORD_NOTIFICATION.equals(action)) {
- Slog.v(TAG, "Sending password expiration notifications for action " + action
- + " for user " + userHandle);
+ if (DBG) Slog.v(TAG, "Sending password expiration notifications for action "
+ + action + " for user " + userHandle);
mHandler.post(new Runnable() {
public void run() {
handlePasswordExpirationNotification(getUserData(userHandle));
@@ -468,7 +468,7 @@
private void handlePackagesChanged(int userHandle) {
boolean removed = false;
- Slog.d(TAG, "Handling package changes for user " + userHandle);
+ if (DBG) Slog.d(TAG, "Handling package changes for user " + userHandle);
DevicePolicyData policy = getUserData(userHandle);
IPackageManager pm = AppGlobals.getPackageManager();
for (int i = policy.mAdminList.size() - 1; i >= 0; i--) {
@@ -982,7 +982,7 @@
long token = Binder.clearCallingIdentity();
try {
String value = cameraDisabled ? "1" : "0";
- Slog.v(TAG, "Change in camera state ["
+ if (DBG) Slog.v(TAG, "Change in camera state ["
+ SYSTEM_PROP_DISABLE_CAMERA + "] = " + value);
SystemProperties.set(SYSTEM_PROP_DISABLE_CAMERA, value);
} finally {
@@ -1682,10 +1682,9 @@
}
int neededNumbers = getPasswordMinimumNumeric(null, userHandle);
if (numbers < neededNumbers) {
- Slog
- .w(TAG, "resetPassword: number of numerical digits " + numbers
- + " does not meet required number of numerical digits "
- + neededNumbers);
+ Slog.w(TAG, "resetPassword: number of numerical digits " + numbers
+ + " does not meet required number of numerical digits "
+ + neededNumbers);
return false;
}
int neededLowerCase = getPasswordMinimumLowerCase(null, userHandle);
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index ad28a36..2e0c977 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -105,9 +105,9 @@
// TODO: listen for user creation/deletion
- private static final boolean LOCAL_LOGD = true;
- private static final boolean DEBUG_UNMOUNT = true;
- private static final boolean DEBUG_EVENTS = true;
+ private static final boolean LOCAL_LOGD = false;
+ private static final boolean DEBUG_UNMOUNT = false;
+ private static final boolean DEBUG_EVENTS = false;
private static final boolean DEBUG_OBB = false;
// Disable this since it messes up long-running cryptfs operations.
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 894c4d0..55885e6 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -1005,7 +1005,7 @@
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.android.systemui",
"com.android.systemui.SystemUIService"));
- Slog.d(TAG, "Starting service: " + intent);
+ //Slog.d(TAG, "Starting service: " + intent);
context.startServiceAsUser(intent, UserHandle.OWNER);
}
}
diff --git a/services/java/com/android/server/TelephonyRegistry.java b/services/java/com/android/server/TelephonyRegistry.java
index 26684de..17260d5 100644
--- a/services/java/com/android/server/TelephonyRegistry.java
+++ b/services/java/com/android/server/TelephonyRegistry.java
@@ -139,7 +139,7 @@
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_USER_SWITCHED: {
- Slog.d(TAG, "MSG_USER_SWITCHED userId=" + msg.arg1);
+ if (DBG) Slog.d(TAG, "MSG_USER_SWITCHED userId=" + msg.arg1);
TelephonyRegistry.this.notifyCellLocation(mCellLocation);
break;
}
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 82c9030..5fb2ec9 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -21,7 +21,6 @@
import com.android.internal.R;
import com.android.internal.os.BatteryStatsImpl;
import com.android.internal.os.ProcessStats;
-import com.android.internal.widget.LockPatternUtils;
import com.android.server.AttributeCache;
import com.android.server.IntentResolver;
import com.android.server.ProcessMap;
@@ -7935,7 +7934,7 @@
}
}, 0, null, null,
android.Manifest.permission.INTERACT_ACROSS_USERS,
- false, false, MY_PID, Process.SYSTEM_UID, UserHandle.USER_ALL);
+ true, false, MY_PID, Process.SYSTEM_UID, UserHandle.USER_ALL);
} finally {
Binder.restoreCallingIdentity(ident);
}
@@ -14257,7 +14256,7 @@
}
}, 0, null, null,
android.Manifest.permission.INTERACT_ACROSS_USERS,
- false, false, MY_PID, Process.SYSTEM_UID, UserHandle.USER_ALL);
+ true, false, MY_PID, Process.SYSTEM_UID, UserHandle.USER_ALL);
}
}
} finally {
@@ -14480,7 +14479,7 @@
long ident = Binder.clearCallingIdentity();
try {
// We are going to broadcast ACTION_USER_STOPPING and then
- // once that is down send a final ACTION_SHUTDOWN and then
+ // once that is done send a final ACTION_SHUTDOWN and then
// stop the user.
final Intent stoppingIntent = new Intent(Intent.ACTION_USER_STOPPING);
stoppingIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
diff --git a/services/java/com/android/server/display/WifiDisplayController.java b/services/java/com/android/server/display/WifiDisplayController.java
index 886e049..a83675e 100644
--- a/services/java/com/android/server/display/WifiDisplayController.java
+++ b/services/java/com/android/server/display/WifiDisplayController.java
@@ -30,6 +30,7 @@
import android.media.RemoteDisplay;
import android.net.NetworkInfo;
import android.net.Uri;
+import android.net.wifi.WpsInfo;
import android.net.wifi.p2p.WifiP2pConfig;
import android.net.wifi.p2p.WifiP2pDevice;
import android.net.wifi.p2p.WifiP2pDeviceList;
@@ -572,6 +573,16 @@
mConnectingDevice = mDesiredDevice;
WifiP2pConfig config = new WifiP2pConfig();
+ WpsInfo wps = new WpsInfo();
+ if (mConnectingDevice.wpsPbcSupported()) {
+ wps.setup = WpsInfo.PBC;
+ } else if (mConnectingDevice.wpsDisplaySupported()) {
+ // We do keypad if peer does display
+ wps.setup = WpsInfo.KEYPAD;
+ } else {
+ wps.setup = WpsInfo.DISPLAY;
+ }
+ config.wps = wps;
config.deviceAddress = mConnectingDevice.deviceAddress;
// Helps with STA & P2P concurrency
config.groupOwnerIntent = WifiP2pConfig.MIN_GROUP_OWNER_INTENT;
diff --git a/services/java/com/android/server/dreams/DreamManagerService.java b/services/java/com/android/server/dreams/DreamManagerService.java
index 1f40176..7e4a554 100644
--- a/services/java/com/android/server/dreams/DreamManagerService.java
+++ b/services/java/com/android/server/dreams/DreamManagerService.java
@@ -47,7 +47,7 @@
* @hide
*/
public final class DreamManagerService extends IDreamManager.Stub {
- private static final boolean DEBUG = true;
+ private static final boolean DEBUG = false;
private static final String TAG = "DreamManagerService";
private final Object mLock = new Object();
@@ -292,7 +292,7 @@
stopDreamLocked();
- Slog.i(TAG, "Entering dreamland.");
+ if (DEBUG) Slog.i(TAG, "Entering dreamland.");
final Binder newToken = new Binder();
mCurrentDreamToken = newToken;
@@ -310,7 +310,7 @@
private void stopDreamLocked() {
if (mCurrentDreamToken != null) {
- Slog.i(TAG, "Leaving dreamland.");
+ if (DEBUG) Slog.i(TAG, "Leaving dreamland.");
cleanupDreamLocked();
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index 83672c5..78d2565 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -4113,7 +4113,7 @@
}
}
- Slog.i(TAG, "Linking native library dir for " + path);
+ if (DEBUG_INSTALL) Slog.i(TAG, "Linking native library dir for " + path);
final int[] userIds = sUserManager.getUserIds();
synchronized (mInstallLock) {
for (int userId : userIds) {
@@ -6301,20 +6301,21 @@
final File packageFile;
if (encryptionParams != null || !"file".equals(mPackageURI.getScheme())) {
- ParcelFileDescriptor out = null;
-
mTempPackage = createTempPackageFile(mDrmAppPrivateInstallDir);
if (mTempPackage != null) {
+ ParcelFileDescriptor out;
try {
out = ParcelFileDescriptor.open(mTempPackage,
ParcelFileDescriptor.MODE_READ_WRITE);
} catch (FileNotFoundException e) {
+ out = null;
Slog.e(TAG, "Failed to create temporary file for : " + mPackageURI);
}
// Make a temporary file for decryption.
ret = mContainerService
.copyResource(mPackageURI, encryptionParams, out);
+ IoUtils.closeQuietly(out);
packageFile = mTempPackage;
@@ -9079,10 +9080,8 @@
if (removed.size() > 0) {
for (int j=0; j<removed.size(); j++) {
PreferredActivity pa = removed.get(i);
- RuntimeException here = new RuntimeException("here");
- here.fillInStackTrace();
Slog.w(TAG, "Removing dangling preferred activity: "
- + pa.mPref.mComponent, here);
+ + pa.mPref.mComponent);
pir.removeFilter(pa);
}
mSettings.writePackageRestrictionsLPr(
diff --git a/tests/StatusBar/res/layout/notification_builder_test.xml b/tests/StatusBar/res/layout/notification_builder_test.xml
index 94fc089..5987c84 100644
--- a/tests/StatusBar/res/layout/notification_builder_test.xml
+++ b/tests/StatusBar/res/layout/notification_builder_test.xml
@@ -222,307 +222,320 @@
>
<!-- setWhen -->
- <RadioGroup
- android:id="@+id/group_when"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setWhen"
/>
- <RadioButton
- android:id="@+id/when_midnight"
- style="@style/FieldContents"
- android:text="midnight"
- />
- <RadioButton
- android:id="@+id/when_now"
- style="@style/FieldContents"
- android:text="now"
- />
- <RadioButton
- android:id="@+id/when_now_plus_1h"
- style="@style/FieldContents.Disabled"
- android:text="now + 1h"
- />
- <RadioButton
- android:id="@+id/when_tomorrow"
- style="@style/FieldContents.Disabled"
- android:text="tomorrow"
- />
- </RadioGroup>
+ <RadioGroup
+ android:id="@+id/group_when"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/when_midnight"
+ style="@style/FieldContents"
+ android:text="midnight"
+ />
+ <RadioButton
+ android:id="@+id/when_now"
+ style="@style/FieldContents"
+ android:text="now"
+ />
+ <RadioButton
+ android:id="@+id/when_now_plus_1h"
+ style="@style/FieldContents.Disabled"
+ android:text="now + 1h"
+ />
+ <RadioButton
+ android:id="@+id/when_tomorrow"
+ style="@style/FieldContents.Disabled"
+ android:text="tomorrow"
+ />
+ </RadioGroup>
+ </LinearLayout>
<!-- icon -->
- <RadioGroup
- android:id="@+id/group_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setSmallIcon"
/>
- <RadioButton
- android:id="@+id/icon_im"
- style="@style/FieldContents"
- android:text="IM"
- />
- <RadioButton
- android:id="@+id/icon_alert"
- style="@style/FieldContents"
- android:text="alert"
- />
- <RadioButton
- android:id="@+id/icon_surprise"
- style="@style/FieldContents"
- android:text="surprise"
- />
- <RadioButton
- android:id="@+id/icon_level0"
- style="@style/FieldContents.Disabled"
- android:text="level 0"
- />
- <RadioButton
- android:id="@+id/icon_level50"
- style="@style/FieldContents.Disabled"
- android:text="level 50"
- />
- <RadioButton
- android:id="@+id/icon_level100"
- style="@style/FieldContents.Disabled"
- android:text="level 100"
- />
- <!-- todo setSmallIcon(int icon, int level) -->
- </RadioGroup>
-
+ <RadioGroup
+ android:id="@+id/group_icon"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/icon_im"
+ style="@style/FieldContents"
+ android:text="IM"
+ />
+ <RadioButton
+ android:id="@+id/icon_alert"
+ style="@style/FieldContents"
+ android:text="alert"
+ />
+ <RadioButton
+ android:id="@+id/icon_surprise"
+ style="@style/FieldContents"
+ android:text="surprise"
+ />
+ <RadioButton
+ android:id="@+id/icon_level0"
+ style="@style/FieldContents.Disabled"
+ android:text="level 0"
+ />
+ <RadioButton
+ android:id="@+id/icon_level50"
+ style="@style/FieldContents.Disabled"
+ android:text="level 50"
+ />
+ <RadioButton
+ android:id="@+id/icon_level100"
+ style="@style/FieldContents.Disabled"
+ android:text="level 100"
+ />
+ <!-- todo setSmallIcon(int icon, int level) -->
+ </RadioGroup>
+ </LinearLayout>
+
<!-- setContentTitle -->
- <RadioGroup
- android:id="@+id/group_title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setContentTitle"
/>
- <RadioButton
- android:id="@+id/title_short"
- style="@style/FieldContents"
- android:text="none"
- android:tag=""
- />
- <RadioButton
- android:id="@+id/title_short"
- style="@style/FieldContents"
- android:text="short"
- android:tag="Title"
- />
- <RadioButton
- android:id="@+id/title_medium"
- style="@style/FieldContents"
- android:text="medium"
- android:tag="Notification Test"
- />
- <RadioButton
- android:id="@+id/title_long"
- style="@style/FieldContents"
- android:text="long"
- android:tag="This is one heckuva long title for a notification"
- />
- </RadioGroup>
-
+ <RadioGroup
+ android:id="@+id/group_title"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/title_short"
+ style="@style/FieldContents"
+ android:text="none"
+ android:tag=""
+ />
+ <RadioButton
+ android:id="@+id/title_short"
+ style="@style/FieldContents"
+ android:text="short"
+ android:tag="Title"
+ />
+ <RadioButton
+ android:id="@+id/title_medium"
+ style="@style/FieldContents"
+ android:text="medium"
+ android:tag="Notification Test"
+ />
+ <RadioButton
+ android:id="@+id/title_long"
+ style="@style/FieldContents"
+ android:text="long"
+ android:tag="This is one heckuva long title for a notification"
+ />
+ </RadioGroup>
+ </LinearLayout>
+
<!-- setContentText -->
- <RadioGroup
- android:id="@+id/group_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setContentText"
/>
- <RadioButton
- android:id="@+id/text_none"
- style="@style/FieldContents"
- android:text="none"
- android:tag=""
- />
- <RadioButton
- android:id="@+id/text_short"
- style="@style/FieldContents"
- android:tag="short"
- android:text="text"
- />
- <RadioButton
- android:id="@+id/text_medium"
- style="@style/FieldContents"
- android:text="medium"
- android:tag="Something happened"
- />
- <RadioButton
- android:id="@+id/text_long"
- style="@style/FieldContents"
- android:text="long"
- android:tag="Oh my goodness. SOMETHING HAPPENED!!!!"
- />
- <RadioButton
- android:id="@+id/text_emoji"
- style="@style/FieldContents"
- android:text="emoji"
- android:tag="_ Cactus _ Cactus _"
- />
- <RadioButton
- android:id="@+id/text_haiku"
- style="@style/FieldContents"
- android:text="haiku"
- android:tag="sholes final approach\nlanding gear punted to flan\nrunway foam glistens"
- />
- </RadioGroup>
+ <RadioGroup
+ android:id="@+id/group_text"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/text_none"
+ style="@style/FieldContents"
+ android:text="none"
+ android:tag=""
+ />
+ <RadioButton
+ android:id="@+id/text_short"
+ style="@style/FieldContents"
+ android:tag="short"
+ android:text="text"
+ />
+ <RadioButton
+ android:id="@+id/text_medium"
+ style="@style/FieldContents"
+ android:text="medium"
+ android:tag="Something happened"
+ />
+ <RadioButton
+ android:id="@+id/text_long"
+ style="@style/FieldContents"
+ android:text="long"
+ android:tag="Oh my goodness. SOMETHING HAPPENED!!!!"
+ />
+ <RadioButton
+ android:id="@+id/text_emoji"
+ style="@style/FieldContents"
+ android:text="emoji"
+ android:tag="_ Cactus _ Cactus _"
+ />
+ <RadioButton
+ android:id="@+id/text_haiku"
+ style="@style/FieldContents"
+ android:text="haiku"
+ android:tag="sholes final approach\nlanding gear punted to flan\nrunway foam glistens"
+ />
+ </RadioGroup>
+ </LinearLayout>
<!-- setContentInfo -->
- <RadioGroup
- android:id="@+id/group_info"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setContentInfo"
/>
- <RadioButton
- android:id="@+id/info_none"
- style="@style/FieldContents"
- android:text="none"
- android:tag=""
- />
- <RadioButton
- android:id="@+id/info_number"
- style="@style/FieldContents"
- android:text="snoozed"
- android:tag="snoozed"
- />
- <RadioButton
- android:id="@+id/info_long"
- style="@style/FieldContents"
- android:text="longer"
- android:tag="this content info is way too long"
- />
- </RadioGroup>
+ <RadioGroup
+ android:id="@+id/group_info"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/info_none"
+ style="@style/FieldContents"
+ android:text="none"
+ android:tag=""
+ />
+ <RadioButton
+ android:id="@+id/info_number"
+ style="@style/FieldContents"
+ android:text="snoozed"
+ android:tag="snoozed"
+ />
+ <RadioButton
+ android:id="@+id/info_long"
+ style="@style/FieldContents"
+ android:text="longer"
+ android:tag="this content info is way too long"
+ />
+ </RadioGroup>
+ </LinearLayout>
<!-- setNumber -->
- <RadioGroup
- android:id="@+id/group_number"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setNumber"
/>
- <RadioButton
- android:id="@+id/number_0"
- style="@style/FieldContents"
- android:text="0"
- android:tag="0"
- />
- <RadioButton
- android:id="@+id/number_1"
- style="@style/FieldContents"
- android:text="1"
- android:tag="1"
- />
- <RadioButton
- android:id="@+id/number_42"
- style="@style/FieldContents"
- android:text="42"
- android:tag="42"
- />
- <RadioButton
- android:id="@+id/number_334"
- style="@style/FieldContents"
- android:text="334"
- android:tag="334"
- />
- <RadioButton
- android:id="@+id/number_999"
- style="@style/FieldContents"
- android:text="999"
- android:tag="999"
- />
- <RadioButton
- android:id="@+id/number_9876"
- style="@style/FieldContents"
- android:text="9,876"
- android:tag="9876"
- />
- <RadioButton
- android:id="@+id/number_12345"
- style="@style/FieldContents"
- android:text="12,345"
- android:tag="12345"
- />
- </RadioGroup>
-
+ <RadioGroup
+ android:id="@+id/group_number"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/number_0"
+ style="@style/FieldContents"
+ android:text="0"
+ android:tag="0"
+ />
+ <RadioButton
+ android:id="@+id/number_1"
+ style="@style/FieldContents"
+ android:text="1"
+ android:tag="1"
+ />
+ <RadioButton
+ android:id="@+id/number_42"
+ style="@style/FieldContents"
+ android:text="42"
+ android:tag="42"
+ />
+ <RadioButton
+ android:id="@+id/number_334"
+ style="@style/FieldContents"
+ android:text="334"
+ android:tag="334"
+ />
+ <RadioButton
+ android:id="@+id/number_999"
+ style="@style/FieldContents"
+ android:text="999"
+ android:tag="999"
+ />
+ <RadioButton
+ android:id="@+id/number_9876"
+ style="@style/FieldContents"
+ android:text="9,876"
+ android:tag="9876"
+ />
+ <RadioButton
+ android:id="@+id/number_12345"
+ style="@style/FieldContents"
+ android:text="12,345"
+ android:tag="12345"
+ />
+ </RadioGroup>
+ </LinearLayout>
+
<!-- setContentIntent -->
- <RadioGroup
- android:id="@+id/group_intent"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setContentIntent"
/>
- <RadioButton
- android:id="@+id/intent_none"
- style="@style/FieldContents"
- android:text="none"
- />
- <RadioButton
- android:id="@+id/intent_alert"
- style="@style/FieldContents"
- android:text="alert"
- />
- </RadioGroup>
-
+ <RadioGroup
+ android:id="@+id/group_intent"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/intent_none"
+ style="@style/FieldContents"
+ android:text="none"
+ />
+ <RadioButton
+ android:id="@+id/intent_alert"
+ style="@style/FieldContents"
+ android:text="alert"
+ />
+ </RadioGroup>
+ </LinearLayout>
+
<!-- setDeleteIntent -->
- <RadioGroup
- android:id="@+id/group_delete"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setDeleteIntent"
/>
- <RadioButton
- android:id="@+id/delete_none"
- style="@style/FieldContents"
- android:text="none"
- />
- <RadioButton
- android:id="@+id/delete_alert"
- style="@style/FieldContents"
- android:text="alert"
- />
- </RadioGroup>
-
+ <RadioGroup
+ android:id="@+id/group_delete"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/delete_none"
+ style="@style/FieldContents"
+ android:text="none"
+ />
+ <RadioButton
+ android:id="@+id/delete_alert"
+ style="@style/FieldContents"
+ android:text="alert"
+ />
+ </RadioGroup>
+ </LinearLayout>
<!-- setFullScreenIntent -->
<RadioGroup
android:id="@+id/group_full_screen"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
+ style="@style/FieldChoices"
android:visibility="gone"
>
<TextView
@@ -543,94 +556,94 @@
<!-- setTicker -->
- <RadioGroup
- android:id="@+id/group_ticker"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setTicker"
/>
- <RadioButton
- android:id="@+id/ticker_none"
- style="@style/FieldContents"
- android:text="none"
- android:tag=""
- />
- <RadioButton
- android:id="@+id/ticker_short"
- style="@style/FieldContents"
- android:text="short"
- android:tag="tick"
- />
- <RadioButton
- android:id="@+id/ticker_wrap"
- style="@style/FieldContents"
- android:text="wrap"
- android:tag="tick tick tick tock tock tock something fun has happened but i don't know what it is just yet"
- />
- <RadioButton
- android:id="@+id/ticker_haiku"
- style="@style/FieldContents"
- android:text="haiku"
- android:tag="sholes final approach\nlanding gear punted to flan\nrunway foam glistens"
- />
- <RadioButton
- android:id="@+id/ticker_emoji"
- style="@style/FieldContents"
- android:text="emoji"
- android:tag="_ Cactus _ Cactus _"
- />
- <RadioButton
- android:id="@+id/ticker_custom"
- style="@style/FieldContents.Disabled"
- android:text="custom view"
- />
- </RadioGroup>
-
+ <RadioGroup
+ android:id="@+id/group_ticker"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/ticker_none"
+ style="@style/FieldContents"
+ android:text="none"
+ android:tag=""
+ />
+ <RadioButton
+ android:id="@+id/ticker_short"
+ style="@style/FieldContents"
+ android:text="short"
+ android:tag="tick"
+ />
+ <RadioButton
+ android:id="@+id/ticker_wrap"
+ style="@style/FieldContents"
+ android:text="wrap"
+ android:tag="tick tick tick tock tock tock something fun has happened but i don't know what it is just yet"
+ />
+ <RadioButton
+ android:id="@+id/ticker_haiku"
+ style="@style/FieldContents"
+ android:text="haiku"
+ android:tag="sholes final approach\nlanding gear punted to flan\nrunway foam glistens"
+ />
+ <RadioButton
+ android:id="@+id/ticker_emoji"
+ style="@style/FieldContents"
+ android:text="emoji"
+ android:tag="_ Cactus _ Cactus _"
+ />
+ <RadioButton
+ android:id="@+id/ticker_custom"
+ style="@style/FieldContents.Disabled"
+ android:text="custom view"
+ />
+ </RadioGroup>
+ </LinearLayout>
<!-- setLargeIcon -->
- <RadioGroup
- android:id="@+id/group_large_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setLargeIcon"
/>
- <RadioButton
- android:id="@+id/large_icon_none"
- style="@style/FieldContents"
- android:text="none"
- />
- <RadioButton
- android:id="@+id/large_icon_pineapple"
- style="@style/FieldContents"
- android:text="pineapple"
- />
- <RadioButton
- android:id="@+id/large_icon_pineapple2"
- style="@style/FieldContents"
- android:text="pineapple2"
- />
- <RadioButton
- android:id="@+id/large_icon_small"
- style="@style/FieldContents"
- android:text="small"
- />
- </RadioGroup>
-
+ <RadioGroup
+ android:id="@+id/group_large_icon"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/large_icon_none"
+ style="@style/FieldContents"
+ android:text="none"
+ />
+ <RadioButton
+ android:id="@+id/large_icon_pineapple"
+ style="@style/FieldContents"
+ android:text="pineapple"
+ />
+ <RadioButton
+ android:id="@+id/large_icon_pineapple2"
+ style="@style/FieldContents"
+ android:text="pineapple2"
+ />
+ <RadioButton
+ android:id="@+id/large_icon_small"
+ style="@style/FieldContents"
+ android:text="small"
+ />
+ </RadioGroup>
+ </LinearLayout>
<!-- setSound -->
<RadioGroup
android:id="@+id/group_sound"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
+ style="@style/FieldChoices"
android:visibility="gone"
>
<TextView
@@ -646,190 +659,260 @@
<!-- setVibrate -->
- <RadioGroup
- android:id="@+id/group_vibrate"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setVibrate"
/>
- <RadioButton
- android:id="@+id/vibrate_none"
- style="@style/FieldContents"
- android:text="none"
- />
- <RadioButton
- android:id="@+id/vibrate_short"
- style="@style/FieldContents"
- android:text="short"
- />
- <RadioButton
- android:id="@+id/vibrate_medium"
- style="@style/FieldContents"
- android:text="long"
- />
- <RadioButton
- android:id="@+id/vibrate_long"
- style="@style/FieldContents"
- android:text="long"
- />
- <RadioButton
- android:id="@+id/vibrate_pattern"
- style="@style/FieldContents"
- android:text="longer"
- />
- </RadioGroup>
-
+ <RadioGroup
+ android:id="@+id/group_vibrate"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/vibrate_none"
+ style="@style/FieldContents"
+ android:text="none"
+ />
+ <RadioButton
+ android:id="@+id/vibrate_zero"
+ style="@style/FieldContents"
+ android:text="0"
+ />
+ <RadioButton
+ android:id="@+id/vibrate_short"
+ style="@style/FieldContents"
+ android:text="100"
+ />
+ <RadioButton
+ android:id="@+id/vibrate_long"
+ style="@style/FieldContents"
+ android:text="1000"
+ />
+ <RadioButton
+ android:id="@+id/vibrate_pattern"
+ style="@style/FieldContents"
+ android:text="...---..."
+ />
+ </RadioGroup>
+ </LinearLayout>
<!-- setLights -->
- <RadioGroup
- android:id="@+id/group_lights_color"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setLights (color)"
/>
- <RadioButton
- android:id="@+id/lights_red"
- style="@style/FieldContents"
- android:text="red"
- android:tag="0xff0000"
+ <RadioGroup
+ android:id="@+id/group_lights_color"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/lights_red"
+ style="@style/FieldContents"
+ android:text="red"
+ android:tag="0xff0000"
+ />
+ <RadioButton
+ android:id="@+id/lights_green"
+ style="@style/FieldContents"
+ android:text="green"
+ android:tag="0x00ff00"
+ />
+ <RadioButton
+ android:id="@+id/lights_blue"
+ style="@style/FieldContents"
+ android:text="blue"
+ android:tag="0x0000ff"
+ />
+ <RadioButton
+ android:id="@+id/lights_cyan"
+ style="@style/FieldContents"
+ android:text="cyan"
+ android:tag="0x00ffff"
+ />
+ <RadioButton
+ android:id="@+id/lights_magenta"
+ style="@style/FieldContents"
+ android:text="magenta"
+ android:tag="0xff00ff"
+ />
+ <RadioButton
+ android:id="@+id/lights_yellow"
+ style="@style/FieldContents"
+ android:text="yellow"
+ android:tag="0xffff00"
+ />
+ <RadioButton
+ android:id="@+id/lights_white"
+ style="@style/FieldContents"
+ android:text="white"
+ android:tag="0xffffff"
+ />
+ </RadioGroup>
+ </LinearLayout>
+
+ <!-- setPriority -->
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
+ <TextView
+ style="@style/FieldTitle"
+ android:text="setPriority"
/>
- <RadioButton
- android:id="@+id/lights_green"
- style="@style/FieldContents"
- android:text="green"
- android:tag="0x00ff00"
- />
- <RadioButton
- android:id="@+id/lights_blue"
- style="@style/FieldContents"
- android:text="blue"
- android:tag="0x0000ff"
- />
- <RadioButton
- android:id="@+id/lights_cyan"
- style="@style/FieldContents"
- android:text="cyan"
- android:tag="0x00ffff"
- />
- <RadioButton
- android:id="@+id/lights_magenta"
- style="@style/FieldContents"
- android:text="magenta"
- android:tag="0xff00ff"
- />
- <RadioButton
- android:id="@+id/lights_yellow"
- style="@style/FieldContents"
- android:text="yellow"
- android:tag="0xffff00"
- />
- <RadioButton
- android:id="@+id/lights_white"
- style="@style/FieldContents"
- android:text="white"
- android:tag="0xffffff"
- />
- </RadioGroup>
+ <RadioGroup
+ android:id="@+id/group_priority"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/pri_max"
+ style="@style/FieldContents"
+ android:text="MAX"
+ />
+ <RadioButton
+ android:id="@+id/pri_high"
+ style="@style/FieldContents"
+ android:text="HIGH"
+ />
+ <RadioButton
+ android:id="@+id/pri_default"
+ style="@style/FieldContents"
+ android:text="DEFAULT"
+ />
+ <RadioButton
+ android:id="@+id/pri_low"
+ style="@style/FieldContents"
+ android:text="LOW"
+ />
+ <RadioButton
+ android:id="@+id/pri_min"
+ style="@style/FieldContents"
+ android:text="MIN"
+ />
+ </RadioGroup>
+ </LinearLayout>
<!-- setLights -->
- <RadioGroup
- android:id="@+id/group_lights_blink"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setLights (blink)"
/>
- <RadioButton
- android:id="@+id/lights_off"
- style="@style/FieldContents"
- android:text="off"
- />
- <RadioButton
- android:id="@+id/lights_slow"
- style="@style/FieldContents"
- android:text="slow"
- />
- <RadioButton
- android:id="@+id/lights_fast"
- style="@style/FieldContents"
- android:text="fast"
- />
- <RadioButton
- android:id="@+id/lights_on"
- style="@style/FieldContents"
- android:text="on"
- />
- </RadioGroup>
-
+ <RadioGroup
+ android:id="@+id/group_lights_blink"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/lights_off"
+ style="@style/FieldContents"
+ android:text="off"
+ />
+ <RadioButton
+ android:id="@+id/lights_slow"
+ style="@style/FieldContents"
+ android:text="slow"
+ />
+ <RadioButton
+ android:id="@+id/lights_fast"
+ style="@style/FieldContents"
+ android:text="fast"
+ />
+ <RadioButton
+ android:id="@+id/lights_on"
+ style="@style/FieldContents"
+ android:text="on"
+ />
+ </RadioGroup>
+ </LinearLayout>
+
<!-- flags -->
<LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:layout_marginTop="12dp"
- >
+ style="@style/FieldGroup"
+ android:layout_marginTop="30dp"
+ >
<TextView
style="@style/FieldTitle"
android:text="flags"
/>
- <CheckBox
- android:id="@+id/flag_ongoing"
- style="@style/FieldContents"
- android:text="setOngoing"
- />
- <CheckBox
- android:id="@+id/flag_once"
- style="@style/FieldContents"
- android:text="setOnlyAlertOnce"
- />
- <CheckBox
- android:id="@+id/flag_auto_cancel"
- style="@style/FieldContents"
- android:text="setAutoCancel"
- />
+ <LinearLayout
+ style="@style/FieldChoices"
+ >
+ <CheckBox
+ android:id="@+id/flag_ongoing"
+ style="@style/FieldContents"
+ android:text="ongoing"
+ />
+ <CheckBox
+ android:id="@+id/flag_once"
+ style="@style/FieldContents"
+ android:text="onlyAlertOnce"
+ />
+ <CheckBox
+ android:id="@+id/flag_auto_cancel"
+ style="@style/FieldContents"
+ android:text="autoCancel"
+ />
+ </LinearLayout>
</LinearLayout>
-
+
<!-- defaults -->
<LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="defaults"
/>
- <CheckBox
- android:id="@+id/default_sound"
- style="@style/FieldContents"
- android:text="sound"
- />
- <CheckBox
- android:id="@+id/default_vibrate"
- style="@style/FieldContents"
- android:text="vibrate"
- />
- <CheckBox
- android:id="@+id/default_lights"
- style="@style/FieldContents"
- android:text="lights"
- />
+ <LinearLayout
+ style="@style/FieldChoices"
+ >
+ <CheckBox
+ android:id="@+id/default_sound"
+ style="@style/FieldContents"
+ android:text="sound"
+ />
+ <CheckBox
+ android:id="@+id/default_vibrate"
+ style="@style/FieldContents"
+ android:text="vibrate"
+ />
+ <CheckBox
+ android:id="@+id/default_lights"
+ style="@style/FieldContents"
+ android:text="lights"
+ />
+ </LinearLayout>
</LinearLayout>
-
-
-
+ <!-- delay -->
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
+ <TextView
+ style="@style/FieldTitle"
+ android:text="notify"
+ />
+ <RadioGroup
+ android:id="@+id/group_delay"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/delay_none"
+ style="@style/FieldContents"
+ android:text="immediately"
+ />
+ <RadioButton
+ android:id="@+id/delay_5"
+ style="@style/FieldContents"
+ android:text="in 5 sec"
+ />
+ </RadioGroup>
+ </LinearLayout>
</LinearLayout>
</LinearLayout>
diff --git a/tests/StatusBar/res/values/styles.xml b/tests/StatusBar/res/values/styles.xml
index 103a25a..f2c9f0d 100644
--- a/tests/StatusBar/res/values/styles.xml
+++ b/tests/StatusBar/res/values/styles.xml
@@ -45,8 +45,10 @@
<style name="FieldTitle">
<item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
- <item name="android:layout_width">wrap_content</item>
+ <item name="android:layout_width">120dp</item>
<item name="android:layout_height">wrap_content</item>
+ <item name="android:gravity">right</item>
+ <item name="android:textStyle">bold</item>
</style>
<style name="FieldContents">
@@ -61,5 +63,18 @@
<item name="android:visibility">gone</item>
</style>
+ <style name="FieldGroup">
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:orientation">horizontal</item>
+ <item name="android:layout_marginTop">18dp</item>
+ </style>
+
+ <style name="FieldChoices">
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:orientation">vertical</item>
+ <item name="android:baselineAlignedChildIndex">0</item>
+ </style>
</resources>
diff --git a/tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java b/tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java
index 2f0c173..5d0b155 100644
--- a/tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java
+++ b/tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java
@@ -30,6 +30,7 @@
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
+import android.os.Handler;
import android.os.Vibrator;
import android.os.Handler;
import android.text.SpannableStringBuilder;
@@ -49,11 +50,14 @@
private final static String TAG = "NotificationTestList";
NotificationManager mNM;
+ Handler mHandler;
+ int mStartDelay;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
mNM = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
+ mHandler = new Handler();
setContentView(R.layout.notification_builder_test);
if (icicle == null) {
setDefaults();
@@ -100,8 +104,13 @@
setChecked(R.id.large_icon_none);
setChecked(R.id.sound_none);
setChecked(R.id.vibrate_none);
+ setChecked(R.id.pri_default);
setChecked(R.id.lights_red);
setChecked(R.id.lights_off);
+ setChecked(R.id.delay_none);
+// setChecked(R.id.default_vibrate);
+// setChecked(R.id.default_sound);
+// setChecked(R.id.default_lights);
}
private View.OnClickListener mClickListener = new View.OnClickListener() {
@@ -183,9 +192,13 @@
}
};
- private void sendNotification(int id) {
+ private void sendNotification(final int id) {
final Notification n = buildNotification(id);
- mNM.notify(id, n);
+ mHandler.postDelayed(new Runnable() {
+ public void run() {
+ mNM.notify(id, n);
+ }
+ }, mStartDelay);
}
private static CharSequence subst(CharSequence in, char ch, CharSequence sub) {
@@ -323,23 +336,26 @@
// vibrate
switch (getRadioChecked(R.id.group_vibrate)) {
case R.id.vibrate_none:
+ b.setVibrate(null);
+ break;
+ case R.id.vibrate_zero:
+ b.setVibrate(new long[] { 0 });
break;
case R.id.vibrate_short:
- b.setVibrate(new long[] { 0, 200 });
- break;
- case R.id.vibrate_medium:
- b.setVibrate(new long[] { 0, 500 });
+ b.setVibrate(new long[] { 0, 100 });
break;
case R.id.vibrate_long:
b.setVibrate(new long[] { 0, 1000 });
break;
case R.id.vibrate_pattern:
- b.setVibrate(new long[] { 0, 250, 250, 250, 250, 250, 250, 250 });
+ b.setVibrate(new long[] { 0, 50, 200, 50, 200, 50, 500,
+ 500, 200, 500, 200, 500, 500,
+ 50, 200, 50, 200, 50 });
break;
}
// lights
- final int color = getRadioInt(R.id.group_lights_color, 0xff0000);
+ final int color = getRadioHex(R.id.group_lights_color, 0xff0000);
int onMs;
int offMs;
switch (getRadioChecked(R.id.group_lights_blink)) {
@@ -365,6 +381,35 @@
b.setLights(color, onMs, offMs);
}
+ // priority
+ switch (getRadioChecked(R.id.group_priority)) {
+ case R.id.pri_min:
+ b.setPriority(Notification.PRIORITY_MIN);
+ break;
+ case R.id.pri_low:
+ b.setPriority(Notification.PRIORITY_LOW);
+ break;
+ case R.id.pri_default:
+ b.setPriority(Notification.PRIORITY_DEFAULT);
+ break;
+ case R.id.pri_high:
+ b.setPriority(Notification.PRIORITY_HIGH);
+ break;
+ case R.id.pri_max:
+ b.setPriority(Notification.PRIORITY_MAX);
+ break;
+ }
+
+ // start delay
+ switch (getRadioChecked(R.id.group_delay)) {
+ case R.id.delay_none:
+ mStartDelay = 0;
+ break;
+ case R.id.delay_5:
+ mStartDelay = 5000;
+ break;
+ }
+
// flags
b.setOngoing(getChecked(R.id.flag_ongoing));
b.setOnlyAlertOnce(getChecked(R.id.flag_once));
@@ -383,7 +428,7 @@
}
b.setDefaults(defaults);
- return b.getNotification();
+ return b.build();
}
private void setChecked(int id) {
@@ -396,14 +441,14 @@
return g.getCheckedRadioButtonId();
}
- private CharSequence getRadioTag(int id) {
+ private String getRadioTag(int id) {
final RadioGroup g = (RadioGroup)findViewById(id);
final View v = findViewById(g.getCheckedRadioButtonId());
- return (CharSequence) v.getTag();
+ return (String) v.getTag();
}
private int getRadioInt(int id, int def) {
- CharSequence str = getRadioTag(id);
+ String str = getRadioTag(id);
if (TextUtils.isEmpty(str)) {
return def;
} else {
@@ -415,6 +460,22 @@
}
}
+ private int getRadioHex(int id, int def) {
+ String str = getRadioTag(id);
+ if (TextUtils.isEmpty(str)) {
+ return def;
+ } else {
+ if (str.startsWith("0x")) {
+ str = str.substring(2);
+ }
+ try {
+ return Integer.parseInt(str.toString(), 16);
+ } catch (NumberFormatException ex) {
+ return def;
+ }
+ }
+ }
+
private boolean getChecked(int id) {
final CompoundButton b = (CompoundButton)findViewById(id);
return b.isChecked();