yashsingh1/xdaforums huggingface dataset:
[Xposed General] Falseclock:
If you module hooks Activity, Service or any other context application, you can store settings not with Shared Preferences, but in system settings database and use ContextResolver to get information from database.

and of course use <uses-permission android:name="android.permission.WRITE_SETTINGS" />

Here is an example:

findAndHookMethod("com.android.phone.PhoneApp", paramLoadPackageParam.classLoader, "onCreate", new XC_MethodHook()
{
protected void beforeHookedMethod(MethodHookParam param) throws Throwable
{
ContentResolver cr = (ContentResolver) XposedHelpers.callMethod(param.thisObject, "getContentResolver");
Class <?> Features = XposedHelpers.findClass("com.android.phone.HtcFeatureList", paramLoadPackageParam.classLoader);

boolean CallRecording = Misc.toBoolean(Settings.System.getInt(cr, Const.TWEAK_CALL_REC, 0));

if (CallRecording)
{
XposedHelpers.setStaticBooleanField(Features, "FEATURE_SUPPORT_VOICE_RECORDING", true);
}
}
});

More look here https://github.com/Falseclock/HtcOneTweaker/blob/master/src/kz/virtex/htc/tweaker/mods/Recorder.java

It is possible also to implement for resources, but you have always lookup views by identifier, load your application resources, redraw drawables, strings, etc. AND THIS IS BATTERY COST EFFICIENT method.

Other way - store replaced drawables for example in static variables and do not redraw every time. But there will be a huge code if you are replacing a lot of resources.

here is another example

public static Drawable Background;

findAndHookMethod(packageName + ".ui.ConversationListBaseAdapter", paramLoadPackageParam.classLoader, "bind", "android.view.View", "android.content.Context", packageName + ".ui.ConversationHeader", new XC_MethodHook()
{
protected void afterHookedMethod(MethodHookParam param) throws Throwable
{
boolean isRead = (Boolean) XposedHelpers.callMethod(param.args[2], "isRead");
View row = (View) param.args[0];

if (Background == null)
{
Background = row.getBackground();
if (Background == null)
{
Background = new ColorDrawable(row.getContext().getResources().getColor(android.R.color.transparent));
}
}

if (isRead == false)
{
XModuleResources modRes = XModuleResources.createInstance(XMain.MODULE_PATH, null);

row.setBackgroundDrawable(modRes.getDrawable(R.drawable.list_background_unread));
} else
{
row.setBackgroundDrawable(Background);
}
}
});
[Xposed General] GermainZ:
Ideally, all traces of an Xposed module should be removed when it's uninstalled, IMO. This goes against that.
[Xposed General] Falseclock:
Ideally yes, but there are some tweak/mods requires fast settings change and immediate apply without restart. Otherwise such mods are not usable.

I do such only for special mods. All other mods are stored in shared preferences.
[Xposed General] GermainZ:
Then get the app's context/system context and use your own settings, or register and use a BroadcastReceiver.
[Xposed General] Falseclock:
you are completely right. I just took ready code from my old custom ROM and used as it is in Xposed mode.

time to refactor my code )))
[Xposed General] Massi-X:
Hi I want to blend in too so: I have charged the preferences in the initzigote and after I have method like this:

beforhookedmethod{
Pref.reload();
String[] A new string[2000];
Map<string,?> B = Pref.getall();
i=0;
for(Map.Entry<String,?> entry : a.entrySet()){
B[i] = entry.getValue().toString();
Xposedbridge.log(entry.getvalue());
i++;
}
//some code that set this array into a hooked field
}

Now the problem is:if I remove the reload pref,after a reboot all work but if I leave the reload nothing work;the method is still hooked because I see that doesn't do what it normally do,but doesn't do what I say in the hook and even no log.What could be the problem?

Thanks.
[Xposed General] GermainZ:
Full code? what's Pref? How are you initializing it?
[Xposed General] Massi-X:
This is the full code:

public String[] A = new String[2000];
Field B = null;
public XSharedPreferences Pref;

