e.smali

.class public Lcn/jiguang/bk/e;
.super Ljava/lang/Object;


# static fields
.field private static a:Landroid/content/SharedPreferences;


# direct methods
.method private static a(J)J
    .registers 8

    const-wide/16 v4, 0x2

    rem-long v0, p0, v4

    const-wide/16 v2, 0x0

    cmp-long v0, v0, v2

    if-nez v0, :cond_11

    const-wide/16 v0, 0x1

    add-long/2addr v0, p0

    :goto_d
    const-wide/16 v2, 0x7fff

    rem-long/2addr v0, v2

    return-wide v0

    :cond_11
    add-long v0, p0, v4

    goto :goto_d
.end method

.method private static a(Landroid/content/Context;J)J
    .registers 8

    invoke-static {p0}, Lcn/jiguang/bk/e;->c(Landroid/content/Context;)Landroid/content/SharedPreferences;

    move-result-object v0

    const-string v1, "next_rid"

    invoke-interface {v0, v1, p1, p2}, Landroid/content/SharedPreferences;->getLong(Ljava/lang/String;J)J

    move-result-wide v0

    cmp-long v2, v0, p1

    if-eqz v2, :cond_23

    invoke-static {v0, v1}, Lcn/jiguang/bk/e;->a(J)J

    move-result-wide v0

    invoke-static {p0}, Lcn/jiguang/bk/e;->c(Landroid/content/Context;)Landroid/content/SharedPreferences;

    move-result-object v2

    invoke-interface {v2}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v2

    const-string v3, "next_rid"

    invoke-interface {v2, v3, v0, v1}, Landroid/content/SharedPreferences$Editor;->putLong(Ljava/lang/String;J)Landroid/content/SharedPreferences$Editor;

    move-result-object v2

    invoke-interface {v2}, Landroid/content/SharedPreferences$Editor;->apply()V

    :cond_23
    return-wide v0
.end method

.method public static a(Landroid/content/Context;)V
    .registers 3

    const-string v0, "cn.jpush.preferences.support.rid"

    const/4 v1, 0x0

    invoke-virtual {p0, v0, v1}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v0

    sput-object v0, Lcn/jiguang/bk/e;->a:Landroid/content/SharedPreferences;

    return-void
.end method

.method public static declared-synchronized b(Landroid/content/Context;)J
    .registers 7

    const-wide/16 v4, -0x1

    const-class v2, Lcn/jiguang/bk/e;

    monitor-enter v2

    const-wide/16 v0, -0x1

    :try_start_7
    invoke-static {p0, v0, v1}, Lcn/jiguang/bk/e;->a(Landroid/content/Context;J)J

    move-result-wide v0

    cmp-long v3, v0, v4

    if-nez v3, :cond_34

    new-instance v0, Ljava/util/Random;

    invoke-direct {v0}, Ljava/util/Random;-><init>()V

    const/16 v1, 0x7fff

    invoke-virtual {v0, v1}, Ljava/util/Random;->nextInt(I)I

    move-result v0

    invoke-static {v0}, Ljava/lang/Math;->abs(I)I

    move-result v0

    int-to-long v0, v0

    invoke-static {v0, v1}, Lcn/jiguang/bk/e;->a(J)J

    move-result-wide v0

    invoke-static {p0}, Lcn/jiguang/bk/e;->c(Landroid/content/Context;)Landroid/content/SharedPreferences;

    move-result-object v3

    invoke-interface {v3}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v3

    const-string v4, "next_rid"

    invoke-interface {v3, v4, v0, v1}, Landroid/content/SharedPreferences$Editor;->putLong(Ljava/lang/String;J)Landroid/content/SharedPreferences$Editor;

    move-result-object v3

    invoke-interface {v3}, Landroid/content/SharedPreferences$Editor;->apply()V
    :try_end_34
    .catchall {:try_start_7 .. :try_end_34} :catchall_36

    :cond_34
    monitor-exit v2

    return-wide v0

    :catchall_36
    move-exception v0

    monitor-exit v2

    throw v0
.end method

.method private static c(Landroid/content/Context;)Landroid/content/SharedPreferences;
    .registers 2

    sget-object v0, Lcn/jiguang/bk/e;->a:Landroid/content/SharedPreferences;

    if-nez v0, :cond_7

    invoke-static {p0}, Lcn/jiguang/bk/e;->a(Landroid/content/Context;)V

    :cond_7
    sget-object v0, Lcn/jiguang/bk/e;->a:Landroid/content/SharedPreferences;

    return-object v0
.end method