[Q][Xposed] Altering an Application's Style/Theme - Xposed General

Hello,
I want to force some applications to have floating windows using the (awesome ^^ ) Xposed framework.
So far, I managed to hook on the "onAttachedToWindow()" method (as explained here goo.gl/ZFb8iQ ) to set the floating layout (as explained in goo.gl/GyCXac ), which seems to work pretty well (I can't embed a screenshot due to the forum's restrictions to new members).
However, in order to set a transparent background (outside the resized app, in order to allow the manipulation of other apps in the background), the only method that I'm aware of is adding the following line in the app theme (e.g. styles.xml)
Code:
<item name="android:windowIsTranslucent">true</item>
My question is: how can I do that using Xposed ?
Thanks in advance for your help.

windowIsTranslucent can't be set programmatically AFAIK. You could try seeing where windowIsTranslucent is parsed and set (in the AOSP source code), and hook that method to enable it for your package.

GermainZ said:
windowIsTranslucent can't be set programmatically AFAIK. You could try seeing where windowIsTranslucent is parsed and set (in the AOSP source code), and hook that method to enable it for your package.
Click to expand...
Click to collapse
I see. It's a shame the Android framework doesn't allow such a thing...
Is there any other technique for forcing activities to display a floating window (programmatically) ?
Also, would it be possible, with the help of Xposed, to create a translucent floating window then "insert" a hooked activity into it ?
Or, how could I use Xposed to make an app use a custom theme ?

Related

NoRefresh enabler

