[XPERIA X10 Android Development] alzbac:
And Sound smali

.class public Lcom/android/settings/SoundSettings;
.super Landroid/preference/PreferenceActivity;
.source "SoundSettings.java"

# interfaces
.implements Landroid/preference/Preference$OnPreferenceChangeListener;

# instance fields
.field private mAudioManager:Landroid/media/AudioManager;

.field private mDtmfTone:Landroid/preference/CheckBoxPreference;

.field private mHapticFeedback:Landroid/preference/CheckBoxPreference;

.field private mLockSounds:Landroid/preference/CheckBoxPreference;

.field private mNotificationPulse:Landroid/preference/CheckBoxPreference;

.field private mReceiver:Landroid/content/BroadcastReceiver;

.field private mSilent:Landroid/preference/CheckBoxPreference;

.field private mSoundEffects:Landroid/preference/CheckBoxPreference;

.field private mSoundSettings:Landroid/preference/PreferenceGroup;

.field private mVibrate:Landroid/preference/ListPreference;

.field private mXLoudEnabled:Landroid/preference/CheckBoxPreference;

# direct methods
.method public constructor <init>()V
.locals 1

.prologue
.line 51
invoke-direct {p0}, Landroid/preference/PreferenceActivity;-><init>()V

.line 108
new-instance v0, Lcom/android/settings/SoundSettings$1;

invoke-direct {v0, p0}, Lcom/android/settings/SoundSettings$1;-><init>(Lcom/android/settings/SoundSettings;)V

iput-object v0, p0, Lcom/android/settings/SoundSettings;->mReceiver:Landroid/content/BroadcastReceiver;

return-void
.end method

.method static synthetic access$000(Lcom/android/settings/SoundSettings;Z)V
.locals 0
.parameter "x0"
.parameter "x1"

.prologue
.line 51
invoke-direct {p0, p1}, Lcom/android/settings/SoundSettings;->updateState(Z)V

return-void
.end method

.method private getPhoneVibrateSettingValue()Ljava/lang/String;
.locals 7

.prologue
const/4 v6, 0x2

const/4 v5, 0x1

const/4 v4, 0x0

.line 214
invoke-virtual {p0}, Lcom/android/settings/SoundSettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v2

const-string v3, "vibrate_in_silent"

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

move-result v2

if-ne v2, v5, :cond_1

move v1, v5

.line 220
.local v1, vibeInSilent:Z
:goto_0
iget-object v2, p0, Lcom/android/settings/SoundSettings;->mAudioManager:Landroid/media/AudioManager;

invoke-virtual {v2, v4}, Landroid/media/AudioManager;->getVibrateSetting(I)I

move-result v0

.line 223
.local v0, callsVibrateSetting:I
if-eqz v1, :cond_3

.line 224
if-nez v0, :cond_0

.line 226
iget-object v2, p0, Lcom/android/settings/SoundSettings;->mAudioManager:Landroid/media/AudioManager;

invoke-virtual {v2, v4, v6}, Landroid/media/AudioManager;->setVibrateSetting(II)V

.line 230
:cond_0
if-ne v0, v5, :cond_2

.line 231
const-string v2, "always"

.line 245
:goto_1
return-object v2

.end local v0 #callsVibrateSetting:I
.end local v1 #vibeInSilent:Z
:cond_1
move v1, v4

.line 214
goto :goto_0

.line 233
.restart local v0 #callsVibrateSetting:I
.restart local v1 #vibeInSilent:Z
:cond_2
const-string v2, "silent"

goto :goto_1

.line 236
:cond_3
if-ne v0, v6, :cond_4

.line 238
iget-object v2, p0, Lcom/android/settings/SoundSettings;->mAudioManager:Landroid/media/AudioManager;

invoke-virtual {v2, v4, v4}, Landroid/media/AudioManager;->setVibrateSetting(II)V

.line 242
:cond_4
if-ne v0, v5, :cond_5

.line 243
const-string v2, "notsilent"

goto :goto_1

.line 245
:cond_5
const-string v2, "never"

goto :goto_1
.end method

.method private setPhoneVibrateSettingValue(Ljava/lang/String;)V
.locals 7
.parameter "value"

.prologue
const/4 v6, 0x1

const/4 v5, 0x0

.line 254
const-string v2, "notsilent"

