Merge "Remove silky flag from Notifications for official release" into sc-dev
diff --git a/res/values/strings.xml b/res/values/strings.xml
index af5a706..4dc3060 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -11612,6 +11612,13 @@
     <!-- Positive button for the alert dialog when gesture nav not supported by launcher [CHAR LIMIT=60] -->
     <string name="gesture_not_supported_positive_button">Switch default home app</string>
 
+    <!-- Title for setting category that is shown to enable invoking digital assistant with swipe. [CHAR LIMIT=60] -->
+    <string name="assistant_gesture_category_title">Digital assistant</string>
+    <!-- Title text for swiping from bottom corners to invoke the digital assistant app. [CHAR LIMIT=60] -->
+    <string name="assistant_corner_gesture_title">Swipe to invoke assistant</string>
+    <!-- Summary text for swiping from bottom corners to invoke the digital assistant app. [CHAR LIMIT=NONE] -->
+    <string name="assistant_corner_gesture_summary">Swipe up from a bottom corner corner to invoke digital assistant app.</string>
+
     <!-- Content description for the Information icon [CHAR LIMIT=30] -->
     <string name="information_label">Information</string>
 
diff --git a/res/xml/adb_device_details_fragment.xml b/res/xml/adb_device_details_fragment.xml
index 2e149ed..a227f38 100644
--- a/res/xml/adb_device_details_fragment.xml
+++ b/res/xml/adb_device_details_fragment.xml
@@ -17,8 +17,7 @@
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res-auto"
-    android:title="@string/device_details_title"
-    settings:initialExpandedChildrenCount="3">
+    android:title="@string/device_details_title">
 
     <com.android.settingslib.widget.LayoutPreference
         android:key="adb_device_header"
diff --git a/res/xml/app_notification_settings.xml b/res/xml/app_notification_settings.xml
index edf8cb9..5270b09 100644
--- a/res/xml/app_notification_settings.xml
+++ b/res/xml/app_notification_settings.xml
@@ -80,8 +80,7 @@
 
     <PreferenceCategory
         android:key="app_advanced"
-        android:order="1000"
-        settings:initialExpandedChildrenCount="0">
+        android:order="1000">
         <!-- Show badge -->
         <com.android.settingslib.RestrictedSwitchPreference
             android:key="badge"
diff --git a/res/xml/display_settings_v2.xml b/res/xml/display_settings_v2.xml
index e0eb9bb..2d6e3db 100644
--- a/res/xml/display_settings_v2.xml
+++ b/res/xml/display_settings_v2.xml
@@ -30,7 +30,6 @@
             settings:keywords="@string/keywords_display_brightness_level"
             settings:useAdminDisabledSummary="true"
             settings:userRestriction="no_config_brightness">
-            <intent android:action="com.android.intent.action.SHOW_BRIGHTNESS_DIALOG"/>
         </com.android.settingslib.RestrictedPreference>
 
         <com.android.settings.widget.PrimarySwitchPreference
diff --git a/res/xml/gesture_navigation_settings.xml b/res/xml/gesture_navigation_settings.xml
index 0515d78..09bb870 100644
--- a/res/xml/gesture_navigation_settings.xml
+++ b/res/xml/gesture_navigation_settings.xml
@@ -24,6 +24,20 @@
     settings:keywords="@string/keywords_gesture_navigation_settings">
 
     <PreferenceCategory
+        android:key="assistant_gesture_category"
+        android:persistent="false"
+        android:title="@string/assistant_gesture_category_title">
+
+        <SwitchPreference
+            android:key="assistant_gesture_corner_swipe"
+            android:title="@string/assistant_corner_gesture_title"
+            android:summary="@string/assistant_corner_gesture_summary"
+            settings:controller="com.android.settings.gestures.GestureNavigationSettingsAssistController"
+        />
+
+    </PreferenceCategory>
+
+    <PreferenceCategory
         android:key="back_sensitivity_category"
         android:persistent="false"
         android:title="@string/back_sensitivity_dialog_title">
