blob: d21465c53bdf02cbb230b4d23ad3f2303e971b9d [file] [log] [blame]
Matthew Ng13dbf872017-10-27 11:02:14 -07001/*
2 * Copyright (C) 2017 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
17package com.android.systemui;
18
Matthew Ng30c0a022017-11-10 14:06:29 -080019import android.content.BroadcastReceiver;
Matthew Ng13dbf872017-10-27 11:02:14 -070020import android.content.ComponentName;
21import android.content.Context;
22import android.content.Intent;
Matthew Ng30c0a022017-11-10 14:06:29 -080023import android.content.IntentFilter;
Matthew Ng13dbf872017-10-27 11:02:14 -070024import android.content.ServiceConnection;
Winson Chung38d31c22017-11-08 14:32:32 -080025import android.graphics.Rect;
26import android.os.Binder;
Matthew Ng13dbf872017-10-27 11:02:14 -070027import android.os.Handler;
28import android.os.IBinder;
Matthew Ngfac87832017-11-10 11:27:29 -080029import android.os.Looper;
Matthew Ng30c0a022017-11-10 14:06:29 -080030import android.os.PatternMatcher;
Matthew Ng13dbf872017-10-27 11:02:14 -070031import android.os.RemoteException;
32import android.os.UserHandle;
Winson Chung387e38b2018-07-09 14:30:54 -070033import android.provider.Settings;
Matthew Ng13dbf872017-10-27 11:02:14 -070034import android.util.Log;
Winson Chung38d31c22017-11-08 14:32:32 -080035import android.view.SurfaceControl;
36
Winson Chung11f53e92017-11-13 17:45:12 -080037import com.android.systemui.OverviewProxyService.OverviewProxyListener;
Winson Chungc1674272018-02-21 10:15:17 -080038import com.android.systemui.recents.events.EventBus;
39import com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent;
Matthew Ng1b1d3462018-03-02 11:43:38 -080040import com.android.systemui.recents.misc.SystemServicesProxy;
Winson Chung38d31c22017-11-08 14:32:32 -080041import com.android.systemui.shared.recents.IOverviewProxy;
42import com.android.systemui.shared.recents.ISystemUiProxy;
Winson Chungd95a2252018-04-04 17:02:29 +000043import com.android.systemui.shared.system.ActivityManagerWrapper;
Winson Chung11f53e92017-11-13 17:45:12 -080044import com.android.systemui.shared.system.GraphicBufferCompat;
Matthew Ngc603a502018-04-18 17:14:22 -070045import com.android.systemui.stackdivider.Divider;
Winson Chungcaf2b812018-01-26 10:29:46 -080046import com.android.systemui.statusbar.phone.StatusBar;
Matthew Ng7d05e772017-11-09 14:41:07 -080047import com.android.systemui.statusbar.policy.CallbackController;
Matthew Ng13dbf872017-10-27 11:02:14 -070048import com.android.systemui.statusbar.policy.DeviceProvisionedController;
49import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener;
Winson Chung11f53e92017-11-13 17:45:12 -080050
Matthew Ng1e43ebd2017-11-14 14:47:05 -080051import java.io.FileDescriptor;
52import java.io.PrintWriter;
Matthew Ng7d05e772017-11-09 14:41:07 -080053import java.util.ArrayList;
54import java.util.List;
Matthew Ng13dbf872017-10-27 11:02:14 -070055
Winson Chung6e4b0b562018-04-04 09:13:37 -070056import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE;
Matthew Ngc1a97b12018-03-28 14:02:00 -070057import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABLE_SWIPE_UP;
Matthew Ng8f25fb962018-01-16 17:17:24 -080058import static com.android.systemui.shared.system.NavigationBarCompat.InteractionType;
59
Matthew Ng13dbf872017-10-27 11:02:14 -070060/**
61 * Class to send information from overview to launcher with a binder.
62 */
Matthew Ng1e43ebd2017-11-14 14:47:05 -080063public class OverviewProxyService implements CallbackController<OverviewProxyListener>, Dumpable {
Matthew Ng13dbf872017-10-27 11:02:14 -070064
Sunny Goyal09c12d72018-03-27 10:14:49 -070065 private static final String ACTION_QUICKSTEP = "android.intent.action.QUICKSTEP_SERVICE";
66
Matthew Ngbd824572018-01-17 16:25:56 -080067 public static final String TAG_OPS = "OverviewProxyService";
68 public static final boolean DEBUG_OVERVIEW_PROXY = false;
Matthew Ng96087482018-06-27 15:32:09 -070069 private static final long BACKOFF_MILLIS = 1000;
Matthew Nge3c5af42018-05-02 16:58:44 -070070 private static final long DEFERRED_CALLBACK_MILLIS = 5000;
Matthew Ng13dbf872017-10-27 11:02:14 -070071
72 private final Context mContext;
73 private final Handler mHandler;
Matthew Ngfac87832017-11-10 11:27:29 -080074 private final Runnable mConnectionRunnable = this::internalConnectToCurrentUser;
Sunny Goyal09c12d72018-03-27 10:14:49 -070075 private final ComponentName mRecentsComponentName;
Matthew Ng13dbf872017-10-27 11:02:14 -070076 private final DeviceProvisionedController mDeviceProvisionedController
77 = Dependency.get(DeviceProvisionedController.class);
Matthew Ng7d05e772017-11-09 14:41:07 -080078 private final List<OverviewProxyListener> mConnectionCallbacks = new ArrayList<>();
Winson Chungd95a2252018-04-04 17:02:29 +000079 private final Intent mQuickStepIntent;
Matthew Ng13dbf872017-10-27 11:02:14 -070080
81 private IOverviewProxy mOverviewProxy;
82 private int mConnectionBackoffAttempts;
Matthew Ng8f25fb962018-01-16 17:17:24 -080083 private @InteractionType int mInteractionFlags;
Winson Chungd95a2252018-04-04 17:02:29 +000084 private boolean mIsEnabled;
Matthew Ng13dbf872017-10-27 11:02:14 -070085
Winson Chung38d31c22017-11-08 14:32:32 -080086 private ISystemUiProxy mSysUiProxy = new ISystemUiProxy.Stub() {
Winson Chungcaf2b812018-01-26 10:29:46 -080087
Winson Chung11f53e92017-11-13 17:45:12 -080088 public GraphicBufferCompat screenshot(Rect sourceCrop, int width, int height, int minLayer,
89 int maxLayer, boolean useIdentityTransform, int rotation) {
Winson Chung38d31c22017-11-08 14:32:32 -080090 long token = Binder.clearCallingIdentity();
91 try {
Winson Chung11f53e92017-11-13 17:45:12 -080092 return new GraphicBufferCompat(SurfaceControl.screenshotToBuffer(sourceCrop, width,
93 height, minLayer, maxLayer, useIdentityTransform, rotation));
Winson Chung38d31c22017-11-08 14:32:32 -080094 } finally {
95 Binder.restoreCallingIdentity(token);
96 }
97 }
Winson Chungcbb15a92018-01-25 17:46:16 +000098
Winson Chungcaf2b812018-01-26 10:29:46 -080099 public void startScreenPinning(int taskId) {
100 long token = Binder.clearCallingIdentity();
101 try {
102 mHandler.post(() -> {
Winson Chung06ca2742018-06-29 12:26:49 -0700103 StatusBar statusBar = SysUiServiceProvider.getComponent(mContext,
Winson Chungcaf2b812018-01-26 10:29:46 -0800104 StatusBar.class);
105 if (statusBar != null) {
106 statusBar.showScreenPinningRequest(taskId, false /* allowCancel */);
107 }
108 });
109 } finally {
110 Binder.restoreCallingIdentity(token);
111 }
112 }
113
Winson Chungc1674272018-02-21 10:15:17 -0800114 public void onSplitScreenInvoked() {
115 long token = Binder.clearCallingIdentity();
116 try {
117 EventBus.getDefault().post(new DockedFirstAnimationFrameEvent());
118 } finally {
119 Binder.restoreCallingIdentity(token);
120 }
121 }
122
Tracy Zhou27599052018-04-16 15:47:29 -0700123 public void onOverviewShown(boolean fromHome) {
124 long token = Binder.clearCallingIdentity();
125 try {
126 mHandler.post(() -> {
127 for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
128 mConnectionCallbacks.get(i).onOverviewShown(fromHome);
129 }
130 });
131 } finally {
132 Binder.restoreCallingIdentity(token);
133 }
134 }
135
Matthew Ng8f25fb962018-01-16 17:17:24 -0800136 public void setInteractionState(@InteractionType int flags) {
137 long token = Binder.clearCallingIdentity();
138 try {
139 if (mInteractionFlags != flags) {
140 mInteractionFlags = flags;
141 mHandler.post(() -> {
142 for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
143 mConnectionCallbacks.get(i).onInteractionFlagsChanged(flags);
144 }
145 });
146 }
147 } finally {
Winson Chungd95a2252018-04-04 17:02:29 +0000148 Prefs.putInt(mContext, Prefs.Key.QUICK_STEP_INTERACTION_FLAGS, mInteractionFlags);
Matthew Ng8f25fb962018-01-16 17:17:24 -0800149 Binder.restoreCallingIdentity(token);
150 }
151 }
Matthew Ngc603a502018-04-18 17:14:22 -0700152
153 public Rect getNonMinimizedSplitScreenSecondaryBounds() {
154 long token = Binder.clearCallingIdentity();
155 try {
Winson Chung06ca2742018-06-29 12:26:49 -0700156 Divider divider = SysUiServiceProvider.getComponent(mContext, Divider.class);
Matthew Ngc603a502018-04-18 17:14:22 -0700157 if (divider != null) {
158 return divider.getView().getNonMinimizedSplitScreenSecondaryBounds();
159 }
160 return null;
161 } finally {
162 Binder.restoreCallingIdentity(token);
163 }
164 }
Matthew Ng96985e72018-05-08 15:46:13 -0700165
166 public void setBackButtonAlpha(float alpha, boolean animate) {
167 long token = Binder.clearCallingIdentity();
168 try {
169 mHandler.post(() -> {
Matthew Ng53896452018-05-30 11:27:39 -0700170 notifyBackButtonAlphaChanged(alpha, animate);
Matthew Ng96985e72018-05-08 15:46:13 -0700171 });
172 } finally {
173 Binder.restoreCallingIdentity(token);
174 }
175 }
Winson Chung38d31c22017-11-08 14:32:32 -0800176 };
177
Matthew Nge3c5af42018-05-02 16:58:44 -0700178 private final Runnable mDeferredConnectionCallback = () -> {
179 Log.w(TAG_OPS, "Binder supposed established connection but actual connection to service "
180 + "timed out, trying again");
181 internalConnectToCurrentUser();
182 };
183
Winson Chungd95a2252018-04-04 17:02:29 +0000184 private final BroadcastReceiver mLauncherStateChangedReceiver = new BroadcastReceiver() {
Matthew Ng30c0a022017-11-10 14:06:29 -0800185 @Override
186 public void onReceive(Context context, Intent intent) {
Winson Chungd95a2252018-04-04 17:02:29 +0000187 updateEnabledState();
188
189 // When launcher service is disabled, reset interaction flags because it is inactive
190 if (!isEnabled()) {
191 mInteractionFlags = 0;
192 Prefs.remove(mContext, Prefs.Key.QUICK_STEP_INTERACTION_FLAGS);
193 }
194
Matthew Ng30c0a022017-11-10 14:06:29 -0800195 // Reconnect immediately, instead of waiting for resume to arrive.
196 startConnectionToCurrentUser();
197 }
198 };
199
Matthew Ng13dbf872017-10-27 11:02:14 -0700200 private final ServiceConnection mOverviewServiceConnection = new ServiceConnection() {
201 @Override
202 public void onServiceConnected(ComponentName name, IBinder service) {
Matthew Nge3c5af42018-05-02 16:58:44 -0700203 mHandler.removeCallbacks(mDeferredConnectionCallback);
204 mConnectionBackoffAttempts = 0;
205 mOverviewProxy = IOverviewProxy.Stub.asInterface(service);
206 // Listen for launcher's death
207 try {
208 service.linkToDeath(mOverviewServiceDeathRcpt, 0);
209 } catch (RemoteException e) {
210 Log.e(TAG_OPS, "Lost connection to launcher service", e);
Matthew Ng13dbf872017-10-27 11:02:14 -0700211 }
Matthew Nge3c5af42018-05-02 16:58:44 -0700212 try {
213 mOverviewProxy.onBind(mSysUiProxy);
214 } catch (RemoteException e) {
215 Log.e(TAG_OPS, "Failed to call onBind()", e);
216 }
217 notifyConnectionChanged();
218 }
219
220 @Override
221 public void onNullBinding(ComponentName name) {
222 Log.w(TAG_OPS, "Null binding of '" + name + "', try reconnecting");
223 internalConnectToCurrentUser();
224 }
225
226 @Override
227 public void onBindingDied(ComponentName name) {
228 Log.w(TAG_OPS, "Binding died of '" + name + "', try reconnecting");
229 internalConnectToCurrentUser();
Matthew Ng13dbf872017-10-27 11:02:14 -0700230 }
231
232 @Override
233 public void onServiceDisconnected(ComponentName name) {
234 // Do nothing
235 }
236 };
237
238 private final DeviceProvisionedListener mDeviceProvisionedCallback =
239 new DeviceProvisionedListener() {
240 @Override
Matthew Ngdfab86c2017-11-07 15:46:51 -0800241 public void onUserSetupChanged() {
Matthew Ng13dbf872017-10-27 11:02:14 -0700242 if (mDeviceProvisionedController.isCurrentUserSetup()) {
Matthew Ngfac87832017-11-10 11:27:29 -0800243 internalConnectToCurrentUser();
Matthew Ng13dbf872017-10-27 11:02:14 -0700244 }
245 }
246
247 @Override
248 public void onUserSwitched() {
Matthew Ng13dbf872017-10-27 11:02:14 -0700249 mConnectionBackoffAttempts = 0;
Matthew Ngfac87832017-11-10 11:27:29 -0800250 internalConnectToCurrentUser();
Matthew Ng13dbf872017-10-27 11:02:14 -0700251 }
252 };
253
254 // This is the death handler for the binder from the launcher service
Matthew Ng30c0a022017-11-10 14:06:29 -0800255 private final IBinder.DeathRecipient mOverviewServiceDeathRcpt
256 = this::startConnectionToCurrentUser;
Matthew Ng13dbf872017-10-27 11:02:14 -0700257
258 public OverviewProxyService(Context context) {
259 mContext = context;
260 mHandler = new Handler();
261 mConnectionBackoffAttempts = 0;
Sunny Goyal09c12d72018-03-27 10:14:49 -0700262 mRecentsComponentName = ComponentName.unflattenFromString(context.getString(
263 com.android.internal.R.string.config_recentsComponentName));
Winson Chungd95a2252018-04-04 17:02:29 +0000264 mQuickStepIntent = new Intent(ACTION_QUICKSTEP)
265 .setPackage(mRecentsComponentName.getPackageName());
266 mInteractionFlags = Prefs.getInt(mContext, Prefs.Key.QUICK_STEP_INTERACTION_FLAGS, 0);
Matthew Ng30c0a022017-11-10 14:06:29 -0800267
268 // Listen for the package update changes.
Matthew Ng1b1d3462018-03-02 11:43:38 -0800269 if (SystemServicesProxy.getInstance(context)
270 .isSystemUser(mDeviceProvisionedController.getCurrentUser())) {
Winson Chungd95a2252018-04-04 17:02:29 +0000271 updateEnabledState();
Matthew Ng1b1d3462018-03-02 11:43:38 -0800272 mDeviceProvisionedController.addCallback(mDeviceProvisionedCallback);
273 IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
274 filter.addDataScheme("package");
Sunny Goyal09c12d72018-03-27 10:14:49 -0700275 filter.addDataSchemeSpecificPart(mRecentsComponentName.getPackageName(),
Matthew Ng1b1d3462018-03-02 11:43:38 -0800276 PatternMatcher.PATTERN_LITERAL);
277 filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
Winson Chungd95a2252018-04-04 17:02:29 +0000278 mContext.registerReceiver(mLauncherStateChangedReceiver, filter);
Matthew Ng1b1d3462018-03-02 11:43:38 -0800279 }
Matthew Ng13dbf872017-10-27 11:02:14 -0700280 }
281
282 public void startConnectionToCurrentUser() {
Matthew Ngfac87832017-11-10 11:27:29 -0800283 if (mHandler.getLooper() != Looper.myLooper()) {
284 mHandler.post(mConnectionRunnable);
285 } else {
286 internalConnectToCurrentUser();
287 }
288 }
289
290 private void internalConnectToCurrentUser() {
Matthew Ng1fa3f7e2017-11-07 11:50:36 -0800291 disconnectFromLauncherService();
292
Matthew Ng13dbf872017-10-27 11:02:14 -0700293 // If user has not setup yet or already connected, do not try to connect
Winson Chungd95a2252018-04-04 17:02:29 +0000294 if (!mDeviceProvisionedController.isCurrentUserSetup() || !isEnabled()) {
Matthew Nge3c5af42018-05-02 16:58:44 -0700295 Log.v(TAG_OPS, "Cannot attempt connection, is setup "
296 + mDeviceProvisionedController.isCurrentUserSetup() + ", is enabled "
297 + isEnabled());
Matthew Ng13dbf872017-10-27 11:02:14 -0700298 return;
299 }
300 mHandler.removeCallbacks(mConnectionRunnable);
Sunny Goyal09c12d72018-03-27 10:14:49 -0700301 Intent launcherServiceIntent = new Intent(ACTION_QUICKSTEP)
302 .setPackage(mRecentsComponentName.getPackageName());
Matthew Ng10b6c41a2018-03-26 18:01:37 -0700303 boolean bound = false;
304 try {
305 bound = mContext.bindServiceAsUser(launcherServiceIntent,
306 mOverviewServiceConnection, Context.BIND_AUTO_CREATE,
307 UserHandle.of(mDeviceProvisionedController.getCurrentUser()));
308 } catch (SecurityException e) {
309 Log.e(TAG_OPS, "Unable to bind because of security error", e);
310 }
Matthew Nge3c5af42018-05-02 16:58:44 -0700311 if (bound) {
312 // Ensure that connection has been established even if it thinks it is bound
313 mHandler.postDelayed(mDeferredConnectionCallback, DEFERRED_CALLBACK_MILLIS);
314 } else {
Matthew Ng13dbf872017-10-27 11:02:14 -0700315 // Retry after exponential backoff timeout
316 final long timeoutMs = (long) Math.scalb(BACKOFF_MILLIS, mConnectionBackoffAttempts);
317 mHandler.postDelayed(mConnectionRunnable, timeoutMs);
318 mConnectionBackoffAttempts++;
Matthew Nge3c5af42018-05-02 16:58:44 -0700319 Log.w(TAG_OPS, "Failed to connect on attempt " + mConnectionBackoffAttempts
320 + " will try again in " + timeoutMs + "ms");
Matthew Ng13dbf872017-10-27 11:02:14 -0700321 }
322 }
323
Matthew Ng7d05e772017-11-09 14:41:07 -0800324 @Override
325 public void addCallback(OverviewProxyListener listener) {
326 mConnectionCallbacks.add(listener);
327 listener.onConnectionChanged(mOverviewProxy != null);
Winson Chungd95a2252018-04-04 17:02:29 +0000328 listener.onInteractionFlagsChanged(mInteractionFlags);
Matthew Ng7d05e772017-11-09 14:41:07 -0800329 }
330
331 @Override
332 public void removeCallback(OverviewProxyListener listener) {
333 mConnectionCallbacks.remove(listener);
334 }
335
Matthew Ngc1a97b12018-03-28 14:02:00 -0700336 public boolean shouldShowSwipeUpUI() {
Winson Chungd95a2252018-04-04 17:02:29 +0000337 return isEnabled() && ((mInteractionFlags & FLAG_DISABLE_SWIPE_UP) == 0);
338 }
339
340 public boolean isEnabled() {
341 return mIsEnabled;
Matthew Ngc1a97b12018-03-28 14:02:00 -0700342 }
343
Matthew Ng13dbf872017-10-27 11:02:14 -0700344 public IOverviewProxy getProxy() {
345 return mOverviewProxy;
346 }
347
Matthew Ng8f25fb962018-01-16 17:17:24 -0800348 public int getInteractionFlags() {
349 return mInteractionFlags;
350 }
351
Matthew Ng13dbf872017-10-27 11:02:14 -0700352 private void disconnectFromLauncherService() {
Matthew Ng1fa3f7e2017-11-07 11:50:36 -0800353 if (mOverviewProxy != null) {
Matthew Ngeb6893b2017-11-09 17:15:33 -0800354 mOverviewProxy.asBinder().unlinkToDeath(mOverviewServiceDeathRcpt, 0);
Matthew Ng1fa3f7e2017-11-07 11:50:36 -0800355 mContext.unbindService(mOverviewServiceConnection);
356 mOverviewProxy = null;
Matthew Ng53896452018-05-30 11:27:39 -0700357 notifyBackButtonAlphaChanged(1f, false /* animate */);
Matthew Ng7d05e772017-11-09 14:41:07 -0800358 notifyConnectionChanged();
Matthew Ng1fa3f7e2017-11-07 11:50:36 -0800359 }
Matthew Ng13dbf872017-10-27 11:02:14 -0700360 }
Matthew Ng7d05e772017-11-09 14:41:07 -0800361
Matthew Ng53896452018-05-30 11:27:39 -0700362 private void notifyBackButtonAlphaChanged(float alpha, boolean animate) {
363 for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
364 mConnectionCallbacks.get(i).onBackButtonAlphaChanged(alpha, animate);
365 }
366 }
367
Matthew Ng7d05e772017-11-09 14:41:07 -0800368 private void notifyConnectionChanged() {
369 for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
370 mConnectionCallbacks.get(i).onConnectionChanged(mOverviewProxy != null);
371 }
372 }
373
Matthew Ng2ea93b72018-03-14 19:43:18 +0000374 public void notifyQuickStepStarted() {
Winson Chungcbb15a92018-01-25 17:46:16 +0000375 for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
Matthew Ng2ea93b72018-03-14 19:43:18 +0000376 mConnectionCallbacks.get(i).onQuickStepStarted();
Winson Chungcbb15a92018-01-25 17:46:16 +0000377 }
378 }
379
Tracy Zhou27599052018-04-16 15:47:29 -0700380 public void notifyQuickScrubStarted() {
381 for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
382 mConnectionCallbacks.get(i).onQuickScrubStarted();
383 }
384 }
385
Winson Chungd95a2252018-04-04 17:02:29 +0000386 private void updateEnabledState() {
Winson Chung6e4b0b562018-04-04 09:13:37 -0700387 mIsEnabled = mContext.getPackageManager().resolveServiceAsUser(mQuickStepIntent,
388 MATCH_DIRECT_BOOT_UNAWARE,
Winson Chungd95a2252018-04-04 17:02:29 +0000389 ActivityManagerWrapper.getInstance().getCurrentUserId()) != null;
390 }
391
Matthew Ng1e43ebd2017-11-14 14:47:05 -0800392 @Override
393 public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
Matthew Ngbd824572018-01-17 16:25:56 -0800394 pw.println(TAG_OPS + " state:");
Winson Chung387e38b2018-07-09 14:30:54 -0700395 pw.print(" recentsComponentName="); pw.println(mRecentsComponentName);
396 pw.print(" isConnected="); pw.println(mOverviewProxy != null);
Matthew Ng1e43ebd2017-11-14 14:47:05 -0800397 pw.print(" isCurrentUserSetup="); pw.println(mDeviceProvisionedController
398 .isCurrentUserSetup());
Winson Chung387e38b2018-07-09 14:30:54 -0700399 pw.print(" connectionBackoffAttempts="); pw.println(mConnectionBackoffAttempts);
400 pw.print(" interactionFlags="); pw.println(mInteractionFlags);
401
402 pw.print(" quickStepIntent="); pw.println(mQuickStepIntent);
403 pw.print(" quickStepIntentResolved="); pw.println(isEnabled());
404
405 final int swipeUpDefaultValue = mContext.getResources()
406 .getBoolean(com.android.internal.R.bool.config_swipe_up_gesture_default) ? 1 : 0;
407 final int swipeUpEnabled = Settings.Secure.getInt(mContext.getContentResolver(),
408 Settings.Secure.SWIPE_UP_TO_SWITCH_APPS_ENABLED, swipeUpDefaultValue);
409 pw.print(" swipeUpSetting="); pw.println(swipeUpEnabled != 0);
410 pw.print(" swipeUpSettingDefault="); pw.println(swipeUpDefaultValue != 0);
Matthew Ng1e43ebd2017-11-14 14:47:05 -0800411 }
412
Matthew Ng7d05e772017-11-09 14:41:07 -0800413 public interface OverviewProxyListener {
Winson Chungcbb15a92018-01-25 17:46:16 +0000414 default void onConnectionChanged(boolean isConnected) {}
Matthew Ng2ea93b72018-03-14 19:43:18 +0000415 default void onQuickStepStarted() {}
Matthew Ng8f25fb962018-01-16 17:17:24 -0800416 default void onInteractionFlagsChanged(@InteractionType int flags) {}
Tracy Zhou27599052018-04-16 15:47:29 -0700417 default void onOverviewShown(boolean fromHome) {}
418 default void onQuickScrubStarted() {}
Matthew Ng96985e72018-05-08 15:46:13 -0700419 default void onBackButtonAlphaChanged(float alpha, boolean animate) {}
Matthew Ng7d05e772017-11-09 14:41:07 -0800420 }
Matthew Ng13dbf872017-10-27 11:02:14 -0700421}