Change the illustration in one-hand mode page.

- Different one-hand modes need to display different illustrations.

Fix: 191334556
Test: rebotest and see the UI
Change-Id: Id6edba40142e008c618fdb3536424edd2b77f9b0
diff --git a/res/raw/lottie_swipe_for_notifications.json b/res/raw/lottie_swipe_for_notifications.json
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/res/raw/lottie_swipe_for_notifications.json
diff --git a/src/com/android/settings/gestures/OneHandedSettings.java b/src/com/android/settings/gestures/OneHandedSettings.java
index 6d1cbfd..51c6b66 100644
--- a/src/com/android/settings/gestures/OneHandedSettings.java
+++ b/src/com/android/settings/gestures/OneHandedSettings.java
@@ -16,19 +16,18 @@
 
 package com.android.settings.gestures;
 
+import android.app.Activity;
 import android.app.settings.SettingsEnums;
 import android.content.ComponentName;
 import android.content.Context;
 import android.os.Bundle;
 import android.os.UserHandle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
 
 import com.android.internal.accessibility.AccessibilityShortcutController;
 import com.android.settings.R;
 import com.android.settings.accessibility.AccessibilityShortcutPreferenceFragment;
 import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.widget.IllustrationPreference;
 
 /**
  * Fragment for One-handed mode settings
@@ -37,13 +36,27 @@
  * providing basic accessibility shortcut service setup.
  */
 public class OneHandedSettings extends AccessibilityShortcutPreferenceFragment {
+
     private static final String ONE_HANDED_SHORTCUT_KEY = "one_handed_shortcuts_preference";
+    private static final String ONE_HANDED_ILLUSTRATION_KEY = "one_handed_header";
     private String mFeatureName;
+    private OneHandedSettingsUtils mUtils;
 
     @Override
     protected void updatePreferenceStates() {
         OneHandedSettingsUtils.setUserId(UserHandle.myUserId());
         super.updatePreferenceStates();
+
+        final IllustrationPreference preference =
+                (IllustrationPreference) getPreferenceScreen().findPreference(
+                        ONE_HANDED_ILLUSTRATION_KEY);
+        if (preference != null) {
+            final boolean isSwipeDownNotification =
+                    OneHandedSettingsUtils.isSwipeDownNotificationEnabled(getContext());
+            preference.setLottieAnimationResId(
+                    isSwipeDownNotification ? R.raw.lottie_swipe_for_notifications
+                            : R.raw.lottie_one_hand_mode);
+        }
     }
 
     @Override
@@ -69,9 +82,21 @@
     }
 
     @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-            Bundle savedInstanceState) {
-        return super.onCreateView(inflater, container, savedInstanceState);
+    public void onStart() {
+        super.onStart();
+        mUtils = new OneHandedSettingsUtils(this.getContext());
+        mUtils.registerToggleAwareObserver(uri -> {
+            Activity activity = getActivity();
+            if (activity != null) {
+                activity.runOnUiThread(() -> updatePreferenceStates());
+            }
+        });
+    }
+
+    @Override
+    public void onStop() {
+        super.onStop();
+        mUtils.unregisterToggleAwareObserver();
     }
 
     @Override