Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[MOD][HOW-TO] Add Flashlight quick toggle [4.3|4.4]

OP CNexus

3rd October 2014, 06:51 AM   |  #401  
oneleft.ak's Avatar
Junior Member
Flag Anchorage
Thanks Meter: 24
 
20 posts
Join Date:Joined: Aug 2012
Donate to Me
More
Cant get systemui.apk to compile with the flashlight smali provided by OP
I had no problems decompiling systemui.apk using apktool 2.0.0rc1. However, I noticed there was already a FlashLightQuickSettingButton.smali file in systemui. When I replaced the FlashLightQuickSettingButton.smali with the file provided by the OP I got the following error when trying to re-compile systemui:
Code:
I: Smaling...
systemui\smali\com\android\systemui\statusbar\policy\quicksetting\FlashLightQuic
kSettingButton.smali[22,4] Error for input '.parameter': Invalid directive
systemui\smali\com\android\systemui\statusbar\policy\quicksetting\FlashLightQuic
kSettingButton.smali[22,15] mismatched input '"context"' expecting END_METHOD_DI
RECTIVE
systemui\smali\com\android\systemui\statusbar\policy\quicksetting\FlashLightQuic
kSettingButton.smali[121,4] Error for input '.parameter': Invalid directive
systemui\smali\com\android\systemui\statusbar\policy\quicksetting\FlashLightQuic
kSettingButton.smali[121,15] mismatched input '"paramBoolean"' expecting END_MET
HOD_DIRECTIVE
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file
: com/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButto
n.smali
        at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:72)
        at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:56)
        at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:41)
        at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:342)
        at brut.androlib.Androlib.buildSources(Androlib.java:303)
        at brut.androlib.Androlib.build(Androlib.java:289)
        at brut.androlib.Androlib.build(Androlib.java:262)
        at brut.apktool.Main.cmdBuild(Main.java:236)
        at brut.apktool.Main.main(Main.java:88)
Here is the content of the original FlashLightQuickSettingButton.smali:

Code:
.class public Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;
.super Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;
.source "FlashLightQuickSettingButton.java"

# interfaces
.implements Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton$Listener;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton$FlashLightObserver;
    }
.end annotation


# static fields
.field private static final TW_TAG:Ljava/lang/String; = "STATUSBAR-FlashLightController"


# instance fields
.field private mContentResolver:Landroid/content/ContentResolver;

.field private mFlashLightObserver:Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton$FlashLightObserver;

.field private mState:Z


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 9
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    const v1, 0x7f0b020f

    const/4 v8, 0x1

    const/4 v5, 0x0

    .line 49
    const/4 v0, 0x0

    sget-boolean v2, Lcom/android/systemui/statusbar/Feature;->mIsTablet:Z

    invoke-direct {p0, p1, v0, v2}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;Z)V

    .line 50
    const v3, 0x7f02020f

    const v4, 0x7f020211

    move-object v0, p0

    move v2, v1

    move v6, v5

    move v7, v5

    invoke-virtual/range {v0 .. v7}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->initLayout(IIIIIII)V

    .line 57
    invoke-virtual {p0, p0}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->setListener(Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton$Listener;)V

    .line 58
    invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    const-string v1, "flash_light_start"

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

    move-result v0

    if-eqz v0, :cond_0

    move v5, v8

    :cond_0
    iput-boolean v5, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mState:Z

    .line 59
    iget-boolean v0, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mState:Z

    if-eqz v0, :cond_1

    :goto_0
    invoke-virtual {p0, v8}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->setActivateStatus(I)V

    .line 60
    invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    iput-object v0, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mContentResolver:Landroid/content/ContentResolver;

    .line 61
    new-instance v0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton$FlashLightObserver;

    invoke-direct {v0, p0}, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton$FlashLightObserver;-><init>(Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;)V

    iput-object v0, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mFlashLightObserver:Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton$FlashLightObserver;

    .line 62
    return-void

    .line 59
    :cond_1
    const/4 v8, 0x2

    goto :goto_0
.end method

