Post Reply 
Auto-rotation skins on Free42 v3.0.7
11-07-2021, 11:43 PM
Post: #1
Auto-rotation skins on Free42 v3.0.7
Has something changed related to skin display, auto-rotation, display in Horizontal mode, etc. in the v3.0.7 release of Free42? I just got a new phone and only yesterday afternoon got Free42 installed and working right in both V and H modes. Then 3.0.7 came out and now it's not working right (or at least the same). Now, in H mode, the same skin is used, but squashed down.

Maybe it's something here, but I have all 4 needed files (2 x .gif and 2 x .layout) in the /Free42 folder as normal, and it was working. Strange...

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
11-08-2021, 12:10 AM (This post was last modified: 11-08-2021 12:13 AM by Thomas Okken.)
Post: #2
RE: Auto-rotation skins on Free42 v3.0.7
That sounds like the issue that I fixed in 2.5.24a, back in January: the app not switching between portrait and landscape skins on Android 11.

With 3.0.7, I had to change the target sdk version from 29 to 30, i.e. Android 10 to 11. Maybe that change defeated the 2.5.24a fix.

The whole thing was a bit mysterious to me to begin with. My own phone, running Android 8.1, doesn't have the rotation problem, so it's of no use for spotting or troubleshooting the issue; I'll see if I can reproduce it in the Android 11 emulator tomorrow.
Visit this user's website Find all posts by this user
Quote this message in a reply
11-08-2021, 02:42 AM
Post: #3
RE: Auto-rotation skins on Free42 v3.0.7
(11-08-2021 12:10 AM)Thomas Okken Wrote:  That sounds like the issue that I fixed in 2.5.24a, back in January: the app not switching between portrait and landscape skins on Android 11.

With 3.0.7, I had to change the target sdk version from 29 to 30, i.e. Android 10 to 11. Maybe that change defeated the 2.5.24a fix.

The whole thing was a bit mysterious to me to begin with. My own phone, running Android 8.1, doesn't have the rotation problem, so it's of no use for spotting or troubleshooting the issue; I'll see if I can reproduce it in the Android 11 emulator tomorrow.

Thanks for the feedback Thomas.

My new phone is actually Android 12 (a Pixel 6 Pro) but as I noted, 3.0.6 was working yesterday on the same phone. It appears to be something that changed in 3.0.7, but I can't 100% rule out that something in the phone (or Android 12) might be the cause. While I haven't made any Phone config. changes that should affect this deliberately, it's not impossible I've changed something by mistake; there's a lot of new and different things in A v12.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
11-08-2021, 07:48 AM (This post was last modified: 11-08-2021 07:49 AM by Thomas Okken.)
Post: #4
RE: Auto-rotation skins on Free42 v3.0.7
That's good to know; I'll test this in the Android 12 emulator as well, then. I could also send you an apk with the target sdk set to 29, which you could side-load, to check whether or not that fixes the issue.

I do suspect the target sdk setting is the culprit, though, for a couple of reasons: one, the behavior you describe is eerily similar to what prompted the 2.5.24a release; two, changing the skin by accident is not easy to do; three, there haven't been any code changes in the UI part for 3.0.7 except for that target sdk change; and four, Android uses the target sdk setting on an apk to selectively enable compatibility behaviors, and when developers are forced to change that setting, as Google just did effective November 1st, this sometimes causes unexpected breakage. This kind of thing has actually happened to Free42 before, when another forced target sdk change made the main menu stop working.
Visit this user's website Find all posts by this user
Quote this message in a reply
11-08-2021, 09:24 AM (This post was last modified: 11-08-2021 09:29 AM by johanw.)
Post: #5
RE: Auto-rotation skins on Free42 v3.0.7
Strange. This has has never worked for me, but when I tested it with Free42 3.0.7 on Android 11 it worked.