invoke-virtual {p1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_1

.line 255
const/4 v0, 0x1

.line 256
.local v0, callsVibrateSetting:I
const/4 v1, 0x0

.line 268
.local v1, vibeInSilent:Z
:goto_0
invoke-virtual {p0}, Lcom/android/settings/SoundSettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v2

const-string v3, "vibrate_in_silent"

if-eqz v1, :cond_4

move v4, v6

:goto_1
invoke-static {v2, v3, v4}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

.line 274
iget-object v2, p0, Lcom/android/settings/SoundSettings;->mSilent:Landroid/preference/CheckBoxPreference;

invoke-virtual {v2}, Landroid/preference/CheckBoxPreference;->isChecked()Z

move-result v2

if-eqz v2, :cond_0

.line 275
iget-object v2, p0, Lcom/android/settings/SoundSettings;->mAudioManager:Landroid/media/AudioManager;

if-eqz v1, :cond_5

move v3, v6

:goto_2
invoke-virtual {v2, v3}, Landroid/media/AudioManager;->setRingerMode(I)V

.line 280
:cond_0
iget-object v2, p0, Lcom/android/settings/SoundSettings;->mAudioManager:Landroid/media/AudioManager;

invoke-virtual {v2, v5, v0}, Landroid/media/AudioManager;->setVibrateSetting(II)V

.line 283
return-void

.line 257
.end local v0 #callsVibrateSetting:I
.end local v1 #vibeInSilent:Z
:cond_1
const-string v2, "never"

invoke-virtual {p1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_2

.line 258
const/4 v0, 0x0

.line 259
.restart local v0 #callsVibrateSetting:I
const/4 v1, 0x0

.restart local v1 #vibeInSilent:Z
goto :goto_0

.line 260
.end local v0 #callsVibrateSetting:I
.end local v1 #vibeInSilent:Z
:cond_2
const-string v2, "silent"

invoke-virtual {p1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-eqz v2, :cond_3

.line 261
const/4 v0, 0x2

.line 262
.restart local v0 #callsVibrateSetting:I
const/4 v1, 0x1

.restart local v1 #vibeInSilent:Z
goto :goto_0

.line 264
.end local v0 #callsVibrateSetting:I
.end local v1 #vibeInSilent:Z
:cond_3
const/4 v0, 0x1

.line 265
.restart local v0 #callsVibrateSetting:I
const/4 v1, 0x1

.restart local v1 #vibeInSilent:Z
goto :goto_0

:cond_4
move v4, v5

.line 268
goto :goto_1

:cond_5
move v3, v5

.line 275
goto :goto_2
.end method

.method private updateState(Z)V
.locals 9
.parameter "force"

.prologue
const/4 v8, 0x1

const/4 v7, 0x0

.line 287
iget-object v5, p0, Lcom/android/settings/SoundSettings;->mAudioManager:Landroid/media/AudioManager;

invoke-virtual {v5}, Landroid/media/AudioManager;->getRingerMode()I

move-result v2

.line 292
.local v2, ringerMode:I
const/4 v5, 0x2

if-eq v2, v5, :cond_4

move v4, v8

.line 295
.local v4, silentOrVibrateMode:Z
:goto_0
iget-object v5, p0, Lcom/android/settings/SoundSettings;->mSilent:Landroid/preference/CheckBoxPreference;

invoke-virtual {v5}, Landroid/preference/CheckBoxPreference;->isChecked()Z

move-result v5

if-ne v4, v5, :cond_0

if-eqz p1, :cond_1

.line 296
:cond_0
iget-object v5, p0, Lcom/android/settings/SoundSettings;->mSilent:Landroid/preference/CheckBoxPreference;

invoke-virtual {v5, v4}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V

.line 299
:cond_1
invoke-direct {p0}, Lcom/android/settings/SoundSettings;->getPhoneVibrateSettingValue()Ljava/lang/String;

move-result-object v1

.line 301
.local v1, phoneVibrateSetting:Ljava/lang/String;
iget-object v5, p0, Lcom/android/settings/SoundSettings;->mVibrate:Landroid/preference/ListPreference;

invoke-virtual {v5}, Landroid/preference/ListPreference;->getValue()Ljava/lang/String;

move-result-object v5

invoke-virtual {v1, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v5

if-eqz v5, :cond_2

if-eqz p1, :cond_3

.line 302
:cond_2
iget-object v5, p0, Lcom/android/settings/SoundSettings;->mVibrate:Landroid/preference/ListPreference;

invoke-virtual {v5, v1}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V

.line 304
:cond_3
iget-object v5, p0, Lcom/android/settings/SoundSettings;->mVibrate:Landroid/preference/ListPreference;

iget-object v6, p0, Lcom/android/settings/SoundSettings;->mVibrate:Landroid/preference/ListPreference;

invoke-virtual {v6}, Landroid/preference/ListPreference;->getEntry()Ljava/lang/CharSequence;

move-result-object v6

invoke-virtual {v5, v6}, Landroid/preference/ListPreference;->setSummary(Ljava/lang/CharSequence;)V

.line 306
invoke-virtual {p0}, Lcom/android/settings/SoundSettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v5

const-string v6, "mode_ringer_streams_affected"

invoke-static {v5, v6, v7}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v3

.line 308
.local v3, silentModeStreams:I
and-int/lit8 v5, v3, 0x10

if-eqz v5, :cond_5

move v0, v8

.line 309
.local v0, isAlarmInclSilentMode:Z
:goto_1
iget-object v5, p0, Lcom/android/settings/SoundSettings;->mSilent:Landroid/preference/CheckBoxPreference;

if-eqz v0, :cond_6

const v6, 0x7f0801be

:goto_2
invoke-virtual {v5, v6}, Landroid/preference/CheckBoxPreference;->setSummary(I)V

.line 312
return-void

.end local v0 #isAlarmInclSilentMode:Z
.end local v1 #phoneVibrateSetting:Ljava/lang/String;
.end local v3 #silentModeStreams:I
.end local v4 #silentOrVibrateMode:Z
:cond_4
move v4, v7

.line 292
goto :goto_0

.restart local v1 #phoneVibrateSetting:Ljava/lang/String;
.restart local v3 #silentModeStreams:I
.restart local v4 #silentOrVibrateMode:Z
:cond_5
move v0, v7

.line 308
goto :goto_1

.line 309
.restart local v0 #isAlarmInclSilentMode:Z
:cond_6
const v6, 0x7f0801bd

goto :goto_2
.end method

# virtual methods
.method protected onCreate(Landroid/os/Bundle;)V
.locals 11
.parameter "savedInstanceState"

.prologue
const/4 v9, 0x2

const/4 v7, 0x1

const/4 v6, 0x0

const-string v10, "dtmf_tone"

const-string v8, "emergency_tone"

.line 121
invoke-super {p0, p1}, Landroid/preference/PreferenceActivity;->onCreate(Landroid/os/Bundle;)V

.line 122
invoke-virtual {p0}, Lcom/android/settings/SoundSettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v2

.line 123
.local v2, resolver:Landroid/content/ContentResolver;
invoke-static {}, Landroid/telephony/TelephonyManager;->getDefault()Landroid/telephony/TelephonyManager;

move-result-object v4

invoke-virtual {v4}, Landroid/telephony/TelephonyManager;->getPhoneType()I

move-result v0

.line 125
.local v0, activePhoneType:I
const-string v4, "audio"

invoke-virtual {p0, v4}, Lcom/android/settings/SoundSettings;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

move-result-object v4

check-cast v4, Landroid/media/AudioManager;

iput-object v4, p0, Lcom/android/settings/SoundSettings;->mAudioManager:Landroid/media/AudioManager;

.line 127
const v4, 0x7f040023

invoke-virtual {p0, v4}, Lcom/android/settings/SoundSettings;->addPreferencesFromResource(I)V

.line 129
if-eq v9, v0, :cond_0

.line 131
invoke-virtual {p0}, Lcom/android/settings/SoundSettings;->getPreferenceScreen()Landroid/preference/PreferenceScreen;

move-result-object v4

const-string v5, "emergency_tone"

invoke-virtual {p0, v8}, Lcom/android/settings/SoundSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v5

invoke-virtual {v4, v5}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z

.line 134
:cond_0
const-string v4, "silent"

invoke-virtual {p0, v4}, Lcom/android/settings/SoundSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v4

check-cast v4, Landroid/preference/CheckBoxPreference;

iput-object v4, p0, Lcom/android/settings/SoundSettings;->mSilent:Landroid/preference/CheckBoxPreference;

.line 136
const-string v4, "vibrate"

invoke-virtual {p0, v4}, Lcom/android/settings/SoundSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v4

check-cast v4, Landroid/preference/ListPreference;

iput-object v4, p0, Lcom/android/settings/SoundSettings;->mVibrate:Landroid/preference/ListPreference;

.line 137
iget-object v4, p0, Lcom/android/settings/SoundSettings;->mVibrate:Landroid/preference/ListPreference;

invoke-virtual {v4, p0}, Landroid/preference/ListPreference;->setOnPreferenceChangeListener(Landroid/preference/Preference$OnPreferenceChangeListener;)V

.line 139
const-string v4, "dtmf_tone"

invoke-virtual {p0, v10}, Lcom/android/settings/SoundSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v4

check-cast v4, Landroid/preference/CheckBoxPreference;

iput-object v4, p0, Lcom/android/settings/SoundSettings;->mDtmfTone:Landroid/preference/CheckBoxPreference;

.line 140
iget-object v4, p0, Lcom/android/settings/SoundSettings;->mDtmfTone:Landroid/preference/CheckBoxPreference;

invoke-virtual {v4, v6}, Landroid/preference/CheckBoxPreference;->setPersistent(Z)V

.line 141
iget-object v4, p0, Lcom/android/settings/SoundSettings;->mDtmfTone:Landroid/preference/CheckBoxPreference;

const-string v5, "dtmf_tone"

invoke-static {v2, v10, v7}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v5

if-eqz v5, :cond_2

move v5, v7

:goto_0
invoke-virtual {v4, v5}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V

.line 143
const-string v4, "sound_effects"

invoke-virtual {p0, v4}, Lcom/android/settings/SoundSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v4

check-cast v4, Landroid/preference/CheckBoxPreference;

iput-object v4, p0, Lcom/android/settings/SoundSettings;->mSoundEffects:Landroid/preference/CheckBoxPreference;

.line 144
iget-object v4, p0, Lcom/android/settings/SoundSettings;->mSoundEffects:Landroid/preference/CheckBoxPreference;

invoke-virtual {v4, v6}, Landroid/preference/CheckBoxPreference;->setPersistent(Z)V

.line 145
iget-object v4, p0, Lcom/android/settings/SoundSettings;->mSoundEffects:Landroid/preference/CheckBoxPreference;

const-string v5, "sound_effects_enabled"

invoke-static {v2, v5, v6}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v5

if-eqz v5, :cond_3

move v5, v7

:goto_1
invoke-virtual {v4, v5}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V

.line 147
const-string v4, "haptic_feedback"

invoke-virtual {p0, v4}, Lcom/android/settings/SoundSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v4

check-cast v4, Landroid/preference/CheckBoxPreference;

iput-object v4, p0, Lcom/android/settings/SoundSettings;->mHapticFeedback:Landroid/preference/CheckBoxPreference;

.line 148
iget-object v4, p0, Lcom/android/settings/SoundSettings;->mHapticFeedback:Landroid/preference/CheckBoxPreference;

invoke-virtual {v4, v6}, Landroid/preference/CheckBoxPreference;->setPersistent(Z)V

.line 149
iget-object v4, p0, Lcom/android/settings/SoundSettings;->mHapticFeedback:Landroid/preference/CheckBoxPreference;

const-string v5, "haptic_feedback_enabled"

invoke-static {v2, v5, v6}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v5

if-eqz v5, :cond_4

move v5, v7

:goto_2
invoke-virtual {v4, v5}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V

.line 151
const-string v4, "lock_sounds"

invoke-virtual {p0, v4}, Lcom/android/settings/SoundSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v4

check-cast v4, Landroid/preference/CheckBoxPreference;

iput-object v4, p0, Lcom/android/settings/SoundSettings;->mLockSounds:Landroid/preference/CheckBoxPreference;

.line 152
iget-object v4, p0, Lcom/android/settings/SoundSettings;->mLockSounds:Landroid/preference/CheckBoxPreference;

invoke-virtual {v4, v6}, Landroid/preference/CheckBoxPreference;->setPersistent(Z)V

.line 153
iget-object v4, p0, Lcom/android/settings/SoundSettings;->mLockSounds:Landroid/preference/CheckBoxPreference;

const-string v5, "lockscreen_sounds_enabled"

invoke-static {v2, v5, v7}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v5

if-eqz v5, :cond_5

move v5, v7

:goto_3
invoke-virtual {v4, v5}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V

.line 156
if-ne v9, v0, :cond_1

.line 157
const-string v4, "emergency_tone"

invoke-virtual {p0, v8}, Lcom/android/settings/SoundSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v1

check-cast v1, Landroid/preference/ListPreference;

.line 159
.local v1, emergencyTonePreference:Landroid/preference/ListPreference;
const-string v4, "emergency_tone"

invoke-static {v2, v8, v6}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v4

invoke-static {v4}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

move-result-object v4

invoke-virtual {v1, v4}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V

.line 161
invoke-virtual {v1, p0}, Landroid/preference/ListPreference;->setOnPreferenceChangeListener(Landroid/preference/Preference$OnPreferenceChangeListener;)V

.line 164
.end local v1 #emergencyTonePreference:Landroid/preference/ListPreference;
:cond_1
const-string v4, "sound_settings"

invoke-virtual {p0, v4}, Lcom/android/settings/SoundSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v4

check-cast v4, Landroid/preference/PreferenceGroup;

iput-object v4, p0, Lcom/android/settings/SoundSettings;->mSoundSettings:Landroid/preference/PreferenceGroup;

.line 165
iget-object v4, p0, Lcom/android/settings/SoundSettings;->mSoundSettings:Landroid/preference/PreferenceGroup;

const-string v5, "notification_pulse"

invoke-virtual {v4, v5}, Landroid/preference/PreferenceGroup;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v4

check-cast v4, Landroid/preference/CheckBoxPreference;

iput-object v4, p0, Lcom/android/settings/SoundSettings;->mNotificationPulse:Landroid/preference/CheckBoxPreference;

.line 167
iget-object v4, p0, Lcom/android/settings/SoundSettings;->mNotificationPulse:Landroid/preference/CheckBoxPreference;

if-eqz v4, :cond_6

invoke-virtual {p0}, Lcom/android/settings/SoundSettings;-