.method static synthetic access$000(Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;)Z
    .locals 1
    .param p0, "x0"    # Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;

    .prologue
    .line 40
    iget-boolean v0, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mState:Z

    return v0
.end method

.method static synthetic access$002(Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;Z)Z
    .locals 0
    .param p0, "x0"    # Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;
    .param p1, "x1"    # Z

    .prologue
    .line 40
    iput-boolean p1, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mState:Z

    return p1
.end method

.method static synthetic access$100(Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;)Landroid/content/ContentResolver;
    .locals 1
    .param p0, "x0"    # Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;

    .prologue
    .line 40
    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mContentResolver:Landroid/content/ContentResolver;

    return-object v0
.end method


# virtual methods
.method public deinit()V
    .locals 2

    .prologue
    .line 70
    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mContentResolver:Landroid/content/ContentResolver;

    iget-object v1, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mFlashLightObserver:Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton$FlashLightObserver;

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

    .line 71
    return-void
.end method

.method public init()V
    .locals 5

    .prologue
    .line 65
    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mContentResolver:Landroid/content/ContentResolver;

    const-string v1, "flash_light_start"

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

    move-result-object v1

    const/4 v2, 0x0

    iget-object v3, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mFlashLightObserver:Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton$FlashLightObserver;

    const/4 v4, -0x2

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

    .line 67
    return-void
.end method

.method public onClick(Z)V
    .locals 3
    .param p1, "state"    # Z

    .prologue
    .line 74
    const-string v0, "STATUSBAR-FlashLightController"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "onClick state="

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Landroid/util/secutil/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 75
    const/4 v0, 0x1

    if-ne p1, v0, :cond_0

    .line 77
    const-string v0, "com.android.settings"

    const-string v1, "com.android.settings.flashlight.FlashLightDisplay"

    invoke-virtual {p0, v0, v1}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->callActivity(Ljava/lang/String;Ljava/lang/String;)V

    .line 83
    :goto_0
    return-void

    .line 81
    :cond_0
    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mContentResolver:Landroid/content/ContentResolver;

    const-string v1, "flash_light_start"

    const/4 v2, 0x0

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

    goto :goto_0
.end method

.method public onLongClick()V
    .locals 0

    .prologue
    .line 88
    return-void
.end method


Here is the content of the FlashLightQuickSettingButton.smali from the zip in OP that is throwing the error on compile:
Code:
.class public Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;
.super Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;
.source "FlashlightQuickSettingButton.java"

# interfaces
.implements Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton$Listener;


# static fields
.field private static final TW_TAG:Ljava/lang/String; = "STATUSBAR-FlashlightQuickSettingButton"


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

.field private mFlashlight:I


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 7
    .parameter "context"

    .prologue
    const/4 v4, 0x0

    .line 16
    const/4 v0, 0x0

    invoke-direct {p0, p1, v0, v4}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;Z)V

    .line 17
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    const-string v1, "quickpanel_flashlight_text"

    const-string v2, "string"

    const-string v3, "com.android.systemui"

    invoke-virtual {v0, v1, v2, v3}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I

    move-result v1

    .line 18
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    const-string v2, "tw_quick_panel_icon_flashlight_on"

    const-string v3, "drawable"

    const-string v5, "com.android.systemui"

    invoke-virtual {v0, v2, v3, v5}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I

    move-result v2

    .line 19
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    const-string v3, "tw_quick_panel_icon_flashlight_off"

    const-string v5, "drawable"

    const-string v6, "com.android.systemui"

    invoke-virtual {v0, v3, v5, v6}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I

    move-result v3

    move-object v0, p0

    move v5, v4

    move v6, v4

    .line 17
    invoke-virtual/range {v0 .. v6}, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->initLayout(IIIIII)V

    .line 23
    iput-object p1, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->mContext:Landroid/content/Context;

    .line 24
    invoke-virtual {p0, p0}, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->setListener(Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton$Listener;)V

    .line 25
    return-void
.end method


# virtual methods
.method public deinit()V
    .locals 0

    .prologue
    .line 27
    return-void
.end method

