Merge "Using the new contract for some systemUI constants" into ub-launcher3-master

This commit is contained in:
Sunny Goyal 2019-03-06 21:40:12 +00:00 committed by Android (Google) Code Review
commit 826405d095
3 changed files with 13 additions and 34 deletions

View File

@ -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

View File

@ -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);
});

View File

@ -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;
}