diff --git a/res/xml/location_settings.xml b/res/xml/location_settings.xml
index 880a326..cffab3e 100644
--- a/res/xml/location_settings.xml
+++ b/res/xml/location_settings.xml
@@ -37,8 +37,7 @@
 
     <PreferenceCategory
         android:key="location_advanced_settings"
-        android:layout="@layout/preference_category_no_label"
-        settings:initialExpandedChildrenCount="3">
+        android:layout="@layout/preference_category_no_label">
 
         <!-- This preference gets removed if there is no managed profile -->
         <com.android.settingslib.RestrictedSwitchPreference
diff --git a/res/xml/privacy_dashboard_settings.xml b/res/xml/privacy_dashboard_settings.xml
index 0cf5f77..7c4966b 100644
--- a/res/xml/privacy_dashboard_settings.xml
+++ b/res/xml/privacy_dashboard_settings.xml
@@ -19,8 +19,7 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res-auto"
     android:key="privacy_dashboard_page"
-    android:title="@string/privacy_dashboard_title"
-    settings:initialExpandedChildrenCount="4">
+    android:title="@string/privacy_dashboard_title">
 
 
     <!-- Work Policy info -->
diff --git a/res/xml/security_dashboard_settings.xml b/res/xml/security_dashboard_settings.xml
index be1f34c..edfe582 100644
--- a/res/xml/security_dashboard_settings.xml
+++ b/res/xml/security_dashboard_settings.xml
@@ -19,8 +19,7 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res-auto"
     android:key="security_dashboard_page"
-    android:title="@string/security_settings_title"
-    settings:initialExpandedChildrenCount="9">
+    android:title="@string/security_settings_title">
 
     <!-- security_settings_status.xml -->
     <PreferenceCategory
diff --git a/res/xml/wifi_network_details_fragment2.xml b/res/xml/wifi_network_details_fragment2.xml
index cb24a8f..7847eba 100644
--- a/res/xml/wifi_network_details_fragment2.xml
+++ b/res/xml/wifi_network_details_fragment2.xml
@@ -16,8 +16,7 @@
 
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:settings="http://schemas.android.com/apk/res-auto"
-    settings:initialExpandedChildrenCount="5">
+    xmlns:settings="http://schemas.android.com/apk/res-auto">
 
     <com.android.settingslib.widget.LayoutPreference
         android:key="connection_header"
diff --git a/src/com/android/settings/core/SettingsBaseActivity.java b/src/com/android/settings/core/SettingsBaseActivity.java
index a032a8b..c2d3ad3 100644
--- a/src/com/android/settings/core/SettingsBaseActivity.java
+++ b/src/com/android/settings/core/SettingsBaseActivity.java
@@ -50,6 +50,7 @@
 import com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin;
 import com.android.settingslib.drawer.Tile;
 import com.android.settingslib.transition.SettingsTransitionHelper;
+import com.android.settingslib.transition.SettingsTransitionHelper.TransitionType;
 
 import com.google.android.material.appbar.CollapsingToolbarLayout;
 import com.google.android.material.resources.TextAppearanceConfig;
@@ -63,6 +64,11 @@
 
 public class SettingsBaseActivity extends FragmentActivity {
 
+    /**
+     * What type of page transition should be apply.
+     */
+    public static final String EXTRA_PAGE_TRANSITION_TYPE = "extra_page_transition_type";
+
     protected static final boolean DEBUG_TIMING = false;
     private static final String TAG = "SettingsBaseActivity";
     private static final String DATA_SCHEME_PKG = "package";
@@ -163,26 +169,53 @@
             super.startActivity(intent);
             return;
         }
