Adds option to launch Gesture Sandbox from dev settings.

This is set to have the same task affinity as Launcher
so that it inherits the ability to ignore system gestures.

Bug: 148542211
Change-Id: I29bc5599dea61c44be721dcc0bec7bc494c415c4
This commit is contained in:
Andy Wickham
2020-02-19 23:48:21 +00:00
parent 0f0a53a35f
commit a9673f4b5c
3 changed files with 28 additions and 1 deletions

View File

@@ -96,6 +96,7 @@ public class DeveloperOptionsFragment extends PreferenceFragmentCompat {
initFlags();
loadPluginPrefs();
maybeAddSandboxCategory();
}
@Override
@@ -203,6 +204,31 @@ public class DeveloperOptionsFragment extends PreferenceFragmentCompat {
});
}
private void maybeAddSandboxCategory() {
Context context = getContext();
if (context == null) {
return;
}
Intent launchSandboxIntent =
new Intent("com.android.quickstep.action.GESTURE_SANDBOX")
.setPackage(context.getPackageName())
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (launchSandboxIntent.resolveActivity(context.getPackageManager()) == null) {
return;
}
PreferenceCategory sandboxCategory = newCategory("Sandbox");
Preference launchSandboxPreference = new Preference(context);
launchSandboxPreference.setKey("launchSandbox");
launchSandboxPreference.setTitle("Launch Gesture Navigation Sandbox");
launchSandboxPreference.setSummary(
"This provides tutorials and a place to practice navigation gestures.");
launchSandboxPreference.setOnPreferenceClickListener(preference -> {
startActivity(launchSandboxIntent);
return true;
});
sandboxCategory.addPreference(launchSandboxPreference);
}
private String toName(String action) {
String str = action.replace("com.android.systemui.action.PLUGIN_", "")
.replace("com.android.launcher3.action.PLUGIN_", "");