SystemNotificationMonitor.smali

.class public Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;
.super Landroid/view/OrientationEventListener;
.source "SourceFile"

# interfaces
.implements Lcom/tencent/liteav/base/util/w$a;


# annotations
.annotation runtime Lcom/tencent/liteav/base/annotations/JNINamespace;
    value = "liteav::video"
.end annotation


# instance fields
.field private mDisplayRotation:Lcom/tencent/liteav/videobase/utils/Rotation;

.field private volatile mListenerPtr:J

.field private mSensorRotation:Lcom/tencent/liteav/videobase/utils/Rotation;

.field private volatile mTimer:Lcom/tencent/liteav/base/util/w;


# direct methods
.method public constructor <init>()V
    .registers 4

    .line 27
    invoke-static {}, Lcom/tencent/liteav/base/ContextUtils;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    invoke-direct {p0, v0}, Landroid/view/OrientationEventListener;-><init>(Landroid/content/Context;)V

    const/4 v0, 0x0

    .line 20
    iput-object v0, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mTimer:Lcom/tencent/liteav/base/util/w;

    const-wide/16 v1, 0x0

    .line 21
    iput-wide v1, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mListenerPtr:J

    .line 22
    iput-object v0, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mSensorRotation:Lcom/tencent/liteav/videobase/utils/Rotation;

    .line 23
    iput-object v0, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mDisplayRotation:Lcom/tencent/liteav/videobase/utils/Rotation;

    return-void
.end method