+
+        final int transitionType = getTransitionType(intent);
+        if (transitionType == TransitionType.TRANSITION_SLIDE) {
+            super.startActivity(intent, null);
+            overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
+            return;
+        } else if (transitionType == TransitionType.TRANSITION_NONE) {
+            super.startActivity(intent, null);
+            return;
+        }
         super.startActivity(intent, createActivityOptionsBundleForTransition(null));
     }
 
     @Override
     public void startActivity(Intent intent, @androidx.annotation.Nullable Bundle options) {
-        if (!Utils.isPageTransitionEnabled(this)) {
+        final int transitionType = getTransitionType(intent);
+        if (!Utils.isPageTransitionEnabled(this) ||
+                transitionType == TransitionType.TRANSITION_NONE) {
             super.startActivity(intent, options);
             return;
         }
+
+        if (transitionType == TransitionType.TRANSITION_SLIDE) {
+            super.startActivity(intent, options);
+            overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
+            return;
+        }
         super.startActivity(intent, createActivityOptionsBundleForTransition(options));
     }
 
     @Override
     public void startActivityForResult(Intent intent, int requestCode) {
+        final int transitionType = getTransitionType(intent);
         // startActivity() will eventually calls startActivityForResult() with requestCode -1.
         // Adding this condition to avoid multiple calls.
-        if (!Utils.isPageTransitionEnabled(this) || requestCode == DEFAULT_REQUEST) {
+        if (!Utils.isPageTransitionEnabled(this) || requestCode == DEFAULT_REQUEST
+                || transitionType == TransitionType.TRANSITION_NONE) {
             super.startActivityForResult(intent, requestCode);
             return;
         }
+
+        if (transitionType == TransitionType.TRANSITION_SLIDE) {
+            super.startActivityForResult(intent, requestCode, null);
+            overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
+            return;
+        }
+
         super.startActivityForResult(intent, requestCode,
                 createActivityOptionsBundleForTransition(null));
     }
@@ -190,10 +223,19 @@
     @Override
     public void startActivityForResult(Intent intent, int requestCode,
             @androidx.annotation.Nullable Bundle options) {
-        if (!Utils.isPageTransitionEnabled(this) || requestCode == DEFAULT_REQUEST) {
+        final int transitionType = getTransitionType(intent);
+        if (!Utils.isPageTransitionEnabled(this) || requestCode == DEFAULT_REQUEST
+                || transitionType == TransitionType.TRANSITION_NONE) {
             super.startActivityForResult(intent, requestCode, options);
             return;
         }
+
+        if (transitionType == TransitionType.TRANSITION_SLIDE) {
+            super.startActivityForResult(intent, requestCode, options);
+            overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
+            return;
+        }
+
         super.startActivityForResult(intent, requestCode,
                 createActivityOptionsBundleForTransition(options));
     }
@@ -344,6 +386,11 @@
         }
     }
 
+    private int getTransitionType(Intent intent) {
+        return intent.getIntExtra(EXTRA_PAGE_TRANSITION_TYPE,
+                SettingsTransitionHelper.TransitionType.TRANSITION_SHARED_AXIS);
+    }
+
     @androidx.annotation.Nullable
     private Bundle createActivityOptionsBundleForTransition(
             @androidx.annotation.Nullable Bundle options) {
diff --git a/src/com/android/settings/core/SubSettingLauncher.java b/src/com/android/settings/core/SubSettingLauncher.java
index 545fcda..2ee404b 100644
--- a/src/com/android/settings/core/SubSettingLauncher.java
+++ b/src/com/android/settings/core/SubSettingLauncher.java
@@ -34,6 +34,7 @@
 import com.android.settings.SubSettings;
 import com.android.settings.Utils;
 import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
+import com.android.settingslib.transition.SettingsTransitionHelper.TransitionType;
 
 public class SubSettingLauncher {
 
@@ -47,6 +48,7 @@
         }
         mContext = context;
         mLaunchRequest = new LaunchRequest();
+        mLaunchRequest.transitionType = TransitionType.TRANSITION_SHARED_AXIS;
     }
 
     public SubSettingLauncher setDestination(String fragmentName) {
@@ -120,6 +122,11 @@
         return this;
     }
 
+    public SubSettingLauncher setTransitionType(int transitionType) {
+        mLaunchRequest.transitionType = transitionType;
+        return this;
+    }
+
     public void launch() {
         if (mLaunched) {
             throw new IllegalStateException(
@@ -166,6 +173,9 @@
                 mLaunchRequest.titleResId);
         intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE, mLaunchRequest.title);
         intent.addFlags(mLaunchRequest.flags);
+        intent.putExtra(SettingsBaseActivity.EXTRA_PAGE_TRANSITION_TYPE,
+                mLaunchRequest.transitionType);
+
         return intent;
     }
 
@@ -219,6 +229,7 @@
         Fragment mResultListener;
         int mRequestCode;
         UserHandle userHandle;
+        int transitionType;
         Bundle arguments;
         Bundle extras;
     }
