001// SPDX-License-Identifier: GPL-3.0-or-later 002// Copyright © 2026 Aurélien Pierre 003 004package com.aurelienpierre.sioul; 005 006import android.app.Activity; 007import android.content.Intent; 008import android.os.Bundle; 009 010/** 011 * "Pause" pressed on the quick-settings tile (PauseTile) or the home screen's 012 * shortcut (res/xml/sioul_shortcuts.xml): the press kept for Sioul 013 * ({@link PauseMode#pressed}, which Rust takes when the window comes up), then Sioul 014 * brought up as by its icon, where the pause starts, or shows when it is on 015 * already. Never shown itself. Not exported: no other app can press it. 016 */ 017public final class PauseOpener extends Activity 018{ 019 @Override 020 protected void onCreate(Bundle state) 021 { 022 super.onCreate(state); 023 if (state == null) 024 PauseMode.pressed(this); 025 Intent sioul = getPackageManager().getLaunchIntentForPackage(getPackageName()); 026 if (sioul != null) 027 startActivity(sioul.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED)); 028 finish(); 029 } 030}