diff options
Diffstat (limited to 'services')
8 files changed, 62 insertions, 25 deletions
diff --git a/services/audioflinger/AudioResampler.cpp b/services/audioflinger/AudioResampler.cpp index 5c3b43fc..dca795c 100644 --- a/services/audioflinger/AudioResampler.cpp +++ b/services/audioflinger/AudioResampler.cpp @@ -26,11 +26,15 @@ #include "AudioResamplerSinc.h" #include "AudioResamplerCubic.h" +#ifdef __arm__ +#include <machine/cpu-features.h> +#endif + namespace android { -#ifdef __ARM_ARCH_5E__ // optimized asm option +#ifdef __ARM_HAVE_HALFWORD_MULTIPLY // optimized asm option #define ASM_ARM_RESAMP1 // enable asm optimisation for ResamplerOrder1 -#endif // __ARM_ARCH_5E__ +#endif // __ARM_HAVE_HALFWORD_MULTIPLY // ---------------------------------------------------------------------------- class AudioResamplerOrder1 : public AudioResampler { diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index d77ab60..56b6c54 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -532,18 +532,8 @@ public class ConnectivityService extends IConnectivityManager.Stub { */ public NetworkInfo getActiveNetworkInfo() { enforceAccessPermission(); - for (int type=0; type <= ConnectivityManager.MAX_NETWORK_TYPE; type++) { - if (mNetConfigs[type] == null || !mNetConfigs[type].isDefault()) { - continue; - } - NetworkStateTracker t = mNetTrackers[type]; - NetworkInfo info = t.getNetworkInfo(); - if (info.isConnected()) { - if (DBG && type != mActiveDefaultNetwork) { - loge("connected default network is not mActiveDefaultNetwork!"); - } - return info; - } + if (mActiveDefaultNetwork != -1) { + return mNetTrackers[mActiveDefaultNetwork].getNetworkInfo(); } return null; } @@ -1311,6 +1301,7 @@ public class ConnectivityService extends IConnectivityManager.Stub { } if (!teardown(otherNet)) { loge("Network declined teardown request"); + teardown(thisNet); return; } } @@ -1360,6 +1351,19 @@ public class ConnectivityService extends IConnectivityManager.Stub { handleApplyDefaultProxy(netType); addDefaultRoute(mNetTrackers[netType]); } else { + // many radios add a default route even when we don't want one. + // remove the default interface unless we need it for our active network + if (mActiveDefaultNetwork != -1) { + LinkProperties linkProperties = + mNetTrackers[mActiveDefaultNetwork].getLinkProperties(); + LinkProperties newLinkProperties = + mNetTrackers[netType].getLinkProperties(); + String defaultIface = linkProperties.getInterfaceName(); + if (defaultIface != null && + !defaultIface.equals(newLinkProperties.getInterfaceName())) { + removeDefaultRoute(mNetTrackers[netType]); + } + } addPrivateDnsRoutes(mNetTrackers[netType]); } } else { diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java index a91b690..a528aa3 100644 --- a/services/java/com/android/server/MountService.java +++ b/services/java/com/android/server/MountService.java @@ -1536,7 +1536,8 @@ class MountService extends IMountService.Stub implements INativeDaemonConnectorC } catch (NativeDaemonConnectorException e) { int code = e.getCode(); if (code == VoldResponseCode.OpFailedStorageNotFound) { - throw new IllegalArgumentException(String.format("Container '%s' not found", id)); + Slog.i(TAG, String.format("Container '%s' not found", id)); + return null; } else { throw new IllegalStateException(String.format("Unexpected response code %d", code)); } diff --git a/services/java/com/android/server/VibratorService.java b/services/java/com/android/server/VibratorService.java index 2fcdb5d..c39dc80 100755 --- a/services/java/com/android/server/VibratorService.java +++ b/services/java/com/android/server/VibratorService.java @@ -247,6 +247,7 @@ public class VibratorService extends IVibratorService.Stub { // Lock held on mVibrations private void startNextVibrationLocked() { if (mVibrations.size() <= 0) { + mCurrentVibration = null; return; } mCurrentVibration = mVibrations.getFirst(); @@ -273,17 +274,27 @@ public class VibratorService extends IVibratorService.Stub { Vibration vib = iter.next(); if (vib.mToken == token) { iter.remove(); + unlinkVibration(vib); return vib; } } // We might be looking for a simple vibration which is only stored in // mCurrentVibration. if (mCurrentVibration != null && mCurrentVibration.mToken == token) { + unlinkVibration(mCurrentVibration); return mCurrentVibration; } return null; } + private void unlinkVibration(Vibration vib) { + if (vib.mPattern != null) { + // If Vibration object has a pattern, + // the Vibration object has also been linkedToDeath. + vib.mToken.unlinkToDeath(vib, 0); + } + } + private class VibrateThread extends Thread { final Vibration mVibration; boolean mDone; @@ -360,6 +371,7 @@ public class VibratorService extends IVibratorService.Stub { // If this vibration finished naturally, start the next // vibration. mVibrations.remove(mVibration); + unlinkVibration(mVibration); startNextVibrationLocked(); } } diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 54cc885..01ae522 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -6995,8 +6995,9 @@ public final class ActivityManagerService extends ActivityManagerNative addErrorToDropBox("wtf", r, null, null, tag, null, null, crashInfo); - if (Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.WTF_IS_FATAL, 0) != 0) { + if (r != null && r.pid != Process.myPid() && + Settings.Secure.getInt(mContext.getContentResolver(), + Settings.Secure.WTF_IS_FATAL, 0) != 0) { crashApplication(r, crashInfo); return true; } else { @@ -7036,18 +7037,25 @@ public final class ActivityManagerService extends ActivityManagerNative * to append various headers to the dropbox log text. */ private void appendDropBoxProcessHeaders(ProcessRecord process, StringBuilder sb) { + // Watchdog thread ends up invoking this function (with + // a null ProcessRecord) to add the stack file to dropbox. + // Do not acquire a lock on this (am) in such cases, as it + // could cause a potential deadlock, if and when watchdog + // is invoked due to unavailability of lock on am and it + // would prevent watchdog from killing system_server. + if (process == null) { + sb.append("Process: system_server\n"); + return; + } // Note: ProcessRecord 'process' is guarded by the service // instance. (notably process.pkgList, which could otherwise change // concurrently during execution of this method) synchronized (this) { - if (process == null || process.pid == MY_PID) { + if (process.pid == MY_PID) { sb.append("Process: system_server\n"); } else { sb.append("Process: ").append(process.processName).append("\n"); } - if (process == null) { - return; - } int flags = process.info.flags; IPackageManager pm = AppGlobals.getPackageManager(); sb.append("Flags: 0x").append(Integer.toString(flags, 16)).append("\n"); diff --git a/services/java/com/android/server/location/GpsLocationProvider.java b/services/java/com/android/server/location/GpsLocationProvider.java index 3561862..63ce0bd 100755 --- a/services/java/com/android/server/location/GpsLocationProvider.java +++ b/services/java/com/android/server/location/GpsLocationProvider.java @@ -203,7 +203,7 @@ public class GpsLocationProvider implements LocationProviderInterface { // flags to trigger NTP or XTRA data download when network becomes available // initialized to true so we do NTP and XTRA when the network comes up after booting private boolean mInjectNtpTimePending = true; - private boolean mDownloadXtraDataPending = false; + private boolean mDownloadXtraDataPending = true; // true if GPS is navigating private boolean mNavigating; diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 517c335..99d904d 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -984,8 +984,16 @@ status_t Layer::BufferManager::initEglImage(EGLDisplay dpy, ssize_t index = mActiveBufferIndex; if (index >= 0) { if (!mFailover) { - Image& texture(mBufferData[index].texture); - err = mTextureManager.initEglImage(&texture, dpy, buffer); + { + // Without that lock, there is a chance of race condition + // where while composing a specific index, requestBuf + // with the same index can be executed and touch the same data + // that is being used in initEglImage. + // (e.g. dirty flag in texture) + Mutex::Autolock _l(mLock); + Image& texture(mBufferData[index].texture); + err = mTextureManager.initEglImage(&texture, dpy, buffer); + } // if EGLImage fails, we switch to regular texture mode, and we // free all resources associated with using EGLImages. if (err == NO_ERROR) { diff --git a/services/surfaceflinger/TextureManager.cpp b/services/surfaceflinger/TextureManager.cpp index c9a15f5..9e24f90 100644 --- a/services/surfaceflinger/TextureManager.cpp +++ b/services/surfaceflinger/TextureManager.cpp @@ -186,7 +186,7 @@ status_t TextureManager::loadTexture(Texture* texture, if (texture->name == -1UL) { status_t err = initTexture(texture); LOGE_IF(err, "loadTexture failed in initTexture (%s)", strerror(err)); - return err; + if (err != NO_ERROR) return err; } if (texture->target != Texture::TEXTURE_2D) |