diff options
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/MediaRouteActionProvider.java | 11 | ||||
| -rw-r--r-- | core/java/android/app/MediaRouteButton.java | 7 | ||||
| -rw-r--r-- | core/java/android/content/pm/IPackageManager.aidl | 3 | ||||
| -rw-r--r-- | core/java/android/text/Layout.java | 1 | ||||
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 25 |
5 files changed, 42 insertions, 5 deletions
diff --git a/core/java/android/app/MediaRouteActionProvider.java b/core/java/android/app/MediaRouteActionProvider.java index 7764ac6..5fe08ec 100644 --- a/core/java/android/app/MediaRouteActionProvider.java +++ b/core/java/android/app/MediaRouteActionProvider.java @@ -33,11 +33,12 @@ public class MediaRouteActionProvider extends ActionProvider { private MediaRouteButton mView; private int mRouteTypes; private final RouterCallback mRouterCallback = new RouterCallback(); + private View.OnClickListener mExtendedSettingsListener; public MediaRouteActionProvider(Context context) { super(context); mContext = context; - mRouter = (MediaRouter)context.getSystemService(Context.MEDIA_ROUTER_SERVICE); + mRouter = (MediaRouter) context.getSystemService(Context.MEDIA_ROUTER_SERVICE); // Start with live audio by default. // TODO Update this when new route types are added; segment by API level @@ -76,6 +77,7 @@ public class MediaRouteActionProvider extends ActionProvider { mView = new MediaRouteButton(mContext); mMenuItem.setVisible(mRouter.getRouteCount() > 1); mView.setRouteTypes(mRouteTypes); + mView.setExtendedSettingsClickListener(mExtendedSettingsListener); return mView; } @@ -85,6 +87,13 @@ public class MediaRouteActionProvider extends ActionProvider { return true; } + public void setExtendedSettingsClickListener(View.OnClickListener listener) { + mExtendedSettingsListener = listener; + if (mView != null) { + mView.setExtendedSettingsClickListener(listener); + } + } + private class RouterCallback extends MediaRouter.SimpleCallback { @Override public void onRouteAdded(MediaRouter router, RouteInfo info) { diff --git a/core/java/android/app/MediaRouteButton.java b/core/java/android/app/MediaRouteButton.java index 8f9379a..385241c 100644 --- a/core/java/android/app/MediaRouteButton.java +++ b/core/java/android/app/MediaRouteButton.java @@ -43,6 +43,8 @@ public class MediaRouteButton extends View { private int mMinWidth; private int mMinHeight; + private OnClickListener mExtendedSettingsClickListener; + private static final int[] ACTIVATED_STATE_SET = { R.attr.state_activated }; @@ -260,6 +262,11 @@ public class MediaRouteButton extends View { mRemoteIndicator.draw(canvas); } + public void setExtendedSettingsClickListener(OnClickListener listener) { + // TODO: if dialog is already open, propagate so that it updates live. + mExtendedSettingsClickListener = listener; + } + private class MediaRouteCallback extends MediaRouter.SimpleCallback { @Override public void onRouteSelected(MediaRouter router, int type, RouteInfo info) { diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl index 70c0c48..90b4247 100644 --- a/core/java/android/content/pm/IPackageManager.aidl +++ b/core/java/android/content/pm/IPackageManager.aidl @@ -376,4 +376,7 @@ interface IPackageManager { void setPermissionEnforced(String permission, boolean enforced); boolean isPermissionEnforced(String permission); + + /** Reflects current DeviceStorageMonitorService state */ + boolean isStorageLow(); } diff --git a/core/java/android/text/Layout.java b/core/java/android/text/Layout.java index c453a5d..12f16fd 100644 --- a/core/java/android/text/Layout.java +++ b/core/java/android/text/Layout.java @@ -456,6 +456,7 @@ public abstract class Layout { final int top = Math.max(dtop, 0); final int bottom = Math.min(getLineTop(getLineCount()), dbottom); + if (top >= bottom) return TextUtils.packRangeInLong(0, -1); return TextUtils.packRangeInLong(getLineForVertical(top), getLineForVertical(bottom)); } diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 7eeb6d0..cdc51d1 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -229,6 +229,7 @@ public final class ViewRootImpl implements ViewParent, boolean mWindowsAnimating; boolean mIsDrawing; int mLastSystemUiVisibility; + int mClientWindowLayoutFlags; // Pool of queued input events. private static final int MAX_QUEUED_INPUT_EVENT_POOL_SIZE = 10; @@ -485,6 +486,8 @@ public final class ViewRootImpl implements ViewParent, mFallbackEventHandler.setView(view); mWindowAttributes.copyFrom(attrs); attrs = mWindowAttributes; + // Keep track of the actual window flags supplied by the client. + mClientWindowLayoutFlags = attrs.flags; setAccessibilityFocusedHost(null); @@ -760,6 +763,8 @@ public final class ViewRootImpl implements ViewParent, void setLayoutParams(WindowManager.LayoutParams attrs, boolean newView) { synchronized (this) { int oldSoftInputMode = mWindowAttributes.softInputMode; + // Keep track of the actual window flags supplied by the client. + mClientWindowLayoutFlags = attrs.flags; // preserve compatible window flag if exists. int compatibleWindowFlag = mWindowAttributes.flags & WindowManager.LayoutParams.FLAG_COMPATIBLE_WINDOW; @@ -768,7 +773,9 @@ public final class ViewRootImpl implements ViewParent, attrs.subtreeSystemUiVisibility = mWindowAttributes.subtreeSystemUiVisibility; mWindowAttributesChangesFlag = mWindowAttributes.copyFrom(attrs); mWindowAttributes.flags |= compatibleWindowFlag; - + + applyKeepScreenOnFlag(mWindowAttributes); + if (newView) { mSoftInputMode = attrs.softInputMode; requestLayout(); @@ -1000,6 +1007,18 @@ public final class ViewRootImpl implements ViewParent, } } + private void applyKeepScreenOnFlag(WindowManager.LayoutParams params) { + // Update window's global keep screen on flag: if a view has requested + // that the screen be kept on, then it is always set; otherwise, it is + // set to whatever the client last requested for the global state. + if (mAttachInfo.mKeepScreenOn) { + params.flags |= WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + } else { + params.flags = (params.flags&~WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) + | (mClientWindowLayoutFlags&WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } + } + private boolean collectViewAttributes() { final View.AttachInfo attachInfo = mAttachInfo; if (attachInfo.mRecomputeGlobalAttributes) { @@ -1017,9 +1036,7 @@ public final class ViewRootImpl implements ViewParent, || attachInfo.mSystemUiVisibility != oldVis || attachInfo.mHasSystemUiListeners != oldHasSystemUiListeners) { WindowManager.LayoutParams params = mWindowAttributes; - if (attachInfo.mKeepScreenOn) { - params.flags |= WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; - } + applyKeepScreenOnFlag(params); params.subtreeSystemUiVisibility = attachInfo.mSystemUiVisibility; params.hasSystemUiListeners = attachInfo.mHasSystemUiListeners; mView.dispatchWindowSystemUiVisiblityChanged(attachInfo.mSystemUiVisibility); |
