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

Commit 2423c135 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Removing per-user PiP component."

parents 76281019 853c99a0
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -95,8 +95,7 @@ public class SystemUIApplication extends Application implements SysUiServiceProv
     */
    private final Class<?>[] SERVICES_PER_USER = new Class[] {
            Dependency.class,
            Recents.class,
            PipUI.class
            Recents.class
    };

    /**
+7 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.content.pm.PackageManager;
import android.content.res.Configuration;

import com.android.systemui.SystemUI;
import com.android.systemui.recents.misc.SystemServicesProxy;

import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -35,7 +36,6 @@ public class PipUI extends SystemUI {
    private BasePipManager mPipManager;

    private boolean mSupportsPip;
    private boolean mIsLeanBackOnly;

    @Override
    public void start() {
@@ -45,6 +45,12 @@ public class PipUI extends SystemUI {
            return;
        }

        // Ensure that we are the primary user's SystemUI.
        final int processUser = SystemServicesProxy.getInstance(mContext).getProcessUser();
        if (!SystemServicesProxy.getInstance(mContext).isSystemUser(processUser)) {
            throw new IllegalStateException("Non-primary Pip component not currently supported.");
        }

        mPipManager = pm.hasSystemFeature(FEATURE_LEANBACK_ONLY)
                ? com.android.systemui.pip.tv.PipManager.getInstance()
                : com.android.systemui.pip.phone.PipManager.getInstance();
+17 −12
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.pip.phone;

import static com.android.systemui.pip.phone.PipMenuActivityController.EXTRA_ACTIONS;
import static com.android.systemui.pip.phone.PipMenuActivityController.EXTRA_CONTROLLER_MESSENGER;
import static com.android.systemui.pip.phone.PipMenuActivityController.EXTRA_DISMISS_FRACTION;
import static com.android.systemui.pip.phone.PipMenuActivityController.EXTRA_MOVEMENT_BOUNDS;
import static com.android.systemui.pip.phone.PipMenuActivityController.EXTRA_SHOW_MENU;
import static com.android.systemui.pip.phone.PipMenuActivityController.EXTRA_STACK_BOUNDS;
@@ -113,26 +114,31 @@ public class PipMenuActivity extends Activity {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case MESSAGE_SHOW_MENU:
                    Pair<Rect, Rect> bounds = (Pair<Rect, Rect>) msg.obj;
                    showMenu(bounds.first, bounds.second);
                case MESSAGE_SHOW_MENU: {
                    final Bundle data = (Bundle) msg.obj;
                    showMenu(data.getParcelable(EXTRA_STACK_BOUNDS),
                            data.getParcelable(EXTRA_MOVEMENT_BOUNDS));
                    break;
                }
                case MESSAGE_POKE_MENU:
                    cancelDelayedFinish();
                    break;
                case MESSAGE_HIDE_MENU:
                    hideMenu();
                    break;
                case MESSAGE_UPDATE_ACTIONS:
                    Pair<Rect, ParceledListSlice> data = (Pair<Rect, ParceledListSlice>) msg.obj;
                    setActions(data.first, data.second.getList());
                case MESSAGE_UPDATE_ACTIONS: {
                    final Bundle data = (Bundle) msg.obj;
                    setActions(data.getParcelable(EXTRA_STACK_BOUNDS),
                            ((ParceledListSlice) data.getParcelable(EXTRA_ACTIONS)).getList());
                    break;
                case MESSAGE_UPDATE_DISMISS_FRACTION:
                    float fraction = (float) msg.obj;
                    updateDismissFraction(fraction);
                }
                case MESSAGE_UPDATE_DISMISS_FRACTION: {
                    final Bundle data = (Bundle) msg.obj;
                    updateDismissFraction(data.getFloat(EXTRA_DISMISS_FRACTION));
                    break;
                }
            }
        }
    });

    private final Runnable mFinishRunnable = new Runnable() {
@@ -313,9 +319,8 @@ public class PipMenuActivity extends Activity {
            mActions.addAll(actions.getList());
        }
        if (intent.getBooleanExtra(EXTRA_SHOW_MENU, false)) {
            Rect stackBounds = Rect.unflattenFromString(intent.getStringExtra(EXTRA_STACK_BOUNDS));
            Rect movementBounds = Rect.unflattenFromString(intent.getStringExtra(
                    EXTRA_MOVEMENT_BOUNDS));
            Rect stackBounds = intent.getParcelableExtra(EXTRA_STACK_BOUNDS);
            Rect movementBounds = intent.getParcelableExtra(EXTRA_MOVEMENT_BOUNDS);
            showMenu(stackBounds, movementBounds);
        }
    }
+17 −5
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.ParceledListSlice;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.Messenger;
@@ -56,6 +57,7 @@ public class PipMenuActivityController {
    public static final String EXTRA_STACK_BOUNDS = "stack_bounds";
    public static final String EXTRA_MOVEMENT_BOUNDS = "movement_bounds";
    public static final String EXTRA_SHOW_MENU = "show_menu";
    public static final String EXTRA_DISMISS_FRACTION = "dismiss_fraction";

    public static final int MESSAGE_MENU_VISIBILITY_CHANGED = 100;
    public static final int MESSAGE_EXPAND_PIP = 101;
@@ -103,6 +105,8 @@ public class PipMenuActivityController {
    private ParceledListSlice mMediaActions;
    private boolean mMenuVisible;

    private Bundle mTmpData = new Bundle();

    private boolean mStartActivityRequested;
    private Messenger mToActivityMessenger;
    private Messenger mMessenger = new Messenger(new Handler() {
@@ -191,9 +195,11 @@ public class PipMenuActivityController {
     */
    public void setDismissFraction(float fraction) {
        if (mToActivityMessenger != null) {
            mTmpData.clear();
            mTmpData.putFloat(EXTRA_DISMISS_FRACTION, fraction);
            Message m = Message.obtain();
            m.what = PipMenuActivity.MESSAGE_UPDATE_DISMISS_FRACTION;
            m.obj = fraction;
            m.obj = mTmpData;
            try {
                mToActivityMessenger.send(m);
            } catch (RemoteException e) {
@@ -210,9 +216,12 @@ public class PipMenuActivityController {
     */
    public void showMenu(Rect stackBounds, Rect movementBounds) {
        if (mToActivityMessenger != null) {
            mTmpData.clear();
            mTmpData.putParcelable(EXTRA_STACK_BOUNDS, stackBounds);
            mTmpData.putParcelable(EXTRA_MOVEMENT_BOUNDS, movementBounds);
            Message m = Message.obtain();
            m.what = PipMenuActivity.MESSAGE_SHOW_MENU;
            m.obj = new Pair<>(stackBounds, movementBounds);
            m.obj = mTmpData;
            try {
                mToActivityMessenger.send(m);
            } catch (RemoteException e) {
@@ -290,10 +299,10 @@ public class PipMenuActivityController {
                intent.putExtra(EXTRA_CONTROLLER_MESSENGER, mMessenger);
                intent.putExtra(EXTRA_ACTIONS, resolveMenuActions());
                if (stackBounds != null) {
                    intent.putExtra(EXTRA_STACK_BOUNDS, stackBounds.flattenToString());
                    intent.putExtra(EXTRA_STACK_BOUNDS, stackBounds);
                }
                if (movementBounds != null) {
                    intent.putExtra(EXTRA_MOVEMENT_BOUNDS, movementBounds.flattenToString());
                    intent.putExtra(EXTRA_MOVEMENT_BOUNDS, movementBounds);
                }
                intent.putExtra(EXTRA_SHOW_MENU, showMenu);
                ActivityOptions options = ActivityOptions.makeCustomAnimation(mContext, 0, 0);
@@ -327,9 +336,12 @@ public class PipMenuActivityController {
                Log.e(TAG, "Error showing PIP menu activity", e);
            }

            mTmpData.clear();
            mTmpData.putParcelable(EXTRA_STACK_BOUNDS, stackBounds);
            mTmpData.putParcelable(EXTRA_ACTIONS, resolveMenuActions());
            Message m = Message.obtain();
            m.what = PipMenuActivity.MESSAGE_UPDATE_ACTIONS;
            m.obj = new Pair<>(stackBounds, resolveMenuActions());
            m.obj = mTmpData;
            try {
                mToActivityMessenger.send(m);
            } catch (RemoteException e) {
+8 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ import com.android.server.input.InputWindowHandle;

import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Set;
import java.util.function.Consumer;

final class InputMonitor implements InputManagerService.WindowManagerCallbacks {
@@ -583,6 +584,13 @@ final class InputMonitor implements InputManagerService.WindowManagerCallbacks {
        if (mInputFreezeReason != null) {
            pw.println(prefix + "mInputFreezeReason=" + mInputFreezeReason);
        }
        final Set<String> inputConsumerKeys = mInputConsumers.keySet();
        if (!inputConsumerKeys.isEmpty()) {
            pw.println(prefix + "InputConsumers:");
            for (String key : inputConsumerKeys) {
                pw.println(prefix + "  name=" + key);
            }
        }
    }

    private final class UpdateInputForAllWindowsConsumer implements Consumer<WindowState> {