diff --git a/src/com/android/settings/display/BrightnessLevelPreferenceController.java b/src/com/android/settings/display/BrightnessLevelPreferenceController.java
index 7e0ce66..de4fe25 100644
--- a/src/com/android/settings/display/BrightnessLevelPreferenceController.java
+++ b/src/com/android/settings/display/BrightnessLevelPreferenceController.java
@@ -13,12 +13,15 @@
  */
 package com.android.settings.display;
 
+import static android.content.Intent.ACTION_SHOW_BRIGHTNESS_DIALOG;
+
 import static com.android.settingslib.display.BrightnessUtils.GAMMA_SPACE_MAX;
 import static com.android.settingslib.display.BrightnessUtils.GAMMA_SPACE_MIN;
 import static com.android.settingslib.display.BrightnessUtils.convertLinearToGammaFloat;
 
 import android.content.ContentResolver;
 import android.content.Context;
+import android.content.Intent;
 import android.database.ContentObserver;
 import android.hardware.display.BrightnessInfo;
 import android.hardware.display.DisplayManager;
@@ -31,6 +34,7 @@
 import android.os.ServiceManager;
 import android.provider.Settings.System;
 import android.service.vr.IVrManager;
+import android.text.TextUtils;
 import android.util.Log;
 
 import androidx.annotation.VisibleForTesting;
@@ -38,11 +42,13 @@
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settings.core.SettingsBaseActivity;
 import com.android.settingslib.core.AbstractPreferenceController;
 import com.android.settingslib.core.lifecycle.Lifecycle;
 import com.android.settingslib.core.lifecycle.LifecycleObserver;
 import com.android.settingslib.core.lifecycle.events.OnStart;
 import com.android.settingslib.core.lifecycle.events.OnStop;
+import com.android.settingslib.transition.SettingsTransitionHelper;
 
 import java.text.NumberFormat;
 
