Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.server.wm; |
| 18 | |
Jorim Jaggi | f12ec0f | 2017-08-23 16:14:10 +0200 | [diff] [blame] | 19 | import static android.Manifest.permission.DEVICE_POWER; |
Wale Ogunwale | 01ad434 | 2017-06-30 07:07:01 -0700 | [diff] [blame] | 20 | import static android.Manifest.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS; |
Wale Ogunwale | 943002b | 2017-02-15 19:34:01 -0800 | [diff] [blame] | 21 | import static android.Manifest.permission.INTERNAL_SYSTEM_WINDOW; |
| 22 | import static android.content.pm.PackageManager.PERMISSION_GRANTED; |
Wale Ogunwale | 4958ad2 | 2017-06-22 09:08:14 -0700 | [diff] [blame] | 23 | import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; |
Wale Ogunwale | d993a57 | 2017-02-05 13:52:09 -0800 | [diff] [blame] | 24 | import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; |
Wale Ogunwale | 943002b | 2017-02-15 19:34:01 -0800 | [diff] [blame] | 25 | import static android.view.WindowManager.LayoutParams.isSystemAlertWindowType; |
Adrian Roos | 5c6b622 | 2017-11-07 17:36:10 +0100 | [diff] [blame] | 26 | |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 27 | import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_TASK_POSITIONING; |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 28 | import static com.android.server.wm.WindowManagerDebugConfig.SHOW_TRANSACTIONS; |
| 29 | import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 30 | |
| 31 | import android.content.ClipData; |
| 32 | import android.content.Context; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 33 | import android.graphics.Rect; |
| 34 | import android.graphics.Region; |
| 35 | import android.os.Binder; |
| 36 | import android.os.Bundle; |
| 37 | import android.os.IBinder; |
| 38 | import android.os.Parcel; |
Dianne Hackborn | 5fe7e2a | 2012-10-04 11:58:16 -0700 | [diff] [blame] | 39 | import android.os.Process; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 40 | import android.os.RemoteException; |
| 41 | import android.os.ServiceManager; |
Wale Ogunwale | 4958ad2 | 2017-06-22 09:08:14 -0700 | [diff] [blame] | 42 | import android.os.Trace; |
Dianne Hackborn | 5fe7e2a | 2012-10-04 11:58:16 -0700 | [diff] [blame] | 43 | import android.os.UserHandle; |
Andrii Kulian | 4460796 | 2017-03-16 11:06:24 -0700 | [diff] [blame] | 44 | import android.util.MergedConfiguration; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 45 | import android.util.Slog; |
Craig Mautner | 6881a10 | 2012-07-27 13:04:51 -0700 | [diff] [blame] | 46 | import android.view.Display; |
Adrian Roos | 5c6b622 | 2017-11-07 17:36:10 +0100 | [diff] [blame] | 47 | import android.view.DisplayCutout; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 48 | import android.view.IWindow; |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 49 | import android.view.IWindowId; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 50 | import android.view.IWindowSession; |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 51 | import android.view.IWindowSessionCallback; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 52 | import android.view.InputChannel; |
| 53 | import android.view.Surface; |
Daichi Hirono | a1fb9be | 2017-12-18 17:02:54 +0900 | [diff] [blame] | 54 | import android.view.SurfaceControl; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 55 | import android.view.SurfaceSession; |
| 56 | import android.view.WindowManager; |
| 57 | |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 58 | import com.android.internal.view.IInputContext; |
| 59 | import com.android.internal.view.IInputMethodClient; |
| 60 | import com.android.internal.view.IInputMethodManager; |
| 61 | import com.android.server.wm.WindowManagerService.H; |
| 62 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 63 | import java.io.PrintWriter; |
Wale Ogunwale | 943002b | 2017-02-15 19:34:01 -0800 | [diff] [blame] | 64 | import java.util.HashSet; |
| 65 | import java.util.Set; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 66 | |
| 67 | /** |
| 68 | * This class represents an active client session. There is generally one |
| 69 | * Session object per process that is interacting with the window manager. |
| 70 | */ |
Bryce Lee | a559286 | 2017-10-23 12:57:37 -0700 | [diff] [blame] | 71 | class Session extends IWindowSession.Stub implements IBinder.DeathRecipient { |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 72 | final WindowManagerService mService; |
Dianne Hackborn | eb94fa7 | 2014-06-03 17:48:12 -0700 | [diff] [blame] | 73 | final IWindowSessionCallback mCallback; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 74 | final IInputMethodClient mClient; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 75 | final int mUid; |
| 76 | final int mPid; |
Wale Ogunwale | cfca258 | 2016-10-19 09:53:25 -0700 | [diff] [blame] | 77 | private final String mStringName; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 78 | SurfaceSession mSurfaceSession; |
Wale Ogunwale | cfca258 | 2016-10-19 09:53:25 -0700 | [diff] [blame] | 79 | private int mNumWindow = 0; |
Wale Ogunwale | 943002b | 2017-02-15 19:34:01 -0800 | [diff] [blame] | 80 | // Set of visible application overlay window surfaces connected to this session. |
| 81 | private final Set<WindowSurfaceController> mAppOverlaySurfaces = new HashSet<>(); |
| 82 | // Set of visible alert window surfaces connected to this session. |
| 83 | private final Set<WindowSurfaceController> mAlertWindowSurfaces = new HashSet<>(); |
Daichi Hirono | df5cf62 | 2017-09-11 14:59:26 +0900 | [diff] [blame] | 84 | private final DragDropController mDragDropController; |
Wale Ogunwale | 943002b | 2017-02-15 19:34:01 -0800 | [diff] [blame] | 85 | final boolean mCanAddInternalSystemWindow; |
Wale Ogunwale | 01ad434 | 2017-06-30 07:07:01 -0700 | [diff] [blame] | 86 | final boolean mCanHideNonSystemOverlayWindows; |
Jorim Jaggi | f12ec0f | 2017-08-23 16:14:10 +0200 | [diff] [blame] | 87 | final boolean mCanAcquireSleepToken; |
Wale Ogunwale | 387e4c6 | 2017-02-13 09:50:02 -0800 | [diff] [blame] | 88 | private AlertWindowNotification mAlertWindowNotification; |
Wale Ogunwale | a10fc7e | 2017-04-06 07:09:51 -0700 | [diff] [blame] | 89 | private boolean mShowingAlertWindowNotificationAllowed; |
Wale Ogunwale | cfca258 | 2016-10-19 09:53:25 -0700 | [diff] [blame] | 90 | private boolean mClientDead = false; |
| 91 | private float mLastReportedAnimatorScale; |
Wale Ogunwale | 387e4c6 | 2017-02-13 09:50:02 -0800 | [diff] [blame] | 92 | private String mPackageName; |
Wale Ogunwale | 4958ad2 | 2017-06-22 09:08:14 -0700 | [diff] [blame] | 93 | private String mRelayoutTag; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 94 | |
Dianne Hackborn | eb94fa7 | 2014-06-03 17:48:12 -0700 | [diff] [blame] | 95 | public Session(WindowManagerService service, IWindowSessionCallback callback, |
| 96 | IInputMethodClient client, IInputContext inputContext) { |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 97 | mService = service; |
Dianne Hackborn | eb94fa7 | 2014-06-03 17:48:12 -0700 | [diff] [blame] | 98 | mCallback = callback; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 99 | mClient = client; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 100 | mUid = Binder.getCallingUid(); |
| 101 | mPid = Binder.getCallingPid(); |
Dianne Hackborn | eb94fa7 | 2014-06-03 17:48:12 -0700 | [diff] [blame] | 102 | mLastReportedAnimatorScale = service.getCurrentAnimatorScale(); |
Wale Ogunwale | 5aa8683 | 2017-02-28 10:40:27 -0800 | [diff] [blame] | 103 | mCanAddInternalSystemWindow = service.mContext.checkCallingOrSelfPermission( |
Wale Ogunwale | 943002b | 2017-02-15 19:34:01 -0800 | [diff] [blame] | 104 | INTERNAL_SYSTEM_WINDOW) == PERMISSION_GRANTED; |
Wale Ogunwale | 01ad434 | 2017-06-30 07:07:01 -0700 | [diff] [blame] | 105 | mCanHideNonSystemOverlayWindows = service.mContext.checkCallingOrSelfPermission( |
| 106 | HIDE_NON_SYSTEM_OVERLAY_WINDOWS) == PERMISSION_GRANTED; |
Jorim Jaggi | f12ec0f | 2017-08-23 16:14:10 +0200 | [diff] [blame] | 107 | mCanAcquireSleepToken = service.mContext.checkCallingOrSelfPermission(DEVICE_POWER) |
| 108 | == PERMISSION_GRANTED; |
Wale Ogunwale | a10fc7e | 2017-04-06 07:09:51 -0700 | [diff] [blame] | 109 | mShowingAlertWindowNotificationAllowed = mService.mShowAlertWindowNotifications; |
Daichi Hirono | df5cf62 | 2017-09-11 14:59:26 +0900 | [diff] [blame] | 110 | mDragDropController = mService.mDragDropController; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 111 | StringBuilder sb = new StringBuilder(); |
| 112 | sb.append("Session{"); |
| 113 | sb.append(Integer.toHexString(System.identityHashCode(this))); |
Dianne Hackborn | 5fe7e2a | 2012-10-04 11:58:16 -0700 | [diff] [blame] | 114 | sb.append(" "); |
| 115 | sb.append(mPid); |
| 116 | if (mUid < Process.FIRST_APPLICATION_UID) { |
| 117 | sb.append(":"); |
| 118 | sb.append(mUid); |
| 119 | } else { |
| 120 | sb.append(":u"); |
| 121 | sb.append(UserHandle.getUserId(mUid)); |
| 122 | sb.append('a'); |
| 123 | sb.append(UserHandle.getAppId(mUid)); |
| 124 | } |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 125 | sb.append("}"); |
| 126 | mStringName = sb.toString(); |
| 127 | |
| 128 | synchronized (mService.mWindowMap) { |
| 129 | if (mService.mInputMethodManager == null && mService.mHaveInputMethods) { |
| 130 | IBinder b = ServiceManager.getService( |
| 131 | Context.INPUT_METHOD_SERVICE); |
| 132 | mService.mInputMethodManager = IInputMethodManager.Stub.asInterface(b); |
| 133 | } |
| 134 | } |
| 135 | long ident = Binder.clearCallingIdentity(); |
| 136 | try { |
| 137 | // Note: it is safe to call in to the input method manager |
| 138 | // here because we are not holding our lock. |
| 139 | if (mService.mInputMethodManager != null) { |
| 140 | mService.mInputMethodManager.addClient(client, inputContext, |
| 141 | mUid, mPid); |
| 142 | } else { |
| 143 | client.setUsingInputMethod(false); |
| 144 | } |
| 145 | client.asBinder().linkToDeath(this, 0); |
| 146 | } catch (RemoteException e) { |
| 147 | // The caller has died, so we can just forget about this. |
| 148 | try { |
| 149 | if (mService.mInputMethodManager != null) { |
| 150 | mService.mInputMethodManager.removeClient(client); |
| 151 | } |
| 152 | } catch (RemoteException ee) { |
| 153 | } |
| 154 | } finally { |
| 155 | Binder.restoreCallingIdentity(ident); |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | @Override |
| 160 | public boolean onTransact(int code, Parcel data, Parcel reply, int flags) |
| 161 | throws RemoteException { |
| 162 | try { |
| 163 | return super.onTransact(code, data, reply, flags); |
| 164 | } catch (RuntimeException e) { |
| 165 | // Log all 'real' exceptions thrown to the caller |
| 166 | if (!(e instanceof SecurityException)) { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 167 | Slog.wtf(TAG_WM, "Window Session Crash", e); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 168 | } |
| 169 | throw e; |
| 170 | } |
| 171 | } |
| 172 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 173 | @Override |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 174 | public void binderDied() { |
| 175 | // Note: it is safe to call in to the input method manager |
| 176 | // here because we are not holding our lock. |
| 177 | try { |
| 178 | if (mService.mInputMethodManager != null) { |
| 179 | mService.mInputMethodManager.removeClient(mClient); |
| 180 | } |
| 181 | } catch (RemoteException e) { |
| 182 | } |
| 183 | synchronized(mService.mWindowMap) { |
| 184 | mClient.asBinder().unlinkToDeath(this, 0); |
| 185 | mClientDead = true; |
| 186 | killSessionLocked(); |
| 187 | } |
| 188 | } |
| 189 | |
Craig Mautner | 6881a10 | 2012-07-27 13:04:51 -0700 | [diff] [blame] | 190 | @Override |
Dianne Hackborn | 9a230e0 | 2011-10-06 11:51:27 -0700 | [diff] [blame] | 191 | public int add(IWindow window, int seq, WindowManager.LayoutParams attrs, |
Adrian Roos | 37d7a68 | 2014-11-06 18:15:16 +0100 | [diff] [blame] | 192 | int viewVisibility, Rect outContentInsets, Rect outStableInsets, |
| 193 | InputChannel outInputChannel) { |
Craig Mautner | 6881a10 | 2012-07-27 13:04:51 -0700 | [diff] [blame] | 194 | return addToDisplay(window, seq, attrs, viewVisibility, Display.DEFAULT_DISPLAY, |
Adrian Roos | 5c6b622 | 2017-11-07 17:36:10 +0100 | [diff] [blame] | 195 | outContentInsets, outStableInsets, null /* outOutsets */, null /* cutout */, |
| 196 | outInputChannel); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 197 | } |
Craig Mautner | 6881a10 | 2012-07-27 13:04:51 -0700 | [diff] [blame] | 198 | |
| 199 | @Override |
| 200 | public int addToDisplay(IWindow window, int seq, WindowManager.LayoutParams attrs, |
Adrian Roos | 37d7a68 | 2014-11-06 18:15:16 +0100 | [diff] [blame] | 201 | int viewVisibility, int displayId, Rect outContentInsets, Rect outStableInsets, |
Adrian Roos | 5c6b622 | 2017-11-07 17:36:10 +0100 | [diff] [blame] | 202 | Rect outOutsets, DisplayCutout.ParcelableWrapper outDisplayCutout, |
| 203 | InputChannel outInputChannel) { |
Craig Mautner | 6881a10 | 2012-07-27 13:04:51 -0700 | [diff] [blame] | 204 | return mService.addWindow(this, window, seq, attrs, viewVisibility, displayId, |
Adrian Roos | 5c6b622 | 2017-11-07 17:36:10 +0100 | [diff] [blame] | 205 | outContentInsets, outStableInsets, outOutsets, outDisplayCutout, outInputChannel); |
Craig Mautner | 6881a10 | 2012-07-27 13:04:51 -0700 | [diff] [blame] | 206 | } |
| 207 | |
| 208 | @Override |
Dianne Hackborn | 9a230e0 | 2011-10-06 11:51:27 -0700 | [diff] [blame] | 209 | public int addWithoutInputChannel(IWindow window, int seq, WindowManager.LayoutParams attrs, |
Adrian Roos | 37d7a68 | 2014-11-06 18:15:16 +0100 | [diff] [blame] | 210 | int viewVisibility, Rect outContentInsets, Rect outStableInsets) { |
Craig Mautner | 6881a10 | 2012-07-27 13:04:51 -0700 | [diff] [blame] | 211 | return addToDisplayWithoutInputChannel(window, seq, attrs, viewVisibility, |
Adrian Roos | 37d7a68 | 2014-11-06 18:15:16 +0100 | [diff] [blame] | 212 | Display.DEFAULT_DISPLAY, outContentInsets, outStableInsets); |
Craig Mautner | 6881a10 | 2012-07-27 13:04:51 -0700 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | @Override |
| 216 | public int addToDisplayWithoutInputChannel(IWindow window, int seq, WindowManager.LayoutParams attrs, |
Adrian Roos | 37d7a68 | 2014-11-06 18:15:16 +0100 | [diff] [blame] | 217 | int viewVisibility, int displayId, Rect outContentInsets, Rect outStableInsets) { |
Craig Mautner | 6881a10 | 2012-07-27 13:04:51 -0700 | [diff] [blame] | 218 | return mService.addWindow(this, window, seq, attrs, viewVisibility, displayId, |
Adrian Roos | 5c6b622 | 2017-11-07 17:36:10 +0100 | [diff] [blame] | 219 | outContentInsets, outStableInsets, null /* outOutsets */, null /* cutout */, null); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 220 | } |
| 221 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 222 | @Override |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 223 | public void remove(IWindow window) { |
| 224 | mService.removeWindow(this, window); |
| 225 | } |
| 226 | |
Rob Carr | 64e516f | 2015-10-29 00:20:45 +0000 | [diff] [blame] | 227 | @Override |
Robert Carr | 77bdfb5 | 2016-05-02 18:18:31 -0700 | [diff] [blame] | 228 | public void prepareToReplaceWindows(IBinder appToken, boolean childrenOnly) { |
Wale Ogunwale | 9bc4773 | 2016-08-10 14:44:22 -0700 | [diff] [blame] | 229 | mService.setWillReplaceWindows(appToken, childrenOnly); |
Robert Carr | 23fa16b | 2016-01-13 13:19:58 -0800 | [diff] [blame] | 230 | } |
| 231 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 232 | @Override |
Dianne Hackborn | 9a230e0 | 2011-10-06 11:51:27 -0700 | [diff] [blame] | 233 | public int relayout(IWindow window, int seq, WindowManager.LayoutParams attrs, |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 234 | int requestedWidth, int requestedHeight, int viewFlags, |
Dianne Hackborn | c4aad01 | 2013-02-22 15:05:25 -0800 | [diff] [blame] | 235 | int flags, Rect outFrame, Rect outOverscanInsets, Rect outContentInsets, |
Jorim Jaggi | 2e95a48 | 2016-01-14 17:36:55 -0800 | [diff] [blame] | 236 | Rect outVisibleInsets, Rect outStableInsets, Rect outsets, Rect outBackdropFrame, |
Adrian Roos | 5c6b622 | 2017-11-07 17:36:10 +0100 | [diff] [blame] | 237 | DisplayCutout.ParcelableWrapper cutout, |
Andrii Kulian | 4460796 | 2017-03-16 11:06:24 -0700 | [diff] [blame] | 238 | MergedConfiguration mergedConfiguration, Surface outSurface) { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 239 | if (false) Slog.d(TAG_WM, ">>>>>> ENTERED relayout from " |
Dianne Hackborn | b961cd2 | 2011-06-21 12:13:37 -0700 | [diff] [blame] | 240 | + Binder.getCallingPid()); |
Wale Ogunwale | 4958ad2 | 2017-06-22 09:08:14 -0700 | [diff] [blame] | 241 | Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, mRelayoutTag); |
Dianne Hackborn | 9a230e0 | 2011-10-06 11:51:27 -0700 | [diff] [blame] | 242 | int res = mService.relayoutWindow(this, window, seq, attrs, |
Dianne Hackborn | 6d05fd3 | 2011-11-19 14:36:15 -0800 | [diff] [blame] | 243 | requestedWidth, requestedHeight, viewFlags, flags, |
Dianne Hackborn | c4aad01 | 2013-02-22 15:05:25 -0800 | [diff] [blame] | 244 | outFrame, outOverscanInsets, outContentInsets, outVisibleInsets, |
Adrian Roos | 5c6b622 | 2017-11-07 17:36:10 +0100 | [diff] [blame] | 245 | outStableInsets, outsets, outBackdropFrame, cutout, |
| 246 | mergedConfiguration, outSurface); |
Wale Ogunwale | 4958ad2 | 2017-06-22 09:08:14 -0700 | [diff] [blame] | 247 | Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 248 | if (false) Slog.d(TAG_WM, "<<<<<< EXITING relayout to " |
Dianne Hackborn | b961cd2 | 2011-06-21 12:13:37 -0700 | [diff] [blame] | 249 | + Binder.getCallingPid()); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 250 | return res; |
| 251 | } |
| 252 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 253 | @Override |
Dianne Hackborn | 6482517 | 2011-03-02 21:32:58 -0800 | [diff] [blame] | 254 | public boolean outOfMemory(IWindow window) { |
| 255 | return mService.outOfMemoryWindow(this, window); |
| 256 | } |
| 257 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 258 | @Override |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 259 | public void setTransparentRegion(IWindow window, Region region) { |
| 260 | mService.setTransparentRegionWindow(this, window, region); |
| 261 | } |
| 262 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 263 | @Override |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 264 | public void setInsets(IWindow window, int touchableInsets, |
| 265 | Rect contentInsets, Rect visibleInsets, Region touchableArea) { |
| 266 | mService.setInsetsWindow(this, window, touchableInsets, contentInsets, |
| 267 | visibleInsets, touchableArea); |
| 268 | } |
| 269 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 270 | @Override |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 271 | public void getDisplayFrame(IWindow window, Rect outDisplayFrame) { |
| 272 | mService.getWindowDisplayFrame(this, window, outDisplayFrame); |
| 273 | } |
| 274 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 275 | @Override |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 276 | public void finishDrawing(IWindow window) { |
| 277 | if (WindowManagerService.localLOGV) Slog.v( |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 278 | TAG_WM, "IWindow finishDrawing called for " + window); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 279 | mService.finishDrawingWindow(this, window); |
| 280 | } |
| 281 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 282 | @Override |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 283 | public void setInTouchMode(boolean mode) { |
| 284 | synchronized(mService.mWindowMap) { |
| 285 | mService.mInTouchMode = mode; |
| 286 | } |
| 287 | } |
| 288 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 289 | @Override |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 290 | public boolean getInTouchMode() { |
| 291 | synchronized(mService.mWindowMap) { |
| 292 | return mService.mInTouchMode; |
| 293 | } |
| 294 | } |
| 295 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 296 | @Override |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 297 | public boolean performHapticFeedback(IWindow window, int effectId, |
| 298 | boolean always) { |
| 299 | synchronized(mService.mWindowMap) { |
| 300 | long ident = Binder.clearCallingIdentity(); |
| 301 | try { |
| 302 | return mService.mPolicy.performHapticFeedbackLw( |
| 303 | mService.windowForClientLocked(this, window, true), |
| 304 | effectId, always); |
| 305 | } finally { |
| 306 | Binder.restoreCallingIdentity(ident); |
| 307 | } |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | /* Drag/drop */ |
Daichi Hirono | fabca09 | 2017-12-19 15:02:50 +0900 | [diff] [blame^] | 312 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 313 | @Override |
Daichi Hirono | fabca09 | 2017-12-19 15:02:50 +0900 | [diff] [blame^] | 314 | public IBinder performDrag(IWindow window, int flags, SurfaceControl surface, int touchSource, |
| 315 | float touchX, float touchY, float thumbCenterX, float thumbCenterY, ClipData data) { |
Daichi Hirono | df5cf62 | 2017-09-11 14:59:26 +0900 | [diff] [blame] | 316 | final int callerPid = Binder.getCallingPid(); |
| 317 | final int callerUid = Binder.getCallingUid(); |
| 318 | final long ident = Binder.clearCallingIdentity(); |
| 319 | try { |
Daichi Hirono | fabca09 | 2017-12-19 15:02:50 +0900 | [diff] [blame^] | 320 | return mDragDropController.performDrag(mSurfaceSession, callerPid, callerUid, window, |
| 321 | flags, surface, touchSource, touchX, touchY, thumbCenterX, thumbCenterY, data); |
Daichi Hirono | df5cf62 | 2017-09-11 14:59:26 +0900 | [diff] [blame] | 322 | } finally { |
| 323 | Binder.restoreCallingIdentity(ident); |
| 324 | } |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 325 | } |
| 326 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 327 | @Override |
Daichi Hirono | df5cf62 | 2017-09-11 14:59:26 +0900 | [diff] [blame] | 328 | public void reportDropResult(IWindow window, boolean consumed) { |
| 329 | final long ident = Binder.clearCallingIdentity(); |
| 330 | try { |
Daichi Hirono | 58e25e1 | 2017-10-25 15:48:08 +0900 | [diff] [blame] | 331 | mDragDropController.reportDropResult(window, consumed); |
Daichi Hirono | df5cf62 | 2017-09-11 14:59:26 +0900 | [diff] [blame] | 332 | } finally { |
| 333 | Binder.restoreCallingIdentity(ident); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 334 | } |
Daichi Hirono | df5cf62 | 2017-09-11 14:59:26 +0900 | [diff] [blame] | 335 | } |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 336 | |
Daichi Hirono | df5cf62 | 2017-09-11 14:59:26 +0900 | [diff] [blame] | 337 | @Override |
| 338 | public void cancelDragAndDrop(IBinder dragToken) { |
| 339 | final long ident = Binder.clearCallingIdentity(); |
| 340 | try { |
Daichi Hirono | 58e25e1 | 2017-10-25 15:48:08 +0900 | [diff] [blame] | 341 | mDragDropController.cancelDragAndDrop(dragToken); |
Daichi Hirono | df5cf62 | 2017-09-11 14:59:26 +0900 | [diff] [blame] | 342 | } finally { |
| 343 | Binder.restoreCallingIdentity(ident); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 344 | } |
Daichi Hirono | df5cf62 | 2017-09-11 14:59:26 +0900 | [diff] [blame] | 345 | } |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 346 | |
Daichi Hirono | df5cf62 | 2017-09-11 14:59:26 +0900 | [diff] [blame] | 347 | @Override |
| 348 | public void dragRecipientEntered(IWindow window) { |
| 349 | mDragDropController.dragRecipientEntered(window); |
| 350 | } |
| 351 | |
| 352 | @Override |
| 353 | public void dragRecipientExited(IWindow window) { |
| 354 | mDragDropController.dragRecipientExited(window); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 355 | } |
| 356 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 357 | @Override |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 358 | public boolean startMovingTask(IWindow window, float startX, float startY) { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 359 | if (DEBUG_TASK_POSITIONING) Slog.d( |
| 360 | TAG_WM, "startMovingTask: {" + startX + "," + startY + "}"); |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 361 | |
Wale Ogunwale | 09e1b8d | 2016-02-23 10:38:35 -0800 | [diff] [blame] | 362 | long ident = Binder.clearCallingIdentity(); |
| 363 | try { |
Daichi Hirono | 34fb731 | 2017-12-04 10:00:24 +0900 | [diff] [blame] | 364 | return mService.mTaskPositioningController.startMovingTask(window, startX, startY); |
Wale Ogunwale | 09e1b8d | 2016-02-23 10:38:35 -0800 | [diff] [blame] | 365 | } finally { |
| 366 | Binder.restoreCallingIdentity(ident); |
| 367 | } |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 368 | } |
| 369 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 370 | @Override |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 371 | public void setWallpaperPosition(IBinder window, float x, float y, float xStep, float yStep) { |
| 372 | synchronized(mService.mWindowMap) { |
| 373 | long ident = Binder.clearCallingIdentity(); |
| 374 | try { |
Wale Ogunwale | 0303c57 | 2016-10-20 10:16:29 -0700 | [diff] [blame] | 375 | mService.mRoot.mWallpaperController.setWindowWallpaperPosition( |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 376 | mService.windowForClientLocked(this, window, true), |
| 377 | x, y, xStep, yStep); |
| 378 | } finally { |
| 379 | Binder.restoreCallingIdentity(ident); |
| 380 | } |
| 381 | } |
| 382 | } |
| 383 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 384 | @Override |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 385 | public void wallpaperOffsetsComplete(IBinder window) { |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 386 | synchronized (mService.mWindowMap) { |
Wale Ogunwale | 0303c57 | 2016-10-20 10:16:29 -0700 | [diff] [blame] | 387 | mService.mRoot.mWallpaperController.wallpaperOffsetsComplete(window); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 388 | } |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 389 | } |
| 390 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 391 | @Override |
Dianne Hackborn | 067e5f6 | 2014-09-07 23:14:30 -0700 | [diff] [blame] | 392 | public void setWallpaperDisplayOffset(IBinder window, int x, int y) { |
| 393 | synchronized(mService.mWindowMap) { |
| 394 | long ident = Binder.clearCallingIdentity(); |
| 395 | try { |
Wale Ogunwale | 0303c57 | 2016-10-20 10:16:29 -0700 | [diff] [blame] | 396 | mService.mRoot.mWallpaperController.setWindowWallpaperDisplayOffset( |
Dianne Hackborn | 067e5f6 | 2014-09-07 23:14:30 -0700 | [diff] [blame] | 397 | mService.windowForClientLocked(this, window, true), x, y); |
| 398 | } finally { |
| 399 | Binder.restoreCallingIdentity(ident); |
| 400 | } |
| 401 | } |
| 402 | } |
| 403 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 404 | @Override |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 405 | public Bundle sendWallpaperCommand(IBinder window, String action, int x, int y, |
| 406 | int z, Bundle extras, boolean sync) { |
| 407 | synchronized(mService.mWindowMap) { |
| 408 | long ident = Binder.clearCallingIdentity(); |
| 409 | try { |
Wale Ogunwale | 0303c57 | 2016-10-20 10:16:29 -0700 | [diff] [blame] | 410 | return mService.mRoot.mWallpaperController.sendWindowWallpaperCommand( |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 411 | mService.windowForClientLocked(this, window, true), |
| 412 | action, x, y, z, extras, sync); |
| 413 | } finally { |
| 414 | Binder.restoreCallingIdentity(ident); |
| 415 | } |
| 416 | } |
| 417 | } |
| 418 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 419 | @Override |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 420 | public void wallpaperCommandComplete(IBinder window, Bundle result) { |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 421 | synchronized (mService.mWindowMap) { |
Wale Ogunwale | 0303c57 | 2016-10-20 10:16:29 -0700 | [diff] [blame] | 422 | mService.mRoot.mWallpaperController.wallpaperCommandComplete(window); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 423 | } |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 424 | } |
| 425 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 426 | @Override |
Svetoslav | f7174e8 | 2014-06-12 11:29:35 -0700 | [diff] [blame] | 427 | public void onRectangleOnScreenRequested(IBinder token, Rect rectangle) { |
Svetoslav Ganov | 1cf70bb | 2012-08-06 10:53:34 -0700 | [diff] [blame] | 428 | synchronized(mService.mWindowMap) { |
| 429 | final long identity = Binder.clearCallingIdentity(); |
| 430 | try { |
Svetoslav | f7174e8 | 2014-06-12 11:29:35 -0700 | [diff] [blame] | 431 | mService.onRectangleOnScreenRequested(token, rectangle); |
Svetoslav Ganov | 1cf70bb | 2012-08-06 10:53:34 -0700 | [diff] [blame] | 432 | } finally { |
| 433 | Binder.restoreCallingIdentity(identity); |
| 434 | } |
| 435 | } |
| 436 | } |
| 437 | |
Andrew Scull | 26f830d | 2017-05-19 12:16:10 +0100 | [diff] [blame] | 438 | @Override |
Dianne Hackborn | e3f23a3 | 2013-03-01 13:25:35 -0800 | [diff] [blame] | 439 | public IWindowId getWindowId(IBinder window) { |
| 440 | return mService.getWindowId(window); |
| 441 | } |
| 442 | |
Jeff Brown | c2932a1 | 2014-11-20 18:04:05 -0800 | [diff] [blame] | 443 | @Override |
| 444 | public void pokeDrawLock(IBinder window) { |
| 445 | final long identity = Binder.clearCallingIdentity(); |
| 446 | try { |
| 447 | mService.pokeDrawLock(this, window); |
| 448 | } finally { |
| 449 | Binder.restoreCallingIdentity(identity); |
| 450 | } |
| 451 | } |
| 452 | |
Vladislav Kaznacheev | 989b58a | 2016-02-10 12:19:33 -0800 | [diff] [blame] | 453 | @Override |
| 454 | public void updatePointerIcon(IWindow window) { |
| 455 | final long identity = Binder.clearCallingIdentity(); |
| 456 | try { |
| 457 | mService.updatePointerIcon(window); |
| 458 | } finally { |
| 459 | Binder.restoreCallingIdentity(identity); |
| 460 | } |
| 461 | } |
| 462 | |
Wale Ogunwale | 387e4c6 | 2017-02-13 09:50:02 -0800 | [diff] [blame] | 463 | void windowAddedLocked(String packageName) { |
| 464 | mPackageName = packageName; |
Wale Ogunwale | 4958ad2 | 2017-06-22 09:08:14 -0700 | [diff] [blame] | 465 | mRelayoutTag = "relayoutWindow: " + mPackageName; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 466 | if (mSurfaceSession == null) { |
| 467 | if (WindowManagerService.localLOGV) Slog.v( |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 468 | TAG_WM, "First window added to " + this + ", creating SurfaceSession"); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 469 | mSurfaceSession = new SurfaceSession(); |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 470 | if (SHOW_TRANSACTIONS) Slog.i( |
| 471 | TAG_WM, " NEW SURFACE SESSION " + mSurfaceSession); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 472 | mService.mSessions.add(this); |
Dianne Hackborn | eb94fa7 | 2014-06-03 17:48:12 -0700 | [diff] [blame] | 473 | if (mLastReportedAnimatorScale != mService.getCurrentAnimatorScale()) { |
| 474 | mService.dispatchNewAnimatorScaleLocked(this); |
| 475 | } |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 476 | } |
| 477 | mNumWindow++; |
| 478 | } |
| 479 | |
Wale Ogunwale | 943002b | 2017-02-15 19:34:01 -0800 | [diff] [blame] | 480 | void windowRemovedLocked() { |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 481 | mNumWindow--; |
Wale Ogunwale | 943002b | 2017-02-15 19:34:01 -0800 | [diff] [blame] | 482 | killSessionLocked(); |
| 483 | } |
| 484 | |
| 485 | |
| 486 | void onWindowSurfaceVisibilityChanged(WindowSurfaceController surfaceController, |
| 487 | boolean visible, int type) { |
| 488 | |
| 489 | if (!isSystemAlertWindowType(type)) { |
| 490 | return; |
| 491 | } |
| 492 | |
| 493 | boolean changed; |
| 494 | |
| 495 | if (!mCanAddInternalSystemWindow) { |
| 496 | // We want to track non-system signature apps adding alert windows so we can post an |
| 497 | // on-going notification for the user to control their visibility. |
| 498 | if (visible) { |
| 499 | changed = mAlertWindowSurfaces.add(surfaceController); |
| 500 | } else { |
| 501 | changed = mAlertWindowSurfaces.remove(surfaceController); |
| 502 | } |
| 503 | |
| 504 | if (changed) { |
Wale Ogunwale | 387e4c6 | 2017-02-13 09:50:02 -0800 | [diff] [blame] | 505 | if (mAlertWindowSurfaces.isEmpty()) { |
| 506 | cancelAlertWindowNotification(); |
| 507 | } else if (mAlertWindowNotification == null){ |
Wale Ogunwale | d76881e | 2017-03-10 13:17:56 -0800 | [diff] [blame] | 508 | mAlertWindowNotification = new AlertWindowNotification(mService, mPackageName); |
Wale Ogunwale | a10fc7e | 2017-04-06 07:09:51 -0700 | [diff] [blame] | 509 | if (mShowingAlertWindowNotificationAllowed) { |
| 510 | mAlertWindowNotification.post(); |
| 511 | } |
Wale Ogunwale | 387e4c6 | 2017-02-13 09:50:02 -0800 | [diff] [blame] | 512 | } |
Wale Ogunwale | d993a57 | 2017-02-05 13:52:09 -0800 | [diff] [blame] | 513 | } |
| 514 | } |
Wale Ogunwale | 943002b | 2017-02-15 19:34:01 -0800 | [diff] [blame] | 515 | |
| 516 | if (type != TYPE_APPLICATION_OVERLAY) { |
| 517 | return; |
| 518 | } |
| 519 | |
| 520 | if (visible) { |
| 521 | changed = mAppOverlaySurfaces.add(surfaceController); |
| 522 | } else { |
| 523 | changed = mAppOverlaySurfaces.remove(surfaceController); |
| 524 | } |
| 525 | |
| 526 | if (changed) { |
| 527 | // Notify activity manager of changes to app overlay windows so it can adjust the |
| 528 | // importance score for the process. |
| 529 | setHasOverlayUi(!mAppOverlaySurfaces.isEmpty()); |
| 530 | } |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 531 | } |
| 532 | |
Wale Ogunwale | a10fc7e | 2017-04-06 07:09:51 -0700 | [diff] [blame] | 533 | void setShowingAlertWindowNotificationAllowed(boolean allowed) { |
| 534 | mShowingAlertWindowNotificationAllowed = allowed; |
| 535 | if (mAlertWindowNotification != null) { |
| 536 | if (allowed) { |
| 537 | mAlertWindowNotification.post(); |
| 538 | } else { |
| 539 | mAlertWindowNotification.cancel(); |
| 540 | } |
| 541 | } |
| 542 | } |
| 543 | |
Wale Ogunwale | d993a57 | 2017-02-05 13:52:09 -0800 | [diff] [blame] | 544 | private void killSessionLocked() { |
| 545 | if (mNumWindow > 0 || !mClientDead) { |
| 546 | return; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 547 | } |
Wale Ogunwale | d993a57 | 2017-02-05 13:52:09 -0800 | [diff] [blame] | 548 | |
| 549 | mService.mSessions.remove(this); |
| 550 | if (mSurfaceSession == null) { |
| 551 | return; |
| 552 | } |
| 553 | |
| 554 | if (WindowManagerService.localLOGV) Slog.v(TAG_WM, "Last window removed from " + this |
| 555 | + ", destroying " + mSurfaceSession); |
| 556 | if (SHOW_TRANSACTIONS) Slog.i(TAG_WM, " KILL SURFACE SESSION " + mSurfaceSession); |
| 557 | try { |
| 558 | mSurfaceSession.kill(); |
| 559 | } catch (Exception e) { |
| 560 | Slog.w(TAG_WM, "Exception thrown when killing surface session " + mSurfaceSession |
| 561 | + " in session " + this + ": " + e.toString()); |
| 562 | } |
| 563 | mSurfaceSession = null; |
Wale Ogunwale | 387e4c6 | 2017-02-13 09:50:02 -0800 | [diff] [blame] | 564 | mAlertWindowSurfaces.clear(); |
| 565 | mAppOverlaySurfaces.clear(); |
Wale Ogunwale | d993a57 | 2017-02-05 13:52:09 -0800 | [diff] [blame] | 566 | setHasOverlayUi(false); |
Wale Ogunwale | 387e4c6 | 2017-02-13 09:50:02 -0800 | [diff] [blame] | 567 | cancelAlertWindowNotification(); |
Wale Ogunwale | d993a57 | 2017-02-05 13:52:09 -0800 | [diff] [blame] | 568 | } |
| 569 | |
| 570 | private void setHasOverlayUi(boolean hasOverlayUi) { |
| 571 | mService.mH.obtainMessage(H.SET_HAS_OVERLAY_UI, mPid, hasOverlayUi ? 1 : 0).sendToTarget(); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 572 | } |
| 573 | |
Wale Ogunwale | 387e4c6 | 2017-02-13 09:50:02 -0800 | [diff] [blame] | 574 | private void cancelAlertWindowNotification() { |
| 575 | if (mAlertWindowNotification == null) { |
| 576 | return; |
| 577 | } |
| 578 | mAlertWindowNotification.cancel(); |
| 579 | mAlertWindowNotification = null; |
| 580 | } |
| 581 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 582 | void dump(PrintWriter pw, String prefix) { |
| 583 | pw.print(prefix); pw.print("mNumWindow="); pw.print(mNumWindow); |
Wale Ogunwale | 5aa8683 | 2017-02-28 10:40:27 -0800 | [diff] [blame] | 584 | pw.print(" mCanAddInternalSystemWindow="); pw.print(mCanAddInternalSystemWindow); |
Wale Ogunwale | 943002b | 2017-02-15 19:34:01 -0800 | [diff] [blame] | 585 | pw.print(" mAppOverlaySurfaces="); pw.print(mAppOverlaySurfaces); |
| 586 | pw.print(" mAlertWindowSurfaces="); pw.print(mAlertWindowSurfaces); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 587 | pw.print(" mClientDead="); pw.print(mClientDead); |
| 588 | pw.print(" mSurfaceSession="); pw.println(mSurfaceSession); |
Wale Ogunwale | 4958ad2 | 2017-06-22 09:08:14 -0700 | [diff] [blame] | 589 | pw.print(prefix); pw.print("mPackageName="); pw.println(mPackageName); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 590 | } |
| 591 | |
| 592 | @Override |
| 593 | public String toString() { |
| 594 | return mStringName; |
| 595 | } |
Robert Carr | 0e00727 | 2017-10-02 13:00:55 -0700 | [diff] [blame] | 596 | |
| 597 | boolean hasAlertWindowSurfaces() { |
| 598 | return !mAlertWindowSurfaces.isEmpty(); |
| 599 | } |
Filip Gruszczynski | 2217f61 | 2015-05-26 11:32:08 -0700 | [diff] [blame] | 600 | } |