.class public final Landroidx/window/layout/SidecarWindowBackend; .super Ljava/lang/Object; .source "SidecarWindowBackend.kt" # interfaces .implements Landroidx/window/layout/WindowBackend; # annotations .annotation system Ldalvik/annotation/MemberClasses; value = { Landroidx/window/layout/SidecarWindowBackend$ExtensionListenerImpl;, Landroidx/window/layout/SidecarWindowBackend$WindowLayoutChangeCallbackWrapper;, Landroidx/window/layout/SidecarWindowBackend$Companion; } .end annotation .annotation system Ldalvik/annotation/SourceDebugExtension; value = "SMAP\nSidecarWindowBackend.kt\nKotlin\n*S Kotlin\n*F\n+ 1 SidecarWindowBackend.kt\nandroidx/window/layout/SidecarWindowBackend\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,243:1\n286#2,2:244\n1741#2,3:246\n1741#2,3:249\n*S KotlinDebug\n*F\n+ 1 SidecarWindowBackend.kt\nandroidx/window/layout/SidecarWindowBackend\n*L\n79#1:244,2\n90#1:246,3\n127#1:249,3\n*E\n" .end annotation .annotation runtime Lkotlin/Metadata; d1 = { "\u0000D\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0008\u0005\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0008\u0005\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\u0008\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0008\u0005\u0008\u0000\u0018\u0000 \u001c2\u00020\u0001:\u0003\u001c\u001d\u001eB\u0011\u0008\u0007\u0012\u0008\u0010\u0002\u001a\u0004\u0018\u00010\u0003\u00a2\u0006\u0002\u0010\u0004J\u0010\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u0012H\u0003J\u0010\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0011\u001a\u00020\u0012H\u0002J&\u0010\u0015\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00122\u0006\u0010\u0016\u001a\u00020\u00172\u000c\u0010\u0018\u001a\u0008\u0012\u0004\u0012\u00020\u001a0\u0019H\u0016J\u0016\u0010\u001b\u001a\u00020\u00102\u000c\u0010\u0018\u001a\u0008\u0012\u0004\u0012\u00020\u001a0\u0019H\u0016R \u0010\u0002\u001a\u0004\u0018\u00010\u00038\u0006@\u0006X\u0087\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\u0008\u0005\u0010\u0006\"\u0004\u0008\u0007\u0010\u0004R\"\u0010\u0008\u001a\u0008\u0012\u0004\u0012\u00020\n0\t8\u0006X\u0087\u0004\u00a2\u0006\u000e\n\u0000\u0012\u0004\u0008\u000b\u0010\u000c\u001a\u0004\u0008\r\u0010\u000e\u00a8\u0006\u001f" } d2 = { "Landroidx/window/layout/SidecarWindowBackend;", "Landroidx/window/layout/WindowBackend;", "windowExtension", "Landroidx/window/layout/ExtensionInterfaceCompat;", "(Landroidx/window/layout/ExtensionInterfaceCompat;)V", "getWindowExtension", "()Landroidx/window/layout/ExtensionInterfaceCompat;", "setWindowExtension", "windowLayoutChangeCallbacks", "Ljava/util/concurrent/CopyOnWriteArrayList;", "Landroidx/window/layout/SidecarWindowBackend$WindowLayoutChangeCallbackWrapper;", "getWindowLayoutChangeCallbacks$annotations", "()V", "getWindowLayoutChangeCallbacks", "()Ljava/util/concurrent/CopyOnWriteArrayList;", "callbackRemovedForActivity", "", "activity", "Landroid/app/Activity;", "isActivityRegistered", "", "registerLayoutChangeCallback", "executor", "Ljava/util/concurrent/Executor;", "callback", "Landroidx/core/util/Consumer;", "Landroidx/window/layout/WindowLayoutInfo;", "unregisterLayoutChangeCallback", "Companion", "ExtensionListenerImpl", "WindowLayoutChangeCallbackWrapper", "window_release" } k = 0x1 mv = { 0x1, 0x6, 0x0 } xi = 0x30 .end annotation # static fields .field public static final Companion:Landroidx/window/layout/SidecarWindowBackend$Companion; .field public static final DEBUG:Z = false .field private static final TAG:Ljava/lang/String; = "WindowServer" .field private static volatile globalInstance:Landroidx/window/layout/SidecarWindowBackend; .field private static final globalLock:Ljava/util/concurrent/locks/ReentrantLock; # instance fields .field private windowExtension:Landroidx/window/layout/ExtensionInterfaceCompat; .field private final windowLayoutChangeCallbacks:Ljava/util/concurrent/CopyOnWriteArrayList; .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/concurrent/CopyOnWriteArrayList<", "Landroidx/window/layout/SidecarWindowBackend$WindowLayoutChangeCallbackWrapper;", ">;" } .end annotation .end field # direct methods .method static constructor ()V .locals 2 new-instance v0, Landroidx/window/layout/SidecarWindowBackend$Companion; const/4 v1, 0x0 invoke-direct {v0, v1}, Landroidx/window/layout/SidecarWindowBackend$Companion;->(Lkotlin/jvm/internal/DefaultConstructorMarker;)V sput-object v0, Landroidx/window/layout/SidecarWindowBackend;->Companion:Landroidx/window/layout/SidecarWindowBackend$Companion; .line 174 new-instance v0, Ljava/util/concurrent/locks/ReentrantLock; invoke-direct {v0}, Ljava/util/concurrent/locks/ReentrantLock;->()V sput-object v0, Landroidx/window/layout/SidecarWindowBackend;->globalLock:Ljava/util/concurrent/locks/ReentrantLock; return-void .end method .method public constructor (Landroidx/window/layout/ExtensionInterfaceCompat;)V .locals 1 .line 36 invoke-direct {p0}, Ljava/lang/Object;->()V iput-object p1, p0, Landroidx/window/layout/SidecarWindowBackend;->windowExtension:Landroidx/window/layout/ExtensionInterfaceCompat; .line 50 new-instance p1, Ljava/util/concurrent/CopyOnWriteArrayList; invoke-direct {p1}, Ljava/util/concurrent/CopyOnWriteArrayList;->()V iput-object p1, p0, Landroidx/window/layout/SidecarWindowBackend;->windowLayoutChangeCallbacks:Ljava/util/concurrent/CopyOnWriteArrayList; iget-object p1, p0, Landroidx/window/layout/SidecarWindowBackend;->windowExtension:Landroidx/window/layout/ExtensionInterfaceCompat; if-nez p1, :cond_0 goto :goto_0 .line 51 :cond_0 new-instance v0, Landroidx/window/layout/SidecarWindowBackend$ExtensionListenerImpl; invoke-direct {v0, p0}, Landroidx/window/layout/SidecarWindowBackend$ExtensionListenerImpl;->(Landroidx/window/layout/SidecarWindowBackend;)V check-cast v0, Landroidx/window/layout/ExtensionInterfaceCompat$ExtensionCallbackInterface; invoke-interface {p1, v0}, Landroidx/window/layout/ExtensionInterfaceCompat;->setExtensionCallback(Landroidx/window/layout/ExtensionInterfaceCompat$ExtensionCallbackInterface;)V :goto_0 return-void .end method .method public static final synthetic access$getGlobalInstance$cp()Landroidx/window/layout/SidecarWindowBackend; .locals 1 sget-object v0, Landroidx/window/layout/SidecarWindowBackend;->globalInstance:Landroidx/window/layout/SidecarWindowBackend; return-object v0 .end method .method public static final synthetic access$getGlobalLock$cp()Ljava/util/concurrent/locks/ReentrantLock; .locals 1 sget-object v0, Landroidx/window/layout/SidecarWindowBackend;->globalLock:Ljava/util/concurrent/locks/ReentrantLock; return-object v0 .end method .method public static final synthetic access$setGlobalInstance$cp(Landroidx/window/layout/SidecarWindowBackend;)V .locals 0 sput-object p0, Landroidx/window/layout/SidecarWindowBackend;->globalInstance:Landroidx/window/layout/SidecarWindowBackend; return-void .end method .method private final callbackRemovedForActivity(Landroid/app/Activity;)V .locals 2 iget-object v0, p0, Landroidx/window/layout/SidecarWindowBackend;->windowLayoutChangeCallbacks:Ljava/util/concurrent/CopyOnWriteArrayList; .line 127 check-cast v0, Ljava/lang/Iterable; .line 249 instance-of v1, v0, Ljava/util/Collection; if-eqz v1, :cond_0 move-object v1, v0 check-cast v1, Ljava/util/Collection; invoke-interface {v1}, Ljava/util/Collection;->isEmpty()Z move-result v1 if-eqz v1, :cond_0 goto :goto_0 .line 250 :cond_0 invoke-interface {v0}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator; move-result-object v0 :cond_1 invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z move-result v1 if-eqz v1, :cond_2 invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v1 check-cast v1, Landroidx/window/layout/SidecarWindowBackend$WindowLayoutChangeCallbackWrapper; .line 128 invoke-virtual {v1}, Landroidx/window/layout/SidecarWindowBackend$WindowLayoutChangeCallbackWrapper;->getActivity()Landroid/app/Activity; move-result-object v1 invoke-static {v1, p1}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z move-result v1 if-eqz v1, :cond_1 return-void :cond_2 :goto_0 iget-object p0, p0, Landroidx/window/layout/SidecarWindowBackend;->windowExtension:Landroidx/window/layout/ExtensionInterfaceCompat; if-nez p0, :cond_3 goto :goto_1 .line 134 :cond_3 invoke-interface {p0, p1}, Landroidx/window/layout/ExtensionInterfaceCompat;->onWindowLayoutChangeListenerRemoved(Landroid/app/Activity;)V :goto_1 return-void .end method .method public static synthetic getWindowLayoutChangeCallbacks$annotations()V .locals 0 return-void .end method .method private final isActivityRegistered(Landroid/app/Activity;)Z .locals 2 iget-object p0, p0, Landroidx/window/layout/SidecarWindowBackend;->windowLayoutChangeCallbacks:Ljava/util/concurrent/CopyOnWriteArrayList; .line 90 check-cast p0, Ljava/lang/Iterable; .line 246 instance-of v0, p0, Ljava/util/Collection; const/4 v1, 0x0 if-eqz v0, :cond_0 move-object v0, p0 check-cast v0, Ljava/util/Collection; invoke-interface {v0}, Ljava/util/Collection;->isEmpty()Z move-result v0 if-eqz v0, :cond_0 goto :goto_0 .line 247 :cond_0 invoke-interface {p0}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator; move-result-object p0 :cond_1 invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z move-result v0 if-eqz v0, :cond_2 invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v0 check-cast v0, Landroidx/window/layout/SidecarWindowBackend$WindowLayoutChangeCallbackWrapper; .line 91 invoke-virtual {v0}, Landroidx/window/layout/SidecarWindowBackend$WindowLayoutChangeCallbackWrapper;->getActivity()Landroid/app/Activity; move-result-object v0 invoke-static {v0, p1}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z move-result v0 if-eqz v0, :cond_1 const/4 v1, 0x1 :cond_2 :goto_0 return v1 .end method # virtual methods .method public final getWindowExtension()Landroidx/window/layout/ExtensionInterfaceCompat; .locals 0 iget-object p0, p0, Landroidx/window/layout/SidecarWindowBackend;->windowExtension:Landroidx/window/layout/ExtensionInterfaceCompat; return-object p0 .end method .method public final getWindowLayoutChangeCallbacks()Ljava/util/concurrent/CopyOnWriteArrayList; .locals 0 .annotation system Ldalvik/annotation/Signature; value = { "()", "Ljava/util/concurrent/CopyOnWriteArrayList<", "Landroidx/window/layout/SidecarWindowBackend$WindowLayoutChangeCallbackWrapper;", ">;" } .end annotation iget-object p0, p0, Landroidx/window/layout/SidecarWindowBackend;->windowLayoutChangeCallbacks:Ljava/util/concurrent/CopyOnWriteArrayList; return-object p0 .end method .method public registerLayoutChangeCallback(Landroid/app/Activity;Ljava/util/concurrent/Executor;Landroidx/core/util/Consumer;)V .locals 4 .annotation system Ldalvik/annotation/Signature; value = { "(", "Landroid/app/Activity;", "Ljava/util/concurrent/Executor;", "Landroidx/core/util/Consumer<", "Landroidx/window/layout/WindowLayoutInfo;", ">;)V" } .end annotation const-string v0, "activity" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V const-string v0, "executor" invoke-static {p2, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V const-string v0, "callback" invoke-static {p3, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V sget-object v0, Landroidx/window/layout/SidecarWindowBackend;->globalLock:Ljava/util/concurrent/locks/ReentrantLock; .line 59 check-cast v0, Ljava/util/concurrent/locks/Lock; invoke-interface {v0}, Ljava/util/concurrent/locks/Lock;->lock()V .line 60 :try_start_0 invoke-virtual {p0}, Landroidx/window/layout/SidecarWindowBackend;->getWindowExtension()Landroidx/window/layout/ExtensionInterfaceCompat; move-result-object v1 if-nez v1, :cond_0 .line 65 new-instance p0, Landroidx/window/layout/WindowLayoutInfo; invoke-static {}, Lkotlin/collections/CollectionsKt;->emptyList()Ljava/util/List; move-result-object p1 invoke-direct {p0, p1}, Landroidx/window/layout/WindowLayoutInfo;->(Ljava/util/List;)V invoke-interface {p3, p0}, Landroidx/core/util/Consumer;->accept(Ljava/lang/Object;)V :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 .line 66 invoke-interface {v0}, Ljava/util/concurrent/locks/Lock;->unlock()V return-void .line 71 :cond_0 :try_start_1 invoke-direct {p0, p1}, Landroidx/window/layout/SidecarWindowBackend;->isActivityRegistered(Landroid/app/Activity;)Z move-result v2 .line 72 new-instance v3, Landroidx/window/layout/SidecarWindowBackend$WindowLayoutChangeCallbackWrapper; invoke-direct {v3, p1, p2, p3}, Landroidx/window/layout/SidecarWindowBackend$WindowLayoutChangeCallbackWrapper;->(Landroid/app/Activity;Ljava/util/concurrent/Executor;Landroidx/core/util/Consumer;)V .line 73 invoke-virtual {p0}, Landroidx/window/layout/SidecarWindowBackend;->getWindowLayoutChangeCallbacks()Ljava/util/concurrent/CopyOnWriteArrayList; move-result-object p2 invoke-virtual {p2, v3}, Ljava/util/concurrent/CopyOnWriteArrayList;->add(Ljava/lang/Object;)Z if-nez v2, :cond_1 .line 75 invoke-interface {v1, p1}, Landroidx/window/layout/ExtensionInterfaceCompat;->onWindowLayoutChangeListenerAdded(Landroid/app/Activity;)V goto :goto_2 .line 79 :cond_1 invoke-virtual {p0}, Landroidx/window/layout/SidecarWindowBackend;->getWindowLayoutChangeCallbacks()Ljava/util/concurrent/CopyOnWriteArrayList; move-result-object p0 check-cast p0, Ljava/lang/Iterable; .line 244 invoke-interface {p0}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator; move-result-object p0 :cond_2 invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z move-result p2 const/4 p3, 0x0 if-eqz p2, :cond_3 invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object p2 move-object v1, p2 check-cast v1, Landroidx/window/layout/SidecarWindowBackend$WindowLayoutChangeCallbackWrapper; .line 80 invoke-virtual {v1}, Landroidx/window/layout/SidecarWindowBackend$WindowLayoutChangeCallbackWrapper;->getActivity()Landroid/app/Activity; move-result-object v1 invoke-static {p1, v1}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z move-result v1 if-eqz v1, :cond_2 goto :goto_0 :cond_3 move-object p2, p3 .line 79 :goto_0 check-cast p2, Landroidx/window/layout/SidecarWindowBackend$WindowLayoutChangeCallbackWrapper; if-nez p2, :cond_4 goto :goto_1 .line 81 :cond_4 invoke-virtual {p2}, Landroidx/window/layout/SidecarWindowBackend$WindowLayoutChangeCallbackWrapper;->getLastInfo()Landroidx/window/layout/WindowLayoutInfo; move-result-object p3 :goto_1 if-eqz p3, :cond_5 .line 83 invoke-virtual {v3, p3}, Landroidx/window/layout/SidecarWindowBackend$WindowLayoutChangeCallbackWrapper;->accept(Landroidx/window/layout/WindowLayoutInfo;)V .line 86 :cond_5 :goto_2 sget-object p0, Lkotlin/Unit;->INSTANCE:Lkotlin/Unit; :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 .line 59 invoke-interface {v0}, Ljava/util/concurrent/locks/Lock;->unlock()V return-void :catchall_0 move-exception p0 invoke-interface {v0}, Ljava/util/concurrent/locks/Lock;->unlock()V throw p0 .end method .method public final setWindowExtension(Landroidx/window/layout/ExtensionInterfaceCompat;)V .locals 0 iput-object p1, p0, Landroidx/window/layout/SidecarWindowBackend;->windowExtension:Landroidx/window/layout/ExtensionInterfaceCompat; return-void .end method .method public unregisterLayoutChangeCallback(Landroidx/core/util/Consumer;)V .locals 5 .annotation system Ldalvik/annotation/Signature; value = { "(", "Landroidx/core/util/Consumer<", "Landroidx/window/layout/WindowLayoutInfo;", ">;)V" } .end annotation const-string v0, "callback" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V sget-object v0, Landroidx/window/layout/SidecarWindowBackend;->globalLock:Ljava/util/concurrent/locks/ReentrantLock; .line 96 monitor-enter v0 .line 97 :try_start_0 invoke-virtual {p0}, Landroidx/window/layout/SidecarWindowBackend;->getWindowExtension()Landroidx/window/layout/ExtensionInterfaceCompat; move-result-object v1 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 if-nez v1, :cond_0 .line 101 monitor-exit v0 return-void .line 106 :cond_0 :try_start_1 new-instance v1, Ljava/util/ArrayList; invoke-direct {v1}, Ljava/util/ArrayList;->()V check-cast v1, Ljava/util/List; .line 107 invoke-virtual {p0}, Landroidx/window/layout/SidecarWindowBackend;->getWindowLayoutChangeCallbacks()Ljava/util/concurrent/CopyOnWriteArrayList; move-result-object v2 invoke-virtual {v2}, Ljava/util/concurrent/CopyOnWriteArrayList;->iterator()Ljava/util/Iterator; move-result-object v2 :cond_1 :goto_0 invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z move-result v3 if-eqz v3, :cond_2 invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v3 check-cast v3, Landroidx/window/layout/SidecarWindowBackend$WindowLayoutChangeCallbackWrapper; .line 108 invoke-virtual {v3}, Landroidx/window/layout/SidecarWindowBackend$WindowLayoutChangeCallbackWrapper;->getCallback()Landroidx/core/util/Consumer; move-result-object v4 if-ne v4, p1, :cond_1 const-string v4, "callbackWrapper" .line 110 invoke-static {v3, v4}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V invoke-interface {v1, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z goto :goto_0 .line 114 :cond_2 invoke-virtual {p0}, Landroidx/window/layout/SidecarWindowBackend;->getWindowLayoutChangeCallbacks()Ljava/util/concurrent/CopyOnWriteArrayList; move-result-object p1 move-object v2, v1 check-cast v2, Ljava/util/Collection; invoke-virtual {p1, v2}, Ljava/util/concurrent/CopyOnWriteArrayList;->removeAll(Ljava/util/Collection;)Z .line 115 invoke-interface {v1}, Ljava/util/List;->iterator()Ljava/util/Iterator; move-result-object p1 :goto_1 invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z move-result v1 if-eqz v1, :cond_3 invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v1 check-cast v1, Landroidx/window/layout/SidecarWindowBackend$WindowLayoutChangeCallbackWrapper; .line 116 invoke-virtual {v1}, Landroidx/window/layout/SidecarWindowBackend$WindowLayoutChangeCallbackWrapper;->getActivity()Landroid/app/Activity; move-result-object v1 invoke-direct {p0, v1}, Landroidx/window/layout/SidecarWindowBackend;->callbackRemovedForActivity(Landroid/app/Activity;)V goto :goto_1 .line 118 :cond_3 sget-object p0, Lkotlin/Unit;->INSTANCE:Lkotlin/Unit; :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 .line 96 monitor-exit v0 return-void :catchall_0 move-exception p0 monitor-exit v0 throw p0 .end method