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