@Override
public void initZygote(StartupParam startupParam) throws Throwable {
Pref = new XSharedPreferences("com.android.xposed...", "Preferences");
}

public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {
if (lpparam.packageName.equals("com.android...")) {

de.robv.android.xposed.XposedHelpers.findAndHookMethod
("com.android...", lpparam.classLoader, "....", Operation.class,
new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {

final Class<?> Constants = de.robv.android.xposed.XposedHelpers.findClass
("....", lpparam.classLoader);
Pref.reload();
Map<String,?> D = xPreferences.getAll();
int i=0;
for (Map.Entry<String, ?> entry: D.entrySet()) {
A[i] = entry.getKey();
de.robv.android.xposed.XposedBridge.log(entry.getKey());
i++;
}

B = de.robv.android.xposed.XposedHelpers.findField
(Constants, "ACCEPTABLE...");
final Object oldFieldAcc = B.get(Constants);
B.set
(oldFieldAcc, A);

});
}
}
}

I want to keep the secret :p so I obscured the name of variables and some string but all the code is exactly that!

Thanks!
[Xposed General] GermainZ:
And it works fine when you remove .reload()? I'm not sure what's wrong, but if I had to guess, I'd say it's a permission issue. Do this when defining Pref instead:

Pref = new XSharedPreferences(…, …);
[COLOR="Red"]Pref.makeWorldReadable();[/COLOR]
[Xposed General] Massi-X:
Yes works perfect when I remove to reload.I have yet tried this solution but not work.

I try to explain you what happens when I use the version with pref.reload:I select the option in my app and reboot and all work,also the log;when I change things on the go old preferences continue to work and the hook also but all new things aren't considered and the log stop to work.

I'm going crazy....
[Xposed General] rovo89:
That's easy to explain: You write the settings from your own app, but read them from a different app. It doesn't matter that your code tries to read the settings, it's executed in the hooked app's process with the hooked app's UID. Android's security concept doesn't allow this by default, preferences are usually only readable for the app that created it. Pref.makeWorldReadable() will change this (as the name says), but Android automatically resets the permissions when you store the settings again. To fix this, try:

[B]getPreferenceManager().setSharedPreferencesMode(MODE_WORLD_READABLE);[/B]
addPreferencesFromResource(R.xml.preferences);

https://github.com/rovo89/PlayStore...d/mods/playstorefix/SettingsActivity.java#L29
[Xposed General] Massi-X:
You won't believe it but i think this last night :D .And yes,this was the problem!Thanks to everyone have help me.I think that my module will online today or tomorrow. :good:
[One (M7) Q&A, Help & Troubleshooting] Bjbeats31:
I would like some help on the following:

On my older HTC One I have the following:

Android version: 4.4.2

HTC Sense version: 6.0

Software number: 5.13.599.101

On my HTC One AT&T I have following:

Android version: 4.1.2

HTC Sense version: 5.0

Software number: 1.26.502.12

Since I am not in USA and not using AT&T network, I find myself unable to upgrade the software.

Is there a way of getting rid of the AT&T software version and getting the normal HTC software version?

Best Regards
[One (M7) Q&A, Help & Troubleshooting] jensenyu:
Rooted, flash recovery, s-off and flash whatever rom you like
[Upgrading, Modifying and Unlocking] raghupeddireddy:
I purchased my note 3 n9005 from UAE .After updated to 4.4.2 device doesn't recognise external sd card. Trying to mount sd card "blank sd card or unsupported file format" message displays. Same external sd card tested in desktop and other mobile...it is opens fine..plz anybody suggest the solution. ..
[Paranoid Android Features Development] EStt:
Hi,

I was wondering if a functionality like the one provided by the xposed module statusbarscrolltotop could be implemented ?

For example when the system detects that the user has been scrolling up for quite some time or just hit the status bar it would show the same kind of window as it does with clear all recents for exampe.
[Acer Iconia A700 and A510] tonev:
I need stock system.img in order to flash it via fastboot. I have deleted my recovery and now i have no rom installed so i need these files. Hope someone can uploaded them fast because i am running out of time.
[Acer Iconia A700 and A510] Shreps:
As said by PM

