summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-12-09 23:51:21 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-12-09 23:51:21 +0000
commit6a26ddcafc938c930efe49f7258eca143d16ca4b (patch)
tree804eb8218845a622f74828e760864428d8ef0bf6 /core/java
parent26fea7259f19fc1df04418ca50b389ee7300426d (diff)
parentd69738602a34c995c313f071c2ad30be5924c735 (diff)
Merge "Move WindowControllerCallback methods into a delagate."
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/Activity.java110
1 files changed, 59 insertions, 51 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 6bea68b446a4..577272e38707 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -726,7 +726,7 @@ public class Activity extends ContextThemeWrapper
implements LayoutInflater.Factory2,
Window.Callback, KeyEvent.Callback,
OnCreateContextMenuListener, ComponentCallbacks2,
- Window.OnWindowDismissedCallback, WindowControllerCallback,
+ Window.OnWindowDismissedCallback,
AutofillManager.AutofillClient, ContentCaptureManager.ContentCaptureClient {
private static final String TAG = "Activity";
private static final boolean DEBUG_LIFECYCLE = false;
@@ -938,6 +938,62 @@ public class Activity extends ContextThemeWrapper
private Boolean mLastDispatchedIsInMultiWindowMode;
private Boolean mLastDispatchedIsInPictureInPictureMode;
+ private final WindowControllerCallback mWindowControllerCallback =
+ new WindowControllerCallback() {
+ /**
+ * Moves the activity between {@link WindowConfiguration#WINDOWING_MODE_FREEFORM} windowing
+ * mode and {@link WindowConfiguration#WINDOWING_MODE_FULLSCREEN}.
+ *
+ * @hide
+ */
+ @Override
+ public void toggleFreeformWindowingMode() throws RemoteException {
+ ActivityTaskManager.getService().toggleFreeformWindowingMode(mToken);
+ }
+
+ /**
+ * Puts the activity in picture-in-picture mode if the activity supports.
+ * @see android.R.attr#supportsPictureInPicture
+ * @hide
+ */
+ @Override
+ public void enterPictureInPictureModeIfPossible() {
+ if (mActivityInfo.supportsPictureInPicture()) {
+ enterPictureInPictureMode();
+ }
+ }
+
+ @Override
+ public boolean isTaskRoot() {
+ try {
+ return ActivityTaskManager.getService().getTaskForActivity(mToken, true) >= 0;
+ } catch (RemoteException e) {
+ return false;
+ }
+ }
+
+ /**
+ * Update the forced status bar color.
+ * @hide
+ */
+ @Override
+ public void updateStatusBarColor(int color) {
+ mTaskDescription.setStatusBarColor(color);
+ setTaskDescription(mTaskDescription);
+ }
+
+ /**
+ * Update the forced navigation bar color.
+ * @hide
+ */
+ @Override
+ public void updateNavigationBarColor(int color) {
+ mTaskDescription.setNavigationBarColor(color);
+ setTaskDescription(mTaskDescription);
+ }
+
+ };
+
private static native String getDlWarning();
/** Return the intent that started this activity. */
@@ -3915,49 +3971,6 @@ public class Activity extends ContextThemeWrapper
/**
- * Moves the activity between {@link WindowConfiguration#WINDOWING_MODE_FREEFORM} windowing mode
- * and {@link WindowConfiguration#WINDOWING_MODE_FULLSCREEN}.
- *
- * @hide
- */
- @Override
- public void toggleFreeformWindowingMode() throws RemoteException {
- ActivityTaskManager.getService().toggleFreeformWindowingMode(mToken);
- }
-
- /**
- * Update the forced status bar color.
- * @hide
- */
- @Override
- public void updateStatusBarColor(int color) {
- mTaskDescription.setStatusBarColor(color);
- setTaskDescription(mTaskDescription);
- }
-
- /**
- * Update the forced navigation bar color.
- * @hide
- */
- @Override
- public void updateNavigationBarColor(int color) {
- mTaskDescription.setNavigationBarColor(color);
- setTaskDescription(mTaskDescription);
- }
-
- /**
- * Puts the activity in picture-in-picture mode if the activity supports.
- * @see android.R.attr#supportsPictureInPicture
- * @hide
- */
- @Override
- public void enterPictureInPictureModeIfPossible() {
- if (mActivityInfo.supportsPictureInPicture()) {
- enterPictureInPictureMode();
- }
- }
-
- /**
* Called to process key events. You can override this to intercept all
* key events before they are dispatched to the window. Be sure to call
* this implementation for key events that should be handled normally.
@@ -6603,13 +6616,8 @@ public class Activity extends ContextThemeWrapper
*
* @return True if this is the root activity, else false.
*/
- @Override
public boolean isTaskRoot() {
- try {
- return ActivityTaskManager.getService().getTaskForActivity(mToken, true) >= 0;
- } catch (RemoteException e) {
- return false;
- }
+ return mWindowControllerCallback.isTaskRoot();
}
/**
@@ -7801,7 +7809,7 @@ public class Activity extends ContextThemeWrapper
mFragments.attachHost(null /*parent*/);
mWindow = new PhoneWindow(this, window, activityConfigCallback);
- mWindow.setWindowControllerCallback(this);
+ mWindow.setWindowControllerCallback(mWindowControllerCallback);
mWindow.setCallback(this);
mWindow.setOnWindowDismissedCallback(this);
mWindow.getLayoutInflater().setPrivateFactory(this);