ShizuStore

OnStop2FinishAndRemoveTask

takusan23

2.0.6 · GitHub

Download APK
Miscellaneous Android 12+ 2 weeks ago Apache-2.0
33 ShizuStore
3.5k GitHub
93 Stars
2 MB Size

More about this app

Automatically close selected apps when you exit them to save power and memory

OnStop2FinishAndRemoveTask

before after

別のアプリに切り替えた時、切り替え前のアプリを自動的に終了するアプリです。アプリは登録する必要があります。 Shizukuが必要です。

If change other app, Auto close task in prev app. The app must be registered. Required Shizuku APP.

ダウンロード / download

GitHub Release

https://github.com/takusan23/OnStop2FinishAndRemoveTask/releases

F-Droidからもダウンロードできます(レビューしてくれた方ありがとう!)。ダウンロードできるAPKはGitHub Releaseと同じです(再現可能ビルドを有効にしてあります)。 Available download from F-Droid (Thanks for reviewer!). Download apk is same as GitHub Release (Reproducible build enabled).

https://f-droid.org/ja/packages/io.github.takusan23.onstop2finishandremovetask/

仕組み / How to work

Android アプリ開発者ですか?
以下のコードのような動作をします。これを好きなアプリで利用することができるアプリです。

You're Android app developer ?
This app behavior like this code. Maybe, this app is available behavior for any app.

class MainActivity : ComponentActivity() {
    override fun onStop() {
        super.onStop()
        finishAndRemoveTask()
    }
}

フォアグラウンドサービスから今表示されているActivityを監視します。別のアプリに切り替わったところでタスクを終了する関数を呼び出しています。
これらの関数は内部の関数なので、それらを呼び出すためにShizukuを利用しています。

Observe current Activity From Foreground service. If change other app, Invoke remove task function.
this APIs Invoke by Shizuku. that's because, using API is Internal-API.

ビルド方法 / building

最新のAndroid Studioでビルド可能です。

Available build in latest Android Studio.

ビルド手順 / step

隠しAPIを呼び出しています。
aidlとandroid.app.パッケージのクラスをAOSPのソースコード( cs.android.com )からコピーしてきたため、android.jarの差し替えは不要です。
git cloneしたらAndroid Studioで開いてください。

Invoke Hidden API.
This app Copied using .aidl file and android.app package java class from AOSP ( cs.android.com ). No need replace android.jar.
Execute git clone and open Android Studio.

古いコミットの場合 / checkout old commit hash

https://github.com/Reginer/aosp-android-jar

隠しAPIを利用するため、android.jarを上記のURLからダウンロードして入れ替える必要があります。

This app is using Hidden-API. Must download android.jar in this URL. and replace android.jar.

Close

How Shizuku is used

Can automatically close selected apps after you switch away via `IActivityManager.removeTask` through Shizuku.

This is an AI-assisted analysis of Shizuku-related usages in the app's public source code. It is best effort, so it may not catch every single usage.

How this app uses Shizuku

Shizuku is used to watch the foreground app and close selected apps after you leave them.

  • Auto close chosen apps: the app watches the foreground app through Shizuku and, once you switch to a different app, removes the previous selected app task so it does not stay running in the background.

Android APIs or commands used

  • IActivityManager.registerTaskStackListener
  • IActivityManager.unregisterTaskStackListener
  • IActivityManager.removeTask
Close

Changelog

What's new for version 2.0.6

APK のサイズを最適化しました(R8 を有効にしました) Optimize APK size (enable to R8)

間違えた apk をアップロードしてしまったので assets を再度アップロードしました 🙇 I re-update apk. That's because incorrect apk uploaded.

Close

Permissions

6 permissions requested

  • android.permission.POST_NOTIFICATIONS
  • android.permission.QUERY_ALL_PACKAGES
  • android.permission.FOREGROUND_SERVICE
  • android.permission.FOREGROUND_SERVICE_SPECIAL_USE
  • io.github.takusan23.onstop2finishandremovetask.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION
  • moe.shizuku.manager.permission.API_V23
Close

Sources

2 sources

2.0.6 Universal GitHub · io.github.takusan23.onstop2finishandremovetask
Selected Download
2.0.6 arm64-v8a,armeabi-v7a,x86,x86_64 F-Droid · io.github.takusan23.onstop2finishandremovetask · io.github.takusan23.onstop2finishandremovetask
Download