Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 826405d0 authored by Sunny Goyal's avatar Sunny Goyal Committed by Android (Google) Code Review
Browse files

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

parents 5ac7eb1e b7dafa6a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -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);
            });

+11 −34
Original line number Diff line number Diff line
@@ -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;
    }