▲ 6 r/tasker

[Project Share] Monitor when a display is added or removed and when its properties change

Click to download

The code in this project were written with the assistance of AI tools. The code can be checked here. Tested in HyperOS3 (Android 16).

What does this project do ?

  1. Monitor display events by using DisplayListener class. https://developer.android.com/reference/android/hardware/display/DisplayManager.DisplayListener
  2. Surface the events via Tasker command system.
  3. The current display information can be viewed via global variable %Display.

May require the latest version of beta (or Direct purchase) since Joao has condition for Command Event. It's not actually necessary but make things easier to define the profile.

It's still a little bit difficult to use though since I use full class path. But can be shortened with using *DisplayListener.onDisplayAdded* or *onDisplayAdded*

I will try to make it easier later if Joao were to introduce his concept of custom state, event and action mentioned here.

reddit.com
u/aasswwddd — 11 days ago

Scroll to Text or View Id without gesture

Click to download macro

This macro requires Text-Based UI Automation with Java macro to work 

This macro allows us to scroll to certain text or view id while using certain element as anchor point.

Scrolling from Triggers to Local Variables

Why another macro? 

I'm too lazy to dissect the code myself, it involves various other scripts after all. If you have interest to make it to work as is, I'll explain the code down below.

How it works

This works by utilizing AccessibilityNodeInfo.ACTION_SCROLL_FORWARD and AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD on an element (node) that can be scrolled.

Most screen usually has one scrollable node, however there can be more than one as well. Example on Macrodroid Template, It has multiple scrollable nodes

Scrollable nodes usually have view ids. Though rarely does on modern app built with jetpack compose.

Hence the anchor is needed. To determine which one we want to scroll.

The best part about using both of them is that we don't need to use gesture at all.  There is no need to define the direction or how far we should scroll. So it's far more reliable and easier to work with.

It also means that it's working space is limited to regular apps that uses regular android view framework. It won't work on.

  1. Non standard App UI, e.g Games. Since they are loaded with game engine.
  2. Images or tall images. This would require OCR.

How to make it standalone

For those who wants to make it standalone. This is more or else the logic I use in my script.

  1. Find the anchor node first.
    1. Crawl the entire node by using AccessibilityNodeInfo.findAccessibilityNodeInfosByText or AccessibilityNodeInfo.findAccessibilityNodeInfosByText
    2. Find the scroll node by checking the first scrollable parents.
    3. Save the first scrollable parent as anchor node.
  2. Find the nodes target using the same method as #1.
    1. Instead of the entire root, we just have to use the method in #1 against the anchor node.
    2. There might be instance where both APIs couldn't find relevant nodes. So you have to crawl the anchor node manually.
  3. If not found then perform ACTION_SCROLL_FORWARD or ACTION_SCROLL_BACKWARD on the anchor node. Repeat 2.
  4. If found. Refresh the node and show them on screen with AccessibilityNodeInfo.AccessibilityAction.ACTION_SHOW_ON_SCREEN
    1. Needed just in case the node is found but not visible on screen. Happens often in a browser.

The action will also return false if it's not scrollable anymore. It's usually happens on App that needs to reload contents again like Reddit.

Reference to the codes

  1. https://github.com/mqwec43as/AccessibilityAction/blob/main/code/actions/scrollFromNodeTo.bsh
  2. https://github.com/mqwec43as/AccessibilityAction/blob/main/readme/actions/scrollFromNodeTo.md
reddit.com
u/aasswwddd — 15 days ago
▲ 9 r/tasker

[Project Share] Overlay to monitor app's memory and thread

Click to download via taskernet

Requires v6.7.6 and privileged shell (root, shizuku or adb wifi)

The code in this project is written with the help of AI tools.

How this work

  1. Get pid from pidof package_name
  2. Check the process details from cat /proc/pid/status
  3. Show thread count and memory in overlay and update repeatedly.
  4. Long press the icon to remove the overlay.

Inspired by TaskManager.

u/aasswwddd — 1 month ago
▲ 5 r/tasker

