Windows Subsystem for Android (Fine-tuning) Notes

There are many forks of WSA. For this blog post, I’ll assume this popular variant that’s the most updated

https://github.com/MustardChef/WSABuilds

The common use case starts the program with Run.bat which is just a wrapper for the powershell script Install.ps1.

Unlike conventional designs, there isn’t really a dedicated installer nor the program runs standalone. The launcher starts the WSA if it’s already ‘installed’ and ‘install’ it if it wasn’t. If a WSA was launched, it’d be closed and restarted (yes, it will interrupt the apps opened). So you basically trust the Install.ps1 script to do the right thing managing everything needed to get WSA up and running.

The Hyper-V virtual machine is really in %LOCALAPPDATA%\Packages\MicrosoftCorporationII.WindowsSubsystemForAndroid_8wekyb3d8bbwe\LocalCache\ and everything is in userdata.*.vhdx so there’s only one file to backup and restore.


Direct Android App icons on Windows Start Menu

The Windows start menu icons created by installing apps on WSA are launching the stub (App execution alias) to wsaclient.exe located in %localappdata%\Microsoft\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForAndroid_8wekyb3d8bbwe\

Specifically the syntax is wsaclient /launch wsa://{android application ID}.

Annoying windows/apps opened every time WSA (Run.bat) is started

It’d make sense to say if WSA displays nothing after successfully starting in the background, beginners won’t know where to start. It typically starts these

  • native Windows WSA settings app (Microsoft App, not Android App)
  • Google Play store (Android app)
  • Android Settings app (Android app)

If you installed the WSA with KernelSU, a webpage with the docs about KernelSU pops up every single time you start the WSA, which is ridiculous.

Turns out it’s these lines (the Finish block) in Install.ps1‘s design decisions. I simply commented these nusiances out now that I know where and how to launch them when needed

Creating icons to Android apps

Google Play app is usually created by WSA, but not the Android-Settings Android app and WSA-Settings Windows App. Disabling these above means I’ll have to make the icons to them since they are the starting points to managing the emulated Android system.

If you forget Windows Apps are different from Windows programs like I do, you should right click on the WSA-Settings Windows App and make a shortcut icon out of it to be used on the Windows Desktop or Start Menu.

Android-Settings Android app icon can be created from this command:

%LocalAppData%\Microsoft\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForAndroid_8wekyb3d8bbwe\WsaClient.exe /launch wsa://com.android.settings

WSA Sideloader

Since WSA doesn’t come with many apps. If you don’t want to login to your Google account to use Play store, you can download the APKs (say Apkpure) and sideload it with WSA Sideloader. It’s avaiable

As Windows App: https://apps.microsoft.com/detail/9nmfsjb25qjr?hl=en-US&gl=US

As Windows Installer: https://github.com/infinitepower18/WSA-Sideloader/releases

You will have to turn on Developer Mode in the WSA-Settings Windows App first

and allow ADB debugging (since this is how sideloading works) when prompted.

Loading

Using 3rd party packages for Powershell Install-Module

It make sense by default if you download 3rd party powershell packages like kbupdate, it should not run right away until you’ve done your due dilligence. You’ll get a warning like this during installation:

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?

But when I try to use it, I get an error message:

Get-KbUpdate : The 'Get-KbUpdate' command was found in the module 'kbupdate', but the module could not be loaded. For more information, run 'Import-Module kbupdate'.

Import-Module gives a cryptic message like this:

Import-Module : Errors occurred while loading the format data file:
D:\Administrator\Documents\WindowsPowerShell\Modules\PSFramework\1.6.214\xml\PSFramework.Format.ps1xml, ,
D:\Administrator\Documents\WindowsPowerShell\Modules\PSFramework\1.6.214\xml\PSFramework.Format.ps1xml: The file was
skipped because of the following validation exception: File
D:\Administrator\Documents\WindowsPowerShell\Modules\PSFramework\1.6.214\xml\PSFramework.Format.ps1xml cannot be
loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170..

Turns out either the package needs to be marked safe or just stop checking altogether:

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

Loading

Descriptive names for logic operations on a pair (x, y)

It reads as “The output is TRUE only when the reduction (x,y)\rightarrow z meets the description of the operations below”

0 inputs:

  • Constant: gives the same hard-coded result regardless of inputs

1 input:

  • Transfer: Hardwired to one of the inputs
  • Complement: NOT

2 inputs (symmetric):

  • Comparison: different (XOR), identical (NXOR or equivalence)
  • Arithmetic: AND, OR and its complements NAND, NOR

2 inputs (asymmetric):

  • Inhibition: ONLY 1 followed by 0 is an inhibition. It’s a WHITE-list: anything else is not an inhibition (starting with 0 doesn’t inhibit)
  • Implication: ANYTHING GOES as long as 1 is be followed by 1. It’s a BLACK-list: anything else qualifies as an implication (starting with 0 does not break the implication)

Implication is the complement of Inhibition, as the only case that breaks an implication is inhibition.

This ‘operator’ instead of truth-table view is more often used in electrical engineering than in computer science. There are many names for the same thing, but I put in some thought to find the intuitive words to make it easy to understand and remember

WARNING: Those there are tempting faint similarities between logic and set theory, there’s no direct tight duality between the two. Whitelist/Blacklist in inhibition/implication do not make sense with set-diff/subset as we are talking about a one-shot relationship here in logic, while set theory talks about the relationship between elements picked after it is quantified by “for all” vs “there is”. i.e. Truth table do not mix with sets

Loading

