diff --git a/Android.bp b/Android.bp
index 3a36daa4fb..df366dde87 100644
--- a/Android.bp
+++ b/Android.bp
@@ -228,7 +228,10 @@ android_app {
"Home",
"Launcher2",
],
- required: ["privapp_whitelist_com.android.launcher3"],
+ required: [
+ "privapp_whitelist_com.android.launcher3",
+ "privapp_whitelist_aospa_launcher3.xml",
+ ],
jacoco: {
include_filter: ["com.android.launcher3.**"],
@@ -357,7 +360,10 @@ android_app {
"Launcher3",
"Launcher3QuickStep",
],
- required: ["privapp_whitelist_com.android.launcher3"],
+ required: [
+ "privapp_whitelist_com.android.launcher3",
+ "privapp_whitelist_aospa_launcher3.xml",
+ ],
additional_manifests: [
"AndroidManifest.xml",
@@ -392,7 +398,10 @@ android_app {
"Launcher2",
"Launcher3",
],
- required: ["privapp_whitelist_com.android.launcher3"],
+ required: [
+ "privapp_whitelist_com.android.launcher3",
+ "privapp_whitelist_aospa_launcher3.xml",
+ ],
resource_dirs: ["quickstep/res"],
@@ -443,7 +452,10 @@ android_app {
"Launcher3",
"Launcher3QuickStep",
],
- required: ["privapp_whitelist_com.android.launcher3"],
+ required: [
+ "privapp_whitelist_com.android.launcher3",
+ "privapp_whitelist_aospa_launcher3.xml",
+ ],
additional_manifests: [
"go/AndroidManifest.xml",
@@ -458,3 +470,9 @@ android_app {
}
+prebuilt_etc {
+ name: "privapp_whitelist_aospa_launcher3.xml",
+ src: "privapp_whitelist_aospa_launcher3.xml",
+ system_ext_specific: true,
+ sub_dir: "permissions",
+}
diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml
index 6ef64a4acc..fb58411596 100644
--- a/AndroidManifest-common.xml
+++ b/AndroidManifest-common.xml
@@ -46,6 +46,8 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/quickstep/res/drawable/ic_kill_app.xml b/quickstep/res/drawable/ic_kill_app.xml
new file mode 100644
index 0000000000..bb7036a6ac
--- /dev/null
+++ b/quickstep/res/drawable/ic_kill_app.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
diff --git a/quickstep/res/values/aospa_strings.xml b/quickstep/res/values/aospa_strings.xml
new file mode 100644
index 0000000000..8c11ae256a
--- /dev/null
+++ b/quickstep/res/values/aospa_strings.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+ Force close
+ App closed
+
diff --git a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
index fdf2235f7d..fdc0d4a40f 100644
--- a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
+++ b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
@@ -120,6 +120,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
/** Note that these will be shown in order from top to bottom, if available for the task. */
private static final TaskShortcutFactory[] MENU_OPTIONS = new TaskShortcutFactory[]{
TaskShortcutFactory.APP_INFO,
+ TaskShortcutFactory.KILL_APP,
TaskShortcutFactory.SPLIT_SELECT,
TaskShortcutFactory.UNINSTALL,
TaskShortcutFactory.PIN,
diff --git a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java
index 34eeef504c..511786bc99 100644
--- a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java
+++ b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java
@@ -22,7 +22,9 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_SELECTIO
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SYSTEM_SHORTCUT_FREE_FORM_TAP;
import android.app.Activity;
+import android.app.ActivityManagerNative;
import android.app.ActivityOptions;
+import android.app.IActivityManager;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Rect;
@@ -30,11 +32,13 @@ import android.os.Handler;
import android.os.Looper;
import android.os.RemoteException;
import android.os.SystemProperties;
+import android.os.UserHandle;
import android.util.Log;
import android.view.View;
import android.view.WindowInsets;
import android.view.WindowManagerGlobal;
import android.window.SplashScreen;
+import android.widget.Toast;
import androidx.annotation.Nullable;
@@ -410,4 +414,49 @@ public interface TaskShortcutFactory {
return null;
}
};
+
+ TaskShortcutFactory KILL_APP = new TaskShortcutFactory() {
+ public List getShortcuts(BaseDraggingActivity activity,
+ TaskIdAttributeContainer taskContainer) {
+ String packageName = taskContainer.getTaskView()
+ .getItemInfo().getTargetComponent().getPackageName();
+ return Collections.singletonList(new KillSystemShortcut(activity, taskContainer, packageName));
+
+ }
+ };
+
+ class KillSystemShortcut extends SystemShortcut {
+ private static final String TAG = "KillSystemShortcut";
+ private final TaskView mTaskView;
+ private final BaseDraggingActivity mActivity;
+ private final String mPackageName;
+
+ public KillSystemShortcut(BaseDraggingActivity activity,
+ TaskIdAttributeContainer taskContainer, String packageName) {
+ super(R.drawable.ic_kill_app, R.string.recent_task_option_kill_app,
+ activity, taskContainer.getItemInfo(), taskContainer.getTaskView());
+ mTaskView = taskContainer.getTaskView();
+ mActivity = activity;
+ mPackageName = packageName;
+ }
+
+ @Override
+ public void onClick(View view) {
+ if (mPackageName != null) {
+ IActivityManager iam = ActivityManagerNative.getDefault();
+ Task task = mTaskView.getTask();
+ if (task != null) {
+ try {
+ iam.forceStopPackage(mPackageName, UserHandle.USER_CURRENT);
+ Toast appKilled = Toast.makeText(mActivity, R.string.recents_app_killed,
+ Toast.LENGTH_SHORT);
+ appKilled.show();
+ ((RecentsView)mActivity.getOverviewPanel())
+ .dismissTask(mTaskView, true /* animate */, true /* removeTask */);
+ } catch (RemoteException e) { }
+ }
+ }
+ dismissTaskMenuView(mActivity);
+ }
+ }
}