Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

frameworks-base: Commit

frameworks/base


Commit MetaInfo

Revisionc837c92b2873f847c5fe1b66d812b2217a5be143 (tree)
Time2020-07-08 00:40:06
AuthorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

Merge branch 'boringdroid-x86-9.0.0' of https://github.com/boringdroid/platform_frameworks_base into pie-x86

Change Summary

Incremental Difference

--- a/config/hiddenapi-private-dex.txt
+++ b/config/hiddenapi-private-dex.txt
@@ -113705,6 +113705,8 @@ Lcom/android/internal/R$drawable;->decor_close_button_dark:I
113705113705 Lcom/android/internal/R$drawable;->decor_close_button_light:I
113706113706 Lcom/android/internal/R$drawable;->decor_maximize_button_dark:I
113707113707 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
113708113710 Lcom/android/internal/R$drawable;->default_lock_wallpaper:I
113709113711 Lcom/android/internal/R$drawable;->default_wallpaper:I
113710113712 Lcom/android/internal/R$drawable;->dialog_frame:I
--- a/core/java/com/android/internal/policy/BackdropFrameRenderer.java
+++ b/core/java/com/android/internal/policy/BackdropFrameRenderer.java
@@ -331,8 +331,17 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
331331
332332 // Since the surface is spanning the entire screen, we have to add the start offset of
333333 // 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
336345 final int width = newBounds.width();
337346 final int height = newBounds.height();
338347
--- a/core/java/com/android/internal/policy/DecorView.java
+++ b/core/java/com/android/internal/policy/DecorView.java
@@ -1994,7 +1994,12 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
19941994 }
19951995
19961996 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(
19982003 R.drawable.decor_pip_button_light);
19992004 view.findViewById(R.id.minimize_window).setBackgroundResource(
20002005 R.drawable.decor_minimize_button_light);
@@ -2005,6 +2010,11 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
20052010 }
20062011
20072012 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
20082018 view.findViewById(R.id.pip_window).setBackgroundResource(
20092019 R.drawable.decor_pip_button_dark);
20102020 view.findViewById(R.id.minimize_window).setBackgroundResource(
@@ -2231,6 +2241,12 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
22312241 mElevationAdjustedForStack = false;
22322242 }
22332243
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
22342250 // Don't change the elevation if we didn't previously adjust it for the stack it was in
22352251 // or it didn't change.
22362252 if ((wasAdjustedForStack || mElevationAdjustedForStack)
--- a/core/java/com/android/internal/widget/DecorCaptionView.java
+++ b/core/java/com/android/internal/widget/DecorCaptionView.java
@@ -16,6 +16,7 @@
1616
1717 package com.android.internal.widget;
1818
19+import android.app.Activity;
1920 import android.content.Context;
2021 import android.graphics.Color;
2122 import android.graphics.Rect;
@@ -107,6 +108,10 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener,
107108 private final Rect mMinimizeRect = new Rect();
108109 private final Rect mPipRect = new Rect();
109110 private View mClickTarget;
111+ // region @boringdroid
112+ private View mBack;
113+ private final Rect mBackRect = new Rect();
114+ // endregion
110115
111116 public DecorCaptionView(Context context) {
112117 super(context);
@@ -147,6 +152,9 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener,
147152 // By changing the outline provider to BOUNDS, the window can remove its
148153 // background without removing the shadow.
149154 mOwner.getDecorView().setOutlineProvider(ViewOutlineProvider.BOUNDS);
155+ // region @boringdroid
156+ mBack = findViewById(R.id.back_window);
157+ // endregion
150158 mPip = findViewById(R.id.pip_window);
151159 mMinimize = findViewById(R.id.minimize_window);
152160 mMaximize = findViewById(R.id.maximize_window);
@@ -160,6 +168,11 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener,
160168 if (ev.getAction() == MotionEvent.ACTION_DOWN) {
161169 final int x = (int) ev.getX();
162170 final int y = (int) ev.getY();
171+ // region @boringdroid
172+ if (mBackRect.contains(x, y)) {
173+ mClickTarget = mBack;
174+ }
175+ // endregion
163176 // Only offset y for containment tests because the actual views are already translated.
164177 if (mPipRect.contains(x, y)) {
165178 mClickTarget = mPip;
@@ -311,12 +324,18 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener,
311324 if (mCaption.getVisibility() != View.GONE) {
312325 mCaption.layout(0, 0, mCaption.getMeasuredWidth(), mCaption.getMeasuredHeight());
313326 captionHeight = mCaption.getBottom() - mCaption.getTop();
327+ // region @boringdroid
328+ mBack.getHitRect(mBackRect);
329+ // endregion
314330 mPip.getHitRect(mPipRect);
315331 mMinimize.getHitRect(mMinimizeRect);
316332 mMaximize.getHitRect(mMaximizeRect);
317333 mClose.getHitRect(mCloseRect);
318334 } else {
319335 captionHeight = 0;
336+ // region @boringdroid
337+ mBackRect.setEmpty();
338+ // endregion
320339 mPipRect.setEmpty();
321340 mMinimizeRect.setEmpty();
322341 mMaximizeRect.setEmpty();
@@ -333,8 +352,12 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener,
333352 }
334353
335354 // 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(),
337359 mClose.getRight(), mClose.getBottom());
360+ // endregion
338361 }
339362 /**
340363 * Determine if the workspace is entirely covered by the window.
@@ -351,7 +374,14 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener,
351374 **/
352375 private void updateCaptionVisibility() {
353376 // 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
355385 mCaption.setVisibility(invisible ? GONE : VISIBLE);
356386 mCaption.setOnTouchListener(this);
357387 }
@@ -436,6 +466,16 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener,
436466
437467 @Override
438468 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
439479 if (mClickTarget == mMinimize) {
440480 minimizeWindow();
441481 } else if (mClickTarget == mPip) {
--- /dev/null
+++ b/core/res/res/drawable/decor_back_button_dark.xml
@@ -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+
--- /dev/null
+++ b/core/res/res/drawable/decor_back_button_light.xml
@@ -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>
--- a/core/res/res/layout/decor_caption.xml
+++ b/core/res/res/layout/decor_caption.xml
@@ -30,6 +30,22 @@
3030 android:background="@drawable/decor_caption_title"
3131 android:focusable="false"
3232 android:descendantFocusability="blocksDescendants" >
33+ <!-- region @boringdroid -->
34+ <Button
35+ android:id="@+id/back_window"
36+ android:layout_width="32dp"
37+ android:layout_height="32dp"
38+ android:layout_margin="5dp"
39+ android:padding="4dp"
40+ android:layout_gravity="center_vertical|start"
41+ android:contentDescription="@string/back_button_text"
42+ android:background="@drawable/decor_back_button_dark" />
43+ <Space
44+ android:layout_width="wrap_content"
45+ android:layout_height="wrap_content"
46+ android:layout_weight="1"
47+ android:background="@color/transparent" />
48+ <!-- endregion -->
3349 <Button
3450 android:id="@+id/pip_window"
3551 android:layout_width="32dp"
--- a/core/res/res/values/arrays.xml
+++ b/core/res/res/values/arrays.xml
@@ -143,6 +143,10 @@
143143 <item>@drawable/decor_minimize_button_light</item>
144144 <item>@drawable/decor_pip_button_dark</item>
145145 <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 -->
146150 </array>
147151
148152 <!-- Used in LocalePicker -->
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -4671,6 +4671,9 @@
46714671 <string name="floating_toolbar_close_overflow_description">Close overflow</string>
46724672
46734673 <!-- Free style window strings -->
4674+ <!-- region @boringdroid -->
4675+ <string name="back_button_text">Back</string>
4676+ <!-- endregion -->
46744677 <!-- Accessibility text for the minimize window button -->
46754678 <string name="pip_button_text">Picture In Picture</string>
46764679 <!-- Accessibility text for the minimize window button -->
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2237,6 +2237,11 @@
22372237 <java-symbol type="drawable" name="decor_maximize_button_light" />
22382238 <java-symbol type="drawable" name="decor_pip_button_dark" />
22392239 <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 -->
22402245 <java-symbol type="color" name="decor_button_dark_color" />
22412246 <java-symbol type="color" name="decor_button_light_color" />
22422247
--- a/services/core/java/com/android/server/am/ActivityLaunchParamsModifier.java
+++ b/services/core/java/com/android/server/am/ActivityLaunchParamsModifier.java
@@ -49,7 +49,13 @@ public class ActivityLaunchParamsModifier implements LaunchParamsModifier {
4949 return RESULT_SKIP;
5050 }
5151
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
5359
5460 // Bounds weren't valid.
5561 if (bounds == null || bounds.isEmpty()) {
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -620,6 +620,15 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
620620 }
621621 }
622622
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
623632 if (!Objects.equals(getOverrideBounds(), mTmpRect2)) {
624633 resize(mTmpRect2, null /* tempTaskBounds */, null /* tempTaskInsetBounds */);
625634 }
--- a/services/core/java/com/android/server/am/TaskLaunchParamsModifier.java
+++ b/services/core/java/com/android/server/am/TaskLaunchParamsModifier.java
@@ -92,6 +92,13 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
9292 final Rect resultBounds = outParams.mBounds;
9393
9494 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
95102 positionCenter(tasks, mAvailableRect, getFreeformWidth(mAvailableRect),
96103 getFreeformHeight(mAvailableRect), resultBounds);
97104 return RESULT_CONTINUE;
@@ -118,6 +125,13 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
118125 // center.
119126 Slog.w(TAG, "Received unsupported gravity: " + layout.gravity
120127 + ", 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
121135 positionCenter(tasks, mAvailableRect, width, height, resultBounds);
122136 }
123137
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -548,6 +548,10 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
548548 }
549549 }
550550 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
551555
552556 Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
553557 return kept;
@@ -559,7 +563,31 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
559563 // TODO: Investigate combining with the resize() method above.
560564 void resizeWindowContainer() {
561565 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+ }
562589 }
590+ // endregion
563591
564592 void getWindowContainerBounds(Rect bounds) {
565593 mWindowContainerController.getBounds(bounds);
@@ -1895,6 +1923,32 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
18951923 } else if (!getWindowConfiguration().persistTaskBounds()) {
18961924 return mStack.getOverrideBounds();
18971925 }
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
18981952 return mLastNonFullscreenBounds;
18991953 }
19001954
--- a/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java
+++ b/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java
@@ -104,6 +104,22 @@ public class TaskTapPointerEventListener implements PointerEventListener {
104104 }
105105 }
106106 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
107123 }
108124 }
109125
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -126,6 +126,7 @@ import android.content.ContentResolver;
126126 import android.content.Context;
127127 import android.content.Intent;
128128 import android.content.IntentFilter;
129+import android.content.SharedPreferences;
129130 import android.content.pm.ApplicationInfo;
130131 import android.content.pm.PackageManager;
131132 import android.content.pm.PackageManagerInternal;
@@ -148,6 +149,7 @@ import android.os.Binder;
148149 import android.os.Build;
149150 import android.os.Bundle;
150151 import android.os.Debug;
152+import android.os.Environment;
151153 import android.os.Handler;
152154 import android.os.IBinder;
153155 import android.os.IRemoteCallback;
@@ -169,6 +171,7 @@ import android.os.SystemProperties;
169171 import android.os.SystemService;
170172 import android.os.Trace;
171173 import android.os.UserHandle;
174+import android.os.UserManager;
172175 import android.os.WorkSource;
173176 import android.provider.Settings;
174177 import android.text.format.DateUtils;
@@ -7601,4 +7604,66 @@ public class WindowManagerService extends IWindowManager.Stub
76017604 }
76027605 }
76037606 }
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
76047669 }
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -798,6 +798,11 @@ class WindowStateAnimator {
798798 return false;
799799 }
800800
801+ // region @boringdroid
802+ if (w.inFreeformWindowingMode()) {
803+ return false;
804+ }
805+ // endregion
801806 // If we're animating, the wallpaper should only
802807 // be updated at the end of the animation.
803808 if (w.mAttrs.type == TYPE_WALLPAPER) {
Show on old repository browser