Reboot in fastboot, and do

fastboot boot recovery.img

(using CWM or TWRP)

In recovery, you will be able to flash a ROM or restore a backup.
[Android Q&A, Help & Troubleshooting] agushack:
hey,, forum..

Please help meee,, I recently flashing (cm10.2 android4.2.2) on my device and after that i cant play any mp3 files,, but other *ogg (notifications ringtone, etc) is working good, how ti fix his problem

lOGCAT

--------- beginning of /dev/log/system

--------- beginning of /dev/log/main

E/MediaPlayer( 5756): error (1, -2147483648)
E/MediaPlayer( 5756): Error (1,-2147483648)
E/MediaPlayer( 5756): error (1, -2147483648)
E/MediaPlayer( 5756): Error (1,-2147483648)
E/MediaPlayer( 5756): error (1, -2147483648)
E/MediaPlayer( 5756): Error (1,-2147483648)
E/MediaPlayer( 5756): error (1, -2147483648)
E/MediaPlayer( 5756): Error (1,-2147483648)
E/MediaPlayer( 5756): error (1, -2147483648)
E/MediaPlayer( 5756): Error (1,-2147483648)
E/MediaPlayer( 5756): error (1, -2147483648)
E/MediaPlayer( 5756): Error (1,-2147483648)
E/MediaPlayer( 5756): error (1, -2147483648)
E/MediaPlayer( 5756): Error (1,-2147483648)
E/MediaPlayer( 5756): error (1, -2147483648)
E/MediaPlayer( 5756): Error (1,-2147483648)
E/MediaPlayer( 5756): error (1, -2147483648)
E/MediaPlayer( 5756): Error (1,-2147483648)
E/MediaPlayer( 5756): error (1, -2147483648)
E/MediaPlayer( 5756): Error (1,-2147483648)
E/MediaPlayer( 5756): error (1, -2147483648)
E/MediaPlayer( 5756): Error (1,-2147483648)
E/MediaPlayer( 5756): error (1, -2147483648)
E/MediaPlayer( 5756): Error (1,-2147483648)
E/MediaPlayer( 5756): Unable to to create media player
E/MediaPlayer( 5756): Unable to to create media player
E/MediaPlayer( 5756): Unable to to create media player
E/MediaPlayer( 5756): Unable to to create media player
E/MediaPlayer( 5756): Unable to to create media player
E/MediaPlayer( 5756): Unable to to create media player
E/MediaPlayer( 5756): Unable to to create media player
E/MediaPlayer( 5756): Unable to to create media player
E/MediaPlayer( 5756): Unable to to create media player
E/MediaPlayer( 5756): Unable to to create media player
E/MediaPlayer( 5756): Unable to to create media player
E/MediaPlayer( 5756): Unable to to create media player
E/MediaPlayer( 5756): Unable to to create media player
E/MediaPlayer( 5756): Unable to to create media player
E/MediaPlayer( 5756): error (1, -2147483648)
E/MediaPlayer( 5756): Error (1,-2147483648)
E/MediaPlayer( 5756): error (1, -2147483648)
E/MediaPlayer( 5756): Error (1,-2147483648)
[Moto G General] abhifx:
Its now all over the development section where people are trying custom ROM and getting stuck at infinite bootanimation loop.

This, as explained by famous developer dhacker29, the f2fs file system is very sensitive and gets easily corrupted. This results in stuck at bootanimation.

Presenting the solution – One time, shut it all and noob friendly

Common steps

1)	From your working ROM, copy all your sd card data somewhere safe (PC, pendrive etc)

2)	Backup all your apps (you can use titanium back up or this http://xdaforums.com/showthread.php?t=1581653)

3)	Download stock firmware for all those “what if it goes wrong” issues.

4)	Install drivers for Motorola devices

5)	Download your favourite ROM

6)	Install minimum adb and fastboot