Do you think taskernet need to have AI and Java code tags?

I was wondering for a while about this. I had filed a request back then to have taskernet to automatically show a tag if a taskernet has Java code & Java function action.

https://tasker.helprace.com/i2001-add-java-tag-for-public-taskernet

However it was declined.

Most of my shares here recently were all Java code and written with the help of AI. I was wondering about AI flag as well.

What do you think?

Edit.

My concern is that as of now the user doesn't have a way to make informed decisions easily.

Some may care enough about how a taskernet is made due to various reasons.

  1. Ethical & Environmental reasons. You know like how people prefer to buy organic labeled foods? Similar to that, some may not want to run a project generated with AI tools.
  2. Trust. Some user may not prefer to run a java code from someone they don't trust.
u/aasswwddd — 1 month ago
▲ 3 r/tasker

[Help] What approach should I use for creating custom events and states that are easy to remember?

Most of my custom contexts are not exactly easy to and reuse. Realized this after adjusting my gesture project that fires send command event.

And it spiraled down after I take a look at my global variables section. I don't recognize most of them lol.

 

What approach should I exactly use for this?

 

Context

I remembered several other occasions like these happened several years ago lol, so I have a few stories for these. Here's a couple of them.

 

Custom context with variables, e.g location.

I set this with the usual old %Home, %Work, %ParentHome, %Outside etc based on multiple contexts like location, wifi, bluetooth.

 

Turned out I had those and I just don't remember them at all the moment I come back to Tasker later. Mostly I have to check the project "Custom Location" and check the variable tabs.

 

Happened with several others , like USB clients, data plan usage, lightings states etc. I couldn't make sense which one are used for events, or just shared variables.

 

Screen event with send command and variables

This what started the rabbit hole.

 

I had an old project that does certain things I perform down or up gesture on current screen. Like which foreground app, visible text or view ids are currently available.

 

The old one with Everywhere Launcher (gesture app) used to fire a task that sends global variables.

 

After I rewrote it to Java code, I changed the events to command system. And for current screen information to variables.

 

It was a PITA to adapt, since I change the variables so I have to adjust again. I still left some with everywhere launcher even today.

 

Then I tried changing it recently since I updated the project, it was another PITA. Even though I just added a prefix for the command. From "Handle name=:=gesture" to "Every=:=".

 

All of these seems like a bad practice so I'd like to gather some feedbacks. I have a few that I want to add recently. Like tethered clients or when the screen size changes.

 

Thankyou!

reddit.com
u/aasswwddd — 2 months ago
▲ 9 r/tasker

[How to] Curation of java code tips on github

I uploaded all my Java tips posts I made over the past year to a github repo. Since my profile is hidden, this would make easier to reference and access.

Here's the link.

https://github.com/mqwec43as/Beanshell-Guide

I included my custom instructions for tasker's java code and beanshell interpreter.

The differences.

  1. Example of beanshell built-in commands. like cd(), importCommands(), source() etc.
  2. Remove SceneV2 related methods since I don't use SceneV2 in Java code.
  3. Allow to generate methods or scripted object (bsh.This).
  4. Has section to create a proxy interface for abstract/concrete class with scripted object.
  5. Others like comments format etc.

#4 is just a wrapper for tasker.implementClass. It helps me declare those classes quite similar like how it is in Java.

e.g I can declare ISoftApCallback for detecting hotspot events like this.

This ISoftApCallbackImpl() {

  public void onStateChanged(SoftApState state) {}

  public void onConnectedClientsOrInfoChanged(Map infos, Map clients, boolean isBridged, boolean isRegistration) {}

  public void onCapabilityChanged(SoftApCapability capability) {}

  public void onBlockedClientConnecting(WifiClient client, int blockedReason) {}

  public void onClientsDisconnected(SoftApInfo info, List clients) {}

  return this;
}

// MyISoftApCallback is the wrapper.
ISoftApCallback callback = MyISoftApCallback(ISoftApCallbackImpl());
u/aasswwddd — 2 months ago
▲ 7 r/tasker

