Comparing sensitive data, confidential files or internal emails?

Most legal and privacy policies prohibit uploading sensitive data online. Diffchecker Desktop ensures your confidential information never leaves your computer. Work offline and compare documents securely.

WindowManagerImpl Diff 14.0.9 -> 14.0.11

Created Diff never expires
10 removals
250 lines
36 additions
276 lines
//
//
// Source code recreated from a .class file by IntelliJ IDEA
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
// (powered by FernFlower decompiler)
//
//


package android.view;
package android.view;


import android.content.Context;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.Rect;
import android.graphics.Region;
import android.graphics.Region;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable;
import android.hardware.display.DisplayManagerGlobal;
import android.hardware.display.DisplayManagerGlobal;
import android.os.IBinder;
import android.os.IBinder;
import android.util.DisplayMetrics;
import android.util.DisplayMetrics;
import android.view.View.MeasureSpec;
import android.view.View.MeasureSpec;
import android.widget.FrameLayout;
import android.widget.FrameLayout;
import com.android.internal.policy.DecorView;
import com.android.internal.policy.DecorView;
import com.android.layoutlib.bridge.Bridge;
import com.android.layoutlib.bridge.Bridge;
import com.android.layoutlib.bridge.android.BridgeContext;
import com.android.layoutlib.bridge.util.InsetUtil;
import com.android.layoutlib.bridge.util.InsetUtil;
import com.android.server.wm.DisplayFrames;
import java.util.ArrayList;
import java.util.ArrayList;