7)	Install TWRP (official support is now available)

The geek method

8)	Format /system, /data and /data/media (I strictly mean format as simple wipes won’t do)

9)	Now sideload your rom file

a.	Advance in TWRP

b.	ADB sideload and swipe to start

c.	Connect to computer where you have installed drivers and adb

d.	Start cmd and type adb devices – it should show your device

e.	Now side load by typing adb sideload drive letter:\where\your\rom\rom.zip

10)	Reboot to recovery

11)	Now install ROM as normal

12)	Wipe cache and dalvik and reboot

Non Geek method

8) Install stock firmware for your respective device using fastboot (there are tutorials that have the batch file which installs the firmware automatically by simply clicking the batch file)

9) Install TWRP recovery

10 ) copy ROM zip file and flash

Everyone is now requested to use the guide, help me improve it ans stop flooding dev section with same question over and over again.
[Moto G General] amit.lohar:
Alternate Method : Noob Friendly.

First of all backup your sd card (i.e data/media)

Flash Philz Touch 6.26.6 Recovery

Hope you have OTG cable and a pendrive. :)

Copy the rom which you want to install on pendrive. Attach pendrive through OTG.

(backup your current rom on usbdisk. For this goto Backup and Storage. Find option backup on storage/usbdisk :good: )

Now, select Wipe Data/Factory Reset. It will ask Wipe to install new rom,tap on it. Say Yes.

After that goto Mounts and Storage and format /data and /data/media (/sdcard). Say Yes.

Done.

Now flash your favorite custom rom.

Select the option install from sdcard. Then select usbdisk. Select your custom rom and install it
[Moto G General] bublz654:
this is a noob question-is a USB stick same as a pen drive ?
[Moto G General] reversegear:
yes
[Moto G General] IronFistYo:
Wohoho..!

Oh man..!

I was one of the first people who started facing this issue...

That time, 2 months back, I couldn't figure what to do...

So, I installed Stock GB Firmware (link in my signature)..

Finally, we've got a method to fix that.. :)

I've been away of this forum for quite a lot of time now..

Good to see such development coming in.. :good:
[Moto G General] bublz654:
does anyone know a quick and easy way to copy content of SD card to somewhere ?
[Moto G General] IronFistYo:
Quickest way I think is to take a USB Drive and attach it through an OTG-Cable, then use ES File Explorer to copy all things to it..

Connecting to a PC through USB takes more time due to some limitations there...

UST OTG works good.. :good:

You can use WiFi Direct maybe..
[Moto G General] bublz654:
OK cool ty :)
[Moto G General] bublz654:
I just bought a 64 GB (but actually 58.86 GB when I looked in storage settings) so I'm going to try this method either tonight or tomorrow night - the alternative method as I have philz recovery installed
[Moto G General] abhifx:
Yeah... Lots of people were having the same problem. Sadly, most people choose to not to search before posting same issue again and again.

But i still hope this guide helps other. This should probably be sticky.
[Moto G General] bublz654:
sorry for no feedback yet. I am waiting on next build of ROM as this version has a boot problem
[Moto G General] abhifx:
wrong thread?
[Moto G General] bublz654:
I said in my previous post that I would test this guide out. but I'm waiting on next build of rom
[Moto G General] IronFistYo:
Yup

When I searched for the issue, I found nothing on it...And I had no idea how to fix it..

I thought to make a thread about the problem but didn't had enough time in those days..

I thought someone will eventually report the problem..

I think flashing the RetailGB firmware helped because it formatted the internal memory...

#PEACE-OUT (Not in for spam.. :) )
[Moto G General] Pankaj_gehloach:
Thanks for the guide bud.
[Moto G General] ross231:
Is there a way i can mount USB storage in TWRP?

---------- Post added at 11:36 PM ---------- Previous post was at 11:27 PM ----------