@@ -77,10 +83,12 @@
 
     private final DisplayListener mDisplayListener = new DisplayListener() {
         @Override
-        public void onDisplayAdded(int displayId) {}
+        public void onDisplayAdded(int displayId) {
+        }
 
         @Override
-        public void onDisplayRemoved(int displayId) {}
+        public void onDisplayRemoved(int displayId) {
+        }
 
         @Override
         public void onDisplayChanged(int displayId) {
@@ -140,6 +148,18 @@
         mDisplayManager.unregisterDisplayListener(mDisplayListener);
     }
 
+    @Override
+    public boolean handlePreferenceTreeClick(Preference preference) {
+        if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) {
+            return false;
+        }
+        final Intent intent = new Intent(ACTION_SHOW_BRIGHTNESS_DIALOG);
+        intent.putExtra(SettingsBaseActivity.EXTRA_PAGE_TRANSITION_TYPE,
+                SettingsTransitionHelper.TransitionType.TRANSITION_NONE);
+        mContext.startActivity(intent);
+        return true;
+    }
+
     private void updatedSummary(Preference preference) {
         if (preference != null) {
             preference.setSummary(NumberFormat.getPercentInstance().format(getCurrentBrightness()));
diff --git a/src/com/android/settings/gestures/GestureNavigationSettingsAssistController.java b/src/com/android/settings/gestures/GestureNavigationSettingsAssistController.java
new file mode 100644
index 0000000..5c49538
--- /dev/null
+++ b/src/com/android/settings/gestures/GestureNavigationSettingsAssistController.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.gestures;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import com.android.settings.core.TogglePreferenceController;
+
+/**
+ * Configures behaviour of corner swipe to invoke assistant app gesture.
+ */
+public class GestureNavigationSettingsAssistController extends TogglePreferenceController {
+
+    // This value is based on SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java
+    // behaviour. We assume that the gestures are enabled by default.
+    private static final int ASSIST_TOUCH_GESTURE_DEFAULT_VALUE = 1;
+
+    public GestureNavigationSettingsAssistController(Context context, String key) {
+        super(context, key);
+    }
+
+    @Override
+    public boolean isChecked() {
+        return Settings.Secure.getInt(mContext.getContentResolver(),
+                Settings.Secure.ASSIST_TOUCH_GESTURE_ENABLED, ASSIST_TOUCH_GESTURE_DEFAULT_VALUE)
+                == 1;
+    }
+
+    @Override
+    public boolean setChecked(boolean isChecked) {
+        return Settings.Secure.putInt(mContext.getContentResolver(),
+                Settings.Secure.ASSIST_TOUCH_GESTURE_ENABLED, isChecked ? 1 : 0);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return SystemNavigationPreferenceController.isGestureAvailable(mContext) ? AVAILABLE
+                : UNSUPPORTED_ON_DEVICE;
+    }
+}
diff --git a/src/com/android/settings/security/TopLevelSecurityEntryPreferenceController.java b/src/com/android/settings/security/TopLevelSecurityEntryPreferenceController.java
index 8fab3c9..964482e 100644
--- a/src/com/android/settings/security/TopLevelSecurityEntryPreferenceController.java
+++ b/src/com/android/settings/security/TopLevelSecurityEntryPreferenceController.java
@@ -27,8 +27,12 @@
 
 public class TopLevelSecurityEntryPreferenceController extends BasePreferenceController {
 
+    private final SecuritySettingsFeatureProvider mSecuritySettingsFeatureProvider;
+
     public TopLevelSecurityEntryPreferenceController(Context context, String preferenceKey) {
         super(context, preferenceKey);
+        mSecuritySettingsFeatureProvider = FeatureFactory.getFactory(mContext)
+                .getSecuritySettingsFeatureProvider();
     }
 
     @Override
@@ -42,11 +46,9 @@
             return super.handlePreferenceTreeClick(preference);
         }
 
-        SecuritySettingsFeatureProvider securitySettingsFeatureProvider =
-                FeatureFactory.getFactory(mContext).getSecuritySettingsFeatureProvider();
-        if (securitySettingsFeatureProvider.hasAlternativeSecuritySettingsFragment()) {
+        if (mSecuritySettingsFeatureProvider.hasAlternativeSecuritySettingsFragment()) {
             String alternativeFragmentClassname =
-                    securitySettingsFeatureProvider
+                    mSecuritySettingsFeatureProvider
                             .getAlternativeSecuritySettingsFragmentClassname();
             if (alternativeFragmentClassname != null) {
                 new SubSettingLauncher(mContext)
diff --git a/tests/robotests/src/com/android/settings/core/SubSettingLauncherTest.java b/tests/robotests/src/com/android/settings/core/SubSettingLauncherTest.java
index 7a83cd0..a74c01e 100644
--- a/tests/robotests/src/com/android/settings/core/SubSettingLauncherTest.java
+++ b/tests/robotests/src/com/android/settings/core/SubSettingLauncherTest.java
@@ -37,6 +37,7 @@
 import com.android.settings.SettingsActivity;
 import com.android.settings.testutils.shadow.ShadowUtils;
 import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
+import com.android.settingslib.transition.SettingsTransitionHelper;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -97,6 +98,7 @@
                 .setDestination(SubSettingLauncherTest.class.getName())
                 .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
                 .setSourceMetricsCategory(123)
+                .setTransitionType(SettingsTransitionHelper.TransitionType.TRANSITION_SLIDE)
                 .launch();
         doNothing().when(launcher).launch(any(Intent.class));
         verify(launcher).launch(intentArgumentCaptor.capture());
@@ -109,6 +111,8 @@
         assertThat(intent.getFlags()).isEqualTo(Intent.FLAG_ACTIVITY_NEW_TASK);
         assertThat(intent.getIntExtra(MetricsFeatureProvider.EXTRA_SOURCE_METRICS_CATEGORY, -1))
                 .isEqualTo(123);
+        assertThat(intent.getIntExtra(SettingsBaseActivity.EXTRA_PAGE_TRANSITION_TYPE, -1))
+                .isEqualTo(SettingsTransitionHelper.TransitionType.TRANSITION_SLIDE);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/display/BrightnessLevelPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/BrightnessLevelPreferenceControllerTest.java
index 8fd847a..4948986 100644
--- a/tests/robotests/src/com/android/settings/display/BrightnessLevelPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/BrightnessLevelPreferenceControllerTest.java
@@ -25,9 +25,12 @@
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
+import static org.robolectric.Shadows.shadowOf;
 
+import android.app.Activity;
 import android.content.ContentResolver;
 import android.content.Context;
+import android.content.Intent;
 import android.hardware.display.BrightnessInfo;
 import android.os.PowerManager;
 import android.provider.Settings.System;
@@ -36,14 +39,19 @@
 import androidx.preference.Preference;
 import androidx.preference.PreferenceScreen;
 
+import com.android.settings.core.SettingsBaseActivity;
+import com.android.settingslib.transition.SettingsTransitionHelper;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
+import org.robolectric.Robolectric;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
 import org.robolectric.shadow.api.Shadow;
+import org.robolectric.shadows.ShadowActivity;
 import org.robolectric.shadows.ShadowApplication;
 import org.robolectric.shadows.ShadowContentResolver;
 
@@ -178,4 +186,20 @@
         mController.updateState(mPreference);
         verify(mPreference).setSummary("0%");
     }
+
+    @Test
+    public void handlePreferenceTreeClick_transitionTypeNone_shouldPassToNextActivity() {
+        final Activity activity = Robolectric.setupActivity(Activity.class);
+        final BrightnessLevelPreferenceController controller =
+                new BrightnessLevelPreferenceController(activity, null);
+        final ShadowActivity shadowActivity = shadowOf(activity);
+        when(mPreference.getKey()).thenReturn("brightness");
+
+        controller.handlePreferenceTreeClick(mPreference);
+
+        final Intent intent = shadowActivity.getNextStartedActivity();
+        assertThat(intent.getIntExtra(SettingsBaseActivity.EXTRA_PAGE_TRANSITION_TYPE, 0))
+                .isEqualTo(SettingsTransitionHelper.TransitionType.TRANSITION_NONE);
+
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/gestures/GestureNavigationSettingsAssistControllerTest.java b/tests/robotests/src/com/android/settings/gestures/GestureNavigationSettingsAssistControllerTest.java
new file mode 100644
index 0000000..e0dadee
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/gestures/GestureNavigationSettingsAssistControllerTest.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.gestures;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.ResolveInfo;
+import android.content.pm.ServiceInfo;
+import android.provider.Settings;
+
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.internal.R;
+import com.android.settings.testutils.shadow.SettingsShadowResources;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.Shadows;
+import org.robolectric.annotation.Config;
+import org.robolectric.shadows.ShadowPackageManager;
+
+@RunWith(RobolectricTestRunner.class)
+@Config(shadows = SettingsShadowResources.class)
+public class GestureNavigationSettingsAssistControllerTest {
+
+    private static final String KEY_SWIPE_FOR_ASSIST = "assistant_gesture_corner_swipe";
+    private static final String ACTION_QUICKSTEP = "android.intent.action.QUICKSTEP_SERVICE";
+    private GestureNavigationSettingsAssistController mController;
+
+    private Context mContext;
+
+    @Before
+    public void setUp() {
+        mContext = ApplicationProvider.getApplicationContext();
+
+        // This sets up SystemNavigationPreferenceController.isGestureAvailable() so it returns true
+        SettingsShadowResources.overrideResource(R.bool.config_swipe_up_gesture_setting_available,
+                true);
+        final String recentsComponentPackageName = "recents.component";
+        SettingsShadowResources.overrideResource(R.string.config_recentsComponentName,
+                recentsComponentPackageName + "/.ComponentName");
+        final Intent quickStepIntent = new Intent(ACTION_QUICKSTEP)
+                .setPackage(recentsComponentPackageName);
+        final ResolveInfo info = new ResolveInfo();
+        info.serviceInfo = new ServiceInfo();
+        info.resolvePackageName = recentsComponentPackageName;
+        info.serviceInfo.packageName = info.resolvePackageName;
+        info.serviceInfo.name = recentsComponentPackageName;
+        info.serviceInfo.applicationInfo = new ApplicationInfo();
+        info.serviceInfo.applicationInfo.flags = ApplicationInfo.FLAG_SYSTEM;
+        ShadowPackageManager shadowPackageManager = Shadows.shadowOf(mContext.getPackageManager());
+        shadowPackageManager.addResolveInfoForIntent(quickStepIntent, info);
+
+        mController = new GestureNavigationSettingsAssistController(mContext, KEY_SWIPE_FOR_ASSIST);
+    }
+
+    @Test
+    public void isAvailable_systemNavigationControllerReturnsTrue_shouldReturnTrue() {
+        assertThat(mController.isAvailable()).isTrue();
+    }
+
+    @Test
+    public void isAvailable_systemNavigationControllerReturnsFalse_shouldReturnFalse() {
+        SettingsShadowResources.overrideResource(R.bool.config_swipe_up_gesture_setting_available,
+                false);
+        assertThat(mController.isAvailable()).isFalse();
+    }
+
+    @Test
+    public void isChecked_noDefault_true() {
+        assertThat(mController.isChecked()).isTrue();
+    }
+
+    @Test
+    public void isChecked_valueFalse_shouldReturnFalse() {
+        Settings.Secure.putInt(mContext.getContentResolver(),
+                Settings.Secure.ASSIST_TOUCH_GESTURE_ENABLED, 0);
+        assertThat(mController.isChecked()).isFalse();
+    }
+
+    @Test
+    public void isChecked_valueTrue_shouldReturnTrue() {
+        Settings.Secure.putInt(mContext.getContentResolver(),
+                Settings.Secure.ASSIST_TOUCH_GESTURE_ENABLED, 1);
+        assertThat(mController.isChecked()).isTrue();
+    }
+
+    @Test
+    public void onPreferenceChange_preferenceChecked_valueTrue() {
+        mController.onPreferenceChange(null, true);
+        assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
+                Settings.Secure.ASSIST_TOUCH_GESTURE_ENABLED, -1)).isEqualTo(1);
+    }
+
+    @Test
+    public void onPreferenceChange_preferenceUnchecked_valueFalse() {
+        mController.onPreferenceChange(null, false);
+        assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
+                Settings.Secure.ASSIST_TOUCH_GESTURE_ENABLED, -1)).isEqualTo(0);
+    }
+}