What I did: set autorotate on, set Free42 orientation to auto. Select a protrait skin in portrait mode, select a landscape skin in landscape mode (in this case the type_nova_P/L_v2 from Thomas' site).

Result: autorotate switched bewteen the corect skins.

When I did not first select the landscape skin it showed the portrait skin, but distorted.
Find all posts by this user
Quote this message in a reply
11-08-2021, 10:31 AM
Post: #6
RE: Auto-rotation skins on Free42 v3.0.7
I haven't been able to reproduce the problem in the Android 11 and 12 emulators (API levels 30 and 31). Hmm...

I uploaded a 3.0.7 build with target sdk = 29 to https://thomasokken.com/free42/download/...oid-29.apk -- Bob (or anyone else experiencing the screen rotation issue), could you try installing this, and let me know what happens?
Visit this user's website Find all posts by this user
Quote this message in a reply
11-08-2021, 02:20 PM
Post: #7
RE: Auto-rotation skins on Free42 v3.0.7
(11-08-2021 10:31 AM)Thomas Okken Wrote:  I haven't been able to reproduce the problem in the Android 11 and 12 emulators (API levels 30 and 31). Hmm...

I uploaded a 3.0.7 build with target sdk = 29 to https://thomasokken.com/free42/download/...oid-29.apk -- Bob (or anyone else experiencing the screen rotation issue), could you try installing this, and let me know what happens?

Quick update - I compared my new phone (A12) with my old phone (A8) side-by-side and I now notice that when in the "Skin: Other" dialog, the *.layout files are not visible (in the file display area where one would pick a file), even though I've confirmed that these files are actually in the /Free42 folder.

I then copied the *.layout files to the /Downloads folder and then navigate there in the "Skin: Other" dialog and these files are also not visible there, where they should be as this folder is obviously available to the user. I have confirmed that Free42 is sensing the rotation and "knows" which mode it's in when opening the dialog.

So, it must have something to do with folder access, or permissions, etc.

Maybe this helps? I'd rather not side-load if it can be avoided, due to a troubled past doing so in very early Android days...

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
11-08-2021, 02:50 PM
Post: #8
RE: Auto-rotation skins on Free42 v3.0.7
The way the filesystem can be accessed has changed dramatically with API 30. Look for "Storage Access Framework" (SAF).
Visit this user's website Find all posts by this user
Quote this message in a reply
11-08-2021, 04:30 PM
Post: #9
RE: Auto-rotation skins on Free42 v3.0.7
Ah, right... the trouble with storage access started with Android 11, but there was a transitional option you could use in the app manifest, requestLegacyExternalStorage=true. But that only works for apps targeting api level 29 or less, so now that I'm forced to target 30 or higher, the work-around no longer works, and this issue needs to be dealt with.

I assume it is still possible to store skins under /data/data/<package_name>/files, since that's where the state files are as well?
Visit this user's website Find all posts by this user
Quote this message in a reply
11-08-2021, 05:37 PM
Post: #10
RE: Auto-rotation skins on Free42 v3.0.7
(11-08-2021 04:30 PM)Thomas Okken Wrote:  Ah, right... the trouble with storage access started with Android 11, but there was a transitional option you could use in the app manifest, requestLegacyExternalStorage=true. But that only works for apps targeting api level 29 or less, so now that I'm forced to target 30 or higher, the work-around no longer works, and this issue needs to be dealt with.

I assume it is still possible to store skins under /data/data/<package_name>/files, since that's where the state files are as well?

There is no 2nd data under /Android/data, unless it's hidden. I do see /Android/data/com.thomasokken.free42/files but that folder is empty.

The files I can access appear to be in /Free42, which looks like a top-level folder under the root, but I'm confident that's just some 'user' view of things.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
11-08-2021, 06:58 PM
Post: #11
RE: Auto-rotation skins on Free42 v3.0.7
There are two commonly used directories that Android apps should have access to even without being granted any special permissions: /data/data/<package_name>, which is in the main filesystem, and /sdcard/Android/data/<package_name>, in external storage. The former, or rather, /data/data/<package_name>/files, is where Free42 stores its state files, so if that /Free42 directory you can see in the file manager contains files named "state" and "print", and the *.f42 state files, it's the right one.

I should probably add a note to the documentation that that's the right place to store skins. I don't see any strong reason to jump through hoops to allow Free42 to access other corners of the filesystem, as long as users are able to store skins in the standard data directories without a lot of trouble. As long as it's documented! All this is a bit annoying for people who still remember when Android apps basically had the run of the entire filesystem. Big Grin

BTW, the built-in skin loader will load skins to /data/data/<package_name>/files, so as long as you're trying to use skins that are available for download from an HTTP server somewhere, that method of putting skins in the right place should always work.
Visit this user's website Find all posts by this user
Quote this message in a reply
11-08-2021, 07:04 PM (This post was last modified: 11-08-2021 07:09 PM by johanw.)
Post: #12
RE: Auto-rotation skins on Free42 v3.0.7
(11-08-2021 04:30 PM)Thomas Okken Wrote:  I assume it is still possible to store skins under /data/data/<package_name>/files, since that's where the state files are as well?
It should be. However, what is often far worse, SAF prevents you from working with absolute file paths and most of the File API. There is a way around that on Android 11+ (not 10), using the MANAGE_EXTERNAL_STORAGE permission, but apps using this who do not strictly need it (like file managers) are refused in Google Play.

It does work well however: I use it myself in an app that I don't intend to publish there anyway.
Find all posts by this user
Quote this message in a reply
11-08-2021, 07:07 PM (This post was last modified: 11-08-2021 07:10 PM by johanw.)
Post: #13
RE: Auto-rotation skins on Free42 v3.0.7
(11-08-2021 05:37 PM)rprosperi Wrote:  There is no 2nd data under /Android/data, unless it's hidden. I do see /Android/data/com.thomasokken.free42/files but that folder is empty.
You obviously have not rooted your device.

There can, in fact, be 3 such directories:

[root]/data/data/[package name]
[internal storage]Android/data/[package name]
[removable storage]/Android/data/[package name]

On a non-rooted device with Android 11 you won't be able to access the first 2. On Android 10 and below you are only blocked from accessing the first.
Find all posts by this user
Quote this message in a reply
11-08-2021, 09:56 PM
Post: #14
RE: Auto-rotation skins on Free42 v3.0.7
(11-08-2021 07:07 PM)johanw Wrote:  [root]/data/data/[package name]
[internal storage]Android/data/[package name]
[removable storage]/Android/data/[package name]

On a non-rooted device with Android 11 you won't be able to access the first 2. On Android 10 and below you are only blocked from accessing the first.

Yes, and the first directory is the one where the skin loader puts the files it downloads (to open the skin loader: Main Menu -> Select Skin -> Load...), and the third is the one that the file selection dialogs in Free42 go to when you press the Home button (next to the directory drop-down menu).
Visit this user's website Find all posts by this user
Quote this message in a reply
11-09-2021, 12:00 AM
Post: #15
RE: Auto-rotation skins on Free42 v3.0.7
Ok, got it working by using the built-in Main Menu -> Select Skin -> Load... process. I can't see the 'right' folder via File Manager (it's not rooted), so can't confirm where it is in A12, but the right files are now there and 3.0.7 is working properly, auto-rotating skins as needed.

