diff options
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/service/dreams/DreamService.java | 28 | ||||
| -rw-r--r-- | core/java/android/service/wallpaper/WallpaperService.java | 23 | ||||
| -rw-r--r-- | core/java/android/view/IWindowManager.aidl | 3 | ||||
| -rw-r--r-- | core/java/android/view/TextureView.java | 23 | ||||
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 8 | ||||
| -rw-r--r-- | core/java/android/view/WindowManager.java | 45 | ||||
| -rw-r--r-- | core/java/android/view/WindowManagerPolicy.java | 19 |
7 files changed, 115 insertions, 34 deletions
diff --git a/core/java/android/service/dreams/DreamService.java b/core/java/android/service/dreams/DreamService.java index dd51764..cb78763 100644 --- a/core/java/android/service/dreams/DreamService.java +++ b/core/java/android/service/dreams/DreamService.java @@ -22,6 +22,7 @@ import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.app.Service; import android.content.Intent; +import android.graphics.PixelFormat; import android.graphics.drawable.ColorDrawable; import android.os.Handler; import android.os.IBinder; @@ -401,6 +402,9 @@ public class DreamService extends Service implements Window.Callback { * Sets View.SYSTEM_UI_FLAG_LOW_PROFILE on the content view. * * @param lowProfile True to set View.SYSTEM_UI_FLAG_LOW_PROFILE + * @hide There is no reason to have this -- dreams can set this flag + * on their own content view, and from there can actually do the + * correct interactions with it (seeing when it is cleared etc). */ public void setLowProfile(boolean lowProfile) { mLowProfile = lowProfile; @@ -412,20 +416,23 @@ public class DreamService extends Service implements Window.Callback { * Returns whether or not this dream is in low profile mode. Defaults to true. * * @see #setLowProfile(boolean) + * @hide */ public boolean isLowProfile() { return getSystemUiVisibilityFlagValue(View.SYSTEM_UI_FLAG_LOW_PROFILE, mLowProfile); } /** - * Sets View.SYSTEM_UI_FLAG_FULLSCREEN on the content view. + * Controls {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN} + * on the dream's window. * - * @param fullscreen True to set View.SYSTEM_UI_FLAG_FULLSCREEN + * @param fullscreen If true, the fullscreen flag will be set; else it + * will be cleared. */ public void setFullscreen(boolean fullscreen) { mFullscreen = fullscreen; - int flag = View.SYSTEM_UI_FLAG_FULLSCREEN; - applySystemUiVisibilityFlags(mFullscreen ? flag : 0, flag); + int flag = WindowManager.LayoutParams.FLAG_FULLSCREEN; + applyWindowFlags(mFullscreen ? flag : 0, flag); } /** @@ -434,7 +441,7 @@ public class DreamService extends Service implements Window.Callback { * @see #setFullscreen(boolean) */ public boolean isFullscreen() { - return getSystemUiVisibilityFlagValue(View.SYSTEM_UI_FLAG_FULLSCREEN, mFullscreen); + return mFullscreen; } /** @@ -565,6 +572,7 @@ public class DreamService extends Service implements Window.Callback { mWindow.setCallback(this); mWindow.requestFeature(Window.FEATURE_NO_TITLE); mWindow.setBackgroundDrawable(new ColorDrawable(0xFF000000)); + mWindow.setFormat(PixelFormat.OPAQUE); if (mDebug) Slog.v(TAG, String.format("Attaching window token: %s to window of type %s", windowToken, WindowManager.LayoutParams.TYPE_DREAM)); @@ -573,9 +581,12 @@ public class DreamService extends Service implements Window.Callback { lp.type = WindowManager.LayoutParams.TYPE_DREAM; lp.token = windowToken; lp.windowAnimations = com.android.internal.R.style.Animation_Dream; - lp.flags |= ( WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED + lp.flags |= ( WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN + | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR + | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON + | (mFullscreen ? WindowManager.LayoutParams.FLAG_FULLSCREEN : 0) | (mScreenBright ? WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON : 0) ); mWindow.setAttributes(lp); @@ -588,9 +599,8 @@ public class DreamService extends Service implements Window.Callback { if (mDebug) Slog.v(TAG, "Window added on thread " + Thread.currentThread().getId()); try { applySystemUiVisibilityFlags( - (mLowProfile ? View.SYSTEM_UI_FLAG_LOW_PROFILE : 0) - | (mFullscreen ? View.SYSTEM_UI_FLAG_FULLSCREEN : 0), - View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN); + (mLowProfile ? View.SYSTEM_UI_FLAG_LOW_PROFILE : 0), + View.SYSTEM_UI_FLAG_LOW_PROFILE); getWindowManager().addView(mWindow.getDecorView(), mWindow.getAttributes()); } catch (Throwable t) { Slog.w("Crashed adding window view", t); diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java index 86bbc55..6d5705d 100644 --- a/core/java/android/service/wallpaper/WallpaperService.java +++ b/core/java/android/service/wallpaper/WallpaperService.java @@ -574,7 +574,8 @@ public abstract class WallpaperService extends Service { final boolean flagsChanged = mCurWindowFlags != mWindowFlags || mCurWindowPrivateFlags != mWindowPrivateFlags; if (forceRelayout || creating || surfaceCreating || formatChanged || sizeChanged - || typeChanged || flagsChanged || redrawNeeded) { + || typeChanged || flagsChanged || redrawNeeded + || !mIWallpaperEngine.mShownReported) { if (DEBUG) Log.v(TAG, "Changes: creating=" + creating + " format=" + formatChanged + " size=" + sizeChanged); @@ -739,6 +740,7 @@ public abstract class WallpaperService extends Service { if (redrawNeeded) { mSession.finishDrawing(mWindow); } + mIWallpaperEngine.reportShown(); } } catch (RemoteException ex) { } @@ -950,6 +952,7 @@ public abstract class WallpaperService extends Service { final IBinder mWindowToken; final int mWindowType; final boolean mIsPreview; + boolean mShownReported; int mReqWidth; int mReqHeight; @@ -1002,6 +1005,18 @@ public abstract class WallpaperService extends Service { } } + public void reportShown() { + if (!mShownReported) { + mShownReported = true; + try { + mConnection.engineShown(this); + } catch (RemoteException e) { + Log.w(TAG, "Wallpaper host disappeared", e); + return; + } + } + } + public void destroy() { Message msg = mCaller.obtainMessage(DO_DETACH); mCaller.sendMessage(msg); @@ -1020,12 +1035,6 @@ public abstract class WallpaperService extends Service { mEngine = engine; mActiveEngines.add(engine); engine.attach(this); - try { - mConnection.engineShown(this); - } catch (RemoteException e) { - Log.w(TAG, "Wallpaper host disappeared", e); - return; - } return; } case DO_DETACH: { diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl index f7ba38c..e3250f9 100644 --- a/core/java/android/view/IWindowManager.aidl +++ b/core/java/android/view/IWindowManager.aidl @@ -201,8 +201,9 @@ interface IWindowManager /** * Block until the given window has been drawn to the screen. + * Returns true if really waiting, false if the window does not exist. */ - void waitForWindowDrawn(IBinder token, in IRemoteCallback callback); + boolean waitForWindowDrawn(IBinder token, in IRemoteCallback callback); /** * Device has a software navigation bar (separate from the status bar). diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java index 876b7d84..a9b6e09 100644 --- a/core/java/android/view/TextureView.java +++ b/core/java/android/view/TextureView.java @@ -189,7 +189,7 @@ public class TextureView extends View { if (opaque != mOpaque) { mOpaque = opaque; if (mLayer != null) { - updateLayer(); + updateLayerAndInvalidate(); } } } @@ -310,6 +310,7 @@ public class TextureView extends View { super.onSizeChanged(w, h, oldw, oldh); if (mSurface != null) { nSetDefaultBufferSize(mSurface, getWidth(), getHeight()); + updateLayer(); if (mListener != null) { mListener.onSurfaceTextureSizeChanged(mSurface, getWidth(), getHeight()); } @@ -352,9 +353,7 @@ public class TextureView extends View { public void onFrameAvailable(SurfaceTexture surfaceTexture) { // Per SurfaceTexture's documentation, the callback may be invoked // from an arbitrary thread - synchronized (mLock) { - mUpdateLayer = true; - } + updateLayer(); if (Looper.myLooper() == Looper.getMainLooper()) { invalidate(); @@ -379,9 +378,7 @@ public class TextureView extends View { // Since we are updating the layer, force an update to ensure its // parameters are correct (width, height, transform, etc.) - synchronized (mLock) { - mUpdateLayer = true; - } + updateLayer(); mMatrixChanged = true; mAttachInfo.mHardwareRenderer.setSurfaceTexture(mLayer, mSurface); @@ -404,7 +401,7 @@ public class TextureView extends View { // updates listener if (visibility == VISIBLE) { mSurface.setOnFrameAvailableListener(mUpdateListener); - updateLayer(); + updateLayerAndInvalidate(); } else { mSurface.setOnFrameAvailableListener(null); } @@ -412,7 +409,15 @@ public class TextureView extends View { } private void updateLayer() { - mUpdateLayer = true; + synchronized (mLock) { + mUpdateLayer = true; + } + } + + private void updateLayerAndInvalidate() { + synchronized (mLock) { + mUpdateLayer = true; + } invalidate(); } diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index be2d5b3..0475283 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -2322,7 +2322,13 @@ public final class ViewRootImpl implements ViewParent, mAccessibilityFocusedHost.getDrawingRect(bounds); if (mView instanceof ViewGroup) { ViewGroup viewGroup = (ViewGroup) mView; - viewGroup.offsetDescendantRectToMyCoords(mAccessibilityFocusedHost, bounds); + try { + viewGroup.offsetDescendantRectToMyCoords(mAccessibilityFocusedHost, bounds); + } catch (IllegalArgumentException iae) { + Log.e(TAG, "Temporary detached view that was neither removed not reattached: " + + mAccessibilityFocusedHost); + return; + } } } else { if (mAccessibilityFocusedVirtualView == null) { diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 6e51270..eb3f72e 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -298,12 +298,14 @@ public interface WindowManager extends ViewManager { * Window type: the status bar. There can be only one status bar * window; it is placed at the top of the screen, and all other * windows are shifted down so they are below it. + * In multiuser systems shows on all users' windows. */ public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW; /** * Window type: the search bar. There can be only one search bar * window; it is placed at the top of the screen. + * In multiuser systems shows on all users' windows. */ public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1; @@ -312,22 +314,26 @@ public interface WindowManager extends ViewManager { * user interaction with the phone (in particular incoming calls). * These windows are normally placed above all applications, but behind * the status bar. + * In multiuser systems shows on all users' windows. */ public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2; /** * Window type: system window, such as low power alert. These windows * are always on top of application windows. + * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3; /** * Window type: keyguard window. + * In multiuser systems shows on all users' windows. */ public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4; /** * Window type: transient notifications. + * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5; @@ -335,6 +341,7 @@ public interface WindowManager extends ViewManager { * Window type: system overlay windows, which need to be displayed * on top of everything else. These windows must not take input * focus, or they will interfere with the keyguard. + * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6; @@ -342,22 +349,26 @@ public interface WindowManager extends ViewManager { * Window type: priority phone UI, which needs to be displayed even if * the keyguard is active. These windows must not take input * focus, or they will interfere with the keyguard. + * In multiuser systems shows on all users' windows. */ public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7; /** * Window type: panel that slides out from the status bar + * In multiuser systems shows on all users' windows. */ public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8; /** * Window type: dialogs that the keyguard shows + * In multiuser systems shows on all users' windows. */ public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9; /** * Window type: internal system error windows, appear on top of * everything they can. + * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10; @@ -365,23 +376,27 @@ public interface WindowManager extends ViewManager { * Window type: internal input methods windows, which appear above * the normal UI. Application windows may be resized or panned to keep * the input focus visible while this window is displayed. + * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11; /** * Window type: internal input methods dialog windows, which appear above * the current input method window. + * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12; /** * Window type: wallpaper window, placed behind any window that wants * to sit on top of the wallpaper. + * In multiuser systems shows only on the owning user's window. */ public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13; /** * Window type: panel that slides out from over the status bar + * In multiuser systems shows on all users' windows. */ public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14; @@ -393,6 +408,8 @@ public interface WindowManager extends ViewManager { * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the * system itself is allowed to create these overlays. Applications cannot * obtain permission to create secure system overlays. + * + * In multiuser systems shows only on the owning user's window. * @hide */ public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15; @@ -400,24 +417,28 @@ public interface WindowManager extends ViewManager { /** * Window type: the drag-and-drop pseudowindow. There is only one * drag layer (at most), and it is placed on top of all other windows. + * In multiuser systems shows only on the owning user's window. * @hide */ public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16; /** * Window type: panel that slides out from under the status bar + * In multiuser systems shows on all users' windows. * @hide */ public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17; /** * Window type: (mouse) pointer + * In multiuser systems shows on all users' windows. * @hide */ public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18; /** * Window type: Navigation bar (when distinct from status bar) + * In multiuser systems shows on all users' windows. * @hide */ public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19; @@ -425,6 +446,7 @@ public interface WindowManager extends ViewManager { /** * Window type: The volume level overlay/dialog shown when the user * changes the system volume. + * In multiuser systems shows on all users' windows. * @hide */ public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20; @@ -432,6 +454,7 @@ public interface WindowManager extends ViewManager { /** * Window type: The boot progress dialog, goes on top of everything * in the world. + * In multiuser systems shows on all users' windows. * @hide */ public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21; @@ -439,30 +462,35 @@ public interface WindowManager extends ViewManager { /** * Window type: Fake window to consume touch events when the navigation * bar is hidden. + * In multiuser systems shows on all users' windows. * @hide */ public static final int TYPE_HIDDEN_NAV_CONSUMER = FIRST_SYSTEM_WINDOW+22; /** * Window type: Dreams (screen saver) window, just above keyguard. + * In multiuser systems shows only on the owning user's window. * @hide */ public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23; /** * Window type: Navigation bar panel (when navigation bar is distinct from status bar) + * In multiuser systems shows on all users' windows. * @hide */ public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24; /** * Window type: Behind the universe of the real windows. + * In multiuser systems shows on all users' windows. * @hide */ public static final int TYPE_UNIVERSE_BACKGROUND = FIRST_SYSTEM_WINDOW+25; /** * Window type: Display overlay window. Used to simulate secondary display devices. + * In multiuser systems shows on all users' windows. * @hide */ public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26; @@ -470,11 +498,20 @@ public interface WindowManager extends ViewManager { /** * Window type: Magnification overlay window. Used to highlight the magnified * portion of a display when accessibility magnification is enabled. + * In multiuser systems shows on all users' windows. * @hide */ public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27; /** + * Window type: Recents. Same layer as {@link #TYPE_SYSTEM_DIALOG} but only appears on + * one user's screen. + * In multiuser systems shows on all users' windows. + * @hide + */ + public static final int TYPE_RECENTS_OVERLAY = FIRST_SYSTEM_WINDOW+28; + + /** * End of types of system windows. */ public static final int LAST_SYSTEM_WINDOW = 2999; @@ -879,6 +916,14 @@ public interface WindowManager extends ViewManager { */ public static final int PRIVATE_FLAG_SET_NEEDS_MENU_KEY = 0x00000008; + /** In a multiuser system if this flag is set and the owner is a system process then this + * window will appear on all user screens. This overrides the default behavior of window + * types that normally only appear on the owning user's screen. Refer to each window type + * to determine its default behavior. + * + * {@hide} */ + public static final int PRIVATE_FLAG_SHOW_FOR_ALL_USERS = 0x00000010; + /** * Control flags that are private to the platform. * @hide diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index 04b5e11..4ccb502 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -501,6 +501,16 @@ public interface WindowManagerPolicy { public int checkAddPermission(WindowManager.LayoutParams attrs); /** + * Check permissions when adding a window. + * + * @param attrs The window's LayoutParams. + * + * @return True if the window may only be shown to the current user, false if the window can + * be shown on all users' windows. + */ + public boolean checkShowToOwnerOnly(WindowManager.LayoutParams attrs); + + /** * Sanitize the layout parameters coming from a client. Allows the policy * to do things like ensure that windows of a specific type can't take * input focus. @@ -1058,18 +1068,13 @@ public interface WindowManagerPolicy { * Called when we have started keeping the screen on because a window * requesting this has become visible. */ - public void screenOnStartedLw(); + public void keepScreenOnStartedLw(); /** * Called when we have stopped keeping the screen on because the last window * requesting this is no longer visible. */ - public void screenOnStoppedLw(); - - /** - * Return false to disable key repeat events from being generated. - */ - public boolean allowKeyRepeat(); + public void keepScreenOnStoppedLw(); /** * Inform the policy that the user has chosen a preferred orientation ("rotation lock"). |
