[Q] Need help with extended power menu on 2.3.6 - Android Q&A, Help & Troubleshooting

Hi all!! I need help with the extended power menu!
I'm on Gingerbread 2.3.6 and my rom is deodexed. I tried to add the extended power menu following this and this tutorial...
After study my "globalaction.smali", the code that I changed is this:
Code:
const/4 v0, 0x3
I follow the tutorial, but if I change the above code with "0x4 or 0xanynumber " my phone reboots when I try to bring up the menu, but the menu is not displayed. I only have a small vibration.
where I'm wrong?

Related

[Q]add reboot to power menu..

http://forum.xda-developers.com/showthread.php?t=811532
└ This Thread looks while watching it, and curious.
Step 2 ,
When "com\android\internal\app\ShutdownThread.smali " fix,
cannot found that.
「.line 531
invoke-static {}, Landroid/os/Power;->shutdown()V
.line 532
return-void」
also
Step 3,
When "com\android\internal\policy\impl\GlobalActions.sm ali" fix,
cannot found "aput-object v2, v0, v1"
Venue is Different from existing descriptions.
What a way to get through a rock?

[HELP] Forcing Spotify to tablet mode ( Smali patch version )

Spent last two days trying to edit .smali files in Spotify to force it to tablet mode without any luck. I know there's Xposed module for this but I'd like to achieve the same by edit .smali files, this way no root required and ART compatible, i know many user will appreciate this.
findings so far ( thanks to Xposed module creator @JsChiSurf too ):
spotify uses getDisplayMetrics() to get pixel height/width/xdpi
spotify uses pythagoras to get screen diagonal size
spotify reads manufacteur/brand/device type/device id
Click to expand...
Click to collapse
functions it uses to achieve this are located in com\spotify\mobile\android\util\ab.smali, just did a whole decompiled apk search with jd-gui for "getDisplayMetrics" and this is the only place it access height/width
this is how it looks:
Code:
public static ac h()
{
return new ac(Build.MODEL, Build.MODEL, Build.BRAND, Build.MANUFACTURER);
}
public final double b()
{
DisplayMetrics localDisplayMetrics = this.a.getResources().getDisplayMetrics();
return Math.sqrt(Math.pow(localDisplayMetrics.widthPixels / localDisplayMetrics.xdpi, 2.0D) + Math.pow(localDisplayMetrics.heightPixels / localDisplayMetrics.ydpi, 2.0D));
}
public final String g()
{
return ((TelephonyManager)this.a.getSystemService("phone")).getDeviceId();
}
now dalvik opcodes:
Code:
# virtual methods
.method public final b()D
.locals 7
.prologue
const-wide/high16 v5, 0x4000
.line 44
iget-object v0, p0, Lcom/spotify/mobile/android/util/ab;->a:Landroid/content/Context;
invoke-virtual {v0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v0
invoke-virtual {v0}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;
move-result-object v0
.line 45
iget v1, v0, Landroid/util/DisplayMetrics;->widthPixels:I
int-to-float v1, v1
iget v2, v0, Landroid/util/DisplayMetrics;->xdpi:F
div-float/2addr v1, v2
float-to-double v1, v1
invoke-static {v1, v2, v5, v6}, Ljava/lang/Math;->pow(DD)D
move-result-wide v1
iget v3, v0, Landroid/util/DisplayMetrics;->heightPixels:I
int-to-float v3, v3
iget v0, v0, Landroid/util/DisplayMetrics;->ydpi:F
div-float v0, v3, v0
float-to-double v3, v0
invoke-static {v3, v4, v5, v6}, Ljava/lang/Math;->pow(DD)D
move-result-wide v3
add-double v0, v1, v3
invoke-static {v0, v1}, Ljava/lang/Math;->sqrt(D)D
move-result-wide v0
return-wide v0
.end method
what I've tried so far:
placing some "mul-double v0, v0, v0" before return-wide v0 -> my idea was to mul return value to have a bigger screen diagonal
removing sqrt call
returning custom values using const opcode
Click to expand...
Click to collapse
everytime im installing modded apk in bluestacks, nothing changed i can only play shuffle mode aka mobile mode.
my environment:
Bluestacks to test app -> I set its screen size to 100*100 this way spotify starts in mobile phone mode and i can test
Virtuous Ten Studio to edit spotify apk -> when creating new project DESELECT disassemble resources otherwise when compiling it will fail
to set bluestacks screen size to trigger mobile mode : StacksTweak
Can anyone more experienced contribute/help me? This way user that dont want roor/use ART can use spotify forced in tablet mode
no one?
edit: search in com\spotify\mobile\android for keywords like "screen_size" and "layout_as_tablet" some lines above ther's the call to phytagoras function i described before. File im talking about is MainActivity.smali in com\spotify\mobile\android\ui\activityl folder. Event forcing the check to return true aka im in tablet mode doesnt work
Can some dev explain this?
very nice idea, I'm interested in it too... does someone know how to do?
What the diffrence between the tablet and phone gui of spotify if you guys don't mind me asking..?
I found where it calculates Pythagoras to grab screen diagonal and tried to patch apk then rebuilt it. BTW it doesn't seem to affect apk when executed, so maybe im rebuilding/patching in the wrong way, that's why I posted. Maybe some dev can explain why it doesn't work when executed.
I think it's the right place to patch since it's clearly calculating screen diagonal
With tablet mode you can select which song you want to play, with phone mode only shuffle is enabled, both gui are the same
I would LOVE a working forced-tablet apk! I have a 9.7" no-name tablet which only runs Spotify in mobile mode. I cannot use the Xposed module because it has not been backported to Gingerbread (Xposed - yes, the module - no).
Spotify never responded to my support ticket, so I would have no guilt using a tweaked app to force tablet mode on my....tablet!
fudduf said:
I would LOVE a working forced-tablet apk! I have a 9.7" no-name tablet which only runs Spotify in mobile mode. I cannot use the Xposed module because it has not been backported to Gingerbread (Xposed - yes, the module - no).
Spotify never responded to my support ticket, so I would have no guilt using a tweaked app to force tablet mode on my....tablet!
Click to expand...
Click to collapse
that's why i'd like to patch apk, Xposed is a general way, not specific to Spotify and it requires root, many users dont want it. I think patching apk is the best solution for this problem, as i stated before, i found where patch it's needed, now some devs should help us, but i think they're too busy as none of them replied, maybe just a tip to point me in the right direction and patch it...
any headway into this project? This would be so cool if achieved.
Tabletmatrics.
Sent from my Barnes & Noble Nook HD using Tapatalk 4
Hey steebro,
I like your thinking! But I quess you are digging on the wrong place.
The code your working on, looks more like the actual math itself. What you
need to find or rather to mod is the real IF function that asks:
"!! pseudo code !!"
If this device is a phone
set play mode
else
set shuffle mode
Maybe it is vice versa:
set play mode
If this device is not a tablet
set shuffle mode
They could be a lot of options how they wrote this procedure to get this information and set the mode.
First you need to find this point where the code decided which mode will be activated.
Which functions are calling the public final double b() ?
Than! You can "just" set the "set shuffle mode" in comments or replace it with the "set play mode" and the job
is done! And it doesnt matter what device you have!
I appreaciate your work because I think the same way. If you need a beta tester, don't hesitate
to contact me. I can also take a look in the code to identify the procedure we need to find!?
Cheers
NewBit
Bump on this because with 5.0 released this has ruined my spotify. If anyone has a way to get in into tablet mode with xposed please do tell.
Same here...
I found a lot of references for getdisplaymetrics:
spotify/smali/net/hockeyapp/android/views/UpdateView.smali :
spotify/smali/net/hockeyapp/android/views/b.smali :
spotify/smali/net/hockeyapp/android/views/c.smali :
spotify/smali/net/hockeyapp/android/views/a.smali :
spotify/smali/android/support/v7/app/f.smali :
spotify/smali/android/support/v7/internal/view/menu/ActionMenuItemView.smali :
spotify/smali/android/support/v7/internal/view/menu/y.smali :
spotify/smali/android/support/v7/internal/view/menu/ActionMenuPresenter.smali :
spotify/smali/android/support/v7/internal/view/menu/ActionMenuView.smali :
spotify/smali/android/support/v7/internal/view/a.smali :
spotify/smali/android/support/v7/internal/widget/ActionBarView.smali :
spotify/smali/android/support/v7/internal/widget/ActionBarContextView.smali :
spotify/smali/android/support/v7/internal/widget/ListPopupWindow.smali :
spotify/smali/android/support/v7/internal/widget/ActivityChooserView.smali :
spotify/smali/android/support/v4/view/PagerTabStrip.smali :
spotify/smali/android/support/v4/view/PagerTitleStrip.smali :
spotify/smali/android/support/v4/view/PagerTitleStripHacked.smali :
spotify/smali/android/support/v4/view/ViewPager.smali :
spotify/smali/android/support/v4/view/ActionBarTabStrip.smali :
spotify/smali/android/support/v4/widget/DrawerLayout.smali :
spotify/smali/android/support/v4/widget/SlidingPaneLayout.smali :
spotify/smali/android/support/v4/widget/ad.smali :
spotify/smali/android/support/v4/widget/SwipeRefreshLayout.smali :
spotify/smali/com/userzoom/bb.smali :
spotify/smali/com/userzoom/az.smali :
spotify/smali/com/userzoom/ay.smali :
spotify/smali/com/facebook/widget/i.smali :
spotify/smali/com/devsmart/android/ui/HorizontalListView.smali :
spotify/smali/com/mixpanel/android/mpmetrics/y.smali :
spotify/smali/com/mixpanel/android/mpmetrics/e.smali :
spotify/smali/com/mixpanel/android/surveys/SurveyChoiceView.smali :
spotify/smali/com/google/android/gms/ads/d.smali :
spotify/smali/com/google/android/gms/internal/ar.smali :
spotify/smali/com/google/android/gms/internal/ak.smali :
spotify/smali/com/google/android/gms/internal/j.smali :
spotify/smali/com/google/android/gms/internal/ls.smali :
spotify/smali/com/google/android/gms/internal/fs.smali :
spotify/smali/com/google/android/gms/internal/dw.smali :
spotify/smali/com/google/android/gms/internal/el.smali :
spotify/smali/com/google/android/gms/internal/eo.smali :
spotify/smali/com/google/android/gms/internal/cs.smali :
spotify/smali/com/google/android/gms/internal/c.smali :
spotify/smali/com/google/android/gms/internal/er.smali :
spotify/smali/com/google/android/gms/internal/jq.smali :
spotify/smali/com/google/android/gms/plus/j.smali :
spotify/smali/com/mobileapptracker/h.smali :
spotify/smali/com/spotify/mobile/android/spotlets/search/view/SearchViewsManager.smali :
spotify/smali/com/spotify/mobile/android/spotlets/browse/c.smali :
spotify/smali/com/spotify/mobile/android/spotlets/collection/b/b.smali :
spotify/smali/com/spotify/mobile/android/util/bk.smali :
spotify/smali/com/spotify/mobile/android/util/ao.smali :
spotify/smali/com/spotify/mobile/android/ui/ActionBarManager.smali :
spotify/smali/com/spotify/android/paste/graphics/e.smali :
spotify/smali/com/spotify/android/paste/widget/EmptyView.smali :
spotify/smali/com/squareup/picasso/z.smali :
spotify/smali/it/sephiroth/android/library/widget/y.smali :
spotify/smali/it/sephiroth/android/library/widget/AbsHListView.smali :
spotify/smali/it/sephiroth/android/library/widget/s.smali :
Click to expand...
Click to collapse
This is gonna be hard to achieve.
oh please guys make this happen. I love tablet metrics, but I want to update to lollipop. this is the only thing keeping me from updating. I hope you didn't give up on this. rooting for ya
any updates??
Yes please someone do it. This is the only thing I hate about lollipop, I've subscribed to music all access but I think nothing beats Spotify
Forcing tablet mode!
I'm also looking for this to work. I've found that the function shuffle takes a boolean which I assume that this will tell the app to work in tablet/phone mode after calculating the metrics. So I tried to set that boolean to be false (or true) from the beginning. But when I modify anything the app want open or crash immediately after openning. So I think you guys should look there for a fix as I lack the skills to modify an app
Good luck!
Forced tablet mode
Captain here. I was also frustrated to find out XPosed therefore TabletMetrics does not work on ART (& Android Lollipop), and I had no other choice but to learn some Dalvik.
I do "honestly not know" how the link appeared below, but to all who feel like "free music on 'ma phone":
~removed because more info below~
@op You are missing just one more method hiding somewhere in .../util/ that plays a big role here
ViRb3 said:
So guys I decided to move this work to a separate topic. The interest of all of you is what made me do that .
You can find the newest Spotify mod [updated today!] here from now on:
http://forum.xda-developers.com/android/general/mod-spotify-tablet-mode-t3006191/
Click to expand...
Click to collapse
Forcing tablet mode!
ViRb3 said:
Captain here. I was also frustrated to find out XPosed therefore TabletMetrics does not work on ART (& Android Lollipop), and I had no other choice but to learn some Dalvik.
I do "honestly not know" how the link appeared below, but to all who feel like "free music on 'ma phone":
URL: mega.co.nz/#!pdoEEYjL (latest version as of now)
Mr.Key: rOuCoHJ6uEN6L8PQv1SevDCOytNRs4brP2grVqtjoSY
@op You are missing just one more method hiding somewhere in .../util/ that plays a big role here
Click to expand...
Click to collapse
WOW!! You sir are a genius! Literally! Please I really wanna learn how you done it from start to end. Please teach me This is a dream come true for me, man
I receive this error
Sent from my Nexus 5 using XDA Free mobile app
Same for me, but using standard login works 100% THANKS ViRb3!

Enable On-Screen Btn and Disable hw Btn

First of all, root is required to edit these files.
Basically, all you have to enable the software buttons, is add 'qemu.hw.mainkeys=0' to the build.prop in /system and reboot.
Deactivate the hardware keys.
Go to /system/usr/keylayout and open 'Generic.kl' in a text editor and find the lines that say 'key 139 MENU WAKE_DROPPED', 'key 158 BACK WAKE_DROPPED', and 'key 172 HOME' and place a # at the start of each line like:
#139 MENU WAKE_DROPPED
#158 BACK WAKE_DROPPED
key 172 HOME (I would not recommend and disable home)
Take care here because if you add a # to the wrong line, you won
And last, navigate to system>usr>keylayout. We will be looking for a file called "sec_touchkey.kl".
Out the keys you don't want to work with a #.
So if you are like me and think the home button is fine, it will look like this.
#key 139 MENU
#key 158 BACK
key 102 HOME
key 217 SEARCH
UPDATE: For Customize Navbar Go to Settings-->Buttons
Just remember to remove the # - before you update the Cyanogenmod version to a newer.

Firefox v35.0.1 with Flash Enabled

It's me from the development section. I noticed a little while back that starting firefox 29, our device is explicitly blacklisted from mozilla not to use the flash plugin. Regardless of whether you're on kitkat or not and whether you installed flash or not firefox will check to see if you're using a tegra2 (and surprise) tegra3 device. If you have one of these, firefox goes out of its way to make sure you don't use flash. In place, it has a cheesy "we're sorry" message. On most kitkat roms flash will not work because you need to compile the rom with -DNEEDS_VECTORIMPL_SYMBOLS . However, this flag is automatically used for our tablet to get the camera driver to load. It would seem like a no-brainer to use flash on our tablet then.
Here's the code that disables flash for us: firefox-source/mobile/android/base/GeckoAppShell.java
Code:
// An awful hack to detect Tegra devices. Easiest way to do it without spinning up a EGL context.
[B]boolean[/B] isTegra = (new File("/system/lib/hw/[B]gralloc.tegra.so[/B]")).exists() ||
(new File("/system/lib/hw/[B]gralloc.tegra3.so[/B]")).exists();
if (isTegra) {
// [COLOR="Red"][B]disable Flash[/B][/COLOR] on Tegra ICS with CM9 and other custom firmware (bug 736421)
File vfile = new File("/proc/version");
FileReader vreader = null; ...etc
Not feeling like recompiling firefox fore just those few lines I decided to use apktool to try and remove this function. The smali apktool produces, barely resembles the java code. I think I've managed to bypass the tegra check with this "v2" hack method:
/smali/org/mozilla/gecko/GeckoAppShell.smali
Code:
[[email protected] fennec]$ diff GeckoAppShell.smali.orig GeckoAppShell.smali
4166,4188c4166
< new-instance v1, Ljava/io/File;
<
< const-string v4, "/system/lib/hw/gralloc.tegra.so"
<
< invoke-direct {v1, v4}, Ljava/io/File;-><init>(Ljava/lang/String;)V
<
< invoke-virtual {v1}, Ljava/io/File;->exists()Z
<
< move-result v1
<
< [B]if-nez v1, :cond_0[/B]
<
< new-instance v1, Ljava/io/File;
<
< const-string v4, "/system/lib/hw/gralloc.tegra3.so"
<
< invoke-direct {v1, v4}, Ljava/io/File;-><init>(Ljava/lang/String;)V
<
< invoke-virtual {v1}, Ljava/io/File;->exists()Z
<
< move-result v1
<
< [B]if-eqz v1, :cond_2[/B]
---
> goto :[B]cond_2[/B]
Here's how I think the new hack works as it does according to the screenshot. I think the first 6 lines check for the tegra2 display driver file. The 6th line says that "if the check returned a non zero value skip to condition 0". I can only assume that a non zero check would indicate the file was found. It's skipping straight to "condition 0" because the original java code had the check for the tegra2 and tegra3 driver in a logical OR. In this case, if the first half of the OR is true, there's no use to check the second half since a minimum of 1 of the halves must be true.
The second half is when the tegra2 driver hasn't been found it will try for the tegra3. **Note these lines are NOT executed if the tegra2 driver was found because of the jump to condition_0 which bypasses these lines.** However, at the end is an interesting "if the result of the search is zero, skip to condition 2". I'm assuming that if both checks failed then condition 2 must be what comes after the "if (isTegra)" in the java code. condition_2 likely skips past the body of that if staement. In that case, I'll have firefox skip right to the chase and directly go to condition 2 without checking. I consider this a more clean hack that removes the check altogether. While not poetic it's efficient.
As to why we shouldn't just stick to firefox 28.0.1... security issues! Each new version of firefox patches up security holes in the previous versions. As much as we like to poke fun at Internet Explorer for swiss cheese security (among other things...), we wouldn't be any better using an old firefox.
Download v30 here
Download v31 here
Download v32 here
Download v32.0.1 here
Download v32.0.3 here
**New**: just pick up your updates from the android file host link.
Screenshot to prove that it works below :cyclops: :
I uploaded the new firefox v31. You must uninstall firefox v30 first since I used a different signing key. I'll stick with the new one for now since I lost the one I used for firefox 30.
Here's the old hack method:
Code:
.line 1860
new-instance v1, Ljava/io/File;
const-string v4, "/system/lib/hw/[B]dont.be.mean.to.tegra2[/B]"
invoke-direct {v1, v4}, Ljava/io/File;-><init>(Ljava/lang/String;)V
invoke-virtual {v1}, Ljava/io/File;->exists()Z
move-User Nameresult v1
if-nez v1, :cond_0
new-instance v1, Ljava/io/File;
const-string v4, "/system/lib/hw/[B]dont.be.mean.to.tegra3[/B]"
invoke-direct {v1, v4}, Ljava/io/File;-><init>(Ljava/lang/String;)V
invoke-virtual {v1}, Ljava/io/File;->exists()Z
move-result v1
It simply changes which files are used to confirm a tegra2 or tegra3 board. The file name changes were intended to be poetic.
Hello,
Are you planning on updating your mod for Firefox 32?
spamam1 said:
Hello,
Are you planning on updating your mod for Firefox 32?
Click to expand...
Click to collapse
Yeah. Sometime next week.
Sent from my GT-I9300
All right everyone. V32 is up. Sorry for the wait. As usual, it uses the same hack mentioned in the first post.
To those who keep up to date on the thread by new post notifications: firefox v32.0.1 is out. This uses a newer cleaner hack. The new hack is described in the first post. It took me a good 45 mins to come up with that simple solution.
The old hack is still explained in the second post for those who are curious of the difference.
Firefox v32.0.3 is up. Uses the v2 hack.
Is flash automatically enabled after I install this on my tab that already has flash installed or do I need to enable it manually?
Sent from my new ZenFone 5
SystemDoctor said:
Is flash automatically enabled after I install this on my tab that already has flash installed or do I need to enable it manually?
Sent from my new ZenFone 5
Click to expand...
Click to collapse
It will be automatically enabled if it's already installed.
Sent from my GT-I9300
It's back guys. Firefox with flash unblocked for v33. I had a few issues with apktool but I'm using a workaround for that. You MUST uninstall the old firefox first for reasons I don't know.
There's a surprise youtube mod yt-sig.apk. It WILL crash play service whenever you watch a video or exit one. That shouldn't be too bad. You can always hit ok. I wouldn't bother trying it if you're on a kitkat rom but if you're on a lollipop rom it may complement the latest dev advances nicely. Let's say if you like it, keep it to yourself. It goes without saying you've gotta uninstall the stock youtube app and may never update it. I probably won't update it because there's little functional changes with each youtube app update.
Firefox unblocked v34 is up. Unfortunately you have to uninstall v33 first before installing v34. Apktool can no longer rebuild the whole apk. It can still recompile the smali so I just swap out the mozilla supplied classes.dex in the apk for my modified one.
You can still use flash in lollipop.
Firefox v35 unblocked is up.
Thanks for both apps can't get yt to install even after removed stock one and flash does not always seem to work
gazleyp said:
Thanks for both apps can't get yt to install even after removed stock one and flash does not always seem to work
Click to expand...
Click to collapse
After removing the stock one, try doing adb install and copy the error message to here. For flash make sure you're using this firefox and not the official one. With the newer omni roms I make (latest and 2nd latest) flash should be way more responsive. I uploaded a screen shot to show it in action on a relatively recent omni build of lollipop.
----------------------------------------------------------Added-----------------------------------------------------------
Anyways the new v35.0.1 is up.
Have this working sweet with your ROM now

How to swap Menu and Back Key of RN3 (Snapdragon) in CM13

I am on official build (cm-13.0-20160820-SNAPSHOT-ZNH5YAO0J4-kenzo.zip), I want to swap the menu and back key, so I use root explorer to change the value of Menu key (from 139 to 158) and the value of Back key (from 158 to 139) of the 3 files located at /system/usr/keylayout (Atmel_maXTouch_Touchscreen.kl, Generic.kl & qwerty.kl), after that I reboot the phone and found that it was not successful, the menu key and the back key remain unchanged.
Is there any apps or methods can be easily assign the layout of the hardware touch buttons of RN3? Thanks.

Categories

Resources