public class WindowManagerImpl implements WindowManager {
public class WindowManagerImpl implements WindowManager {
private static final PrivacyIndicatorBounds sPrivacyIndicatorBounds = new PrivacyIndicatorBounds();
private final Context mContext;
private final Context mContext;
private final DisplayMetrics mMetrics;
private final DisplayMetrics mMetrics;
private final Display mDisplay;
private final DisplayInfo mDisplayInfo;
private Display mDisplay;
private ViewGroup mBaseRootView;
private ViewGroup mBaseRootView;
private ViewGroup mCurrentRootView;
private ViewGroup mCurrentRootView;
private DisplayFrames mDisplayFrames;


public WindowManagerImpl(Context context, DisplayMetrics metrics) {
public WindowManagerImpl(BridgeContext context, DisplayMetrics metrics) {
this.mContext = context;
this.mContext = context;
this.mMetrics = metrics;
this.mMetrics = metrics;
DisplayInfo info = new DisplayInfo();
this.mDisplayInfo = new DisplayInfo();
info.logicalHeight = this.mMetrics.heightPixels;
this.mDisplayInfo.logicalHeight = this.mMetrics.heightPixels;
info.logicalWidth = this.mMetrics.widthPixels;
this.mDisplayInfo.logicalWidth = this.mMetrics.widthPixels;
info.supportedModes = new Display.Mode[]{new Display.Mode(0, this.mMetrics.widthPixels, this.mMetrics.heightPixels, 60.0F)};
this.mDisplayInfo.supportedModes = new Display.Mode[]{new Display.Mode(0, this.mMetrics.widthPixels, this.mMetrics.heightPixels, 60.0F)};
info.logicalDensityDpi = this.mMetrics.densityDpi;
this.mDisplayInfo.logicalDensityDpi = this.mMetrics.densityDpi;
this.mDisplay = new Display((DisplayManagerGlobal)null, 0, info, DisplayAdjustments.DEFAULT_DISPLAY_ADJUSTMENTS);
this.mDisplayInfo.displayCutout = DisplayCutout.NO_CUTOUT;
}
}


public WindowManagerImpl createLocalWindowManager(Window parentWindow) {
public WindowManagerImpl createLocalWindowManager(Window parentWindow) {
return this;
return this;
}
}


public WindowManagerImpl createPresentationWindowManager(Context displayContext) {
public WindowManagerImpl createPresentationWindowManager(Context displayContext) {
Bridge.getLog().fidelityWarning("unsupported", "The preview does not fully support multiple windows.", (Throwable)null, (Object)null, (Object)null);
Bridge.getLog().fidelityWarning("unsupported", "The preview does not fully support multiple windows.", (Throwable)null, (Object)null, (Object)null);
return this;
return this;
}
}


public void setDefaultToken(IBinder token) {
public void setDefaultToken(IBinder token) {
}
}


public Display getDefaultDisplay() {
public Display getDefaultDisplay() {
if (this.mDisplay == null) {
this.mDisplay = new Display((DisplayManagerGlobal)null, 0, this.mDisplayInfo, this.mContext.getResources());
}

return this.mDisplay;
return this.mDisplay;
}
}


public void addView(View arg0, ViewGroup.LayoutParams arg1) {
public void addView(View arg0, ViewGroup.LayoutParams arg1) {
if (this.mBaseRootView != null) {
if (this.mBaseRootView != null) {
if (this.mCurrentRootView == null) {
if (this.mCurrentRootView == null) {
FrameLayout layout = new FrameLayout(this.mContext) {
FrameLayout layout = new FrameLayout(this.mContext) {
public boolean dispatchTouchEvent(MotionEvent ev) {
public boolean dispatchTouchEvent(MotionEvent ev) {
float offsetX = -this.getX();
float offsetX = -this.getX();
float offsetY = -this.getY();
float offsetY = -this.getY();
View baseRootParent = (View)WindowManagerImpl.this.mBaseRootView.getParent();
View baseRootParent = (View)WindowManagerImpl.this.mBaseRootView.getParent();
if (baseRootParent != null) {
if (baseRootParent != null) {
offsetX -= baseRootParent.getX();
offsetX -= baseRootParent.getX();
offsetY -= baseRootParent.getY();
offsetY -= baseRootParent.getY();
}
}


ev.offsetLocation(offsetX, offsetY);
ev.offsetLocation(offsetX, offsetY);
return super.dispatchTouchEvent(ev);
return super.dispatchTouchEvent(ev);
}
}


protected void measureChildWithMargins(View child, int parentWidthMeasureSpec, int widthUsed, int parentHeightMeasureSpec, int heightUsed) {
protected void measureChildWithMargins(View child, int parentWidthMeasureSpec, int widthUsed, int parentHeightMeasureSpec, int heightUsed) {
ViewGroup.LayoutParams lp = child.getLayoutParams();
ViewGroup.LayoutParams lp = child.getLayoutParams();
int parentWidth = MeasureSpec.getSize(parentWidthMeasureSpec);
int parentWidth = MeasureSpec.getSize(parentWidthMeasureSpec);
int parentHeight = MeasureSpec.getSize(parentHeightMeasureSpec);
int parentHeight = MeasureSpec.getSize(parentHeightMeasureSpec);
int childWidthMeasureSpec = 0;
int childWidthMeasureSpec = 0;
int childHeightMeasureSpec = ViewRootImpl.getRootMeasureSpec(parentHeight, lp.height, 0);
int childHeightMeasureSpec = ViewRootImpl.getRootMeasureSpec(parentHeight, lp.height, 0);
if (lp.width == -2) {
if (lp.width == -2) {
int baseSize = this.mContext.getResources().getDimensionPixelSize(17105103);
int baseSize = this.mContext.getResources().getDimensionPixelSize(17105103);
if (baseSize != 0 && baseSize < parentWidth) {
if (baseSize != 0 && baseSize < parentWidth) {
childWidthMeasureSpec = ViewRootImpl.getRootMeasureSpec(baseSize, lp.width, 0);
childWidthMeasureSpec = ViewRootImpl.getRootMeasureSpec(baseSize, lp.width, 0);
}
}
}
}


if (childWidthMeasureSpec == 0) {
if (childWidthMeasureSpec == 0) {
childWidthMeasureSpec = ViewRootImpl.getRootMeasureSpec(parentWidth, lp.width, 0);
childWidthMeasureSpec = ViewRootImpl.getRootMeasureSpec(parentWidth, lp.width, 0);
}
}


child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
}
}
};
};
layout.setOnTouchListener((v, event) -> {
layout.setOnTouchListener((v, event) -> {
event.offsetLocation(-arg0.getX(), -arg0.getY());
event.offsetLocation(-arg0.getX(), -arg0.getY());
return arg0.dispatchTouchEvent(event);
return arg0.dispatchTouchEvent(event);
});
});
int layoutMode = -2;
int layoutMode = -2;
if (arg0 instanceof DecorView) {
if (arg0 instanceof DecorView) {
layoutMode = -1;
layoutMode = -1;
}
}


this.mBaseRootView.addView(layout, this.mBaseRootView.getChildCount() - 1, new FrameLayout.LayoutParams(layoutMode, layoutMode));
this.mBaseRootView.addView(layout, new FrameLayout.LayoutParams(layoutMode, layoutMode));
this.mCurrentRootView = layout;
this.mCurrentRootView = layout;
}
}


FrameLayout.LayoutParams frameLayoutParams = new FrameLayout.LayoutParams(arg1);
FrameLayout.LayoutParams frameLayoutParams = new FrameLayout.LayoutParams(arg1);
if (arg1 instanceof WindowManager.LayoutParams) {
if (arg1 instanceof WindowManager.LayoutParams) {
WindowManager.LayoutParams params = (WindowManager.LayoutParams)arg1;
WindowManager.LayoutParams params = (WindowManager.LayoutParams)arg1;
frameLayoutParams.gravity = params.gravity;
frameLayoutParams.gravity = params.gravity;
if ((params.flags & 2) != 0) {
if ((params.flags & 2) != 0) {
this.mCurrentRootView.setBackgroundColor(Color.argb(params.dimAmount, 0.0F, 0.0F, 0.0F));
this.mCurrentRootView.setBackgroundColor(Color.argb(params.dimAmount, 0.0F, 0.0F, 0.0F));
} else {
} else {
int backgroundColor = -1;
int backgroundColor = -1;
Drawable background = this.mBaseRootView.getBackground();
Drawable background = this.mBaseRootView.getBackground();
if (background == null) {
if (background == null) {
background = this.mBaseRootView.getRootView().getBackground();
background = this.mBaseRootView.getRootView().getBackground();
}
}


if (background instanceof ColorDrawable) {
if (background instanceof ColorDrawable) {
backgroundColor = ((ColorDrawable)background).getColor();
backgroundColor = ((ColorDrawable)background).getColor();
}
}


this.mCurrentRootView.setBackgroundColor(backgroundColor);
this.mCurrentRootView.setBackgroundColor(backgroundColor);
}
}
}
}


this.mCurrentRootView.addView(arg0, frameLayoutParams);
this.mCurrentRootView.addView(arg0, frameLayoutParams);
ViewRootImpl_Accessor.setChild(this.mBaseRootView.getViewRootImpl(), arg0);
ViewRootImpl_Accessor.setChild(this.mBaseRootView.getViewRootImpl(), arg0);
}
}
}
}


public void removeView(View arg0) {
public void removeView(View arg0) {
ViewRootImpl viewRootImpl = arg0.getViewRootImpl();
ViewRootImpl viewRootImpl = arg0.getViewRootImpl();
if (this.mCurrentRootView != null) {
if (this.mCurrentRootView != null) {
this.mCurrentRootView.removeView(arg0);
this.mCurrentRootView.removeView(arg0);
if (this.mBaseRootView != null && this.mCurrentRootView.getChildCount() == 0) {
if (this.mBaseRootView != null && this.mCurrentRootView.getChildCount() == 0) {
this.mBaseRootView.removeView(this.mCurrentRootView);
this.mBaseRootView.removeView(this.mCurrentRootView);
this.mCurrentRootView = null;
this.mCurrentRootView = null;
}
}
}
}


if (viewRootImpl != null && viewRootImpl.getView() == arg0) {
if (viewRootImpl != null && viewRootImpl.getView() == arg0) {
View newRoot = null;
View newRoot = null;
if (this.mCurrentRootView != null && this.mCurrentRootView.getChildCount() > 0) {
if (this.mCurrentRootView != null && this.mCurrentRootView.getChildCount() > 0) {
ArrayList<View> childrenList = this.mCurrentRootView.buildOrderedChildList();
ArrayList<View> childrenList = this.mCurrentRootView.buildOrderedChildList();
newRoot = (View)childrenList.get(childrenList.size() - 1);
newRoot = (View)childrenList.get(childrenList.size() - 1);
} else if (this.mBaseRootView != null) {
} else if (this.mBaseRootView != null) {
Object root;
Object root;
for(root = this.mBaseRootView; ((View)root).getParent() instanceof View; root = (View)((View)root).getParent()) {
for(root = this.mBaseRootView; ((View)root).getParent() instanceof View; root = (View)((View)root).getParent()) {
}
}


newRoot = root;
newRoot = root;
}
}


ViewRootImpl_Accessor.setChild(viewRootImpl, (View)newRoot);
ViewRootImpl_Accessor.setChild(viewRootImpl, (View)newRoot);
}
}


}
}


public void updateViewLayout(View view, ViewGroup.LayoutParams params) {
public void updateViewLayout(View view, ViewGroup.LayoutParams params) {
if (view == null) {
if (view == null) {
throw new IllegalArgumentException("view must not be null");
throw new IllegalArgumentException("view must not be null");
} else if (!(params instanceof WindowManager.LayoutParams)) {
} else if (!(params instanceof WindowManager.LayoutParams)) {
throw new IllegalArgumentException("Params must be WindowManager.LayoutParams");
throw new IllegalArgumentException("Params must be WindowManager.LayoutParams");
} else {
} else {
WindowManager.LayoutParams wparams = (WindowManager.LayoutParams)params;
WindowManager.LayoutParams wparams = (WindowManager.LayoutParams)params;
FrameLayout.LayoutParams lparams = new FrameLayout.LayoutParams(params);
FrameLayout.LayoutParams lparams = new FrameLayout.LayoutParams(params);
lparams.gravity = wparams.gravity;
lparams.gravity = wparams.gravity;
view.setLayoutParams(lparams);
view.setLayoutParams(lparams);
if (this.mCurrentRootView != null) {
if (this.mCurrentRootView != null) {
Rect bounds = new Rect();
Rect bounds = new Rect();
this.mBaseRootView.getBoundsOnScreen(bounds);
this.mBaseRootView.getBoundsOnScreen(bounds);
this.mCurrentRootView.setX((float)(wparams.x - bounds.left));
this.mCurrentRootView.setX((float)(wparams.x - bounds.left));
this.mCurrentRootView.setY((float)(wparams.y - bounds.top));
this.mCurrentRootView.setY((float)(wparams.y - bounds.top));
this.mCurrentRootView.setElevation(view.getElevation());
this.mCurrentRootView.setElevation(view.getElevation());
}
}


}
}
}
}


public void removeViewImmediate(View arg0) {
public void removeViewImmediate(View arg0) {
this.removeView(arg0);
this.removeView(arg0);
}
}


public void requestAppKeyboardShortcuts(WindowManager.KeyboardShortcutsReceiver receiver, int deviceId) {
public void requestAppKeyboardShortcuts(WindowManager.KeyboardShortcutsReceiver receiver, int deviceId) {
}
}


public Region getCurrentImeTouchRegion() {
public Region getCurrentImeTouchRegion() {
return null;
return null;
}
}


public void setShouldShowWithInsecureKeyguard(int displayId, boolean shouldShow) {
public void setShouldShowWithInsecureKeyguard(int displayId, boolean shouldShow) {
}
}


public void setShouldShowSystemDecors(int displayId, boolean shouldShow) {
public void setShouldShowSystemDecors(int displayId, boolean shouldShow) {
}
}


public void setDisplayImePolicy(int displayId, int imePolicy) {
public void setDisplayImePolicy(int displayId, int imePolicy) {
}
}


public WindowMetrics getCurrentWindowMetrics() {
public WindowMetrics getCurrentWindowMetrics() {
Rect bound = InsetUtil.getCurrentBounds(this.mContext);
Rect bound = InsetUtil.getCurrentBounds(this.mContext);
return new WindowMetrics(bound, this.computeWindowInsets());
return new WindowMetrics(bound, this.computeWindowInsets());
}
}


public WindowMetrics getMaximumWindowMetrics() {
public WindowMetrics getMaximumWindowMetrics() {
return new WindowMetrics(this.getMaximumBounds(), this.computeWindowInsets());
return new WindowMetrics(this.getMaximumBounds(), this.computeWindowInsets());
}
}


private Rect getMaximumBounds() {
private Rect getMaximumBounds() {
Point displaySize = new Point();
Point displaySize = new Point();
this.mDisplay.getRealSize(displaySize);
this.getDefaultDisplay().getRealSize(displaySize);
return new Rect(0, 0, displaySize.x, displaySize.y);
return new Rect(0, 0, displaySize.x, displaySize.y);
}
}


private WindowInsets computeWindowInsets() {
private WindowInsets computeWindowInsets() {
return this.mBaseRootView == null ? null : this.mBaseRootView.getViewRootImpl().getWindowInsets(true);
return this.mBaseRootView == null ? null : this.mBaseRootView.getViewRootImpl().getWindowInsets(true);
}
}


public void setBaseRootView(ViewGroup baseRootView) {
public void setBaseRootView(ViewGroup baseRootView) {
ViewGroup composableRoot = this.findComposableRoot(baseRootView);
ViewGroup composableRoot = this.findComposableRoot(baseRootView);
this.mBaseRootView = composableRoot != null ? composableRoot : baseRootView;
this.mBaseRootView = composableRoot != null ? composableRoot : baseRootView;
}
}


private ViewGroup findComposableRoot(ViewGroup baseRootView) {
private ViewGroup findComposableRoot(ViewGroup baseRootView) {
if (baseRootView.getClass().getName().endsWith("ComposeViewAdapter")) {
if (baseRootView.getClass().getName().endsWith("ComposeViewAdapter")) {
return baseRootView;
return baseRootView;
} else {
} else {
for(int i = 0; i < baseRootView.getChildCount(); ++i) {
for(int i = 0; i < baseRootView.getChildCount(); ++i) {
View child = baseRootView.getChildAt(i);
View child = baseRootView.getChildAt(i);
if (child instanceof ViewGroup) {
if (child instanceof ViewGroup) {
ViewGroup composableRoot = this.findComposableRoot((ViewGroup)child);
ViewGroup composableRoot = this.findComposableRoot((ViewGroup)child);
if (composableRoot != null) {
if (composableRoot != null) {
return composableRoot;
return composableRoot;
}
}
}
}
}
}


return null;
return null;
}
}
}
}


public ViewGroup getCurrentRootView() {
public ViewGroup getCurrentRootView() {
return this.mCurrentRootView;
return this.mCurrentRootView;
}
}

public void createOrUpdateDisplayFrames(InsetsState insetsState) {
if (this.mDisplayFrames == null) {
this.mDisplayFrames = new DisplayFrames(insetsState, this.mDisplayInfo, this.mDisplayInfo.displayCutout, RoundedCorners.NO_ROUNDED_CORNERS, sPrivacyIndicatorBounds, DisplayShape.NONE);
} else {
this.mDisplayFrames.update(this.mDisplayInfo.rotation, this.mDisplayInfo.logicalWidth, this.mDisplayInfo.logicalHeight, this.mDisplayInfo.displayCutout, RoundedCorners.NO_ROUNDED_CORNERS, sPrivacyIndicatorBounds, DisplayShape.NONE);
}

}

public void setupDisplayCutout() {
DisplayCutout displayCutout = DisplayCutout.fromResourcesRectApproximation(this.mContext.getResources(), (String)null, this.mMetrics.widthPixels, this.mMetrics.heightPixels, this.mMetrics.widthPixels, this.mMetrics.heightPixels);
if (displayCutout != null) {
this.mDisplayInfo.displayCutout = displayCutout.getRotated(this.mDisplayInfo.logicalWidth, this.mDisplayInfo.logicalHeight, this.mDisplayInfo.rotation, this.getDefaultDisplay().getRotation());
}

}
}
}