Is there a way i can mount USB storage in TWRP?
[Moto G General] _Drifter_:
Go to advanced - USB OTG - click on it.
[Moto G General] ross231:
I did, but nothing happened.
[Moto G General] _Drifter_:
Click the square before ''USB OTG''.
[Moto G General] abhifx:
what version of TWRP are you using? only the official version or the teamex version has OTG support
[Moto G General] amit.lohar:
Tick that and reboot in recovery again.

Sent from xt1033, India ;)
[Moto G General] outlawmodzz:
a little lost.

Can someone post a link to philz recovery 6.26 .
[Moto G General] amit.lohar:
Find it here:

https://goo.im/devs/philz_touch/CWM_Advanced_Edition/falcon/

Sent from xt1033, India ;)
[Moto G General] Ugion:
This isn't the post i read, but this method worked for me after i couldn't get CyanogenMod to install. :)
[Moto G General] :
once you do this once do you have to do this again if you want to flash other ROMs. or you have to do this every single time?
[Moto G General] amit.lohar:
No not everytime. Only once!

Sent from xt1033, India ;)
[Moto G General] :
yayyy!!! :) im just going to flash a random ROM now xD
[Moto G General] vdries:
Or what you can do is hold the power button untill a black screen appears, the hold the power and vol - to get into fastboot. pick recovery and you're good to go again. :p correct me if i'm wrong :p
[Moto G General] amit.lohar:
Thats not the issue. Once you are stuck on bootloop thats means you have corrupted f2fs partition. So to boot cm you have to wipe sdcard i.e internal storage. This happens for people who flash cm for first time.

Sent from xt1033, India ;)
[Moto G General] vdries:
Ok well, I said nothing xd
[Moto G General] :
im trying to flash c ROM
[Moto G General] amit.lohar:
stuck on bootanimation? you have to wipe internal storage too.
[Moto G General] :
what I meant was he said people get stuck on bootloop when they flash cm first time. I was trying to flash c ROM first time
[Moto G General] abhifx:
This could be tons of issue. generaly once you are on custom rom, other roms should work if you do a clean install.

If clean install is not helping then i recommend you follow the steps in the guide (super easy step is fastboot original ROM)

If everything else fails then blame the ROM developer.
[Moto G General] :
I have to clean install every single time I have to flash a ROM ? I thought the person said you only have to do it once and other times you can do the normal wipes
[Moto G General] abhifx:
Havent i said it clearly in the above post that "generally" it works.

but since you are getting stuck i was suggesting you try clean install.
[Moto G General] :
i havent tried flashing a rom using this method yet because im in an area with no wifi. only an internet cable
[Moto G General] DJHAMILTONS:
Thanks ;)
[Moto G General] abhifx:
why do you need wifi?

all the stuff in the guide can be downloaded through fixed lines too and flashing stuff doesn't require wifi.
[Moto G General] :
if I want to set up accounts etc. download apps
[Moto G General] abhifx:
there is a workaround for all that, but the guide is here in case you take the plunge :)
[Moto G General] nickharh:
help me out guys!

guys my moto g have been stuck at boot like forever..actually i convert my moto g to gpe and upgrade it to 4.4.4..but i change my mind and downgrade it to 4.4.2..now im stuck like forever :crying::crying::crying::crying::crying::crying::crying: help me guys..miss my moto g
[Moto G General] abhifx:
have you tried flashing stock 4.4.4 firmware through fastboot?
[Moto G General] nickharh:
not yet senior..where can i get that 4.4.4 firmware?? can you give me a link please

update : found the solution for my problem!! this thread help me to recover my moto g back to life!! thanks sir! http://xdaforums.com/moto-g/help/believe-to-unbrick-moto-g-bricked-boot-t2809373
[Moto G General] TechLT:
total destruction

Hi guys, I followed these steps and then I realized I have no OTG cable... Now my phone is formatted and it cannot be detected by my pc.I have no idea how to flash my rom.

Any help is MUCH appreciated!
[Moto G General] amit.lohar:
Boot in recovery. And flash rom using adb sideload.

Follow this :

http://xdaforums.com/showthread.php?t=2318497

