diff options
author | Tracy Zhou <tracyzhou@google.com> | 2020-02-25 11:41:32 -0800 |
---|---|---|
committer | Tracy Zhou <tracyzhou@google.com> | 2020-03-04 18:29:35 -0800 |
commit | ccfab35bf899800d0eee4c1d604ca5573746ba1e (patch) | |
tree | d53a81154556fd2e17d522cd39abf9b1fa56f436 /packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java | |
parent | ab2c1bb0073aea3a4bda100bacf431fd4e3b6d2a (diff) |
Make SurfaceView rendering generic in SysUI
WindowlessWindowManager is not visible as external APIs, so for
launcher / wallpaper to use the API the rendering code has to be in the
SysUI.
Bug: 150224413
Test: Manual. Make sure universal smartspace still works as intended.
Change-Id: If006d622f181f6c8cc7c1cebda3f63b0b2ad85d5
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java')
-rw-r--r-- | packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java index 241f96e19e38..a181ce4b000a 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java @@ -24,9 +24,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; import android.graphics.Color; -import android.graphics.PixelFormat; import android.os.Handler; -import android.os.IBinder; import android.os.RemoteException; import android.os.UserHandle; import android.text.TextUtils; @@ -35,11 +33,7 @@ import android.util.AttributeSet; import android.util.Log; import android.util.Slog; import android.util.TypedValue; -import android.view.SurfaceControl; -import android.view.SurfaceControlViewHost; import android.view.View; -import android.view.WindowManager; -import android.view.WindowlessWindowManager; import android.widget.GridLayout; import android.widget.LinearLayout; import android.widget.TextView; @@ -49,6 +43,7 @@ import androidx.core.graphics.ColorUtils; import com.android.internal.widget.LockPatternUtils; import com.android.systemui.Dependency; import com.android.systemui.R; +import com.android.systemui.shared.system.SurfaceViewRequestReceiver; import com.android.systemui.shared.system.UniversalSmartspaceUtils; import com.android.systemui.statusbar.policy.ConfigurationController; @@ -86,7 +81,6 @@ public class KeyguardStatusView extends GridLayout implements private int mIconTopMargin; private int mIconTopMarginWithHeader; private boolean mShowingHeader; - private SurfaceControlViewHost mUniversalSmartspaceViewHost; private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() { @@ -133,37 +127,20 @@ public class KeyguardStatusView extends GridLayout implements } }; - private BroadcastReceiver mUniversalSmartspaceBroadcastReceiver = new BroadcastReceiver() { + private final BroadcastReceiver mUniversalSmartspaceBroadcastReceiver = + new BroadcastReceiver() { + private final SurfaceViewRequestReceiver mReceiver = new SurfaceViewRequestReceiver(); + @Override public void onReceive(Context context, Intent i) { // TODO(b/148159743): Restrict to Pixel Launcher. if (UniversalSmartspaceUtils.ACTION_REQUEST_SMARTSPACE_VIEW.equals(i.getAction())) { - if (mUniversalSmartspaceViewHost != null) { - mUniversalSmartspaceViewHost.die(); - } - SurfaceControl surfaceControl = UniversalSmartspaceUtils.getSurfaceControl(i); - if (surfaceControl != null) { - IBinder input = UniversalSmartspaceUtils.getInputToken(i); - - WindowlessWindowManager windowlessWindowManager = - new WindowlessWindowManager(context.getResources().getConfiguration(), - surfaceControl, input); - mUniversalSmartspaceViewHost = new SurfaceControlViewHost(context, - context.getDisplayNoVerify(), windowlessWindowManager); - WindowManager.LayoutParams layoutParams = - new WindowManager.LayoutParams( - surfaceControl.getWidth(), - surfaceControl.getHeight(), - WindowManager.LayoutParams.TYPE_APPLICATION, - 0, - PixelFormat.TRANSPARENT); - - mUniversalSmartspaceViewHost.addView( - inflate(context, R.layout.keyguard_status_area, null), layoutParams); - } + mReceiver.onReceive(context, + i.getBundleExtra(UniversalSmartspaceUtils.INTENT_BUNDLE_KEY), + inflate(mContext, R.layout.keyguard_status_area, null)); } } - };; + }; public KeyguardStatusView(Context context) { this(context, null, 0); |