From b7dafa6a04c0da0b92d2e2db5ace4a8a7b87130a Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 6 Mar 2019 12:32:09 -0800 Subject: [PATCH] Using the new contract for some systemUI constants Change-Id: I1a0351bc9b1ac5b8fe866a92c1bda93126189543 --- .../quickstep/TouchInteractionService.java | 1 + .../quickstep/TouchInteractionService.java | 1 + .../com/android/quickstep/RecentsModel.java | 45 +++++-------------- 3 files changed, 13 insertions(+), 34 deletions(-) diff --git a/go/quickstep/src/com/android/quickstep/TouchInteractionService.java b/go/quickstep/src/com/android/quickstep/TouchInteractionService.java index 2858deb6f4..34f374c3d1 100644 --- a/go/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/go/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -52,6 +52,7 @@ public class TouchInteractionService extends Service { ISystemUiProxy iSystemUiProxy = ISystemUiProxy.Stub .asInterface(bundle.getBinder(KEY_EXTRA_SYSUI_PROXY)); mRecentsModel.setSystemUiProxy(iSystemUiProxy); + mRecentsModel.onInitializeSystemUI(bundle); } @Override diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index a3c3ff9655..aa90756f29 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -89,6 +89,7 @@ public class TouchInteractionService extends Service { .asInterface(bundle.getBinder(KEY_EXTRA_SYSUI_PROXY)); runWhenUserUnlocked(() -> { mRecentsModel.setSystemUiProxy(mISystemUiProxy); + mRecentsModel.onInitializeSystemUI(bundle); mOverviewInteractionState.setSystemUiProxy(mISystemUiProxy); }); diff --git a/quickstep/src/com/android/quickstep/RecentsModel.java b/quickstep/src/com/android/quickstep/RecentsModel.java index 81a22a190a..56bc8570f6 100644 --- a/quickstep/src/com/android/quickstep/RecentsModel.java +++ b/quickstep/src/com/android/quickstep/RecentsModel.java @@ -16,12 +16,15 @@ package com.android.quickstep; import static com.android.quickstep.TaskUtils.checkCurrentOrManagedUserId; +import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SUPPORTS_WINDOW_CORNERS; +import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_WINDOW_CORNER_RADIUS; import android.annotation.TargetApi; import android.app.ActivityManager; import android.content.ComponentCallbacks2; import android.content.Context; import android.os.Build; +import android.os.Bundle; import android.os.HandlerThread; import android.os.Process; import android.os.RemoteException; @@ -59,8 +62,8 @@ public class RecentsModel extends TaskStackChangeListener { private final TaskIconCache mIconCache; private final TaskThumbnailCache mThumbnailCache; - private float mWindowCornerRadius = -1; - private Boolean mSupportsRoundedCornersOnWindows; + private float mWindowCornerRadius = 0; + private boolean mSupportsRoundedCornersOnWindows; private RecentsModel(Context context) { mContext = context; @@ -73,6 +76,12 @@ public class RecentsModel extends TaskStackChangeListener { ActivityManagerWrapper.getInstance().registerTaskStackListener(this); } + public void onInitializeSystemUI(Bundle params) { + mWindowCornerRadius = params.getFloat(KEY_EXTRA_WINDOW_CORNER_RADIUS, 0); + mSupportsRoundedCornersOnWindows = + params.getBoolean(KEY_EXTRA_SUPPORTS_WINDOW_CORNERS, false); + } + public TaskIconCache getIconCache() { return mIconCache; } @@ -182,42 +191,10 @@ public class RecentsModel extends TaskStackChangeListener { } public float getWindowCornerRadius() { - // The window corner radius is expressed in pixels and won't change if the - // display density changes. It's safe to cache the value. - if (mWindowCornerRadius == -1) { - if (mSystemUiProxy != null) { - try { - mWindowCornerRadius = mSystemUiProxy.getWindowCornerRadius(); - } catch (RemoteException e) { - Log.w(TAG, "Connection to ISystemUIProxy was lost, ignoring window corner " - + "radius"); - return 0; - } - } else { - Log.w(TAG, "ISystemUIProxy is null, ignoring window corner radius"); - return 0; - } - } return mWindowCornerRadius; } public boolean supportsRoundedCornersOnWindows() { - if (mSupportsRoundedCornersOnWindows == null) { - if (mSystemUiProxy != null) { - try { - mSupportsRoundedCornersOnWindows = - mSystemUiProxy.supportsRoundedCornersOnWindows(); - } catch (RemoteException e) { - Log.w(TAG, "Connection to ISystemUIProxy was lost, ignoring window corner " - + "radius"); - return false; - } - } else { - Log.w(TAG, "ISystemUIProxy is null, ignoring window corner radius"); - return false; - } - } - return mSupportsRoundedCornersOnWindows; }