.method private getSensorRotationByDisplayRotation(Lcom/tencent/liteav/videobase/utils/Rotation;)Lcom/tencent/liteav/videobase/utils/Rotation;
    .registers 3

    if-nez p1, :cond_5

    .line 105
    sget-object p1, Lcom/tencent/liteav/videobase/utils/Rotation;->a:Lcom/tencent/liteav/videobase/utils/Rotation;

    return-object p1

    .line 107
    :cond_5
    sget-object v0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor$1;->a:[I

    invoke-virtual {p1}, Lcom/tencent/liteav/videobase/utils/Rotation;->ordinal()I

    move-result p1

    aget p1, v0, p1

    const/4 v0, 0x1

    if-eq p1, v0, :cond_1f

    const/4 v0, 0x2

    if-eq p1, v0, :cond_1c

    const/4 v0, 0x3

    if-eq p1, v0, :cond_19

    .line 118
    sget-object p1, Lcom/tencent/liteav/videobase/utils/Rotation;->a:Lcom/tencent/liteav/videobase/utils/Rotation;

    return-object p1

    .line 115
    :cond_19
    sget-object p1, Lcom/tencent/liteav/videobase/utils/Rotation;->b:Lcom/tencent/liteav/videobase/utils/Rotation;

    return-object p1

    .line 112
    :cond_1c
    sget-object p1, Lcom/tencent/liteav/videobase/utils/Rotation;->c:Lcom/tencent/liteav/videobase/utils/Rotation;

    return-object p1

    .line 110
    :cond_1f
    sget-object p1, Lcom/tencent/liteav/videobase/utils/Rotation;->d:Lcom/tencent/liteav/videobase/utils/Rotation;

    return-object p1
.end method

.method private static native nativeSensorChanged(JII)V
.end method

.method private declared-synchronized notifyOrientationChanged()V
    .registers 5

    monitor-enter p0

    .line 95
    :try_start_1
    iget-wide v0, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mListenerPtr:J
    :try_end_3
    .catchall {:try_start_1 .. :try_end_3} :catchall_21

    const-wide/16 v2, 0x0

    cmp-long v0, v0, v2

    if-nez v0, :cond_b

    .line 96
    monitor-exit p0

    return-void

    .line 98
    :cond_b
    :try_start_b
    iget-object v0, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mSensorRotation:Lcom/tencent/liteav/videobase/utils/Rotation;

    const/4 v1, 0x0

    if-eqz v0, :cond_13

    .line 1045
    iget v0, v0, Lcom/tencent/liteav/videobase/utils/Rotation;->mValue:I

    goto :goto_14

    :cond_13
    move v0, v1

    .line 99
    :goto_14
    iget-object v2, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mDisplayRotation:Lcom/tencent/liteav/videobase/utils/Rotation;

    if-eqz v2, :cond_1a

    .line 2045
    iget v1, v2, Lcom/tencent/liteav/videobase/utils/Rotation;->mValue:I

    .line 100
    :cond_1a
    iget-wide v2, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mListenerPtr:J

    invoke-static {v2, v3, v0, v1}, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->nativeSensorChanged(JII)V
    :try_end_1f
    .catchall {:try_start_b .. :try_end_1f} :catchall_21

    .line 101
    monitor-exit p0

    return-void

    :catchall_21
    move-exception v0

    monitor-exit p0

    throw v0
.end method


# virtual methods
.method public declared-synchronized initialize(J)V
    .registers 4

    monitor-enter p0

    .line 32
    :try_start_1
    iput-wide p1, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mListenerPtr:J

    .line 33
    iget-object p1, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mTimer:Lcom/tencent/liteav/base/util/w;
    :try_end_5
    .catchall {:try_start_1 .. :try_end_5} :catchall_21

    if-eqz p1, :cond_9

    .line 34
    monitor-exit p0

    return-void

    .line 36
    :cond_9
    :try_start_9
    invoke-super {p0}, Landroid/view/OrientationEventListener;->enable()V

    .line 37
    new-instance p1, Lcom/tencent/liteav/base/util/w;

    invoke-static {}, Landroid/os/Looper;->getMainLooper()Landroid/os/Looper;

    move-result-object p2

    invoke-direct {p1, p2, p0}, Lcom/tencent/liteav/base/util/w;-><init>(Landroid/os/Looper;Lcom/tencent/liteav/base/util/w$a;)V

    iput-object p1, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mTimer:Lcom/tencent/liteav/base/util/w;

    .line 38
    iget-object p1, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mTimer:Lcom/tencent/liteav/base/util/w;

    const/4 p2, 0x0

    const/16 v0, 0x3e8

    invoke-virtual {p1, p2, v0}, Lcom/tencent/liteav/base/util/w;->a(II)V
    :try_end_1f
    .catchall {:try_start_9 .. :try_end_1f} :catchall_21

    .line 39
    monitor-exit p0

    return-void

    :catchall_21
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public onOrientationChanged(I)V
    .registers 3

    const/4 v0, -0x1

    if-ne p1, v0, :cond_4

    return-void

    :cond_4
    const/16 v0, 0x2d

    if-le p1, v0, :cond_1d

    const/16 v0, 0x87

    if-gt p1, v0, :cond_f

    .line 60
    sget-object p1, Lcom/tencent/liteav/videobase/utils/Rotation;->b:Lcom/tencent/liteav/videobase/utils/Rotation;

    goto :goto_1f

    :cond_f
    const/16 v0, 0xe1

    if-gt p1, v0, :cond_16

    .line 62
    sget-object p1, Lcom/tencent/liteav/videobase/utils/Rotation;->c:Lcom/tencent/liteav/videobase/utils/Rotation;

    goto :goto_1f

    :cond_16
    const/16 v0, 0x13b

    if-gt p1, v0, :cond_1d

    .line 64
    sget-object p1, Lcom/tencent/liteav/videobase/utils/Rotation;->d:Lcom/tencent/liteav/videobase/utils/Rotation;

    goto :goto_1f

    .line 66
    :cond_1d
    sget-object p1, Lcom/tencent/liteav/videobase/utils/Rotation;->a:Lcom/tencent/liteav/videobase/utils/Rotation;

    .line 69
    :goto_1f
    iget-object v0, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mSensorRotation:Lcom/tencent/liteav/videobase/utils/Rotation;

    if-ne v0, p1, :cond_24

    return-void

    .line 72
    :cond_24
    iput-object p1, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mSensorRotation:Lcom/tencent/liteav/videobase/utils/Rotation;

    .line 73
    invoke-static {}, Lcom/tencent/liteav/base/util/SystemUtil;->getDisplayRotationDegree()I

    move-result p1

    invoke-static {p1}, Lcom/tencent/liteav/videobase/utils/Rotation;->a(I)Lcom/tencent/liteav/videobase/utils/Rotation;

    move-result-object p1

    iput-object p1, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mDisplayRotation:Lcom/tencent/liteav/videobase/utils/Rotation;

    .line 74
    invoke-direct {p0}, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->notifyOrientationChanged()V

    return-void
.end method

.method public onTimeout()V
    .registers 3

    .line 80
    invoke-static {}, Lcom/tencent/liteav/base/util/SystemUtil;->getDisplayRotationDegree()I

    move-result v0

    invoke-static {v0}, Lcom/tencent/liteav/videobase/utils/Rotation;->a(I)Lcom/tencent/liteav/videobase/utils/Rotation;

    move-result-object v0

    .line 81
    iget-object v1, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mDisplayRotation:Lcom/tencent/liteav/videobase/utils/Rotation;

    if-ne v1, v0, :cond_d

    return-void

    .line 84
    :cond_d
    iput-object v0, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mDisplayRotation:Lcom/tencent/liteav/videobase/utils/Rotation;

    .line 87
    iget-object v1, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mSensorRotation:Lcom/tencent/liteav/videobase/utils/Rotation;

    if-nez v1, :cond_19

    .line 88
    invoke-direct {p0, v0}, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->getSensorRotationByDisplayRotation(Lcom/tencent/liteav/videobase/utils/Rotation;)Lcom/tencent/liteav/videobase/utils/Rotation;

    move-result-object v0

    iput-object v0, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mSensorRotation:Lcom/tencent/liteav/videobase/utils/Rotation;

    .line 90
    :cond_19
    invoke-direct {p0}, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->notifyOrientationChanged()V

    return-void
.end method

.method public declared-synchronized uninitialize()V
    .registers 3

    monitor-enter p0

    .line 43
    :try_start_1
    invoke-super {p0}, Landroid/view/OrientationEventListener;->disable()V

    const-wide/16 v0, 0x0

    .line 44
    iput-wide v0, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mListenerPtr:J

    .line 45
    iget-object v0, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mTimer:Lcom/tencent/liteav/base/util/w;

    if-eqz v0, :cond_14

    .line 46
    iget-object v0, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mTimer:Lcom/tencent/liteav/base/util/w;

    invoke-virtual {v0}, Lcom/tencent/liteav/base/util/w;->a()V

    const/4 v0, 0x0

    .line 47
    iput-object v0, p0, Lcom/tencent/liteav/videoproducer2/SystemNotificationMonitor;->mTimer:Lcom/tencent/liteav/base/util/w;
    :try_end_14
    .catchall {:try_start_1 .. :try_end_14} :catchall_16

    .line 49
    :cond_14
    monitor-exit p0

    return-void

    :catchall_16
    move-exception v0

    monitor-exit p0

    throw v0
.end method