[Project Share] Sample to control hotspot and monitor its events e.g connected clients with Shizuku and Hidden Api

Requirement.

  1. Tasker v6.6, v6.7 is recommended because the java thread leak presents in v6.6 is already fixed.
  2. Shizuku, to access system service.
  3. Disable hidden API restriction.
    1. If you have ADB Wifi granted for Tasker, the restriction may already be disabled by Tasker.
    2. Otherwise run the command here. https://developer.android.com/guide/app-compatibility/restrictions-non-sdk-interfaces#how_can_i_enable_access_to_non-sdk_interfaces

What does this sample project do

  1. Monitor hotspot events, e.g hotspot connected clients.
  2. Block and unblock client by its mac address.
  3. Set max client.
  4. Toggling hotspot.
  5. Set password.
  6. Limit to approved mac addresses.
  7. Store the manager to java global variable tetherManager

How to use

Run the initiator task to start tetherManager and monitor the events.

Download

This is just a sample generated with the assistance of AI tools, which needs to be tweaked later! May causes conflict with default Hotspot! USE IT WITH YOUR OWN RISK!

  1. Taskernet
  2. Direct file

How does it work

The project utilizes android.net.ITetheringConnector and android.net.wifi.IWifiManager services retrieved from Shizuku to control the hotspot.

Events

The project listens to:

  1. ITetheringEventCallback registered with ITetheringConnector.registerTetheringEventCallback.
    1. Check This TetheringEventCallbackImpl(){}.
  2. ISoftApCallback.Stub registered with IWifiManager.registerSoftApCallback.
    1. Check This ISoftApCallbackImpl(){}.

The example fires tasker.sendCommand which broadcast the arguments as JSON string. Thanks to that, several info like mac address may not be human readable. #1 seems to cover all tethers, while SoftAp is limited to Wifi-Tether.

Editing configuration

The project modifies android.net.wifi.SoftApConfiguration or android.net.wifi.SoftApConfiguration.Builder The configuration is retrieved from IWifiManager.getSoftApConfiguration()

Then set SoftApConfiguration with IWifiManager.setSoftApConfiguration(SoftApConfiguration, shellPackageName)

We can use the builder to set ssid, password etc as well.

SoftApConfiguration.Builder builder = tetherManager.getSoftApBuilder();
builder.setSsid("xxx");
builder.setPassphrase("xxx", SoftApConfiguration.SECURITY_TYPE_WPA2_PSK);
SoftApConfiguration newConfig = builder.build();

tetherManager.setSoftApConfig(newConfig);

// Toggle Hotspot Wifi
tetherManager.stopWifiTethering();
Thread.sleep(1000);
tetherManager.startWifiTethering();

Demo

In this demo, I started the hotspot after runningtetherManager.allowByUser() and then tried connecting to the hotspot from my other phone. The connection got blocked and an event was triggered.

Notice that the address changed several times due to default private setting, yet it still got blocked.

Note

Since this is done by using hidden APIs, it's not really documented. We need to read the source code or looking at project like delta. Even with AI, it can be hard to do with referencing the right APIs.

The behaviour may vary for each OS and may cause conflict with the OS hotspot setting.

So far I only tested the code with HyperOS3 (Android 16) and CrDroid (Android 15).

During my test with HyperOS3, there were times when it crashes the hotspot setting. Fixed midways if I were to re-toggle back the hotspot manually.

Nothing with CrDroid so far.

This should be a good starting point for those who wants to control and monitor the hotspot :) Too bad that we have to use Shizuku and disabling hidden api restriction for this.

The codes are not perfect and are meant to be edited later.

reddit.com
u/aasswwddd — 3 months ago
▲ 14 r/tasker

[Idea] Custom recents with previews by using Shizuku and Hidden APIs

Continuation of my task share before here.

The previews are retrieved with IActivityTaskManager.getTaskSnapshot

Tested with some stuff from my project here. I was planning to create a custom recent to replace HyperOS's default one.

Just in case anyone wants the codes. this is for the single preview and this is for the horizontal scroll.