I'm honestly confused as to why 3.0.6 worked before if nothing in this area changed, but the discussion and prod to "use it the way it's supposed to be used" advice has solved the problem.

Thanks to Thomas, johanw and SammysHP! Smile

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
11-09-2021, 12:25 AM (This post was last modified: 11-09-2021 12:33 AM by Thomas Okken.)
Post: #16
RE: Auto-rotation skins on Free42 v3.0.7
(11-09-2021 12:00 AM)rprosperi Wrote:  I'm honestly confused as to why 3.0.6 worked before if nothing in this area changed

The target sdk change from 29 to 30 must have stopped the requestLegacyExternalStorage=true parameter in the app manifest from working. That's documented behavior, but I had forgotten about that and didn't realize that side effect would happen. It does make sense that you'd see Free42 load the standard skin if your custom skin suddenly became inaccessible to the app. (Although it is a bug that it loads the built-in portrait skin when loading the skin fails while in landscape mode!)

Apparently, this doesn't have anything to do with the 2.5.24a fix, even though I implemented that because of a problem with the exact same symptoms. Now that I think about it, the issue that time may have been a Samsung quirk of some sort.
Visit this user's website Find all posts by this user
Quote this message in a reply
11-09-2021, 02:41 AM
Post: #17
RE: Auto-rotation skins on Free42 v3.0.7
(11-09-2021 12:25 AM)Thomas Okken Wrote:  
(11-09-2021 12:00 AM)rprosperi Wrote:  I'm honestly confused as to why 3.0.6 worked before if nothing in this area changed

