Skip to content

Commit

Permalink
[app] mavel rule ext: support action delay
Browse files Browse the repository at this point in the history
  • Loading branch information
Tornaco committed Apr 5, 2022
1 parent af90b58 commit 98aa959
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion android/internal/Thanox-Internal
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import android.os.Binder;
import android.os.Handler;
import android.os.Process;
import android.os.UserHandle;

import androidx.annotation.Nullable;

Expand Down Expand Up @@ -92,6 +93,11 @@ public Intent registerReceiver(@Nullable BroadcastReceiver receiver, IntentFilte
return new Intent();
}

public Intent registerReceiverAsUser(BroadcastReceiver receiver, UserHandle user, IntentFilter filter, String broadcastPermission, Handler scheduler) {
XLog.w("ShellProcessContext, drop registerReceiver call..." + receiver);
return new Intent();
}

@Override
public ContentResolver getContentResolver() {
XLog.w("ShellProcessContext, drop getContentResolver call...");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[
{
"name": "Delayed action example",
"description": "Execute the action delay 2s: show a short toast and log the event 2s after app switched.",
"description": "Execute the action delay 2000 ms: show a short toast 2s after app switched.",
"priority": 1,
"delay": 2000,
"condition": "frontPkgChanged == true",
"actions": [
"actor.delayed(2000, \"ui.showShortToast(\\\"App switched 2s ago\\\")\")",
"actor.delayed(2000, \"log.log(to)\")"
"ui.showShortToast(\"App switched 2s ago to: \" + thanos.getPkgManager().getAppInfo(to).getAppLabel())"
]
}
]

1 comment on commit 98aa959

@countrysideboy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

太好了,这样写情景模式就方便了。另外还有一个小需求,就是希望切换后台状态持续X秒以后才执行。不懂现在的delay是切换回后台,是不是立马切回前台,仍然会执行

Please sign in to comment.