Both still uses some part of my other project so you have to edit them first. It's also pretty laggy and delayed especially for the scrolling one.

Since this uses hidden apis, we have to lift the restrictions first by running the adb command in the link below. Tasker does this automatically if we already grant it ADB Wifi access.

https://developer.android.com/guide/app-compatibility/restrictions-non-sdk-interfaces#how_can_i_enable_access_to_non-sdk_interfaces

u/aasswwddd — 3 months ago
▲ 19 r/tasker

[Task Share] Sliding Recents with Shizuku & Java code

How this work

The code lists the recent apps with IActivityManager.getRecentTasks. Then bring them to front again with IActivityManager.moveTaskToFront.

import android.app.ActivityManager;
import android.app.IActivityManager;
import android.content.Context;
import android.app.ActivityManager.RecentTaskInfo;

// Getting IActivityManager
IBinder binder = tasker.getShizukuService(Context.ACTIVITY_SERVICE);
IActivityManager am = IActivityManager.Stub.asInterface(binder);

// List the recents
List tasks = am.getRecentTasks(5, ActivityManager.RECENT_IGNORE_UNAVAILABLE, 0).getList();
RecentTaskInfo task = tasks.get(1); // 0 is the foreground task

// Bring up the task to front
am.moveTaskToFront(null, "com.android.shell", task.taskId, 0, null);

// or this is also possible
am.startActivityFromRecents(task.taskId, null);

However we do it when we slide on an overlay instead.

We need two overlays. One to intercept the sliding by using View.onTouchListener and another one to show the recent apps icon.

Example Generated with AI.

Run https://gist.githubusercontent.com/mqwec43as/871e53e6e5ebf199f26ebd310077c63f/raw/QuickRecentHandle.java via Java Code. Run again to remove. if it works, copy the code in the link then adjust yourself.

source(new URL("https://gist.githubusercontent.com/mqwec43as/871e53e6e5ebf199f26ebd310077c63f/raw/QuickRecentHandle.java"));

Taskernet

u/aasswwddd — 3 months ago

How to lock pinned tab stack?

What I mean by locking is preventing me to change sites and the amount of tabs. Say I have two tabs, google and Youtube. Then I stack both, pin the stack and lock it. I want to prevent Vivaldi to change the url domain and keep the amount tabs to two.

I already disable the close button, so this kind of preventing me to close existing tabs. However what bothers me the most about this is that I can still add a new tab in the pinned tabs.

I have to unpin, close them and pin the stack again. Which is counter productive. And I still want to keep the behaviour to open a new tab in another unpinned tab stack like usually have ( open in the related tab stack ).

I tried the lock second tab level, the lock icon on the far right. I'm not sure what it does but this button is definitely not what I'm looking for, since I can still add new tab.

Thankyou!

Version: 8.1.4087.53 (Official Build) (64-bit) Windows 11

reddit.com
u/aasswwddd — 3 months ago
▲ 17 r/tasker

[Project Share] EveryGesture, draw any gesture and do something.

Click to download via Taskernet

This project was developed with the assistance of generative AI tools and I don't have any android dev experience.

This project will ask to download files from this repo. Then executes gesture.java via Initiate EveryGesture variable task.

Reminder that this will delete only used folder inside the target folder.

Source code available in this repo. https://github.com/mqwec43as/EveryGesture

Requires the latest tasker beta v6.7.6

 

Features

  1. Do action based on performed gesture.
  2. JSON configuration file.
  3. UI to draw gesture and configure action.
  4. Control via Java code.

 

Demo

Add actions to trigger Circle to search (requires hidden api) and assistant.

How to use

All the tutorials & demos are available in the repo.

  1. How to use the project, steps with videos to show how to use the project.
  2. Helper mode, allow us to configure the command event directly.

Or can be accessed via the activity itself.

  1. Launch Open EveryGesture Main Activity task.
  2. Click tripple dot menu on the top right.
  3. Click How to use.

 

 

