what-the-bank/sources/o/smP.java

194 lines
7.2 KiB
Java

package o;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Build;
import android.view.Display;
import android.view.DisplayCutout;
import com.google.firebase.crashlytics.internal.common.AbstractSpiCall;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/* loaded from: classes.dex */
public final class smP implements DvF {
public static final smP b = new smP();
private static final String e;
private smP() {
}
static {
C14957gcv.c((Object) "WindowMetricsCalculatorCompat", "");
e = "WindowMetricsCalculatorCompat";
}
public final wbK Db_(Activity activity) {
Rect Dc_;
C14957gcv.e(activity, "");
if (Build.VERSION.SDK_INT >= 30) {
Dc_ = Nrd.e.Cz_(activity);
} else if (Build.VERSION.SDK_INT >= 29) {
Dc_ = De_(activity);
} else if (Build.VERSION.SDK_INT >= 28) {
Dc_ = Dd_(activity);
} else {
Dc_ = Dc_(activity);
}
return new wbK(Dc_);
}
public final Rect De_(Activity activity) {
C14957gcv.e(activity, "");
Configuration configuration = activity.getResources().getConfiguration();
try {
Field declaredField = Configuration.class.getDeclaredField("windowConfiguration");
declaredField.setAccessible(true);
Object obj = declaredField.get(configuration);
Object invoke = obj.getClass().getDeclaredMethod("getBounds", new Class[0]).invoke(obj, new Object[0]);
if (invoke != null) {
return new Rect((Rect) invoke);
}
throw new NullPointerException("null cannot be cast to non-null type android.graphics.Rect");
} catch (IllegalAccessException e2) {
return Dd_(activity);
} catch (NoSuchFieldException e3) {
return Dd_(activity);
} catch (NoSuchMethodException e4) {
return Dd_(activity);
} catch (InvocationTargetException e5) {
return Dd_(activity);
}
}
public final Rect Dd_(Activity activity) {
DisplayCutout CZ_;
C14957gcv.e(activity, "");
Rect rect = new Rect();
Configuration configuration = activity.getResources().getConfiguration();
try {
Field declaredField = Configuration.class.getDeclaredField("windowConfiguration");
declaredField.setAccessible(true);
Object obj = declaredField.get(configuration);
if (DBr.e.Cy_(activity)) {
Object invoke = obj.getClass().getDeclaredMethod("getBounds", new Class[0]).invoke(obj, new Object[0]);
if (invoke == null) {
throw new NullPointerException("null cannot be cast to non-null type android.graphics.Rect");
}
rect.set((Rect) invoke);
} else {
Object invoke2 = obj.getClass().getDeclaredMethod("getAppBounds", new Class[0]).invoke(obj, new Object[0]);
if (invoke2 == null) {
throw new NullPointerException("null cannot be cast to non-null type android.graphics.Rect");
}
rect.set((Rect) invoke2);
}
} catch (IllegalAccessException e2) {
Da_(activity, rect);
} catch (NoSuchFieldException e3) {
Da_(activity, rect);
} catch (NoSuchMethodException e4) {
Da_(activity, rect);
} catch (InvocationTargetException e5) {
Da_(activity, rect);
}
Display defaultDisplay = activity.getWindowManager().getDefaultDisplay();
Point point = new Point();
CAM cam = CAM.d;
C14957gcv.c(defaultDisplay, "");
cam.CA_(defaultDisplay, point);
if (!DBr.e.Cy_(activity)) {
int e6 = e(activity);
if (rect.bottom + e6 == point.y) {
rect.bottom += e6;
} else if (rect.right + e6 == point.x) {
rect.right += e6;
} else if (rect.left == e6) {
rect.left = 0;
}
}
if ((rect.width() < point.x || rect.height() < point.y) && !DBr.e.Cy_(activity) && (CZ_ = CZ_(defaultDisplay)) != null) {
if (rect.left == gAi.a.CC_(CZ_)) {
rect.left = 0;
}
if (point.x - rect.right == gAi.a.CD_(CZ_)) {
rect.right += gAi.a.CD_(CZ_);
}
if (rect.top == gAi.a.CE_(CZ_)) {
rect.top = 0;
}
if (point.y - rect.bottom == gAi.a.CB_(CZ_)) {
rect.bottom += gAi.a.CB_(CZ_);
}
}
return rect;
}
private final void Da_(Activity activity, Rect rect) {
activity.getWindowManager().getDefaultDisplay().getRectSize(rect);
}
public final Rect Dc_(Activity activity) {
C14957gcv.e(activity, "");
Rect rect = new Rect();
Display defaultDisplay = activity.getWindowManager().getDefaultDisplay();
defaultDisplay.getRectSize(rect);
if (!DBr.e.Cy_(activity)) {
C14957gcv.c(defaultDisplay, "");
Point Df_ = Df_(defaultDisplay);
int e2 = e(activity);
if (rect.bottom + e2 == Df_.y) {
rect.bottom += e2;
} else if (rect.right + e2 == Df_.x) {
rect.right += e2;
}
}
return rect;
}
public final Point Df_(Display display) {
C14957gcv.e(display, "");
Point point = new Point();
CAM.d.CA_(display, point);
return point;
}
private final int e(Context context) {
Resources resources = context.getResources();
int identifier = resources.getIdentifier("navigation_bar_height", "dimen", AbstractSpiCall.ANDROID_CLIENT_TYPE);
if (identifier > 0) {
return resources.getDimensionPixelSize(identifier);
}
return 0;
}
private final DisplayCutout CZ_(Display display) {
try {
Constructor<?> constructor = Class.forName("android.view.DisplayInfo").getConstructor(new Class[0]);
constructor.setAccessible(true);
Object newInstance = constructor.newInstance(new Object[0]);
Method declaredMethod = display.getClass().getDeclaredMethod("getDisplayInfo", newInstance.getClass());
declaredMethod.setAccessible(true);
declaredMethod.invoke(display, newInstance);
Field declaredField = newInstance.getClass().getDeclaredField("displayCutout");
declaredField.setAccessible(true);
Object obj = declaredField.get(newInstance);
if (obj instanceof DisplayCutout) {
return (DisplayCutout) obj;
}
} catch (ClassNotFoundException e2) {
} catch (IllegalAccessException e3) {
} catch (InstantiationException e4) {
} catch (NoSuchFieldException e5) {
} catch (NoSuchMethodException e6) {
} catch (InvocationTargetException e7) {
}
return null;
}
}