Always remove task

This commit is contained in:
vvb2060 2022-06-09 19:39:43 +08:00 committed by John Wu
parent cae58c8790
commit 42606efe56
4 changed files with 13 additions and 10 deletions

View File

@ -27,6 +27,7 @@
android:name=".ui.surequest.SuRequestActivity" android:name=".ui.surequest.SuRequestActivity"
android:directBootAware="true" android:directBootAware="true"
android:exported="false" android:exported="false"
android:taskAffinity=""
tools:ignore="AppLinkUrlError"> tools:ignore="AppLinkUrlError">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />

View File

@ -24,13 +24,9 @@ open class SuRequestActivity : UIActivity<ActivityRequestBinding>() {
override val layoutRes: Int = R.layout.activity_request override val layoutRes: Int = R.layout.activity_request
override val viewModel: SuRequestViewModel by viewModel() override val viewModel: SuRequestViewModel by viewModel()
override fun onBackPressed() {
viewModel.denyPressed()
}
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
supportRequestWindowFeature(Window.FEATURE_NO_TITLE) supportRequestWindowFeature(Window.FEATURE_NO_TITLE)
lockOrientation() requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LOCKED
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
window.addFlags(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN) window.addFlags(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
@ -62,7 +58,11 @@ open class SuRequestActivity : UIActivity<ActivityRequestBinding>() {
return theme return theme
} }
private fun lockOrientation() { override fun onBackPressed() {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LOCKED viewModel.denyPressed()
}
override fun finish() {
super.finishAndRemoveTask()
} }
} }

View File

@ -127,6 +127,7 @@ fun genStubManifest(srcDir: File, outDir: File): String {
| android:name="%s" | android:name="%s"
| android:directBootAware="true" | android:directBootAware="true"
| android:exported="false" | android:exported="false"
| android:taskAffinity=""
| tools:ignore="AppLinkUrlError"> | tools:ignore="AppLinkUrlError">
| <intent-filter> | <intent-filter>
| <action android:name="android.intent.action.VIEW"/> | <action android:name="android.intent.action.VIEW"/>

View File

@ -17,10 +17,11 @@ exe, "/system/bin", "com.android.commands.content.Content", \
#define START_ACTIVITY \ #define START_ACTIVITY \
exe, "/system/bin", "com.android.commands.am.Am", \ exe, "/system/bin", "com.android.commands.am.Am", \
"start", "-p", target, "--user", user, "-a", "android.intent.action.VIEW", \ "start", "-p", target, "--user", user, "-a", "android.intent.action.VIEW", \
"-f", "0x58000020", "--es", "action", action "-f", "0x58800020", "--es", "action", action
// 0x58000020 = FLAG_ACTIVITY_NEW_TASK|FLAG_ACTIVITY_MULTIPLE_TASK| // 0x58800020 = FLAG_ACTIVITY_NEW_TASK|FLAG_ACTIVITY_MULTIPLE_TASK|
// FLAG_ACTIVITY_NO_HISTORY|FLAG_INCLUDE_STOPPED_PACKAGES // FLAG_ACTIVITY_NO_HISTORY|FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS|
// FLAG_INCLUDE_STOPPED_PACKAGES
#define get_cmd(to) \ #define get_cmd(to) \
((to).command.empty() ? \ ((to).command.empty() ? \