Changelog

 v2.0

  1. Helper mode.
  2. Access repo and how to directly via webview.
  3. Toggle wifi and hotspot.
  4. Screen Event action to read screen context with accessibility service.
  5. Improve loading gesture cards.
  6. Finish activities properly (requires v6.7.6).

v1.0

  1. Do action based on performed gesture.
  2. JSON configuration file.
  3. UI to draw gesture and configure action.
  4. Control via Java code.

 

Notes

The UI for the properties configuration is not WYSIWYG . We have to save first to see the change.

If there are stuff that doesn't fit your likings, e.g UI/UX, trigger behaviour, etc, feel free to edit the project however you like!

For bug/crash, you could report it here. https://github.com/mqwec43as/EveryGesture/issues

 

! Memory Leak !

I notice sometimes I have a higher ram usage up to 100mb (from 350mb idle to 450mb) even after the activites are not foreground. Usually I always kill Tasker after done configuring the handle.

It's probably because the activities are not finished properly since I only monitor the decor view.

Update:

This is fixed by monitoring the activity and clearing when onPaused is triggered.

Joao added a way to monitor the activity lifecycle in the latest beta here. This shouldn't be a problem anymore.

reddit.com
u/aasswwddd — 3 months ago

[Feature Request] feat: Allow 3rd party app to trigger patch process via intent

This request will facilitate anyone who wants to patch via morhpe with much control from other apps such as Tasker, Macrodroid, or vFlow (FOSS) locally.

Examples.

  1. Patch when connected to home wifi at 21.00
  2. When patch is done, share to other devices and install automatically.
  3. Trigger patching remotely when device is not within reach.

While morphe-cli exist, it's much simpler to use those apps.

  1. They have visual editor.
  2. Easily shareable, anyone can share their setup to their community.

I'm aware of this request #227 but the proposal is pretty limited compared to what those apps capable to do.

More details in the link.

github.com
u/aasswwddd — 3 months ago
▲ 22 r/tasker

r/tasker now supports images and videos, Show your scene or any interface you make with Tasker!

As title suggested, show the community the scene you make with Tasker. Can be anything, old scene, widget, scene V2 or even Java code!

Let us know the context behind them too!

I start first myself.

Here's one project that I have been working on recently. A gesture project with Java, the UI lemme configure the configuration required. Video in the comments. since Joao hasn't activated embed videos yet in the body post. He confirmed he'd do so sooner here.

Gesture sheet

Context

I created this since Poco (Xiaomi) won't let its user use native gesture if 3rd party launcher is used. The app I use to replace it has some mildly infuriating bugs so I'd like to have one with Tasker instead.

At first this was just a text based one with configuration file. As I added more logic and gestures, it became harder to manage them. That was when I realized I need a front end for this. It's still WIP and honestly a lot more harder then configuring the core engine.

reddit.com
u/aasswwddd — 3 months ago

Recognize Text via OCR and return their location as well

MacroDroid Template

Utilize ML kit library available in Macrodroid via Java code. Please use the action block and configure the input variables. Return array of dictionaries.

Java Code User

For anyone who wants to use the Java code alone, it's available here.

https://gist.githubusercontent.com/mqwec43as/a44859d7df11aab102b8219eb089915e/raw/OCR.bsh

The methods in library are obfuscated, so I have to normalize them first. And I couldn't tell which one returns the score, lines etc so this doesn't have that.

https://developers.google.com/ml-kit/vision/text-recognition/v2

Example code

addClassPath("Directory where the script is stored");
importCommands(".");

ocr = OCR();
ocr.setLanguage("jp");
ocr.recognize("/storage/emulated/0/DCIM/jp.png");
List result = ocr.toList();

// Accessing the first boundingbox
Rect box = result.get(0).boundingBox;
reddit.com
u/aasswwddd — 4 months ago
▲ 14 r/tasker

[TIPS] Use Java code to run shell command by prioritizing elevated privileges. Root > Shizuku > ADBWifi > Default

The latest beta introduce methods to run shell command with root, shizuku, adbwifi and default one.

Now with this we can create one function for all run shell action!