.method public init()V
    .locals 1

    .prologue
    .line 30
    const/4 v0, 0x2

    invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->setActivateStatus(I)V

    .line 31
    return-void
.end method

.method public onClick(Z)V
    .locals 5
    .parameter "paramBoolean"

    .prologue
    .line 34
    const/4 v2, 0x0

    .line 35
    .local v2, localIntent:Landroid/content/Intent;
    const/4 v1, 0x0

    .line 37
    .local v1, bc:Ljava/lang/String;
    const/4 v0, 0x2

    .line 39
    .local v0, activateStatus:I
    iget v3, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->mFlashlight:I

    add-int/lit8 v3, v3, 0x1

    iput v3, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->mFlashlight:I

    .line 41
    iget v3, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->mFlashlight:I

    rem-int/lit8 v3, v3, 0x2

    iput v3, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->mFlashlight:I

    .line 43
    iget v3, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->mFlashlight:I

    const/4 v4, 0x1

    if-ne v3, v4, :cond_0

    .line 44
    const-string v1, "com.sec.samsung.torchwidget.torch_on_3"

    .line 45
    const/4 v0, 0x1

    .line 50
    :goto_0
    invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->setActivateStatus(I)V

    .line 52
    new-instance v2, Landroid/content/Intent;

    .end local v2           #localIntent:Landroid/content/Intent;
    invoke-direct {v2, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 54
    .restart local v2       #localIntent:Landroid/content/Intent;
    iget-object v3, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->mContext:Landroid/content/Context;

    invoke-virtual {v3, v2}, Landroid/content/Context;->sendBroadcast(Landroid/content/Intent;)V

    .line 55
    return-void

    .line 47
    :cond_0
    const-string v1, "com.sec.samsung.torchwidget.torch_off"

    goto :goto_0
.end method

.method public onLongClick()V
    .locals 0

    .prologue
    .line 57
    return-void
.end method


I am compiling for Stock Deodexed i747 4.4.2 NE4
Any help getting this to compile would be greatly appreciated-
3rd October 2014, 07:54 AM   |  #402  
oneleft.ak's Avatar
Junior Member
Flag Anchorage
Thanks Meter: 24
 
20 posts
Join Date:Joined: Aug 2012
Donate to Me
More
Quote:
Originally Posted by oneleft.ak

I had no problems decompiling systemui.apk using apktool 2.0.0rc1. However, I noticed there was already a FlashLightQuickSettingButton.smali file in systemui. When I replaced the FlashLightQuickSettingButton.smali with the file provided by the OP I got the following error when trying to re-compile systemui:

Code:
I: Smaling...
systemui\smali\com\android\systemui\statusbar\policy\quicksetting\FlashLightQuic
kSettingButton.smali[22,4] Error for input '.parameter': Invalid directive
systemui\smali\com\android\systemui\statusbar\policy\quicksetting\FlashLightQuic
kSettingButton.smali[22,15] mismatched input '"context"' expecting END_METHOD_DI
RECTIVE
systemui\smali\com\android\systemui\statusbar\policy\quicksetting\FlashLightQuic
kSettingButton.smali[121,4] Error for input '.parameter': Invalid directive
systemui\smali\com\android\systemui\statusbar\policy\quicksetting\FlashLightQuic
kSettingButton.smali[121,15] mismatched input '"paramBoolean"' expecting END_MET
HOD_DIRECTIVE
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file
: com/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButto
n.smali
        at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:72)
        at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:56)
        at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:41)
        at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:342)
        at brut.androlib.Androlib.buildSources(Androlib.java:303)
        at brut.androlib.Androlib.build(Androlib.java:289)
        at brut.androlib.Androlib.build(Androlib.java:262)
        at brut.apktool.Main.cmdBuild(Main.java:236)
        at brut.apktool.Main.main(Main.java:88)
Here is the content of the original FlashLightQuickSettingButton.smali:

Code:
.class public Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;
.super Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;
.source "FlashLightQuickSettingButton.java"

# interfaces
.implements Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton$Listener;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton$FlashLightObserver;
    }
.end annotation


