[Android Software/Hacking General [Developers Only]] xizix:
HowTo change the Simple Calendar Widget configuration by modifying its internal files.​

(also shows how to modify applications data files without root)​

Go to reply 1 to get the solution right away

Go to reply 2 to get my config file

Simple Calendar Widget is my favorite calendar widget. It has been with me since my first android phone. Unfortunately it hasn't been maintained for the last 10 years. The functionality is not lacking but an android change broke the widget. It still displays data properly but it's not possible to change the configuration (the app shuts down when you try to configure it).

Google store image on the left. My setup on the right.

View attachment 5617121 View attachment 5617125

Most of the users dropped the widget altogether and the store rating reflects it. It has nothing to do with how good the widget is - its perfect. Obviously most users are discouraged by the lack of configuration :) I am not though. Who needs a gui configuration as long as you can set the style you want. You only configure it once unless a migration between devices breaks your configuration or you remove and reinsert the widget.

I've decided to find out how the configuration is stored internally and make the changes I want by modifying files in apps data folder and that's what the guide is about.

Evaluating solutions

Picking best candidates

Finding out how to do stuff

Testing

Making the changes

Prospering

1. Evaluating solutions​

In general we can approach this in two ways. Either we fix the app by finding underlying issue and rebuilding the apk or find a way to modify the configuration without the GUI. Since rebuilding and posting a modified app without the authors consent is imo a bad form and doing all this work only for my benefit seemed not worth the time I went with the second option.

My main device is not rooted and cannot be rooted easily and with a rooted target device this whole task would not be worth a guide. Well at least not on xda.

With those decisions made the task is to find out how to setup the widget the way we want (a) and how to modify an app data on a non rooted device (b)

2. Picking best candidates​

Lets see what we can do about (b) first. Unless we succeed (a) is moot. With googles help I imagined those:

Modify the app manifest to make the app debuggable and execute commands from it's context

Accessing the data using root without permanently rooting the target device

Mounting the internal storage and reading/writing directly.

Triggering a load config from backup action without a gui (the widget has a config import/export capability - the gui to trigger it is broken though)

Backup-> modify -> restore app data

Looks like there are some potential options. 3. shouldn't even be here I don't even know how many protections there are for making it hard. 2. my device does not have an option to enable root on usb debugging. 4. I didn't feel like researching it so I picked 1. and 5.

Lets see about (a)

Look at the internal data and see if we can make any sense of it and be able to guess which parameter is stored where

Get an emulator with an old Android version (where the gui works) and see how gui config changes are reflected in the data files.

Both good enough but I didn't want to break stuff on my target device while playing with config so an emulator was needed. And since we use it we can get an old Android where the widget would work thus killing two birds (with one emulator) (read on for more excellent jokes like this)

3. Finding out how to do stuff​

Starting with (a) to mix things up I used the Apk Extractor from the store to export the app (com.anod.calendar) and installed it on the one emulator I had on hand - Bluestacks 5.4.100.1025 N32

View attachment 5617231

This is the button to install an apk right there:

View attachment 5617233

Also installed the Nova Launcher on the emulator from the store (the Bluestacks home screen is not a normal Android home screen and it's not possible to install widgets on it).

Amazingly I was was able to put the widget on the Nova Launcher home screen and it worked right of the bat.

View attachment 5617235View attachment 5617237

The configuration is not exported with the apk - what I was hoping for - but still I hadn't expect it to work from first try.

For the next part we need to check how the changes in configuration are reflected in the data files. For this we need the adb: SDK Platform Tools includes adb and root on our Bluestacks instance.

To get root on Bluestacks go to %programdata%\BlueStacks_nxt folder and modify bluestacks.conf file (backup first). Change bst.feature.rooting="0" to "1" and bst.instance.Nougat32.enable_root_access="0" to "1". Note that if you have multiple Bluestacks instances the second line to modify might look like that: bst.instance.Nougat32_3.enable_root_access (4th instance)

Enable Android Debug Bridge in Settings->Advanced

View attachment 5617255

Check if debug bridge works properly by listing available devices. Connect using the address:port listed on that page. In my instance its localhost on 5595 (127.0.0.1:5595). Then go to the app data folder and browse.

adb devices
adb connect localhost:5595
adb -e shell
su
cd /data/data/com.anod.calendar/
find . | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/|-\1/"

No I did not write the last command myself :p

View attachment 5617263

View attachment 5617265View attachment 5617267

So this looks super uninteresting except from /shared_prefs/com.anod.calendar_preferences.xml and maybe app_webview/pref_store

tbc​