import com.joaomgcd.taskerm.shell.CommandResult;
import com.joaomgcd.taskerm.action.java.JavacommandException;

public CommandResult runShell(String command, int timeout) {
	int NONE = 0;
	int ROOT = 1;
	int SHIZUKU = 2;
	int ADBW = 3;
	boolean hasRoot = tasker.isRootAvailable();
	boolean hasShizuku = tasker.isShizukuAvailable();
	boolean hasAdbWifi = tasker.isAdbWifiAvailable();
	int[] order = { ROOT, SHIZUKU, ADBW, NONE };

	for (int method: order) {

		if (method == NONE) {
			return tasker.runShell(command, timeout);
		}

		else if (method == ROOT && hasRoot) {
			return tasker.runShellRoot(command, timeout);
		}

		else if (method == SHIZUKU && hasShizuku) {
			return tasker.runShellShizuku(command, timeout);
		}

		else if (method == ADBW && hasAdbWifi) {
			return tasker.runShellAdbWifi(command, timeout);
		}
	}
}

public CommandResult runShell(String command) {
	return runShell(command, 30);
}

To make this easier, you can store the script into global variable or create a task. Or store this to a file even with this approach.

https://www.reddit.com/r/tasker/comments/1r49vbf/how_to_store_java_code_as_a_file_and_use_them_in/

Implementation examples

#1 We can shorten the name to shell() and make it output JSON instead.

Copy this and run via Java code action to import.

source(new URL("https://gist.githubusercontent.com/mqwec43as/b6c911c0546b7830e59b93e4ace9beb2/raw/shell%2520script.txt"));

// Edit this to store to global variable you like
tasker.setVariable("Shell", script);

The link store the script variable and then will be stored to %Shell

Then we can execute it like this.

%Shell

// output to %shell
shell("echo 'hello'", 10);

// output to %custom_var
shell("custom_var", "echo 'hello'", 10);

This will output %shell local variable and the data can be accessed with %shell.exitCode, %shell.output, and %shell.error

#2 We can integrate this with other Java code project seamlessly.

I have gesture project, and with this I can kill foreground app with am force-stop packageName directly after I draw a circle. No additional task or Shizuku is needed!

Demo video https://files.catbox.moe/wyp9ru.mp4

reddit.com
u/aasswwddd — 4 months ago

Text-Based UI Automation With Java (Beta)

Template Link

Requires 5.65.2

Source code https://github.com/mqwec43as/AccessibilityAction The codes in this project were generated with the assistance of AI Tools.

This macro lets us declares UI automation as text, as oppose to using action instead. Similar to AutoHotkey (Windows) or AutoInput Action V2.

All the syntax and functions can be read here. (Supported: main, actions, and gestures) https://github.com/mqwec43as/AccessibilityAction/blob/main/readme/Documentation.md

Demo video, add variable set action when displayed on virtual display. https://i.imgur.com/g1jXOnJ.mp4

Total downloaded size is around 180kb (600kb unzipped) and stored on chosen folder on internal storage.

How it works

The macro sets a global java variable called a11Y and exposes every method through set() method.

You can use it in any Java code action and all the methods will be available.

a11Y = globals.get("a11Y");
a11Y.set();

// or
globals.get("a11Y").set();

openApp("Youtube");
click("Subscription");
click("Today");

Read more about the a11Y here.

https://github.com/mqwec43as/AccessibilityAction/blob/main/readme/What%20is%20a11Y.md#a11y

What's ported

  • Text-Based UI Automation.
  • Debug highligher.

What's ported

  • Assist features and other UIs. Unable to use com.google.material components due to missing compatible theme (Theme.Material3) with the library.
  • Shizuku gestures. Unable to use Shizuku in Java code.
  • Callback for gestures (tap, swipe) and takeScreenshot. Unable to use related abstract class.
  • Event declaration. Unable to intercept events in Java code.

Notes

Finally I can port my tasker project here!

I left the remaining codes there for now just so I can pick them up later, if one day Macrodroid supports Material You or using abstract classes.

