yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] ravian29:
you are right, i understand how the app works, it only fire scripts and scripts needs to work using kernel, busybox, init.d etc. I am not blaming the rom control app, its fantastic work which is saving hours of work which every dev has to do. I am really thankful to you guys for your contributions, not only for rom control but for all other mods and guides too.
[Android Apps and Games] daxgirl:
Thanks man. You have ton understand we're not being defensive here. There is just little we can do when it comes to not working scripts. It's the one part where the developer must find the problem. And from expirience. .. it's a pain in the ass...
[Android Apps and Games] Martillero:
Regarding the status bar color issue... i have the same issue on light theme when i first compile rc, i fixed long time ago but i dont remember how exactly, it was something on styles :confused:...

Try playing a little bit with styles.xml (v21), dont remember right now wich line was it.

Now if i want to change the statusbar color, in styles we have:

AppTheme:

<item name="colorPrimaryDark">@color/myPrimaryDarkColor</item>

AppThemeLight:

<item name="colorPrimaryDark">@color/myPrimaryDarkColorLight</item>

So in colors need to change those:

myPrimaryDarkColor and myPrimaryDarkColorLight to your desired colors.

Ex:

And yeah, i cant stop saying this: Thanks a lot Wuby and Dax :good:
[Android Apps and Games] Wuby986:
wooooooow!!! such a cool layout there [emoji108][emoji108][emoji108] love it!!
[Android Apps and Games] daxgirl:
Right??? I see those and I can't believe it was our code!!! Those guys really do wonders!!!

Edit: love your new signature. Melts my heart and you know it!!!

To add another great citation:

"People die doing this (motogp). But most of them live. REALLY live."

From Fastest, by Marc Neal [MENTION=5493353]Wuby986[/MENTION]
[Android Apps and Games] Er. Aditya:
hey guys , i hope you all are having a nice time :)

anna , wuby is there any way i can backup my settings made to rom control and restore each time i clean flash ??

thankyou so very much for this powerful creation
[Android Apps and Games] daxgirl:
That's a nice idea. We will definitely add it to the app. ???
[Android Apps and Games] Er. Aditya:
thanks aton anna for such great and fast response , looking forward to it :)
[Android Apps and Games] daxgirl:
As I mentioned probably more times than anyone cares to hear, I am kinda pressed in time till December 14th to finish a study project. So if we can squeeze it in sometime, or Wuby gets bored often, it could happen before then. If not - soon after that. Knowing Wuby though he will have it done faster than I finish my project ???
[Android Apps and Games] Er. Aditya:
there's no rush , you guys are doing this is the main thing that matters to us here :D
[Android Apps and Games] Kamy:
Yes it's a nice idea. That also can be done through script too, Just -rf all databases folder of settings provider to sd card and to restore -rf it back to database folder.
[Android Apps and Games] tdunham:
It is not feasible for Rom Control only as it utilizes the main sql database to store its entries. The entire sql database would have to be backed/restored as kmokhtar79 said.

I have done this for some time now.

The backup script:

#!/system/bin/sh

mount -o rw,remount /data

mkdir /sdcard/backups

cp -rf /data/data/com.android.providers.settings/databases /sdcard/backups

Restore script with auto reboot after restore:

#!/system/bin/sh

mount -o rw,remount /data

cp -rf /sdcard/backups/databases /data/data/com.android.providers.settings

pkill zygote
[Android Apps and Games] Er. Aditya:
thanks a million ,sir
[Android Apps and Games] ravian29:
thanks for guiding me there, i have changed

<item name="android:windowDrawsSystemBarBackgrounds">true</item>

to

<item name="android:windowDrawsSystemBarBackgrounds">false</item>

and now status bar is black :good:
[Android Apps and Games] tdunham:
And this is our Rom Control entries to utilitize the two scripts that we place in the assets folder:

<PreferenceCategory
android:title="Data Management" />
<PreferenceScreen
android:title="Backup System Settings"
android:key="script#backup_sql"
android:summary="Backs up entire settings database" />
<PreferenceScreen
android:title="Restore System Settings"
android:key="script#restore_sql"
android:summary="Automatic reboot on press" />
[Android Apps and Games] Er. Aditya:
will give this a shot , and will report back :D
[Android Apps and Games] daxgirl:
Great stuff, Troy!!!!!

