diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java index 00ab7de101783..1c0ed3671d37d 100644 --- a/core/java/android/content/res/Resources.java +++ b/core/java/android/content/res/Resources.java @@ -54,7 +54,7 @@ public class Resources { // Use the current SDK version code. If we are a development build, // also allow the previous SDK version + 1. private static final int sSdkVersion = Build.VERSION.SDK_INT - + ("REL".equals(Build.VERSION.CODENAME) ? 1 : 0); + + ("REL".equals(Build.VERSION.CODENAME) ? 0 : 1); private static final Object mSync = new Object(); private static Resources mSystem = null; diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h index a7c8a0a7bd2f1..e0661778c3e3e 100644 --- a/include/media/AudioSystem.h +++ b/include/media/AudioSystem.h @@ -257,11 +257,12 @@ public: DEVICE_IN_WIRED_HEADSET = 0x100000, DEVICE_IN_AUX_DIGITAL = 0x200000, DEVICE_IN_VOICE_CALL = 0x400000, + DEVICE_IN_BACK_MIC = 0x800000, DEVICE_IN_DEFAULT = 0x80000000, DEVICE_IN_ALL = (DEVICE_IN_COMMUNICATION | DEVICE_IN_AMBIENT | DEVICE_IN_BUILTIN_MIC | DEVICE_IN_BLUETOOTH_SCO_HEADSET | DEVICE_IN_WIRED_HEADSET | DEVICE_IN_AUX_DIGITAL | - DEVICE_IN_VOICE_CALL| DEVICE_IN_DEFAULT) + DEVICE_IN_VOICE_CALL | DEVICE_IN_BACK_MIC | DEVICE_IN_DEFAULT) }; // device connection states used for setDeviceConnectionState() diff --git a/include/media/mediarecorder.h b/include/media/mediarecorder.h index 13316a9339d30..d8ab63d6092f4 100644 --- a/include/media/mediarecorder.h +++ b/include/media/mediarecorder.h @@ -41,7 +41,8 @@ enum audio_source { AUDIO_SOURCE_VOICE_UPLINK = 2, AUDIO_SOURCE_VOICE_DOWNLINK = 3, AUDIO_SOURCE_VOICE_CALL = 4, - AUDIO_SOURCE_MAX = AUDIO_SOURCE_VOICE_CALL, + AUDIO_SOURCE_CAMCORDER = 5, + AUDIO_SOURCE_MAX = AUDIO_SOURCE_CAMCORDER, AUDIO_SOURCE_LIST_END // must be last - used to validate audio source type }; diff --git a/include/utils/ResourceTypes.h b/include/utils/ResourceTypes.h index 17ccad6f987b1..49145e8efd53b 100644 --- a/include/utils/ResourceTypes.h +++ b/include/utils/ResourceTypes.h @@ -1272,7 +1272,7 @@ struct ResTable_config if (version || o.version) { if ((sdkVersion != o.sdkVersion) && requested->sdkVersion) { - return (sdkVersion); + return (sdkVersion > o.sdkVersion); } if ((minorVersion != o.minorVersion) && @@ -1384,7 +1384,7 @@ struct ResTable_config } if (version != 0) { if (settings.sdkVersion != 0 && sdkVersion != 0 - && sdkVersion != settings.sdkVersion) { + && sdkVersion > settings.sdkVersion) { return false; } if (settings.minorVersion != 0 && minorVersion != 0 diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp index 0960c81e108ea..9c0c8508606ba 100644 --- a/libs/audioflinger/AudioFlinger.cpp +++ b/libs/audioflinger/AudioFlinger.cpp @@ -1162,7 +1162,7 @@ AudioFlinger::MixerThread::~MixerThread() bool AudioFlinger::MixerThread::threadLoop() { - uint32_t sleepTime = 0; + uint32_t sleepTime = 1000; uint32_t maxBufferRecoveryInUsecs = getMaxBufferRecoveryInUsecs(); int16_t* curBuf = mMixBuffer; Vector< sp > tracksToRemove; @@ -1224,6 +1224,7 @@ bool AudioFlinger::MixerThread::threadLoop() } standbyTime = systemTime() + kStandbyTimeInNsecs; + sleepTime = 1000; continue; } } @@ -1591,7 +1592,7 @@ AudioFlinger::DirectOutputThread::~DirectOutputThread() bool AudioFlinger::DirectOutputThread::threadLoop() { - uint32_t sleepTime = 0; + uint32_t sleepTime = 1000; uint32_t maxBufferRecoveryInUsecs = getMaxBufferRecoveryInUsecs(); sp trackToRemove; sp activeTrack; @@ -1643,6 +1644,7 @@ bool AudioFlinger::DirectOutputThread::threadLoop() } standbyTime = systemTime() + kStandbyTimeInNsecs; + sleepTime = 1000; continue; } } @@ -1879,7 +1881,7 @@ AudioFlinger::DuplicatingThread::~DuplicatingThread() bool AudioFlinger::DuplicatingThread::threadLoop() { - uint32_t sleepTime = 0; + uint32_t sleepTime = 1000; uint32_t maxBufferRecoveryInUsecs = getMaxBufferRecoveryInUsecs(); int16_t* curBuf = mMixBuffer; Vector< sp > tracksToRemove; @@ -1940,6 +1942,7 @@ bool AudioFlinger::DuplicatingThread::threadLoop() } standbyTime = systemTime() + kStandbyTimeInNsecs; + sleepTime = 1000; continue; } } diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp index b7d1297feddf1..2cbfe17d40a9d 100644 --- a/libs/rs/rsAllocation.cpp +++ b/libs/rs/rsAllocation.cpp @@ -52,6 +52,8 @@ Allocation::Allocation(Context *rsc, const Type *type) : ObjectBase(rsc) Allocation::~Allocation() { + free(mPtr); + mPtr = NULL; } void Allocation::setCpuWritable(bool) diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp index eb388af500344..961ec0b2709cb 100644 --- a/libs/rs/rsContext.cpp +++ b/libs/rs/rsContext.cpp @@ -350,6 +350,7 @@ void * Context::threadProc(void *vrsc) rsc->deinitEGL(); pthread_mutex_unlock(&gInitMutex); + rsc->mObjDestroy.mNeedToEmpty = true; rsc->objDestroyOOBRun(); LOGV("RS Thread exited"); return NULL; @@ -421,6 +422,7 @@ Context::~Context() mIO.shutdown(); int status = pthread_join(mThreadId, &res); + mObjDestroy.mNeedToEmpty = true; objDestroyOOBRun(); // Global structure cleanup. @@ -431,6 +433,7 @@ Context::~Context() if (!gThreadTLSKeyCount) { pthread_key_delete(gThreadTLSKey); } + mDev = NULL; } pthread_mutex_unlock(&gInitMutex); diff --git a/libs/rs/rsObjectBase.cpp b/libs/rs/rsObjectBase.cpp index 0008ea47c222b..1b442ba39a7e0 100644 --- a/libs/rs/rsObjectBase.cpp +++ b/libs/rs/rsObjectBase.cpp @@ -39,6 +39,7 @@ ObjectBase::~ObjectBase() rsAssert(!mUserRefCount); rsAssert(!mSysRefCount); remove(); + delete[] mName; } void ObjectBase::dumpLOGV(const char *op) const diff --git a/libs/rs/rsSimpleMesh.cpp b/libs/rs/rsSimpleMesh.cpp index b082fd7db26b9..434a35ffb3b0c 100644 --- a/libs/rs/rsSimpleMesh.cpp +++ b/libs/rs/rsSimpleMesh.cpp @@ -99,6 +99,8 @@ SimpleMeshContext::SimpleMeshContext() SimpleMeshContext::~SimpleMeshContext() { + delete[] mVertexTypes; + delete[] mVertexBuffers; } diff --git a/libs/rs/rsType.cpp b/libs/rs/rsType.cpp index ddaa2f0e14262..0eb41119daab5 100644 --- a/libs/rs/rsType.cpp +++ b/libs/rs/rsType.cpp @@ -57,6 +57,7 @@ TypeState::TypeState() TypeState::~TypeState() { + delete[] mLODs; } size_t Type::getOffsetForFace(uint32_t face) const diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp index 9d2c779e70e30..0b75a2bf75f34 100644 --- a/media/libmediaplayerservice/MediaPlayerService.cpp +++ b/media/libmediaplayerservice/MediaPlayerService.cpp @@ -1509,6 +1509,7 @@ void MediaPlayerService::AudioOutput::pause() { LOGV("pause"); if (mTrack) mTrack->pause(); + lastWriteTime = 0; } void MediaPlayerService::AudioOutput::close() diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java index 82a7c1c6d90ec..754e6e578b538 100644 --- a/services/java/com/android/server/BackupManagerService.java +++ b/services/java/com/android/server/BackupManagerService.java @@ -76,6 +76,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Random; class BackupManagerService extends IBackupManager.Stub { private static final String TAG = "BackupManagerService"; @@ -85,6 +86,9 @@ class BackupManagerService extends IBackupManager.Stub { // trigger an immediate pass. private static final long BACKUP_INTERVAL = AlarmManager.INTERVAL_HOUR; + // Random variation in backup scheduling time to avoid server load spikes + private static final int FUZZ_MILLIS = 5 * 60 * 1000; + // The amount of time between the initial provisioning of the device and // the first backup pass. private static final long FIRST_BACKUP_INTERVAL = 12 * AlarmManager.INTERVAL_HOUR; @@ -1949,9 +1953,15 @@ class BackupManagerService extends IBackupManager.Stub { } private void startBackupAlarmsLocked(long delayBeforeFirstBackup) { - long when = System.currentTimeMillis() + delayBeforeFirstBackup; - mAlarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, when, - BACKUP_INTERVAL, mRunBackupIntent); + // We used to use setInexactRepeating(), but that may be linked to + // backups running at :00 more often than not, creating load spikes. + // Schedule at an exact time for now, and also add a bit of "fuzz". + + Random random = new Random(); + long when = System.currentTimeMillis() + delayBeforeFirstBackup + + random.nextInt(FUZZ_MILLIS); + mAlarmManager.setRepeating(AlarmManager.RTC_WAKEUP, when, + BACKUP_INTERVAL + random.nextInt(FUZZ_MILLIS), mRunBackupIntent); mNextBackupPass = when; } diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java index 190ba5e075075..8a7c28fc1fc17 100644 --- a/services/java/com/android/server/PowerManagerService.java +++ b/services/java/com/android/server/PowerManagerService.java @@ -1803,6 +1803,8 @@ class PowerManagerService extends IPowerManager.Stub } private void forceUserActivityLocked() { + // cancel animation so userActivity will succeed + mScreenBrightness.animating = false; boolean savedActivityAllowed = mUserActivityAllowed; mUserActivityAllowed = true; userActivity(SystemClock.uptimeMillis(), false); @@ -2079,7 +2081,6 @@ class PowerManagerService extends IPowerManager.Stub public void enableUserActivity(boolean enabled) { synchronized (mLocks) { mUserActivityAllowed = enabled; - mLastEventTime = SystemClock.uptimeMillis(); // we might need to pass this in } } diff --git a/services/java/com/android/server/status/StatusBarService.java b/services/java/com/android/server/status/StatusBarService.java index 59e9832c18fe6..8dded1a8a6e84 100644 --- a/services/java/com/android/server/status/StatusBarService.java +++ b/services/java/com/android/server/status/StatusBarService.java @@ -950,7 +950,8 @@ public class StatusBarService extends IStatusBar.Stub panelSlightlyVisible(true); updateExpandedViewPos(EXPANDED_LEAVE_ALONE); - mExpandedDialog.show(); + mExpandedParams.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; + mExpandedDialog.getWindow().setAttributes(mExpandedParams); mExpandedView.requestFocus(View.FOCUS_FORWARD); mTrackingView.setVisibility(View.VISIBLE); @@ -1027,7 +1028,8 @@ public class StatusBarService extends IStatusBar.Stub } mExpandedVisible = false; panelSlightlyVisible(false); - mExpandedDialog.hide(); + mExpandedParams.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; + mExpandedDialog.getWindow().setAttributes(mExpandedParams); mTrackingView.setVisibility(View.GONE); if ((mDisabled & StatusBarManager.DISABLE_NOTIFICATION_ICONS) == 0) { @@ -1056,6 +1058,7 @@ public class StatusBarService extends IStatusBar.Stub else if (mAnimY < mStatusBarView.getHeight()) { if (SPEW) Log.d(TAG, "Animation completed to collapsed state."); mAnimating = false; + updateExpandedViewPos(0); performCollapse(); } else { @@ -1508,17 +1511,19 @@ public class StatusBarService extends IStatusBar.Stub } } + final int disph = mDisplay.getHeight(); lp = mExpandedDialog.getWindow().getAttributes(); lp.width = ViewGroup.LayoutParams.FILL_PARENT; lp.height = ViewGroup.LayoutParams.WRAP_CONTENT; lp.x = 0; - lp.y = 0; + mTrackingPosition = lp.y = -disph; // sufficiently large negative lp.type = WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL; lp.flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM - | WindowManager.LayoutParams.FLAG_DITHER; + | WindowManager.LayoutParams.FLAG_DITHER + | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; lp.format = pixelFormat; lp.gravity = Gravity.TOP | Gravity.FILL_HORIZONTAL; lp.setTitle("StatusBarExpanded"); @@ -1531,7 +1536,6 @@ public class StatusBarService extends IStatusBar.Stub new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); mExpandedDialog.show(); - mExpandedDialog.hide(); FrameLayout hack = (FrameLayout)mExpandedView.getParent(); hack.setForeground(null); } diff --git a/services/java/com/android/server/status/TrackingPatternView.java b/services/java/com/android/server/status/TrackingPatternView.java index 0ae9984cb348c..4cb8eff5043a7 100644 --- a/services/java/com/android/server/status/TrackingPatternView.java +++ b/services/java/com/android/server/status/TrackingPatternView.java @@ -55,8 +55,6 @@ public class TrackingPatternView extends View { final int textureWidth = mTextureWidth; final int textureHeight = mTextureHeight; - Log.d("TrackingPatternView", "width=" + width + " textureWidth=" + textureWidth); - int x = 0; int y;