Merge "Clear default for USB device/accessory when new matching app is installed" into honeycomb-mr1
diff --git a/core/java/android/app/backup/WallpaperBackupHelper.java b/core/java/android/app/backup/WallpaperBackupHelper.java
index 6539711..55368d6 100644
--- a/core/java/android/app/backup/WallpaperBackupHelper.java
+++ b/core/java/android/app/backup/WallpaperBackupHelper.java
@@ -110,11 +110,16 @@
if (DEBUG) Slog.d(TAG, "Restoring wallpaper image w=" + options.outWidth
+ " h=" + options.outHeight);
- // how much does the image differ from our preference?
+ // How much does the image differ from our preference? The threshold
+ // here is set to accept any image larger than our target, because
+ // scaling down is acceptable; but to reject images that are deemed
+ // "too small" to scale up attractively. The value 1.33 is just barely
+ // too low to pass Nexus 1 or Droid wallpapers for use on a Xoom, but
+ // will pass anything relatively larger.
double widthRatio = mDesiredMinWidth / options.outWidth;
double heightRatio = mDesiredMinHeight / options.outHeight;
- if (widthRatio > 0.8 && widthRatio < 1.25
- && heightRatio > 0.8 && heightRatio < 1.25) {
+ if (widthRatio > 0 && widthRatio < 1.33
+ && heightRatio > 0 && heightRatio < 1.33) {
// sufficiently close to our resolution; go ahead and use it
if (DEBUG) Slog.d(TAG, "wallpaper dimension match; using");
f.renameTo(new File(WALLPAPER_IMAGE));
diff --git a/docs/html/guide/developing/tools/monkeyrunner_concepts.jd b/docs/html/guide/developing/tools/monkeyrunner_concepts.jd
index 97c7c1f..c0795d7 100644
--- a/docs/html/guide/developing/tools/monkeyrunner_concepts.jd
+++ b/docs/html/guide/developing/tools/monkeyrunner_concepts.jd
@@ -128,7 +128,7 @@
device.press('KEYCODE_MENU','DOWN_AND_UP')
# Takes a screenshot
-result = device.takeSnapShot()
+result = device.takeSnapshot()
# Writes the screenshot to a file
result.writeToFile('myproject/shot1.png','png')
diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h
index f7d837a..93b5d24 100644
--- a/include/media/stagefright/OMXCodec.h
+++ b/include/media/stagefright/OMXCodec.h
@@ -50,6 +50,9 @@
// Only submit one input buffer at one time.
kOnlySubmitOneInputBufferAtOneTime = 64,
+
+ // Enable GRALLOC_USAGE_PROTECTED for output buffers from native window
+ kEnableGrallocUsageProtected = 128,
};
static sp<MediaSource> Create(
const sp<IOMX> &omx,
@@ -197,6 +200,7 @@
bool mIsMetaDataStoredInVideoBuffers;
bool mOnlySubmitOneBufferAtOneTime;
+ bool mEnableGrallocUsageProtected;
OMXCodec(const sp<IOMX> &omx, IOMX::node_id node, uint32_t quirks,
bool isEncoder, const char *mime, const char *componentName,
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 4c744bd..5734c7e 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -45,6 +45,7 @@
#include <surfaceflinger/Surface.h>
#include <gui/ISurfaceTexture.h>
#include <gui/SurfaceTextureClient.h>
+#include <surfaceflinger/ISurfaceComposer.h>
#include <media/stagefright/foundation/ALooper.h>
#include <media/stagefright/foundation/AMessage.h>
@@ -1189,6 +1190,19 @@
}
status_t AwesomePlayer::initVideoDecoder(uint32_t flags) {
+
+ // Either the application or the DRM system can independently say
+ // that there must be a hardware-protected path to an external video sink.
+ // For now we always require a hardware-protected path to external video sink
+ // if content is DRMed, but eventually this could be optional per DRM agent.
+ // When the application wants protection, then
+ // (USE_SURFACE_ALLOC && (mSurface != 0) &&
+ // (mSurface->getFlags() & ISurfaceComposer::eProtectedByApp))
+ // will be true, but that part is already handled by SurfaceFlinger.
+ if (mDecryptHandle != NULL) {
+ flags |= OMXCodec::kEnableGrallocUsageProtected;
+ }
+ LOGV("initVideoDecoder flags=0x%x", flags);
mVideoSource = OMXCodec::Create(
mClient.interface(), mVideoTrack->getFormat(),
false, // createEncoder
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 4a94e0d..3e26a95 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -528,6 +528,12 @@
mOnlySubmitOneBufferAtOneTime = true;
}
+ mEnableGrallocUsageProtected = false;
+ if (flags & kEnableGrallocUsageProtected) {
+ mEnableGrallocUsageProtected = true;
+ }
+ LOGV("configureCodec protected=%d", mEnableGrallocUsageProtected);
+
if (!(flags & kIgnoreCodecSpecificData)) {
uint32_t type;
const void *data;
@@ -1751,7 +1757,11 @@
// XXX: Currently this error is logged, but not fatal.
usage = 0;
}
+ if (mEnableGrallocUsageProtected) {
+ usage |= GRALLOC_USAGE_PROTECTED;
+ }
+ LOGV("native_window_set_usage usage=0x%x", usage);
err = native_window_set_usage(
mNativeWindow.get(), usage | GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP);
if (err != 0) {
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 0fab964..267c76a 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -3151,6 +3151,9 @@
try {
pm.setPackageStoppedState(packageName, true);
} catch (RemoteException e) {
+ } catch (IllegalArgumentException e) {
+ Slog.w(TAG, "Failed trying to unstop package "
+ + packageName + ": " + e);
}
}
} finally {
@@ -5559,6 +5562,9 @@
AppGlobals.getPackageManager().setPackageStoppedState(
cpr.appInfo.packageName, false);
} catch (RemoteException e) {
+ } catch (IllegalArgumentException e) {
+ Slog.w(TAG, "Failed trying to unstop package "
+ + cpr.appInfo.packageName + ": " + e);
}
ProcessRecord proc = startProcessLocked(cpi.processName,
@@ -5840,6 +5846,9 @@
AppGlobals.getPackageManager().setPackageStoppedState(
info.packageName, false);
} catch (RemoteException e) {
+ } catch (IllegalArgumentException e) {
+ Slog.w(TAG, "Failed trying to unstop package "
+ + info.packageName + ": " + e);
}
if ((info.flags&(ApplicationInfo.FLAG_SYSTEM|ApplicationInfo.FLAG_PERSISTENT))
@@ -6673,8 +6682,10 @@
mProcessCrashTimes.remove(app.info.processName, app.info.uid);
app.removed = true;
removeProcessLocked(app, false);
+ mMainStack.resumeTopActivityLocked(null);
return false;
}
+ mMainStack.resumeTopActivityLocked(null);
} else {
ActivityRecord r = mMainStack.topRunningActivityLocked(null);
if (r.app == app) {
@@ -6780,7 +6791,7 @@
* @param crashInfo describing the exception
*/
public void handleApplicationCrash(IBinder app, ApplicationErrorReport.CrashInfo crashInfo) {
- ProcessRecord r = findAppProcess(app);
+ ProcessRecord r = findAppProcess(app, "Crash");
EventLog.writeEvent(EventLogTags.AM_CRASH, Binder.getCallingPid(),
app == null ? "system" : (r == null ? "unknown" : r.processName),
@@ -6799,7 +6810,10 @@
IBinder app,
int violationMask,
StrictMode.ViolationInfo info) {
- ProcessRecord r = findAppProcess(app);
+ ProcessRecord r = findAppProcess(app, "StrictMode");
+ if (r == null) {
+ return;
+ }
if ((violationMask & StrictMode.PENALTY_DROPBOX) != 0) {
Integer stackFingerprint = info.hashCode();
@@ -6973,7 +6987,7 @@
*/
public boolean handleApplicationWtf(IBinder app, String tag,
ApplicationErrorReport.CrashInfo crashInfo) {
- ProcessRecord r = findAppProcess(app);
+ ProcessRecord r = findAppProcess(app, "WTF");
EventLog.writeEvent(EventLogTags.AM_WTF, Binder.getCallingPid(),
app == null ? "system" : (r == null ? "unknown" : r.processName),
@@ -6995,7 +7009,7 @@
* @param app object of some object (as stored in {@link com.android.internal.os.RuntimeInit})
* @return the corresponding {@link ProcessRecord} object, or null if none could be found
*/
- private ProcessRecord findAppProcess(IBinder app) {
+ private ProcessRecord findAppProcess(IBinder app, String reason) {
if (app == null) {
return null;
}
@@ -7011,7 +7025,9 @@
}
}
- Slog.w(TAG, "Can't find mystery application: " + app);
+ Slog.w(TAG, "Can't find mystery application for " + reason
+ + " from pid=" + Binder.getCallingPid()
+ + " uid=" + Binder.getCallingUid() + ": " + app);
return null;
}
}
@@ -9396,6 +9412,9 @@
AppGlobals.getPackageManager().setPackageStoppedState(
r.packageName, false);
} catch (RemoteException e) {
+ } catch (IllegalArgumentException e) {
+ Slog.w(TAG, "Failed trying to unstop package "
+ + r.packageName + ": " + e);
}
final String appName = r.processName;
@@ -10297,6 +10316,9 @@
AppGlobals.getPackageManager().setPackageStoppedState(
app.packageName, false);
} catch (RemoteException e) {
+ } catch (IllegalArgumentException e) {
+ Slog.w(TAG, "Failed trying to unstop package "
+ + app.packageName + ": " + e);
}
BackupRecord r = new BackupRecord(ss, app, backupMode);
@@ -11625,6 +11647,9 @@
AppGlobals.getPackageManager().setPackageStoppedState(
r.curComponent.getPackageName(), false);
} catch (RemoteException e) {
+ } catch (IllegalArgumentException e) {
+ Slog.w(TAG, "Failed trying to unstop package "
+ + r.curComponent.getPackageName() + ": " + e);
}
// Is this receiver's application already running?
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index 3a613bb..c087aecf 100644
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -1299,6 +1299,9 @@
AppGlobals.getPackageManager().setPackageStoppedState(
next.packageName, false);
} catch (RemoteException e1) {
+ } catch (IllegalArgumentException e) {
+ Slog.w(TAG, "Failed trying to unstop package "
+ + next.packageName + ": " + e);
}
// We are starting up the next activity, so tell the window manager