# static fields
.field private static final TW_TAG:Ljava/lang/String; = "STATUSBAR-FlashLightController"


# instance fields
.field private mContentResolver:Landroid/content/ContentResolver;

.field private mFlashLightObserver:Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton$FlashLightObserver;

.field private mState:Z


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 9
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    const v1, 0x7f0b020f

    const/4 v8, 0x1

    const/4 v5, 0x0

    .line 49
    const/4 v0, 0x0

    sget-boolean v2, Lcom/android/systemui/statusbar/Feature;->mIsTablet:Z

    invoke-direct {p0, p1, v0, v2}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;Z)V

    .line 50
    const v3, 0x7f02020f

    const v4, 0x7f020211

    move-object v0, p0

    move v2, v1

    move v6, v5

    move v7, v5

    invoke-virtual/range {v0 .. v7}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->initLayout(IIIIIII)V

    .line 57
    invoke-virtual {p0, p0}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->setListener(Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton$Listener;)V

    .line 58
    invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    const-string v1, "flash_light_start"

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

    move-result v0

    if-eqz v0, :cond_0

    move v5, v8

    :cond_0
    iput-boolean v5, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mState:Z

    .line 59
    iget-boolean v0, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mState:Z

    if-eqz v0, :cond_1

    :goto_0
    invoke-virtual {p0, v8}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->setActivateStatus(I)V

    .line 60
    invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    iput-object v0, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mContentResolver:Landroid/content/ContentResolver;

    .line 61
    new-instance v0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton$FlashLightObserver;

    invoke-direct {v0, p0}, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton$FlashLightObserver;-><init>(Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;)V

    iput-object v0, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mFlashLightObserver:Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton$FlashLightObserver;

    .line 62
    return-void

    .line 59
    :cond_1
    const/4 v8, 0x2

    goto :goto_0
.end method

.method static synthetic access$000(Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;)Z
    .locals 1
    .param p0, "x0"    # Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;

    .prologue
    .line 40
    iget-boolean v0, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mState:Z

    return v0
.end method

.method static synthetic access$002(Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;Z)Z
    .locals 0
    .param p0, "x0"    # Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;
    .param p1, "x1"    # Z

    .prologue
    .line 40
    iput-boolean p1, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mState:Z

    return p1
.end method

.method static synthetic access$100(Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;)Landroid/content/ContentResolver;
    .locals 1
    .param p0, "x0"    # Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;

    .prologue
    .line 40
    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mContentResolver:Landroid/content/ContentResolver;

    return-object v0
.end method


# virtual methods
.method public deinit()V
    .locals 2

    .prologue
    .line 70
    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mContentResolver:Landroid/content/ContentResolver;

    iget-object v1, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mFlashLightObserver:Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton$FlashLightObserver;

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

    .line 71
    return-void
.end method

.method public init()V
    .locals 5

    .prologue
    .line 65
    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mContentResolver:Landroid/content/ContentResolver;

    const-string v1, "flash_light_start"

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

    move-result-object v1

    const/4 v2, 0x0

    iget-object v3, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mFlashLightObserver:Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton$FlashLightObserver;

    const/4 v4, -0x2

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

    .line 67
    return-void
.end method

.method public onClick(Z)V
    .locals 3
    .param p1, "state"    # Z

    .prologue
    .line 74
    const-string v0, "STATUSBAR-FlashLightController"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "onClick state="

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Landroid/util/secutil/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 75
    const/4 v0, 0x1

    if-ne p1, v0, :cond_0

    .line 77
    const-string v0, "com.android.settings"

    const-string v1, "com.android.settings.flashlight.FlashLightDisplay"

    invoke-virtual {p0, v0, v1}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->callActivity(Ljava/lang/String;Ljava/lang/String;)V

    .line 83
    :goto_0
    return-void

    .line 81
    :cond_0
    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashLightQuickSettingButton;->mContentResolver:Landroid/content/ContentResolver;

    const-string v1, "flash_light_start"

    const/4 v2, 0x0

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

    goto :goto_0
.end method

.method public onLongClick()V
    .locals 0

    .prologue
    .line 88
    return-void