You guys are unbelievable!!! Monster rom and monster rom control!!!

As for not feasible... challenge accepted.. ?
[Android Apps and Games] Er. Aditya:
lol clash of the titans

---------- Post added at 05:47 PM ---------- Previous post was at 05:04 PM ----------

also anna where can i find toggle images ??
[Android Apps and Games] Wuby986:
yep.. accepted [emoji1]

how you guys were thinking it to be? like a separate entry in the navbar?
[Android Apps and Games] daxgirl:
Yeah we can add a settings entry or backup entry. As for saving the preferences, me was thinking...Good ol' hash map, baby!!! ???
[Android Apps and Games] daxgirl:
[MENTION=5750672]Er. Aditya[/MENTION] toggle images are in framework-res. But you can use your own provided you make an item for it in styles ?
[Android Apps and Games] Wuby986:
you mean going throug the db and backup/restore only the entry that are related to app?
[Android Apps and Games] daxgirl:
No need to go through db. Anything that's in db is in preferences. Just save hash map of string-string pairs
[Android Apps and Games] tdunham:
No ideas for that one but if we're kicking ideas around, how about adding something that will autoboot the app like the apptoggles already does on first boot to set the all the database entries on first rom boot?
[Android Apps and Games] daxgirl:
That's part of the idea. Exactly what I was thinking
[Android Apps and Games] ravian29:
guys i need little help here, i want to execute the following command on selection (this is for statusbar clock)

<CheckBoxPreference android:title="Uppercase" android:key="upper" android:summary="Disable to use normal text" />

is there any chances to get it applied on selection instead of systemui restart or phone reboot ? Thanks in advance
[Android Apps and Games] daxgirl:
Yes there is a way. You need content observer. For that you need to consult on modding thread. As stated in the op we do not answer modding questions here. We connect you to the content resolver. Whether your mod applies after ui reboot or immidiately has nothing to do with us. You need content observer.
[Android Apps and Games] ravian29:
thanks for answering and guiding me in right direction
[Android Apps and Games] daxgirl:
I don't have the link handy, but one of the links I have in OP is to a thread by tdunham. He also has a special thread for content observers. You might have better luck understanding what you need to do there. Very helpful people in this area are tdunham and remuntada78. They have built many mods with observer.
[Android Apps and Games] ravian29:
sure will try to learn this as well, i am totally new to android development that's why i do not have much knowledge about java/android coding. Thanks anyway for introducing a new concept of ontent observers.:good:
[Android Apps and Games] daxgirl:
Dear friends, the amazing and the almighty [MENTION=5493353]Wuby986[/MENTION] has done a hell of a job on a new, interactive backup and restore function for the rom control.

As first stage we will publish it as is, not adding to git sources for now. The reason is that we're currently working on updating the sources to v2.0 with all the goodies we have added so far with your ideas and help.

The backup function will be added to the sources once we have completed the upgrade. For now Wuby will publish a guide with necessary files for you to add to your project in order to expirience the backup and restore functionality and test it.

Your feedback and ideas are most welcome.

Cheers!
[Android Apps and Games] Er. Aditya:
love you guys :D :highfive: :D

[MENTION=4715535]wuby[/MENTION] [MENTION=243290]anna[/MENTION]

just a confusion

- we will add it's case to the onNavigationItemSelected in MainActivityView.java, for my current avail options i went for case 5

or

onNavigationDrawerItemSelected ??
[Android Apps and Games] daxgirl:
Wuby will create a new guide soon with the updated functionality. Then it should be more clear.
[Android Apps and Games] Er. Aditya:
you guys are the hulk :D
[Android Apps and Games] Martillero:
Hi guys, thanks a lot! like usual, your work is priceless :good:

Wuby, all is working awesome for me now, but i had some issues so i will ask just in case.

1- what is this part of the code for?