Also if you see context and tasker, those are wrapper objects to match tasker syntax set by lib/macrodroidHelper.bsh. Just so I don't have much to change later.

Feel free to fork, edit, reuse or do anything about this project.

Mostly the core syntax is the same as Tasker, so you can definitely lurk on my previous posts in r/tasker to see relevant updates & discussion.

My profile is private, Click this reddit search url to find them.

Lemme know if there is any error outside what's not supported. Cheers!

reddit.com
u/aasswwddd — 4 months ago
▲ 14 r/tasker

[Project Share] Accessibility Action v3.3, Target virtual display, filter search nodes, use multiple identifiers and take node screenshot.

Taskernet

The codes inside this project were generated with the assistance of AI Tools.

This project will ask to download files from this repo. Then executes a11Y.java via Initiate a11Y variable task.

If you previously download this project, please re-import again. Reminder that this will delete only used folder inside the target folder.

 

What is this project?

Syntax based automation like AutoInput Action V2 or AutoHotkey. More info and examples can be read on the repo page. https://github.com/mqwec43as/AccessibilityAction

  1. Syntax based UI automation actions.
  2. Debug highlighter & UI inspector.
  3. Minimal script builder.

Older posts containing past discussion and examples can be found here.

 

New

  1. Target secondary/virtual display with setDisplay.
  2. Most Assist and debugging features works with secondary/virtual display.
  3. Filter nodes by their properties with sheet menu.
  4. Search nodes through list dialogs.
  5. New identifier key "flags" to match against node's properties.
  6. Use multiple keys and their counter match.
  7. Take screenshot of node, window, and display.
  8. Get pixel color.
  9. Control accessibility service.

Taskernet features

  1. Add support to run via http request on local network.
  2. Add support to run via intent. Both requires keyv to be passed, needs to be set up via project variable.

 

Support secondary/virtual display

Demo Video: Interacting with scrcpy's virtual display

We can set the target display by using setDisplay().

Target display id 20.

a11Y.set();

setDisplay(20);
openApp("Youtube");
click("Subscription");
click("Today");

Target the first scrcpy display.

a11Y.set();

setDisplay("scrcpy");
browseUrl("www.youtube.com", "Youtube");

 

Search and filter nodes

Demo video: Filter clickable and see them in list dialog

We can filter nodes now based on their flags. E.g clickable and has text. Making it easier to select nodes that are overlapped.

Noted: Some nodes that has text are not always clickable. However their parent is, and this project will try to click the parent instead.

 

Multiple keys filter and counter keys

Demo video: Highlight different nodes with one reference text

Now it's possible to filter mutiple data and invert keys too.

Require at least text or id.

aa.text = "string";
aa.notext = "me";
aa.flags = NodeInfo.PASSWORD | NodeInfo.ENABLED;
click(aa);

or

a() {
    text = "string";
    noregex = "[A-Z]";
    // Use clazz instead of class because class it's reserverd
    clazz = "android.view.Button";
    return this;
}
click(a());

 

Take screenshot of target node, window or display and get pixel color

Demo video: Sharing reddit post card

Joao added a new flag to take screenshot to Tasker accessibility service. The project now supports taking screenshot with it and checking pixel color as well.

// Screenshot of diplay 0
takeScreenshot("/storage/emulated/0/ss.png"); 

// screenshot of the first node that matches "Tasker";
takeScreenshot(getNode("Tasker"), "/storage/emulated/0/ss.png");

//  Target diplay id 3
takeScreenshot(3,"/storage/emulated/0/ss.png" )

//  Target window id 3, auto adjust the target display.
String path = takeScreenshot(3, 0, "/storage/emulated/0/ss.png" )

// Get pixel color
int color = getPixelColor(100,100); 

 

Control accessibility service

Useful when we don't always one the service to be enabled. Requires WRITE_SECURE_SETTINGS permission.

a11Y.set();

// Enable first
a11Y.enableService();
// wait(100); Wait might be needed.

openApp("Youtube");

click("Subscription");

// Disable after.
a11Y.disableService();

 

Final Notes

Assist feature limitation