.end method


Here is the content of the FlashLightQuickSettingButton.smali from the zip in OP that is throwing the error on compile:
Code:
.class public Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;
.super Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;
.source "FlashlightQuickSettingButton.java"

# interfaces
.implements Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton$Listener;


# static fields
.field private static final TW_TAG:Ljava/lang/String; = "STATUSBAR-FlashlightQuickSettingButton"


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

.field private mFlashlight:I


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 7
    .parameter "context"

    .prologue
    const/4 v4, 0x0

    .line 16
    const/4 v0, 0x0

    invoke-direct {p0, p1, v0, v4}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;Z)V

    .line 17
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    const-string v1, "quickpanel_flashlight_text"

    const-string v2, "string"

    const-string v3, "com.android.systemui"

    invoke-virtual {v0, v1, v2, v3}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I

    move-result v1

    .line 18
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    const-string v2, "tw_quick_panel_icon_flashlight_on"

    const-string v3, "drawable"

    const-string v5, "com.android.systemui"

    invoke-virtual {v0, v2, v3, v5}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I

    move-result v2

    .line 19
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    const-string v3, "tw_quick_panel_icon_flashlight_off"

    const-string v5, "drawable"

    const-string v6, "com.android.systemui"

    invoke-virtual {v0, v3, v5, v6}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I

    move-result v3

    move-object v0, p0

    move v5, v4

    move v6, v4

    .line 17
    invoke-virtual/range {v0 .. v6}, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->initLayout(IIIIII)V

    .line 23
    iput-object p1, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->mContext:Landroid/content/Context;

    .line 24
    invoke-virtual {p0, p0}, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->setListener(Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton$Listener;)V

    .line 25
    return-void
.end method


# virtual methods
.method public deinit()V
    .locals 0

    .prologue
    .line 27
    return-void
.end method

.method public init()V
    .locals 1

    .prologue
    .line 30
    const/4 v0, 0x2

    invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->setActivateStatus(I)V

    .line 31
    return-void
.end method

