diff options
Diffstat (limited to 'services')
4 files changed, 48 insertions, 17 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index 133dabd..ce701ca 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -1973,11 +1973,14 @@ bool AudioFlinger::MixerThread::threadLoop() if (LIKELY(mixerStatus == MIXER_TRACKS_READY)) { // mix buffers... mAudioMixer->process(); - sleepTime = 0; - // increase sleep time progressively when application underrun condition clears - if (sleepTimeShift > 0) { + // increase sleep time progressively when application underrun condition clears. + // Only increase sleep time if the mixer is ready for two consecutive times to avoid + // that a steady state of alternating ready/not ready conditions keeps the sleep time + // such that we would underrun the audio HAL. + if ((sleepTime == 0) && (sleepTimeShift > 0)) { sleepTimeShift--; } + sleepTime = 0; standbyTime = systemTime() + kStandbyTimeInNsecs; //TODO: delay standby when effects have a tail } else { diff --git a/services/java/com/android/server/connectivity/Tethering.java b/services/java/com/android/server/connectivity/Tethering.java index c344bc6..ed7324c 100644 --- a/services/java/com/android/server/connectivity/Tethering.java +++ b/services/java/com/android/server/connectivity/Tethering.java @@ -118,7 +118,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub { "192.168.48.2", "192.168.48.254", }; - private String[] mDnsServers; + private String[] mDefaultDnsServers; private static final String DNS_DEFAULT_SERVER1 = "8.8.8.8"; private static final String DNS_DEFAULT_SERVER2 = "8.8.4.4"; @@ -171,9 +171,9 @@ public class Tethering extends INetworkManagementEventObserver.Stub { updateConfiguration(); // TODO - remove and rely on real notifications of the current iface - mDnsServers = new String[2]; - mDnsServers[0] = DNS_DEFAULT_SERVER1; - mDnsServers[1] = DNS_DEFAULT_SERVER2; + mDefaultDnsServers = new String[2]; + mDefaultDnsServers[0] = DNS_DEFAULT_SERVER1; + mDefaultDnsServers[1] = DNS_DEFAULT_SERVER2; } void updateConfiguration() { @@ -1245,7 +1245,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub { } } try { - mNMService.setDnsForwarders(mDnsServers); + mNMService.setDnsForwarders(mDefaultDnsServers); } catch (Exception e) { transitionTo(mSetDnsForwardersErrorState); return false; @@ -1321,7 +1321,19 @@ public class Tethering extends INetworkManagementEventObserver.Stub { try { linkProperties = mConnService.getLinkProperties(upType); } catch (RemoteException e) { } - if (linkProperties != null) iface = linkProperties.getInterfaceName(); + if (linkProperties != null) { + iface = linkProperties.getInterfaceName(); + String[] dnsServers = mDefaultDnsServers; + Collection<InetAddress> dnses = linkProperties.getDnses(); + if (dnses != null) { + dnsServers = NetworkUtils.makeStrings(dnses); + } + try { + mNMService.setDnsForwarders(dnsServers); + } catch (Exception e) { + transitionTo(mSetDnsForwardersErrorState); + } + } } notifyTetheredOfNewUpstreamIface(iface); } diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index e8c0516..bd33e0c 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -728,7 +728,7 @@ public class WindowManagerService extends IWindowManager.Stub //Looper.myLooper().setMessageLogging(new LogPrinter( // Log.VERBOSE, "WindowManagerPolicy", Log.LOG_ID_SYSTEM)); android.os.Process.setThreadPriority( - android.os.Process.THREAD_PRIORITY_DISPLAY); + android.os.Process.THREAD_PRIORITY_FOREGROUND); android.os.Process.setCanSelfBackground(false); mPolicy.init(mContext, mService, mService, mPM); @@ -2538,8 +2538,12 @@ public class WindowManagerService extends IWindowManager.Stub if (win == null) { return 0; } - win.mRequestedWidth = requestedWidth; - win.mRequestedHeight = requestedHeight; + if (win.mRequestedWidth != requestedWidth + || win.mRequestedHeight != requestedHeight) { + win.mLayoutNeeded = true; + win.mRequestedWidth = requestedWidth; + win.mRequestedHeight = requestedHeight; + } if (attrs != null && seq == win.mSeq) { win.mSystemUiVisibility = systemUiVisibility; } @@ -2560,6 +2564,9 @@ public class WindowManagerService extends IWindowManager.Stub } flagChanges = win.mAttrs.flags ^= attrs.flags; attrChanges = win.mAttrs.copyFrom(attrs); + if ((attrChanges&WindowManager.LayoutParams.LAYOUT_CHANGED) != 0) { + win.mLayoutNeeded = true; + } } if (DEBUG_LAYOUT) Slog.v(TAG, "Relayout " + win + ": " + win.mAttrs); @@ -7438,12 +7445,13 @@ public class WindowManagerService extends IWindowManager.Stub // if they want. (We do the normal layout for INVISIBLE // windows, since that means "perform layout as normal, // just don't display"). - if (!gone || !win.mHaveFrame) { + if (!gone || !win.mHaveFrame || win.mLayoutNeeded) { if (!win.mLayoutAttached) { if (initial) { //Slog.i(TAG, "Window " + this + " clearing mContentChanged - initial"); win.mContentChanged = false; } + win.mLayoutNeeded = false; win.prelayout(); mPolicy.layoutWindowLw(win, win.mAttrs, null); win.mLayoutSeq = seq; @@ -7475,11 +7483,12 @@ public class WindowManagerService extends IWindowManager.Stub // windows, since that means "perform layout as normal, // just don't display"). if ((win.mViewVisibility != View.GONE && win.mRelayoutCalled) - || !win.mHaveFrame) { + || !win.mHaveFrame || win.mLayoutNeeded) { if (initial) { //Slog.i(TAG, "Window " + this + " clearing mContentChanged - initial"); win.mContentChanged = false; } + win.mLayoutNeeded = false; win.prelayout(); mPolicy.layoutWindowLw(win, win.mAttrs, win.mAttachedWindow); win.mLayoutSeq = seq; diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java index 9118381..1067cad 100644 --- a/services/java/com/android/server/wm/WindowState.java +++ b/services/java/com/android/server/wm/WindowState.java @@ -238,6 +238,12 @@ final class WindowState implements WindowManagerPolicy.WindowState { // we can give the window focus before waiting for the relayout. boolean mRelayoutCalled; + // If the application has called relayout() with changes that can + // impact its window's size, we need to perform a layout pass on it + // even if it is not currently visible for layout. This is set + // when in that case until the layout is done. + boolean mLayoutNeeded; + // This is set after the Surface has been created but before the // window has been drawn. During this time the surface is hidden. boolean mDrawPending; @@ -1449,7 +1455,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { return mViewVisibility == View.GONE || !mRelayoutCalled || (atoken == null && mRootToken.hidden) - || (atoken != null && atoken.hiddenRequested) + || (atoken != null && (atoken.hiddenRequested || atoken.hidden)) || mAttachedHidden || mExiting || mDestroying; } @@ -1728,8 +1734,9 @@ final class WindowState implements WindowManagerPolicy.WindowState { pw.print(mPolicyVisibilityAfterAnim); pw.print(" mAttachedHidden="); pw.println(mAttachedHidden); } - if (!mRelayoutCalled) { - pw.print(prefix); pw.print("mRelayoutCalled="); pw.println(mRelayoutCalled); + if (!mRelayoutCalled || mLayoutNeeded) { + pw.print(prefix); pw.print("mRelayoutCalled="); pw.print(mRelayoutCalled); + pw.print(" mLayoutNeeded="); pw.println(mLayoutNeeded); } if (mSurfaceResized || mSurfaceDestroyDeferred) { pw.print(prefix); pw.print("mSurfaceResized="); pw.print(mSurfaceResized); |