The action picker can only be displayed on the main screen since tasker.doWithActivity(Consumer) can't target specific display id. The same goes when the screen is locked, we have to unlock first to see the dialog.

App Factory & v6.6

The picker and setting also won't work if com.google.android.material is not found. E.g kid app or any version before v6.7.

Joao updated the App factory last weekend, so it should probably works since it supports SceneV2 (uses material lib). Not tested though.

Transparent overlay && draw over system settings

If you dislike having a transparent overlay for normal overlay, you could disable this by running the following adb command.

adb shell settings put global maximum_obscuring_opacity_for_touch 1

Can be done via Tasker too.

Draw over settings can be accessed via Developer Options.

Dev Options > Debugging > Allow screen overlay on settings
u/aasswwddd — 4 months ago

I fixed my heat problem by toggling these two settings in dev options.

Edit: Toggling These two on and off periodically.

See possible reasons below.

Dev options > Apps > Disable Child Press

Dev Options > Apps > Auto fillI

I always have the first one toggled on for so long, forgot to turn it off when I used to play with Termux lol.

But for some strange reason, the heat comes back for a while even I have them turned off. so I decided to toggle both on & off with Automate when the screen is on and off. Edit: Read below for possible reason.

Equivalent of adb command.

adb shell settings put global autofill_logging_level 0 and adb shell settings put settings_enable_monitor_phantom_procs true

Any apps that can change system settings will do the job, one that requires WRITE_SECURE_SETTINGS or Shizuku permission, e.g Tasker, Macrodroid. I toggled both to 2 and true when screen is off and on, wait 1s and revert to the value above.

Warm heat now is gone and logd consumed a lot less power from 400-500 mah down to 200, reported by BBS Reloaded. In comparison, System consumes around 500mah for a full cycle.

I also toggled these two as well, so I could tell which apps crash or went ANR.

https://preview.redd.it/kphcoju7685h1.png?width=359&format=png&auto=webp&s=b39f8bf6e405f24a017b2a8ff5f82f591070be98

I can still feel a bit of heat for casual use, but not as bad as the entire two years I have this phone with me. What's important is the phone has less lag as well.

Considering I hit 900 charge cycle after charging like a pig and now it has 83% battery health (based on max charge). This isn't bad at all.

My phone is Poco X6, HyperOS3, debloated with Canta. I don't game at all.

Edit:

Possible Reason

https://issuetracker.google.com/issues/205156966 After reading the issue and ask AI to look at the source code of AOSP reponsibles for handling phantom (child) process, what I think might happen is.

By toggling them frequently, we kind of like refreshing and trimming the child process list down to 32.

This is hypothetical, but OEM such as Poco/playstore might still alter the value which leads to more child process running in background.

This is probably why I feel that my phone gets cooler and snappier when I toggled them frequently :).

I could be wrong though so don't quote on me, but this should be debugable by following the issue troubleshooting approach.

reddit.com
u/aasswwddd — 4 months ago
▲ 5 r/tasker

[Help] I learned to load my own jar file in Java code. But how I do use external library instead?

SOLVED:

https://www.reddit.com/r/tasker/comments/1tvljle/comment/ophq4e3

The library has to be converted to dex bytecode. I'm using d8 here https://developer.android.com/tools/d8

OP
Someone at r/macrodroid posted a macro that uses jar file to show a trackpad https://www.reddit.com/r/macrodroid/comments/1trb047/just_finished_my_trackpad_shortcuts_menu_macro/

He used DexClassLoader after saving the file in cache directory and make it read only. I managed to replicate the method in tasker and used my own class successfully.

Now I'd like to do more, like using Zxing to read qr code for example. Or any other library really.

Ask this here just in case anyone familiar with this here, not sure where to look. Read through Beanshell's repo and doc, addClassPath(String) seems to be used to add the file but that was a bust.

More like I don't really understand the jargon lol. I'm just a vibe coder after all.

Anyone know how to do this properly? Thankyou!

Anyway, this is the script to load jar file gist.githubusercontent.com

u/aasswwddd — 4 months ago