frameworks/base
Revision | c837c92b2873f847c5fe1b66d812b2217a5be143 (tree) |
---|---|
Zeit | 2020-07-08 00:40:06 |
Autor | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Chih-Wei Huang |
Merge branch 'boringdroid-x86-9.0.0' of https://github.com/boringdroid/platform_frameworks_base into pie-x86
@@ -113705,6 +113705,8 @@ Lcom/android/internal/R$drawable;->decor_close_button_dark:I | ||
113705 | 113705 | Lcom/android/internal/R$drawable;->decor_close_button_light:I |
113706 | 113706 | Lcom/android/internal/R$drawable;->decor_maximize_button_dark:I |
113707 | 113707 | Lcom/android/internal/R$drawable;->decor_maximize_button_light:I |
113708 | +Lcom/android/internal/R$drawable;->decor_back_button_dark:I | |
113709 | +Lcom/android/internal/R$drawable;->decor_back_button_light:I | |
113708 | 113710 | Lcom/android/internal/R$drawable;->default_lock_wallpaper:I |
113709 | 113711 | Lcom/android/internal/R$drawable;->default_wallpaper:I |
113710 | 113712 | Lcom/android/internal/R$drawable;->dialog_frame:I |
@@ -331,8 +331,17 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame | ||
331 | 331 | |
332 | 332 | // Since the surface is spanning the entire screen, we have to add the start offset of |
333 | 333 | // the bounds to get to the surface location. |
334 | - final int left = mLastXOffset + newBounds.left; | |
335 | - final int top = mLastYOffset + newBounds.top; | |
334 | + // region @boringdroid | |
335 | + // In FrameBuilder.cpp, the system will calculate the distance between content | |
336 | + // drawing bound and back drop frame bounds, and translate content drawing bounds | |
337 | + // to back drop left and top position to draw it, what will cause another content | |
338 | + // jumps. So we should keep the left and top position with content drawing bounds | |
339 | + // to avoid another part content jumps. | |
340 | + // final int left = mLastXOffset + newBounds.left; | |
341 | + // final int top = mLastYOffset + newBounds.top; | |
342 | + final int left = mLastXOffset; | |
343 | + final int top = mLastYOffset; | |
344 | + // endregion | |
336 | 345 | final int width = newBounds.width(); |
337 | 346 | final int height = newBounds.height(); |
338 | 347 |
@@ -1994,7 +1994,12 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind | ||
1994 | 1994 | } |
1995 | 1995 | |
1996 | 1996 | private void setLightDecorCaptionShade(DecorCaptionView view) { |
1997 | - view.findViewById(R.id.pip_window).setBackgroundResource( | |
1997 | + // region @boringdroid | |
1998 | + view.findViewById(R.id.back_window).setBackgroundResource( | |
1999 | + R.drawable.decor_back_button_light | |
2000 | + ); | |
2001 | + // endregion | |
2002 | + view.findViewById(R.id.pip_window).setBackgroundResource( | |
1998 | 2003 | R.drawable.decor_pip_button_light); |
1999 | 2004 | view.findViewById(R.id.minimize_window).setBackgroundResource( |
2000 | 2005 | R.drawable.decor_minimize_button_light); |
@@ -2005,6 +2010,11 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind | ||
2005 | 2010 | } |
2006 | 2011 | |
2007 | 2012 | private void setDarkDecorCaptionShade(DecorCaptionView view) { |
2013 | + // region @boringdroid | |
2014 | + view.findViewById(R.id.back_window).setBackgroundResource( | |
2015 | + R.drawable.decor_back_button_dark | |
2016 | + ); | |
2017 | + // endregion | |
2008 | 2018 | view.findViewById(R.id.pip_window).setBackgroundResource( |
2009 | 2019 | R.drawable.decor_pip_button_dark); |
2010 | 2020 | view.findViewById(R.id.minimize_window).setBackgroundResource( |
@@ -2231,6 +2241,12 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind | ||
2231 | 2241 | mElevationAdjustedForStack = false; |
2232 | 2242 | } |
2233 | 2243 | |
2244 | + // region @boringdroid | |
2245 | + if ((windowingMode == WINDOWING_MODE_FREEFORM) && isResizing()) { | |
2246 | + elevation = dipToPx(DECOR_SHADOW_FOCUSED_HEIGHT_IN_DIP); | |
2247 | + mElevationAdjustedForStack = true; | |
2248 | + } | |
2249 | + // endregion | |
2234 | 2250 | // Don't change the elevation if we didn't previously adjust it for the stack it was in |
2235 | 2251 | // or it didn't change. |
2236 | 2252 | if ((wasAdjustedForStack || mElevationAdjustedForStack) |
@@ -16,6 +16,7 @@ | ||
16 | 16 | |
17 | 17 | package com.android.internal.widget; |
18 | 18 | |
19 | +import android.app.Activity; | |
19 | 20 | import android.content.Context; |
20 | 21 | import android.graphics.Color; |
21 | 22 | import android.graphics.Rect; |
@@ -107,6 +108,10 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener, | ||
107 | 108 | private final Rect mMinimizeRect = new Rect(); |
108 | 109 | private final Rect mPipRect = new Rect(); |
109 | 110 | private View mClickTarget; |
111 | + // region @boringdroid | |
112 | + private View mBack; | |
113 | + private final Rect mBackRect = new Rect(); | |
114 | + // endregion | |
110 | 115 | |
111 | 116 | public DecorCaptionView(Context context) { |
112 | 117 | super(context); |
@@ -147,6 +152,9 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener, | ||
147 | 152 | // By changing the outline provider to BOUNDS, the window can remove its |
148 | 153 | // background without removing the shadow. |
149 | 154 | mOwner.getDecorView().setOutlineProvider(ViewOutlineProvider.BOUNDS); |
155 | + // region @boringdroid | |
156 | + mBack = findViewById(R.id.back_window); | |
157 | + // endregion | |
150 | 158 | mPip = findViewById(R.id.pip_window); |
151 | 159 | mMinimize = findViewById(R.id.minimize_window); |
152 | 160 | mMaximize = findViewById(R.id.maximize_window); |
@@ -160,6 +168,11 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener, | ||
160 | 168 | if (ev.getAction() == MotionEvent.ACTION_DOWN) { |
161 | 169 | final int x = (int) ev.getX(); |
162 | 170 | final int y = (int) ev.getY(); |
171 | + // region @boringdroid | |
172 | + if (mBackRect.contains(x, y)) { | |
173 | + mClickTarget = mBack; | |
174 | + } | |
175 | + // endregion | |
163 | 176 | // Only offset y for containment tests because the actual views are already translated. |
164 | 177 | if (mPipRect.contains(x, y)) { |
165 | 178 | mClickTarget = mPip; |
@@ -311,12 +324,18 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener, | ||
311 | 324 | if (mCaption.getVisibility() != View.GONE) { |
312 | 325 | mCaption.layout(0, 0, mCaption.getMeasuredWidth(), mCaption.getMeasuredHeight()); |
313 | 326 | captionHeight = mCaption.getBottom() - mCaption.getTop(); |
327 | + // region @boringdroid | |
328 | + mBack.getHitRect(mBackRect); | |
329 | + // endregion | |
314 | 330 | mPip.getHitRect(mPipRect); |
315 | 331 | mMinimize.getHitRect(mMinimizeRect); |
316 | 332 | mMaximize.getHitRect(mMaximizeRect); |
317 | 333 | mClose.getHitRect(mCloseRect); |
318 | 334 | } else { |
319 | 335 | captionHeight = 0; |
336 | + // region @boringdroid | |
337 | + mBackRect.setEmpty(); | |
338 | + // endregion | |
320 | 339 | mPipRect.setEmpty(); |
321 | 340 | mMinimizeRect.setEmpty(); |
322 | 341 | mMaximizeRect.setEmpty(); |
@@ -333,8 +352,12 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener, | ||
333 | 352 | } |
334 | 353 | |
335 | 354 | // This assumes that the caption bar is at the top. |
336 | - mOwner.notifyRestrictedCaptionAreaCallback(mPip.getLeft(), mMaximize.getTop(), | |
355 | + // region @boringdroid | |
356 | + // mOwner.notifyRestrictedCaptionAreaCallback(mPip.getLeft(), mMaximize.getTop(), | |
357 | + // mClose.getRight(), mClose.getBottom()); | |
358 | + mOwner.notifyRestrictedCaptionAreaCallback(mBack.getLeft(), mBack.getTop(), | |
337 | 359 | mClose.getRight(), mClose.getBottom()); |
360 | + // endregion | |
338 | 361 | } |
339 | 362 | /** |
340 | 363 | * Determine if the workspace is entirely covered by the window. |
@@ -351,7 +374,14 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener, | ||
351 | 374 | **/ |
352 | 375 | private void updateCaptionVisibility() { |
353 | 376 | // Don't show the caption if the window has e.g. entered full screen. |
354 | - boolean invisible = isFillingScreen() || !mShow; | |
377 | + // region @boringdroid | |
378 | + // If mShow is true, the window is in freeform window, because only freeform | |
379 | + // window can show decor caption. In freeform window mode, we should ignore | |
380 | + // system ui visibility. If we consider it, the decor caption will dismiss | |
381 | + // if we resize window with fullscreen system ui visibility, such as Clock. | |
382 | + // boolean invisible = isFillingScreen() || !mShow; | |
383 | + boolean invisible = !mShow; | |
384 | + // endregion | |
355 | 385 | mCaption.setVisibility(invisible ? GONE : VISIBLE); |
356 | 386 | mCaption.setOnTouchListener(this); |
357 | 387 | } |
@@ -436,6 +466,16 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener, | ||
436 | 466 | |
437 | 467 | @Override |
438 | 468 | public boolean onSingleTapUp(MotionEvent e) { |
469 | + // region @boringdroid | |
470 | + if (mClickTarget == mBack) { | |
471 | + Window.WindowControllerCallback callback = mOwner.getWindowControllerCallback(); | |
472 | + if (callback instanceof Activity) { | |
473 | + Activity activity = (Activity) callback; | |
474 | + activity.onBackPressed(); | |
475 | + } | |
476 | + return true; | |
477 | + } | |
478 | + // endregion | |
439 | 479 | if (mClickTarget == mMinimize) { |
440 | 480 | minimizeWindow(); |
441 | 481 | } else if (mClickTarget == mPip) { |
@@ -0,0 +1,34 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<!-- Copyright (C) 2015 The Android Open Source Project | |
3 | + Copyright (C) 2020 boringdroid | |
4 | + | |
5 | + Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | + you may not use this file except in compliance with the License. | |
7 | + You may obtain a copy of the License at | |
8 | + | |
9 | + http://www.apache.org/licenses/LICENSE-2.0 | |
10 | + | |
11 | + Unless required by applicable law or agreed to in writing, software | |
12 | + distributed under the License is distributed on an "AS IS" BASIS, | |
13 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | + See the License for the specific language governing permissions and | |
15 | + limitations under the License. | |
16 | +--> | |
17 | + | |
18 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
19 | + android:width="32.0dp" | |
20 | + android:height="32.0dp" | |
21 | + android:viewportWidth="32.0" | |
22 | + android:viewportHeight="32.0" | |
23 | + android:tint="@color/decor_button_dark_color"> | |
24 | + <group android:scaleX="0.5" | |
25 | + android:scaleY="0.5" | |
26 | + android:translateX="8.0" | |
27 | + android:translateY="8.0"> | |
28 | + <path | |
29 | + android:fillColor="@color/white" | |
30 | + android:pathData="M2.0,16.0l28.0,14.0l0.0,-28z" /> | |
31 | + </group> | |
32 | +</vector> | |
33 | + | |
34 | + |
@@ -0,0 +1,31 @@ | ||
1 | +<!-- Copyright (C) 2015 The Android Open Source Project | |
2 | + Copyright (C) boringdroid | |
3 | + | |
4 | + Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | + you may not use this file except in compliance with the License. | |
6 | + You may obtain a copy of the License at | |
7 | + | |
8 | + http://www.apache.org/licenses/LICENSE-2.0 | |
9 | + | |
10 | + Unless required by applicable law or agreed to in writing, software | |
11 | + distributed under the License is distributed on an "AS IS" BASIS, | |
12 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | + See the License for the specific language governing permissions and | |
14 | + limitations under the License. | |
15 | +--> | |
16 | + | |
17 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
18 | + android:width="32.0dp" | |
19 | + android:height="32.0dp" | |
20 | + android:viewportWidth="32.0" | |
21 | + android:viewportHeight="32.0" | |
22 | + android:tint="@color/decor_button_light_color"> | |
23 | + <group android:scaleX="0.5" | |
24 | + android:scaleY="0.5" | |
25 | + android:translateX="8.0" | |
26 | + android:translateY="8.0"> | |
27 | + <path | |
28 | + android:fillColor="@color/white" | |
29 | + android:pathData="M2.0,16.0l28.0,14.0l0.0,-28z" /> | |
30 | + </group> | |
31 | +</vector> |
@@ -143,6 +143,10 @@ | ||
143 | 143 | <item>@drawable/decor_minimize_button_light</item> |
144 | 144 | <item>@drawable/decor_pip_button_dark</item> |
145 | 145 | <item>@drawable/decor_pip_button_light</item> |
146 | + <!-- region @boringdroid --> | |
147 | + <item>@drawable/decor_back_button_dark</item> | |
148 | + <item>@drawable/decor_back_button_light</item> | |
149 | + <!-- endregion --> | |
146 | 150 | </array> |
147 | 151 | |
148 | 152 | <!-- Used in LocalePicker --> |
@@ -4671,6 +4671,9 @@ | ||
4671 | 4671 | <string name="floating_toolbar_close_overflow_description">Close overflow</string> |
4672 | 4672 | |
4673 | 4673 | <!-- Free style window strings --> |
4674 | + <!-- region @boringdroid --> | |
4675 | + <string name="back_button_text">Back</string> | |
4676 | + <!-- endregion --> | |
4674 | 4677 | <!-- Accessibility text for the minimize window button --> |
4675 | 4678 | <string name="pip_button_text">Picture In Picture</string> |
4676 | 4679 | <!-- Accessibility text for the minimize window button --> |
@@ -2237,6 +2237,11 @@ | ||
2237 | 2237 | <java-symbol type="drawable" name="decor_maximize_button_light" /> |
2238 | 2238 | <java-symbol type="drawable" name="decor_pip_button_dark" /> |
2239 | 2239 | <java-symbol type="drawable" name="decor_pip_button_light" /> |
2240 | + <!-- region @boringdroid --> | |
2241 | + <java-symbol type="id" name="back_window" /> | |
2242 | + <java-symbol type="drawable" name="decor_back_button_dark" /> | |
2243 | + <java-symbol type="drawable" name="decor_back_button_light" /> | |
2244 | + <!-- endregion --> | |
2240 | 2245 | <java-symbol type="color" name="decor_button_dark_color" /> |
2241 | 2246 | <java-symbol type="color" name="decor_button_light_color" /> |
2242 | 2247 |
@@ -49,7 +49,13 @@ public class ActivityLaunchParamsModifier implements LaunchParamsModifier { | ||
49 | 49 | return RESULT_SKIP; |
50 | 50 | } |
51 | 51 | |
52 | - final Rect bounds = options.getLaunchBounds(); | |
52 | + // region @boringdroid | |
53 | + // Leave window bounds to wms/ams, and ignore launch bounds from starter. | |
54 | + // The starter doesn't know the current window bounds after resizing, so launch | |
55 | + // bounds will reset freeform window bounds to the default state. | |
56 | + // final Rect bounds = options.getLaunchBounds(); | |
57 | + final Rect bounds = null; | |
58 | + // endregion | |
53 | 59 | |
54 | 60 | // Bounds weren't valid. |
55 | 61 | if (bounds == null || bounds.isEmpty()) { |
@@ -620,6 +620,15 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai | ||
620 | 620 | } |
621 | 621 | } |
622 | 622 | |
623 | + // region @boringdroid | |
624 | + // Current logic, if we change windowing mode from freeform to fullscreen, getOverrideBounds() will | |
625 | + // return empty, the same as mTmpRect2, which doesn't trigger resize for window. So if current mode | |
626 | + // is freeform, and new mode is fullscreen, we should resize window forcibly to avoid rigid | |
627 | + // rendering problem. | |
628 | + if (mTmpRect2.isEmpty() && currentMode == WINDOWING_MODE_FREEFORM) { | |
629 | + resize(mTmpRect2, null /* tempTaskBounds */, null /* tempTaskInsetBounds */); | |
630 | + } | |
631 | + // endregion | |
623 | 632 | if (!Objects.equals(getOverrideBounds(), mTmpRect2)) { |
624 | 633 | resize(mTmpRect2, null /* tempTaskBounds */, null /* tempTaskInsetBounds */); |
625 | 634 | } |
@@ -92,6 +92,13 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier { | ||
92 | 92 | final Rect resultBounds = outParams.mBounds; |
93 | 93 | |
94 | 94 | if (layout == null) { |
95 | + // region @boringdroid | |
96 | + // For freeform window, we should use its launch bounds instead of recauclate its bounds. | |
97 | + if (task.inFreeformWindowingMode()) { | |
98 | + task.updateOverrideConfiguration(task.getLaunchBounds()); | |
99 | + return RESULT_CONTINUE; | |
100 | + } | |
101 | + // endregion | |
95 | 102 | positionCenter(tasks, mAvailableRect, getFreeformWidth(mAvailableRect), |
96 | 103 | getFreeformHeight(mAvailableRect), resultBounds); |
97 | 104 | return RESULT_CONTINUE; |
@@ -118,6 +125,13 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier { | ||
118 | 125 | // center. |
119 | 126 | Slog.w(TAG, "Received unsupported gravity: " + layout.gravity |
120 | 127 | + ", positioning in the center instead."); |
128 | + // region @boringdroid | |
129 | + // For freeform window, we should use its launch bounds instead of recauclate its bounds. | |
130 | + if (task.inFreeformWindowingMode()) { | |
131 | + task.updateOverrideConfiguration(task.getLaunchBounds()); | |
132 | + return RESULT_CONTINUE; | |
133 | + } | |
134 | + // endregion | |
121 | 135 | positionCenter(tasks, mAvailableRect, width, height, resultBounds); |
122 | 136 | } |
123 | 137 |
@@ -548,6 +548,10 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi | ||
548 | 548 | } |
549 | 549 | } |
550 | 550 | mWindowContainerController.resize(kept, forced); |
551 | + // region @boringdroid | |
552 | + // After window resizes its bounds(real resize and move), we should save the window bounds. | |
553 | + saveTaskBounds(); | |
554 | + // endregion | |
551 | 555 | |
552 | 556 | Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER); |
553 | 557 | return kept; |
@@ -559,7 +563,31 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi | ||
559 | 563 | // TODO: Investigate combining with the resize() method above. |
560 | 564 | void resizeWindowContainer() { |
561 | 565 | mWindowContainerController.resize(false /* relayout */, false /* forced */); |
566 | + // region @boringdroid | |
567 | + // After window resizes its bounds(real resize and move), we should save the window bounds. | |
568 | + saveTaskBounds(); | |
569 | + // endregion | |
570 | + } | |
571 | + // region @boringdroid | |
572 | + private void saveTaskBounds() { | |
573 | + Rect savedBounds = new Rect(); | |
574 | + mWindowContainerController.getBounds(savedBounds); | |
575 | + String packageName = null; | |
576 | + if (realActivity != null) { | |
577 | + packageName = realActivity.getPackageName(); | |
578 | + } else if (getRootActivity() != null) { | |
579 | + packageName = getRootActivity().packageName; | |
580 | + } | |
581 | + if (mStack != null | |
582 | + && mStack.getWindowingMode() == WINDOWING_MODE_FREEFORM | |
583 | + && !savedBounds.isEmpty() | |
584 | + && packageName != null) { | |
585 | + WindowManagerService | |
586 | + .getWMSInstance() | |
587 | + .savePackageWindowBounds(packageName, savedBounds); | |
588 | + } | |
562 | 589 | } |
590 | + // endregion | |
563 | 591 | |
564 | 592 | void getWindowContainerBounds(Rect bounds) { |
565 | 593 | mWindowContainerController.getBounds(bounds); |
@@ -1895,6 +1923,32 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi | ||
1895 | 1923 | } else if (!getWindowConfiguration().persistTaskBounds()) { |
1896 | 1924 | return mStack.getOverrideBounds(); |
1897 | 1925 | } |
1926 | + // region @boringdroid | |
1927 | + if (mLastNonFullscreenBounds == null) { | |
1928 | + String packageName = null; | |
1929 | + if (realActivity != null) { | |
1930 | + packageName = realActivity.getPackageName(); | |
1931 | + } else if (getRootActivity() != null) { | |
1932 | + packageName = getRootActivity().packageName; | |
1933 | + } | |
1934 | + mLastNonFullscreenBounds = | |
1935 | + packageName != null ? | |
1936 | + WindowManagerService | |
1937 | + .getWMSInstance() | |
1938 | + .getPackageWindowBounds(packageName) | |
1939 | + : new Rect(); | |
1940 | + if (!mLastNonFullscreenBounds.isEmpty()) { | |
1941 | + return mLastNonFullscreenBounds; | |
1942 | + } | |
1943 | + getParent().getBounds(mLastNonFullscreenBounds); | |
1944 | + int width = mLastNonFullscreenBounds.width() / 2; | |
1945 | + int height = mLastNonFullscreenBounds.height() / 2; | |
1946 | + int left = mLastNonFullscreenBounds.left + width / 2; | |
1947 | + int top = mLastNonFullscreenBounds.top + height / 2; | |
1948 | + mLastNonFullscreenBounds.set(left, top , left + width, top + height); | |
1949 | + adjustForMinimalTaskDimensions(mLastNonFullscreenBounds); | |
1950 | + } | |
1951 | + // endregion | |
1898 | 1952 | return mLastNonFullscreenBounds; |
1899 | 1953 | } |
1900 | 1954 |
@@ -104,6 +104,22 @@ public class TaskTapPointerEventListener implements PointerEventListener { | ||
104 | 104 | } |
105 | 105 | } |
106 | 106 | break; |
107 | + | |
108 | + // region @boringdroid | |
109 | + // We should reset pointer icon type when hover exit task. If we start freeform | |
110 | + // window from Taskbar, and move pointer to resize region, the pointer type will | |
111 | + // change to TYPE_*_DOUBLE_ARROW, but when we move pointer outer freeform window | |
112 | + // resize region, the pointer type will keep to TYPE_*_DOUBLE_ARROW. The reset | |
113 | + // operation will help to fix this problem. | |
114 | + case MotionEvent.ACTION_HOVER_EXIT: { | |
115 | + mPointerIconType = TYPE_NOT_SPECIFIED; | |
116 | + final int x = (int) motionEvent.getX(); | |
117 | + final int y = (int) motionEvent.getY(); | |
118 | + mService.mH.obtainMessage(H.RESTORE_POINTER_ICON, | |
119 | + x, y, mDisplayContent).sendToTarget(); | |
120 | + } | |
121 | + break; | |
122 | + // endregion | |
107 | 123 | } |
108 | 124 | } |
109 | 125 |
@@ -126,6 +126,7 @@ import android.content.ContentResolver; | ||
126 | 126 | import android.content.Context; |
127 | 127 | import android.content.Intent; |
128 | 128 | import android.content.IntentFilter; |
129 | +import android.content.SharedPreferences; | |
129 | 130 | import android.content.pm.ApplicationInfo; |
130 | 131 | import android.content.pm.PackageManager; |
131 | 132 | import android.content.pm.PackageManagerInternal; |
@@ -148,6 +149,7 @@ import android.os.Binder; | ||
148 | 149 | import android.os.Build; |
149 | 150 | import android.os.Bundle; |
150 | 151 | import android.os.Debug; |
152 | +import android.os.Environment; | |
151 | 153 | import android.os.Handler; |
152 | 154 | import android.os.IBinder; |
153 | 155 | import android.os.IRemoteCallback; |
@@ -169,6 +171,7 @@ import android.os.SystemProperties; | ||
169 | 171 | import android.os.SystemService; |
170 | 172 | import android.os.Trace; |
171 | 173 | import android.os.UserHandle; |
174 | +import android.os.UserManager; | |
172 | 175 | import android.os.WorkSource; |
173 | 176 | import android.provider.Settings; |
174 | 177 | import android.text.format.DateUtils; |
@@ -7601,4 +7604,66 @@ public class WindowManagerService extends IWindowManager.Stub | ||
7601 | 7604 | } |
7602 | 7605 | } |
7603 | 7606 | } |
7607 | + // region @boringdroid | |
7608 | + private static final String PACKAGE_WINDOW_BOUNDS_NAME = "package-window-bounds"; | |
7609 | + | |
7610 | + private static boolean isDataSystemDirNotReady(Context context) { | |
7611 | + UserManager userManager = context.getSystemService(UserManager.class); | |
7612 | + return !(userManager != null && userManager.isUserUnlockingOrUnlocked(UserHandle.myUserId())); | |
7613 | + } | |
7614 | + | |
7615 | + private static File getPackageWindowBoundsName() { | |
7616 | + return new File( | |
7617 | + Environment.getDataSystemCeDirectory(UserHandle.myUserId()) | |
7618 | + + File.separator + PACKAGE_WINDOW_BOUNDS_NAME | |
7619 | + ); | |
7620 | + } | |
7621 | + | |
7622 | + /** | |
7623 | + * @hide | |
7624 | + */ | |
7625 | + public static WindowManagerService getWMSInstance() { | |
7626 | + return getInstance(); | |
7627 | + } | |
7628 | + | |
7629 | + /** | |
7630 | + * @hide | |
7631 | + */ | |
7632 | + public void savePackageWindowBounds(String packageName, Rect bounds) { | |
7633 | + if (isDataSystemDirNotReady(mContext)) { | |
7634 | + Slog.e(TAG, "Calling savePackageWindowBounds with package " + packageName | |
7635 | + + ", and bounds " + bounds + ", before file is ready"); | |
7636 | + return; | |
7637 | + } | |
7638 | + SharedPreferences sharedPreferences = | |
7639 | + mContext.getSharedPreferences(getPackageWindowBoundsName(), Context.MODE_PRIVATE); | |
7640 | + Rect tempBounds = new Rect(bounds); | |
7641 | + sharedPreferences | |
7642 | + .edit() | |
7643 | + .putInt(packageName + "-left", tempBounds.left) | |
7644 | + .putInt(packageName + "-top", tempBounds.top) | |
7645 | + .putInt(packageName + "-right", tempBounds.right) | |
7646 | + .putInt(packageName + "-bottom", tempBounds.bottom) | |
7647 | + .apply(); | |
7648 | + } | |
7649 | + | |
7650 | + /** | |
7651 | + * @hide | |
7652 | + */ | |
7653 | + public Rect getPackageWindowBounds(String packageName) { | |
7654 | + if (isDataSystemDirNotReady(mContext)) { | |
7655 | + Slog.e(TAG, "Calling getPackageWindowBounds with package " + packageName | |
7656 | + + ", before file is ready"); | |
7657 | + return new Rect(); | |
7658 | + } | |
7659 | + SharedPreferences sharedPreferences = | |
7660 | + mContext.getSharedPreferences(getPackageWindowBoundsName(), Context.MODE_PRIVATE); | |
7661 | + return new Rect( | |
7662 | + sharedPreferences.getInt(packageName + "-left", 0), | |
7663 | + sharedPreferences.getInt(packageName + "-top", 0), | |
7664 | + sharedPreferences.getInt(packageName + "-right", 0), | |
7665 | + sharedPreferences.getInt(packageName + "-bottom", 0) | |
7666 | + ); | |
7667 | + } | |
7668 | + // endregion | |
7604 | 7669 | } |
@@ -798,6 +798,11 @@ class WindowStateAnimator { | ||
798 | 798 | return false; |
799 | 799 | } |
800 | 800 | |
801 | + // region @boringdroid | |
802 | + if (w.inFreeformWindowingMode()) { | |
803 | + return false; | |
804 | + } | |
805 | + // endregion | |
801 | 806 | // If we're animating, the wallpaper should only |
802 | 807 | // be updated at the end of the animation. |
803 | 808 | if (w.mAttrs.type == TYPE_WALLPAPER) { |