for (File files : filesdir.listFiles()) {
if (files.isFile()) {
String name = files.getName();
if (!name.contains("com.wubydax")) {
File filebackup = new File(bkpdir + "/" + name);
try {
filebackup.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

I get it has something to do with the filename but i had to remove it cause it was causing a crash on rc, after remove it, it works just fine.

2- Second issue i found at my end, was this part:

@Override
protected Boolean doInBackground(String... params) {
//Accessing the ability of the device to get root and the ability of app to achieve su privileges.
// if root is given we create the folders if not existing
if (RootTools.isAccessGiven()) {
if (!sddir.exists()) {
Log.d("sddir", "sddir doesn't exists");
sddir.mkdir();
bkpdir.mkdir();
}
return null;

} else {
return false;
}
}

If i get it right, this part is for creating the folders on sdcard when we lunch rc, copying and pasting the method wasnt working so i had to edit my previous method: "protected Boolean doInBackground(Void... voids)", and introduce the code for folders like this:

@Override
protected Boolean doInBackground(Void... voids) {
//Accessing the ability of the device to get root and the ability of app to achieve su privileges.
if (RootTools.isAccessGiven()) {
if (!sddir.exists()) {
Log.d("sddir", "sddir doesn't exists");
sddir.mkdir();
bkpdir.mkdir();
}
am = getAssets();
//Calling the helper class HandleScripts to copy scripts to the files folder and chmod 755.
//Scripts can be then accessed and executed using script#scriptname key for PreferenceScreen in PreferenceFragments
hs = new HandleScripts(MainViewActivity.this);
hs.copyAssetFolder();
return true;

} else {
return false;
}
}

Now everything works fine, and i know as long as something works its ok, but i want to know if there is something superwrong about this or not. Until now, all backup/restore features works fine.

Thanks again.
[Android Apps and Games] Wuby986:
so the first error is kinda weird.. also if you have removed that part how is it possible it works?!?! that is going to make a backup..! it will read all the files in the file directory and copy them to sdcard.. but now that i think of there shouldn't be the condition for its name there! make sure you did not swap code by error

it's correct (even if useless in this current vs of code, because we avoided the mix with the com.etc.etc files by using the separated folder.. anyway, it shouldn't cause any problem at all.. that is going to be always true

also the second error is because ( i think) you added in the copyassest async taks, not sure about this actually.. i might need to see the error now that i read it again from pc for sure it was.. you were giving the null return to a void method
[Android Apps and Games] daxgirl:
[MENTION=4830018]Martillero[/MENTION] copy of the error from the log could go a long way.

I suspect there was a null pointer exception because of no files in the direction or something.. maybe you skipped a condition or something. But it really would help to see the error.
[Android Apps and Games] Martillero:
Honestly i dont fully understand why, but its working 100% sure.

I ve tried several times, deleting the folder, and when i press backup option i have new folder and the prefs.txt file created.

Now i see the code i think this is the part is somehow giving me troubles:

for (File files : filesdir.listFiles()) {

if (files.isFile()) {

String name = files.getName();

if (!name.contains("com.wubydax")) {

So the backup part works, cause there still there the backup code.

Basically Point 2, second code of the guide

I delete red part:

private void backupPreferences() {
//we go into the shared_prefs folder and we read the files name's
File prefdir = new File("/data/data/com.wubydax.romcontrol/shared_prefs");
File filesdir = new File("/data/data/com.wubydax.romcontrol/files/FilePrefs");
if (bkpdir.listFiles() != null) {
for (File deleteBkp : bkpdir.listFiles()) {
deleteBkp.delete();

}
}
for (File f : prefdir.listFiles()) {
if (f.isFile()) {
String name = f.getName();
//if file is defult pref we don't backup as it doesn't go in the bd
if (!name.equals("com.wubydax.romcontrol_preferences.xml")) {
//we remove the xml suffix from filename and we assign it in the loop to the shared prefs
//this way we can use the getAll method of shared prefs for all the existing files in the folder
name = name.replace(".xml", "");
SharedPreferences pref = getSharedPreferences(name, MODE_PRIVATE);
//now we write to the backup file
Map<String, ?> allEntries = pref.getAll();
for (Map.Entry<String, ?> entry : allEntries.entrySet()) {
try(
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(bkpdir + "/prefs.txt", true)))) {
out.println(entry.getKey() + ": " + entry.getValue().toString());

}catch (IOException e) {

}
}
}
}
}
[COLOR="Red"] for (File files : filesdir.listFiles()) {
if (files.isFile()) {
String name = files.getName();
if (!name.contains("com.wubydax")) {
File filebackup = new File(bkpdir + "/" + name);
try {
filebackup.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}[/COLOR]

finish();
this.overridePendingTransition(0, R.animator.fadeout);
startActivity(new Intent(this, MainViewActivity.class));
this.overridePendingTransition(R.animator.fadein, 0);
}

And yes, i remember it was a null pointer exception, that's why i choose to "skip" that section and try.

Like i said, now is working but I will recreate the changes to catch the log for you guys :good:
[Android Apps and Games] Wuby986:
well that is going to handle the special FilePreferences backup.. the preference will create or remove a certain name file in the files/FilePrefs folder now, so we backup.. so in the end is my bad i didn't thought it might not exist.. it was always there because i have a fileprefs in the first fragment that opens so it calls the class and creates the folder.. so we might solve this way.. right above the red code we add an if condition

if (filesdir.exists()) {

and we will add the closing } after it..

this should solve
[Android Apps and Games] Martillero:
Daaaaamn...you guys are too smart :victory:

I was writing my answer but you were faster than a bullet wuby, so i had to delete everything haha

That adittion indeed solve my issue.

Awesome job mate :good:
[Android Apps and Games] Wuby986:
so guys..

we've been thinking a bit on this restore feature and it comes out that as it is it can be safely restored only over the same vs of the rom because what if you decide to change the behaviour of one mod, or for some reason you changed the value of key entry from string to integer? as it is by now you get restore a wrong value because you restore string and it need integer to work.. so it can lead to fc and can be solved only via wipe data, also if you remove a mod, we don't need to write it to the db as it will be only useless junk and we really don't want this to happen, specially the first case!

so the solution we thought is to edit further the RestorePreferences class in order to restore only what you decide is safe.. so based on a txt file placed in the newest version of the app that you're going to include in the new vs of the rom you'll be able to restore only the preference that are safe, meaning that still remained the same. this is the idea.. for ex. in that file we put the key names we want to restore , let's say clock_color, and it will read the restore pref file that got back up and only if it finds the corresponding key there it will restore its value to db.

if instead you decide that all the old preferences are fine also for the new vs of the rom, then you just don't include it and you get all restore.

another case if you don't want to let the user restore because you changed too many thing, we will need to to rename the backup file to .bak f.e. so we don't delete it, but we don't give the ability to restore, since the file name is different the app won't read it. if they want to restore previous vs of the rom the can manually rename the file on sdcard removing .bak and do the manual restore from the app.

i'll work on this asap, in the mean while we'd like to know if you think it is necessary or not, if you are used change the key or the values for the mods or if you think it can be done in a different and more easy way for your needs and any idea you have about it

thanks :)
[Android Apps and Games] Goldie:
Snap! Same way I did it...makes most sense
[Android Apps and Games] Wuby986:
cool!! :D

yeah makes sense as it is now! how i did before was not the best way at all.. !

and if we all leaded to same method i am quite sure is the right one
[Android Apps and Games] daxgirl:
Cool!

I sincerely hope you don't imply we "borrowed" your idea, because.. well... we didn't ?
[Android Apps and Games] malbert16442:
Question

So when I resync from the new sources will I have to copy over all my mods>:D
[Android Apps and Games] daxgirl:
I am sure you will find a way...
[Android Apps and Games] Er. Aditya:
Hey guys can u specify a way to make my rom control app to work just for my rom ... just want to be sure if omeone needs it can take from source code
[Android Apps and Games] Wuby986:
well teoretically speaking you can make his life harder by hardcoding a your specific path name, or something like.. but if the thief is good with smali he can edit it as he prefers more or like.. but the point is.. if he is so good with smali, make some prefscreen won't be hard so he can pick and compile from source, also he could be held from GPU for violating the rules.. i don't think i would get worried too much about
[Android Apps and Games] daxgirl:
May I ask why you would wanna do that?
[Android Apps and Games] Er. Aditya:
thankyou sir , i some what understood :)

lol anna nothing special just had a thought in mind and wuby has explained many things in his rply...

thankyou guys
[Android Apps and Games] Er. Aditya:
hey anna , wuby how r u guys ??

guys i am trying to make another app for my tweeks but it replaces my current apk

how can i use both ?
[Android Apps and Games] daxgirl:
You need a different package name
[Android Apps and Games] Er. Aditya:
thanks anna

---------- Post added at 10:03 PM ---------- Previous post was at 09:46 PM ----------

[MENTION=4714483]daxgirl[/MENTION] sorry for such noob questions, but how can i do that with allready present package

with new project there's a option to name package

sorry bout that again
[Android Apps and Games] Wuby986:
i am quite sure you can from the setting of the project..
[Android Apps and Games] Er. Aditya:
oops forgot to update did it bro , just working on new project :D

thankyou for making this so so much fun :)

---------- Post added at 12:06 AM ---------- Previous post was at 12:02 AM ----------

[MENTION=5493353]Wuby986[/MENTION] bro just wanted to ask can rom control work on older android versions ??
[Android Apps and Games] daxgirl:
Min sdk 21
[Android Apps and Games] Er. Aditya:
thankyou anna , just one last thing when i try to push project on github it says project allready exists and has link for your repo
[Android Apps and Games] Wuby986:
you can make the new project from github web site, and then change the link in project setting to that one.. you'll need to merge first and then push
[Android Apps and Games] civato:
Phronesis rom control V4 source

So as this is a open project here is my source to build the app version "Phronesis Rom Control".

I build this to support the Note5 port for the note3 on the Phronesis rom.

Github Source
[Android Apps and Games] Wuby986:
nice :)

btw.. i'm sorry i forgot about the problem you had with scripts.. i believe now is all solved..
[Android Apps and Games] daxgirl:
Simply wonderful!

The source code link must appear on the op of the rom if people wish to review or build upon it!!! Good luck with your new build!!!
[Android Apps and Games] bamzzz:
Please add Image Picker Preference.. Thanks.. Great job.
[Android Apps and Games] daxgirl:
Sorry?
[Android Apps and Games] bamzzz:
Yes sir, Image Picker for pick image from gallery for modding custom Background dropdown, custom app background, etc
[Android Apps and Games] Wuby986:
unfortunately is not that easy

when you change a background in the systemUI the img is already into the apk you don't do it picking it from gallery..

i am sure we could make it, but what about the systemUI for ex? i don't have any idea on how to let it read the img not inside it

there are xposed modules that do that, not sure on how to code it in smali
[Android Apps and Games] xenreon:
Thanks for this wonderful thread, helped me learn some much needed stuff
[Android Apps and Games] Martillero:
Anna, Wuby, i have a question, i know all you do for us, feel bad asking for more, but maybe this one is an easy one for you.

I'm using the backup/restore feature provided by you. All is working like clockwork. The only thing i want to change is the alertdialog theme (to match with the set theme alertdialog for example, rounded borders and theme accent colors).

So, this 2 items use alertdialog popups:

I 've managed to use the theme support for method showBackupDialog, adding the setbackgrounddrawableresource on that method from MainViewActivity.

Did the same for RestorePreference class, also in same method where it says

ContextThemeWrapper(c, R.style.AppTheme ) i use ThemeOverlay_AppCompat instead AppTheme , that gaves me support for both themes and not only the dark one.

The alertdialogs i couldn't modify were the "confirm backup" and the "restore next boot". I 've tried to use setbackgrounddrawableresource, but had no luck.

This one:

I know this is a meaningless thing, it doesnt affect functionality, it's more about theming but i just want to know how if this can be done :confused:

Regards
[Android Apps and Games] daxgirl:
Well there is a trick for that. You will see the hint once you see how I themed all the dialogs in the app. Let me know if you find it on your own or want to skip for the answers part of the quiz ???
[Android Apps and Games] Martillero:
Nop, i prefer find it by myself, the best way to learn :good:

Now i know what i have to look for, thanks Anna!
[Android Apps and Games] daxgirl:
I just knew you were the "challenge accepted kinda guy" ? the main hint is... any part of the dialog can be gotten after the dialog is displayed. There you can get and theme backgrounds, buttons and stuff...
[Android Apps and Games] Martillero:
Done ;)

Have to change 2 lines on both methods, but it was so simple, the only thing i had to do was read and understand what the method says.

Now, all my new popups are properly themed, thanks again dax :good:
[Android Apps and Games] Henry Watson:
Rom Control

Very nice, thanks for share :)
[Android Apps and Games] DaOldMan:
This is excellent. Now we can truly learn from each other!
[Android Apps and Games] daxgirl:
Merry Christmas everyone! !! Best wishes and most productive year! May all your families, loved ones and friends bring only joy into your lives. And may marshmallow be a blessed, easy to root, easy to mode, fun to develop for platform ?

Merry Christmas and Happy new year to all!!!
[Android Apps and Games] Er. Aditya:
thankyou anna just letting you know its been a great year with you And wuby around :)