.class public abstract Lcom/android/systemui/qs/QSTileSystemSettingObserver;
.super Landroid/database/ContentObserver;
.source "QSTileSystemSettingObserver.java"

# interfaces
.implements Lcom/android/systemui/statusbar/policy/Listenable;


# static fields
.field private static final DEFAULT:I


# instance fields
.field private final mContext:Landroid/content/Context;

.field private mListening:Z

.field private mObservedValue:I

.field private final mSettingName:Ljava/lang/String;

.field private mUserId:I


# direct methods
.method public constructor <init>(Landroid/content/Context;Landroid/os/Handler;Ljava/lang/String;)V
    .locals 1

    invoke-direct {p0, p2}, Landroid/database/ContentObserver;-><init>(Landroid/os/Handler;)V

    const/4 v0, 0x0

    iput v0, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mObservedValue:I

    iput-object p1, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mContext:Landroid/content/Context;

    iput-object p3, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mSettingName:Ljava/lang/String;

    invoke-static {}, Landroid/app/ActivityManager;->getCurrentUser()I

    move-result v0

    iput v0, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mUserId:I

    return-void
.end method


# virtual methods
.method public getValue()I
    .locals 4

    iget-object v0, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mContext:Landroid/content/Context;

    invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    iget-object v1, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mSettingName:Ljava/lang/String;

    iget v2, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mUserId:I

    const/4 v3, 0x0

    invoke-static {v0, v1, v3, v2}, Landroid/provider/Settings$System;->getIntForUser(Landroid/content/ContentResolver;Ljava/lang/String;II)I

    move-result v0

    return v0
.end method

.method protected abstract handleValueChanged(IZ)V
.end method

.method public onChange(Z)V
    .locals 2

    invoke-virtual {p0}, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->getValue()I

    move-result v0

    iget v1, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mObservedValue:I

    if-eq v0, v1, :cond_0

    const/4 v1, 0x1

    :goto_0
    invoke-virtual {p0, v0, v1}, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->handleValueChanged(IZ)V

    iput v0, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mObservedValue:I

    return-void

    :cond_0
    const/4 v1, 0x0

    goto :goto_0
.end method

.method public setListening(Z)V
    .locals 4

    const/4 v3, 0x0

    iget-boolean v0, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mListening:Z

    if-ne p1, v0, :cond_0

    return-void

    :cond_0
    iput-boolean p1, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mListening:Z

    if-eqz p1, :cond_1

    invoke-virtual {p0}, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->getValue()I

    move-result v0

    iput v0, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mObservedValue:I

    iget-object v0, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mContext:Landroid/content/Context;

    invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    iget-object v1, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mSettingName:Ljava/lang/String;

    invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v1

    iget v2, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mUserId:I

    invoke-virtual {v0, v1, v3, p0, v2}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;I)V

    :goto_0
    return-void

    :cond_1
    iget-object v0, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mContext:Landroid/content/Context;

    invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    invoke-virtual {v0, p0}, Landroid/content/ContentResolver;->unregisterContentObserver(Landroid/database/ContentObserver;)V

    iput v3, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mObservedValue:I

    goto :goto_0
.end method

.method public setUserId(I)V
    .locals 1

    iput p1, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mUserId:I

    iget-boolean v0, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mListening:Z

    if-eqz v0, :cond_0

    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->setListening(Z)V

    const/4 v0, 0x1

    invoke-virtual {p0, v0}, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->setListening(Z)V

    :cond_0
    return-void
.end method

.method public setValue(I)V
    .locals 3

    iget-object v0, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mContext:Landroid/content/Context;

    invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    iget-object v1, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mSettingName:Ljava/lang/String;

    iget v2, p0, Lcom/android/systemui/qs/QSTileSystemSettingObserver;->mUserId:I

    invoke-static {v0, v1, p1, v2}, Landroid/provider/Settings$System;->putIntForUser(Landroid/content/ContentResolver;Ljava/lang/String;II)Z

    return-void
.end method