Experimental Worldview Framework Desires x Problems x Mechanisms x Device

I am experimenting with a framework to summarize how I observe things that are going on around me, analyzing situations and coming up with solution approaches. Currently this is what I have:

{Desires} × {Problems} × {Mechanisms} × {Devices}

Everything I see can be analyzed as a result of the cross-product (a fancy word for combinations of contents) between these 4 broad categories. To make it easier to remember, they can be factored into 2 major categories:

{Questions} × {Answers}

Where obviously

  • [Questions] Desires (objectives) lead to problems (practicalities) to solve
  • [Answers] Mechanisms (abstract concepts) hosted by a device (implementation) to address questions

Why the cross product? By tabulating everything I learned or know in 4 columns (categories), I can always select a few of them (subset) and notice a lot of recurring themes (questions) and common solution approaches (answers). This corresponds to an old saying “there’s nothing new under the sun”.

Then what about innovations? Are we constantly creating something new? Yes, we still are, but if you look closely, there are very few ideas that are fundamentally new that cannot be synthesized by combining the old ones (sometimes recursively).

Let me use the framework itself as an example on how to apply this framework (yes, it’s recursive):

  • Desires: predict and understand many phenomenon
  • Problems: mental capacity is limited
  • Mechanisms: this framework (breaking observations into 4 categories)
  • Devices: tabulation (cross-products, order reduction)

Feedback as an example:

  • Desires: have good outcomes (or meet set objectives)
  • Problems: not there yet
  • Mechanism: take advantage of past data for future outputs (through correction)
  • Devices: feedback path (e.g. regulator or control systems.)

Feedforward as an example that shares a lot of properties as feedback:

  • Desires: have good outcomes (or meet set objectives)
  • Problems: not there yet
  • Mechanism: take advantage of past data for future outputs (through prediction)
  • Devices: predictor (e.g. algorithm or formula)

Abstraction as an example:

  • Desires: understand complexities (e.g. large code base)
  • Problems: limited mental capacity (programmers are humans after all)
  • Mechanism: abstraction (generic view grouping similar ideas together)
  • Devices: black-boxes (e.g. functions, classes)

Trade as an example:

  • Desires: improves utility (utility = happiness in economics lingo)
  • Problems: one cannot do everything on its own (limited capacity)
  • Mechanism: exchange competitive advantages
  • Devices: market (goods and services)

Business as an example:

  • Desires: improves utility (through trade)
  • Problems: need to offer something for trade
  • Mechanism: create value
  • Devices: operations

Money (and Markets) as two examples:

  • Desires: facilitate trade
  • Problems: difficult valuation and transfer through barter, decentralized
  • Mechanism: a common medium
  • Devices: money (currencies), markets (platform for trade)

Law as an example:

  • Desires: make the pie bigger by working cooperatively
  • Problems: every individual tries to maximize their own interest but mentally too limited to consider working together to grow the pie (pareto efficient solutions)
  • Mechanism: set rules and boundaries (I personally think it’s a sloppy patch fix that is way overused and way abused) and get everybody to buy it
  • Devices: law and enforcement

Religion as an example

  • Desires: coexist peacefully
  • Problems: irreconcilable differences
  • Mechanism: blind unverified trust (faith)
  • Devices: Deities and religion

Just with the examples above, many desires can be consolidated along the lines of making ourselves better off, and many problems can be consolidated along the lines of we’re too stupid. Of course it’s not everything, but it shows the power of tabulating into 4 categories and consolidating the parts into few unique themes.

I chose to abstract the framework into 4 broad categories instead of 2 because two are too simplified to be useful: since the framework is a way to organize (compactify) observations into manageable number of unique items, there will be too many distinct entries if I have only two categories. Nonetheless, I would refrain from having more than 7 categories because most humans cannot reason effectively with that many levels of nested for-loops (that’s what cross products boils down to).

I also separated desires from problems because I realized that way too often people (manager, clients, customers, government, etc.) ask the wrong question (because they narrowed it to the wrong problem) that leads to a lot of wasted work and frequent direction changes. People are too often asked to solve hard problems that turns out to be the wrong ones for fulfilling the motivating desires. Very few learn to trace it back to the source (desires) and find the correct problem to address, which often have easy solutions that’s more valuable to the requester than what was originally asked. This often leads to unhappy outcomes for everybody that’s avoidable. An emphasis on desires is one of my frequently used approaches to prevent these kind of mishaps.

Loading

Title of this blog site

Initially I started with “TMI: Too Much Information” as the title of this blog, given that my plan was to put fragments of technical information or insights I came across that might be useful for solving problems. That means the blog posts contain more than what you want to know, unless you are looking to solve a specific problem with the help of the post or you are just outright nerdy.

But soon I realized I have some non-technical stuff like gags, music, and the technical stuff covers more than just electronic measurement instruments, so I need a title that’s less common and more catchy.

Today, I came across a reddit post, which user “llllIlllIllIlIRogue Sysadmin “says:

If you don’t they’ll just hear jargon and glaze over completely and not even try to follow you. If you draw a pretty layout of everything, though, they’ll make some token effort to follow along.

They’ll still get lost but now you’re not just a nerd rambling… you’re a rambling nerd with a plan.

Very catchy! Also, I liked the original comment because it covers:

  • Passion for geeky topics
  • It’s important to communicate well so that people will bother to follow what we have to say.

I did a google search with quotes “rambling nerd with a plan” and only one entry: the original post, showed up, so it’s not a commonly used phrase. I’ll take it 🙂

Loading