diff options
author | Winson Chung <winsonc@google.com> | 2018-10-29 10:45:25 -0700 |
---|---|---|
committer | Vadim Tryshev <vadimt@google.com> | 2018-10-30 13:52:19 -0700 |
commit | b3fe661860c6ec909d4726103e9c7d10434a0455 (patch) | |
tree | d1ad0c93c7cecd5e7eb671161cd4b4358c62b901 /tests/src/com/android/launcher3/testcomponent | |
parent | f107c9ef6ddc59763c1b60507c6ea7b09ecee8f9 (diff) | |
download | android_packages_apps_Trebuchet-b3fe661860c6ec909d4726103e9c7d10434a0455.tar.gz android_packages_apps_Trebuchet-b3fe661860c6ec909d4726103e9c7d10434a0455.tar.bz2 android_packages_apps_Trebuchet-b3fe661860c6ec909d4726103e9c7d10434a0455.zip |
Add kill-process call to TestCommandReceiver
Bug: 117888000
Test: On Nexus side
Change-Id: I4803a884ffe8ae6147fdbaf98e2f813934418b76
Diffstat (limited to 'tests/src/com/android/launcher3/testcomponent')
-rw-r--r-- | tests/src/com/android/launcher3/testcomponent/TestCommandReceiver.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/src/com/android/launcher3/testcomponent/TestCommandReceiver.java b/tests/src/com/android/launcher3/testcomponent/TestCommandReceiver.java index 04c04f5b1..0edb3d61b 100644 --- a/tests/src/com/android/launcher3/testcomponent/TestCommandReceiver.java +++ b/tests/src/com/android/launcher3/testcomponent/TestCommandReceiver.java @@ -19,6 +19,8 @@ import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED; import static android.content.pm.PackageManager.DONT_KILL_APP; +import android.app.Activity; +import android.app.ActivityManager; import android.app.Instrumentation; import android.content.ComponentName; import android.content.ContentProvider; @@ -36,6 +38,7 @@ public class TestCommandReceiver extends ContentProvider { public static final String ENABLE_TEST_LAUNCHER = "enable-test-launcher"; public static final String DISABLE_TEST_LAUNCHER = "disable-test-launcher"; + public static final String KILL_PROCESS = "kill-process"; @Override public boolean onCreate() { @@ -83,14 +86,22 @@ public class TestCommandReceiver extends ContentProvider { COMPONENT_ENABLED_STATE_DISABLED, DONT_KILL_APP); return null; } - + case KILL_PROCESS: { + ((ActivityManager) getContext().getSystemService(Activity.ACTIVITY_SERVICE)). + killBackgroundProcesses(arg); + return null; + } } return super.call(method, arg, extras); } public static Bundle callCommand(String command) { + return callCommand(command, null); + } + + public static Bundle callCommand(String command, String arg) { Instrumentation inst = InstrumentationRegistry.getInstrumentation(); Uri uri = Uri.parse("content://" + inst.getContext().getPackageName() + ".commands"); - return inst.getTargetContext().getContentResolver().call(uri, command, null, null); + return inst.getTargetContext().getContentResolver().call(uri, command, arg, null); } } |