Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9673f4b authored by Andy Wickham's avatar Andy Wickham
Browse files

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
parent 0f0a53a3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@
            android:configChanges="keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenSize|screenLayout|smallestScreenSize"
            android:resizeableActivity="true"
            android:resumeWhilePausing="true"
            android:taskAffinity=""
            android:taskAffinity="${packageName}.launcher"
            android:enabled="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
+1 −0
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@
            android:name="com.android.quickstep.interaction.GestureSandboxActivity"
            android:autoRemoveFromRecents="true"
            android:excludeFromRecents="true"
            android:taskAffinity="${packageName}.launcher"
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="com.android.quickstep.action.GESTURE_SANDBOX" />
+26 −0
Original line number Diff line number Diff line
@@ -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_", "");