summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/dagger/SystemUIRootComponent.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java29
-rw-r--r--packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuIconsAlgorithm.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/pip/phone/dagger/PipMenuActivityClass.java30
-rw-r--r--packages/SystemUI/src/com/android/systemui/wmshell/WindowManagerShellModule.java10
8 files changed, 76 insertions, 30 deletions
diff --git a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
index 995a3ecde6c1..f4e704ea373e 100644
--- a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
+++ b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
@@ -38,6 +38,8 @@ import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dock.DockManager;
import com.android.systemui.dock.DockManagerImpl;
import com.android.systemui.doze.DozeHost;
+import com.android.systemui.pip.phone.PipMenuActivity;
+import com.android.systemui.pip.phone.dagger.PipMenuActivityClass;
import com.android.systemui.plugins.qs.QSFactory;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.power.EnhancedEstimates;
@@ -142,6 +144,13 @@ public abstract class CarSystemUIModule {
mainHandler, transactionPool).build();
}
+ @Singleton
+ @PipMenuActivityClass
+ @Provides
+ static Class<?> providePipMenuActivityClass() {
+ return PipMenuActivity.class;
+ }
+
@Binds
abstract HeadsUpManager bindHeadsUpManagerPhone(HeadsUpManagerPhone headsUpManagerPhone);
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIRootComponent.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIRootComponent.java
index 900c11f0830e..9fdbb6daca51 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIRootComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIRootComponent.java
@@ -29,7 +29,6 @@ import com.android.systemui.dump.DumpManager;
import com.android.systemui.fragments.FragmentService;
import com.android.systemui.keyguard.KeyguardSliceProvider;
import com.android.systemui.onehanded.dagger.OneHandedModule;
-import com.android.systemui.pip.phone.PipMenuActivity;
import com.android.systemui.pip.phone.dagger.PipModule;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.util.InjectionInflationController;
@@ -133,9 +132,4 @@ public interface SystemUIRootComponent {
* Member injection into the supplied argument.
*/
void inject(KeyguardSliceProvider keyguardSliceProvider);
-
- /**
- * Member injection into the supplied argument.
- */
- void inject(PipMenuActivity pipMenuActivity);
}
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
index e4d057e76079..6e75253d8604 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
@@ -47,6 +47,7 @@ import com.android.systemui.pip.BasePipManager;
import com.android.systemui.pip.PipBoundsHandler;
import com.android.systemui.pip.PipSnapAlgorithm;
import com.android.systemui.pip.PipTaskOrganizer;
+import com.android.systemui.pip.phone.dagger.PipMenuActivityClass;
import com.android.systemui.shared.recents.IPinnedStackAnimationListener;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.InputConsumerController;
@@ -250,6 +251,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
@Inject
public PipManager(Context context, BroadcastDispatcher broadcastDispatcher,
+ @PipMenuActivityClass Class<?> pipMenuActivityClass,
DisplayController displayController,
FloatingContentCoordinator floatingContentCoordinator,
DeviceConfigProxy deviceConfig,
@@ -274,8 +276,8 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
mPipTaskOrganizer.registerPipTransitionCallback(this);
mInputConsumerController = InputConsumerController.getPipInputConsumer();
mMediaController = new PipMediaController(context, mActivityManager, broadcastDispatcher);
- mMenuController = new PipMenuActivityController(context, mMediaController,
- mInputConsumerController);
+ mMenuController = new PipMenuActivityController(context, pipMenuActivityClass,
+ mMediaController, mInputConsumerController);
mTouchHandler = new PipTouchHandler(context, mActivityManager,
mMenuController, mInputConsumerController, mPipBoundsHandler, mPipTaskOrganizer,
floatingContentCoordinator, deviceConfig, pipSnapAlgorithm, sysUiState);
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
index d6f3e163ad70..1b1b2de05883 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
@@ -76,17 +76,15 @@ import android.widget.ImageButton;
import android.widget.LinearLayout;
import com.android.systemui.Interpolators;
-import com.android.systemui.SystemUIFactory;
import com.android.wm.shell.R;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import javax.inject.Inject;
-
/**
* Translucent activity that gets started on top of a task in PIP to allow the user to control it.
+ * TODO(b/150319024): PipMenuActivity will move to a Window
*/
public class PipMenuActivity extends Activity {
@@ -126,19 +124,11 @@ public class PipMenuActivity extends Activity {
private final List<RemoteAction> mActions = new ArrayList<>();
private AccessibilityManager mAccessibilityManager;
- private View mViewRoot;
private Drawable mBackgroundDrawable;
private View mMenuContainer;
private LinearLayout mActionsGroup;
- private View mSettingsButton;
- private View mDismissButton;
- private View mResizeHandle;
- private View mTopEndContainer;
private int mBetweenActionPaddingLand;
- @Inject
- PipMenuIconsAlgorithm mPipMenuIconsAlgorithm;
-
private AnimatorSet mMenuContainerAnimator;
private ValueAnimator.AnimatorUpdateListener mMenuBgUpdateListener =
@@ -193,6 +183,9 @@ public class PipMenuActivity extends Activity {
break;
}
case MESSAGE_MENU_EXPANDED : {
+ if (mMenuContainerAnimator == null) {
+ return;
+ }
mMenuContainerAnimator.setStartDelay(MENU_SHOW_ON_EXPAND_START_DELAY);
mMenuContainerAnimator.start();
break;
@@ -202,6 +195,9 @@ public class PipMenuActivity extends Activity {
break;
}
case MESSAGE_UPDATE_MENU_LAYOUT: {
+ if (mPipMenuIconsAlgorithm == null) {
+ return;
+ }
final Rect bounds = (Rect) msg.obj;
mPipMenuIconsAlgorithm.onBoundsChanged(bounds);
break;
@@ -214,6 +210,13 @@ public class PipMenuActivity extends Activity {
private final Runnable mFinishRunnable = this::hideMenu;
+ protected View mViewRoot;
+ protected View mSettingsButton;
+ protected View mDismissButton;
+ protected View mResizeHandle;
+ protected View mTopEndContainer;
+ protected PipMenuIconsAlgorithm mPipMenuIconsAlgorithm;
+
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
// Set the flags to allow us to watch for outside touches and also hide the menu and start
@@ -222,8 +225,6 @@ public class PipMenuActivity extends Activity {
super.onCreate(savedInstanceState);
- SystemUIFactory.getInstance().getRootComponent().inject(this);
-
setContentView(R.layout.pip_menu_activity);
mAccessibilityManager = getSystemService(AccessibilityManager.class);
@@ -254,7 +255,7 @@ public class PipMenuActivity extends Activity {
mActionsGroup = findViewById(R.id.actions_group);
mBetweenActionPaddingLand = getResources().getDimensionPixelSize(
R.dimen.pip_between_action_padding_land);
-
+ mPipMenuIconsAlgorithm = new PipMenuIconsAlgorithm(this.getApplicationContext());
mPipMenuIconsAlgorithm.bindViews((ViewGroup) mViewRoot, (ViewGroup) mTopEndContainer,
mResizeHandle, mSettingsButton, mDismissButton);
updateFromIntent(getIntent());
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java
index 267c5eacd139..383f6b3bf79d 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java
@@ -110,6 +110,8 @@ public class PipMenuActivityController {
void onPipShowMenu();
}
+ /** TODO(b/150319024): PipMenuActivity will move to a Window */
+ private Class<?> mPipMenuActivityClass;
private Context mContext;
private PipMediaController mMediaController;
private InputConsumerController mInputConsumerController;
@@ -185,11 +187,13 @@ public class PipMenuActivityController {
}
};
- public PipMenuActivityController(Context context,
- PipMediaController mediaController, InputConsumerController inputConsumerController) {
+ public PipMenuActivityController(Context context, Class<?> pipMenuActivityClass,
+ PipMediaController mediaController, InputConsumerController inputConsumerController
+ ) {
mContext = context;
mMediaController = mediaController;
mInputConsumerController = inputConsumerController;
+ mPipMenuActivityClass = pipMenuActivityClass;
}
public boolean isMenuActivityVisible() {
@@ -454,7 +458,7 @@ public class PipMenuActivityController {
WINDOWING_MODE_PINNED, ACTIVITY_TYPE_UNDEFINED);
if (pinnedStackInfo != null && pinnedStackInfo.taskIds != null &&
pinnedStackInfo.taskIds.length > 0) {
- Intent intent = new Intent(mContext, PipMenuActivity.class);
+ Intent intent = new Intent(mContext, mPipMenuActivityClass);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(EXTRA_CONTROLLER_MESSENGER, mMessenger);
intent.putExtra(EXTRA_ACTIONS, resolveMenuActions());
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuIconsAlgorithm.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuIconsAlgorithm.java
index 69a04d8d3e22..6cfed070198b 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuIconsAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuIconsAlgorithm.java
@@ -24,8 +24,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
-import javax.inject.Inject;
-
/**
* Helper class to calculate and place the menu icons on the PIP Menu.
*/
@@ -40,8 +38,7 @@ public class PipMenuIconsAlgorithm {
protected View mSettingsButton;
protected View mDismissButton;
- @Inject
- public PipMenuIconsAlgorithm(Context context) {
+ protected PipMenuIconsAlgorithm(Context context) {
}
/**
@@ -56,7 +53,6 @@ public class PipMenuIconsAlgorithm {
mDismissButton = dismissButton;
}
-
/**
* Updates the position of the drag handle based on where the PIP window is on the screen.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/dagger/PipMenuActivityClass.java b/packages/SystemUI/src/com/android/systemui/pip/phone/dagger/PipMenuActivityClass.java
new file mode 100644
index 000000000000..114c30e625aa
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/dagger/PipMenuActivityClass.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.pip.phone.dagger;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+@Documented
+@Retention(RUNTIME)
+public @interface PipMenuActivityClass {
+}
diff --git a/packages/SystemUI/src/com/android/systemui/wmshell/WindowManagerShellModule.java b/packages/SystemUI/src/com/android/systemui/wmshell/WindowManagerShellModule.java
index 5b2c39db2eae..d2c61cc996dd 100644
--- a/packages/SystemUI/src/com/android/systemui/wmshell/WindowManagerShellModule.java
+++ b/packages/SystemUI/src/com/android/systemui/wmshell/WindowManagerShellModule.java
@@ -21,6 +21,8 @@ import android.os.Handler;
import android.view.IWindowManager;
import com.android.systemui.dagger.qualifiers.Main;
+import com.android.systemui.pip.phone.PipMenuActivity;
+import com.android.systemui.pip.phone.dagger.PipMenuActivityClass;
import com.android.wm.shell.common.DisplayController;
import com.android.wm.shell.common.DisplayImeController;
import com.android.wm.shell.common.SystemWindows;
@@ -65,4 +67,12 @@ public class WindowManagerShellModule {
return new DisplayImeController.Builder(wmService, displayController, mainHandler,
transactionPool).build();
}
+
+ /** TODO(b/150319024): PipMenuActivity will move to a Window */
+ @Singleton
+ @PipMenuActivityClass
+ @Provides
+ static Class<?> providePipMenuActivityClass() {
+ return PipMenuActivity.class;
+ }
}