.method public onClick(Z)V
    .locals 5
    .parameter "paramBoolean"

    .prologue
    .line 34
    const/4 v2, 0x0

    .line 35
    .local v2, localIntent:Landroid/content/Intent;
    const/4 v1, 0x0

    .line 37
    .local v1, bc:Ljava/lang/String;
    const/4 v0, 0x2

    .line 39
    .local v0, activateStatus:I
    iget v3, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->mFlashlight:I

    add-int/lit8 v3, v3, 0x1

    iput v3, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->mFlashlight:I

    .line 41
    iget v3, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->mFlashlight:I

    rem-int/lit8 v3, v3, 0x2

    iput v3, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->mFlashlight:I

    .line 43
    iget v3, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->mFlashlight:I

    const/4 v4, 0x1

    if-ne v3, v4, :cond_0

    .line 44
    const-string v1, "com.sec.samsung.torchwidget.torch_on_3"

    .line 45
    const/4 v0, 0x1

    .line 50
    :goto_0
    invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->setActivateStatus(I)V

    .line 52
    new-instance v2, Landroid/content/Intent;

    .end local v2           #localIntent:Landroid/content/Intent;
    invoke-direct {v2, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 54
    .restart local v2       #localIntent:Landroid/content/Intent;
    iget-object v3, p0, Lcom/android/systemui/statusbar/policy/quicksetting/FlashlightQuickSettingButton;->mContext:Landroid/content/Context;

    invoke-virtual {v3, v2}, Landroid/content/Context;->sendBroadcast(Landroid/content/Intent;)V

    .line 55
    return-void

    .line 47
    :cond_0
    const-string v1, "com.sec.samsung.torchwidget.torch_off"

    goto :goto_0
.end method

.method public onLongClick()V
    .locals 0

    .prologue
    .line 57
    return-void
.end method


I am compiling for Stock Deodexed i747 4.4.2 NE4
Any help getting this to compile would be greatly appreciated-

EDIT- Looks like the answer is in post #289. Had to change the smali for apktool2
The Following User Says Thank You to oneleft.ak For This Useful Post: [ View ]
3rd October 2014, 07:55 PM   |  #403  
Senior Member
Flag chennai
Thanks Meter: 77
 
246 posts
Join Date:Joined: Jan 2012
More
But i got two different images in system ui and edit notification panel.
Please see the attachment.
Can you give any clue to solve this issue?
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2014-10-03-23-17-54.png
Views:	257
Size:	212.6 KB
ID:	2958884   Click image for larger version

Name:	Screenshot_2014-10-03-23-18-17.png
Views:	254
Size:	232.4 KB
ID:	2958885  
3rd October 2014, 10:56 PM   |  #404  
tdunham's Avatar
Recognized Contributor
TampaBay
Thanks Meter: 19,566
 
8,624 posts
Join Date:Joined: Jun 2008
Donate to Me
More
Quote:
Originally Posted by sudhamana

But i got two different images in system ui and edit notification panel.
Please see the attachment.
Can you give any clue to solve this issue?

I think you need the S5 style flashlight files. It was posted way back in the thread so I have no idea who posted it but try looking through the attached file.
And I 'think' I had an issue with the icons being slightly too large even though they were the same size resolution as the rest so I had to downsize one or more of them a little at a time until I was happy with the way they displayed.
Attached Files
File Type: zip Flashlight_Files_S5.zip - [Click for QR Code] (10.2 KB, 57 views)
The Following 6 Users Say Thank You to tdunham For This Useful Post: [ View ]
5th October 2014, 11:57 AM   |  #405  
Senior Member
Flag chennai
Thanks Meter: 77
 
246 posts
Join Date:Joined: Jan 2012
More
Thanks a lot.
Now the problem solved. .
Thank you once again.
13th November 2014, 05:24 AM   |  #406  
Senior Member
Thanks Meter: 48
 
211 posts
Join Date:Joined: Oct 2013
Hi

I have done everything stated in OP but my settings force closed when I try to edit quick panel settings...

Is it because I changed the string name of notification_panel_flashlight to Torch? I MUST use the name Flashlight?

any clue? please help me....

Here are the file (I already changed the string name back to Flashlight):
https://docs.google.com/uc?export=do...FV0S1VsNVRTQlk

Dear @tdunham, do you know why?
Last edited by edwardsiow; 13th November 2014 at 05:32 AM.
13th November 2014, 03:45 PM   |  #407  
tdunham's Avatar
Recognized Contributor
TampaBay
Thanks Meter: 19,566
 
8,624 posts
Join Date:Joined: Jun 2008
Donate to Me
More
Quote:
Originally Posted by edwardsiow

Hi

I have done everything stated in OP but my settings force closed when I try to edit quick panel settings...

Is it because I changed the string name of notification_panel_flashlight to Torch? I MUST use the name Flashlight?

any clue? please help me....

Here are the file (I already changed the string name back to Flashlight):
https://docs.google.com/uc?export=do...FV0S1VsNVRTQlk

Dear @tdunham, do you know why?

In strings.xml, you only changed this (see below)? The string name notification_panel_flashlight must stay the same unless you also change it in smali.

Code:
<string name="notification_panel_flashlight">Torch</string>


---------- Post added at 02:45 PM ---------- Previous post was at 02:37 PM ----------

Also Edward, you have this working 100% without making that change too?
The Following 3 Users Say Thank You to tdunham For This Useful Post: [ View ]
Today, 04:08 AM   |  #408  
thisisapoorusernamechoice's Avatar
Member
Flag Albany
Thanks Meter: 14
 
40 posts
Join Date:Joined: Jul 2014
More
So I searched this thread and a couple similar ones, is there any way to adjust the brightness that this toggle activates? Alternatively, I converted the Torch app from the play store into a system app because it gives a brighter light than the system default and other third-party apps. Would there be a way to make this toggle use the Torch app instead? Basically I just want a way for this flashlight to be brighter, any ideas?

Post Reply Subscribe to Thread

Tags
4.3, 4.4, flashlight, flashlight toggle, toggle
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes