mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-18 03:47:18 +01:00
44 lines
2.3 KiB
Java
44 lines
2.3 KiB
Java
package androidx.compose.ui.platform;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.app.Activity;
|
|
import android.content.res.Configuration;
|
|
import android.graphics.Rect;
|
|
import androidx.annotation.RequiresApi;
|
|
import java.lang.reflect.Field;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import kotlin.Metadata;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@RequiresApi(29)
|
|
@Metadata(d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\bÃ\u0002\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0002\u0010\u0003J\u0010\u0010\u0004\u001a\u00020\u00052\u0006\u0010\u0006\u001a\u00020\u0007H\u0017¨\u0006\b"}, d2 = {"Landroidx/compose/ui/platform/BoundsHelperApi29Impl;", "Landroidx/compose/ui/platform/BoundsHelper;", "<init>", "()V", "currentWindowBounds", "Landroid/graphics/Rect;", "activity", "Landroid/app/Activity;", "ui_release"}, k = 1, mv = {2, 0, 0}, xi = 48)
|
|
/* loaded from: classes13.dex */
|
|
final class BoundsHelperApi29Impl implements BoundsHelper {
|
|
|
|
@NotNull
|
|
public static final BoundsHelperApi29Impl INSTANCE = new BoundsHelperApi29Impl();
|
|
|
|
private BoundsHelperApi29Impl() {
|
|
}
|
|
|
|
@Override // androidx.compose.ui.platform.BoundsHelper
|
|
@SuppressLint({"BanUncheckedReflection", "BlockedPrivateApi"})
|
|
@NotNull
|
|
public Rect currentWindowBounds(@NotNull Activity 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", null).invoke(obj, null);
|
|
invoke.getClass();
|
|
return new Rect((Rect) invoke);
|
|
} catch (Exception e) {
|
|
if ((e instanceof NoSuchFieldException) || (e instanceof NoSuchMethodException) || (e instanceof IllegalAccessException) || (e instanceof InvocationTargetException)) {
|
|
return BoundsHelperApi28Impl.INSTANCE.currentWindowBounds(activity);
|
|
}
|
|
throw e;
|
|
}
|
|
}
|
|
}
|