Sent from xt1033, India ;)
[Moto G General] TechLT:
Thank you for your reply, but after I did " format /data and /data/media (/sdcard)", the command "adb devices" does not list any device anymore.
[Moto G General] amit.lohar:
From recovery did u choose adb sideload?

Sent from xt1033, India ;)
[Moto G General] TechLT:
Yes, but it doesn't seem to detect the device at all. Only battery charges when plugged in to the pc.

Do you think that I will solve the issue with the OTG cable?
[Moto G General] amit.lohar:
Yea..just plug it and install rom from pendrive/usb stick. For now philz touch recovery supports otg.

Sent from xt1033, India ;)
[Moto G General] abhifx:
in fastboot mode type fastboot devices. if it gets listed then i dont see a problem in sideloading.. i guess it does depend on recovery you are using.

but if everything else fails than try flashing stock ROM via fastboot.
[Moto G General] TechLT:
Also fastboot didn't detect my device.

But I bought the OTG cable and managed to flash the rom. I just had to mount the usb device and reboot.

Thank you all for your help
[Moto G General] abhifx:
Good! But fastboot not being detected means there is some driver issue and you should check it as you may never know when you will need to flash stock ROM
[Moto G General] maikel2201:
please help

ok, so my phone was plugged into the cahrger(40%), and when i came back the phone was off. shutdown.

i turned it on and it doesnt go past the motorola logo after the boot animation.

i have never rooted or did something to my phone. clean android 4.3.

i try to go to factory, but after i select it it goes into boot animation and stay there again. i tried all options all the same.

can someone please try and help me? i dont know what else to do? even if just to try and recover my files
[Moto G General] abhifx:
If the factory reset from stock recovery is not working.. may i suggest you install custom recovery. yes this will entail bootloader unlock.

Or if you want nothing like this,... just flash stock ROM
[Moto G General] justjr_isanidiot:
Thanks to user [MENTION=4097733]SickBeast[/MENTION] Faux has stopped development for us. Thanks SickBeast, well done. Now please keep this forum one time for all, do it for us, please. Or someone ban this useless kid :highfive:

Such an idiot!!! :laugh::laugh::laugh:

YOU ARE RUDE!!! ahahahahahahahahahah
[Moto G General] ChuzoS4:
Good thread and thanks for the information offered.

greetings
[Moto G General] Juste300:
NEED URGENT HELP

I accidentally wiped the internal storage of my Moto G XT1033 (dual sim variant), since the OS is lost now my phone is stuck at bootloader warning. I can access TWRP recovery. In device manager I can see Google Nexus ADB Interface. And in taskbar (safely remove hardware and eject media) phone is recognized as Eject XT1032. But in file explorer/My computer I can't see the phone. My phone drivers are installed.

I've tried adb shell command and I am getting this error:

C:\Minimal ADB and Fastboot>adb shell

* daemon not running. starting it now on port 5037 *

* daemon started successfully *

error: device not found

and with adb devices command following error:

C:\Minimal ADB and Fastboot>adb devices

List of devices attached

(this line/area is blank)

C:\Minimal ADB and Fastboot>

Now how can I fix ADB or this problem? Please help :(
[Moto G General] Juste300:
I tried USB OTG method, copied CM nightly into my flash-drive then attached flash-drive + OTG cable with phone, at first OTG was not working don't know why it could not mount, I restarted phone, went into recovery and then I could installed rom from flash-drive. Finally my phone is working now :)

I am totally new to android and this rom rooting stuff. Moto G is my first android smartphone coming directly from iPhone 5 so I was scared like hell :D

If anyone failed with ADB Sideload method please try USB OTG method and your phone will work again. Hope this help others :)
[Moto G General] Josuegrs:
Nice post, thanks a lot.
[Moto G General] Sachin1357:
Thanks
[Moto G General] vikraminside:
Can I do same with CWM or TWRP is must?

One more thought: Will it not be okay to just restore /system/media

as bootanimation.zip in that directory. If I can mount USB in recovery will it not be enough to restore only media partition why full factory reset and data format?