Quantcast
Channel: xda-developers - Android Software and Hacking General [Developers Only]
Viewing all articles
Browse latest Browse all 3614

[Guide][Beginners] Bypass OEM's Device Check

$
0
0
This is a fast and easy tutorial to bypass device not compatible with your device check.

****NOTE I've seen some similar code in Samsung apps but I'm not sure, this guide may differ from device to device. and it isn't 100% that this method is working for all devices*******

I found out that some of the HTC apps were using this device check and I'm sure those who already ported some HTC apps might know how to bypass this issue.

Well this is a very easy way and there isn't "much" that you have to do.

You'll be needing.

Apktool or baksmali
Notepad++
Common smali knowledge.
And ofc java setup to get apktool working.

Now in this example ill only write a short info (this is due to no computer at hand) but it'll cover most of it.

Once you have everything above. you're good to go!

In this example i'm using HTC_IME.apk

Decompile your desired app with either apktool

Navigate to /smali/com/HTC/ and copy the path to the directory



Open up notepad and press ctrl+f you'll get a popup window. now click on Find in files tab. And in search for window put isHTCdevice As seen in screenshot and in folder copy your copied path to your decompiled HTC location which I mentioned earlier.



Now you'll get probably several strings found with isHTCdevice like

http://forum.xda-developers.com/atta...1&d=1427751676

Which one would I take???

If your thinking straight. you want either the constructor to be it or a method.

The method should start with. .method

Code:

.method public static isHTCDevice()Z
    .locals 9

    .prologue
    const/4 v1, 0x1

    const/4 v2, 0x0

    .line 255
    sget v0, Lcom/htc/sense/ime/NonAndroidSDK$HtcAdded;->sIS_HTC_DEVICE:I

    if-gez v0, :cond_0

    .line 256
    const-string v0, "ro.product.brand"

    const-string v3, ""

    invoke-static {v0, v3}, Landroid/os/SystemProperties;->get(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    .line 257
    new-instance v0, Lcom/htc/sense/ime/NonAndroidSDK$HAAccUtil;

    invoke-direct {v0}, Lcom/htc/sense/ime/NonAndroidSDK$HAAccUtil;-><init>()V

    const-string v4, "sku_id"

    const/4 v5, -0x1

    invoke-virtual {v0, v4, v5}, Lcom/htc/sense/ime/NonAndroidSDK$HAAccUtil;->readInteger(Ljava/lang/String;I)I

    move-result v4

    .line 258
    invoke-static {}, Lcom/htc/a/a;->b()Z

    move-result v5

    .line 261
    sget v6, Landroid/os/Build$VERSION;->SDK_INT:I

    .line 262
    if-eqz v5, :cond_1

    move v0, v1

    :goto_0
    sput v0, Lcom/htc/sense/ime/NonAndroidSDK$HtcAdded;->sIS_HTC_DEVICE:I

    .line 264
    new-instance v0, Ljava/lang/StringBuilder;

    const-string v7, ", init time:"

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

    sput-object v0, Lcom/htc/sense/ime/NonAndroidSDK$HtcAdded;->sINIT_LOG:Ljava/lang/StringBuilder;

    .line 265
    sget-object v0, Lcom/htc/sense/ime/NonAndroidSDK$HtcAdded;->sINIT_LOG:Ljava/lang/StringBuilder;

    invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J

    move-result-wide v7

    invoke-virtual {v0, v7, v8}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v7, ", systemProperty="

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

    move-result-object v0

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

    move-result-object v0

    const-string v3, ", accSku="

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

    move-result-object v0

    invoke-virtual {v0, v4}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v3, ", HDKLib0Util.isHTCDevice()="

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

    move-result-object v0

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

    move-result-object v0

    const-string v3, ", sdkVer="

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

    move-result-object v0

    invoke-virtual {v0, v6}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    .line 268
    const-string v0, "HtcAdded"

    new-instance v3, Ljava/lang/StringBuilder;

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

    const-string v4, "In isHTCDevice(), current time:"

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

    move-result-object v3

    invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J

    move-result-wide v4

    invoke-virtual {v3, v4, v5}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v3

    sget-object v4, Lcom/htc/sense/ime/NonAndroidSDK$HtcAdded;->sINIT_LOG:Ljava/lang/StringBuilder;

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

    move-result-object v4

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

    move-result-object v3

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

    move-result-object v3

    invoke-static {v0, v3}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 270
    :cond_0
    sget v0, Lcom/htc/sense/ime/NonAndroidSDK$HtcAdded;->sIS_HTC_DEVICE:I

    if-lez v0, :cond_2

    :goto_1
    return v1

    :cond_1
    move v0, v2

    .line 262
    goto :goto_0

    :cond_2
    move v1, v2

    .line 270
    goto :goto_1
.end method

So what do we do now?

Well by judging from a fast view, the v1 result and v0 result is moved to v2, which in our case is 0x0 = FALSE

by simply changing the number to 0x1 will tell us that the result of v2 is true

This is my first tutorial and i hope for beginners this is not too hard

Attached Thumbnails
Click image for larger version

Name:	t1.PNG
Views:	N/A
Size:	123.9 KB
ID:	3237123   Click image for larger version

Name:	t2.PNG
Views:	N/A
Size:	29.0 KB
ID:	3237124   Click image for larger version

Name:	t3.PNG
Views:	N/A
Size:	29.3 KB
ID:	3237135  

Viewing all articles
Browse latest Browse all 3614

Trending Articles