The target sdk change from 29 to 30 must have stopped the requestLegacyExternalStorage=true parameter in the app manifest from working. That's documented behavior, but I had forgotten about that and didn't realize that side effect would happen. It does make sense that you'd see Free42 load the standard skin if your custom skin suddenly became inaccessible to the app. (Although it is a bug that it loads the built-in portrait skin when loading the skin fails while in landscape mode!)

Apparently, this doesn't have anything to do with the 2.5.24a fix, even though I implemented that because of a problem with the exact same symptoms. Now that I think about it, the issue that time may have been a Samsung quirk of some sort.

Thanks again. I wish I had noticed and reported earlier that 3.0.7 was loading the default skin (and not the custom one that worked the day before) as that may have been an earlier clue as to what was happening.

Also, discussion of the various folders led me to wonder where .raw files (and others) are exported to by default, since the prior folder you mentioned isn't accessible. When you Export, it now defaults to
/storage/emulated/0/Android/data/com.thomasokken.free42/files, which apparently is the new "Home".

Thanks

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
11-09-2021, 05:36 AM
Post: #18
RE: Auto-rotation skins on Free42 v3.0.7
(11-09-2021 02:41 AM)rprosperi Wrote:  Also, discussion of the various folders led me to wonder where .raw files (and others) are exported to by default, since the prior folder you mentioned isn't accessible. When you Export, it now defaults to
/storage/emulated/0/Android/data/com.thomasokken.free42/files, which apparently is the new "Home".

Please note that this directory is deleted automatically when you uninstall the app! It can't be used for backups.
Visit this user's website Find all posts by this user
Quote this message in a reply
11-09-2021, 08:44 AM
Post: #19
RE: Auto-rotation skins on Free42 v3.0.7
(11-09-2021 05:36 AM)SammysHP Wrote:  
(11-09-2021 02:41 AM)rprosperi Wrote:  Also, discussion of the various folders led me to wonder where .raw files (and others) are exported to by default, since the prior folder you mentioned isn't accessible. When you Export, it now defaults to
/storage/emulated/0/Android/data/com.thomasokken.free42/files, which apparently is the new "Home".

Please note that this directory is deleted automatically when you uninstall the app! It can't be used for backups.

Can custom skins be stored in the same places as state files and exported programs? (Preferably somewhere that doesn't get deleted when the app is uninstalled.)

— Ian Abbott
Find all posts by this user
Quote this message in a reply
11-09-2021, 01:22 PM
Post: #20
RE: Auto-rotation skins on Free42 v3.0.7
(11-09-2021 05:36 AM)SammysHP Wrote:  
(11-09-2021 02:41 AM)rprosperi Wrote:  Also, discussion of the various folders led me to wonder where .raw files (and others) are exported to by default, since the prior folder you mentioned isn't accessible. When you Export, it now defaults to
/storage/emulated/0/Android/data/com.thomasokken.free42/files, which apparently is the new "Home".

Please note that this directory is deleted automatically when you uninstall the app! It can't be used for backups.

Not an issue for me, Free42 is never uninstalled... Wink

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)