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

Commit c43a9482 authored by Dave Mankoff's avatar Dave Mankoff Committed by Android (Google) Code Review
Browse files

Merge "Provide PipManager through injection."

parents f20b2ecd f5019144
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import com.android.systemui.dagger.DependencyProvider;
import com.android.systemui.dagger.SystemServicesModule;
import com.android.systemui.dagger.SystemUIModule;
import com.android.systemui.dagger.SystemUIRootComponent;
import com.android.systemui.pip.phone.dagger.PipModule;

import javax.inject.Singleton;

@@ -32,6 +33,7 @@ import dagger.Component;
                CarComponentBinder.class,
                DependencyProvider.class,
                DependencyBinder.class,
                PipModule.class,
                SystemUIFactory.ContextHolder.class,
                SystemServicesModule.class,
                SystemUIModule.class,
+3 −2
Original line number Diff line number Diff line
@@ -21,8 +21,9 @@
     for different hardware and product builds. -->
<resources>
    <!-- SystemUIFactory component -->
    <string name="config_systemUIFactoryComponent" translatable="false">com.android.systemui.tv.TvSystemUIFactory</string>

    <string name="config_systemUIFactoryComponent" translatable="false">
        com.android.systemui.tv.TvSystemUIFactory
    </string>
    <!-- SystemUI Services: The classes of the stuff to start. -->
    <string-array name="config_systemUIServiceComponents" translatable="false">
        <item>com.android.systemui.util.NotificationChannels</item>
+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import com.android.systemui.SystemUIAppComponentFactory;
import com.android.systemui.SystemUIFactory;
import com.android.systemui.fragments.FragmentService;
import com.android.systemui.keyguard.KeyguardSliceProvider;
import com.android.systemui.pip.phone.dagger.PipModule;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.util.InjectionInflationController;

@@ -43,6 +44,7 @@ import dagger.Component;
        DefaultComponentBinder.class,
        DependencyProvider.class,
        DependencyBinder.class,
        PipModule.class,
        SystemServicesModule.class,
        SystemUIFactory.ContextHolder.class,
        SystemUIBinder.class,
+0 −6
Original line number Diff line number Diff line
@@ -16,17 +16,11 @@

package com.android.systemui.pip;

import android.content.Context;
import android.content.res.Configuration;

import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.wm.DisplayController;

import java.io.PrintWriter;

public interface BasePipManager {
    void initialize(Context context, BroadcastDispatcher broadcastDispatcher,
            DisplayController displayController);
    void showPictureInPictureMenu();
    default void expandPip() {}
    default void hidePipMenu(Runnable onStartCallback, Runnable onEndCallback) {}
+4 −17
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.systemui.pip;

import static android.content.pm.PackageManager.FEATURE_LEANBACK_ONLY;
import static android.content.pm.PackageManager.FEATURE_PICTURE_IN_PICTURE;

import android.content.Context;
@@ -26,9 +25,7 @@ import android.os.UserHandle;
import android.os.UserManager;

import com.android.systemui.SystemUI;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.wm.DisplayController;

import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -44,25 +41,20 @@ public class PipUI extends SystemUI implements CommandQueue.Callbacks {

    private final CommandQueue mCommandQueue;
    private BasePipManager mPipManager;
    private final BroadcastDispatcher mBroadcastDispatcher;
    private final DisplayController mDisplayController;
    private boolean mSupportsPip;

    @Inject
    public PipUI(Context context, CommandQueue commandQueue,
            BroadcastDispatcher broadcastDispatcher,
            DisplayController displayController) {
            BasePipManager pipManager) {
        super(context);
        mBroadcastDispatcher = broadcastDispatcher;
        mCommandQueue = commandQueue;
        mDisplayController = displayController;
        mPipManager = pipManager;
    }

    @Override
    public void start() {
        PackageManager pm = mContext.getPackageManager();
        mSupportsPip = pm.hasSystemFeature(FEATURE_PICTURE_IN_PICTURE);
        if (!mSupportsPip) {
        boolean supportsPip = pm.hasSystemFeature(FEATURE_PICTURE_IN_PICTURE);
        if (!supportsPip) {
            return;
        }

@@ -72,11 +64,6 @@ public class PipUI extends SystemUI implements CommandQueue.Callbacks {
            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();
        mPipManager.initialize(mContext, mBroadcastDispatcher, mDisplayController);

        mCommandQueue.addCallback(this);
    }

Loading