Hi,
I am trying to put a code together to control the refresh behavior of the e-ink screen. The final goal is to have a drop-in library for app developers to help making their app more e-ink friendly.
The code works already for the PRS-T1, but needs a different driver for the Nook Touch (N2EpdController included).
My one and only beta tester gets the famous "There is a problem parsing the package" error. Pls find enclosed the sources.
I would be grateful if someone could fix possible Eclipse setting or other errors.
Hi,
I have some interest in adapting apps to the eink screen, so I will try to help with this. Unfortunately, I cannot post in the dev forums yet.
When you get error installing apps via android UI, it is useful to do via "adb install" to be able to know the error cause. The message was "INSTALL_FAILED_OLDER_SDK", which I solved by lowering the android:minSdkVersion parameter in Manifest. Then, the app installed and ran fine, but didn't do the desired effect yet. I will check the code now...
---------- Post added at 02:41 AM ---------- Previous post was at 01:53 AM ----------
I see that you're trying to use enterA2Mode() for the nook (btw, there is a typo at NoRefreshEnablerActivity.java:29, it should read EINK_NOOK). I've been playing around with this some time ago when I started developing a fast e-ink drawing app for the NST, you can see it here: https://github.com/marspeople/E-Paper (WIP).
With few testing I've done, I guess the 1-bit mode (A2) setting is not applied globally: it should take effect only in the View from which it is called. I haven't investigated further to try to use it globally.
Hi marspeople,
Thanks for pointing out the type, it should read
} else if (DeviceInfo.EINK_NOOK)
Regarding the global value of mode setting. From what I understand, A2 is a permanent mode, so whatever function or app is setting the updatemode, it is kept. With the PRS-T1, it is reset by calling any stock (Sony) app. For the Nook I don't know..
Good luck in compiling, hopefully we come to a version which works on both devices. Then I can proceed to dynamically change the updatemode within an app.
Yes, the A2 mode is kept until any process resets the EPD. Using logcat, I noticed several epd_reset_region messages appearing automatically when I close your app to go back to the launcher. It seems the system overrides the EPD setting, making impossible to use A2 system-wide (at least by this method).
However, if you want A2 just for an app, calling enterA2mode() will probably work, as I used in my own app above.
Can you send me your apk?
salsichad2 said:
Can you send me your apk?
Click to expand...
Click to collapse
You mean the apk for "NoRefresh" or my drawing app?
Hi marspeople,
I would be most interested to know why the initial source code does compile ok, works on the PRS-T1 and does not install on the Nook Touch + the fixes.
With this knowledge I can write either an app to set refresh modes or within apps.
Did you succeed to compile and install on Nook?
Hi again,
in your N2EpdController.java
Code:
83: mtSetRegion.invoke(null, "aarddict", enumsRegion[region], regionParams, enumsMode[mode]);
I would like to replace the hardcoded "aarddict" by something dynamic.
What would be the correct function to infer the wanted name?
Code:
activity.class.getName()
this.getClass().toString()
.. ?
bardo8430 said:
Hi marspeople,
I would be most interested to know why the initial source code does compile ok, works on the PRS-T1 and does not install on the Nook Touch + the fixes.
With this knowledge I can write either an app to set refresh modes or within apps.
Did you succeed to compile and install on Nook?
Click to expand...
Click to collapse
Yes, sorry about the confusion, but I managed to do it, despite the A2 mode didn't work. What I did was just edit the AndroidManifest.xml, changing the android:minSdkVersion parameter to 7 (since the NST runs Android 2.1).
Good luck finding out how to set A2 mode permanently. I guess you don't have a Nook, so feel free to ask me for testing purposes.
Since the Nook A2 mode seems to be overridden when switching foreground activity, I've tried another approach with a background service which toggles A2 mode when requested by user. This way, the foreground activity isn't switched and "fast refreshing" mode works (until you change activity).
This fast refresh mode (called A2) is only possible because it uses only 1-bit depth, i.e, just black on white, meaning you can't see grayscale pictures but it's good enough for black text on white background and scrolling. I have not "created it", it is built-in from the device (you can test using the stock reader, it is activated when holding a page button). What I implemented is a way to activate and deactivate it at user will from inside any app.
Thanks to dairyknight for his N2EpdController class, which made this possible.
Thanks to bardo8430 for bringing the idea.
Thanks to AndroSS source code for screenshots used in automatic contrast.
Changelog:
01/Mar: Now when you launch the app and it is already running, it will activate NoRefresh mode. So you can also use an activation shortcut to the app using NookTouchTools (i.e. B&N's book icon at top left corner).
02/Mar: Improve activation shortcut to perform toggle between modes. Tap gestures aren't needed anymore (use "-noGestures" apk version if you don't want them).
04/Mar: Got rid of initial ghosting by redrawing the screen after activating A2.
04/Mar (2): Minor improvement of removing ghosting at screen edges.
12/Mar (Beta): Now you can adjust contrast in A2 mode. Images shouldn't be dark or black anymore if you raise the contrast a bit.
22/May: Completely redesigned version 2.0:
- Several options can be customized via settings screen.
- NoRefresh can be toggled by manual app shortcut, tap gestures or automatically according to screen animation (new).
- New App Whitelist to avoid unwanted activation in specific apps (except for manual mode).
- Background service can be launched at boot.
- Small improvements and tweaks.
- Custom app icon (finally )
06/Jun: Fix crash on empty whitelist
08/Jul: (Version 2.1)
- Automatic contrast when activating NoRefresh, according to total "brightness" of the screen (simple algorithm). This should ask you for root permission.
- Also supports manual setting in specific situations (customizable).
- Fix possible crash at startup.
26/Jul: (Version 2.2)
- Fix contrast setting behaviour
06/Dec:
- Alternative version with fixed compatibility for FW 1.2.0 available at https://github.com/marspeople/NoRefreshToggle/downloads
First Video: http://youtu.be/6pBPsyno5PY
Other Video: http://youtu.be/kBbl6egyPsQ
Another demo: http://youtu.be/5b7JjllImjM
Repository: https://github.com/marspeople/NoRefreshToggle
Great to see that it works on the Nook! Good job.
When I try to compile on Eclipse, I have to remove the below Override:
//@Override
public boolean onTouch(View v, MotionEvent event) {
otherwise I get an error: The method onTouch(View, MotionEvent) of type A2Service must override a superclass method
When I compile with this mod and run the app, nothing happens after using your gestures. Except that I tap on other icons which then try to launch other apps.
Should NoRefreshToggle keep the focus?
I have a suspicion: The PRS-T1 needs to call a function of the Sony library with extended parameters to pass the updatemode. ANY function carrying the mUpdateMode parameter would do - but it must be called. Which might be the problem here. In the used EinkListView.java, a lot of "injection" functions like below are defined.
Code:
@Override
public void scrollTo(int x, int y) {
try {
Method invalidateMethod = super.getClass().getMethod("scrollTo",
int.class, int.class, int.class);
invalidateMethod.invoke(this, x, y , mUpdateMode);
} catch(Exception e) {
e.printStackTrace();
}
But your code has neither a Listview, nor would any injection function trigger. I am afraid you would have to make the app use a ListView (or WebView).
Can you?
bardo8430 said:
Great to see that it works on the Nook! Good job.
When I try to compile on Eclipse, I have to remove the below Override:
//@Override
public boolean onTouch(View v, MotionEvent event) {
otherwise I get an error: The method onTouch(View, MotionEvent) of type A2Service must override a superclass method
When I compile with this mod and run the app, nothing happens after using your gestures. Except that I tap on other icons which then try to launch other apps.
Should NoRefreshToggle keep the focus?
Click to expand...
Click to collapse
Well, I noticed that problem of accidentally tapping unwanted widgets, I would recommend tapping on a free area of the screen. I could use an overlay button, but it would occasionally get in the way too. What do you mean by "keep the focus"?
---------- Post added at 09:13 PM ---------- Previous post was at 09:05 PM ----------
bardo8430 said:
I have a suspicion: The PRS-T1 needs to call a function of the Sony library with extended parameters to pass the updatemode. ANY function carrying the mUpdateMode parameter would do - but it must be called. Which might be the problem here. In the used EinkListView.java, a lot of "injection" functions like below are defined.
Code:
@Override
public void scrollTo(int x, int y) {
try {
Method invalidateMethod = super.getClass().getMethod("scrollTo",
int.class, int.class, int.class);
invalidateMethod.invoke(this, x, y , mUpdateMode);
} catch(Exception e) {
e.printStackTrace();
}
But your code has neither a Listview, nor would any injection function trigger. I am afraid you would have to make the app use a ListView (or WebView).
Can you?
Click to expand...
Click to collapse
Well, to capture touch events I've used a dummy View which is added to an overlay (see A2Service.java:43). Despite being an android Service instead of Activity, maybe you can instantiate your ListView there and hopefully it will work.
Thanks for the hint on the dummy view, will try.
"keep the focus"?: window manager speak, I mean that a tap stays within your app and does not act on the icons below.
bardo8430 said:
Thanks for the hint on the dummy view, will try.
"keep the focus"?: window manager speak, I mean that a tap stays within your app and does not act on the icons below.
Click to expand...
Click to collapse
Since I'm using a transparent overlay, I have to let touch events pass through, otherwise only my app would see them.
PS: I've added a demo video at a previous post.
I've been trying to improve the functionality of the app by changing from this manual toggle approach to something like: fast mode is triggered (a bit after) when user starts dragging his finger on the screen and restored when released.
However, I've been searching how to do this with no success so far. The invisible overlay that detects touch events currently is only able to capture MotionEvent.ACTION_OUTSIDE event type, which is useful to detect a tap, but can't deal with a drag. I also need that the drag is passed normally to the app below (to perform scrolling or whatever).
I've found this page (http://stackoverflow.com/questions/8073803/android-multi-touch-and-type-system-overlay) in which is proposed a solution that can detect a drag but can't pass it to the app below.
The code is now here: https://github.com/marspeople/NoRefreshToggle . I would appreciate any help from developers.
Maybe it can be run every 1 second when screen is on. I mean nook is not locked. I don't think that changing one parameter would eat battery. Is it worth a try?
Hi marspeople,
thanks again for taking this. My initial intention was to help app developers with no e-ink experience to easily adapt their code. Doing these things inside an app is much easier but needs access to the source.
See the related question on stackoverflow:
http://stackoverflow.com/questions/9391710/adapt-scrolling-swiping-to-e-ink-screens
The external app was used as a mere demonstrator to have it work on the NST and PRS-T1. Good to have a repository for it now.
marspeople said:
Ok, I think I've got it.
Since the Nook A2 mode seems to be overridden when switching foreground activity, I've tried another approach with a background service which toggles A2 mode when requested by user via a touch gesture. This way, the foreground activity isn't switched and "fast refreshing" mode works (until you change activity).
The activation gestures I'm currently using (unfortunately, it seems you can't use hardware keys using this approach) are:
- 4 "downward-right" taps (each tap must be done to the right and below the previous one) to activate (A2 mode)
- 4 "upward-left" taps to deactivate (Normal mode)
Video: http://youtu.be/6pBPsyno5PY
Here is the source code and a apk. bardo8430, I believe it would be easy to port this to the PRS-T1.
Click to expand...
Click to collapse
Noob question.
So I just install the apk and run it and I have Norefresh.
dark_hawk said:
Noob question.
So I just install the apk and run it and I have Norefresh.
Click to expand...
Click to collapse
yes, just open the norefresh app, and like the youtube video tap the screen from top left to bottom right 4 point
but i think the trade off is the screen go black&white with no grayscale (at lease for me)

[Q] Miscellaneous Q&A;Modding PA Halo to Samsung Multi-Windows

TL;DR, is it possible and is any dev attempting to mod the PA Halo to Samsung Multi-Windows?
(This probably isn't a question which validates an own thread, but it is something I wanted to know really badly; I suppose this can be a thread in which these miscellaneous questions like this one can be asked)
As we all know recently PA has recently open sourced HALO, for which edits in the rom are made to the following to make it work:
no. mostly systemUI. and one setting in framework.jar. -res contains only androids resources.
Click to expand...
Click to collapse
(source, molesarecoming at this thread:http://forum.xda-developers.com/showthread.php?t=2273074)
Since multi-windows is the only TW feature which really keeps me on TW roms I was wondering whether it was possible to mod the work done by PA, to mimic the multi-windows feature on AOSP(A) roms?
Since I am not a developer I can't really do it myself, I can list what in my opinion needs to be changed to have it function as Multi-windows;
Conditions; HALO now continues to be in front of the app it has been called before (this is also possible without getting a notification from the concerning app by adding this app to the HALO via "HALO)))"(source:https://play.google.com/store/apps/details?id=com.paranoid.halo)). The end behaviour from an app on the front now needs to be changed to some kind of added button. Right now it vanishes when you tap the app it is on top off.
Looks; the app in the background is being blacked out, this also needs to be removed. The size of the app being shown needs to become wider, full screen, by which it loses it 16:9 scale (Google may find this braking app compatibility, just as with cornerstone and CM)
I think these are the most obvious changes to be made to get Multi-Windows on AOSP(A)....
(Another idea maybe is to keep the HALO, the way it is, but made is resizesable and being able to move it around (the darkening of the other already running app still needs to be removed...))

[Q] Can xposed modules run in batch manually?

I'm not a dev so plz understand my clumsyness
It seems all of xposed modules run at the same time now.
This make the messy result sometimes when using the modules which hooks same things.
For example, I'm changing the size and format of clock on the statusbar with module A and I'm using module B also to theme my rom and this contains the function changing the size of clock on the statusbar also.
As you see, it seems that A and B have same function. But their way to make it in technical are not same.
This makes the size of clock every boot different, and users and devs can't set the module which hooks something LAST.
I asked @rovo89 before about the 'priority' of modules before and he answered xposed framework doesn't.
But I recognized my question was wrong recently.
I had to ask the 'batch' of modules
I think making a batch could solve the concurrent hooks
Possible?
It sounds like you want to be able to specify the order in which modules get loaded. Though your use of the word ``batch'' makes no sense to me, please elaborate.

[Q] Module priority?

WARNING: This might seem like a really noob question. It probably is.
The other day, when I was optimizing a chinese phone (it's system was the messiest thing I've ever seen), I ran into an issue.
For the sake of example, imagine you have a module that lets you choose your statusbar color and a module with loads of useful features but alas, one of them is coloring the statusbar red (can't be disabled except by disabling the module).
I'm guessing there's some sort of thing as module priority, be it load/hook order or something else (I'm not a module developer). Is there any way (modding apks of the modules?) I can adjust these priorities myself?
And to provoke module developers, is it possible for a module to achieve this?
hajdulak said:
WARNING: This might seem like a really noob question. It probably is.
The other day, when I was optimizing a chinese phone (it's system was the messiest thing I've ever seen), I ran into an issue.
For the sake of example, imagine you have a module that lets you choose your statusbar color and a module with loads of useful features but alas, one of them is coloring the statusbar red (can't be disabled except by disabling the module).
I'm guessing there's some sort of thing as module priority, be it load/hook order or something else (I'm not a module developer). Is there any way (modding apks of the modules?) I can adjust these priorities myself?
And to provoke module developers, is it possible for a module to achieve this?
Click to expand...
Click to collapse
Rovo has said that there is no way to prioritize one module over another...
The way to deal with that is to ask module developers to put in switches to turn off portions of the module...
hajdulak said:
For the sake of example, imagine you have a module that lets you choose your statusbar color and a module with loads of useful features but alas, one of them is coloring the statusbar red (can't be disabled except by disabling the module).
Click to expand...
Click to collapse
This is exactly my example to explain why module priorities are not needed. The problem is that what you mentioned last - the module isn't flexible enough to let you disable its features seperately. The solution would be to ask the module developer to implement such a setting, where the module wouldn't touch the statusbar color at all (not even setting it to the assume standard black). There are different ways to change the statusbar color, and only in some cases, the module which is executed last will win. If the modules use different ways to change it, there's a good chance that one of them will win no matter whether it can do its changes first or last.
I remember only one use-case where higher priority is the only way to achieve the goal, and that was a module hooking other modules/Xposed itself. Apart from that, I have only heard about cases like you described, where priority handling is only a workaround that works only sometimes. I don't want to encourage such behavior by offering a feature that only experts would understand.
rovo89 said:
The solution would be to ask the module developer to implement such a setting
Click to expand...
Click to collapse
At the moment, I am using something like this...
afterHookedMethod
if (isEnabled) changeSomething()
Is this scheme OK?
or should I hook something only if it is enabled:
if (isEnabled) findAndHookMethod...
?
rovo89 said:
This is exactly my example to explain why module priorities are not needed. The problem is that what you mentioned last - the module isn't flexible enough to let you disable its features seperately. The solution would be to ask the module developer to implement such a setting, where the module wouldn't touch the statusbar color at all (not even setting it to the assume standard black). There are different ways to change the statusbar color, and only in some cases, the module which is executed last will win. If the modules use different ways to change it, there's a good chance that one of them will win no matter whether it can do its changes first or last.
I remember only one use-case where higher priority is the only way to achieve the goal, and that was a module hooking other modules/Xposed itself. Apart from that, I have only heard about cases like you described, where priority handling is only a workaround that works only sometimes. I don't want to encourage such behavior by offering a feature that only experts would understand.
Click to expand...
Click to collapse
Amen.

Mod Android Auto GUI to show large clock on bottom command bar

I own a Mazda CX-5 and recently paid for the upgrade of the infotainment to add Android Auto.
The main issue is that once AA is running the clock becomes almost unreadable! it's too small an overlaid on the app (mostly Waze for my purposes).
I would like to be able to move the clock to the bottom bar of AA in order to ensure it's always there and way bigger then now.
I started by decompiling the AA APK etc... but then come to the conclusion that probably someone else already tried something like that and that in general here in the forum there will surely be some kind of guide on how to decompile/repackage the AA and which layouts/bundles to edit for which result: unfortunately I didn't find any such guide
So my questions:
1 - is already out there any AA rebuild which puts a large clock in the bottom bar?
2 - if not: is there any guide on how to open and repackage AA and which are the main requirements to make it work again after repackaging?
3 - if not: at least some steps on how to mod some layouts and repackage in a way which allows it to work?
4 - if not: anyone willing to share suggestions on issues I'll meet (i.e. google signature required for AA, special permissions etc...) ?
5 - if not: anyone out there who already tried (and failed) willing to share his experience so that I don't start the try-fail process from scratch?
thanks everyone for helping!
p.s.: no Xposed at current stage since I'm using the company's phone and I'm not willing to root it, thanks!
Hi, i know this a old post and i'm sorry if my English is a little bad. You resolve the clock problem? I buy a CX 5 too and have same problem and question.
There's an option to do just so with Substratum and the theme Extras For AA
Having the same problem I made a small application which gives the time all the time:
[CLOCK] 0.2 Always displayed
-Some car radios do not display the time when an app is in full screen (waze). So I developed a small application that displays the time permanently. Usage: install the app and start. The position can be modified by sliding, it will be memorized...
forum.xda-developers.com

Categories

Resources