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

Commit 3badad79 authored by ryanlwlin's avatar ryanlwlin
Browse files

Show notification to promote window magnification mode available

The magnification mode is full-screen when the migrating deivce turns on
magnification settings.
We show a notification prompt the user that new window magnifier to
guide the user to take a look.

Bug: 168635084
Test: 1. adb shell settings put secure \
      accessibility_show_window_magnification_prompt 1
      2. use full-screen magnification to see if it works well.
      atest WindowMagnificationPromptControllerTest
      atest FullScreenMagnificationGestureHandlerTest
Change-Id: I40dfc49307d2dad380f1e662960d35f5cc5e7524
parent 54e28edd
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ public class SystemNotificationChannels {
    public static String HEAVY_WEIGHT_APP = "HEAVY_WEIGHT_APP";
    public static String SYSTEM_CHANGES = "SYSTEM_CHANGES";
    public static String DO_NOT_DISTURB = "DO_NOT_DISTURB";
    public static String ACCESSIBILITY_MAGNIFICATION = "ACCESSIBILITY_MAGNIFICATION";

    public static void createAll(Context context) {
        final NotificationManager nm = context.getSystemService(NotificationManager.class);
@@ -191,6 +192,13 @@ public class SystemNotificationChannels {
                NotificationManager.IMPORTANCE_LOW);
        channelsList.add(dndChanges);

        final NotificationChannel newFeaturePrompt = new NotificationChannel(
                ACCESSIBILITY_MAGNIFICATION,
                context.getString(R.string.notification_channel_accessibility_magnification),
                NotificationManager.IMPORTANCE_HIGH);
        newFeaturePrompt.setBlockable(true);
        channelsList.add(newFeaturePrompt);

        nm.createNotificationChannels(channelsList);
    }

+16 −0
Original line number Diff line number Diff line
@@ -717,6 +717,10 @@
        [CHAR LIMIT=NONE BACKUP_MESSAGE_ID=6665375982962336520] -->
    <string name="notification_channel_foreground_service">Apps consuming battery</string>

    <!-- Text shown when viewing channel settings for notifications related to accessibility
         magnification. [CHAR_LIMIT=NONE]-->
    <string name="notification_channel_accessibility_magnification">Magnification</string>

    <!-- Label for foreground service notification when one app is running.
    [CHAR LIMIT=NONE BACKUP_MESSAGE_ID=6826789589341671842] -->
    <string name="foreground_service_app_in_background"><xliff:g id="app_name">%1$s</xliff:g> is
@@ -5767,4 +5771,16 @@ ul.</string>
    <string name="config_pdp_reject_service_not_subscribed"></string>
    <!-- pdp data reject dialog string for cause 55 (MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED) [CHAR LIMIT=100] -->
    <string name="config_pdp_reject_multi_conn_to_same_pdn_not_allowed"></string>

    <!-- Window magnification prompt related string. -->

    <!-- Notification title to prompt the user that new magnification feature is available. [CHAR LIMIT=50] -->
    <string name="window_magnification_prompt_title">New: Window Magnifier</string>
    <!-- Notification content to prompt the user that new magnification feature is available. [CHAR LIMIT=50] -->
    <string name="window_magnification_prompt_content">You can now magnify some or all of your screen</string>
    <!-- Notification action to bring the user to magnification settings page. [CHAR LIMIT=50] -->
    <string name="turn_on_magnification_settings_action">Turn on in Settings</string>
    <!-- Notification action to dismiss. [CHAR LIMIT=50] -->
    <string name="dismiss_action">Dismiss</string>

</resources>
+7 −0
Original line number Diff line number Diff line
@@ -3460,6 +3460,7 @@
  <java-symbol type="string" name="notification_channel_heavy_weight_app" />
  <java-symbol type="string" name="notification_channel_system_changes" />
  <java-symbol type="string" name="notification_channel_do_not_disturb" />
  <java-symbol type="string" name="notification_channel_accessibility_magnification" />
  <java-symbol type="string" name="config_defaultAutofillService" />
  <java-symbol type="string" name="config_defaultTextClassifierPackage" />
  <java-symbol type="string" name="config_defaultWellbeingPackage" />
@@ -4097,4 +4098,10 @@
  <java-symbol type="dimen" name="config_taskLetterboxAspectRatio" />

  <java-symbol type="bool" name="config_hideDisplayCutoutWithDisplayArea" />

  <!-- Window magnification prompt -->
  <java-symbol type="string" name="window_magnification_prompt_title" />
  <java-symbol type="string" name="window_magnification_prompt_content" />
  <java-symbol type="string" name="turn_on_magnification_settings_action" />
  <java-symbol type="string" name="dismiss_action" />
</resources>
+4 −0
Original line number Diff line number Diff line
@@ -332,5 +332,9 @@ message SystemMessage {
    // Notify the user that the admin suspended personal apps on the device.
    // Package: android
    NOTE_PERSONAL_APPS_SUSPENDED = 1003;

    // Notify the user that window magnification is available.
    // package: android
    NOTE_A11Y_WINDOW_MAGNIFICATION_FEATURE = 1004;
  }
}
+4 −2
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.server.accessibility.gestures.TouchExplorer;
import com.android.server.accessibility.magnification.FullScreenMagnificationGestureHandler;
import com.android.server.accessibility.magnification.MagnificationGestureHandler;
import com.android.server.accessibility.magnification.WindowMagnificationGestureHandler;
import com.android.server.accessibility.magnification.WindowMagnificationPromptController;
import com.android.server.policy.WindowManagerPolicy;

import java.util.ArrayList;
@@ -561,8 +562,9 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo
                    detectControlGestures, triggerable, displayId);
        } else {
            magnificationGestureHandler = new FullScreenMagnificationGestureHandler(displayContext,
                    mAms.getFullScreenMagnificationController(), mAms::onMagnificationScaleChanged,
                    detectControlGestures, triggerable, displayId);
                    mAms.getFullScreenMagnificationController(),
                    mAms::onMagnificationScaleChanged, detectControlGestures, triggerable,
                    new WindowMagnificationPromptController(displayContext, mUserId), displayId);
        }
        return magnificationGestureHandler;
    }
Loading